Commit 7cbf2bd2 authored by yangjian's avatar yangjian

add scripts/start.sh: Start multiple 5gcs and ueransim

parent 43666fef
......@@ -13,7 +13,7 @@ services:
max-size: "100m"
networks:
openxg:
ipv4_address: 172.11.200.14
ipv4_address: 10.0.0.4
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
......@@ -26,18 +26,18 @@ services:
- MCC=466
- MNC=92
- TAC=100
- AMF_MySQL_SERVER_ADDR=172.11.200.10
- AMF_MySQL_SERVER_ADDR=10.0.0.2
- AMF_MySQL_USERNAME=root
- AMF_MySQL_PASSWORD=123456
- AMF_MySQL_DATABASE=amfusers
# SMF
- SMF_DEFAULT_IPV4_RANGE=192.169.0.3 - 192.169.199.253
- SMF_IMS_IPV4_RANGE=192.169.200.2 - 192.169.255.253
- SMF_CTNET_IPV4_RANGE=192.169.0.3 - 192.169.199.253
- SMF_INTERNET_IPV4_RANGE=192.169.0.3 - 192.169.199.253
- SMF_DEFAULT_IPV4_RANGE=12.0.0.3 - 12.0.199.253
- SMF_IMS_IPV4_RANGE=12.0.200.2 - 12.0.255.253
- SMF_CTNET_IPV4_RANGE=12.0.0.3 - 12.0.199.253
- SMF_INTERNET_IPV4_RANGE=12.0.0.3 - 12.0.199.253
# UPF
- INTERFACE_NAME=eth0
- UPF_PDN_NETWORK_IPV4=192.169.0.0/16
- UPF_PDN_NETWORK_IPV4=12.0.0.0/16
openxg-5gc-2:
image: openxg5gc/openxg-5gc:latest
......@@ -52,7 +52,7 @@ services:
max-size: "100m"
networks:
openxg:
ipv4_address: 172.11.200.15
ipv4_address: 10.1.0.4
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
......@@ -65,18 +65,18 @@ services:
- MCC=466
- MNC=91
- TAC=100
- AMF_MySQL_SERVER_ADDR=172.11.200.10
- AMF_MySQL_SERVER_ADDR=10.0.0.2
- AMF_MySQL_USERNAME=root
- AMF_MySQL_PASSWORD=123456
- AMF_MySQL_DATABASE=amfusers
# SMF
- SMF_DEFAULT_IPV4_RANGE=192.170.0.3 - 192.170.199.253
- SMF_IMS_IPV4_RANGE=192.170.200.2 - 192.170.255.253
- SMF_CTNET_IPV4_RANGE=192.170.0.3 - 192.170.199.253
- SMF_INTERNET_IPV4_RANGE=192.170.0.3 - 192.170.199.253
- SMF_DEFAULT_IPV4_RANGE=12.1.0.3 - 12.1.199.253
- SMF_IMS_IPV4_RANGE=12.1.200.2 - 12.1.255.253
- SMF_CTNET_IPV4_RANGE=12.1.0.3 - 12.1.199.253
- SMF_INTERNET_IPV4_RANGE=12.1.0.3 - 12.1.199.253
# UPF
- INTERFACE_NAME=eth0
- UPF_PDN_NETWORK_IPV4=192.170.0.0/16
- UPF_PDN_NETWORK_IPV4=12.1.0.0/16
openxg-5gc-3:
image: openxg5gc/openxg-5gc:latest
container_name: openxg-5gc-3
......@@ -90,7 +90,7 @@ services:
max-size: "100m"
networks:
openxg:
ipv4_address: 172.11.200.16
ipv4_address: 10.2.0.4
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
......@@ -103,18 +103,18 @@ services:
- MCC=466
- MNC=93
- TAC=100
- AMF_MySQL_SERVER_ADDR=172.11.200.10
- AMF_MySQL_SERVER_ADDR=10.0.0.2
- AMF_MySQL_USERNAME=root
- AMF_MySQL_PASSWORD=123456
- AMF_MySQL_DATABASE=amfusers
# SMF
- SMF_DEFAULT_IPV4_RANGE=192.171.0.3 - 192.171.199.253
- SMF_IMS_IPV4_RANGE=192.171.200.2 - 192.171.255.253
- SMF_CTNET_IPV4_RANGE=192.171.0.3 - 192.171.199.253
- SMF_INTERNET_IPV4_RANGE=192.171.0.3 - 192.171.199.253
- SMF_DEFAULT_IPV4_RANGE=12.2.0.3 - 12.2.199.253
- SMF_IMS_IPV4_RANGE=12.2.200.2 - 12.2.255.253
- SMF_CTNET_IPV4_RANGE=12.2.0.3 - 12.2.199.253
- SMF_INTERNET_IPV4_RANGE=12.2.0.3 - 12.2.199.253
# UPF
- INTERFACE_NAME=eth0
- UPF_PDN_NETWORK_IPV4=192.171.0.0/16
- UPF_PDN_NETWORK_IPV4=12.2.0.0/16
openxg-5gc-4:
image: openxg5gc/openxg-5gc:latest
container_name: openxg-5gc-4
......@@ -128,7 +128,7 @@ services:
max-size: "100m"
networks:
openxg:
ipv4_address: 172.11.200.17
ipv4_address: 10.3.0.4
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
......@@ -141,18 +141,18 @@ services:
- MCC=466
- MNC=94
- TAC=100
- AMF_MySQL_SERVER_ADDR=172.11.200.10
- AMF_MySQL_SERVER_ADDR=10.0.0.2
- AMF_MySQL_USERNAME=root
- AMF_MySQL_PASSWORD=123456
- AMF_MySQL_DATABASE=amfusers
# SMF
- SMF_DEFAULT_IPV4_RANGE=192.172.0.3 - 192.172.199.253
- SMF_IMS_IPV4_RANGE=192.172.200.2 - 192.172.255.253
- SMF_CTNET_IPV4_RANGE=192.172.0.3 - 192.172.199.253
- SMF_INTERNET_IPV4_RANGE=192.172.0.3 - 192.172.199.253
- SMF_DEFAULT_IPV4_RANGE=12.3.0.3 - 12.3.199.253
- SMF_IMS_IPV4_RANGE=12.3.200.2 - 12.3.255.253
- SMF_CTNET_IPV4_RANGE=12.3.0.3 - 12.3.199.253
- SMF_INTERNET_IPV4_RANGE=12.3.0.3 - 12.3.199.253
# UPF
- INTERFACE_NAME=eth0
- UPF_PDN_NETWORK_IPV4=192.172.0.0/16
- UPF_PDN_NETWORK_IPV4=12.3.0.0/16
networks:
openxg:
......
......@@ -13,7 +13,7 @@ services:
max-size: "100m"
networks:
openxg:
ipv4_address: 172.11.200.14
ipv4_address: 10.0.0.4
volumes:
- /etc/timezone:/etc/timezone
- /etc/localtime:/etc/localtime
......@@ -26,18 +26,18 @@ services:
- MCC=466
- MNC=92
- TAC=100
- AMF_MySQL_SERVER_ADDR=172.11.200.10
- AMF_MySQL_SERVER_ADDR=10.0.0.2
- AMF_MySQL_USERNAME=root
- AMF_MySQL_PASSWORD=123456
- AMF_MySQL_DATABASE=amfusers
# SMF
- SMF_DEFAULT_IPV4_RANGE=192.169.0.3 - 192.169.199.253
- SMF_IMS_IPV4_RANGE=192.169.200.2 - 192.169.255.253
- SMF_CTNET_IPV4_RANGE=192.169.0.3 - 192.169.199.253
- SMF_INTERNET_IPV4_RANGE=192.169.0.3 - 192.169.199.253
- SMF_DEFAULT_IPV4_RANGE=12.0.0.3 - 12.0.199.253
- SMF_IMS_IPV4_RANGE=12.0.200.2 - 12.0.255.253
- SMF_CTNET_IPV4_RANGE=12.0.0.3 - 12.0.199.253
- SMF_INTERNET_IPV4_RANGE=12.0.0.3 - 12.0.199.253
# UPF
- INTERFACE_NAME=eth0
- UPF_PDN_NETWORK_IPV4=192.169.0.0/16
- UPF_PDN_NETWORK_IPV4=12.0.0.0/16
networks:
openxg:
......
......@@ -10,7 +10,7 @@ services:
max-size: "100m"
networks:
openxg:
ipv4_address: 172.11.200.200
ipv4_address: 10.11.12.1
stdin_open: true
tty: true
volumes:
......
......@@ -12,7 +12,7 @@ services:
openxg:
aliases:
- web_mysql
ipv4_address: 172.11.200.10
ipv4_address: 10.0.0.2
ports:
- "3306:3306"
- "33060:33060"
......@@ -39,11 +39,11 @@ services:
openxg:
aliases:
- web_phpmyadmin
ipv4_address: 172.11.200.9
ipv4_address: 10.0.0.3
ports:
- "8080:80"
environment:
PMA_HOST: 172.11.200.10
PMA_HOST: 10.0.0.2
PMA_PORT: 3306
networks:
......@@ -52,6 +52,6 @@ networks:
name: docker-openxg
ipam:
config:
- subnet: 172.11.200.0/24
- subnet: 10.0.0.0/8
driver_opts:
com.docker.network.bridge.name: "docker-openxg"
version: '3.8'
services:
openxg-gnb-1:
container_name: "openxg-gnb-1"
openxg-gnb-1-1:
container_name: "openxg-gnb-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
......@@ -12,7 +12,7 @@ services:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.100
ipv4_address: 10.0.0.5
command: /bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -23,8 +23,8 @@ services:
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=172.11.200.100
- AMF_IP=172.11.200.14
- GNB_IP=10.0.0.5
- AMF_IP=10.0.0.4
- NIC=0x000000010
- COREIP=127.0.0.1
- COREPORT=7777
......@@ -43,21 +43,21 @@ services:
- ENCONDINGMODE=1
- BROADCASTIP=127.0.0.1
- BROADCASTPORT=1111
openxg-ue-1-1:
openxg-ue-1-1-1:
container_name: "openxg-ue-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-1
- openxg-gnb-1-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.200
ipv4_address: 10.0.0.6
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -68,15 +68,15 @@ services:
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=172.11.200.100
- GNB_IP=10.0.0.5
- IMSI=466920000000001
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
- AMF_VALUE=8000
- CONTROLPORT=9988
- CONTROLIP=127.0.0.1
openxg-gnb-2:
container_name: "openxg-gnb-2"
openxg-gnb-2-1:
container_name: "openxg-gnb-2-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
......@@ -87,7 +87,7 @@ services:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.101
ipv4_address: 10.1.0.5
command: /bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -98,8 +98,8 @@ services:
- MCC=466
- MNC=91
- TAC=100
- GNB_IP=172.11.200.101
- AMF_IP=172.11.200.15
- GNB_IP=10.1.0.5
- AMF_IP=10.1.0.4
- NIC=0x000000020
- COREIP=127.0.0.1
- COREPORT=7777
......@@ -118,21 +118,21 @@ services:
- ENCONDINGMODE=1
- BROADCASTIP=127.0.0.1
- BROADCASTPORT=1111
openxg-ue-2-1:
container_name: "openxg-ue-2-1"
openxg-ue-2-1-1:
container_name: "openxg-ue-2-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-2
- openxg-gnb-2-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.201
ipv4_address: 10.1.0.6
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -143,15 +143,15 @@ services:
- MCC=466
- MNC=91
- TAC=100
- GNB_IP=172.11.200.101
- GNB_IP=10.1.0.5
- IMSI=466910000000001
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
- AMF_VALUE=8000
- CONTROLPORT=9988
- CONTROLIP=127.0.0.1
openxg-gnb-3:
container_name: "openxg-gnb-3"
openxg-gnb-3-1:
container_name: "openxg-gnb-3-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
......@@ -162,7 +162,7 @@ services:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.102
ipv4_address: 10.2.0.5
command: /bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -173,8 +173,8 @@ services:
- MCC=466
- MNC=93
- TAC=100
- GNB_IP=172.11.200.102
- AMF_IP=172.11.200.16
- GNB_IP=10.2.0.5
- AMF_IP=10.2.0.4
- NIC=0x000000030
- COREIP=127.0.0.1
- COREPORT=7777
......@@ -193,21 +193,21 @@ services:
- ENCONDINGMODE=1
- BROADCASTIP=127.0.0.1
- BROADCASTPORT=1111
openxg-ue-3-1:
container_name: "openxg-ue-3-1"
openxg-ue-3-1-1:
container_name: "openxg-ue-3-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-3
- openxg-gnb-3-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.202
ipv4_address: 10.2.0.6
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -218,15 +218,15 @@ services:
- MCC=466
- MNC=93
- TAC=100
- GNB_IP=172.11.200.102
- GNB_IP=10.2.0.5
- IMSI=466930000000001
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
- AMF_VALUE=8000
- CONTROLPORT=9988
- CONTROLIP=127.0.0.1
openxg-gnb-4:
container_name: "openxg-gnb-4"
openxg-gnb-4-1:
container_name: "openxg-gnb-4-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
......@@ -237,7 +237,7 @@ services:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.103
ipv4_address: 10.3.0.5
command: /bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -248,8 +248,8 @@ services:
- MCC=466
- MNC=94
- TAC=100
- GNB_IP=172.11.200.103
- AMF_IP=172.11.200.17
- GNB_IP=10.3.0.5
- AMF_IP=10.3.0.4
- NIC=0x000000040
- COREIP=127.0.0.1
- COREPORT=7777
......@@ -268,21 +268,21 @@ services:
- ENCONDINGMODE=1
- BROADCASTIP=127.0.0.1
- BROADCASTPORT=1111
openxg-ue-4-1:
container_name: "openxg-ue-4-1"
openxg-ue-4-1-1:
container_name: "openxg-ue-4-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-4
- openxg-gnb-4-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.203
ipv4_address: 10.3.0.6
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -293,7 +293,7 @@ services:
- MCC=466
- MNC=94
- TAC=100
- GNB_IP=172.11.200.103
- GNB_IP=10.3.0.5
- IMSI=466940000000001
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
......
version: '3.8'
services:
openxg-gnb-1:
container_name: "openxg-gnb-1"
openxg-gnb-1-1:
container_name: "openxg-gnb-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
......@@ -12,7 +12,7 @@ services:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.100
ipv4_address: 10.0.0.5
command: /bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -23,8 +23,8 @@ services:
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=172.11.200.100
- AMF_IP=172.11.200.14
- GNB_IP=10.0.0.5
- AMF_IP=10.0.0.4
- NIC=0x000000010
- COREIP=127.0.0.1
- COREPORT=7777
......@@ -43,21 +43,21 @@ services:
- ENCONDINGMODE=1
- BROADCASTIP=127.0.0.1
- BROADCASTPORT=1111
openxg-ue-1-1:
container_name: "openxg-ue-1-1"
openxg-ue-1-1-1:
container_name: "openxg-ue-1-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-1
- openxg-gnb-1-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 172.11.200.101
ipv4_address: 10.0.0.6
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
......@@ -68,7 +68,7 @@ services:
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=172.11.200.100
- GNB_IP=10.0.0.5
- IMSI=466920000000001
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
......
version: '3.8'
services:
openxg-gnb-1-1:
container_name: "openxg-gnb-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 10.0.0.5
command: /bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
- ../template/gnb.template:/ueransim/etc/gnb.template
#- ./lib/nr-gnb:/ueransim/bin/nr-gnb
environment:
- UERANSIM_TYPE=GNB # Which to use GNB/UE
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=10.0.0.5
- AMF_IP=10.0.0.4
- NIC=0x000000010
- COREIP=127.0.0.1
- COREPORT=7777
- GNBTYPE=0 #TD:0;FD:1;地面:2;5G:3
- UPRESOURCEALLOCATION=78,10;32,8;40,2 #10个78M,8个32M
- DOWNRESOURCEALLOCATION=78,10;32,8;40,2 #10个78M,8个32M
- UPFREQUENCYMINIMUMRESOURCE=0 #频域最小资源
- UPTIMEPERIOD=0 #时域周期
- UPTIMEMINIMUMRESOURCE=0 #时域最小资源配置
- UPTOTALNUMBEROFLINES=0 #线路总数
- DOWNFREQUENCYMINIMUMRESOURCE=0
- DOWNTIMEPERIOD=0
- DOWNTIMEMINIMUMRESOURCE=0
- DOWNTOTALNUMBEROFLINES=0
- MODUALITIONMODE=1
- ENCONDINGMODE=1
- BROADCASTIP=127.0.0.1
- BROADCASTPORT=1111
openxg-ue-1-1-1:
container_name: "openxg-ue-1-1-1"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-1-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 10.0.0.6
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
- ../template/ue.template:/ueransim/etc/ue.template
#- ./lib/nr-ue:/ueransim/bin/nr-ue
environment:
- UERANSIM_TYPE=UE # Which to use GNB/UE
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=10.0.0.5
- IMSI=466920000000001
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
- AMF_VALUE=8000
- CONTROLPORT=9988
- CONTROLIP=127.0.0.1
openxg-ue-1-1-2:
container_name: "openxg-ue-1-1-2"
image: openxg5gc/openxg-ueransim:v3.2.6
privileged: true
stdin_open: true
tty: true
depends_on:
- openxg-gnb-1-1
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
openxg:
ipv4_address: 10.0.0.7
command: /bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
volumes:
- ../template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py
- ../template/ue.template:/ueransim/etc/ue.template
#- ./lib/nr-ue:/ueransim/bin/nr-ue
environment:
- UERANSIM_TYPE=UE # Which to use GNB/UE
- MCC=466
- MNC=92
- TAC=100
- GNB_IP=10.0.0.5
- IMSI=466920000000002
- KEY=00112233445566778899aabbccddeeff
- OPC=000102030405060708090a0b0c0d0e0f
- AMF_VALUE=8000
- CONTROLPORT=9988
- CONTROLIP=127.0.0.1
networks:
openxg:
name: docker-openxg
external: true
#!/bin/bash
# 显示帮助信息的函数
help() {
echo "Usage: $0 --5gc <value> --gnb <value> --ue <value>"
echo
echo "Options:"
echo " --5gc <value> Set the 5gc value."
echo " --gnb <value> Set the gnb value."
echo " --ue <value> Set the ue value."
echo " --close Close the project."
echo " --help Display this help message."
}
close() {
docker rm -f $(docker ps -aq)
}
# 处理命令行参数的函数
process_args() {
while [[ "$#" -gt 0 ]]; do
case $1 in
--5gc)
if [[ -n $2 && $2 != --* ]]; then
fivegc_value=$2
shift 2
else
echo "Error: --5gc requires a value."
exit 1
fi
;;
--gnb)
if [[ -n $2 && $2 != --* ]]; then
gnb_value=$2
shift 2
else
echo "Error: --gnb requires a value."
exit 1
fi
;;
--ue)
if [[ -n $2 && $2 != --* ]]; then
ue_value=$2
shift 2
else
echo "Error: --ue requires a value."
exit 1
fi
;;
--close)
close
exit 0
;;
--help)
help
exit 0
;;
*)
echo "Error: Invalid option $1"
help
exit 1
;;
esac
done
}
start_5gc() {
docker run -itd --log-opt max-size=10m --privileged=true \
--name $1 \
--network docker-openxg --ip 10.$2.0.4 \
-v "$SRC/template/amf.template:/opt/5gcs/etc/amf.template" \
-v "$SRC/template/smf.template:/opt/5gcs/etc/smf.template" \
-v "$SRC/template/upf.template:/opt/5gcs/etc/upf.template" \
-v "$SRC/template/entrypoint_5gc.py:/opt/5gcs/etc/entrypoint.py" \
-e "MCC=$3" \
-e "MNC=$4" \
-e "TAC=100" \
-e "AMF_MySQL_SERVER_ADDR=10.$5.0.2" \
-e "AMF_MySQL_USERNAME=root" \
-e "AMF_MySQL_PASSWORD=123456" \
-e "AMF_MySQL_DATABASE=amfusers" \
-e "SMF_DEFAULT_IPV4_RANGE=12.$2.0.3 - 12.$2.199.253" \
-e "SMF_IMS_IPV4_RANGE=12.$2.200.2 - 12.$2.255.253" \
-e "SMF_CTNET_IPV4_RANGE=12.$2.0.3 - 12.$2.199.253" \
-e "SMF_INTERNET_IPV4_RANGE=12.$2.0.3 - 12.$2.199.253" \
-e "INTERFACE_NAME=eth0" \
-e "UPF_PDN_NETWORK_IPV4=12.$2.0.0/16" \
openxg5gc/openxg-5gc:latest
}
start_gnb() {
# -v "$SRC/docker-compose/lib/nr-gnb:/ueransim/bin/nr-gnb" \
docker run -itd --log-opt max-size=10m --privileged=true \
--name $1 \
--network docker-openxg --ip $2 \
-v "$SRC/template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py" \
-v "$SRC/template/gnb.template:/ueransim/etc/gnb.template" \
-e "UERANSIM_TYPE=GNB" \
-e "MCC=$3" \
-e "MNC=$4" \
-e "TAC=100" \
-e "GNB_IP=$2" \
-e "AMF_IP=$5" \
-e "NIC=$6" \
-e "COREIP=127.0.0.1" \
-e "COREPORT=7777" \
-e "GNBTYPE=0" \
-e "UPRESOURCEALLOCATION=78,10;32,8;40,2" \
-e "DOWNRESOURCEALLOCATION=78,10;32,8;40,2" \
-e "UPFREQUENCYMINIMUMRESOURCE=0" \
-e "UPTIMEPERIOD=0" \
-e "UPTIMEMINIMUMRESOURCE=0" \
-e "UPTOTALNUMBEROFLINES=0" \
-e "DOWNFREQUENCYMINIMUMRESOURCE=0" \
-e "DOWNTIMEPERIOD=0" \
-e "DOWNTIMEMINIMUMRESOURCE=0" \
-e "DOWNTOTALNUMBEROFLINES=0" \
-e "MODUALITIONMODE=1" \
-e "ENCONDINGMODE=1" \
-e "BROADCASTIP=127.0.0.1" \
-e "BROADCASTPORT=1111" \
openxg5gc/openxg-ueransim:v3.2.6 \
/bin/bash -c "/ueransim/bin/nr-gnb -c /ueransim/etc/gnb.yaml"
}
start_ue() {
# -v "$SRC/docker-compose/lib/nr-ue:/ueransim/bin/nr-ue" \
docker run -itd --log-opt max-size=10m --privileged=true \
--name $1 \
--network docker-openxg --ip $2 \
-v "$SRC/template/entrypoint_ueransim.py:/ueransim/etc/entrypoint.py" \
-v "$SRC/template/ue.template:/ueransim/etc/ue.template" \
-e "UERANSIM_TYPE=UE" \
-e "MCC=$3" \
-e "MNC=$4" \
-e "TAC=100" \
-e "GNB_IP=$5" \
-e "IMSI=$6" \
-e "KEY=00112233445566778899aabbccddeeff" \
-e "OPC=000102030405060708090a0b0c0d0e0f" \
-e "AMF_VALUE=8000" \
-e "CONTROLPORT=9988" \
-e "CONTROLIP=127.0.0.1" \
openxg5gc/openxg-ueransim:v3.2.6 \
/bin/bash -c "/ueransim/bin/nr-ue -c /ueransim/etc/ue.yaml"
}
# IPv4 地址自增
ip_increment() {
local ip=$1
local a b c d
IFS=. read -r a b c d <<< "$ip"
local ip_int=$(( (a << 24) | (b << 16) | (c << 8) | d ))
ip_int=$(($ip_int + 1))
echo "$(( (ip_int >> 24) & 0xFF )).$(( (ip_int >> 16) & 0xFF )).$(( (ip_int >> 8) & 0xFF )).$(( ip_int & 0xFF ))"
}
# 初始化默认值
SRC="/home/witcomm/yj/diankeyuan/openxg-5gcs-release"
fivegc_value="1"
gnb_value=""
ue_value=""
# 处理命令行参数
process_args "$@"
# 检查是否提供了所需的参数
if [[ -z $gnb_value || -z $ue_value ]]; then
echo "Error: Both --gnb and --ue options are required."
help
exit 1
fi
# 打印传递的参数
echo "5GC Value: $fivegc_value"
echo "gNB Value: $gnb_value"
echo "UE Value: $ue_value"
mcc=466
mnc=91
nic=0x000000000
for ((i=0; i<fivegc_value; i++)); do
echo "Start 5GC: openxg-5gc-$i"
start_5gc openxg-5gc-$i $i $mcc $mnc 0
amf_ip="10.$i.0.4"
gnb_ue_ipv4=$amf_ip
imsi=$(($(($mcc$mnc)) * 10000000000))
sleep 3
for ((j=0; j<gnb_value; j++)); do
gnb_ue_ipv4=$(ip_increment "$gnb_ue_ipv4")
gnb_ip=$gnb_ue_ipv4
nic=$((nic+0x10))
echo "Start gNB: openxg-gnb-$i-$j"
start_gnb openxg-gnb-$i-$j $gnb_ip $mcc $mnc $amf_ip $(printf "0x%09x\n" "$nic")
for ((k=0; k<ue_value; k++)); do
gnb_ue_ipv4=$(ip_increment "$gnb_ue_ipv4")
imsi=$(($imsi+1))
echo "Start UE: openxg-ue-$i-$j-$k imsi($imsi)"
start_ue openxg-ue-$i-$j-$k $gnb_ue_ipv4 $mcc $mnc $gnb_ip $imsi
done
done
mnc=$((mnc + 1))
if [[ $mnc -gt 99 ]]; then
echo "Error: mnc($mnc) > 99, out of range!"
exit 0
fi
sleep 3
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment