# Build OAI gNB and make E2E connection
:::info
## :dart: **Objective**: Make E2E connection.
:::
### :small_blue_diamond:**OS Information:**

## 1. Introduction
:bookmark: **Reference**:
The necessary resources for this build are listed below.
| Author | Context | Link |
| --------- | -------------------------- | -------------------------------------------------------------------- |
| Open OAI | Build gNB and UE | [OAI_gNB](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/NR_SA_Tutorial_OAI_nrUE.md) |
:::info
**OAI CN5G pre-requisites**
:::
> [color=#eb4cf7] Please install and configure OAI CN5G as described here:
> [OAI CN5G](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/NR_SA_Tutorial_OAI_CN5G.md)
:::info
### **OAI gNB and OAI nrUE pre-requisites**
:::
**Build UHD from source**
**1-** Add the Docker repository to APT sources:
$ sudo apt install -y libboost-all-dev libusb-1.0-0-dev doxygen python3-docutils python3-mako python3-numpy python3-requests python3-ruamel.yaml python3-setuptools cmake build-essential
* Clone UHD
$ git clone https://github.com/EttusResearch/uhd.git ~/uhd
$ cd ~/uhd
$ git checkout v4.5.0.0
$ cd host
$ mkdir build
$ cd build
$ cmake ../
$ make -j $(nproc)
$ make test # This step is optional
$ sudo make install
$ sudo ldconfig
$ sudo uhd_images_downloader
:::info
### **Build OAI gNB and OAI nrUE**
:::
* Get openairinterface5g source code:
$ git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git ~/openairinterface5g
$ cd ~/openairinterface5g
$ cd ~/openairinterface5g
$ git checkout develop
* Install OAI dependencies:
$ cd ~/openairinterface5g/cmake_targets
$ ./build_oai -I
* nrscope dependencies:
$ sudo apt install -y libforms-dev libforms-bin
* Build OAI gNB:
$ cd ~/openairinterface5g
$ source oaienv
$ cd cmake_targets
$ ./build_oai -w USRP --ninja --nrUE --gNB --build-lib "nrscope" -C

:::info
### **Run OAI CN5G and OAI gNB**
:::
* Run OAI CN5G:
$ cd ~/oai-cn5g
$ docker compose up -d
### **SIM Card Configuration**
:::spoiler Expand here!
#define UICC_PARAMS_DESC {\
{"imsi", "USIM IMSI\n", 0, strptr:&(uicc->imsiStr), defstrval:"001010000000001", TYPE_STRING, 0 },\
{"nmc_size" "number of digits in NMC", 0, iptr:&(uicc->nmc_size), defintval:2, TYPE_INT, 0 },\
{"key", "USIM Ki\n", 0, strptr:&(uicc->keyStr), defstrval:"fec86ba6eb707ed08905757b1bb44b8f", TYPE_STRING, 0 },\
{"opc", "USIM OPc\n", 0, strptr:&(uicc->opcStr), defstrval:"c42449363bbad02b66d16bc975d77cc1", TYPE_STRING, 0 },\
{"amf", "USIM amf\n", 0, strptr:&(uicc->amfStr), defstrval:"8000", TYPE_STRING, 0 },\
{"sqn", "USIM sqn\n", 0, strptr:&(uicc->sqnStr), defstrval:"000000", TYPE_STRING, 0 },\
{"dnn", "UE dnn (apn)\n", 0, strptr:&(uicc->dnnStr), defstrval:"oai", TYPE_STRING, 0 },\
{"nssai_sst", "UE nssai\n", 0, iptr:&(uicc->nssai_sst), defintval:1, TYPE_INT, 0 }, \
{"nssai_sd", "UE nssai\n", 0, iptr:&(uicc->nssai_sd), defintval:0xffffff, TYPE_INT, 0 }, \
};
:::