blob: 77c89e27f95322b1b086de6e809d9c5f70d5ff17 [file] [log] [blame]
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -08001Getting Started
2===============
3
4Portability
5------------
6
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07007ndnSIM has been successfully compiled and used under Ubuntu Linux 12.04 (boost libraries **1.48**, with default version 1.46 compilation will probably fail), 12.10 (default version of boost 1.49), 13.04 (default version of boost 1.49), Fedora 18, Mac OS 10.7 and 10.8 (gcc-4.2 apple/llvm, macports gcc 4.7, boost 1.49-1.54).
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -08008
9.. _requirements:
10
11Requirements
12-------------
13
141. ndnSIM requires the customized version of NS-3 simulator (a number of patches required to make ndnSIM work with the latest development branch of NS-3).
15
162. Boost libraries should be installed on the system:
17
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070018 * For Ubuntu
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080019
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070020 * 12.04
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080021
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070022 .. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080023
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070024 sudo aptitude install libboost1.48-all-dev
Alexander Afanasyev326410e2013-03-09 20:39:11 -080025
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070026 * 12.10, 13.04, and newer versions
Alexander Afanasyev326410e2013-03-09 20:39:11 -080027
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070028 .. code-block:: bash
Alexander Afanasyev326410e2013-03-09 20:39:11 -080029
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070030 sudo aptitude install libboost-all-dev
Alexander Afanasyev326410e2013-03-09 20:39:11 -080031
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070032 * For Fedora (for Fedora 18 and later only):
Alexander Afanasyev326410e2013-03-09 20:39:11 -080033
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070034 .. code-block:: bash
35
36 sudo yum install boost-devel
37
38 * For MacOS (macports):
39
40 .. code-block:: bash
41
42 sudo port instal boost
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080043
Alexander Afanasyev26b558b2012-12-13 11:39:46 -080044.. role:: red
45
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080046.. note::
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070047 :red:`!!! ndnSIM requires boost version at least 1.48.` Many linux distribution (Fedora 16, 17 at the time of this writing) ship an old version of boost, making it impossible to compile ndnSIM out-of-the-box. Please install the latest version, following :ref:`these simple instructions <Installing boost libraries>`.
48
49.. note::
50 :red:`For Ubuntu 12.04` Ubuntu 12.04 ships with two versions of boost libraries and it is known that if both are installed, then compilation of ndnSIM will most likely fail. Please install ``libboost1.48-dev-all`` package and uninstall ``libboost-dev-all``. If you want to install the latest version of boost libraries, then uninstall both ``libboost1.48-dev-all`` and ``libboost-dev-all``, so the libraries do not interfere with each other.
Alexander Afanasyev26b558b2012-12-13 11:39:46 -080051
52.. note::
Alexander Afanasyev326410e2013-03-09 20:39:11 -080053 !!! If you do not have root permissions to install boost, you can install it in your home folder. However, you need to be make sure that `libboost_iostreams` library is successfully compiled and is installed. Please refer to :ref:`the following example <Installing boost libraries>` for the hints how to successfully compile and install boost libraries on Ubuntu Linux.
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080054
55
563. If you are planning to use other modules, like visualizer, a number of additional dependencies should be installed. For example, in
57order to run `visualizer`_ module, the following should be installed:
58
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -070059 * For Ubuntu (tested on Ubuntu 12.04, 12.10, 13.04, should work on later versions as well):
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
65 sudo apt-get install python-gnomedesktop python-rsvg ipython
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080066
Alexander Afanasyev326410e2013-03-09 20:39:11 -080067 * For Fedora (tested on Fedora 16):
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
78 * For MacOS (macports):
79
80 .. code-block:: bash
81
82 sudo port install py27-pygraphviz py27-goocanvas
83
84.. py27-kiwi
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080085
86.. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
87
88Downloading ndnSIM source
89-------------------------
90
Alexander Afanasyev701e5082013-03-13 09:47:50 -070091Download a custom branch of NS-3 that contains all necessary patches, python binding generation library (optional), and clone actual ndnSIM code and place it in src/ folder:
Alexander Afanasyev326410e2013-03-09 20:39:11 -080092
93.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080094
95 mkdir ndnSIM
96 cd ndnSIM
97 git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
98 git clone git://github.com/cawka/pybindgen.git pybindgen
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -080099 git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
100
101There are quite a few modification to the base NS-3 code that are necessary to run ndnSIM, and the code is periodically synchronized with the official developer branch. Eventually, all the changes will be merged to the official branch, but for the time being, it is necessary to use the customized branch.
102
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700103If you have problems connecting to github, you can try to clone from google servers:
104
105.. code-block:: bash
106
107 mkdir ndnSIM
108 cd ndnSIM
109 git clone https://code.google.com/p/ndnsim.ns3-base/ ns-3
110 git clone https://code.google.com/p/ndnsim.pybindgen/ pybindgen
111 git clone https://code.google.com/p/ndnsim/ ns-3/src/ndnSIM
112
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800113Compiling and running ndnSIM
114----------------------------
115
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800116ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be sufficient to configure and build ndnSIM with python bindings enabled:
117
118.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800119
120 cd <ns-3-folder>
Alexander Afanasyev26b558b2012-12-13 11:39:46 -0800121 ./waf configure --enable-examples
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800122 ./waf
123
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800124On MacOS (with macports), you may need to modify the configure command to use macports version of python:
125
126.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800127
128 cd <ns-3-folder>
Alexander Afanasyev26b558b2012-12-13 11:39:46 -0800129 ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800130 ./waf
131
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800132Python bindings is an optional and not very stable feature of NS-3 simulator. It is possible to disable python bindings compilation either to speed up compilation or to avoid certain compilation errors (e.g., "Could not find a task generator for the name 'ns3-visualizer'"):
133
134.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800135
136 cd <ns-3-folder>
Alexander Afanasyev26b558b2012-12-13 11:39:46 -0800137 ./waf configure --disable-python --enable-examples
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800138 ./waf
139
140For more configuration options, please refer to ``./waf --help``.
141
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800142To run :doc:`sample ndnSIM simulations <examples>`:
143
144.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800145
146 ./waf --run=ndn-simple
147
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800148or:
149
150.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800151
152 ./waf --run=ndn-grid
153
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800154If you have compiled with python bindings, then you can try to run these simulations with visualizer:
155
156.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800157
158 ./waf --run=ndn-simple --vis
159
Alexander Afanasyev326410e2013-03-09 20:39:11 -0800160or:
161
162.. code-block:: bash
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800163
164 ./waf --run=ndn-grid --vis
165
166.. note::
167 Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d optimized``) in order to run actual simulations.
168
Alexander Afanasyeve095f0f2012-11-21 17:43:32 -0800169
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700170Simulating using ndnSIM
171-----------------------
172
173While it is possible to write simulations directly inside NS-3 (in ``scratch/`` folder) or ndnSIM (in ``examples/``), the recommended way is to write your simulation scenarios, as well as any custom extensions, separately from the NS-3 or ndnSIM core.
174
Alexander Afanasyeva79df572013-07-26 11:32:42 -0700175For example, you can use the following template to write your extensions, simulation scenarios, and metric processing scripts: `<http://github.com/cawka/ndnSIM-scenario-template>`_:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700176
177.. code-block:: bash
178
179 mkdir ndnSIM
180 cd ndnSIM
181 git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
182 git clone git://github.com/cawka/pybindgen.git pybindgen
183 git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
184
185 # Build and install NS-3 and ndnSIM
186 cd ns-3
187 ./waf configure -d optimized
188 ./waf
189
190 sudo ./waf install
191 cd ..
192
193 git clone git://github.com/cawka/ndnSIM-scenario-template.git scenario
194 cd scenario
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -0700195 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700196 export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
197
198 ./waf configure
199
200 ./waf --run <scenario>
201
202For more detailed information, refer to `README file <https://github.com/cawka/ndnSIM-scenario-template/blob/master/README.md>`_.
203
204Examples of template-based simulations
205~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07002071. ndnSIM examples from `<http://ndnsim.net>`_ website and more:
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700208
209- `<http://github.com/cawka/ndnSIM-examples>`_, or
210- `<http://code.google.com/p/ndnsim.ndnsim-examples/>`_
211
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07002122. Script scenarios and graph processing scripts for simulations used in "A Case for Stateful 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 -0700213
214- `<http://github.com/cawka/ndnSIM-comcom-stateful-fw>`_, or
215- `<http://code.google.com/p/ndnsim.ndnsim-comcom/>`_
216
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -07002173. Script scenarios and graph processing scripts for simulations used in "Rapid Traffic Information Dissemination Using Named Data" paper by Wang et al. (`<http://dx.doi.org/10.1145/2248361.2248365>`_):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700218
219- `<http://github.com/cawka/ndnSIM-nom-rapid-car2car>`_, or
220- `<http://code.google.com/p/ndnsim.ndnsim-nom-rapid/>`_
221
Alexander Afanasyev9ab7d672013-08-11 11:02:52 -0700222- Rocketfuel-based topology generator for ndnSIM preferred format (randomly assigned link delays and bandwidth, based on estimated types of connections between nodes):
Alexander Afanasyev701e5082013-03-13 09:47:50 -0700223
224- `<http://github.com/cawka/ndnSIM-sample-topologies>`_, or
225- `<http://code.google.com/p/ndnsim.ndnsim-sample-topo/>`_