# xApp Development: Colosseum Near RT RIC and OAI
[TOC]
---
## Architecture

## Pre-Requisites
- **OAI**: [OAI Installation](https://hackmd.io/@nomaden/BkFteqYOlx)
- **Colosseum Near RT RIC**
For RIC, we will be using Colosseum Near RT RIC. Follow this tutorial to setup the RIC: [Colosseum Near RT RIC Setup](https://hackmd.io/EcYW22grRDSGmM9id95UHg#Near-RT-RIC-Setup). **(No need to deploy ns-o-ran)**
- **FlexRIC**
FlexRIC will only be used for the Service Model (SM) connector since Colosseum sm-connector is not compatible. [FlexRIC Installation](https://hackmd.io/@nomaden/rJPhM5FOgg)
## Setup Colosseum Near RT RIC
Open three terminal:
- One for gNB-CU
- One for gNB-DU
- One for Colosseum Near RT RIC
### Change E2Term Port
```bash!
sudo nano ~/colosseum-near-rt-ric/setup-scripts/setup-lib.sh
```
Change E2 SCTP Port to 36421:
```shell!
E2TERM_SCTP_PORT=36421
```

### Deploy the Near RT RIC components
```bash!
cd ~/colosseum-near-rt-ric/setup-scripts
./setup-ric-bronze.sh
```
### Check Docker
```bash!
docker ps
```
:::success
:::spoiler Result

::::::
## Setup OAI O-RAN
### DU Configuration
```bash!
sudo nano ~/openairinterface5g/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf
```
Add these on the bottom of the file:
```conf!
e2_agent = {
near_ric_ip_addr = "10.0.2.1";
sm_dir = "/usr/local/lib/flexric/"
}
```

### Run CU
```bash!
cd ~/openairinterface5g/cmake_targets/ran_build/build
sudo ./nr-softmodem -O ~/oai/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf --rfsim --sa -E
```
:::info
:::spoiler Result

>[!Note] Error Notes
>We can just ignore the GTP-U error since we don't use the Core components.
::::::
### Run DU
```bash!
sudo ./nr-softmodem -O ~/oai/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf --rfsim --sa -E
```
:::info
:::spoiler Result

::::::
## Result
### CU and DU Can Connect
:::spoiler **CU**

:::
:::spoiler **DU**

:::
### E2 Agent from DU
:::spoiler **Created**

:::
### E2 Agent can't Connect to E2Term RIC
:::spoiler **Timeout**

:::
## Conclusion
For now, I haven't found any way to make the OAI O-RAN E2 Agent to be compatible with Colosseum Near RT RIC.