# O-DU high
###### tags: `Construction`
[O-DU High Installation Guide](https://docs.o-ran-sc.org/projects/o-ran-sc-o-du-l2/en/latest/installation-guide.html)
### 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`
Cloning code Create a folder to clone the O-DU High code into. The folder is hereafter referred to as <O-DU High Directory>. Clone code into <O-DU High Directory>
`git clone https://gerrit.o-ran-sc.org/r/o-du/l2`
Pre-requisite for O1 Interface (Required only if run with O1 interface enabled):
1. Setup netconf server
a. Add new netconf user (login with root user or use sudo and run following script)
`$cd l2/build/scripts`
`$sudo ./add_netconf_user.sh`
b. Install netconf packages.
`$chmod +x install_lib_O1.sh`
`$sudo ./install_lib_O1.sh -c`
2. Update the configuration according to your setup.
`$cd l2/build/config`
a. Open the startup_config.xml and edit the desired IP and Port for CU, DU and RIC.
b. Open the nacm_config.xml and edit the desired user name to provide the access to that user.
c. Open the netconf_server_ipv6.xml and edit the desired netconf server configuration.
d. Open the vesConfig.json and edit the details of VES collector.
e. Open the netconfConfig.json and edit the details of Netopeer server.
f. Install the yang modules and load initial configuration
`$cd l2/build/scripts`
`$sudo ./load_yang.sh`

3. Start Netopeer2-server:
`$cd l2/build/scripts`
`$sudo ./netopeer-server.sh start`

### Clean and Build
* Navigate to Build folder
```cd <O-DU High Directory>/l2/build/odu```
* Build O-DU High:
* Clean O-DU High binary
`make clean_odu MACHINE=BIT64 MODE=FDD`
* Compile O-DU High binary
`make odu MACHINE=BIT64 MODE=FDD`

* Build CU Stub :
* Clean CU Stub binary
`make clean_cu NODE=TEST_STUB MACHINE=BIT64 MODE=FDD`
* Compile CU Stub binary
`make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD`

* Build RIC Stub :
* Clean RIC Stub binary
`make clean_ric NODE=TEST_STUB MACHINE=BIT64 MODE=FDD`
* Compile RIC Stub binary
`make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD`

* Cleaning ODU, CU Stub and RIC Stub:
`make clean_all`
### Clean and Build with O1 interface enabled
* Build O-DU High:
* Clean O-DU High binary
`make clean_odu MACHINE=BIT64 MODE=FDD O1_ENABLE=YES`
* Compile O-DU High binary
`make odu MACHINE=BIT64 MODE=FDD O1_ENABLE=YES`

* Build CU Stub :
* Clean CU Stub binary
`make clean_cu NODE=TEST_STUB MACHINE=BIT64 MODE=FDD O1_ENABLE=YES`
* Compile CU Stub binary
`make cu_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD O1_ENABLE=YES`
COMPLETE:

* Build RIC Stub :
* Clean RIC Stub binary
`make clean_ric NODE=TEST_STUB MACHINE=BIT64 MODE=FDD O1_ENABLE=YES`
* Compile RIC Stub binary
`make ric_stub NODE=TEST_STUB MACHINE=BIT64 MODE=FDD O1_ENABLE=YES`

* Cleaning ODU, CU Stub and RIC Stub:
`make clean_all`
>Build commands:
> a. odu - Builds all components of ODU
> b. cu_stub - Builds all CU Stub
> c. ric_stub - Builds all RIC_Stub
> d. clean_odu - clean up ODU
> e. clean_cu - clean up CU Stub
> f. clean_ric - clean up RIC Stub
> g. clean_all - cleanup everything
> h. options:
> i. MACHINE=BIT64/BIT32 - Specify underlying machine type. Default is BIT32
> ii. NODE=TEST_STUB - Specify if it is a test node. Mandatory for cu_stub/ric_stub. Must not be used for odu
> iii. MODE=FDD/TDD - Specify duplex mode. Default is FDD
> iv. PHY=INTEL_L1 - Specify type of phy. If not specified, PHY stub is used
> v. PHY_MODE=TIMER - Specify mode of phy. Used only if PHY=INTEL_L1. Default is radio mode
> vi. O1_ENABLE=YES - Specify if O1 interface is enabled. If not specified, it is disabled
## [User Guide](https://docs.o-ran-sc.org/projects/o-ran-sc-o-du-l2/en/latest/user-guide.html)
User guide for D release of O-DU/l2.
### 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`
***設定完之後從再設定一次建置的部分設定***
`$cd l2/build/scripts`
`$sudo ./add_netconf_user.sh`
`$sudo ./load_yang.sh`
`$sudo ./netopeer-server.sh start`
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.

## 相關issues
* [**issues ODUHIGH-247: Configure IP and port of DU, CU and RIC through Netconf interface**](https://jira.o-ran-sc.org/projects/ODUHIGH/issues/ODUHIGH-247?filter=allissues)


==============================================================================================================================================
# OSC DU @ OAI
`MWNL Project start from here`
The MWNL project to integrate OSC DU with OAI CU and CN
- [OSC DU @ OAI](#osc-du--oai)
- [Pre-requist](#pre-requist)
- [Setup](#setup)
- [Compile & Run](#compile--run)
- [MWNL Env](#mwnl-env) (not use for now)
- [Official Guidelines](#official-guidelines)
# Pre-requist
* This step if for mwnl project, if you are not using mwnl project, skip this.
* Only do this one time
* copy the vNIT config to /etc/init.d
* Change scripts in /etc/init.d
* Add lines in /etc/rc.local
```sh
$ cd l2/bin/mwnl
# Modify the both scripts 'config.sh' and 'gen_vNIT.sh'
$ NAME="o-ran"
# Copy
$ sudo cp config.sh gen_vNIT.sh /etc/init.d
# Add lines in rc.local
$ sudo vim /etc/rc.local
$ /etc/init.d/gen_vNIT.sh
$ /etc/inti.d/config.sh
# Enable the rc.local.service
$ sudo systemctl enable rc.local.service
```
# Setup
* The detail can be found in [O-RAN O-DU](https://docs.o-ran-sc.org/projects/o-ran-sc-o-du-l2/en/latest/overview.html).
* In Ubuntu 18.04( or 20.04) environment
1. Install Library
```shell=
# GCC version 4.6.3 and above : `gcc –version`
$ sudo apt-get install -y build-essential
$ sudo apt-get install -y libsctp-dev
$ sudo apt-get install -y libpcap-dev
$ sudo apt-get install -y libz-dev # for build crc library from integration with the OAI
```
2. Setting up Netconf server, `only if O1 interface is enabled`
```sh
# Create new netconf user
$ cd <O-DU High Directory>/l2/build/scripts
$ sudo ./add_netconf_user.sh
# Install Netconf libraries
# libssh, libyang, libnetconf2, sysrepo, netopeer2
$ sudo ./install_lib_O1.sh -c
$ cd <O-DU High Directory>/l2/build/config
# Install the yand modules and load initial configuration
$ cd <O-DU High Directory>/l2/build/scripts
$ sudo ./load_yand.sh
# Install additional 3GPP YANG models
$ cd <O-DU High Directory>/l2/build/yang
$ sed -i -e ‘s/”IMMEDIATE_MDT”/”IMMEDIATE_MDT_ONLY”/g’ _3gpp-common-trace.yang
$ sed -i -e ‘s/”TRACE”/”TRACE_ONLY”/g’ _3gpp-common-trace.yang
$ cd <O-DU High Directory>/l2/build/yang
$ sysrepoctl -i _3gpp-common-yang-types.yang
$ sysrepoctl -i _3gpp-common-top.yang
$ sysrepoctl -i _3gpp-common-measurements.yang
$ sysrepoctl -i _3gpp-common-trace.yang
$ sysrepoctl -i _3gpp-common-managed-function.yang
$ sysrepoctl -i _3gpp-common-subscription-control.yang
$ sysrepoctl -i _3gpp-common-fm.yang
$ sysrepoctl -i _3gpp-common-managed-element.yang
$ sysrepoctl -i _3gpp-5g-common-yang-types.yang
$ sysrepoctl -i _3gpp-nr-nrm-rrmpolicy.yang
$ sysrepoctl -i _3gpp-nr-nrm-gnbdufunction.yang
$ sysrepoctl -i _3gpp-nr-nrm-nrcelldu.yang
# Start Netopeer2-server
$ cd <O-DU High Directory>/l2/build/scripts
$ sudo ./netopeer-server.sh start
```
# Compile & Run
## MWNL Env
* please skip this for now and use [Official Guidelines](#official-guidelines)
* This may help you skipping the [Official Guidelines](#official-guidelines)
1. source MWNL env
```shell=
$ cd l2/
$ source mwnlenv
```
2. Build
* TBD ...
```sh
$ cd_oran_build # cd ORAN build dir
$ clean_odu # clean odu
$ build_odu # build odu
$ build_odu_o1 # build odu with O1 interface
$ clean_ocu # clean ocu
$ build_ocu # build ocu
$ build_ocu_o1 # build ocu with O1 interface
$ clean_ric # clean ric
$ build_ric # build ric
$ build_ric_o1 # build ric with O1 interface
```
3. Run
```sh
$ cd_oran_bin # cd ORAN bin dir
$ run_ocu # run ocu
$ run_ric # run ric
$ run_odu # run odu
```
## Official Guidelines
```sh
cd <O-DU High Directory>/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
```
* The above will generate images which can be found at
```txt
O-DU_High - <O-DU High Directory>/l2/bin/odu
CU_Stub - <O-DU High Directory>/l2/bin/cu_stub
RIC_Stub - <O-DU High Directory>/l2/bin/ric_stub
```
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>/l2/bin/cu_stub
sudo ./cu_stub
# Execute RIC Stub
cd <O-DU High Directory>/l2/bin/ric_stub
sudo ./ric_stub
# Execute O-DU High
cd <O-DU High Directory>/l2/bin/odu
sudo ./odu
```