blob: 76948b75be44f284de15d4ef44224a756f87b4f7 [file] [log] [blame]
Hyunsun Moon06f98552019-08-15 13:44:47 -06001#!/bin/sh
Hyunsun Moon636e17d2019-07-03 12:52:15 -05002#
3# Copyright 2019-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -ex
18
19cp /opt/mme/config/config.json /opt/mme/config/shared/config.json
20cd /opt/mme/config/shared
21
22# Set local IP address for s1ap and s11 networks to the config
Hyunsun Moon16d70922019-08-25 04:57:25 -050023jq --arg MME_LOCAL_IP "$POD_IP" '.mme.ip_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
24jq --arg MME_LOCAL_IP "$POD_IP" '.s1ap.s1ap_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
25jq --arg MME_LOCAL_IP "$POD_IP" '.s11.egtp_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json
Hyunsun Moon636e17d2019-07-03 12:52:15 -050026
Hyunsun Moon16d70922019-08-25 04:57:25 -050027# Set SPGWC address to the config
28# We need to convert service domain name to actual IP address
29# because mme apps does not take domain address - should be fixed in openmme
30SPGWC_ADDR=$(dig +short +search {{ .Values.config.mme.spgwAddr }})
Hyunsun Moon636e17d2019-07-03 12:52:15 -050031jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.sgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json
32jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.pgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json
33
34# Add additional redundant keys - should be fixed in openmme
35HSS_TYPE=$(jq -r '.s6a.host_type' config.json)
36HSS_HOST=$(jq -r '.s6a.host' config.json)
37jq --arg HSS_TYPE "$HSS_TYPE" '.s6a.hss_type=$HSS_TYPE' config.json > config.tmp && mv config.tmp config.json
38jq --arg HSS_HOST "$HSS_HOST" '.s6a.host_name=$HSS_HOST' config.json > config.tmp && mv config.tmp config.json
39
40# Copy the final configs for each applications
41cp /opt/mme/config/shared/config.json /opt/mme/config/shared/mme.json
42cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s11.json
43cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s1ap.json
44cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s6a.json
45cp /opt/mme/config/s6a_fd.conf /opt/mme/config/shared/s6a_fd.conf
Woojoong Kimdde90e32020-02-18 14:43:18 -080046cp /opt/mme/config/mme_exporter.json /opt/mme/config/shared/mme_exporter.json
Hyunsun Moon636e17d2019-07-03 12:52:15 -050047
Ajay Lotan Thakurff2cad62019-12-01 04:41:58 -080048#This multiple copies of config needs some cleanup. For now I want
49#that after running mme_init config to be present in the target directory
50cp /opt/mme/config/shared/* /openmme/target/conf/
51
Hyunsun Moon636e17d2019-07-03 12:52:15 -050052# Generate certs
Hyunsun Moon2eede662019-10-11 13:11:44 -060053MME_IDENTITY={{ tuple "mme" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }};
Hyunsun Moon636e17d2019-07-03 12:52:15 -050054DIAMETER_HOST=$(echo $MME_IDENTITY | cut -d'.' -f1)
Hyunsun Moon2eede662019-10-11 13:11:44 -060055DIAMETER_REALM={{ tuple "mme" "realm" . | include "omec-control-plane.diameter_endpoint" | quote }};
Hyunsun Moon636e17d2019-07-03 12:52:15 -050056
57cp /openmme/target/conf/make_certs.sh /opt/mme/config/shared/make_certs.sh
58cd /opt/mme/config/shared
59./make_certs.sh $DIAMETER_HOST $DIAMETER_REALM