blob: 86a85533184fb84b06b4659198de557ee198d1fc [file] [log] [blame]
badhri854c028b32021-11-03 18:24:05 -05001#!/bin/sh
2
3# Copyright 2019-present Open Networking Foundation
4#
Ajay Lotan Thakur03189d22022-02-10 14:06:03 -06005# SPDX-License-Identifier: Apache-2.0
badhri854c028b32021-11-03 18:24:05 -05006
7set -ex
8
9cp /opt/mme/config/config.json /opt/mme/config/shared/config.json
10cd /opt/mme/config/shared
11
12# Set local IP address for s1ap and s11 networks to the config
13jq --arg MME_LOCAL_IP "$POD_IP" '.mme.ip_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
14jq --arg MME_LOCAL_IP "$POD_IP" '.s1ap.s1ap_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
15jq --arg MME_LOCAL_IP "$POD_IP" '.s11.egtp_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
16
17# Set SPGWC address to the config
18# We need to convert service domain name to actual IP address
19# because mme apps does not take domain address - should be fixed in openmme
20SPGWC_ADDR=$(dig +short +search {{ .Values.config.mme.spgwAddr }})
21jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.sgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json
22jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.pgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json
23
24# Add additional redundant keys - should be fixed in openmme
25HSS_TYPE=$(jq -r '.s6a.host_type' config.json)
26HSS_HOST=$(jq -r '.s6a.host' config.json)
27jq --arg HSS_TYPE "$HSS_TYPE" '.s6a.hss_type=$HSS_TYPE' config.json > config.tmp && mv config.tmp config.json
28jq --arg HSS_HOST "$HSS_HOST" '.s6a.host_name=$HSS_HOST' config.json > config.tmp && mv config.tmp config.json
29
30# Copy the final configs for each applications
31cp /opt/mme/config/shared/config.json /opt/mme/config/shared/mme.json
32cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s11.json
33cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s1ap.json
34cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s6a.json
35cp /opt/mme/config/s6a_fd.conf /opt/mme/config/shared/s6a_fd.conf
36
37#This multiple copies of config needs some cleanup. For now I want
38#that after running mme_init config to be present in the target directory
39cp /opt/mme/config/shared/* /openmme/target/conf/
40
41# Generate certs
42MME_IDENTITY={{ tuple "mme" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }};
43DIAMETER_HOST=$(echo $MME_IDENTITY | cut -d'.' -f1)
44DIAMETER_REALM={{ tuple "mme" "realm" . | include "omec-control-plane.diameter_endpoint" | quote }};
45
46cp /openmme/target/conf/make_certs.sh /opt/mme/config/shared/make_certs.sh
47cd /opt/mme/config/shared
48./make_certs.sh $DIAMETER_HOST $DIAMETER_REALM