blob: 61195d08891edfad7dc4c4d50d993c842f2fd5f1 [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
26 # add --boost-libs=/usr/lib/x86_64-linux-gnu to ./waf configure for ndn-cxx and ns3
27 # ./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
Alexander Afanasyevdc63d4a2015-06-08 12:26:12 -070032.. note::
33 For ndnSIM properly work, ndn-cxx library must be build as a shared library. For example::
34
35 # download ndn-cxx
36 ./waf configure --enable-shared --disable-static
37 ./waf build
38 sudo ./waf install
39
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080040.. _requirements:
41
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080042Prerequisites
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080043-------------
44
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800451. `ndnSIM also required ndn-cxx library and all of its prerequisites
46 <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080047
Alexander Afanasyev26b558b2012-12-13 11:39:46 -080048.. role:: red
49
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080050.. note::
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -080051 :red:`ndnSIM requires boost version at least 1.49.` Many linux distribution
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080052 (Fedora 16, 17 at the time of this writing) ship an old version of boost, making it
53 impossible to compile ndnSIM out-of-the-box. Please install the latest version, following
54 :ref:`these simple instructions <Installing boost libraries>`.
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070055
56.. note::
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -080057 If you do not have root permissions to install boost, you can install it in your home
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080058 folder. However, you need to be make sure that `libboost_iostreams` library is successfully
59 compiled and is installed. Please refer to :ref:`the following example <Installing boost
60 libraries>` for the hints how to successfully compile and install boost libraries on Ubuntu
61 Linux.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080062
63
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800642. If you are planning to use other modules, like visualizer, a number of additional
65dependencies should be installed. For example, in order to run `visualizer`_ module, the
66following should be installed:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080067
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000068 * For Ubuntu:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080069
Alexander Afanasyev326410e2013-03-09 20:39:11 -080070 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080071
Alexander Afanasyev326410e2013-03-09 20:39:11 -080072 sudo apt-get install python-dev python-pygraphviz python-kiwi
73 sudo apt-get install python-pygoocanvas python-gnome2
Alexander Afanasyevdf26b5a2015-01-15 23:30:56 -080074 sudo apt-get install python-rsvg ipython
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080075
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000076 * For Fedora:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080077
Alexander Afanasyev326410e2013-03-09 20:39:11 -080078 .. code-block:: bash
79
80 sudo yum install pygoocanvas python-kiwi graphviz-python
81
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070082 # 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 -080083 sudo yum install graphviz-devel
84 sudo yum install python-pip
85 sudo easy_install pygraphviz
86
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +000087 * For OS X with MacPorts:
Alexander Afanasyev326410e2013-03-09 20:39:11 -080088
89 .. code-block:: bash
90
91 sudo port install py27-pygraphviz py27-goocanvas
92
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -080093 # If you add NDN macports repository, as described in
94 # http://named-data.net/doc/NFD/current/INSTALL.html#install-nfd-using-the-ndn-macports-repository-on-os-x
95 # you will be able to install another useful python module
96 # sudo port install py27-kiwi
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080097
Alexander Afanasyevdf26b5a2015-01-15 23:30:56 -080098 * For OS X with HomeBrew
99
100 .. code-block:: bash
101
102 brew install boost cryptopp pkg-config libxml2
103 brew link --force libxml2
104
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800105.. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
106
107Downloading ndnSIM source
108-------------------------
109
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800110ndnSIM package consists of three pieces:
111
112- `ndn-cxx library <http://named-data.net/doc/ndn-cxx/>`_
113- a custom branch of NS-3 that contains a few useful patches
114- a customized python binding generation library (necessary if you want to use NS-3's python
115 bindings and/or visualizer module)
116- the source code of ndnSIM module
117
118The following commands download all pieces from GitHub repositories:
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800119
120.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800121
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800122 mkdir ndnSIM
123 cd ndnSIM
124 git clone https://github.com/named-data/ndn-cxx.git ndn-cxx
125 git clone https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
126 git clone https://github.com/cawka/pybindgen.git pybindgen
127 git clone https://github.com/named-data/ndnSIM.git ns-3/src/ndnSIM
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800128
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800129The few modification to the base NS-3 code are necessary to run ndnSIM, and the code is
130periodically synchronized with the official developer branch. Eventually, all the changes will
131be merged to the official branch, but for the time being, it is necessary to use the customized
132branch.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800133
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700134
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800135Compiling and running ndnSIM
136----------------------------
137
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800138- Compile and install ndn-cxx library
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 ndnSIM/ndn-cxx
Alexander Afanasyevdc63d4a2015-06-08 12:26:12 -0700143 ./waf configure --enable-shared --disable-static
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800144 ./waf
145 sudo ./waf install
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800146
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800147 .. note::
148 On Ubuntu platform you can also install ndn-cxx library from `NDN
149 PPA repository <http://named-data.net/doc/NFD/current/INSTALL.html#installing-nfd-from-binaries>`_
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800150
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800151 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800152
Alexander Afanasyev11381c22015-01-19 16:07:46 -0800153 sudo apt-get install ndn-cxx-dev
154
155 If you are using ndn-cxx from PPA, please make sure that you do not have the existing installation
156 of ndn-cxx library compiled from source (e.g., in /usr/local). Otherwise, the version mistmach
157 may result in compilation errors.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800158
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800159- Compile NS-3 with ndnSIM module
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800160
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800161 ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be
162 sufficient to configure and build ndnSIM with python bindings enabled:
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800163
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800164 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800165
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800166 cd <ns-3-folder>
167 ./waf configure --enable-examples
168 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800169
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800170 On MacOS (with macports), you may need to modify the configure command to use macports
171 version of python:
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800172
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800173 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800174
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800175 cd <ns-3-folder>
176 ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples
177 # or run ``sudo port select python python27``
178 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800179
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -0800180 .. note::
181 On OS X configuration stage may get :ref:`stuck at detecting gtk module <Problems with
182 the gtk python module on OS X>`. Make sure you have `XQuartz
183 <http://xquartz.macosforge.org>`_ installed or disable python as described in the
184 following instructions.
185
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800186 Python bindings is an optional and not very stable feature of NS-3 simulator. It is
187 possible to disable python bindings compilation either to speed up compilation or to avoid
188 certain compilation errors (e.g., "Could not find a task generator for the name
189 'ns3-visualizer'"):
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800190
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800191 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800192
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800193 cd <ns-3-folder>
194 ./waf configure --disable-python --enable-examples
195 ./waf
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800196
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800197 For more configuration options, please refer to ``./waf --help``.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800198
Spyridon Mastorakisf34b3192015-02-16 17:42:01 -0800199
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700200Simulating using ndnSIM
201-----------------------
202
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800203- Examples simulations
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700204
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800205 When NS-3 is compiled with ``--with-examples`` flag, you can directly run all examples
206 described in :doc:`examples section of this tutorial <examples>`. For example, to run
207 ``ndn-simple.cpp`` scenario, you can run the following command:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700208
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800209 .. code-block:: bash
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700210
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800211 ./waf --run=ndn-simple
212
Spyridon Mastorakisc33e2882015-01-20 21:45:44 -0800213 To run ``ndn-grid.cpp`` scenario:
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800214
215 .. code-block:: bash
216
217 ./waf --run=ndn-grid
218
219 To run the sample simulation scenarios with the logging module of NS-3 enabled (note that
220 this will work only when NS-3 is compiled in debug mode):
221
222 .. code-block:: bash
223
224 NS_LOG=ndn.Producer:ndn.Consumer ./waf --run=<scenario name>
225
226 If you have compiled with python bindings, then you can try to run these simulations with
227 visualizer:
228
229 .. code-block:: bash
230
231 ./waf --run=ndn-simple --vis
232
233 or:
234
235 .. code-block:: bash
236
237 ./waf --run=ndn-grid --vis
238
239 .. note::
240 Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d
241 optimized``) in order to run actual simulations.
242
243- Real experimentation
244
245 While it is possible to write simulations directly inside NS-3 (in ``scratch/`` folder) or
246 ndnSIM (in ``examples/``), the recommended way is to write your simulation scenarios, as
247 well as any custom extensions, separately from the NS-3 or ndnSIM core.
248
249 For example, you can use the following template to write your extensions, simulation
250 scenarios, and metric processing scripts:
251 `<http://github.com/cawka/ndnSIM-scenario-template>`_:
252
253 .. code-block:: bash
254
255 mkdir ndnSIM
256 cd ndnSIM
257 git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
258 git clone git://github.com/cawka/pybindgen.git pybindgen
259 git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700260
261 # Build and install NS-3 and ndnSIM
262 cd ns-3
263 ./waf configure -d optimized
264 ./waf
265
266 sudo ./waf install
267 cd ..
268
269 git clone git://github.com/cawka/ndnSIM-scenario-template.git scenario
270 cd scenario
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -0700271 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700272 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
273
274 ./waf configure
275
276 ./waf --run <scenario>
277
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800278 For more detailed information, refer to `README file
279 <https://github.com/cawka/ndnSIM-scenario-template/blob/master/README.md>`_.
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700280
281Examples of template-based simulations
282~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07002841. ndnSIM examples from `<http://ndnsim.net>`_ website and more:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700285
286- `<http://github.com/cawka/ndnSIM-examples>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700287
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08002882. Script scenarios and graph processing scripts for simulations used in "A Case for Stateful
289 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 -0700290
291- `<http://github.com/cawka/ndnSIM-comcom-stateful-fw>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700292
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -08002933. Script scenarios and graph processing scripts for simulations used in "Rapid Traffic
294 Information Dissemination Using Named Data" paper by Wang et
295 al. (`<http://dx.doi.org/10.1145/2248361.2248365>`_):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700296
297- `<http://github.com/cawka/ndnSIM-nom-rapid-car2car>`_, or
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700298
Spyridon Mastorakis460f57c2014-12-17 00:44:14 -0800299- Rocketfuel-based topology generator for ndnSIM preferred format (randomly assigned link
300 delays and bandwidth, based on estimated types of connections between nodes):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700301
302- `<http://github.com/cawka/ndnSIM-sample-topologies>`_, or