# OAI-CU_OSC O-DU (Rel. D)_OAI PNF
###### tags: `Construction`
## Basic requirement
| OS/Kernel | Version |
|:-------------------------- |:----------------------------------------|
| Host operating system | Linux Ubuntu 18.04 or 20.04 |
| Kernel | 4.15.0.142.lowlatency |
## Architecture

## OSCoduOAIcu
The OSCoduOAIcu is a project of OSC O-DU & OAI CU Integration which aim to provide OSC O-DU a complete 5G NR CU solution.
### Assign IP address for O-DU and OAI CU
```sh
$ cd oscdu_oaicu
$ cd l2
## Modify the appropriate NIC
$ vim nic.sh
#!/bin/bash
sudo ifconfig enp4s0:ODU "192.168.130.81"
sudo ifconfig enp4s0:CU_STUB "192.168.130.82"
sudo ifconfig enp4s0:RIC_STUB "192.168.130.80"
sudo ifconfig enp4s0:OAI_CU "192.168.130.83"
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/home/mwnl/
export PATH
echo "O-RAN NIC Setting Complete!"
$ ./nic.sh
```
### Build and Execute OAI CU (Now Testing in BAND 66 FDD mode)
```sh
$ cd <openairinterface5g Directory>/cmake_targets
## Build Command
$ ./build_oai --gNB
$ cd ran_build/build/
$ sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/cu.band66.tm1.106PRB.usrpb210.conf --sa
```
## O-DU at OAI PNF
### Build OSC
```sh
## O-DU
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
```
### Run OSC environments
```sh
## Execute them all as following order in different terminals, at least the ODU must start at the last.
## 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 and run OAI gNB
```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
```
## Results
OSC RIC_STUB and OSC O-DU

OAI-CU and OAI PNF
