###### tags: `open5gs` `openairinterface` `RIC` `E2` :::info - **Location:** RT LAB - **Date:** March 4, 2025 - **Author:** Saffana Zyan DINI - **Contact:** Zyzy <M11102815@gapps.ntust.edu.tw> - **Reference:** - [End to End test open5gs and Openairinterface CU/DU split](https://hackmd.io/@HMiZWWkbRWe7Lksri7E63g/SyaWXi3ZJe) - [OAI FlexRIC source code](https://gitlab.eurecom.fr/mosaic5g/flexric) - https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/openair2/E2AP/README.md#212-build-oai-with-e2-agent ::: ## General Source Code, Version and Config 1. Open5GS (optional for testing flexric) - version: v2.7.2-76-gce36143f5 - VM OS : Ubuntu 22.04.6 - IP : 192.168.60.2 - ogstun : 10.45.0.1 1. Openairinterface - version: 2025.w04-9-g94c75bee8f - VM OS : Ubuntu 22.04.6 ## Architecture ![image](https://hackmd.io/_uploads/rJjXxX4sJg.png) ## Call Flow ![image](https://hackmd.io/_uploads/H1wC0fNskl.png) ## Installation Guide ### Clone and Build OAI with e2 interface ``` sudo git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git <directory name> e.g. sudo git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git zy-OAI cd cmake_targets ./build_oai -I -w SIMU --gNB --nrUE --build-e2 --ninja ``` ![image](https://hackmd.io/_uploads/By4ghM4syx.png) check this directory to make sure build e2 and clone flexric sucsess ``` ls zy-OAI/openair2/E2AP/flexric/ ``` ### Flexric Prerequisites * A recent CMake (at least v3.22). specify for ubuntu 22.04, check https://apt.kitware.com/ for other version ``` sudo apt-get update sudo apt-get install ca-certificates gpg wget test -f /usr/share/doc/kitware-archive-keyring/copyright || wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null sudo apt-get update test -f /usr/share/doc/kitware-archive-keyring/copyright || sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg sudo apt-get install kitware-archive-keyring echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy-rc main' | sudo tee -a /etc/apt/sources.list.d/kitware.list >/dev/null sudo apt-get update sudo apt-get install cmake ``` * SWIG (at least v.4.1). in some case you also need to install library of pcre2 you can install by: ``` sudo apt update sudo apt install libpcre2-dev sudo add-apt-repository ppa:deadsnakes/ppa -y sudo apt install python3.8 python3.8-dev python3.8 --version ``` then install SWIG ``` sudo git clone https://github.com/swig/swig.git cd swig sudo git checkout release-4.1 sudo ./autogen.sh sudo ./configure --prefix=/usr/ sudo make -j8 sudo make install ``` ![image](https://hackmd.io/_uploads/ry5eTMNs1g.png) * GCC (gcc-10, gcc-12, or gcc-13) gcc-11 is not currently supported. the default gcc version of ubuntu 22.04 is gcc-11. upgrade or downgrade the version by: ``` sudo apt install -y gcc-10 g++-10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 ``` * install other dependancies ``` sudo apt install libsctp-dev cmake-curses-gui python3-dev ``` * open directory checkout version for flexric ``` cd zy-OAI/openair2/E2AP/flexric/ sudo git checkout f1c08ed2b9b1eceeda7941dd7bf435db0168dd56 ``` > git checkout v1.0.0 is only support in flexric emulation test not support in oai cu/du/gnb test. * Build Flexric ``` sudo mkdir build cd build sudo cmake .. sudo make -j8 ``` ![image](https://hackmd.io/_uploads/SJI4TzEs1x.png) * Install Flexric ``` sudo make install ``` ![image](https://hackmd.io/_uploads/By7DazNsyl.png) By default the service model libraries will be installed in the path /usr/local/lib/flexric while the configuration file in /usr/local/etc/flexric. * check this 2 folder, to make sure installation success ``` ls /usr/local/lib/flexric ls /usr/local/etc/flexric ``` > if you want to rebuild flexric installation you need to remove both previous folder. * Check that everything went fine running the tests: ``` sudo ctest -j8 --output-on-failure ``` ![image](https://hackmd.io/_uploads/SJ2OTfViyx.png) ## Usage/deployment ### Test with emulators * Start the nearRT-RIC ``` ./examples/ric/nearRT-RIC ``` ![image](https://hackmd.io/_uploads/S1bsTMVsye.png) * Start E2 Node agents gNB-mono ``` ./examples/emulator/agent/emu_agent_gnb ``` if CU/DU split is used, start the gNB as follows ``` ./examples/emulator/agent/emu_agent_gnb_cu ./examples/emulator/agent/emu_agent_gnb_du ``` ![Screenshot 2025-03-04 141735](https://hackmd.io/_uploads/Hyh4iM4j1x.png) **Additionally**, feel free to customize your own config files. Here is one example: ``` ./examples/emulator/agent/emu_agent_gnb_cu -c ~/flexric1.conf & ./examples/emulator/agent/emu_agent_gnb_du -c ~/flexric2.conf & ``` where, flexric1.conf is: ``` [NEAR-RIC] NEAR_RIC_IP = 127.0.0.1 [XAPP] DB_PATH = /tmp/ DB_NAME = xapp_db1 ``` flexric2.conf is: ``` [NEAR-RIC] NEAR_RIC_IP = 127.0.0.1 [XAPP] DB_PATH = /tmp/ DB_NAME = xapp_db2 ``` >It is also interesting to mention, multiple xApps can be run in parallel. At this point, FlexRIC is working correctly in your computer and you have already tested the multi-agent, multi-xApp and multi-language capabilities. The latency that you observe in your monitor xApp is the latency from the E2 Agent to the nearRT-RIC and xApp. In modern computers the latency should be less than 200 microseconds or 50x faster than the O-RAN specified minimum nearRT-RIC latency i.e., (10 ms - 1 sec) range. Therefore, FlexRIC is well suited for use cases with ultra low-latency requirements. Additionally, all the data received in the xApp is also written to `/tmp/xapp_db` in case that offline data processing is wanted (e.g., Machine Learning/Artificial Intelligence applications). You browse the data using e.g., sqlitebrowser. ## Result :dart: xapp helloworld test result --- ``` ./examples/xApp/c/helloworld/xapp_hw ``` ![Screenshot 2025-03-04 132550](https://hackmd.io/_uploads/rkSNJM4j1l.png) ### Test with OAI Edit CU ``` cd cmake_targets/ran_build/build/ sudo nano ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf ``` add e2 agent in CU ``` e2_agent = { near_ric_ip_addr = "RIC IP"; # same as /usr/local/etc/flexric/flexric.conf sm_dir = "/usr/local/lib/flexric/" } ``` Edit DU ``` cd cmake_targets/ran_build/build/ sudo nano ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf ``` add e2 agent in DU ``` e2_agent = { near_ric_ip_addr = "RIC IP"; # same as /usr/local/etc/flexric/flexric.conf sm_dir = "/usr/local/lib/flexric/" } ``` * Start the nearRT-RIC ``` ./examples/ric/nearRT-RIC ``` ![image](https://hackmd.io/_uploads/B1SdDD_jyx.png) * Start the CU ``` sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf --sa --rfsim ``` ![image](https://hackmd.io/_uploads/BkLA7Pdo1l.png) * Start the DU ``` sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf --sa --rfsim -E ``` see in log that E2 is active then test with **Start different xApps** * Start different xApps start the KPM monitor xApp - measurements stated in 2.1.1 E2SM-KPM ``` ./examples/xApp/c/monitor/xapp_kpm_moni ``` ![image](https://hackmd.io/_uploads/SyT5DD_oyl.png) start the RC monitor xApp - aperiodic subscription for "UE RRC State Change" ``` ./examples/xApp/c/monitor/xapp_rc_moni ``` ![image](https://hackmd.io/_uploads/HJ2hDwuoJg.png) start the RC control xApp - RAN control function "QoS flow mapping configuration" (e.g. creating a new DRB) ``` ./examples/xApp/c/kpm_rc/xapp_kpm_rc ``` ![image](https://hackmd.io/_uploads/SJs1_POoJe.png) start the (MAC + RLC + PDCP + GTP) monitor xApp ``` ./examples/xApp/c/monitor/xapp_gtp_mac_rlc_pdcp_moni ``` ![image](https://hackmd.io/_uploads/B15Qdwuoke.png) >Please, notice that no real UE is connected. Therefore, random values within supported messages are filled. Before starting the nearRT-RIC, check that the IP address where your nearRT-RIC will be listening is the desired one at `/usr/local/etc/flexric/flexric.conf`. Infact the default configuration assumes all the components are located in the same localhost. ==Importance==