## :pencil: [**Assignment 3 Study Notes**](#-Wireless-Communications-Study-Notes)
###### tags: `Wireless Communications (ET6207) Study Notes`
:8ball: The objective of this assignment is to review the IEEE paper entitled "[**Programmable and Customized Intelligence for Traffic Steering in 5G Networks Using Open RAN Architectures**](https://arxiv.org/pdf/2209.14171.pdf)", published in 2022. And show the demo of the simulation scenarios by using the tool [**sim-ns3-o-ran-e2**](https://github.com/o-ran-sc/sim-ns3-o-ran-e2).
:::success

:::
:8ball: In these study notes, there are seven major parts, as follows:
:::spoiler [<font color="green">**Introduction**</font>](#-Introduction)
- :pencil: [**Preface**](#-Preface)
:pencil: [**Problems (Issues)**](#-Problems-Issues)
:pencil: [**Motivations**](#-Motivations)
:pencil: [**Contributions**](#-Contributions)
:::
:::spoiler [<font color="green">**Background (Related Works)**</font>](#-Background-Related-Works)
- :pencil: [**O-RAN Cellular Architecture**](#-O-RAN-Cellular-Architecture)
:pencil: [**Intelligence in the RIC**](#-Intelligence-in-the-RIC)
:pencil: [**Dual Connectivity and Traffic Steering**](#-Dual-Connectivity-and-Traffic-Steering)
:pencil: [**5G and AI in NS-3**](#-5G-and-AI-in-NS-3)
:::
:::spoiler [<font color="green">**System Design and Architecture**</font>](#-System-Design-and-Architecture)
- :pencil: [**System Model**](#-System-Model)
:pencil: [**Near-RT RIC Software Architecture**](#-Near-RT-RIC-Software-Architecture)
:pencil: [**Connecting O-RAN with NS-3: ns-O-RAN**](#-Connecting-O-RAN-with-NS-3-ns-O-RAN)
:::
:::spoiler [<font color="green">**Traffic Steering and Optimization**</font>](#-TRAFFIC-STEERING-OPTIMIZATION)
- :pencil: [**Problem Formulation**](#-Problem-Formulation)
:pencil: [**Algorithm Design**](#-Algorithm-Design)
:::
:::spoiler [<font color="green">**Performance Evaluation**</font>](#-Performance-Evaluation)
- :pencil: [**Simulation and Scenario Design**](#-Simulation-and-Scenario-Design)
:pencil: [**Results**](#-Results)
:::
:::spoiler [<font color="green">**Conclusions**</font>](#-Conclusions)
:::
:::spoiler [<font color="red">**Setup and Use ns-O-RAN Simulation Platform with a near-RT RIC**</font>](#-Setup-and-Use-ns-O-RAN-Platform-with-a-near-RT-RIC)
- :desktop_computer: [**Introduction**](#-Introduction1)
:desktop_computer: [**Near-RT RIC Setup**](#-Near-RT-RIC-Setup)
:desktop_computer: [**ns-O-RAN Setup**](#-ns-O-RAN-Setup)
:man-running: [**Run Scenario Zero**](#-Run-Scenario-Zero)
:::
## **:lower_left_crayon: Notes**
## :male-teacher: <font color="green">**Introduction**</font>
#### :pencil: <font color="blue">**Preface**</font>
:::info
* The paper discusses the need for fine-grained control and optimization of 5G and beyond mobile networks to support a wide range of use cases. It highlights the limitations of the current cellular architecture in achieving this level of control. To address this gap, the **Open RAN paradigm** introduces an "open" architecture with abstractions that enable data-driven and intelligent optimization at the user level. The paper introduces **ns-O-RAN**, a software framework that integrates a **near-real-time RAN Intelligent Controller** (**RT RIC**) with a simulated environment (**ns-3**), facilitating the development of custom RAN control applications (**xApps**) and large-scale data collection for **Deep Reinforcement Learning** (**DRL**) training.
* It also presents a user-specific O-RAN **Traffic Steering** (**TS**) intelligent handover framework that uses advanced algorithms and neural networks to optimize base station assignments for users. The evaluation shows that this approach significantly **improves throughput** and **spectral efficiency** over traditional handover methods, with **reduced mobility overhead**.
:::
#### :pencil: <font color="blue">**Problems (Issues)**</font>
:::info
:8ball: The paper discusses the problem of the classic RANs that were deployed with monolithic network functions (e.g., base stations) on black-box hardware. Such architecture is considered static and hard to reconfigure on-demand without any manual on-site intervention.
:8ball: It presents the traditional RRM solutions, largely based on heuristics only involving channel quality and load thresholds, are not primed to handle UE-centric handover decisions for new use-cases, and are often based on local, and thus limited, information.
:8ball: It also presents challenges related to interoperability, AI/ML training, and ensuring that intelligent control solutions effectively optimize RAN performance without disruptions to users.
:::
#### :pencil: <font color="blue">**Motivations**</font>
:::info
:8ball: The major motivations of the study are to solve the limitations of traditional RANs that have monolithic network functionalities and are difficult to reconfigure on-demand without any manual on-site intervention, and to mitigate the problem of RRM systems that are not equipped to handle UE-centric handover choices.
:::
#### :pencil: <font color="blue">**Contributions**</font>
:::info
This paper focuses on the Non Stand Alone (NSA) RAN deployment with an O-RAN-based approach and introduces several key contributions:
1. **System Design:** The authors design and build a near-real-time RIC (Radio Intelligent Controller) platform that complies with O-RAN standards, including open interfaces and service models for interacting with RAN nodes.
1. **Integration:** They develop ns-O-RAN, a virtualized and simulated environment for O-RAN, which bridges large-scale 5G simulations in ns-3 with a real-world near-real-time RIC. This allows for the development of xApps in a simulated environment and their subsequent testing on a real RAN, promoting scalability and flexibility.
1. **TS Optimization:** A data-driven AI-powered TS (Traffic Steering) xApp is created in the near-real-time RIC. This xApp uses reinforcement learning techniques, such as variants of the Deep-Q Network algorithm, to optimize handover procedures at the UE (User Equipment) level, aiming to maximize UE throughput utility.
1. **Performance Evaluation:** The paper extensively evaluates the TS xApp using various Key Performance Indicators (KPIs) such as UE throughput, spectral efficiency, and mobility overhead on a large-scale RAN network created by ns-O-RAN. The results show significant performance improvements, ranging from 30% to 50% for the mentioned KPIs.
The contributions include the development of an O-RAN-compliant RIC platform, the creation of a simulated RAN environment (ns-O-RAN), the implementation of an AI-powered TS xApp, and the demonstration of performance enhancements through fine-grained UE-level intelligence and optimization.
:::
## :male-teacher: <font color="green">**Background (Related Works)**</font>
#### :pencil: <font color="blue">**O-RAN Cellular Architecture**</font>
:::info

<font color="red">**Figure 1:**</font> O-RAN architecture with the near-RT RIC functions, aside packet core
<font color="red">**Table 1:**</font> RAN Protocol Stack
| <font color="green">Components/Layers/Protocols</font> | <font color="green">Descriptions</font> |
| ------------------------------------------------------ | ------------------------------------------------ |
| **gNB** | Next Generation Node Base |
| **CU-CP** | Centralized Unit - Control Plane |
| **CU-UP** | Centralized Unit - User Plane |
| **DU** | Distributed Unit |
| **RU** | Radio Units |
| **RRC** | Radio Resource Control |
| **PDCP-C** | Packet Data Convergence Protocol - Control Plane |
| **SDAP** | Service Data Adaptation Protocol |
| **PDCPU** | Packet Data Convergence Protocol - User Plane |
| **RLC** | Radio Link Control |
| **PHY-U** | Upper Physical |
| **eNB** | evolved Node Base |
| **PHY-L** | Lower Physical |
| **xApps** | extensible applications
<font color="red">**Table 2:**</font> RAN Intelligent Controllers and E2 Interface
| <font color="green">Controller/Interfaces/Models</font> | <font color="green">Descriptions</font> |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **near-RT RIC** | In addition to O-RAN standardized platform framework capabilities, it onboards xApps and uses low-latency control loops at near-RT granularity (from 10 ms to 1 second) to improve RRM decisions for dedicated RAN functionality **[10]**. |
| **E2 interface** | E2 is a bi-directional interface that splits the RRM between the E2 nodes and the near-RT RIC **[2]**. |
| **E2 Application Protocol (E2AP)** | It standardized the procedures and messages exchanged over the E2 interface **[2]**. |
| **E2 Service Models (E2SMs)** | It defined the xApps in the near-RT RIC encode and decode the payload of the E2AP messages containing RRM-specific information **[14]**. |
| **E2SM-Key Performance Measurement (KPM)** | It allows E2 nodes to send RAN performance data to the RIC, with granularity down to the UE-level **[15]**. |
|**E2SMRAN Control (RC)** | It allows the RIC to send back control based on RRM decisions from xApps **[16]**.|
:::
#### :pencil: <font color="blue">**Intelligence in the RIC**</font>
:::info
* This concept discusses the use of data-driven approaches in the context of Radio Resource Management (RRM) problems within the O-RAN framework.
* The disaggregation of RAN functions leads to the generation of large datasets that support machine learning (ML) approaches, and O-RAN defines specifications for the life cycle management of ML-driven RAN control. One promising approach is Reinforcement Learning (RL), particularly Deep Q-Network (DQN), a model-free, off-policy, value-based RL algorithm. DQN uses a Q-value to measure expected rewards for actions at given states and can be trained offline with online refinement, making it suitable for optimizing RAN actions based on live data streams from the environment in a closed-loop fashion **[17]**.
:::
#### :pencil: <font color="blue">**Dual Connectivity and Traffic Steering**</font>
:::info
<font color="red">**Table 3:**</font> Major Technolgies/Applications
| <font color="green">Technologies/Applications</font> | <font color="green">Descriptions</font> |
| -------- | -------- |
| **Dual connectivity** |It is involves in 5G RAN as a UE being connected to multiple base stations, with one as the master node handling control and the other as a secondary node responsible for data transfer **[9]**. |
|**Traffic Steering** | For controlling UEs' connectivity and mobility choices within the RAN, the RRC layer's Traffic Steering feature is used **[8]**. |
| **Q-learning Approaches** | They used to represent a centralized RL agent with handover control **[18]**. |
| **Deep Neural Network (DNN)**|They are used to transfer knowledge based on traditional handover mechanisms and avoid negative effects of random exploration for an untrained agent **[5, 23, 24]**.
:::
#### :pencil: <font color="blue">**5G and AI in NS-3**</font>
:::info
<font color="red">**Table 4:**</font> Major Software/Frameworks
| <font color="green">Software/Frameworks</font> | <font color="green">Descriptions</font> |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **NS-3** | It is a discrete-event time network simulator targeted for research and educational use **[31]**. It is applied on this study because of the very accurate 3GPP stochastic models **[32]** available within the simulator combined with the possibility of simulate large scale deployments with no telecommunication hardware required. |
| **5G and mmWave ns-3 module** | They are extends the ns-3 LTE module with new detailed modeling of the mmWave channel that can capture spatial clusters, path dynamics, antenna patterns and beamforming algorithms **[12]**. |
| **ns3-gym** | It is a framework that integrates both OpenAI Gym and ns-3 in order to encourage usage of RL in networking research **[33]**.|
| **ns3-ai** | It offers a high-efficiency solution to enable the data interaction between ns-3 and other python based AI frameworks **[34]**. However both of these tools cannot be used as a framework for the development of O-RAN xApps that can be used directly in a production environment, unlike the ns-O-RAN framework proposed in this paper. |
:::
## :male-teacher: <font color="green">**System Design and Architecture**</font>
#### :pencil: <font color="blue">**System Model**</font>
:::info

<font color="red">**Figure 2:**</font> System Model and Software Architecture
* The system architecture described in Figure 2a involves an LTE network with M cells and E2 nodes from N NR cells, serving a set U of 5G User Equipment (UEs). This infrastructure is deployed as a 5G NSA network with EN-DC RAN and option 3X for dual connectivity **[35]**. In this setup, 5G UEs are simultaneously connected to an LTE eNB (master node) and the E2 nodes of a 5G gNB (secondary node) in EN-DC. Each UE handles various types of data traffic, and data flows are split at the PDCP-U layer of the gNB CU-UP. Packets are then transmitted to the UE via the NR or LTE radio through the gNB DU or LTE eNB. A near-real-time (near-RT) RAN Intelligent Controller (RIC) is connected to each LTE and NR cell through the E2 interface, featuring the Traffic Steering (TS) xApp to optimize UE handovers. KPM data exchange between E2 nodes and the RIC enables network data exchange and handover control actions at near-RT intervals, while the E2SM-RC service model facilitates control actions and reporting of UE-specific measurements during mobility events.
:::
#### :pencil: <font color="blue">**Near-RT RIC Software Architecture**</font>
:::info
* In this implementation, a near-real-time RAN Intelligent Controller (RIC) platform **[36]** is used with two sets of applications: **xApps for controlling dedicated RAN functions** and **O-RAN-standardized platform services** as shown in Figure 2b. The platform services manage integration, E2 node interfacing, and overall RIC functionality. This includes the E2 Termination service for routing E2AP messages, ASN.1 encoding/decoding, and data management. The xApp Subscription Management service handles xApp subscriptions and data collection, aggregation, and processing, ensuring efficient KPM (Key Performance Monitoring) requests. The Traffic Steering (TS) xApp leverages the RIC platform to collect KPMs, process them, and make online decisions about UE handovers to different cells. It subscribes to E2 node KPMs, retrieves, and processes the data, and communicates handover control actions to the RAN when needed. The process supports streaming various KPMs from E2 nodes, correlating and aggregating data, and making real-time handover decisions.
:::
#### :pencil: <font color="blue">**Connecting O-RAN with NS-3: ns-O-RAN**</font>
:::info

<font color="red">**Figure 3:**</font> ns-O-RAN Architecture
* The paper introduces "**ns-O-RAN**," a crucial contribution that integrates O-RAN principles into ns-3, a network simulation tool. ns-O-RAN connects a real-world near-real-time (RT) RAN Intelligent Controller (RIC) with ns-3, allowing for large-scale collection of RAN KPMs and testing of closed-loop control in simulated cellular networks. This real-world RIC can communicate with actual hardware equipment, making ns-O-RAN a powerful tool for developing and testing xApps for real RANs. The integration simplifies xApp design, development, and testing across various RAN setups without infrastructure deployment costs. It leverages ns-3's realistic wireless modeling capabilities, 3GPP-compliant propagation, and 5G models for EN-DC RAN. The integration involves e2sim for message handling, addressing the challenges of multiple endpoints, IP addresses, and time synchronization between the real-world RIC and ns-3, ensuring consistent timing for simulations and real-world environments.
:::
## :male-teacher: <font color="green">**Traffic Steering Optimization**</font>
:::success
* They formulate the optimization problem for the traffic steering xApp and discuss the algorithm design to determine the optimal target cells for handover of UEs. To the best of their knowledge, this is the first paper to develop a data-driven UE-based traffic steering/handover optimization technique based on **Conservative Q-learning**.
:::
#### :pencil: <font color="blue">**Problem Formulation**</font>
:::info
* The objective in this context is to maximize the weighted cumulative throughput of all User Equipment (UEs) over time, considering their instantaneous target Primary cell of the Secondary Node (PSCell). The goal is to optimize the choice of PSCells for UEs to achieve this objective. However, the optimization process should also minimize frequent handovers for individual UEs, as these can increase network overhead and degrade their performance. To address this, a cost function is associated with each UE-specific handover, modeled as an exponential decay function that depends on the time elapsed since the previous handover for that UE. Smaller time differences result in higher costs, while larger differences reduce the cost. The cost function is used as a constraint to ensure that the total cost does not exceed a predefined threshold.
* The constrained optimization problem is formulated as follows:

:::
#### :pencil: <font color="blue">**Algorithm Design**</font>
:::info
* Generally, they used **MDP** and **RL** algorithms to design their algorithms according to their objectives.
* They consider the infinite time horizon MDP to model the system, where the **environment** is represented by **ns-O-RAN**, and **a single RL agent** is deployed in the near- RT RIC containing the TS xApp. The system is modeled as an MDP because <font color="red">the TS xApp in the RIC controls the target PSCell for the UEs handover</font>, while the resulting state (including the RAN performance parameters and the user throughput) is stochastic.
* The MDP is defined by the tuple **(*S, A, P, R, y, I*)**, *where:*
* - ***S*** is the state space, comprising of per-UE E2SM-KPM periodic data and per-UE E2SM-RC periodic/event-driven data.
- ***A*** is the action space, given by

- ***P** and **R*** given by

- **y** E **[0, 1]** is the **discount factor** for future rewards. The **value function** is the net return given by the expected cumulative discounted sum reward from step ***t*** onwards due to policy, provided as follows:

- ***I*** is the initial distribution of the UE states.
- They consider **two policies**, a **target policy** (to learn the optimal handover action for any state) and a **behavior policy** (to generate the handover actions which result in state transition and a new state data from the environment).
- **Q-function and Deep-Q Network** - They use **Q-learning**, a **model-free**, **off-policy (DQN)**, **value-based** RL approach. They compute the Q-function, an action-value function which measures the expected discounted reward upon taking any action a on any given state s based on any policy.
- The **optimal policy** is the one that **maximizes the expected discounted return**, and the optimal Q function ***Q(s, a)*** is the action-value function for optimal policy given by the Bellman equation as follows:


<font color="red">**Figure 4:**</font> Their CNN architecture design
- **REM and CQL**
- They use a robust offline Q-learning variant of the DQN algorithm, called **REM**, which enforces optimal Bellman consistency on ***J*** random convex combinations of multiple Q-value estimates to approximate the optimal Q-function **[40]**.
- To avoid this problem of over-estimation of Q-values for out-of-distribution actions, they use a conservative variant of offline DQN, called **CQL** that learns a conservative, lower-bound Q-function by **(i)** minimizing Q-values computed using **REM** under the **target policy distribution** and **(ii)** introducing a Q-value maximization term under the **behavior policy distribution** **[41]**.

:::
## :male-teacher: <font color="green">**Performance Evaluation**</font>
#### :pencil: <font color="blue">**Simulation and Scenario Design**</font>
:::info

<font color="red">**Figure 5:**</font> Simulation scenario
<font color="red">**Table 5:**</font> RL hyperparameters and their Values.


<font color="red">**Figure 6:**</font> Loss ***L*** for the Q-function for the offline training

<font color="red">**Figure 7:**</font> Throughput and SINR Cumulative Distribution Function (CDF) for the 850 MHz deployment, for the different baselines and the xAppdriven handover control. The average throughput accounts for the traffic on the LTE and NR split bearer

<font color="red">**Figure 8:**</font> Spectral efficiency and mobility overhead metrics for the 850 MHz deployment, as a function of the number of users, for the different baselines and the xApp-driven handover control.
:::
#### :pencil: <font color="blue">**Results**</font>
:::info

<font color="red">**Figure 9:**</font> Comparison between the performance gain in the 850 MHz band and in the 3.5 GHz band (or C-Band). Each bar represents theratio between the performance with the RIC RL and SON2 for the corresponding metric

<font color="red">**Figure 10:**</font> Comparison between the 10th percentile user throughput with the proposed xApp (RIC RL) and an xApp implementing the handover control logic from **[29]**

<font color="red">**Figure 11:**</font> Average cell spectral efficiency for the different traffic types, for 105 users and the 850 MHz deployment
:::
## :male-teacher: <font color="green">**Conclusions**</font>
:::info
* The paper presented a comprehensive O-RAN-compliant framework for optimizing Traffic Steering (TS) in 3GPP networks, with a specific focus on maximizing throughput by selecting the NR serving cell in an ENDC (E-UTRAN New Radio Dual Connectivity) setup. The implementation involved a cloud-native near-real-time RAN Intelligent Controller (RIC) connected to a simulated RAN environment in ns-3 using open O-RAN interfaces. A custom xApp for the RIC was developed, employing data-driven handover control based on Radio Environment Mapping (REM) and Cell Quality Level (CQL). Performance profiling was conducted on a large-scale deployment across various frequency bands, demonstrating significant improvements in average throughput and spectral efficiency, ranging from 30% to 50%, compared to traditional handover heuristics. These results underscore the effectiveness of the UE-level control at the near-RT RIC for enhancing network performance across different UE combinations.
:::
## :male-teacher: <font color="red">**Setup and Use ns-O-RAN Platform with a near-RT RIC**</font>
#### :pencil: <font color="blue">**Introduction**</font>
:::success
* **ns-O-RAN** is the first open source simulation platform that combines a [functional 4G/5G protocol stack in ns-3](https://github.com/nyuwireless-unipd/ns3-mmwave) with an [O-RAN-compliant E2 interface](https://gerrit.o-ran-sc.org/r/admin/repos/sim/ns3-o-ran-e2,general). This completes WIoT’s OpenRAN Gym platform with a simulator that can enhance data collection and xApp testing capabilities, a key step toward enabling efficient and generic AI and ML solutions for Open RAN and 5G/6G systems.
* **ns-O-RAN** has been designed and implemented to enable the integration of O-RAN software such as the O-RAN Software Community Near-RT RIC with large-scale 5G simulations based on [3GPP channel models](https://dl.acm.org/doi/abs/10.1145/3389400.3389401) and a detailed modeling of the [full 3GPP RAN protocol stack](https://ieeexplore.ieee.org/abstract/document/8344116/). This allows data collection of RAN Key Performance Metrics (KPMs) at scale, in different simulated scenarios, and with different applications (e.g., multimedia streaming, web browsing, wireless virtual reality, etc). ns-O-RAN supports an O-RAN-compliant E2 interface and implements two E2 service models (E2SM), **E2SM-Key Performance Metrics** (KPM) **monitoring** and **E2SM-RAN Control** (RC), that enable a closed-loop control (for example, of traffic steering and mobility).
* Here, we show how to install and setup ns-O-RAN on our environment and how we can create **simulated closed control loops** between **ns-3** and a **Near-RT RIC**. For this guide, we use the near-RT RIC from the WIoT’s [ColO-RAN](https://openrangym.com/o-ran-frameworks/coloran) framework. Such framework can be installed on our local workstation or can be loaded into any experimental platform such as [Colosseum](https://openrangym.com/experimental-platforms/colosseum). In our case, we can use a public available LXC image.
:::
#### :desktop_computer: **<font color="blue">Near-RT RIC Setup</font>**
:::success
* It requires a working version of **Docker** for hosting the RIC on our localhost.
* We first start by cloning and setup the **Colosseum’s near-RT RIC** with the following commands:

* Then we first **import all the images** we need **in Docker**, we tag them properly and we build and launch them:

* After the last step, the main entities of the RIC should be **up** and **running** **in different Docker containers** (this can be easily checked with the **<font color="red">docker ps</font>** command). To understand what is going on in the RIC and to have a feedback once we start ns-O-RAN, we can open **two terminal for the RIC**, one for **logging the values on the E2Term** and **check the E2AP messages exchange**, the other for the **xApp**.

* This last command will build and run a **Docker container** for the **x-app** and will also create a shell inside the container, and log us inside the container. Finally, we can move to the **/home/sample-xapp** directory inside the Docker container, and run the **xApp logic**:

:::
#### :desktop_computer: <font color="blue">**ns-O-RAN Setup**</font>
:::success
* To properly install **ns-3** and **ns-O-RAN**, several options are available, including the use of the Dockerfile provided in the root of the near-RT RIC repository. Here, we will setup and install the ns-O-RAN framework. As described in the paper and in the Figure 3, **ns-O-RAN** is composed by **three main parts:**
- The **e2sim software**, which was originally developed by the OSC.
- The **ns3-mmWave version**, which was originally developed by the University of Padova and NYU.
- The **ns-O-RAN module**, developed by Northeastern University and Mavenir, which is basically an external module that can be plugged in ns-3 and uses the e2sim to create a SCTP connection with the RIC.
* Lets adapted the first two software to enable the **end-to-end communication** with the **near-RT RIC** and the digestion of the **E2AP** and **E2SM messages**. We first start with the installation of the prerequisites. In Ubuntu 20.04 LTS, these can be installed with:

* Then we can clone and install the **e2Sim software**. To see the **E2 ASN messages** on the **e2sim**, we build it with **LOG_LEVEL** equal to **3** (**DEBUG**). This is useful to debug the exchange of the messages between the ns-3 and the RIC, but we also provide different debug levels that can be setup. These levels are summarized in the table below.

* This last command shall configure the **cmake project** and install the **e2sim on the system**. Its main actions are also in the aforementioned Dockerfile that report here to clarify the operations conducted by the script:

* It is now time to clone and install the **ns3-mmWave project:**

* After this step, we can clone the **ns-O-RAN module** and insert it in the **ns3-mmWave project** in the **contrib directory:**

* We now have all the software in place to **configure** and **build ns-3:**

:::
#### :man-running: <font color="blue">**Run Scenario Zero**</font>
:::success
* Finally, we can run an example ns-3 scenario called “**Scenario Zero**”.
* This scenario features a **Non Stand Alone** (NSA) **5G** setup in which we have **one LTE eNB positioned in the center** of the scenario and **four gNBs** around it with an **inter site distance of 1000** between the **eNB** and **each gNB**.
* We can run the scenario with the command:

* And if everything goes as intended we should be able to see in order the **following messages** flowing between the **ns-3** and the **RIC**:
- **E2 Setup Request** (ns-O-RAN to E2 Term on RIC);
- **E2 Setup Response** (E2 Term on RIC to ns-O-RAN);
- **E2 Subscription Request** (xApp to ns-O-RAN through E2 Term on RIC);
- **E2 Subscription Response** (ns-O-RAN to xApp through E2 Term on RIC);
- **E2SM RIC Indication Message** (ns-O-RAN to xApp through E2 Term on RIC);
* Check that this situation is happening, we can see the same message in all the **three different terminals opened**, as shown in the Figure below.
- <font color="red"> When the main entities of the **RIC up** and **running** in my different Docker containers: </font>

- <font color="red"> **When the messages flowing between the ns-3 and the RIC:** </font>

- <font color="red"> **The messages flowing in GUI:** </font>

- <font color="red"> **RX Packet Trace** </font>

- <font color="red"> **MmWave Switch Stats Trace** </font>

- <font color="red"> **The Source Code (scenario-zero.cc)** </font>
<iframe src="https://drive.google.com/file/d/15MHQdQsuyfWYHAQ1D8XLoaFDmp4V0hF3/preview" width="640" height="480" allow="autoplay"></iframe>
:::
:::danger
[:back: Please click here to go back to the home page of Wireless Communications Study Notes](https://hackmd.io/@Estif/HyBBwaa03).
:::