Try   HackMD

FlexRIC and OAI Installation Guide with Testing

Architecture

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

OAI-CU

lsb_release -a #ubuntu version lscpu #cpu sudo dmidecode -t memory | grep -i size #memory sudo lshw -short -C disk

Hardware

Items Content
OS ubuntu 20.04 LTS
CPU Intel® Xeon® Gold 6212U CPU @ 2.40GHz
RAM 8GB
Disk 120GB
IP 191.168.0.32

Software

Items Version
FlexRIC v1.0.0

OAI-FLEXRIC

Hardware

Items Content
OS ubuntu 20.04 LTS
CPU Intel® Xeon® Gold 6212U CPU @ 2.40GHz
RAM 16GB
Disk 120TB
IP 192.168.0.234

Software

Items Version
OSC CU 2023.w40

free5gc

Hardware

Items Content
OS ubuntu 20.04 LTS
CPU Intel® Xeon® Gold 6212U CPU @ 2.40GHz
RAM 8GB
Disk 1TB
IP 192.168.0.37

Software

Items Version
free5gc v3.3

Build Free5GC

You can build free5GC from guide installation here :
https://hackmd.io/@arifadh2003/S1FFzyh_p

Build FlexRIC

Resource

FlexRIC

Install necessary tools

Install prerequisites

  1. A recent CMake (at least v3.15).
    On Ubuntu, you might want to use this PPA to install an up-to-date version.

  2. SWIG (at least v.4.0).
    We use SWIG as an interface generator to enable the multi-language feature (i.e., C/C++ and Python) for the xApps. Please, check your SWIG version (i.e, swig -version) and install it from scratch if necessary as described here: https://swig.org/svn.html or via the code below:

Install cmake
Following this link to install
Install automake

sudo apt-get install autotools-dev sudo apt-get install automake

Install bison for swig make

sudo apt-get install bison -y sudo apt-get install byacc -y

output

root@ubuntu:~/o1/client# sudo apt-get install autotools-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
autotools-dev is already the newest version (20180224.1).
autotools-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.
root@ubuntu:~/o1/client# sudo apt-get install automake
Reading package lists... Done
Building dependency tree
Reading state information... Done
automake is already the newest version (1:1.16.1-4ubuntu6).
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.
root@ubuntu:~/o1/client# sudo apt-get install bison -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
bison is already the newest version (2:3.5.1+dfsg-1).
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.
root@ubuntu:~/o1/client# sudo apt-get install byacc -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  byacc
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
Need to get 61.3 kB of archives.
After this operation, 167 kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com/ubuntu focal/universe amd64 byacc amd64 20140715-1build1 [61.3 kB]
Fetched 61.3 kB in 0s (926 kB/s)
Selecting previously unselected package byacc.
(Reading database ... 101257 files and directories currently installed.)
Preparing to unpack .../byacc_20140715-1build1_amd64.deb ...
Unpacking byacc (20140715-1build1) ...
Setting up byacc (20140715-1build1) ...
Processing triggers for man-db (2.9.1-1) ...
root@ubuntu:~/o1/client#

Install swig
Please, check your SWIG version (i.e, swig -version) and install it from scratch if necessary as described here: https://swig.org/svn.html or via the code below:

sudo apt-get install libpcre2-dev wget https://ftp.gnu.org/gnu/bison/bison-3.5.tar.gz tar -xzvf bison-3.5.tar.gz cd bison-3.5 ./configure make sudo make install bison --version git clone https://github.com/swig/swig.git cd swig ./autogen.sh ./configure --prefix=/usr/ make sudo make install

output

root@ubuntu:~/o1/client/swig# wget https://ftp.gnu.org/gnu/bison/bison-3.5.tar.gz
d bison-3.5
./configure
make
sudo make install
b--2024-06-28 08:12:07--  https://ftp.gnu.org/gnu/bison/bison-3.5.tar.gz
ison --versionResolving ftp.gnu.org (ftp.gnu.org)... 209.51.188.20, 2001:470:142:3::b
Connecting to ftp.gnu.org (ftp.gnu.org)|209.51.188.20|:443... connected.
HTTP request sent, awaiting response... 200 OK
.
.
.
 /usr/bin/mkdir -p '/usr/local/share/doc/bison/examples/c/rpcalc'
 /usr/bin/install -c -m 644 examples/c/rpcalc/rpcalc.y '/usr/local/share/doc/bison/examples/c/rpcalc'
make[3]: Leaving directory '/root/o1/client/swig/bison-3.5'
make[2]: Leaving directory '/root/o1/client/swig/bison-3.5'

:::
Install asn1c compiler

sudo apt-get -y install asn1c

