Creating ndnSIM scenarios with Eclipse - Waseda-Sato-lab/ccn-sim GitHub Wiki

Due to the complexity of the code involved in ndnSIM, it is highly recommended to have a reliable set of tools to be able to see the code one requires to see and to be comfortable with them. This page briefly describes how to set up Eclipse to compile and run a ndnSIM scenario. I assume that you have at least read through the how to install the ndnSIM environment and have at least the initial repository at hand.

Obtainting Eclipse

Debian maintains a very old version of Eclipse in it's stable repository. Because of this it is generally a good idea to download the newest version from the Eclipse homepage. Please remember that ndnSIM is built on C++. The version for Eclipse we have worked with is Kepler, but there is no reason for newer or slightly older versions to work with this explanation. The Eclipse download page can be found here.

Once we have the package we can decompress the files using the following command:

~ $ tar xzvf Downloads/eclipse-cpp-kepler-SR2-linux-gtk-x86_64.tar.gz

Once finished, one can start Eclipse with the following command:

~ $ eclipse/eclipse&

Importing a ndnSIM scenario to Eclipse

  1. Go to File->Import: File->Import

  2. Pick to import from git: Import from git

  3. Pick the clone URI option: Clone URI

  4. Type in the URI you obtained for your repository. Using SSH requires you to set your SSH keys for Github. If you don't have these set, then using HTTPS will work. Be sure to have your Github username and password at hand if you use HTTPS. Type URI

  5. In this example the repository has no branches, so we just pick master. Depending on the repository this will need to be changed: git branch selection

  6. Next we pick the local directory to store the information we get from git. This can be placed within the workspace: Local git location

  7. The repository should not include the Eclipse project settings, meaning that we must import the information as a simple general project: Import a Eclipse project

  8. Finally we give the project a name: Name the project

  9. With the previous step done, we have a project and the repository data, but we don't have the Eclipse support for C/C++. To obtain this we right click on the project and go to New->Convert to C/C++ Project: Project New Convert to C/C++

  10. We convert to a C++ Project and choose to have a simple executable created by gcc: Convert to C/C++ Project

  11. Having done that, we need to change the way Eclipse compiles the code. We right click on the project and then search for properties in the menu: Build properties 1

  12. In the C/C++ Build section under Builder settings, we have to change the build command and the build location to fit that of the repository. In this example the waf script is in ndn-campus/, so the build command must become ndn-campus/waf. Absolute paths and paths created by Eclipse variables are valid here. The scenario builds in ndn-campus/ so that is our build location: C/C++ Build

  13. In the C/C++ Build section under Behaviour settings, we change the Build (Incremental build) to build: C/C++ Build behaviour

  14. Before being able to run waf for ndnSIM scenarios, we have to run ./waf configure. This can also be done within Eclipse. The way I have found to to this is we right click on the project and search for Make targets->Create: Make targets configure

  15. Having done this, the following dialog box pops up where we can create a target called configure. Since we have modified the build method in steps 10 to 12, all that is needed is to write configure:

Create configure target

This concludes the integration of Eclipse with a single ndnSIM scenario.

Building (Compiling) a scenario from within Eclipse

Once we have finished configuring Eclipse with our scenario, we will want to compile the scenario from within Eclipse. To do this, we can take the following steps:

  1. An initial clone of the repository will require the configuration of the waf scripts. If the instructions in the prior section were followed, all we need to do is right click on the project and go to Make Targets->Build. Make Targets->Build

  2. The resulting dialog will show us the particular targets that are available. The prior section created the configure target, which we must choose to run before being able to continue. Clicking on the Build button while having the configure target selected should be sufficient. Configure target

  3. If all goes well, within the Eclipse Console window, you should see the successful configuration of the scenario by the waf scripts. An example is shown below: Console configure results Steps 1, 2 and 3 are only to be executed one time, essentially the first time the project is imported. After that one time, one can compile the scenario by using only steps 4 and 5.

  4. With the configuration executed, we can proceed to build the scenario. This can be done by right clicking on the project and selecting Build Project from the available options: Build Project

  5. If all goes well, within the Eclipse Console window, you should see the successful compilation of the scenario by the waf scripts. An example screenshot is shown below: Console build results

This concludes the configuration and building of a scenario in Eclipse.

Running a scenario from within Eclipse

Due to the number of parameters one can use for ns-3 simulations, even with the integration with Eclipse, it is highly recommended that the actual execution of the simulation be done in Linux terminal. A screenshot of an example is shown below:

Execute simulation

Disclaimer

Be warned that you must build the configure target once before you can later build the project completely. The resulting binary can be run from within Eclipse but to obtain more data, particularly visual data, I suggest you run the project from a command line terminal.