Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | #!/bin/sh |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | # Copyright 2019-present Open Networking Foundation |
| 4 | # |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 5 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 6 | |
| 7 | set -ex |
| 8 | |
| 9 | cp /opt/mme/config/config.json /opt/mme/config/shared/config.json |
| 10 | cd /opt/mme/config/shared |
| 11 | |
| 12 | # Set local IP address for s1ap and s11 networks to the config |
| 13 | jq --arg MME_LOCAL_IP "$POD_IP" '.mme.ip_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json |
| 14 | jq --arg MME_LOCAL_IP "$POD_IP" '.s1ap.s1ap_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json |
| 15 | jq --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 |
| 20 | SPGWC_ADDR=$(dig +short +search {{ .Values.config.mme.spgwAddr }}) |
| 21 | jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.sgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json |
| 22 | jq --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 |
| 25 | HSS_TYPE=$(jq -r '.s6a.host_type' config.json) |
| 26 | HSS_HOST=$(jq -r '.s6a.host' config.json) |
| 27 | jq --arg HSS_TYPE "$HSS_TYPE" '.s6a.hss_type=$HSS_TYPE' config.json > config.tmp && mv config.tmp config.json |
| 28 | jq --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 |
| 31 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/mme.json |
| 32 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s11.json |
| 33 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s1ap.json |
| 34 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s6a.json |
| 35 | cp /opt/mme/config/s6a_fd.conf /opt/mme/config/shared/s6a_fd.conf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 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 |
| 39 | cp /opt/mme/config/shared/* /openmme/target/conf/ |
| 40 | |
| 41 | # Generate certs |
| 42 | MME_IDENTITY={{ tuple "mme" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }}; |
| 43 | DIAMETER_HOST=$(echo $MME_IDENTITY | cut -d'.' -f1) |
| 44 | DIAMETER_REALM={{ tuple "mme" "realm" . | include "omec-control-plane.diameter_endpoint" | quote }}; |
| 45 | |
| 46 | cp /openmme/target/conf/make_certs.sh /opt/mme/config/shared/make_certs.sh |
| 47 | cd /opt/mme/config/shared |
| 48 | ./make_certs.sh $DIAMETER_HOST $DIAMETER_REALM |