blob: 23ff20dfbcec99b7aae1ce111b033ebbcc1298ac [file] [log] [blame]
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -08001Getting Started
2===============
3
4Portability
5------------
6
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08007ndnSIM has been successfully compiled and used under Ubuntu Linux 12.04 (only with boost
8libraries **1.48**), 14.04 (default version of boost), OS X 10.10 (Xcode 6.1.1, macports boost
91.56-1.57).
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080010
11.. _requirements:
12
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080013Prerequisites
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080014-------------
15
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800161. `ndnSIM also required ndn-cxx library and all of its prerequisites
17 <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080018
Alexander Afanasyev26b558b2012-12-13 11:39:46 -080019.. role:: red
20
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080021.. note::
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080022 :red:`!!! ndn-cxx and ndnSIM requires boost version at least 1.48.` Many linux distribution
23 (Fedora 16, 17 at the time of this writing) ship an old version of boost, making it
24 impossible to compile ndnSIM out-of-the-box. Please install the latest version, following
25 :ref:`these simple instructions <Installing boost libraries>`.
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070026
27.. note::
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080028 :red:`For Ubuntu 12.04` Ubuntu 12.04 ships with two versions of boost libraries and it is
29 known that if both are installed, then compilation of ndnSIM will most likely fail. Please
30 install ``libboost1.48-dev-all`` package and uninstall ``libboost-dev-all``. If you want to
31 install the latest version of boost libraries, then uninstall both ``libboost1.48-dev-all``
32 and ``libboost-dev-all``, so the libraries do not interfere with each other.
Alexander Afanasyev26b558b2012-12-13 11:39:46 -080033
34.. note::
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080035 !!! If you do not have root permissions to install boost, you can install it in your home
36 folder. However, you need to be make sure that `libboost_iostreams` library is successfully
37 compiled and is installed. Please refer to :ref:`the following example <Installing boost
38 libraries>` for the hints how to successfully compile and install boost libraries on Ubuntu
39 Linux.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080040
41
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800422. If you are planning to use other modules, like visualizer, a number of additional
43dependencies should be installed. For example, in order to run `visualizer`_ module, the
44following should be installed:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080045
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080046 * For Ubuntu (tested on Ubuntu 14.04, should work on later versions as well):
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080047
Alexander Afanasyev326410e2013-03-09 20:39:11 -080048 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080049
Alexander Afanasyev326410e2013-03-09 20:39:11 -080050 sudo apt-get install python-dev python-pygraphviz python-kiwi
51 sudo apt-get install python-pygoocanvas python-gnome2
52 sudo apt-get install python-gnomedesktop python-rsvg ipython
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080053
Alexander Afanasyev326410e2013-03-09 20:39:11 -080054 * For Fedora (tested on Fedora 16):
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080055
Alexander Afanasyev326410e2013-03-09 20:39:11 -080056 .. code-block:: bash
57
58 sudo yum install pygoocanvas python-kiwi graphviz-python
59
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070060 # 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 -080061 sudo yum install graphviz-devel
62 sudo yum install python-pip
63 sudo easy_install pygraphviz
64
65 * For MacOS (macports):
66
67 .. code-block:: bash
68
69 sudo port install py27-pygraphviz py27-goocanvas
70
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080071 # If you add NDN macports repository, as described in
72 # http://named-data.net/doc/NFD/current/INSTALL.html#install-nfd-using-the-ndn-macports-repository-on-os-x
73 # you will be able to install another useful python module
74 # sudo port install py27-kiwi
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080075
76.. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
77
78Downloading ndnSIM source
79-------------------------
80
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080081ndnSIM package consists of three pieces:
82
83- `ndn-cxx library <http://named-data.net/doc/ndn-cxx/>`_
84- a custom branch of NS-3 that contains a few useful patches
85- a customized python binding generation library (necessary if you want to use NS-3's python
86 bindings and/or visualizer module)
87- the source code of ndnSIM module
88
89The following commands download all pieces from GitHub repositories:
Alexander Afanasyev326410e2013-03-09 20:39:11 -080090
91.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080092
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080093 mkdir ndnSIM
94 cd ndnSIM
95 git clone https://github.com/named-data/ndn-cxx.git ndn-cxx
96 git clone https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
97 git clone https://github.com/cawka/pybindgen.git pybindgen
98 git clone https://github.com/named-data/ndnSIM.git ns-3/src/ndnSIM
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080099
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800100The few modification to the base NS-3 code are necessary to run ndnSIM, and the code is
101periodically synchronized with the official developer branch. Eventually, all the changes will
102be merged to the official branch, but for the time being, it is necessary to use the customized
103branch.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800104
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700105
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800106Compiling and running ndnSIM
107----------------------------
108
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800109- Compile and install ndn-cxx library
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800110
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800111 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800112
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800113 cd ndnSIM/ndn-cxx
114 ./waf configure
115 ./waf
116 sudo ./waf install
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800117
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800118 .. note::
119 On Ubuntu platform you can also install ndn-cxx library from `NDN
120 PPA repository <http://named-data.net/doc/NFD/current/INSTALL.html#installing-nfd-from-binaries>`_
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800121
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800122 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800123
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800124 sudo apt-get install ndn-cxx
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800125
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800126- Compile NS-3 with ndnSIM module
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800127
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800128 ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be
129 sufficient to configure and build ndnSIM with python bindings enabled:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800130
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800131 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800132
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800133 cd <ns-3-folder>
134 ./waf configure --enable-examples
135 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800136
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800137 On MacOS (with macports), you may need to modify the configure command to use macports
138 version of python:
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800139
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800140 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800141
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800142 cd <ns-3-folder>
143 ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples
144 # or run ``sudo port select python python27``
145 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800146
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800147 Python bindings is an optional and not very stable feature of NS-3 simulator. It is
148 possible to disable python bindings compilation either to speed up compilation or to avoid
149 certain compilation errors (e.g., "Could not find a task generator for the name
150 'ns3-visualizer'"):
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800151
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800152 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800153
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800154 cd <ns-3-folder>
155 ./waf configure --disable-python --enable-examples
156 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800157
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800158 For more configuration options, please refer to ``./waf --help``.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800159
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700160Simulating using ndnSIM
161-----------------------
162
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800163- Examples simulations
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700164
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800165 When NS-3 is compiled with ``--with-examples`` flag, you can directly run all examples
166 described in :doc:`examples section of this tutorial <examples>`. For example, to run
167 ``ndn-simple.cpp`` scenario, you can run the following command:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700168
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800169 .. code-block:: bash
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700170
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800171 ./waf --run=ndn-simple
172
173 To run ``ndn-grid.cpp` scenario:
174
175 .. code-block:: bash
176
177 ./waf --run=ndn-grid
178
179 To run the sample simulation scenarios with the logging module of NS-3 enabled (note that
180 this will work only when NS-3 is compiled in debug mode):
181
182 .. code-block:: bash
183
184 NS_LOG=ndn.Producer:ndn.Consumer ./waf --run=<scenario name>
185
186 If you have compiled with python bindings, then you can try to run these simulations with
187 visualizer:
188
189 .. code-block:: bash
190
191 ./waf --run=ndn-simple --vis
192
193 or:
194
195 .. code-block:: bash
196
197 ./waf --run=ndn-grid --vis
198
199 .. note::
200 Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d
201 optimized``) in order to run actual simulations.
202
203- Real experimentation
204
205 While it is possible to write simulations directly inside NS-3 (in ``scratch/`` folder) or
206 ndnSIM (in ``examples/``), the recommended way is to write your simulation scenarios, as
207 well as any custom extensions, separately from the NS-3 or ndnSIM core.
208
209 For example, you can use the following template to write your extensions, simulation
210 scenarios, and metric processing scripts:
211 `<http://github.com/cawka/ndnSIM-scenario-template>`_:
212
213 .. code-block:: bash
214
215 mkdir ndnSIM
216 cd ndnSIM
217 git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
218 git clone git://github.com/cawka/pybindgen.git pybindgen
219 git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700220
221 # Build and install NS-3 and ndnSIM
222 cd ns-3
223 ./waf configure -d optimized
224 ./waf
225
226 sudo ./waf install
227 cd ..
228
229 git clone git://github.com/cawka/ndnSIM-scenario-template.git scenario
230 cd scenario
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -0700231 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700232 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
233
234 ./waf configure
235
236 ./waf --run <scenario>
237
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800238 For more detailed information, refer to `README file
239 <https://github.com/cawka/ndnSIM-scenario-template/blob/master/README.md>`_.
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700240
241Examples of template-based simulations
242~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07002441. ndnSIM examples from `<http://ndnsim.net>`_ website and more:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700245
246- `<http://github.com/cawka/ndnSIM-examples>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700247
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08002482. Script scenarios and graph processing scripts for simulations used in "A Case for Stateful
249 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 -0700250
251- `<http://github.com/cawka/ndnSIM-comcom-stateful-fw>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700252
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08002533. Script scenarios and graph processing scripts for simulations used in "Rapid Traffic
254 Information Dissemination Using Named Data" paper by Wang et
255 al. (`<http://dx.doi.org/10.1145/2248361.2248365>`_):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700256
257- `<http://github.com/cawka/ndnSIM-nom-rapid-car2car>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700258
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800259- Rocketfuel-based topology generator for ndnSIM preferred format (randomly assigned link
260 delays and bandwidth, based on estimated types of connections between nodes):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700261
262- `<http://github.com/cawka/ndnSIM-sample-topologies>`_, or