output:

root@ubuntu:~/o1/client/swig/bison-3.5# sudo apt-get -y install asn1c
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  asn1c-doc
The following NEW packages will be installed:
  asn1c asn1c-doc
0 upgraded, 2 newly installed, 0 to remove and 48 not upgraded.
Need to get 372 kB of archives.
After this operation, 1,165 kB of additional disk space will be used.
Get:1 http://tw.archive.ubuntu.com/ubuntu focal/universe amd64 asn1c amd64 0.9.28+dfsg-3 [237 kB]
Get:2 http://tw.archive.ubuntu.com/ubuntu focal/universe amd64 asn1c-doc all 0.9.28+dfsg-3 [135 kB]
Fetched 372 kB in 0s (2,418 kB/s)
Selecting previously unselected package asn1c.
(Reading database ... 101393 files and directories currently installed.)
Preparing to unpack .../asn1c_0.9.28+dfsg-3_amd64.deb ...
Unpacking asn1c (0.9.28+dfsg-3) ...
Selecting previously unselected package asn1c-doc.
Preparing to unpack .../asn1c-doc_0.9.28+dfsg-3_all.deb ...
Unpacking asn1c-doc (0.9.28+dfsg-3) ...
Setting up asn1c (0.9.28+dfsg-3) ...
Setting up asn1c-doc (0.9.28+dfsg-3) ...
Processing triggers for man-db (2.9.1-1) ...

Install swig

sudo apt-get install swig

output

root@ubuntu:~/o1/client/swig/bison-3.5# sudo apt-get install swig
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  swig4.0
Suggested packages:
.
.
.
Unpacking swig (4.0.1-5build1) ...
Setting up swig4.0 (4.0.1-5build1) ...
Setting up swig (4.0.1-5build1) ...
Processing triggers for man-db (2.9.1-1) ...

Download the required dependencies

Install required dependencies

sudo apt install libsctp-dev python3.8 cmake-curses-gui libpcre2-dev python-dev

output:

root@ubuntu:~/o1/client/swig/bison-3.5# sudo apt install libsctp-dev python3.8 cmake-curses-gui libpcre2-dev python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python-dev-is-python2' instead of 'python-dev'
libsctp-dev is already the newest version (1.0.18+dfsg-1).
libpcre2-dev is already the newest version (10.34-7ubuntu0.1).
python3.8 is already the newest version (3.8.10-0ubuntu1~20.04.9).
python3.8 set to manually installed.
.
.
.
Setting up python2-dev (2.7.17-2ubuntu4) ...
Setting up python-dev-is-python2 (2.7.17-4) ...
Processing triggers for libc-bin (2.31-0ubuntu9.16) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...

Clone the FlexRIC project, build and install it

Download the code

git clone https://gitlab.eurecom.fr/mosaic5g/flexric.git git checkout <here put the release tag> # i.e. git checkout v1.0.0

output

root@ubuntu:~# git clone https://gitlab.eurecom.fr/mosaic5g/flexric.git
Cloning into 'flexric'...
remote: Enumerating objects: 33786, done.
remote: Counting objects: 100% (28191/28191), done.
remote: Compressing objects: 100% (5018/5018), done.
.
.
.
Processing triggers for mime-support (3.64ubuntu1) ...
root@ubuntu:~/o1/client/swig/bison-3.5# cd ~
root@ubuntu:~# git clone https://gitlab.eurecom.fr/mosaic5g/flexric.git
Cloning into 'flexric'...
remote: Enumerating objects: 33786, done.
remote: Counting objects: 100% (28191/28191), done.
remote: Compressing objects: 100% (5018/5018), done.
remote: Total 33786 (delta 25048), reused 23370 (delta 23172), pack-reused 5595 (from 1)
Receiving objects: 100% (33786/33786), 136.65 MiB | 186.00 KiB/s, done.
Resolving deltas: 100% (25048/25048), done.

You can use git tag to get version

git tag

output:

root@ubuntu:~/flexric# git tag
v0.1
v1.0.0
v2.0.0

Build

cd flexric && mkdir build && cd build && cmake .. && make

output:

