blob: 11d1218030382ab03102cc794ca88f90ae0c6377 [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
46
47# Generate certs
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060048MME_IDENTITY={{ tuple "mme" "identity" . | include "omec-control-plane.endpoint_lookup" | quote }};
Hyunsun Moon636e17d2019-07-03 12:52:15 -050049DIAMETER_HOST=$(echo $MME_IDENTITY | cut -d'.' -f1)
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060050DIAMETER_REALM={{ tuple "mme" "realm" . | include "omec-control-plane.endpoint_lookup" | quote }};
Hyunsun Moon636e17d2019-07-03 12:52:15 -050051
52cp /openmme/target/conf/make_certs.sh /opt/mme/config/shared/make_certs.sh
53cd /opt/mme/config/shared
54./make_certs.sh $DIAMETER_HOST $DIAMETER_REALM