blob: 3adbd21a660bd0172f1cae172b4642101a09c64d [file] [log] [blame]
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -08001Getting Started
2===============
3
4Portability
5------------
6
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +00007ndnSIM 2.0 has been successfully compiled and used on following platforms:
8
9- Ubuntu Linux 12.04 (see the note)
10- Ubuntu Linux 14.04
11- OS X 10.10
12
13.. note::
14 ndnSIM is currently cannot be compiled on Ubuntu Linux 12.04 with the packaged boost
15 libraries (there is an `issue with boost 1.48 and gcc 4.6
16 <https://svn.boost.org/trac/boost/ticket/6153>`_). It is still possible to compile ndnSIM
17 on this platform, but either compiler or boost libraries (or both) need to get upgraded.
18
19 More recent version of boost can be installed from "Boost C++ Libraries" team PPA::
20
21 sudo apt-get install python-software-properties
22 sudo add-apt-repository ppa:boost-latest/ppa
23 sudo apt-get update
24 sudo apt-get install libboost1.55-all-dev
25
Spyridon Mastorakisf542c0b2015-08-11 22:59:18 -070026 # add --boost-libs=/usr/lib/x86_64-linux-gnu to ./waf configure
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000027 # ./waf configure --boost-libs=/usr/lib/x86_64-linux-gnu
28
29 Make sure that all other version of boost libraries (``-dev`` packages) are removed,
30 otherwise compilation will fail.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080031
32.. _requirements:
33
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080034Prerequisites
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080035-------------
36
Spyridon Mastorakisf542c0b2015-08-11 22:59:18 -0700371. `ndn-cxx library prerequisites <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`__.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080038
Alexander Afanasyev26b558b2012-12-13 11:39:46 -080039.. role:: red
40
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080041.. note::
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -080042 :red:`ndnSIM requires boost version at least 1.49.` Many linux distribution
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080043 (Fedora 16, 17 at the time of this writing) ship an old version of boost, making it
44 impossible to compile ndnSIM out-of-the-box. Please install the latest version, following
45 :ref:`these simple instructions <Installing boost libraries>`.
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070046
47.. note::
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -080048 If you do not have root permissions to install boost, you can install it in your home
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080049 folder. However, you need to be make sure that `libboost_iostreams` library is successfully
50 compiled and is installed. Please refer to :ref:`the following example <Installing boost
51 libraries>` for the hints how to successfully compile and install boost libraries on Ubuntu
52 Linux.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080053
54
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800552. If you are planning to use other modules, like visualizer, a number of additional
56dependencies should be installed. For example, in order to run `visualizer`_ module, the
57following should be installed:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080058
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000059 * For Ubuntu:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080060
Alexander Afanasyev326410e2013-03-09 20:39:11 -080061 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080062
Alexander Afanasyev326410e2013-03-09 20:39:11 -080063 sudo apt-get install python-dev python-pygraphviz python-kiwi
64 sudo apt-get install python-pygoocanvas python-gnome2
Alexander Afanasyevdf26b5a2015-01-15 23:30:56 -080065 sudo apt-get install python-rsvg ipython
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080066
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000067 * For Fedora:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080068
Alexander Afanasyev326410e2013-03-09 20:39:11 -080069 .. code-block:: bash
70
71 sudo yum install pygoocanvas python-kiwi graphviz-python
72
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070073 # easy_install method, since pygraphviz is not (yet?) packaged into Fedora (https://bugzilla.redhat.com/show_bug.cgi?id=740687)
Alexander Afanasyev326410e2013-03-09 20:39:11 -080074 sudo yum install graphviz-devel
75 sudo yum install python-pip
76 sudo easy_install pygraphviz
77
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000078 * For OS X with MacPorts:
Alexander Afanasyev326410e2013-03-09 20:39:11 -080079
80 .. code-block:: bash
81
82 sudo port install py27-pygraphviz py27-goocanvas
83
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080084 # If you add NDN macports repository, as described in
85 # http://named-data.net/doc/NFD/current/INSTALL.html#install-nfd-using-the-ndn-macports-repository-on-os-x
86 # you will be able to install another useful python module
87 # sudo port install py27-kiwi
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080088
Alexander Afanasyevdf26b5a2015-01-15 23:30:56 -080089 * For OS X with HomeBrew
90
91 .. code-block:: bash
92
93 brew install boost cryptopp pkg-config libxml2
94 brew link --force libxml2
95
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080096.. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
97
98Downloading ndnSIM source
99-------------------------
100
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800101ndnSIM package consists of three pieces:
102
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800103- a custom branch of NS-3 that contains a few useful patches
104- a customized python binding generation library (necessary if you want to use NS-3's python
105 bindings and/or visualizer module)
106- the source code of ndnSIM module
107
108The following commands download all pieces from GitHub repositories:
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800109
110.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800111
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800112 mkdir ndnSIM
113 cd ndnSIM
Alexander Afanasyevd6453cd2015-08-20 21:45:36 -0700114 git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
115 git clone https://github.com/named-data-ndnSIM/pybindgen.git pybindgen
Spyridon Mastorakisa1d135b2015-08-20 20:24:59 -0700116 git clone --recursive https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800117
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800118The few modification to the base NS-3 code are necessary to run ndnSIM, and the code is
119periodically synchronized with the official developer branch. Eventually, all the changes will
120be merged to the official branch, but for the time being, it is necessary to use the customized
121branch.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800122
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700123
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800124Compiling and running ndnSIM
125----------------------------
126
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800127- Compile NS-3 with ndnSIM module
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800128
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800129 ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be
130 sufficient to configure and build ndnSIM with python bindings enabled:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800131
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800132 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800133
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800134 cd <ns-3-folder>
135 ./waf configure --enable-examples
136 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800137
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800138 On MacOS (with macports), you may need to modify the configure command to use macports
139 version of python:
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800140
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800141 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800142
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800143 cd <ns-3-folder>
144 ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples
145 # or run ``sudo port select python python27``
146 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800147
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -0800148 .. note::
149 On OS X configuration stage may get :ref:`stuck at detecting gtk module <Problems with
150 the gtk python module on OS X>`. Make sure you have `XQuartz
151 <http://xquartz.macosforge.org>`_ installed or disable python as described in the
152 following instructions.
153
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800154 Python bindings is an optional and not very stable feature of NS-3 simulator. It is
155 possible to disable python bindings compilation either to speed up compilation or to avoid
156 certain compilation errors (e.g., "Could not find a task generator for the name
157 'ns3-visualizer'"):
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800158
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800159 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800160
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800161 cd <ns-3-folder>
162 ./waf configure --disable-python --enable-examples
163 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800164
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800165 For more configuration options, please refer to ``./waf --help``.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800166
Spyridon Mastorakisf34b3192015-02-16 17:42:01 -0800167
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700168Simulating using ndnSIM
169-----------------------
170
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800171- Examples simulations
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700172
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800173 When NS-3 is compiled with ``--with-examples`` flag, you can directly run all examples
174 described in :doc:`examples section of this tutorial <examples>`. For example, to run
175 ``ndn-simple.cpp`` scenario, you can run the following command:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700176
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800177 .. code-block:: bash
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700178
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800179 ./waf --run=ndn-simple
180
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -0800181 To run ``ndn-grid.cpp`` scenario:
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800182
183 .. code-block:: bash
184
185 ./waf --run=ndn-grid
186
187 To run the sample simulation scenarios with the logging module of NS-3 enabled (note that
188 this will work only when NS-3 is compiled in debug mode):
189
190 .. code-block:: bash
191
192 NS_LOG=ndn.Producer:ndn.Consumer ./waf --run=<scenario name>
193
194 If you have compiled with python bindings, then you can try to run these simulations with
195 visualizer:
196
197 .. code-block:: bash
198
199 ./waf --run=ndn-simple --vis
200
201 or:
202
203 .. code-block:: bash
204
205 ./waf --run=ndn-grid --vis
206
207 .. note::
208 Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d
209 optimized``) in order to run actual simulations.
210
211- Real experimentation
212
213 While it is possible to write simulations directly inside NS-3 (in ``scratch/`` folder) or
214 ndnSIM (in ``examples/``), the recommended way is to write your simulation scenarios, as
215 well as any custom extensions, separately from the NS-3 or ndnSIM core.
216
217 For example, you can use the following template to write your extensions, simulation
218 scenarios, and metric processing scripts:
219 `<http://github.com/cawka/ndnSIM-scenario-template>`_:
220
221 .. code-block:: bash
222
223 mkdir ndnSIM
224 cd ndnSIM
Alexander Afanasyevd6453cd2015-08-20 21:45:36 -0700225 git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
226 git clone https://github.com/named-data-ndnSIM/pybindgen.git pybindgen
Spyridon Mastorakisa1d135b2015-08-20 20:24:59 -0700227 git clone --recursive https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700228
229 # Build and install NS-3 and ndnSIM
230 cd ns-3
231 ./waf configure -d optimized
232 ./waf
233
234 sudo ./waf install
235 cd ..
236
Alexander Afanasyevd6453cd2015-08-20 21:45:36 -0700237 git clone https://github.com/named-data-ndnSIM/scenario-template.git scenario
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700238 cd scenario
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -0700239 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700240 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
241
242 ./waf configure
243
244 ./waf --run <scenario>
245
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800246 For more detailed information, refer to `README file
247 <https://github.com/cawka/ndnSIM-scenario-template/blob/master/README.md>`_.
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700248
249Examples of template-based simulations
250~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
251
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07002521. ndnSIM examples from `<http://ndnsim.net>`_ website and more:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700253
254- `<http://github.com/cawka/ndnSIM-examples>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700255
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08002562. Script scenarios and graph processing scripts for simulations used in "A Case for Stateful
257 Forwarding Plane" paper by Yi et al. (`<http://dx.doi.org/10.1016/j.comcom.2013.01.005>`_):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700258
259- `<http://github.com/cawka/ndnSIM-comcom-stateful-fw>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700260
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08002613. Script scenarios and graph processing scripts for simulations used in "Rapid Traffic
262 Information Dissemination Using Named Data" paper by Wang et
263 al. (`<http://dx.doi.org/10.1145/2248361.2248365>`_):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700264
265- `<http://github.com/cawka/ndnSIM-nom-rapid-car2car>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700266
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800267- Rocketfuel-based topology generator for ndnSIM preferred format (randomly assigned link
268 delays and bandwidth, based on estimated types of connections between nodes):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700269
270- `<http://github.com/cawka/ndnSIM-sample-topologies>`_, or