Make more use of .env file for populating configuration in .yaml files

This commit is contained in:
herlesupreeth
2020-07-21 12:17:15 +02:00
parent 81a4a25917
commit 4984a18dee
9 changed files with 61 additions and 29 deletions

28
.env
View File

@@ -1,12 +1,11 @@
IMS_DOMAIN=ims.mnc001.mcc001.3gppnetwork.org
EPC_DOMAIN=epc.mnc001.mcc001.3gppnetwork.org
TEST_NETWORK=172.22.0.0/24
MCC=001
MNC=01
TEST_NETWORK=172.22.0.0/24
DOCKER_HOST_IP=192.168.1.223
# MONGODB
MONGO_IP=172.22.0.2
DB_URI=mongodb://172.22.0.2/open5gs
# HSS - open5gs
HSS_IP=172.22.0.3
@@ -22,3 +21,24 @@ PGW_IP=172.22.0.6
# MME
MME_IP=172.22.0.7
# DNS
DNS_IP=172.22.0.8
# RTPENGINE
RTPENGINE_IP=172.22.0.9
# MYSQL
MYSQL_IP=172.22.0.10
# FHOSS
FHOSS_IP=172.22.0.11
# ICSCF
ICSCF_IP=172.22.0.12
# SCSCF
SCSCF_IP=172.22.0.13
# PCSCF
PCSCF_IP=172.22.0.14

View File

@@ -9,8 +9,8 @@ parameter:
hss:
freeDiameter:
identity: hss.epc.mnc001.mcc001.3gppnetwork.org
realm: epc.mnc001.mcc001.3gppnetwork.org
identity: hss.EPC_DOMAIN
realm: EPC_DOMAIN
port: 3868
sec_port: 5868
listen_on: HSS_IP
@@ -24,6 +24,6 @@ hss:
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx
connect:
- identity: mme.epc.mnc001.mcc001.3gppnetwork.org
- identity: mme.EPC_DOMAIN
addr: MME_IP
port: 3868

View File

