Deployment of NS-3 with Eclipse IDE

Network Simulators is typically used to study services and applications in complex scenarios due to the infeasibility of deploying real testbeds. Many problems can be solved by using network simulators such as NS-3. With this in mind, the aim of this article is to introduce new NS-3 users through detailed information. It is sometimes difficult to handle by new users the traditional manuals developed by NS-3 project official website. In this article, NS-3 for communication network and Eclipse Integrated Development Environment (IDE) for powerful programming language are integrated step-by-step, explaining the main features of these open source software packages and concluding with an example simulation. Our effort is to make it easy for a beginner to be part of the NS-3 research community and to maintain an open environment of knowledge.


Introduction
Nowadays, communications are present in everything.The different applications allow to connect organizations, universities, colleges, hospitals, vehicles and even countries.Metrics such as, throughput, delay, number of retransmissions, jitter or packet error rate are essential for assessing and designing communication networks.For this purpose, simulation is the most utilized method to study networks, it is the imitation of the real situations through tools called simulators, such as: NS-2, NS-3, OPNET [1], NetSim, OMNeT++, among others [2].Network simulators predicts the behavior of the different networks e.g., allow the study of wired networks, wireless networks [3] [4], mobile telephony [5], QoS analysis [6], protocols analysis [7] [8], etc.
In this context, the new generation of network simulator NS-3 includes a more accurate physical (PHY) layer metrics [9] [10].The NS-3 started in 2006, is an open source software which is written from C++ and is not an evolution of NS-2, it is a new simulator .On the other hand, several external animators and visualization tools can be used with NS-3 such as C++ and/or Python packages [11].This article makes use of Eclipse IDE C++ as integration tool on NS-3.Eclipse is widely used in computer programming.Although, the Eclipse is written primarily in Java, it supports plug-ins that allow developers to develop applications in different programming languages (e.g.PHP, Perl, Cobol and Python) [12].Integrated graphical user interface on NS-3 is a good idea for improving performance of new generation of simulators.The article is organized as follows: Section 2 is focused in the Installation of NS-3 and Eclipse CDT.The Installation of Java Development Kit (JDK) is derived in Section 3. Finally, Section 4 deals with the Installation and Configure Eclipse for C++ Developers for running the first script in NS-3 on Eclipse IDE.

Prerequisite Package for Ubuntu
First of all, it is advisable to update the Ubuntu 16.04 with its latest components through the following instructions in a terminal.Remember you need "sudo" operation to run the commands as root user, you will be prompted for your password only once.Now, the core of NS-3 requires a list of packages that are needed to support different NS-3 options, as detailed below [13]:

Requirements for Network Simulation Cradle
• flex, bison.

Xml-based version of the config store
• libxml2, libxml2-dev.

Support for utils/check-style.py code style check program
• uncrustify.

Download and Install NS-3
With the previous step completed, create a directory of your preference in the home folder (e.g. in my case ns3).After that, extract the downloaded NS-3 package in the new location using the following commands from a terminal:  If the build is successful, the message "build finished successfully " will appear At this point, it is necessary to build using waf builder by running the commands below: If all is ok, you will get this message "configure finished successfully"  If all modules passed, you will get the following output.Congratulations, NS-3 is successfully installed.The above commands produce the following output:

Install Eclipse CDT
It is worth mentioning that there are two ways to install Eclipse CDT: either running the commands of installation from a terminal, or using the Synaptic package manager.In this article, we choose the first option, because in the second alternative, the synaptic package needs to be installed and in some cases you may experience some errors in this installation process.Having said that, open a terminal and execute the following command:

Prerequisite Package for Java
As a first step, it is necessary to check the java version in Ubuntu.For this, in a terminal use the following command:

Install Oracle Java JDK 8
For this tutorial, the JDK 8 package is the last available version in the official Java website http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/.Once the Java version is chosen, download Oracle through the following line in a terminal:  Although Oracle JDK 9 is now considered stable, it is not compatible with Eclipse.We have to type the following command to install Oracle Java 8:  If you find below output it means your installation is successful.Once the installation has been completed, the command of Fig. 15 produces the following output:

Download and Install Eclipse IDE
Before installing Eclipse IDE, you should check if your operative system (OS) is 32bit or 64bit version by using:uname -m.With this information, download the suitable package for your Ubuntu version from website https://eclipse.org/downloads/.Later, unpack the Eclipse package and install it by using the commands from a terminal:   Then, accept the license terms, and then wait to see if package is installed successfully.Afterwards, click on " Launch" and Eclipse IDE will open to you.tutorial both techniques are explained.In addition, it is shown the pros and cons of each of these options.