.
.
.
[ 99%] Building C object test/sm/kpm_sm/CMakeFiles/test_kpm_sm.dir/__/__/__/src/sm/kpm_sm_v2.02/ie/asn/per_encoder.c.o
[100%] Building C object test/sm/kpm_sm/CMakeFiles/test_kpm_sm.dir/__/__/__/src/sm/kpm_sm_v2.02/ie/asn/per_opentype.c.o
[100%] Building C object test/sm/kpm_sm/CMakeFiles/test_kpm_sm.dir/__/__/__/src/sm/kpm_sm_v2.02/ie/asn/per_support.c.o
[100%] Building C object test/sm/kpm_sm/CMakeFiles/test_kpm_sm.dir/__/__/__/src/sm/kpm_sm_v2.02/ie/asn/xer_decoder.c.o
[100%] Building C object test/sm/kpm_sm/CMakeFiles/test_kpm_sm.dir/__/__/__/src/sm/kpm_sm_v2.02/ie/asn/xer_encoder.c.o
[100%] Building C object test/sm/kpm_sm/CMakeFiles/test_kpm_sm.dir/__/__/__/src/sm/kpm_sm_v2.02/ie/asn/xer_support.c.o
[100%] Linking C executable test_kpm_sm
[100%] Built target test_kpm_sm
which swig # find path cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-3.28/Modules -DSWIG_EXECUTABLE=/usr/bin/swig

:::
Install

cd /flexric/build sudo make install

Test RIC E2AP(RIC example file)

Execute RIC file

cd flexric ./build/examples/ric/nearRT-RIC

Execute E2AP agent from flexric

cd flexric ./build/examples/emulator/agent/emu_agent_gnb_cu

Log from RIC

root@ubuntu:~/flexric# ./build/examples/ric/nearRT-RIC
Setting the config -c file to /usr/local/etc/flexric/flexric.conf
Setting path -p for the shared libraries to /usr/local/lib/flexric/
[NEAR-RIC]: nearRT-RIC IP Address = 127.0.0.1, PORT = 36421
[NEAR-RIC]: Initializing
[NEAR-RIC]: Loading SM ID = 148 with def = GTP_STATS_V0
[NEAR-RIC]: Loading SM ID = 146 with def = TC_STATS_V0
[NEAR-RIC]: Loading SM ID = 144 with def = PDCP_STATS_V0
[NEAR-RIC]: Loading SM ID = 145 with def = SLICE_STATS_V0
[NEAR-RIC]: Loading SM ID = 143 with def = RLC_STATS_V0
[NEAR-RIC]: Loading SM ID = 142 with def = MAC_STATS_V0
[NEAR-RIC]: Loading SM ID = 147 with def = ORAN-E2SM-KPM
[iApp]: Initializing ...
[iApp]: nearRT-RIC IP Address = 127.0.0.1, PORT = 36422
fd created with 6

Log from E2AP agent from flexric

.
.
.
fd created with 6
Received message with id = 2, port = 39832
[E2AP] Received SETUP-REQUEST from PLMN 505. 1 Node ID 2 RAN type ngran_gNB_CU CU/DU ID 21
[NEAR-RIC]: Accepting RAN function ID 142 with def = MAC_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 143 with def = RLC_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 144 with def = PDCP_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 145 with def = SLICE_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 146 with def = TC_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 147 with def =
[NEAR-RIC]: Accepting RAN function ID 148 with def = GTP_STATS_V0

cTest Deployment

command

root@ubuntu:~/flexric/build# ctest

output

root@ubuntu:~/flexric/build# ctest
Test project /root/flexric/build
    Start 1: test-All-in-one
1/8 Test #1: test-All-in-one ..................   Passed   19.11 sec
    Start 2: Unit_test_MAC
2/8 Test #2: Unit_test_MAC ....................   Passed    0.00 sec
    Start 3: Unit_test_RLC
3/8 Test #3: Unit_test_RLC ....................   Passed    0.00 sec
    Start 4: Unit_test_PDCP
4/8 Test #4: Unit_test_PDCP ...................   Passed    1.16 sec
    Start 5: Unit_test_SLICE
5/8 Test #5: Unit_test_SLICE ..................   Passed    0.48 sec
    Start 6: Unit_test_TC
6/8 Test #6: Unit_test_TC .....................   Passed    7.23 sec
    Start 7: Unit_test_GTP
7/8 Test #7: Unit_test_GTP ....................   Passed    0.00 sec
    Start 8: Unit_test_KPM
8/8 Test #8: Unit_test_KPM ....................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 8

Total Test time (real) =  27.99 sec

Test simulates an scenario with an E2 node, a nearRT-RIC and an xApp

# terminal 1: start E2 Node agent
./build/examples/emulator/agent/emu_agent_gnb
# terminal 2: start nearRT-RIC
./build/examples/ric/nearRT-RIC
# terminal 3
./build/examples/xApp/c/monitor/xapp_gtp_mac_rlc_pdcp_moni
# terminal 1: start E2 Node agent
./build/examples/emulator/agent/emu_agent_gnb
# terminal 2: start nearRT-RIC
./build/examples/ric/nearRT-RIC
# terminal 3
./build/examples/xApp/c/monitor/xapp_gtp_mac_rlc_pdcp_moni

