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