@@ -29,8 +29,10 @@
cd webui && npm run dev &
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
[ ${#MNC} == 3 ] && EPC_DOMAIN="epc.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || EPC_DOMAIN="epc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
cp /mnt/hss/hss.yaml install/etc/open5gs
sed -i 's|HSS_IP|'$IP_ADDR'|g' install/etc/open5gs/hss.yaml
sed -i 's|MME_IP|'$MME_IP'|g' install/etc/open5gs/hss.yaml
sed -i 's|MONGO_IP|'$MONGO_IP'|g' install/etc/open5gs/hss.yaml
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/open5gs/hss.yaml

View File

@@ -7,8 +7,8 @@ parameter:
mme:
freeDiameter:
identity: mme.epc.mnc001.mcc001.3gppnetwork.org
realm: epc.mnc001.mcc001.3gppnetwork.org
identity: mme.EPC_DOMAIN
realm: EPC_DOMAIN
port: 3868
sec_port: 5868
listen_on: MME_IP
@@ -22,7 +22,7 @@ mme:
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx
connect:
- identity: hss.epc.mnc001.mcc001.3gppnetwork.org
- identity: hss.EPC_DOMAIN
addr: HSS_IP
port: 3868
s1ap:
@@ -31,14 +31,14 @@ mme:
dev: MME_IF
gummei:
plmn_id:
mcc: 001
mnc: 01
mcc: MCC
mnc: MNC
mme_gid: 2
mme_code: 1
tai:
plmn_id:
mcc: 001
mnc: 01
mcc: MCC
mnc: MNC
tac: 1
security:
integrity_order : [ EIA1, EIA2, EIA0 ]

View File

@@ -29,10 +29,14 @@
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
export IF_NAME=$(ip r | awk '/default/ { print $5 }')
[ ${#MNC} == 3 ] && EPC_DOMAIN="epc.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || EPC_DOMAIN="epc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
cp /mnt/mme/mme.yaml install/etc/open5gs
sed -i 's|MNC|'$MNC'|g' install/etc/open5gs/mme.yaml
sed -i 's|MCC|'$MCC'|g' install/etc/open5gs/mme.yaml
sed -i 's|MME_IP|'$IP_ADDR'|g' install/etc/open5gs/mme.yaml
sed -i 's|MME_IF|'$IF_NAME'|g' install/etc/open5gs/mme.yaml
sed -i 's|HSS_IP|'$HSS_IP'|g' install/etc/open5gs/mme.yaml
sed -i 's|SGW_IP|'$SGW_IP'|g' install/etc/open5gs/mme.yaml
sed -i 's|PGW_IP|'$PGW_IP'|g' install/etc/open5gs/mme.yaml
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/open5gs/mme.yaml

View File

@@ -9,8 +9,8 @@ parameter:
pcrf:
freeDiameter:
identity: pcrf.epc.mnc001.mcc001.3gppnetwork.org
realm: epc.mnc001.mcc001.3gppnetwork.org
identity: pcrf.EPC_DOMAIN
realm: EPC_DOMAIN
port: 3868
sec_port: 5868
listen_on: PCRF_IP
@@ -24,9 +24,9 @@ pcrf:
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx
connect:
- identity: pgw.epc.mnc001.mcc001.3gppnetwork.org
- identity: pgw.EPC_DOMAIN
addr: PGW_IP
port: 3868
- identity: pcscf.ims.mnc001.mcc001.3gppnetwork.org
addr: 10.4.128.21
- identity: pcscf.IMS_DOMAIN
addr: PCSCF_IP
port: 3871

View File

@@ -28,9 +28,13 @@
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
[ ${#MNC} == 3 ] && EPC_DOMAIN="epc.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || EPC_DOMAIN="epc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
[ ${#MNC} == 3 ] && IMS_DOMAIN="ims.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || IMS_DOMAIN="ims.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
cp /mnt/pcrf/pcrf.yaml install/etc/open5gs
sed -i 's|MONGO_IP|'$MONGO_IP'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|NAME|'$NAME'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|REALM|'$REALM'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|PCRF_IP|'$IP_ADDR'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|PGW_IP|'$PGW_IP'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|IMS_DOMAIN|'$IMS_DOMAIN'|g' install/etc/open5gs/pcrf.yaml
sed -i 's|PCSCF_IP|'$PCSCF_IP'|g' install/etc/open5gs/pcrf.yaml

View File

@@ -7,8 +7,8 @@ parameter:
pgw:
freeDiameter:
identity: pgw.epc.mnc001.mcc001.3gppnetwork.org
realm: epc.mnc001.mcc001.3gppnetwork.org
identity: pgw.EPC_DOMAIN
realm: EPC_DOMAIN
port: 3868
sec_port: 5868
listen_on: PGW_IP
@@ -22,7 +22,7 @@ pgw:
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx
- module: /open5gs/install/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx
connect:
- identity: pcrf.epc.mnc001.mcc001.3gppnetwork.org
- identity: pcrf.EPC_DOMAIN
addr: PCRF_IP
port: 3868
gtpc:
@@ -47,4 +47,4 @@ pgw:
- 2001:4860:4860::8888
- 2001:4860:4860::8844
p-cscf:
- 10.4.128.21
- PCSCF_IP

View File

@@ -34,9 +34,11 @@ export IF_NAME=$(ip r | awk '/default/ { print $5 }')
python3 /mnt/pgw/tun_if.py --tun_ifname ogstun --ipv4_range 192.168.100.0/24 --ipv6_range fd84:6aea:c36e:2b69::/64
python3 /mnt/pgw/tun_if.py --tun_ifname ogstun2 --ipv4_range 192.168.101.0/24 --ipv6_range fd1f:76f3:da9b:0101::/64 --nat_rule 'no'
[ ${#MNC} == 3 ] && EPC_DOMAIN="epc.mnc${MNC}.mcc${MCC}.3gppnetwork.org" || EPC_DOMAIN="epc.mnc0${MNC}.mcc${MCC}.3gppnetwork.org"
cp /mnt/pgw/pgw.yaml install/etc/open5gs
sed -i 's|PGW_IP|'$IP_ADDR'|g' install/etc/open5gs/pgw.yaml
sed -i 's|PGW_IF|'$IF_NAME'|g' install/etc/open5gs/pgw.yaml
sed -i 's|PCRF_IP|'$PCRF_IP'|g' install/etc/open5gs/pgw.yaml
sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/open5gs/pgw.yaml
sed -i 's|PCSCF_IP|'$PCSCF_IP'|g' install/etc/open5gs/pgw.yaml