Option 1
This alternative has a major drawback, the MercurialEclipse installation package is unavailable in the official Eclipse Studio website, this issue is shown below.On the other hand, for this option, use the following instructions: * In the main menu go to Help → Install New Software * In "Work with" textbox enter the following website http://cbes.javaforge.com/update and clicking on "Add".* A new window will open to you.In "Name" textbox enter again the website http://cbes.javaforge.
com/update and pressing the "OK" button.As previously mentioned, the only available repository in the Fig. 28 is the codeBeamer Eclipse Studio package.Therefore, we recommend using option 2.

Option 2
This alternative is an user-friendly application, but the Eclipse Marketplace tool needed for this option is only available in the latest versions of Eclipse IDE.However, this article provides the installation instructions for latest portable eclipse, so you will not have any problem.Then, follow the instructions for this choice: * In the main menu go to Help → Eclipse Marketplace * Click on Search tab and write "MercurialEclipse" * Click on "Install".then, accept the license terms and press the Finish button  Next step, click on "Next" and "Finish".The new C++ project was created: Confirm the Mercurial Repository Location and press the "Finish" button

Configure WAF Builder
Waf is a piece of software written in Python and used to help building software projects [14].As shown in Fig. 11, the setting of this tool is essential for running the NS-3 scripts.This setting aims to debug a test application under the scratch folder.Here are the steps: * In the main menu go to Run → Debug Configurations * Click on C/C++ Application and choose the C++ project created, in my case "TutorialNS3Debug" * Click on the "Browse" button under the "Project" section and select the current project  Write "LD_LIBRARY_PATH" in the name field.On the other hand, in the value name file write the directory where build exists, in my case "/home/jose/ns3/ns-allinone-3.25/ns-3.25/build".Finally, verify that "Append environment to native envir press the "Apply" and "Close" buttons.From the Run menu, select the name of external runner created, in my case "Run".The following window appears, write the name of the program file without using the extension.This concludes our tutorial.To learn more, please read the references.

Additional Material
This tutorial includes a virtual machine with NS-3 simulator and Eclipse IDE.

Conclusions
A simulator is a very useful tool for learning and research.However, the first steps can be somewhat difficult and its complete domain is a long process.This work aims to ease the path of researchers by presenting a tutorial that indicates step by step how to install NS-3 in conjunction with Eclipse.Eclipse can become essential to debug elements (protocols) or create new ones.It help to track errors and better understand the interactions between these components.As a future work we plan to develop a similar tutorial for another well-known simulator, OMNET ++.In addtion, we want to develop a tutorial that facilitates the execution of block simulations and their subsequent analysis.

Figure 3 .
Figure 3. Successful installation of Prerequisite Package for NS-3.

Figure 5 .
Figure 5. Command to build and compile the examples of NS-3.

Figure 6 .
Figure 6.Confirmation message of successful compilation.

Figure 7 .
Figure 7. Command to build the examples of NS-3 with waf tool.

Figure 8 .
Figure 8. Confirmation message of successful compilation.

Figure 9 .
Figure 9. Command to test if everything is alright.

Finally
, you only need to run a "hello word" program by typing the following:

Figure 11 .
Figure 11.Running the first script.

Figure 12 .
Figure 12.Output message of the first script.

Figure 13 .Figure 14 .
Figure 13.Command to install the Eclipse CDT

Figure 15 .Figure 16 .Figure 17 .
Figure 15.Command to check the Java version in Ubuntu.

Figure 18 .
Figure 18.Command to download the Oracle Java.

Figure 20 .
Figure 20.Command to install Oracle Java.

Figure 21 .
Figure 21.Acceptance of the License Agreement.

Figure 22 .
Figure 22.Successful installation of Oracle Java.

Figure 23 .
Figure 23.Installed version of Java in Ubuntu.

Figure 24 .
Figure 24.Commands to download and install Eclipse IDE.

Figure 30 .
Figure 30.Acceptance of License Agreement for MercurialEclipse.

4. 2 . 6 .
Running the first script in NS-3 on Eclipse IDE After all installation steps have been completed, an example program must be run to verify the successful integration of NS-3 on Eclipse.It is worth mentioning that any NS3 script can be chosen.For this tutorial, the " third.cc" script of the default examples of NS-3 repository is shown.Then, the steps for running a program file: * Go to C++ Project_name (e.g.TutorialNS3) → Examples → Tutorial and double click on "third.cc" to open it.

/C++ Build.
Knowing this, follow the instructions: * Right click on the C++ project → Properties → C