### :school: TEEP 2024_RT LAB_ORAN DPDK
#### :book: FlexRIC Install and Test RIC E2AP(example file)
:::success
List the essential information of this chapter.
1. FlexRIC Installation
2. Test RIC E2AP(RIC example file)
:::
---
## 1. FlexRIC Installation
### 1.1 Architecture
#### 1.1.1 FlexRIC
If you want to check your system information, you can use this command
```=
lsb_release -a #displays the release information of the currently running Linux distribution
lscpu #information about the CPU
sudo dmidecode -t memory | grep -i size #information about the memory modules installed in the system
sudo lshw -short -C disk #information about disk
```
**Hardware**
| Items | Content |
| -------- | -------- |
| OS | ubuntu 22.04 LTS |
| IP | 10.99.1.221 |
**Software**
| Items | Version |
| -------- | -------- |
| FlexRIC | v1.0.0|
### 1.2 Build FlexRIC
#### 1.2.1 Prerequisite
* A recent CMake (at least v3.15).
CMake is a software used to automate the process of compiling and configuring software. It is a frequently used tool in software development to easily manage the cross-platform development process.
* SWIG (at least v.4.0).
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**
Please refer in this link for the installation, [Click here](https://apt.kitware.com/)
**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
```

**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:
```
git clone https://github.com/swig/swig.git
cd swig
./autogen.sh
./configure --prefix=/usr/
make
sudo make install
```

:::danger
Error:

Troubleshooot:
```=
sudo apt-get install libpcre2-dev
```

:::
**Install asn1c compiler**
```=
sudo apt-get -y install asn1c
```
**Install swig**
```=
sudo apt-get install swig
```
#### 1.2.2 Download the required dependencies
Install required dependencies
```
sudo apt install libsctp-dev python3.8 cmake-curses-gui libpcre2-dev python-dev-is-python3
```
#### 1.2.3 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
#i use v1.0.0
```
You can use git tag to choose get version
```
git tag
```



**Build FlexRIC**
:::danger
Error When Build:

Try Troubleshoot:
```
which swig # find path
cmake -DCMAKE_MODULE_PATH=/usr/local/share/cmake-3.28/Modules -DSWIG_EXECUTABLE=/usr/bin/swig
```

I try build again, but it still error
I try to change E2AP and KPM version with:
```
cd flexric && mkdir build && cd build && cmake .. -DE2AP_VERSION=v3.01 -DKPM_VERSION=v3.00 && make -j8
```
and still error

:::
:::success
Solution:
by default Ubuntu 22.04.1 uses gcc-11, the used FlexRIC version can be built only with gcc-10. One possible way to switch gcc version is to use update-alternatives tool or you can downgrade/install the gcc-10 version.
:::
success build

sudo make install

**CTEST**
Check that everything went fine running the tests:
```
ctest
```

---
### 1.3 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

Log from E2AP agent from flexric
