Hyunsun Moon | 06f9855 | 2019-08-15 13:44:47 -0600 | [diff] [blame] | 1 | #!/bin/sh |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 2 | # |
| 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 | |
| 17 | set -ex |
| 18 | |
| 19 | cp /opt/mme/config/config.json /opt/mme/config/shared/config.json |
| 20 | cd /opt/mme/config/shared |
| 21 | |
| 22 | # Set local IP address for s1ap and s11 networks to the config |
Hyunsun Moon | 16d7092 | 2019-08-25 04:57:25 -0500 | [diff] [blame] | 23 | jq --arg MME_LOCAL_IP "$POD_IP" '.mme.ip_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json |
| 24 | jq --arg MME_LOCAL_IP "$POD_IP" '.s1ap.s1ap_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json |
| 25 | jq --arg MME_LOCAL_IP "$POD_IP" '.s11.egtp_local_addr=$MME_LOCAL_IP' config.json > config.tmp && mv config.tmp config.json |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 26 | |
Hyunsun Moon | 16d7092 | 2019-08-25 04:57:25 -0500 | [diff] [blame] | 27 | # 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 |
| 30 | SPGWC_ADDR=$(dig +short +search {{ .Values.config.mme.spgwAddr }}) |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 31 | jq --arg SPGWC_ADDR "$SPGWC_ADDR" '.s11.sgw_addr //= $SPGWC_ADDR' config.json > config.tmp && mv config.tmp config.json |
| 32 | jq --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 |
| 35 | HSS_TYPE=$(jq -r '.s6a.host_type' config.json) |
| 36 | HSS_HOST=$(jq -r '.s6a.host' config.json) |
| 37 | jq --arg HSS_TYPE "$HSS_TYPE" '.s6a.hss_type=$HSS_TYPE' config.json > config.tmp && mv config.tmp config.json |
| 38 | jq --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 |
| 41 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/mme.json |
| 42 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s11.json |
| 43 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s1ap.json |
| 44 | cp /opt/mme/config/shared/config.json /opt/mme/config/shared/s6a.json |
| 45 | cp /opt/mme/config/s6a_fd.conf /opt/mme/config/shared/s6a_fd.conf |
| 46 | |
| 47 | # Generate certs |
Hyunsun Moon | 7a007bb | 2019-08-19 16:41:36 -0600 | [diff] [blame] | 48 | MME_IDENTITY={{ tuple "mme" "identity" . | include "omec-control-plane.endpoint_lookup" | quote }}; |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 49 | DIAMETER_HOST=$(echo $MME_IDENTITY | cut -d'.' -f1) |
Hyunsun Moon | 7a007bb | 2019-08-19 16:41:36 -0600 | [diff] [blame] | 50 | DIAMETER_REALM={{ tuple "mme" "realm" . | include "omec-control-plane.endpoint_lookup" | quote }}; |
Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [diff] [blame] | 51 | |
| 52 | cp /openmme/target/conf/make_certs.sh /opt/mme/config/shared/make_certs.sh |
| 53 | cd /opt/mme/config/shared |
| 54 | ./make_certs.sh $DIAMETER_HOST $DIAMETER_REALM |