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
cd ns-3-allinone && ./
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 Integration        : not enabled (nsclick not enabled (see option --with-nsclick))
NS-3 OpenFlow Integration     : not enabled (OpenFlow not enabled (see option --with-openflow))
*Network Simulation Cradle     : not enabled (NSC not found (see option --with-nsc))
PlanetLab FdNetDevice         : not enabled (PlanetLab operating system not detected (see option --force-planetlab))
*Python API Scanning Support   : not enabled (gccxml too old)

If you want to install BRITE and Click, follow these steps:

hg clone

tar xzvf click-2.0.1.tar.gz
cd click-2.0.1
./configure --enable-userlevel --disable-linuxmodule --enable-nsclick --enable-wifi

gccxml and nsc are too old now. gccxml has been deprecated and replaced by CastXML and nsc works with kernel 2.6.18 as you can see below:

hg clone
cd nsc

linux-2.6.18/include/linux/compiler.h:40:2: error: #error no compiler-gcc.h file for this gcc version
 #error no compiler-gcc.h file for this gcc version

linux-2.6.26/include/asm/processor.h:276:30: warning: 'packed' attribute ignored [-Wattributes]
 DECLARE_PER_CPU(struct tss_struct, init_tss);

Ubuntu 14.04 it's the most recomended version to install all these modules.

OpenFlow 1.3 module for ns3 was developed to ns3 version 3.25. The virtual machine image (available here) is for Ubuntu 14.04.1, but I'll install it on Ubuntu 16.04. Follow these steps:

sudo apt-get install libpcre2-dev libxerces-c-dev libpcap0.8-dev
cd netbee/src/
cmake .

sudo cp ../bin/libn*.so /usr/local/lib
sudo ldconfig
sudo cp -R ../include/* /usr/include/

git clone
cd ofsoftswitch13
git checkout v2.0.x

./configure --enable-ns3-lib

hg clone
cd ns-3.24
hg update ns-3.24.1

hg clone src/ofswitch13
cd src/ofswitch13
hg update 2.0.2
cd ../../

patch -p1 < src/ofswitch13/utils/ofswitch13-csma-3_24_1.patch
patch -p1 < src/ofswitch13/utils/ofswitch13-doc-3_24_1.patch

./waf configure --enable-examples --enable-tests --enable-mpi --with-ofswitch13=PATH_TO_ofsoftswitch13 --with-brite=PATH_TO_BRITE 

./waf --run src/ofswitch13/examples/chain-ofswitch13   
Waf: Entering directory `/home/dragonx/Downloads/ns-3.24/build'
Waf: Leaving directory `/home/dragonx/Downloads/ns-3.24/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (2.311s)
Total bytes sent from H0 to H1: 4462736


  1. ```sh
    $ ~/repos/ns-3-allinone/netbee/src/ofsoftswitch13$ ./
    ./ 14: ./ autoreconf: not found
    sudo apt-get install autoconf automake libtool

  2. This comment has been removed by the author.

  3. Hi

    I am able to add openflow 1.3 to ns-3.24. Is there way to have this support for the latest stable ns-3 release ns-3.26?

    When i tried with ns-3.25, first i had a compilation error V4PingHelper used in When i remove this by adding ns3/internet-apps-module.h, compilation proceeds but fails at linking.

    Help much appreciated to enable Openflow1.3 with ns-3.26

    Thank you
    Best Regards

    1. Sorry for the delay. I was on vacations.
      Did you try doing a patch for version 3.24 and later change only these lines in the newer version? You can't replace the files on the newer version, because are new functions on them.

  4. Hi First Really thanks for your site, I found this morning and till now I use it a lot. anyway if its possible for you guide me with NS3.26 and Ubuntu 16.04 LTS in following error:
    1- Modules not built (see ns-3 tutorial for explanation):
    brite click ofswitch13 openflow

    2- gccxml version unknown or too old, need version >= 0.9; automatic scanning of API definitions will not be possible

    3- when ever I ./waf --run a program following error occurred :
    Could not load icon applets-screenshooter due to missing gnomedesktop Python module
    Could not load icon gnome-terminal due to missing gnomedesktop Python module

    I follow so many instruction but not successful with Ubuntu 16.04 LTS I am disappointed now and will happy to help if its possible.

    1. You must install:
      1.- brite click ofswitch13 openflow (read this post, I published how to install them on it)
      2.- gccxml
      3.- gnomedesktop Python module

    2. This comment has been removed by the author.

    3. thanks for your reply I try specially after this follow this post my ns3.26 face to error I delete it and install it again, I installed all python-gnome2-desktop (5 packages) but still face to that warning.
      about gccxml I did not try.
      So would you please try ns3 3.26 with ubuntu 16.04 LTS I am sure you will see these error I search in net so many people face same problems.


Post a Comment

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

How to install a WhatsApp bot based on Python