# OAI實作
## gNB
### 1. CPU Configuration
:::warning
:warning:Note: OAI doesn't support ubuntu 20 or upper version, ubuntu 18.04 or 16.04 is recommeded
:::
##### ( a ) Disable C-states and P-states in Linux
```
$ sudo vim /etc/default/grub
```
- Add the following line in GRUB_CMDLINE_LINUX_DEFAULT
```
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=disable intel_idle.max_cstate=0 processor.max_cstate=0 idle=poll"
```

- Second , perform update-grub
```
$ sudo update-grub
$ reboot
```
##### ( b ) Remove all power management and CPU frequency scaling
1. Append “blacklist intel_powerclamp” to the end of /etc/modprobe.d/blacklist.conf
2. Disable “hyperthreading”, “CPU frequency control”, “C-states”, “P-states” features in BIOS.
3. Install i7z to check the cpu
```
$ sudo apt-get isntall i7z
$ sudo i7z
```
4. The CPU should not change its frequency by more than 1-2 hertz and should not be any C-state other than C0

5. Disable CPU frequency scaling
(1) Get cpufrequtils
```
$ sudo apt-get install cpufrequtils
```
(2) Edit the following file ( If it doesn't exist, create it )
```
$ sudo vim /etc/default/cpufrequtils
```
(3) Then, add the following line into it and save it.
```
GOVERNOR="performance"
```
(4) Disable ondemand daemon
```
$ sudo update-rc.d ondemand disable
(or use : sudo systemctl disable ondemand.service)
```
(5) Disable Hyper-threading in bios
If you cannot find Hyper-threading in bios, try the bellow link to disable your hyper-threading
[Disable Your Hyper-threading](https://askubuntu.com/questions/942728/disable-hyper-threading-in-ubuntu)
After that, you can try this command to check whether all your cpu is fully used
```
$ watch grep \"cpu MHz\" /proc/cpuinfo
```
## OAI Build
## OAI Configurartion
- 192.168.91.128 -> your 5GC IP
- 192.168.91.128 -> OAI to 5GC Interface IP
- vmnet8 -> OAI to 5GC Interface name
```git=
diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf
index 3b7fadf3bc..34e0ce3fb2 100644
--- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf
+++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf
@@ -11,7 +11,10 @@ gNBs =
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 1;
- plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) });
+ plmn_list = ({ mcc = 999;
+ mnc = 70;
+ mnc_length = 2;
+ snssaiList = ({ sst = 1; }) });
nr_cellid = 12345678L;
@@ -159,7 +162,7 @@ gNBs =
////////// AMF parameters:
- amf_ip_address = ( { ipv4 = "192.168.70.132";
+ amf_ip_address = ( { ipv4 = "192.168.91.128";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
@@ -169,10 +172,10 @@ gNBs =
NETWORK_INTERFACES :
{
- GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai";
- GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24";
- GNB_INTERFACE_NAME_FOR_NGU = "demo-oai";
- GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24";
+ GNB_INTERFACE_NAME_FOR_NG_AMF = "vmnet8";
+ GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.91.1/24";
+ GNB_INTERFACE_NAME_FOR_NGU = "vmnet8";
+ GNB_IPV4_ADDRESS_FOR_NGU = "192.168.91.1/24";
GNB_PORT_FOR_S1U = 2152; # Spec 2152
};
```
## Running each component
:::info
:bulb:Hint: Before running the components, Check the if IP, network interface informations are correct
:::
### gNB
#### Run the OAI Modem(Assume the used Software-defined Radio is USRP b210)
```
$ cd <OAI_location> # ex: cd ~/oai_5gsa/openairinterface5g
$ cd cmake_targets/ran_build/build/
$ sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf -E --sa
```