# ns-3-dev-git
###### tags: `Construction`
## The Network Simulator, Version 3
Overview: An Open Source Project
ns-3 is a free open source project aiming to build a discrete-event network simulator targeted for simulation research and education. This is a collaborative project; we hope that the missing pieces of the models we have not yet implemented will be contributed by the community in an open collaboration process. If you would like to contribute to ns-3, please check the Contributing to ns-3 section below.
This README excerpts some details from a more extensive tutorial that is maintained at: https://www.nsnam.org/documentation/latest/
## Building ns-3
The code for the framework and the default models provided by ns-3 is built as a set of libraries. User simulations are expected to be written as simple programs that make use of these ns-3 libraries.
To build the set of default libraries and the example programs included in this package, you need to use the ns3 tool. This tool provides a Waf-like API to the underlying CMake build manager. Detailed information on how to use ns3 is included in the quick start guide.
Before building ns-3, you must configure it. This step allows the configuration of the build options, such as whether to enable the examples, tests and more.
To configure ns-3 with examples and tests enabled, run the following command on the ns-3 main directory:
```shell=
$ git clone https://github.com/nsnam/ns-3-dev-git.git
##To configure ns-3 with examples and tests enabled, run the following command on the ns-3 main directory:
$ ./ns3 configure --enable-examples --enable-tests
##Then, build ns-3 by running the following command:
$ ./ns3 build
By default, the build artifacts will be stored in the build/ directory.
```
## Testing ns-3
```shell=
##ns-3 contains test suites to validate the models and detect regressions. To run the test suite, run the following command on the ns-3 main directory:
$ ./test.py
##More information about ns-3 tests is available in the test framework section of the manual.
```
## Running ns-3
```shell=
##On recent Linux systems, once you have built ns-3 (with examples enabled), it should be easy to run the sample programs with the following command, such as:
$ ./ns3 run simple-global-routing
$ tcpdump -n -tt -r simple-global-routing-0-1.pcap
##That program should generate a simple-global-routing.tr text trace file and a set of simple-global-routing-xx-xx.pcap binary PCAP trace files, which can be read by tcpdump -n -tt -r filename.pcap. The program source can be found in the examples/routing directory.
```
## 5G-Lena 3GPP-NR module
5G-LENA is a GPLv2 New Radio (NR) network simulator, designed as a pluggable module to ns-3 by Mobile Networks group of a public research institute, CTTC (Centre Tecnològic de Telecomunicacions de Catalunya)[1]. The simulator is the natural evolution of LENA, the LTE/EPC Network Simulator, the development Inspired by mmWave module by NYU/UniPD] [2], and it incorporates fundamental PHY-MAC NR features aligned with NR Release 15[1]
The 5G-LENA code of [1] that I used in this installation is a version meant for installing 3GPP NR module in ns-3-dev and it is for the simulation 5G NR non-standalone cellular networks under ns-3 using 5G-LENA project.
## Step 1: Installation of the Dependencies
```shell=
$ apt-get update
$ apt-get install git
$ apt-get install libc6-dev
$ apt-get install sqlite sqlite3 libsqlite3-dev
```
## Step 2: Download ns-3-dev Version
```shell=
$ cd /home/your_home/
$ git clone https://gitlab.com/nsnam/ns-3-dev.git
```
## Step 3: Downgrade the ns-3-dev version to ns-3.35
```shell=
$ cd ns-3-dev
$ git checkout ns-3.35
```
## Step 4: Installing nr module from GitLab
```shell=
$ cd /home/your_home/ns-3-dev
$ cd contrib
$ git clone https://gitlab.com/cttc-lena/nr.git
$ cd nr
$ git checkout 5g-lena-v1.2.y
```
## Step 5: Configure ns-3
```shell=
$ cd ns-3-dev
$ ./waf configure --enable-examples
```
## Step 6: Compile the Default ns-3-dev
```shell=
$ ./waf build
```
## Step 7: Testing the Lena nr installation with an Example Simulation
```shell=
$ sudo ./waf --run scratch/scratch-simulator.cc --vis
##If the NR module is recognized correctly, you should see "nr" in the list of built modules. If that is the case, Welcome to the NR world !!! :-)
Now, you can run some of NR examples (see nr/examples folder):
$ sudo ./waf --run contrib/nr/examples/cttc-nr-demo.cc
```
# Reference
https://ns3simulation.com/ns3-5g-simulation/
https://gitlab.com/nsnam/ns-3-dev