Posts

Showing posts with the label ns3

Topology Generator for ns3 on Ubuntu 16.04

Image
While I find a solution to execute different BRITE configuration files or how to export ns2 topologies to ns3, I found this application compatible with ns-3.25 (since last week available). To try it, follow these commands: git clone https://github.com/idaholab/Topology_Generator.git cd Topology_Generator  qmake make ./ns-3-generator You can generate a C++ or a Python code and export your topology as XML code. Also, you can create applications, like ping, UDP Echo or TCP Transfer. I tested and it works! Enjoy it!

Install and configure Eclipse IDE to use with ns3 on Ubuntu

Image
First, you need to download Eclipse CDT (C/C++ Development Tooling): sudo apt-get install eclipse-cdt eclipse-mercurialeclipse Maybe, you will have problems to run eclispse and it will close: An extract of the log: org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.simpleconfigurator_1.0.301.dist [1]" could not be resolved. Reason: Missing Constraint: Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,J2SE-1.4 !MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.simpleconfigurator_1.0.301.dist.jar was not resolved. !MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(|(&(osgi.ee=CDC/Foundation)(version=1.1))(&(osgi.ee=JavaSE)(version=1.4)))" To solve it, you must change your java version to other compatible with eclipse. In my case, I was using openjdk9, and I switch it for openjdk8-jre. sudo apt-get install openjdk-8-jre sudo update-alternatives --config java ...

Install ns3-dev through bake on Ubuntu

Bake is an open source integration tool implemented in Python and it is used to automate the build of a number of projects which depend on each other. First, install ns3 dependencies: sudo apt-get install gcc g++ python python-dev mercurial gdb valgrind gsl-bin libgsl0-dev flex bison tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev vtun lxc uncrustify doxygen graphviz imagemagick texlive texlive-latex-extra texlive-generic-extra texlive-generic-recommended python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev Now, download bake and check the dependencies: mkdir ns3 cd ns3 hg clone http://code.nsnam.org/bake cd bake python bake.py check  > Python - OK  > GNU C++ compiler - OK  > Mercurial - OK  > CVS - is missing  > GIT - OK  > Bazaar - is missing  > Tar tool - OK  > Unzip tool - OK  > Unrar tool - is missing  > 7z  data compression ut...

GDB and breakpoints in ns3

Image
If you want debug your simulation, a good option is use gdb. If you want create breakpoints (watchpoints) in your file, just add this line: ns3::BreakpointFallback();  Also, you can do it by the classic way with these lines: #include <signal.h> raise(SIGINT); Now, just execute: ./waf --command-template="gdb %s" --run $FILE_NAME run Whre $FILE_NAME is your simulation file, frequently located at scratch folder. As you can see with "where", the breakpoint was in line 101. You will get these follows signals: Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007fffeaba02a9 in raise (sig=5) at ../sysdeps/unix/sysv/linux/pt-raise.c:35 35 ../sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory. Program received signal SIGINT, Interrupt. 0x00007fffeaba02a9 in raise (sig=2) at ../sysdeps/unix/sysv/linux/pt-raise.c:35 35 ../sysdeps/unix/sysv/linux/pt-raise.c: No such file or directory.

A NetAnim example for ns3

Image
NetAnim is a GUI for ns3 (like visualizer). The last version 3.107 comes with ns3-allinone-3.25. To compile it follow these commands: #Install required software sudo apt-get install mercurial qt4-dev-tools #Download netanim from mercurial hg clone http://code.nsnam.org/netanim #or use it from ns3-allinone-3.25 cd netanim-3.107 make clean qmake NetAnim.pro  (For MAC Users: qmake -spec macx-g++ NetAnim.pro) make  ./NetAnim To generate an xml file compatible with netanim, you must add the following lines to your simulation file. // netanim headers   #include "ns3/netanim-module.h" // file's name to run on netanim   std::string animFile = "example.xml" ;    AnimationInterface anim (animFile); // background image. Starts on 0,0, the image is not resized (scale 1,1) and the image has no transparency (alpha channel is one).   anim.SetBackgroundImage("potential_google_fiber_cities.png",0,0,1,1,1); // Set position of node 0 in the...

How to install openflow 1.3 in ns3

NS3 by default use openflow version 0.8.9, it's very outdated. To install this module, first we'll check the modules compatibility with our Ubuntu 16.04: sudo apt-get install gcc g++ python python-dev sudo apt-get install mercurial bzr gdb valgrind gsl-bin libgsl0-dev libgsl0ldbl flex bison gcc g++ tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev vtun lxc uncrustify doxygen graphviz imagemagick texlive texlive-latex-extra texlive-generic-extra texlive-generic-recommended python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev hg clone http://code.nsnam.org/ns-3-allinone cd ns-3-allinone && ./download.py cd ns-3-dev ./waf configure --enable-examples --enable-tests  BRITE Integration             : not enabled (BRITE not enabled (see option --with-brite)) MPI Support                   : not enabled (option --enable-mpi not selected) NS-3 Click In...