---
# System prepended metadata

title: OSC O-DU at OAI PNF (Rel. D)
tags: [Construction]

---

# OSC O-DU at OAI PNF (Rel. D)
###### tags: `Construction`
### Basic requirement
| OS/Kernel                  | Version                                 |
|:-------------------------- |:----------------------------------------|
| Host operating system      | Linux Ubuntu 18.04 or 20.04    |
| Kernel                     | 4.15.0.142.lowlatency                   |
### Install libraries to compile and execute O-DU High
Pre-requisite for Compilation :
1. Linux 32-bit/64-bit machine
2. GCC version 4.6.3 and above : `gcc --version`
   a. On Ubuntu : `sudo apt-get install -y build-essential`
   b. On CentOS : `sudo yum groups mark install -y “Development Tools”`
3. Install LKSCTP
   a. On Ubuntu : `sudo apt-get install -y libsctp-dev`
   b. On CentOS : `sudo yum install -y lksctp-tools-devel`
4. Install PCAP:
   a. On ubuntu : `sudo apt-get install -y libpcap-dev`
   b. On CentOS : `sudo yum install -y libpcap-devel`


### A. Execution:
#### **I. Execution - On locally compiling O-DU High Source Code**
1. Assign virtual IP addresses as follows:

    ifconfig <interface name>:ODU “192.168.130.81”
    ifconfig <interface name>:CU_STUB “192.168.130.82”
    ifconfig <interface name>:RIC_STUB “192.168.130.80”
    ```
    [root@www ~]# ifconfig eth0:ODU 192.168.130.81
    [root@www ~]# ifconfig eth0:CU_STUB 192.168.130.82
    [root@www ~]# ifconfig eth0:RIC_STUB 192.168.130.80
    ```  
    如果要更改:
    `[root@www ~]# ifconfig eth0:ODU down`
    
2. Execute CU Stub:
   a. CU execution folder:
      	`cd l2/bin/cu_stub`
   b. Run CU Stub binary:
      	`./cu_stub`

3. Execute RIC Stub:
    再開一個terminal
   a. RIC execution folder:
      	`cd l2/bin/ric_stub`
   b. Run RIC Stub binary:
      	`./ric_stub`

4. Execute O-DU High:
    再開一個terminal
   a. DU execution folder:
      	`cd l2/bin/odu`
   b. Run ODU binary:
      	`./odu`
    PS: CU stub and RIC stub must be run (in no particular sequence) before ODU.

![](https://hackmd.io/_uploads/SkSGIvHyp.png)


# Compile & Run (odu_at_oai)

```shell
$ cd /odu_at_oai/l2/build/odu
```
1. Build 
```sh
# O-DU High
make clean_odu MACHINE=BIT64 MODE=FDD VNF_ENABLE=YES
make odu MACHINE=BIT64 MODE=FDD VNF_ENABLE=YES
make odu MACHINE=BIT64 MODE=FDD VNF_ENABLE=YES O1_ENABLE=YES
    
# CU Stub
make clean_cu NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD O1_ENABLE=YES

# RIC Stub
make clean_ric NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD
make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD O1_ENABLE=YES
```


2. Run
* Execute them as following order, at least the ODU must start at the last.
```sh
# Execute CU Stub
cd <O-DU High Directory>/odu_at_oai/l2/bin/cu_stub
sudo ./cu_stub
# Execute RIC Stub
cd <O-DU High Directory>/odu_at_oai/l2/bin/ric_stub
sudo ./ric_stub
# Execute O-DU High
cd <O-DU High Directory>/odu_at_oai/l2/bin/odu
sudo ./odu
```


# Build OAI gNB
#### Clone and build the dependency for the first time
```sh
$ cd openairinterface5g/

# Build ONLY FOR the FIRST time
$ source oaienv
$ cd cmake_targets
$ export BUILD_UHD_FROM_SOURCE=Ture
$ export UHD_VERSION=4.3.0.0-rc1 #(optional UHD_VERSION=4.4.0.0)
$ ./build_oai -I -c -C
$ ./build_oai -w USRP --gNB 
$ cd ran_build/build
$ sudo ./nr-softmodem -O [where the config file is] --sa -E --gNBs.[0].min_rxtxtime 6 --nfapi 1 # 1 : PNF, 2 : VNF
    
# e.q. sudo ./nr-softmodem -O ../../../../../odu_at_oai/l2/mwnl/oai_pnf_conf/oaiL1.nfapi.usrpb210.conf --sa -E --gNBs.[0].min_rxtxtime 6 --continuous-tx --nfapi 1
# --gNBs.[0].min_rxtxtime 6 --> To ensure that the rx tx time advance is 6 slots

``` 
