From a86b829edbb79740dc9e4ff883dc1e4216e01b3f Mon Sep 17 00:00:00 2001 From: herlesupreeth Date: Sun, 6 Aug 2023 09:57:33 +0200 Subject: [PATCH] Add 4G only mode deployment rather than keeping separate branch --- 4g-volte-deploy.yaml | 462 +++++++++++++++++++++++++ README.md | 71 ++-- docker-compose.yaml => deploy-all.yaml | 1 + sa-deploy.yaml | 1 + smf/smf_4g.yaml | 48 +++ smf/smf_init.sh | 6 + 6 files changed, 563 insertions(+), 26 deletions(-) create mode 100644 4g-volte-deploy.yaml rename docker-compose.yaml => deploy-all.yaml (99%) create mode 100644 smf/smf_4g.yaml diff --git a/4g-volte-deploy.yaml b/4g-volte-deploy.yaml new file mode 100644 index 0000000..f490c66 --- /dev/null +++ b/4g-volte-deploy.yaml @@ -0,0 +1,462 @@ +version: '3' +services: + mongo: + image: mongo:6.0 + container_name: mongo + command: --bind_ip 0.0.0.0 + env_file: + - .env + volumes: + - mongodbdata:/data/db + - /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: + - .env + environment: + - COMPONENT_NAME=webui + volumes: + - ./webui:/mnt/webui + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + expose: + - "3000/tcp" + ports: + - "3000:3000/tcp" + networks: + default: + ipv4_address: ${WEBUI_IP} + hss: + image: docker_open5gs + container_name: hss + env_file: + - .env + environment: + - COMPONENT_NAME=hss-1 + volumes: + - ./hss:/mnt/hss + - ./log:/open5gs/install/var/log/open5gs + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + depends_on: + - mongo + expose: + - "3868/udp" + - "3868/tcp" + - "3868/sctp" + - "5868/udp" + - "5868/tcp" + - "5868/sctp" + networks: + default: + ipv4_address: ${HSS_IP} + sgwc: + image: docker_open5gs + depends_on: + - smf + - upf + container_name: sgwc + env_file: + - .env + environment: + - COMPONENT_NAME=sgwc-1 + volumes: + - ./sgwc:/mnt/sgwc + - ./log:/open5gs/install/var/log/open5gs + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + expose: + - "2123/udp" + - "8805/udp" + networks: + default: + ipv4_address: ${SGWC_IP} + sgwu: + image: docker_open5gs + depends_on: + - smf + - upf + container_name: sgwu + env_file: + - .env + environment: + - COMPONENT_NAME=sgwu-1 + volumes: + - ./sgwu:/mnt/sgwu + - ./log:/open5gs/install/var/log/open5gs + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + expose: + - "8805/udp" + - "2152/udp" + # ports: + # - "2152:2152/udp" + networks: + default: + ipv4_address: ${SGWU_IP} + smf: + image: docker_open5gs + container_name: smf + env_file: + - .env + environment: + - COMPONENT_NAME=smf-1 + - DEPLOY_MODE=4G + 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} + upf: + image: docker_open5gs + depends_on: + - smf + container_name: upf + env_file: + - .env + environment: + - COMPONENT_NAME=upf-1 + 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" + cap_add: + - NET_ADMIN + privileged: true + sysctls: + - net.ipv4.ip_forward=1 + networks: + default: + ipv4_address: ${UPF_IP} + mme: + image: docker_open5gs + depends_on: + - hss + - sgwc + - sgwu + - smf + - upf + - osmomsc + container_name: mme + env_file: + - .env + environment: + - COMPONENT_NAME=mme-1 + volumes: + - ./mme:/mnt/mme + - ./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" + - "36412/sctp" + - "2123/udp" + - "9091/tcp" + # ports: + # - "36412:36412/sctp" + networks: + default: + ipv4_address: ${MME_IP} + pcrf: + image: docker_open5gs + container_name: pcrf + env_file: + - .env + environment: + - COMPONENT_NAME=pcrf-1 + depends_on: + - mongo + volumes: + - ./pcrf:/mnt/pcrf + - ./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" + networks: + default: + ipv4_address: ${PCRF_IP} + dns: + build: ./dns + image: docker_dns + container_name: dns + env_file: + - .env + volumes: + - ./dns:/mnt/dns + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + expose: + - "53/udp" + networks: + default: + ipv4_address: ${DNS_IP} + rtpengine: + build: ./rtpengine + image: docker_rtpengine + container_name: rtpengine + privileged: true + env_file: + - .env + volumes: + - ./rtpengine:/mnt/rtpengine + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + cap_add: + - NET_ADMIN + environment: + - TABLE=0 + - INTERFACE=${RTPENGINE_IP} + - LISTEN_NG=${RTPENGINE_IP}:2223 + - PIDFILE=/run/ngcp-rtpengine-daemon.pid + - PORT_MAX=50000 + - PORT_MIN=49000 + - NO_FALLBACK=no + - TOS=184 + expose: + - "2223/udp" + - "49000-50000/udp" + networks: + default: + ipv4_address: ${RTPENGINE_IP} + mysql: + build: ./mysql + image: docker_mysql + container_name: mysql + env_file: + - .env + volumes: + - dbdata:/var/lib/mysql + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + expose: + - "3306/tcp" + networks: + default: + ipv4_address: ${MYSQL_IP} + pyhss: + build: ./pyhss + image: docker_pyhss + container_name: pyhss + dns: ${DNS_IP} + volumes: + - ./pyhss:/mnt/pyhss + - ./pyhss/logs:/pyhss/log/ + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + depends_on: + - dns + - mysql + expose: + - "3868/udp" + - "3868/tcp" + ports: + - "8080:8080/tcp" + networks: + default: + ipv4_address: ${PYHSS_IP} + icscf: + image: docker_kamailio + container_name: icscf + dns: ${DNS_IP} + volumes: + - ./icscf:/mnt/icscf + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - COMPONENT_NAME=icscf-1 + depends_on: + - dns + - mysql + - pyhss + expose: + - "3869/udp" + - "3869/tcp" + - "4060/udp" + - "4060/tcp" + networks: + default: + ipv4_address: ${ICSCF_IP} + scscf: + image: docker_kamailio + container_name: scscf + dns: ${DNS_IP} + volumes: + - ./scscf:/mnt/scscf + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - COMPONENT_NAME=scscf-1 + depends_on: + - dns + - mysql + - pyhss + expose: + - "3870/udp" + - "3870/tcp" + - "6060/udp" + - "6060/tcp" + networks: + default: + ipv4_address: ${SCSCF_IP} + pcscf: + image: docker_kamailio + container_name: pcscf + dns: ${DNS_IP} + privileged: true + cap_add: + - NET_ADMIN + volumes: + - ./pcscf:/mnt/pcscf + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - COMPONENT_NAME=pcscf-1 + depends_on: + - dns + - mysql + - rtpengine + - icscf + - scscf + expose: + - "3871/udp" + - "3871/tcp" + - "5060/tcp" + - "5060/udp" + - "5100-5120/tcp" + - "5100-5120/udp" + - "6100-6120/tcp" + - "6100-6120/udp" + networks: + default: + ipv4_address: ${PCSCF_IP} + smsc: + image: docker_kamailio + container_name: smsc + dns: ${DNS_IP} + volumes: + - ./smsc:/mnt/smsc + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - COMPONENT_NAME=smsc-1 + depends_on: + - dns + - mysql + expose: + - "7090/udp" + - "7090/tcp" + networks: + default: + ipv4_address: ${SMSC_IP} + osmomsc: + build: ./osmomsc + image: docker_osmomsc + container_name: osmomsc + volumes: + - ./osmomsc:/mnt/osmomsc + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - COMPONENT_NAME=osmomsc-1 + depends_on: + - osmohlr + expose: + - "29118/sctp" + - "2775/tcp" + networks: + default: + ipv4_address: ${OSMOMSC_IP} + osmohlr: + build: ./osmohlr + image: docker_osmohlr + container_name: osmohlr + volumes: + - ./osmohlr:/mnt/osmohlr + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + environment: + - COMPONENT_NAME=osmohlr-1 + expose: + - "4222/tcp" + networks: + default: + ipv4_address: ${OSMOHLR_IP} + metrics: + build: ./metrics + image: docker_metrics + container_name: metrics + env_file: + - .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} +networks: + default: + ipam: + config: + - subnet: ${TEST_NETWORK} +volumes: + mongodbdata: {} + dbdata: {} diff --git a/README.md b/README.md index a439543..7b7beae 100644 --- a/README.md +++ b/README.md @@ -59,34 +59,49 @@ cd .. set -a source .env docker-compose build --no-cache -docker-compose up +``` -Over-The-Air setups: +4G deployment: -# srsRAN eNB using SDR +``` +# 4G Core Network + IMS + SMS over SGs +docker-compose -f 4g-volte-deploy.yaml up + +# srsRAN eNB using SDR (OTA) docker-compose -f srsenb.yaml up -d && docker attach srsenb -# srsRAN gNB using SDR + +# srsRAN ZMQ eNB (RF simulated) +docker-compose -f srsenb_zmq.yaml up -d && docker attach srsenb_zmq + +# srsRAN ZMQ 4G UE (RF simulated) +docker-compose -f srsue_zmq.yaml up -d && docker attach srsue_zmq +``` + +5G SA deployment: + +``` +# 5G Core Network +docker-compose -f 4g-volte-deploy.yaml up + +# srsRAN gNB using SDR (OTA) docker-compose -f srsgnb.yaml up -d && docker attach srsgnb -RF simulated setups: - -# srsRAN ZMQ eNB -docker-compose -f srsenb_zmq.yaml up -d && docker attach srsenb_zmq -# srsRAN ZMQ gNB +# srsRAN ZMQ gNB (RF simulated) docker-compose -f srsgnb_zmq.yaml up -d && docker attach srsgnb_zmq -# srsRAN ZMQ 4G UE -docker-compose -f srsue_zmq.yaml up -d && docker attach srsue_zmq -# srsRAN ZMQ 5G UE + +# srsRAN ZMQ 5G UE (RF simulated) docker-compose -f srsue_5g_zmq.yaml up -d && docker attach srsue_5g_zmq -# UERANSIM gNB + +# UERANSIM gNB (RF simulated) docker-compose -f nr-gnb.yaml up -d && docker attach nr_gnb -# UERANSIM NR-UE + +# UERANSIM NR-UE (RF simulated) docker-compose -f nr-ue.yaml up -d && docker attach nr_ue ``` ## Configuration -For the quick run (eNB/gNB, CN in same docker network), edit only the following parameters in .env as per your setup +For the quick run (eNB/gNB, CN in same docker network), edit only the following parameters in **.env** as per your setup ``` MCC @@ -101,7 +116,9 @@ UE_IPV4_IMS --> Change this to your desired (Not conflicted) UE network ip range If eNB/gNB is NOT running in the same docker network/host as the host running the dockerized Core/IMS then follow the below additional steps -Under mme section in docker compose file (**docker-compose.yaml**), uncomment the following part +4G deployment: + +Under mme section in docker compose file (**4g-volte-deploy.yaml**), uncomment the following part ``` ... # ports: @@ -109,15 +126,7 @@ Under mme section in docker compose file (**docker-compose.yaml**), uncomment th ... ``` -Under amf section in docker compose file (**docker-compose.yaml**, **sa-deploy.yaml**), uncomment the following part -``` -... - # ports: - # - "38412:38412/sctp" -... -``` - -If deploying in 5G mode only (**sa-deploy.yaml**), then uncomment the following part under **upf** section +Then, uncomment the following part under **sgwu** section ``` ... # ports: @@ -125,7 +134,17 @@ If deploying in 5G mode only (**sa-deploy.yaml**), then uncomment the following ... ``` -If deploying in 4G mode only (**docker-compose.yaml**), then uncomment the following part under **sgwu** section +5G SA deployment: + +Under amf section in docker compose file (**sa-deploy.yaml**), uncomment the following part +``` +... + # ports: + # - "38412:38412/sctp" +... +``` + +Then, uncomment the following part under **upf** section ``` ... # ports: diff --git a/docker-compose.yaml b/deploy-all.yaml similarity index 99% rename from docker-compose.yaml rename to deploy-all.yaml index f09f0ca..4118d3d 100644 --- a/docker-compose.yaml +++ b/deploy-all.yaml @@ -274,6 +274,7 @@ services: - .env environment: - COMPONENT_NAME=smf-1 + - DEPLOY_MODE=ALL volumes: - ./smf:/mnt/smf - ./log:/open5gs/install/var/log/open5gs diff --git a/sa-deploy.yaml b/sa-deploy.yaml index 6ee7c28..0b5d1ab 100644 --- a/sa-deploy.yaml +++ b/sa-deploy.yaml @@ -142,6 +142,7 @@ services: - .env environment: - COMPONENT_NAME=smf-1 + - DEPLOY_MODE=5G volumes: - ./smf:/mnt/smf - ./log:/open5gs/install/var/log/open5gs diff --git a/smf/smf_4g.yaml b/smf/smf_4g.yaml new file mode 100644 index 0000000..1108da5 --- /dev/null +++ b/smf/smf_4g.yaml @@ -0,0 +1,48 @@ +logger: + file: /open5gs/install/var/log/open5gs/smf.log + +sbi: + server: + no_tls: true + client: + no_tls: true + +parameter: + no_ipv4v6_local_addr_in_packet_filter: true + +smf: + freeDiameter: /open5gs/install/etc/freeDiameter/smf.conf + gtpc: + - addr: SMF_IP + gtpu: + - addr: SMF_IP + pfcp: + - addr: SMF_IP + subnet: + - addr: UE_IPV4_INTERNET_TUN_IP + dnn: internet + dev: ogstun + - addr: 2001:230:cafe::1/48 + dev: ogstun + dnn: internet + - addr: UE_IPV4_IMS_TUN_IP + dnn: ims + dev: ogstun2 + - addr: 2001:230:babe::1/48 + dnn: ims + dev: ogstun2 + dns: + - 8.8.8.8 + - 8.8.4.4 + - 2001:4860:4860::8888 + - 2001:4860:4860::8844 + p-cscf: + - PCSCF_IP + mtu: 1400 + metrics: + - addr: SMF_IP + port: 9091 + +upf: + pfcp: + - addr: UPF_IP diff --git a/smf/smf_init.sh b/smf/smf_init.sh index b1ce446..a7d8af1 100755 --- a/smf/smf_init.sh +++ b/smf/smf_init.sh @@ -37,6 +37,10 @@ UE_IPV4_INTERNET_TUN_IP=$(python3 /mnt/smf/ip_utils.py --ip_range $UE_IPV4_INTER 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 + cp /mnt/smf/smf_4g.yaml install/etc/open5gs/smf.yaml +fi cp /mnt/smf/smf.conf install/etc/freeDiameter cp /mnt/smf/make_certs.sh install/etc/freeDiameter @@ -53,6 +57,8 @@ sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/smf.conf sed -i 's|LD_LIBRARY_PATH|'$LD_LIBRARY_PATH'|g' install/etc/freeDiameter/smf.conf sed -i 's|EPC_DOMAIN|'$EPC_DOMAIN'|g' install/etc/freeDiameter/make_certs.sh + + # Generate TLS certificates ./install/etc/freeDiameter/make_certs.sh install/etc/freeDiameter