blob: 256da0d1d760f4196eea98db9beec9d92834d2a0 [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 Ronquillo6046ce32020-06-18 11:06:29 -07005# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07006
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
Jeremy Ronquillo223db002020-06-05 10:28:22 -070036
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