From c70aa4c43a14aa0bdee525055194885308be1931 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 13 Aug 2021 14:21:50 +0200 Subject: [PATCH 1/3] fix(nr-ue): apply ip rules/route Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 18 +-- ci-scripts/xml_files/container_4g_rfsim.xml | 130 ++++++++++++++++++ .../xml_files/container_4g_rfsim_down.xml | 38 +++++ ci-scripts/xml_files/container_5g_rfsim.xml | 1 + .../yaml_files/5g_rfsimulator/README.md | 28 ---- openair2/RRC/NAS/nas_config.c | 13 ++ 6 files changed, 185 insertions(+), 43 deletions(-) create mode 100644 ci-scripts/xml_files/container_4g_rfsim.xml create mode 100644 ci-scripts/xml_files/container_4g_rfsim_down.xml diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 63b707aa74..3e65f83e06 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -596,20 +596,6 @@ class Containerize(): else: time.sleep(10) - # HACK TO REMOVE LATER WHEN FIX - res = re.search('oai-nr-ue', self.services[0]) - if res is not None: - cmd = 'docker exec rfsim5g-oai-nr-ue /bin/bash -c "ip route del default"' - logging.debug(cmd) - deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - cmd = 'docker exec rfsim5g-oai-nr-ue /bin/bash -c "ip route del 12.1.1.0/24"' - logging.debug(cmd) - deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - cmd = 'docker exec rfsim5g-oai-nr-ue /bin/bash -c "ip route add default via 12.1.1.2 dev oaitun_ue1"' - logging.debug(cmd) - deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - # END OF HACK TO REMOVE LATER WHEN FIX - if count == 100 and healthy == self.nb_healthy[0]: HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m') @@ -628,7 +614,7 @@ class Containerize(): logging.debug(cmd) subprocess.run(cmd, shell=True) -# if the containers are running, recover the logs! + # if the containers are running, recover the logs! cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml ps --all' logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) @@ -831,7 +817,9 @@ class Containerize(): logging.debug('\u001B[1;34m Jitter : ' + jitter + '\u001B[0m') self.IperfExit(HTML, iperfStatus, msg) else: + iperfStatus = False logging.error('problem?') + self.IperfExit(HTML, iperfStatus, 'problem?') if iperfStatus: logging.info('\u001B[1m Iperf Test PASS\u001B[0m') diff --git a/ci-scripts/xml_files/container_4g_rfsim.xml b/ci-scripts/xml_files/container_4g_rfsim.xml new file mode 100644 index 0000000000..f342c3f5ce --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim.xml @@ -0,0 +1,130 @@ + + + rfsim-4gnr + Testing 4G NR RF sim in containers + wrench + 4 + + 100011 + 000011 + 000001 + 000012 + 000002 + 000013 + 000001 + 000014 + 000002 + 020011 + 020012 + 030011 + 030012 + 100011 + + + + + DeployGenObject + Deploy Cassandra Database + yaml_files/4g_rfsimulator + cassandra db_init + 1 + + + + IdleSleep + Sleep + 30 + + + + IdleSleep + Sleep + 10 + + + + DeployGenObject + Deploy OAI 4G CoreNetwork + yaml_files/4g_rfsimulator + oai_hss oai_mme oai_spgwc oai_spgwu trf_gen + 6 + + + + DeployGenObject + Deploy OAI 4G eNB RF sim + yaml_files/4g_rfsimulator + enb + 7 + + + + DeployGenObject + Deploy OAI 4G NR-UE RF sim + yaml_files/4g_rfsimulator + oai_ue0 + 8 + + + + PingFromContainer + Ping Traffic-Gen from LTE-UE + rfsim4g-oai-lte-ue0 + -I oaitun_ue1 -c 20 192.168.61.11 + 5 + + + + PingFromContainer + Ping LTE-UE from Traffic-Gen + rfsim4g-trf-gen + -c 20 12.0.0.2 + 5 + + + + IperfFromContainer + Iperf UDP Downlink + rfsim4g-oai-lte-ue0 + rfsim4g-trf-gen + -B 12.0.0.2 -u -i 1 -s + -c 12.0.0.2 -u -i 1 -t 30 -b 4M + + + + IperfFromContainer + Iperf UDP Uplink + rfsim4g-trf-gen + rfsim4g-oai-lte-ue0 + -u -i 1 -s + -B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 2M + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator + + + diff --git a/ci-scripts/xml_files/container_4g_rfsim_down.xml b/ci-scripts/xml_files/container_4g_rfsim_down.xml new file mode 100644 index 0000000000..cce2b32cf3 --- /dev/null +++ b/ci-scripts/xml_files/container_4g_rfsim_down.xml @@ -0,0 +1,38 @@ + + + rfsim-4gnr + Testing 4G NR RF sim in containers + wrench + + 100011 + + + + + UndeployGenObject + Undeploy all OAI 4G stack + yaml_files/4g_rfsimulator + + + diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index 8847c11894..660cd7cde8 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -25,6 +25,7 @@ Testing 5G NR RF sim in containers wrench + 100001 000001 000002 000003 diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 807f1b47c5..1351d6742b 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -218,34 +218,6 @@ oaitun_ue1: flags=4305 mtu 1500 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` -**CAUTION: THESE NEXT FEW COMMANDS ARE A HACK. RAN developers SHALL FIX THIS!** - -```bash -$ docker exec -it rfsim5g-oai-nr-ue /bin/bash - -# Check the current routes - -root@bb4d400a832d:/opt/oai-nr-ue# ip route -default via 192.168.71.129 dev eth0 -12.1.1.0/24 dev oaitun_ue1 proto kernel scope link src 12.1.1.2 -192.168.71.128/26 dev eth0 proto kernel scope link src 192.168.71.137 - -# Remove the default and PDN routes - -root@bb4d400a832d:/opt/oai-nr-ue# ip route del default -root@bb4d400a832d:/opt/oai-nr-ue# ip route del 12.1.1.0/24 - -# Force the default route through oaitun_ue1 tunnel - -root@bb4d400a832d:/opt/oai-nr-ue# ip route add default via 12.1.1.2 dev oaitun_ue1 - -# Check the new routes - -root@bb4d400a832d:/opt/oai-nr-ue# ip route -default via 12.1.1.2 dev oaitun_ue1 -192.168.71.128/26 dev eth0 proto kernel scope link src 192.168.71.137 -``` - # 3. Check traffic # ## 3.1. Check your Internet connectivity ## diff --git a/openair2/RRC/NAS/nas_config.c b/openair2/RRC/NAS/nas_config.c index 2eb439b9e9..22a7ef2711 100644 --- a/openair2/RRC/NAS/nas_config.c +++ b/openair2/RRC/NAS/nas_config.c @@ -344,6 +344,19 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname) LOG_E(OIP,"Interface %s couldn't be configured (ip address %s, mask %s broadcast address %s)\n", interfaceName, ipAddress, netMask, broadcastAddress); + int res; + char command_line[500]; + res = sprintf(command_line, + "ip rule add from %s/32 table %d && " + "ip rule add to %s/32 table %d && " + "ip route add default dev %s%d table %d", + ipAddress, interface_id - 1 + 10000, + ipAddress, interface_id - 1 + 10000, + UE_NAS_USE_TUN ? "oaitun_ue" : "oip", + interface_id, interface_id - 1 + 10000); + + background_system(command_line); + return returnValue; } From 309a8c3e3e9151993a00673ab46818c379389302 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 30 Aug 2021 14:31:22 +0200 Subject: [PATCH 2/3] CI: -- Reduce required BW test in 4G RF sim Docker: -- Made the "Thread Parallel Config" a flexible parameter default is SINGLE_THREAD -- Clean Up on some Docker file about pyyaml Signed-off-by: Raphael Defosseux --- ci-scripts/xml_files/container_4g_rfsim.xml | 4 ++-- docker/Dockerfile.lteUE.rhel8.2 | 4 +--- docker/Dockerfile.lteUE.ubuntu18 | 4 +--- docker/scripts/enb_entrypoint.sh | 1 + docker/scripts/enb_parameters.yaml | 16 ++++++++++++++++ docker/scripts/gnb_entrypoint.sh | 1 + docker/scripts/gnb_parameters.yaml | 4 ++++ 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ci-scripts/xml_files/container_4g_rfsim.xml b/ci-scripts/xml_files/container_4g_rfsim.xml index f342c3f5ce..5f3e5320af 100644 --- a/ci-scripts/xml_files/container_4g_rfsim.xml +++ b/ci-scripts/xml_files/container_4g_rfsim.xml @@ -109,7 +109,7 @@ rfsim4g-oai-lte-ue0 rfsim4g-trf-gen -B 12.0.0.2 -u -i 1 -s - -c 12.0.0.2 -u -i 1 -t 30 -b 4M + -c 12.0.0.2 -u -i 1 -t 30 -b 2M @@ -118,7 +118,7 @@ rfsim4g-trf-gen rfsim4g-oai-lte-ue0 -u -i 1 -s - -B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 2M + -B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 1M diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index 2d540876e3..936780297a 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -37,9 +37,7 @@ RUN /bin/sh oaienv && \ mkdir -p log && \ ./build_oai --UE --ninja -w USRP --verbose-ci -RUN yum install -y python3-pip && \ - pip3 install --ignore-installed pyyaml && \ - python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ +RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml #start from scratch for target executable diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index c6a70a0b50..34cbe651ad 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -37,9 +37,7 @@ RUN /bin/sh oaienv && \ mkdir -p log && \ ./build_oai --UE --ninja -w USRP --verbose-ci -RUN apt-get install -y python3-pip && \ - pip3 install --ignore-installed pyyaml && \ - python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ +RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml #start from scratch for target executable diff --git a/docker/scripts/enb_entrypoint.sh b/docker/scripts/enb_entrypoint.sh index 4ac86ef1b7..2e8886e855 100755 --- a/docker/scripts/enb_entrypoint.sh +++ b/docker/scripts/enb_entrypoint.sh @@ -6,6 +6,7 @@ PREFIX=/opt/oai-enb RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0} ENABLE_MEASUREMENT_REPORTS=${ENABLE_MEASUREMENT_REPORTS:-no} ENABLE_X2=${ENABLE_X2:-no} +THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD} # Based another env var, pick one template to use if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi diff --git a/docker/scripts/enb_parameters.yaml b/docker/scripts/enb_parameters.yaml index 58715a7152..07bba4479b 100644 --- a/docker/scripts/enb_parameters.yaml +++ b/docker/scripts/enb_parameters.yaml @@ -98,6 +98,8 @@ env: "@NID_CELL@" - key: N_RB_DL env: "@NB_PRB@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: rru.fdd outputfilename: "rru.fdd.conf" @@ -110,6 +112,8 @@ env: "@RRU_LOCAL_IP_ADDRESS@" - key: bands env: "@UTRA_BAND_ID@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: rru.tdd outputfilename: "rru.tdd.conf" @@ -122,6 +126,8 @@ env: "@RRU_LOCAL_IP_ADDRESS@" - key: bands env: "@UTRA_BAND_ID@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: enb.band7.tm1.fr1.25PRB.usrpb210.conf outputfilename: "enb.fdd.conf" @@ -171,6 +177,8 @@ env: "@FLEXRAN_INTERFACE_NAME@" - key: FLEXRAN_IPV4_ADDRESS env: "@FLEXRAN_IPV4_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: enb.band40.tm1.25PRB.FairScheduler.usrpb210 outputfilename: "enb.tdd.conf" @@ -208,6 +216,8 @@ env: "@F1_CU_IP_ADDRESS@" - key: ENB_IPV4_ADDRESS_FOR_X2C env: "@F1_CU_IP_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: "rcc.band7.tm1.nfapi" outputfilename: "rcc.nfapi.fdd.conf" @@ -251,6 +261,8 @@ env: "@F1_CU_IP_ADDRESS@" - key: ENB_IPV4_ADDRESS_FOR_X2C env: "@F1_CU_IP_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: "rcc.band7.tm1.if4p5.lo.25PRB" outputfilename: "rcc.if4p5.fdd.conf" @@ -294,6 +306,8 @@ env: "@IF4P5_RRU_IP_ADDRESS@" - key: local_address env: "@IF4P5_RCC_IP_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: "rcc.band40.tm1.25PRB" outputfilename: "rcc.if4p5.tdd.conf" @@ -337,4 +351,6 @@ env: "@IF4P5_RRU_IP_ADDRESS@" - key: local_address env: "@IF4P5_RCC_IP_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" diff --git a/docker/scripts/gnb_entrypoint.sh b/docker/scripts/gnb_entrypoint.sh index 6d3d63629f..678ec6cb1b 100755 --- a/docker/scripts/gnb_entrypoint.sh +++ b/docker/scripts/gnb_entrypoint.sh @@ -4,6 +4,7 @@ set -euo pipefail PREFIX=/opt/oai-gnb ENABLE_X2=${ENABLE_X2:-yes} +THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD} # Based another env var, pick one template to use if [[ -v USE_NSA_TDD_MONO ]]; then ln -s $PREFIX/etc/gnb.nsa.tdd.conf $PREFIX/etc/gnb.conf; fi diff --git a/docker/scripts/gnb_parameters.yaml b/docker/scripts/gnb_parameters.yaml index a13d0d3677..ac5a6cb971 100644 --- a/docker/scripts/gnb_parameters.yaml +++ b/docker/scripts/gnb_parameters.yaml @@ -61,6 +61,8 @@ env: "@FLEXRAN_INTERFACE_NAME@" - key: FLEXRAN_IPV4_ADDRESS env: "@FLEXRAN_IPV4_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" - filePrefix: gnb.band78.sa.fr1.106PRB.usrpn310.conf outputfilename: "gnb.sa.tdd.conf" @@ -89,4 +91,6 @@ env: "@GNB_NGU_IF_NAME@" - key: GNB_IPV4_ADDRESS_FOR_NGU env: "@GNB_NGU_IP_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" From 3bd6309e2eeec154bb6b5cd84ef342e296917dad Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 30 Aug 2021 16:36:40 +0200 Subject: [PATCH 3/3] fix(test): cosmetics in 4G LTE RF sim test Signed-off-by: Raphael Defosseux --- ci-scripts/xml_files/container_4g_rfsim.xml | 5 ++--- ci-scripts/xml_files/container_4g_rfsim_down.xml | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ci-scripts/xml_files/container_4g_rfsim.xml b/ci-scripts/xml_files/container_4g_rfsim.xml index 5f3e5320af..5430b2b056 100644 --- a/ci-scripts/xml_files/container_4g_rfsim.xml +++ b/ci-scripts/xml_files/container_4g_rfsim.xml @@ -21,10 +21,9 @@ --> - rfsim-4gnr - Testing 4G NR RF sim in containers + rfsim-4glte + Testing 4G LTE RF sim in containers wrench - 4 100011 000011 diff --git a/ci-scripts/xml_files/container_4g_rfsim_down.xml b/ci-scripts/xml_files/container_4g_rfsim_down.xml index cce2b32cf3..dee516d924 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_down.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_down.xml @@ -21,9 +21,9 @@ --> - rfsim-4gnr - Testing 4G NR RF sim in containers - wrench + rfsim-4glte-down + CleanUp 4G RF + trash 100011