image

OAI install with E2AP

Deploy O-DU and O-CU

  • Git clone repository from OAI and build up the binary first. In this case, we use UE simulator for testing.
git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git cd openairinterface5g git checkout 2023.w43

If your CU and RIC are in the different PC or VM, you have to download FlexRIC in your OAI PC

git am ~/flexric/multiRAT/oai/oai.patch --whitespace=nowarn

Build

source oaienv cd cmake_targets ./build_oai -I #for first time installation ## Build up UE simulator and gNB ./build_oai --gNB --nrUE -w SIMU

If the openair2/E2AP/flexric folder is empty, try manually the following commands:

git submodule init
git submodule update

dpkg: error processing package gconf2-common (–configure):
installed gconf2-common package post-installation script subprocess returned error exit status 10

sudo rm /var/lib/dpkg/info/gconf2-common* sudo dpkg --configure -D 777 gconf2-common sudo apt -f install

Connect free5gc and CU and flexRIC

Modify configuration for CU and free5gc amf

cd ~/flexric/multiRAT/oai nano gnb.sa.band78.fr1.106PRB.usrpb210.conf
  • Modify mcc、mnc、sst and sd refer to your amf
    image

  • Modify amf IP、CU interface name and IP
    image

OAI CU Modify configuration for FlexRIC

  • Copy FlexRIC folder from FlexRIC PC to OAI PC
cd /usr/local/lib/flexric
root@ubuntu:/usr/local/lib/flexric# ls
libgtp_sm.so  libkpm_sm.so  libmac_sm.so  libpdcp_sm.so  librlc_sm.so  libslice_sm.so  libtc_sm.so
root@ubuntu:/usr/local/lib/flexric#
  • Copy FlexRIC configuration from FlexRIC PC to OAI PC

command:

cd /usr/local/etc

output:

root@ubuntu:/usr/local/etc# ls
flexric
root@ubuntu:/usr/local/etc#

command :

nano /usr/local/etc/flexric/flexric.conf
  • Modify RIC IP
    image

Test E2AP RIC&OAU CU

Execute free5gc

cd free5gc ./run.sh

Execute Near-RT RIC in FlexRIC PC

./build/examples/ric/nearRT-RIC

Execute OAI-CU in OAI PC

cd ~/oai/cmake_targets/ran_build/build sudo RFSIMULATOR=server ./nr-softmodem --rfsim --sa -O ~/flexric/multiRAT/oai/gnb.sa.band78.fr1.106PRB.usrpb210.conf --sa -E --continuous-tx

Execute start the nrUE

cd oai/cmake_targets/ran_build/build sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --uicc0.imsi 001010000000001 --rfsimulator.serveraddr 127.0.0.1

Test OK
Log from free5gc
before connect CU
after connect CU
Log from OAI CU
before connect flexric
after connect flexric
Log from flexric

Test fail
image

In this condition FlexRIC not connected to OAI CU, this problem still troubleshooting. OAI CU -> OAI UE (Success), OAI CU - Free5GC (Success).

Error log:

From OAI:

[E2AP] Resending Setup Request after timeout
nr-softmodem: ../../../openair2/E2AP/flexric/src/lib/e2ap/v2_03/dec/e2ap_msg_dec_asn.c:2688: e2ap_create_pdu: Assertion `rval.code == RC_OK && "Are you sending data in ATS_ALIGEND_BASIC_PER syntax?"' failed.
Aborted

From FlexRIC:

[NEAR-RIC]: Loading SM ID = 2 with def = ORAN-E2SM-KPM-v02.03
[iApp]: Initializing ...
[iApp]: nearRT-RIC IP Address = 192.168.0.234, PORT = 36422
[NEAR-RIC]: Initializing Task Manager with 2 threads
[E2AP]: E2 SETUP-REQUEST rx from PLMN 208.93 Node ID 3584 RAN type ngran_gNB
[NEAR-RIC]: Accepting RAN function ID 2 with def = ORAN-E2SM-KPM-v02.03
[NEAR-RIC]: Accepting RAN function ID 3 with def = ORAN-E2SM-RC-v01.0
[NEAR-RIC]: Accepting RAN function ID 142 with def = MAC_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 143 with def = RLC_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 144 with def = PDCP_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 145 with def = SLICE_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 146 with def = TC_STATS_V0
[NEAR-RIC]: Accepting RAN function ID 148 with def = GTP_STATS_V0
[E2AP]: SCTP_SHUTDOWN_EVENT
[NEAR-RIC]: Removing E2 Node MCC 208 MNC 93 NB_ID 3584