Include slicing under custom deployment scenarios
This commit is contained in:
156
custom_deployments/slicing/.custom_env
Normal file
156
custom_deployments/slicing/.custom_env
Normal file
@@ -0,0 +1,156 @@
|
||||
# Set proper timezone to sync times between docker host and containers
|
||||
#TZ=Europe/Berlin
|
||||
|
||||
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
|
||||
|
||||
# HSS - open5gs
|
||||
HSS_IP=172.22.0.3
|
||||
|
||||
# PCRF
|
||||
PCRF_IP=172.22.0.4
|
||||
PCRF_BIND_PORT=3873
|
||||
|
||||
# SGW
|
||||
SGWC_IP=172.22.0.5
|
||||
SGWU_IP=172.22.0.6
|
||||
SGWU_ADVERTISE_IP=172.22.0.6
|
||||
|
||||
# SMF
|
||||
SMF_IP=172.22.0.7
|
||||
SMF_DNS1=8.8.8.8
|
||||
SMF_DNS2=8.8.4.4
|
||||
SMF2_IP=172.22.0.100
|
||||
|
||||
# UPF
|
||||
UPF_IP=172.22.0.8
|
||||
UPF_ADVERTISE_IP=172.22.0.8
|
||||
UPF2_IP=172.22.0.90
|
||||
UPF2_ADVERTISE_IP=172.22.0.90
|
||||
|
||||
# MME
|
||||
MME_IP=172.22.0.9
|
||||
|
||||
# AMF
|
||||
AMF_IP=172.22.0.10
|
||||
|
||||
# AUSF
|
||||
AUSF_IP=172.22.0.11
|
||||
|
||||
# NRF
|
||||
NRF_IP=172.22.0.12
|
||||
|
||||
# UDM
|
||||
UDM_IP=172.22.0.13
|
||||
|
||||
# UDR
|
||||
UDR_IP=172.22.0.14
|
||||
|
||||
# IMS DNS
|
||||
DNS_IP=172.22.0.15
|
||||
|
||||
# RTPENGINE
|
||||
RTPENGINE_IP=172.22.0.16
|
||||
|
||||
# MYSQL
|
||||
MYSQL_IP=172.22.0.17
|
||||
|
||||
# PYHSS
|
||||
PYHSS_IP=172.22.0.18
|
||||
PYHSS_BIND_PORT=3875
|
||||
|
||||
# ICSCF
|
||||
ICSCF_IP=172.22.0.19
|
||||
ICSCF_BIND_PORT=3869
|
||||
|
||||
# SCSCF
|
||||
SCSCF_IP=172.22.0.20
|
||||
SCSCF_BIND_PORT=3870
|
||||
|
||||
# PCSCF
|
||||
PCSCF_IP=172.22.0.21
|
||||
PCSCF_BIND_PORT=3871
|
||||
|
||||
# SRSLTE ENB
|
||||
SRS_ENB_IP=172.22.0.22
|
||||
|
||||
# UERANSIM
|
||||
NR_GNB_IP=172.22.0.23
|
||||
NR_UE_IP=172.22.0.24
|
||||
NR_UE2_IP=172.22.0.91
|
||||
|
||||
UE1_IMEI=356938035643803
|
||||
UE1_IMEISV=4370816125816151
|
||||
UE1_IMSI=001011224567895
|
||||
UE1_KI=8baf473f2f8fd09487cccbd7097c6862
|
||||
UE1_OP=11111111111111111111111111111111
|
||||
UE1_AMF=8000
|
||||
|
||||
UE2_IMEI=356938035643804
|
||||
UE2_IMEISV=4370816125816152
|
||||
UE2_IMSI=001011224567896
|
||||
UE2_KI=8baf473f2f8fd09487cccbd7097c6862
|
||||
UE2_OP=11111111111111111111111111111111
|
||||
UE2_AMF=8000
|
||||
|
||||
# OAI ENB
|
||||
OAI_ENB_IP=172.22.0.25
|
||||
|
||||
# OPEN5GS WEBUI
|
||||
WEBUI_IP=172.22.0.26
|
||||
|
||||
# PCF
|
||||
PCF_IP=172.22.0.27
|
||||
|
||||
# NSSF
|
||||
NSSF_IP=172.22.0.28
|
||||
|
||||
# BSF
|
||||
BSF_IP=172.22.0.29
|
||||
|
||||
# ENTITLEMENT SERVER
|
||||
ENTITLEMENT_SERVER_IP=172.22.0.30
|
||||
|
||||
# OSMOMSC
|
||||
OSMOMSC_IP=172.22.0.31
|
||||
|
||||
# OSMOHLR
|
||||
OSMOHLR_IP=172.22.0.32
|
||||
|
||||
# SMSC
|
||||
SMSC_IP=172.22.0.33
|
||||
|
||||
# SRSLTE UE
|
||||
SRS_UE_IP=172.22.0.34
|
||||
|
||||
# SCP
|
||||
SCP_IP=172.22.0.35
|
||||
|
||||
# METRICS
|
||||
METRICS_IP=172.22.0.36
|
||||
|
||||
# SRSRAN GNB
|
||||
SRS_GNB_IP=172.22.0.37
|
||||
|
||||
# GRAFANA
|
||||
GRAFANA_IP=172.22.0.39
|
||||
GRAFANA_USERNAME=open5gs
|
||||
GRAFANA_PASSWORD=open5gs
|
||||
|
||||
# UE IPv4 Subnet Range for APN=internet
|
||||
UE_IPV4_INTERNET=192.168.100.0/24
|
||||
|
||||
# UE IPv4 Subnet Range for APN=ims
|
||||
UE_IPV4_IMS=192.168.101.0/24
|
||||
|
||||
# UE IPv4 Subnet Range for APN=private
|
||||
UE_IPV4_PRIVATE=192.168.101.0/24
|
||||
|
||||
# Maximum Number of UEs
|
||||
MAX_NUM_UE=1024
|
45
custom_deployments/slicing/README.md
Normal file
45
custom_deployments/slicing/README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
## Deployment description
|
||||
|
||||
This custom deployment showcases a slicing scenario by deploying two instances of open5gs SMF and UPF each handling an individual slice configuration.
|
||||
|
||||
## Additional steps
|
||||
|
||||
Most of the steps to be followed are similar to the steps mentioned in the [README in the root folder](../../README.md). However, additional steps mentioned below must be taken into account while deploying this custom deployment scenario.
|
||||
|
||||
### Loading environmental variables for custom deployment
|
||||
|
||||
**Warning**
|
||||
For custom deployments, you must modify/use only the [**.custom_env**](.custom_env) file rather than the [**.env** in the root folder](../../.env).
|
||||
|
||||
```
|
||||
set -a
|
||||
source .custom_env
|
||||
set +a
|
||||
```
|
||||
|
||||
### Scenario deployment
|
||||
|
||||
Deploy the 5G SA network consisting of two slices.
|
||||
|
||||
```
|
||||
cd custom_deployments/slicing
|
||||
docker compose -f sa-deploy.yaml up
|
||||
```
|
||||
|
||||
Deploy UERANSIM gNB (RF simulated).
|
||||
|
||||
```
|
||||
docker compose -f nr-gnb.yaml up -d && docker container attach nr_gnb
|
||||
```
|
||||
|
||||
Deploy UERANSIM NR-UE (RF simulated) for first slice.
|
||||
|
||||
```
|
||||
docker compose -f nr-ue.yaml up -d && docker container attach nr_ue
|
||||
```
|
||||
|
||||
Deploy UERANSIM NR-UE (RF simulated) for second slice.
|
||||
|
||||
```
|
||||
docker compose -f nr-ue2.yaml up -d && docker container attach nr_ue2
|
||||
```
|
62
custom_deployments/slicing/amf/amf.yaml
Normal file
62
custom_deployments/slicing/amf/amf.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
logger:
|
||||
file:
|
||||
path: /open5gs/install/var/log/open5gs/amf.log
|
||||
|
||||
sbi:
|
||||
server:
|
||||
no_tls: true
|
||||
client:
|
||||
no_tls: true
|
||||
|
||||
global:
|
||||
max:
|
||||
ue: MAX_NUM_UE
|
||||
|
||||
amf:
|
||||
sbi:
|
||||
server:
|
||||
- address: AMF_IP
|
||||
port: 7777
|
||||
client:
|
||||
nrf:
|
||||
- uri: http://NRF_IP:7777
|
||||
scp:
|
||||
- uri: http://SCP_IP:7777
|
||||
ngap:
|
||||
server:
|
||||
- address: AMF_IP
|
||||
guami:
|
||||
- plmn_id:
|
||||
mcc: MCC
|
||||
mnc: MNC
|
||||
amf_id:
|
||||
region: 2
|
||||
set: 1
|
||||
tai:
|
||||
- plmn_id:
|
||||
mcc: MCC
|
||||
mnc: MNC
|
||||
tac: 1
|
||||
plmn_support:
|
||||
- plmn_id:
|
||||
mcc: MCC
|
||||
mnc: MNC
|
||||
s_nssai:
|
||||
- sst: 1
|
||||
sd: 000001
|
||||
- sst: 1
|
||||
sd: 000002
|
||||
security:
|
||||
integrity_order : [ NIA2, NIA1, NIA0 ]
|
||||
ciphering_order : [ NEA0, NEA1, NEA2 ]
|
||||
network_name:
|
||||
full: Open5GS
|
||||
amf_name: open5gs-amf0
|
||||
metrics:
|
||||
server:
|
||||
- address: AMF_IP
|
||||
port: 9091
|
||||
time:
|
||||
t3512:
|
||||
value: 540
|
||||
|
38
custom_deployments/slicing/amf/amf_init.sh
Executable file
38
custom_deployments/slicing/amf/amf_init.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cp /mnt/amf/amf.yaml install/etc/open5gs
|
||||
sed -i 's|AMF_IP|'$AMF_IP'|g' install/etc/open5gs/amf.yaml
|
||||
sed -i 's|SCP_IP|'$SCP_IP'|g' install/etc/open5gs/amf.yaml
|
||||
sed -i 's|NRF_IP|'$NRF_IP'|g' install/etc/open5gs/amf.yaml
|
||||
sed -i 's|MNC|'$MNC'|g' install/etc/open5gs/amf.yaml
|
||||
sed -i 's|MCC|'$MCC'|g' install/etc/open5gs/amf.yaml
|
||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/amf.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
29
custom_deployments/slicing/nr-gnb.yaml
Normal file
29
custom_deployments/slicing/nr-gnb.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
version: '3'
|
||||
services:
|
||||
nr_gnb:
|
||||
image: docker_ueransim
|
||||
container_name: nr_gnb
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- ./ueransim:/mnt/ueransim
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=ueransim-gnb
|
||||
expose:
|
||||
- "38412/sctp"
|
||||
- "2152/udp"
|
||||
- "4997/udp"
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
privileged: true
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${NR_GNB_IP}
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: docker_open5gs_default
|
27
custom_deployments/slicing/nr-ue.yaml
Normal file
27
custom_deployments/slicing/nr-ue.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: '3'
|
||||
services:
|
||||
nr_ue:
|
||||
image: docker_ueransim
|
||||
container_name: nr_ue
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- ./ueransim:/mnt/ueransim
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=ueransim-ue
|
||||
expose:
|
||||
- "4997/udp"
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
privileged: true
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${NR_UE_IP}
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: docker_open5gs_default
|
27
custom_deployments/slicing/nr-ue2.yaml
Normal file
27
custom_deployments/slicing/nr-ue2.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: '3'
|
||||
services:
|
||||
nr_ue2:
|
||||
image: docker_ueransim
|
||||
container_name: nr_ue2
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- ./ueransim:/mnt/ueransim
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=ueransim-ue2
|
||||
expose:
|
||||
- "4997/udp"
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
privileged: true
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${NR_UE2_IP}
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: docker_open5gs_default
|
34
custom_deployments/slicing/nssf/nssf.yaml
Normal file
34
custom_deployments/slicing/nssf/nssf.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
logger:
|
||||
file:
|
||||
path: /open5gs/install/var/log/open5gs/nssf.log
|
||||
|
||||
sbi:
|
||||
server:
|
||||
no_tls: true
|
||||
client:
|
||||
no_tls: true
|
||||
|
||||
global:
|
||||
max:
|
||||
ue: MAX_NUM_UE
|
||||
|
||||
nssf:
|
||||
sbi:
|
||||
server:
|
||||
- address: NSSF_IP
|
||||
port: 7777
|
||||
client:
|
||||
nrf:
|
||||
- uri: http://NRF_IP:7777
|
||||
scp:
|
||||
- uri: http://SCP_IP:7777
|
||||
nsi:
|
||||
- uri: http://NRF_IP:7777
|
||||
s_nssai:
|
||||
sst: 1
|
||||
sd: 000001
|
||||
- uri: http://NRF_IP:7777
|
||||
s_nssai:
|
||||
sst: 1
|
||||
sd: 000002
|
||||
|
37
custom_deployments/slicing/nssf/nssf_init.sh
Executable file
37
custom_deployments/slicing/nssf/nssf_init.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cp /mnt/nssf/nssf.yaml install/etc/open5gs
|
||||
sed -i 's|NSSF_IP|'$NSSF_IP'|g' install/etc/open5gs/nssf.yaml
|
||||
sed -i 's|NRF_IP|'$NRF_IP'|g' install/etc/open5gs/nssf.yaml
|
||||
sed -i 's|SCP_IP|'$SCP_IP'|g' install/etc/open5gs/nssf.yaml
|
||||
sed -i 's|NRF_IP|'$NRF_IP'|g' install/etc/open5gs/nssf.yaml
|
||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/nssf.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
403
custom_deployments/slicing/sa-deploy.yaml
Normal file
403
custom_deployments/slicing/sa-deploy.yaml
Normal file
@@ -0,0 +1,403 @@
|
||||
services:
|
||||
mongo:
|
||||
image: mongo:6.0
|
||||
container_name: mongo
|
||||
command: --bind_ip 0.0.0.0
|
||||
env_file:
|
||||
- .custom_env
|
||||
volumes:
|
||||
- mongodbdata:/data/db
|
||||
- mongodbdata:/data/configdb
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "27017/udp"
|
||||
- "27017/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${MONGO_IP}
|
||||
webui:
|
||||
image: docker_open5gs
|
||||
container_name: webui
|
||||
depends_on:
|
||||
- mongo
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=webui
|
||||
volumes:
|
||||
- ../../webui:/mnt/webui
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "9999/tcp"
|
||||
ports:
|
||||
- "9999:9999/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${WEBUI_IP}
|
||||
nrf:
|
||||
image: docker_open5gs
|
||||
container_name: nrf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=nrf
|
||||
volumes:
|
||||
- ../../nrf:/mnt/nrf
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${NRF_IP}
|
||||
scp:
|
||||
image: docker_open5gs
|
||||
container_name: scp
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=scp
|
||||
volumes:
|
||||
- ../../scp:/mnt/scp
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${SCP_IP}
|
||||
ausf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
container_name: ausf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=ausf
|
||||
volumes:
|
||||
- ../../ausf:/mnt/ausf
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${AUSF_IP}
|
||||
udr:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- mongo
|
||||
container_name: udr
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=udr
|
||||
volumes:
|
||||
- ../../udr:/mnt/udr
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${UDR_IP}
|
||||
udm:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
container_name: udm
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=udm
|
||||
volumes:
|
||||
- ../../udm:/mnt/udm
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${UDM_IP}
|
||||
smf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- amf
|
||||
container_name: smf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=smf
|
||||
- DEPLOY_MODE=5G
|
||||
volumes:
|
||||
- ./smf:/mnt/smf
|
||||
- ./log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "3868/udp"
|
||||
- "3868/tcp"
|
||||
- "3868/sctp"
|
||||
- "5868/udp"
|
||||
- "5868/tcp"
|
||||
- "5868/sctp"
|
||||
- "8805/udp"
|
||||
- "2123/udp"
|
||||
- "7777/tcp"
|
||||
- "9091/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${SMF_IP}
|
||||
smf2:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- amf
|
||||
container_name: smf2
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=smf2
|
||||
- DEPLOY_MODE=5G
|
||||
volumes:
|
||||
- ./smf:/mnt/smf
|
||||
- ./log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "3868/udp"
|
||||
- "3868/tcp"
|
||||
- "3868/sctp"
|
||||
- "5868/udp"
|
||||
- "5868/tcp"
|
||||
- "5868/sctp"
|
||||
- "8805/udp"
|
||||
- "2123/udp"
|
||||
- "7777/tcp"
|
||||
- "9091/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${SMF2_IP}
|
||||
upf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- smf
|
||||
container_name: upf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=upf
|
||||
volumes:
|
||||
- ./upf:/mnt/upf
|
||||
- ./log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "2152/udp"
|
||||
- "8805/udp"
|
||||
- "9091/tcp"
|
||||
# ports:
|
||||
# - "2152:2152/udp"
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
privileged: true
|
||||
sysctls:
|
||||
- net.ipv4.ip_forward=1
|
||||
#- net.ipv6.conf.all.disable_ipv6=0
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${UPF_IP}
|
||||
upf2:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- smf2
|
||||
container_name: upf2
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=upf2
|
||||
volumes:
|
||||
- ./upf:/mnt/upf
|
||||
- ./log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "2152/udp"
|
||||
- "8805/udp"
|
||||
- "9091/tcp"
|
||||
# ports:
|
||||
# - "2152:2152/udp"
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
privileged: true
|
||||
sysctls:
|
||||
- net.ipv4.ip_forward=1
|
||||
#- net.ipv6.conf.all.disable_ipv6=0
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${UPF2_IP}
|
||||
amf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- ausf
|
||||
- udm
|
||||
- udr
|
||||
- pcf
|
||||
- bsf
|
||||
container_name: amf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=amf
|
||||
volumes:
|
||||
- ./amf:/mnt/amf
|
||||
- ./log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "38412/sctp"
|
||||
- "7777/tcp"
|
||||
- "9091/tcp"
|
||||
# ports:
|
||||
# - "38412:38412/sctp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${AMF_IP}
|
||||
pcf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- mongo
|
||||
container_name: pcf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=pcf
|
||||
volumes:
|
||||
- ../../pcf:/mnt/pcf
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
- "9091/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${PCF_IP}
|
||||
bsf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- mongo
|
||||
container_name: bsf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=bsf
|
||||
volumes:
|
||||
- ../../bsf:/mnt/bsf
|
||||
- ../../log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${BSF_IP}
|
||||
nssf:
|
||||
image: docker_open5gs
|
||||
depends_on:
|
||||
- nrf
|
||||
- scp
|
||||
- mongo
|
||||
container_name: nssf
|
||||
env_file:
|
||||
- .custom_env
|
||||
environment:
|
||||
- COMPONENT_NAME=nssf
|
||||
volumes:
|
||||
- ./nssf:/mnt/nssf
|
||||
- ./log:/open5gs/install/var/log/open5gs
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "7777/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${NSSF_IP}
|
||||
metrics:
|
||||
build: ./metrics
|
||||
image: docker_metrics
|
||||
container_name: metrics
|
||||
env_file:
|
||||
- .custom_env
|
||||
volumes:
|
||||
- ../../metrics:/mnt/metrics
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
expose:
|
||||
- "9090/tcp"
|
||||
ports:
|
||||
- "9090:9090/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${METRICS_IP}
|
||||
grafana:
|
||||
image: grafana/grafana:11.3.0
|
||||
container_name: grafana
|
||||
env_file:
|
||||
- .custom_env
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ../../grafana/:/etc/grafana/provisioning/
|
||||
- ../../grafana:/mnt/grafana
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=${GRAFANA_USERNAME}
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
|
||||
#- GF_INSTALL_PLUGINS=${GRAFANA_INSTALL_PLUGINS}
|
||||
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
|
||||
- GF_PATHS_DATA=/var/lib/grafana
|
||||
- METRICS_IP=${METRICS_IP}
|
||||
expose:
|
||||
- "3000/tcp"
|
||||
ports:
|
||||
- "3000:3000/tcp"
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: ${GRAFANA_IP}
|
||||
networks:
|
||||
default:
|
||||
name: docker_open5gs_default
|
||||
ipam:
|
||||
config:
|
||||
- subnet: ${TEST_NETWORK}
|
||||
volumes:
|
||||
grafana_data:
|
||||
name: grafana_data
|
||||
mongodbdata:
|
||||
name: docker_open5gs_mongodbdata
|
70
custom_deployments/slicing/smf/ip_utils.py
Executable file
70
custom_deployments/slicing/smf/ip_utils.py
Executable file
@@ -0,0 +1,70 @@
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import click
|
||||
import sys
|
||||
import ipaddress
|
||||
|
||||
"""
|
||||
Script used to fetch first IP address in a given IP range. i.e. the calling bash script reads the std output
|
||||
|
||||
Usage in command line:
|
||||
e.g:
|
||||
$ python3 ip_utils.py --ip_range 192.168.100.0/24
|
||||
$ python3 ip_utils.py --ip_range 2001:230:cafe::/48
|
||||
"""
|
||||
|
||||
|
||||
def validate_ip_net(ctx, param, value):
|
||||
try:
|
||||
ip_net = ipaddress.ip_network(value)
|
||||
return ip_net
|
||||
except ValueError:
|
||||
raise click.BadParameter(
|
||||
'Value does not represent a valid IPv4/IPv6 range')
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--ip_range',
|
||||
required=True,
|
||||
callback=validate_ip_net,
|
||||
help='UE IPv4/IPv6 Address range in CIDR format e.g. 192.168.100.0/24 or 2001:230:cafe::/48')
|
||||
def start(ip_range):
|
||||
|
||||
# Get the first IP address in the IP range and netmask prefix length
|
||||
first_ip_addr = next(ip_range.hosts(), None)
|
||||
if not first_ip_addr:
|
||||
raise ValueError('Invalid UE IPv4 range. Only one IP given')
|
||||
else:
|
||||
first_ip_addr = first_ip_addr.exploded
|
||||
print(str(first_ip_addr))
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
start()
|
||||
sys.exit(0)
|
||||
except ValueError:
|
||||
sys.exit(1)
|
64
custom_deployments/slicing/smf/smf.yaml
Normal file
64
custom_deployments/slicing/smf/smf.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
logger:
|
||||
file:
|
||||
path: /open5gs/install/var/log/open5gs/smf.log
|
||||
|
||||
sbi:
|
||||
server:
|
||||
no_tls: true
|
||||
client:
|
||||
no_tls: true
|
||||
|
||||
global:
|
||||
max:
|
||||
ue: MAX_NUM_UE
|
||||
parameter:
|
||||
no_ipv4v6_local_addr_in_packet_filter: true
|
||||
|
||||
smf:
|
||||
info:
|
||||
- s_nssai:
|
||||
- sst: 1
|
||||
sd: 000001
|
||||
dnn:
|
||||
- internet
|
||||
sbi:
|
||||
server:
|
||||
- address: SMF_IP
|
||||
port: 7777
|
||||
client:
|
||||
nrf:
|
||||
- uri: http://NRF_IP:7777
|
||||
scp:
|
||||
- uri: http://SCP_IP:7777
|
||||
gtpc:
|
||||
server:
|
||||
- address: SMF_IP
|
||||
gtpu:
|
||||
server:
|
||||
- address: SMF_IP
|
||||
pfcp:
|
||||
server:
|
||||
- address: SMF_IP
|
||||
client:
|
||||
upf:
|
||||
- address: UPF_IP
|
||||
dnn: internet
|
||||
session:
|
||||
- subnet: UE_IPV4_INTERNET_SUBNET
|
||||
gateway: UE_IPV4_INTERNET_TUN_IP
|
||||
dnn: internet
|
||||
- subnet: 2001:230:cafe::/48
|
||||
gateway: 2001:230:cafe::1
|
||||
dnn: internet
|
||||
dns:
|
||||
- SMF_DNS1
|
||||
- SMF_DNS2
|
||||
- 2001:4860:4860::8888
|
||||
- 2001:4860:4860::8844
|
||||
p-cscf:
|
||||
- PCSCF_IP
|
||||
mtu: 1450
|
||||
metrics:
|
||||
server:
|
||||
- address: SMF_IP
|
||||
port: 9091
|
64
custom_deployments/slicing/smf/smf2.yaml
Normal file
64
custom_deployments/slicing/smf/smf2.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
logger:
|
||||
file:
|
||||
path: /open5gs/install/var/log/open5gs/smf2.log
|
||||
|
||||
sbi:
|
||||
server:
|
||||
no_tls: true
|
||||
client:
|
||||
no_tls: true
|
||||
|
||||
global:
|
||||
max:
|
||||
ue: MAX_NUM_UE
|
||||
parameter:
|
||||
no_ipv4v6_local_addr_in_packet_filter: true
|
||||
|
||||
smf:
|
||||
info:
|
||||
- s_nssai:
|
||||
- sst: 1
|
||||
sd: 000002
|
||||
dnn:
|
||||
- private
|
||||
sbi:
|
||||
server:
|
||||
- address: SMF2_IP
|
||||
port: 7777
|
||||
client:
|
||||
nrf:
|
||||
- uri: http://NRF_IP:7777
|
||||
scp:
|
||||
- uri: http://SCP_IP:7777
|
||||
gtpc:
|
||||
server:
|
||||
- address: SMF2_IP
|
||||
gtpu:
|
||||
server:
|
||||
- address: SMF2_IP
|
||||
pfcp:
|
||||
server:
|
||||
- address: SMF2_IP
|
||||
client:
|
||||
upf:
|
||||
- address: UPF2_IP
|
||||
dnn: private
|
||||
session:
|
||||
- subnet: UE_IPV4_PRIVATE_SUBNET
|
||||
gateway: UE_IPV4_PRIVATE_TUN_IP
|
||||
dnn: private
|
||||
- subnet: 2001:230:fafe::/48
|
||||
gateway: 2001:230:fafe::1
|
||||
dnn: private
|
||||
dns:
|
||||
- SMF_DNS1
|
||||
- SMF_DNS2
|
||||
- 2001:4860:4860::8888
|
||||
- 2001:4860:4860::8844
|
||||
p-cscf:
|
||||
- PCSCF_IP
|
||||
mtu: 1450
|
||||
metrics:
|
||||
server:
|
||||
- address: SMF2_IP
|
||||
port: 9091
|
57
custom_deployments/slicing/smf/smf2_init.sh
Executable file
57
custom_deployments/slicing/smf/smf2_init.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
export LANG=C.UTF-8
|
||||
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"
|
||||
|
||||
UE_IPV4_PRIVATE_TUN_IP=$(python3 /mnt/smf/ip_utils.py --ip_range $UE_IPV4_PRIVATE)
|
||||
|
||||
cp /mnt/smf/smf2.yaml install/etc/open5gs/smf.yaml
|
||||
if [[ ${DEPLOY_MODE} == 4G ]];
|
||||
then
|
||||
echo "Error: Invalid deployment mode for SMF: '$DEPLOY_MODE'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i 's|SMF2_IP|'$SMF2_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|SCP_IP|'$SCP_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|NRF_IP|'$NRF_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UPF2_IP|'$UPF2_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|SMF_DNS1|'$SMF_DNS1'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|SMF_DNS2|'$SMF_DNS2'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UE_IPV4_PRIVATE_TUN_IP|'$UE_IPV4_PRIVATE_TUN_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UE_IPV4_PRIVATE_SUBNET|'$UE_IPV4_PRIVATE'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|PCSCF_IP|'$PCSCF_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/smf.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
60
custom_deployments/slicing/smf/smf_init.sh
Executable file
60
custom_deployments/slicing/smf/smf_init.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
export LANG=C.UTF-8
|
||||
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"
|
||||
|
||||
UE_IPV4_INTERNET_TUN_IP=$(python3 /mnt/smf/ip_utils.py --ip_range $UE_IPV4_INTERNET)
|
||||
UE_IPV4_IMS_TUN_IP=$(python3 /mnt/smf/ip_utils.py --ip_range $UE_IPV4_IMS)
|
||||
|
||||
cp /mnt/smf/smf.yaml install/etc/open5gs
|
||||
if [[ ${DEPLOY_MODE} == 4G ]];
|
||||
then
|
||||
echo "Error: Invalid deployment mode for SMF: '$DEPLOY_MODE'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i 's|SMF_IP|'$SMF_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|SCP_IP|'$SCP_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|NRF_IP|'$NRF_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UPF_IP|'$UPF_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|SMF_DNS1|'$SMF_DNS1'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|SMF_DNS2|'$SMF_DNS2'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UE_IPV4_INTERNET_TUN_IP|'$UE_IPV4_INTERNET_TUN_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UE_IPV4_INTERNET_SUBNET|'$UE_IPV4_INTERNET'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UE_IPV4_IMS_TUN_IP|'$UE_IPV4_IMS_TUN_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|UE_IPV4_IMS_SUBNET|'$UE_IPV4_IMS'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|PCSCF_IP|'$PCSCF_IP'|g' install/etc/open5gs/smf.yaml
|
||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/smf.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
25
custom_deployments/slicing/ueransim/ueransim-gnb.yaml
Normal file
25
custom_deployments/slicing/ueransim/ueransim-gnb.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
mcc: 'MCC' # Mobile Country Code value
|
||||
mnc: 'MNC' # Mobile Network Code value (2 or 3 digits)
|
||||
|
||||
nci: '0x000000010' # NR Cell Identity (36-bit)
|
||||
idLength: 32 # NR gNB ID length in bits [22...32]
|
||||
tac: 1 # Tracking Area Code
|
||||
|
||||
linkIp: NR_GNB_IP # gNB's local IP address for Radio Link Simulation (Usually same with local IP)
|
||||
ngapIp: NR_GNB_IP # gNB's local IP address for N2 Interface (Usually same with local IP)
|
||||
gtpIp: NR_GNB_IP # gNB's local IP address for N3 Interface (Usually same with local IP)
|
||||
|
||||
# List of AMF address information
|
||||
amfConfigs:
|
||||
- address: AMF_IP
|
||||
port: 38412
|
||||
|
||||
# List of supported S-NSSAIs by this gNB
|
||||
slices:
|
||||
- sst: 1
|
||||
sd: 0x000001
|
||||
- sst: 1
|
||||
sd: 0x000002
|
||||
|
||||
# Indicates whether or not SCTP stream number errors should be ignored.
|
||||
ignoreStreamIds: true
|
39
custom_deployments/slicing/ueransim/ueransim-gnb_init.sh
Executable file
39
custom_deployments/slicing/ueransim/ueransim-gnb_init.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
|
||||
|
||||
cp /mnt/ueransim/${COMPONENT_NAME}.yaml /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
|
||||
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|NR_GNB_IP|'$NR_GNB_IP'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|AMF_IP|'$AMF_IP'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
72
custom_deployments/slicing/ueransim/ueransim-ue.yaml
Normal file
72
custom_deployments/slicing/ueransim/ueransim-ue.yaml
Normal file
@@ -0,0 +1,72 @@
|
||||
# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits)
|
||||
supi: 'imsi-UE1_IMSI'
|
||||
# Mobile Country Code value of HPLMN
|
||||
mcc: 'MCC'
|
||||
# Mobile Network Code value of HPLMN (2 or 3 digits)
|
||||
mnc: 'MNC'
|
||||
|
||||
# Permanent subscription key
|
||||
key: 'UE1_KI'
|
||||
# Operator code (OP or OPC) of the UE
|
||||
op: 'UE1_OP'
|
||||
# This value specifies the OP type and it can be either 'OP' or 'OPC'
|
||||
opType: 'OP'
|
||||
# Authentication Management Field (AMF) value
|
||||
amf: 'UE1_AMF'
|
||||
# IMEI number of the device. It is used if no SUPI is provided
|
||||
imei: 'UE1_IMEI'
|
||||
# IMEISV number of the device. It is used if no SUPI and IMEI is provided
|
||||
imeiSv: 'UE1_IMEISV'
|
||||
|
||||
# List of gNB IP addresses for Radio Link Simulation
|
||||
gnbSearchList:
|
||||
- NR_GNB_IP
|
||||
|
||||
# UAC Access Identities Configuration
|
||||
uacAic:
|
||||
mps: false
|
||||
mcs: false
|
||||
|
||||
# UAC Access Control Class
|
||||
uacAcc:
|
||||
normalClass: 0
|
||||
class11: false
|
||||
class12: false
|
||||
class13: false
|
||||
class14: false
|
||||
class15: false
|
||||
|
||||
# Initial PDU sessions to be established
|
||||
sessions:
|
||||
- type: 'IPv4'
|
||||
apn: 'internet'
|
||||
slice:
|
||||
sst: 1
|
||||
sd: 0x000001
|
||||
|
||||
# Configured NSSAI for this UE by HPLMN
|
||||
configured-nssai:
|
||||
- sst: 1
|
||||
sd: 0x000001
|
||||
|
||||
# Default Configured NSSAI for this UE
|
||||
default-nssai:
|
||||
- sst: 1
|
||||
sd: 0x000001
|
||||
|
||||
# Supported encryption algorithms by this UE
|
||||
integrity:
|
||||
IA1: true
|
||||
IA2: true
|
||||
IA3: true
|
||||
|
||||
# Supported integrity algorithms by this UE
|
||||
ciphering:
|
||||
EA1: true
|
||||
EA2: true
|
||||
EA3: true
|
||||
|
||||
# Integrity protection maximum data rate for user plane
|
||||
integrityMaxRate:
|
||||
uplink: 'full'
|
||||
downlink: 'full'
|
72
custom_deployments/slicing/ueransim/ueransim-ue2.yaml
Normal file
72
custom_deployments/slicing/ueransim/ueransim-ue2.yaml
Normal file
@@ -0,0 +1,72 @@
|
||||
# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits)
|
||||
supi: 'imsi-UE2_IMSI'
|
||||
# Mobile Country Code value of HPLMN
|
||||
mcc: 'MCC'
|
||||
# Mobile Network Code value of HPLMN (2 or 3 digits)
|
||||
mnc: 'MNC'
|
||||
|
||||
# Permanent subscription key
|
||||
key: 'UE2_KI'
|
||||
# Operator code (OP or OPC) of the UE
|
||||
op: 'UE2_OP'
|
||||
# This value specifies the OP type and it can be either 'OP' or 'OPC'
|
||||
opType: 'OP'
|
||||
# Authentication Management Field (AMF) value
|
||||
amf: 'UE2_AMF'
|
||||
# IMEI number of the device. It is used if no SUPI is provided
|
||||
imei: 'UE2_IMEI'
|
||||
# IMEISV number of the device. It is used if no SUPI and IMEI is provided
|
||||
imeiSv: 'UE2_IMEISV'
|
||||
|
||||
# List of gNB IP addresses for Radio Link Simulation
|
||||
gnbSearchList:
|
||||
- NR_GNB_IP
|
||||
|
||||
# UAC Access Identities Configuration
|
||||
uacAic:
|
||||
mps: false
|
||||
mcs: false
|
||||
|
||||
# UAC Access Control Class
|
||||
uacAcc:
|
||||
normalClass: 0
|
||||
class11: false
|
||||
class12: false
|
||||
class13: false
|
||||
class14: false
|
||||
class15: false
|
||||
|
||||
# Initial PDU sessions to be established
|
||||
sessions:
|
||||
- type: 'IPv4'
|
||||
apn: 'private'
|
||||
slice:
|
||||
sst: 1
|
||||
sd: 0x000002
|
||||
|
||||
# Configured NSSAI for this UE by HPLMN
|
||||
configured-nssai:
|
||||
- sst: 1
|
||||
sd: 0x000002
|
||||
|
||||
# Default Configured NSSAI for this UE
|
||||
default-nssai:
|
||||
- sst: 1
|
||||
sd: 0x000002
|
||||
|
||||
# Supported encryption algorithms by this UE
|
||||
integrity:
|
||||
IA1: true
|
||||
IA2: true
|
||||
IA3: true
|
||||
|
||||
# Supported integrity algorithms by this UE
|
||||
ciphering:
|
||||
EA1: true
|
||||
EA2: true
|
||||
EA3: true
|
||||
|
||||
# Integrity protection maximum data rate for user plane
|
||||
integrityMaxRate:
|
||||
uplink: 'full'
|
||||
downlink: 'full'
|
44
custom_deployments/slicing/ueransim/ueransim-ue2_init.sh
Executable file
44
custom_deployments/slicing/ueransim/ueransim-ue2_init.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
|
||||
|
||||
cp /mnt/ueransim/${COMPONENT_NAME}.yaml /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
|
||||
sed -i 's|UE2_KI|'$UE2_KI'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE2_OP|'$UE2_OP'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE2_AMF|'$UE2_AMF'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE2_IMEISV|'$UE2_IMEISV'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE2_IMEI|'$UE2_IMEI'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE2_IMSI|'$UE2_IMSI'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|NR_GNB_IP|'$NR_GNB_IP'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
44
custom_deployments/slicing/ueransim/ueransim-ue_init.sh
Executable file
44
custom_deployments/slicing/ueransim/ueransim-ue_init.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
|
||||
|
||||
cp /mnt/ueransim/${COMPONENT_NAME}.yaml /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|MNC|'$MNC'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|MCC|'$MCC'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
|
||||
sed -i 's|UE1_KI|'$UE1_KI'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE1_OP|'$UE1_OP'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE1_AMF|'$UE1_AMF'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE1_IMEISV|'$UE1_IMEISV'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE1_IMEI|'$UE1_IMEI'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|UE1_IMSI|'$UE1_IMSI'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
sed -i 's|NR_GNB_IP|'$NR_GNB_IP'|g' /UERANSIM/config/${COMPONENT_NAME}.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
70
custom_deployments/slicing/upf/ip_utils.py
Executable file
70
custom_deployments/slicing/upf/ip_utils.py
Executable file
@@ -0,0 +1,70 @@
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import click
|
||||
import sys
|
||||
import ipaddress
|
||||
|
||||
"""
|
||||
Script used to fetch first IP address in a given IP range. i.e. the calling bash script reads the std output
|
||||
|
||||
Usage in command line:
|
||||
e.g:
|
||||
$ python3 ip_utils.py --ip_range 192.168.100.0/24
|
||||
$ python3 ip_utils.py --ip_range 2001:230:cafe::/48
|
||||
"""
|
||||
|
||||
|
||||
def validate_ip_net(ctx, param, value):
|
||||
try:
|
||||
ip_net = ipaddress.ip_network(value)
|
||||
return ip_net
|
||||
except ValueError:
|
||||
raise click.BadParameter(
|
||||
'Value does not represent a valid IPv4/IPv6 range')
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--ip_range',
|
||||
required=True,
|
||||
callback=validate_ip_net,
|
||||
help='UE IPv4/IPv6 Address range in CIDR format e.g. 192.168.100.0/24 or 2001:230:cafe::/48')
|
||||
def start(ip_range):
|
||||
|
||||
# Get the first IP address in the IP range and netmask prefix length
|
||||
first_ip_addr = next(ip_range.hosts(), None)
|
||||
if not first_ip_addr:
|
||||
raise ValueError('Invalid UE IPv4 range. Only one IP given')
|
||||
else:
|
||||
first_ip_addr = first_ip_addr.exploded
|
||||
print(str(first_ip_addr))
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
start()
|
||||
sys.exit(0)
|
||||
except ValueError:
|
||||
sys.exit(1)
|
108
custom_deployments/slicing/upf/tun_if.py
Executable file
108
custom_deployments/slicing/upf/tun_if.py
Executable file
@@ -0,0 +1,108 @@
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import click
|
||||
import subprocess
|
||||
import ipaddress
|
||||
|
||||
"""
|
||||
Usage in command line:
|
||||
e.g:
|
||||
$ python3 tun_if.py --tun_ifname ogstun --ipv4_range 192.168.100.0/24 --ipv6_range 2001:230:cafe::/48
|
||||
"""
|
||||
|
||||
|
||||
def validate_ip_net(ctx, param, value):
|
||||
try:
|
||||
ip_net = ipaddress.ip_network(value)
|
||||
return ip_net
|
||||
except ValueError:
|
||||
raise click.BadParameter(
|
||||
'Value does not represent a valid IPv4/IPv6 range')
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option('--tun_ifname',
|
||||
required=True,
|
||||
help='TUN interface name e.g. ogstun')
|
||||
@click.option('--ipv4_range',
|
||||
required=True,
|
||||
callback=validate_ip_net,
|
||||
help='UE IPv4 Address range in CIDR format e.g. 192.168.100.0/24')
|
||||
@click.option('--ipv6_range',
|
||||
required=True,
|
||||
callback=validate_ip_net,
|
||||
help='UE IPv6 Address range in CIDR format e.g. 2001:230:cafe::/48')
|
||||
@click.option('--nat_rule',
|
||||
default='yes',
|
||||
help='Option specifying whether to add NATing iptables rule or not')
|
||||
def start(tun_ifname,
|
||||
ipv4_range,
|
||||
ipv6_range,
|
||||
nat_rule):
|
||||
|
||||
# Get the first IP address in the IP range and netmask prefix length
|
||||
first_ipv4_addr = next(ipv4_range.hosts(), None)
|
||||
if not first_ipv4_addr:
|
||||
raise ValueError('Invalid UE IPv4 range. Only one IP given')
|
||||
else:
|
||||
first_ipv4_addr = first_ipv4_addr.exploded
|
||||
first_ipv6_addr = next(ipv6_range.hosts(), None)
|
||||
if not first_ipv6_addr:
|
||||
raise ValueError('Invalid UE IPv6 range. Only one IP given')
|
||||
else:
|
||||
first_ipv6_addr = first_ipv6_addr.exploded
|
||||
|
||||
ipv4_netmask_prefix = ipv4_range.prefixlen
|
||||
ipv6_netmask_prefix = ipv6_range.prefixlen
|
||||
|
||||
# Setup the TUN interface, set IP address and setup IPtables
|
||||
# if ls /sys/class/net | grep "ogstun" ; then ip link delete ogstun; fi
|
||||
execute_bash_cmd('ip tuntap add name ' + tun_ifname + ' mode tun')
|
||||
execute_bash_cmd('ip addr add ' + first_ipv4_addr + '/' +
|
||||
str(ipv4_netmask_prefix) + ' dev ' + tun_ifname)
|
||||
execute_bash_cmd('ip addr add ' + first_ipv6_addr + '/' +
|
||||
str(ipv6_netmask_prefix) + ' dev ' + tun_ifname)
|
||||
execute_bash_cmd('ip link set ' + tun_ifname + ' mtu 1450')
|
||||
execute_bash_cmd('ip link set ' + tun_ifname + ' up')
|
||||
if nat_rule == 'yes':
|
||||
execute_bash_cmd('if ! iptables-save | grep -- \"-A POSTROUTING -s ' + ipv4_range.with_prefixlen + ' ! -o ' + tun_ifname + ' -j MASQUERADE\" ; then ' +
|
||||
'iptables -t nat -A POSTROUTING -s ' + ipv4_range.with_prefixlen + ' ! -o ' + tun_ifname + ' -j MASQUERADE; fi')
|
||||
execute_bash_cmd('if ! ip6tables-save | grep -- \"-A POSTROUTING -s ' + ipv6_range.with_prefixlen + ' ! -o ' + tun_ifname + ' -j MASQUERADE\" ; then ' +
|
||||
'ip6tables -t nat -A POSTROUTING -s ' + ipv6_range.with_prefixlen + ' ! -o ' + tun_ifname + ' -j MASQUERADE; fi')
|
||||
execute_bash_cmd('if ! iptables-save | grep -- \"-A INPUT -i ' + tun_ifname + ' -j ACCEPT\" ; then ' +
|
||||
'iptables -A INPUT -i ' + tun_ifname + ' -j ACCEPT; fi')
|
||||
execute_bash_cmd('if ! ip6tables-save | grep -- \"-A INPUT -i ' + tun_ifname + ' -j ACCEPT\" ; then ' +
|
||||
'ip6tables -A INPUT -i ' + tun_ifname + ' -j ACCEPT; fi')
|
||||
|
||||
|
||||
def execute_bash_cmd(bash_cmd):
|
||||
# print("Executing: /bin/bash -c " + bash_cmd)
|
||||
return subprocess.run(bash_cmd, stdout=subprocess.PIPE, shell=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
start()
|
32
custom_deployments/slicing/upf/upf.yaml
Normal file
32
custom_deployments/slicing/upf/upf.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
logger:
|
||||
file:
|
||||
path: /open5gs/install/var/log/open5gs/upf.log
|
||||
|
||||
global:
|
||||
max:
|
||||
ue: MAX_NUM_UE
|
||||
|
||||
upf:
|
||||
pfcp:
|
||||
server:
|
||||
- address: UPF_IP
|
||||
client:
|
||||
smf:
|
||||
- address: SMF_IP
|
||||
dnn: internet
|
||||
gtpu:
|
||||
server:
|
||||
- address: UPF_IP
|
||||
advertise: UPF_ADVERTISE_IP
|
||||
session:
|
||||
- subnet: UE_IPV4_INTERNET_SUBNET
|
||||
gateway: UE_IPV4_INTERNET_TUN_IP
|
||||
dnn: internet
|
||||
dev: ogstun
|
||||
- subnet: 2001:230:cafe::/48
|
||||
gateway: 2001:230:cafe::1
|
||||
dnn: internet
|
||||
metrics:
|
||||
server:
|
||||
- address: UPF_IP
|
||||
port: 9091
|
33
custom_deployments/slicing/upf/upf2.yaml
Normal file
33
custom_deployments/slicing/upf/upf2.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
logger:
|
||||
file:
|
||||
path: /open5gs/install/var/log/open5gs/upf2.log
|
||||
|
||||
global:
|
||||
max:
|
||||
ue: MAX_NUM_UE
|
||||
|
||||
upf:
|
||||
pfcp:
|
||||
server:
|
||||
- address: UPF2_IP
|
||||
client:
|
||||
smf:
|
||||
- address: SMF2_IP
|
||||
dnn: private
|
||||
gtpu:
|
||||
server:
|
||||
- address: UPF2_IP
|
||||
advertise: UPF2_ADVERTISE_IP
|
||||
session:
|
||||
- subnet: UE_IPV4_PRIVATE_SUBNET
|
||||
gateway: UE_IPV4_PRIVATE_TUN_IP
|
||||
dnn: private
|
||||
dev: ogstun
|
||||
- subnet: 2001:230:fafe::/48
|
||||
gateway: 2001:230:fafe::1
|
||||
dnn: private
|
||||
dev: ogstun
|
||||
metrics:
|
||||
server:
|
||||
- address: UPF2_IP
|
||||
port: 9091
|
48
custom_deployments/slicing/upf/upf2_init.sh
Executable file
48
custom_deployments/slicing/upf/upf2_init.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
export LANG=C.UTF-8
|
||||
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
|
||||
export IF_NAME=$(ip r | awk '/default/ { print $5 }')
|
||||
|
||||
python3 /mnt/upf/tun_if.py --tun_ifname ogstun --ipv4_range $UE_IPV4_PRIVATE --ipv6_range 2001:230:fafe::/48
|
||||
|
||||
UE_IPV4_PRIVATE_TUN_IP=$(python3 /mnt/upf/ip_utils.py --ip_range $UE_IPV4_PRIVATE)
|
||||
|
||||
cp /mnt/upf/upf2.yaml install/etc/open5gs/upf.yaml
|
||||
|
||||
sed -i 's|UPF2_IP|'$UPF2_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|SMF2_IP|'$SMF2_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UE_IPV4_PRIVATE_TUN_IP|'$UE_IPV4_PRIVATE_TUN_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UE_IPV4_PRIVATE_SUBNET|'$UE_IPV4_PRIVATE'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UPF2_ADVERTISE_IP|'$UPF2_ADVERTISE_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/upf.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
49
custom_deployments/slicing/upf/upf_init.sh
Executable file
49
custom_deployments/slicing/upf/upf_init.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# BSD 2-Clause License
|
||||
|
||||
# Copyright (c) 2020, Supreeth Herle
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
export LC_ALL=C.UTF-8
|
||||
export LANG=C.UTF-8
|
||||
export IP_ADDR=$(awk 'END{print $1}' /etc/hosts)
|
||||
export IF_NAME=$(ip r | awk '/default/ { print $5 }')
|
||||
|
||||
python3 /mnt/upf/tun_if.py --tun_ifname ogstun --ipv4_range $UE_IPV4_INTERNET --ipv6_range 2001:230:cafe::/48
|
||||
|
||||
UE_IPV4_INTERNET_TUN_IP=$(python3 /mnt/upf/ip_utils.py --ip_range $UE_IPV4_INTERNET)
|
||||
|
||||
cp /mnt/upf/upf.yaml install/etc/open5gs
|
||||
sed -i 's|UPF_IP|'$UPF_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|SMF_IP|'$SMF_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UE_IPV4_INTERNET_TUN_IP|'$UE_IPV4_INTERNET_TUN_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UE_IPV4_INTERNET_SUBNET|'$UE_IPV4_INTERNET'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UE_IPV4_IMS_TUN_IP|'$UE_IPV4_IMS_TUN_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UE_IPV4_IMS_SUBNET|'$UE_IPV4_IMS'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|UPF_ADVERTISE_IP|'$UPF_ADVERTISE_IP'|g' install/etc/open5gs/upf.yaml
|
||||
sed -i 's|MAX_NUM_UE|'$MAX_NUM_UE'|g' install/etc/open5gs/upf.yaml
|
||||
|
||||
# Sync docker time
|
||||
#ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
Reference in New Issue
Block a user