Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 1 | Getting Started |
| 2 | =============== |
| 3 | |
| 4 | Portability |
| 5 | ------------ |
| 6 | |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame^] | 7 | ndnSIM 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 31 | |
| 32 | .. _requirements: |
| 33 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 34 | Prerequisites |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 35 | ------------- |
| 36 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 37 | 1. `ndnSIM also required ndn-cxx library and all of its prerequisites |
| 38 | <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 39 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 40 | .. role:: red |
| 41 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 42 | .. note:: |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame^] | 43 | :red:`!!! ndnSIM requires boost version at least 1.49.` Many linux distribution |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 44 | (Fedora 16, 17 at the time of this writing) ship an old version of boost, making it |
| 45 | impossible to compile ndnSIM out-of-the-box. Please install the latest version, following |
| 46 | :ref:`these simple instructions <Installing boost libraries>`. |
Alexander Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 47 | |
| 48 | .. note:: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 49 | !!! If you do not have root permissions to install boost, you can install it in your home |
| 50 | folder. However, you need to be make sure that `libboost_iostreams` library is successfully |
| 51 | compiled and is installed. Please refer to :ref:`the following example <Installing boost |
| 52 | libraries>` for the hints how to successfully compile and install boost libraries on Ubuntu |
| 53 | Linux. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 54 | |
| 55 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 56 | 2. If you are planning to use other modules, like visualizer, a number of additional |
| 57 | dependencies should be installed. For example, in order to run `visualizer`_ module, the |
| 58 | following should be installed: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 59 | |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame^] | 60 | * For Ubuntu: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 61 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 62 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 63 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 64 | sudo apt-get install python-dev python-pygraphviz python-kiwi |
| 65 | sudo apt-get install python-pygoocanvas python-gnome2 |
| 66 | sudo apt-get install python-gnomedesktop python-rsvg ipython |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 67 | |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame^] | 68 | * For Fedora: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 69 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 70 | .. code-block:: bash |
| 71 | |
| 72 | sudo yum install pygoocanvas python-kiwi graphviz-python |
| 73 | |
Alexander Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 74 | # easy_install method, since pygraphviz is not (yet?) packaged into Fedora (https://bugzilla.redhat.com/show_bug.cgi?id=740687) |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 75 | sudo yum install graphviz-devel |
| 76 | sudo yum install python-pip |
| 77 | sudo easy_install pygraphviz |
| 78 | |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame^] | 79 | * For OS X with MacPorts: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 80 | |
| 81 | .. code-block:: bash |
| 82 | |
| 83 | sudo port install py27-pygraphviz py27-goocanvas |
| 84 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 85 | # If you add NDN macports repository, as described in |
| 86 | # http://named-data.net/doc/NFD/current/INSTALL.html#install-nfd-using-the-ndn-macports-repository-on-os-x |
| 87 | # you will be able to install another useful python module |
| 88 | # sudo port install py27-kiwi |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 89 | |
| 90 | .. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz |
| 91 | |
| 92 | Downloading ndnSIM source |
| 93 | ------------------------- |
| 94 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 95 | ndnSIM package consists of three pieces: |
| 96 | |
| 97 | - `ndn-cxx library <http://named-data.net/doc/ndn-cxx/>`_ |
| 98 | - a custom branch of NS-3 that contains a few useful patches |
| 99 | - a customized python binding generation library (necessary if you want to use NS-3's python |
| 100 | bindings and/or visualizer module) |
| 101 | - the source code of ndnSIM module |
| 102 | |
| 103 | The following commands download all pieces from GitHub repositories: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 104 | |
| 105 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 106 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 107 | mkdir ndnSIM |
| 108 | cd ndnSIM |
| 109 | git clone https://github.com/named-data/ndn-cxx.git ndn-cxx |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame^] | 110 | cd ndn-cxx |
| 111 | git checkout 81a6c5dea60cea97c60dab0d78576c0d3b4e29ed |
| 112 | cd .. |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 113 | git clone https://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 |
| 114 | git clone https://github.com/cawka/pybindgen.git pybindgen |
| 115 | git clone https://github.com/named-data/ndnSIM.git ns-3/src/ndnSIM |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 116 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 117 | The few modification to the base NS-3 code are necessary to run ndnSIM, and the code is |
| 118 | periodically synchronized with the official developer branch. Eventually, all the changes will |
| 119 | be merged to the official branch, but for the time being, it is necessary to use the customized |
| 120 | branch. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 121 | |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 122 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 123 | Compiling and running ndnSIM |
| 124 | ---------------------------- |
| 125 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 126 | - Compile and install ndn-cxx library |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 127 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 128 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 129 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 130 | cd ndnSIM/ndn-cxx |
| 131 | ./waf configure |
| 132 | ./waf |
| 133 | sudo ./waf install |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 134 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 135 | .. note:: |
| 136 | On Ubuntu platform you can also install ndn-cxx library from `NDN |
| 137 | PPA repository <http://named-data.net/doc/NFD/current/INSTALL.html#installing-nfd-from-binaries>`_ |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 138 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 139 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 140 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 141 | sudo apt-get install ndn-cxx |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 142 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 143 | - Compile NS-3 with ndnSIM module |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 144 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 145 | ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be |
| 146 | sufficient to configure and build ndnSIM with python bindings enabled: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 147 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 148 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 149 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 150 | cd <ns-3-folder> |
| 151 | ./waf configure --enable-examples |
| 152 | ./waf |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 153 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 154 | On MacOS (with macports), you may need to modify the configure command to use macports |
| 155 | version of python: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 156 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 157 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 158 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 159 | cd <ns-3-folder> |
| 160 | ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples |
| 161 | # or run ``sudo port select python python27`` |
| 162 | ./waf |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 163 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 164 | Python bindings is an optional and not very stable feature of NS-3 simulator. It is |
| 165 | possible to disable python bindings compilation either to speed up compilation or to avoid |
| 166 | certain compilation errors (e.g., "Could not find a task generator for the name |
| 167 | 'ns3-visualizer'"): |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 168 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 169 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 170 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 171 | cd <ns-3-folder> |
| 172 | ./waf configure --disable-python --enable-examples |
| 173 | ./waf |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 174 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 175 | For more configuration options, please refer to ``./waf --help``. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 176 | |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 177 | Simulating using ndnSIM |
| 178 | ----------------------- |
| 179 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 180 | - Examples simulations |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 181 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 182 | When NS-3 is compiled with ``--with-examples`` flag, you can directly run all examples |
| 183 | described in :doc:`examples section of this tutorial <examples>`. For example, to run |
| 184 | ``ndn-simple.cpp`` scenario, you can run the following command: |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 185 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 186 | .. code-block:: bash |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 187 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 188 | ./waf --run=ndn-simple |
| 189 | |
| 190 | To run ``ndn-grid.cpp` scenario: |
| 191 | |
| 192 | .. code-block:: bash |
| 193 | |
| 194 | ./waf --run=ndn-grid |
| 195 | |
| 196 | To run the sample simulation scenarios with the logging module of NS-3 enabled (note that |
| 197 | this will work only when NS-3 is compiled in debug mode): |
| 198 | |
| 199 | .. code-block:: bash |
| 200 | |
| 201 | NS_LOG=ndn.Producer:ndn.Consumer ./waf --run=<scenario name> |
| 202 | |
| 203 | If you have compiled with python bindings, then you can try to run these simulations with |
| 204 | visualizer: |
| 205 | |
| 206 | .. code-block:: bash |
| 207 | |
| 208 | ./waf --run=ndn-simple --vis |
| 209 | |
| 210 | or: |
| 211 | |
| 212 | .. code-block:: bash |
| 213 | |
| 214 | ./waf --run=ndn-grid --vis |
| 215 | |
| 216 | .. note:: |
| 217 | Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d |
| 218 | optimized``) in order to run actual simulations. |
| 219 | |
| 220 | - Real experimentation |
| 221 | |
| 222 | While it is possible to write simulations directly inside NS-3 (in ``scratch/`` folder) or |
| 223 | ndnSIM (in ``examples/``), the recommended way is to write your simulation scenarios, as |
| 224 | well as any custom extensions, separately from the NS-3 or ndnSIM core. |
| 225 | |
| 226 | For example, you can use the following template to write your extensions, simulation |
| 227 | scenarios, and metric processing scripts: |
| 228 | `<http://github.com/cawka/ndnSIM-scenario-template>`_: |
| 229 | |
| 230 | .. code-block:: bash |
| 231 | |
| 232 | mkdir ndnSIM |
| 233 | cd ndnSIM |
| 234 | git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 |
| 235 | git clone git://github.com/cawka/pybindgen.git pybindgen |
| 236 | git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 237 | |
| 238 | # Build and install NS-3 and ndnSIM |
| 239 | cd ns-3 |
| 240 | ./waf configure -d optimized |
| 241 | ./waf |
| 242 | |
| 243 | sudo ./waf install |
| 244 | cd .. |
| 245 | |
| 246 | git clone git://github.com/cawka/ndnSIM-scenario-template.git scenario |
| 247 | cd scenario |
Alexander Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 248 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 249 | export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH |
| 250 | |
| 251 | ./waf configure |
| 252 | |
| 253 | ./waf --run <scenario> |
| 254 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 255 | For more detailed information, refer to `README file |
| 256 | <https://github.com/cawka/ndnSIM-scenario-template/blob/master/README.md>`_. |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 257 | |
| 258 | Examples of template-based simulations |
| 259 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 260 | |
Alexander Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 261 | 1. ndnSIM examples from `<http://ndnsim.net>`_ website and more: |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 262 | |
| 263 | - `<http://github.com/cawka/ndnSIM-examples>`_, or |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 264 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 265 | 2. Script scenarios and graph processing scripts for simulations used in "A Case for Stateful |
| 266 | Forwarding Plane" paper by Yi et al. (`<http://dx.doi.org/10.1016/j.comcom.2013.01.005>`_): |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 267 | |
| 268 | - `<http://github.com/cawka/ndnSIM-comcom-stateful-fw>`_, or |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 269 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 270 | 3. Script scenarios and graph processing scripts for simulations used in "Rapid Traffic |
| 271 | Information Dissemination Using Named Data" paper by Wang et |
| 272 | al. (`<http://dx.doi.org/10.1145/2248361.2248365>`_): |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 273 | |
| 274 | - `<http://github.com/cawka/ndnSIM-nom-rapid-car2car>`_, or |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 275 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 276 | - Rocketfuel-based topology generator for ndnSIM preferred format (randomly assigned link |
| 277 | delays and bandwidth, based on estimated types of connections between nodes): |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 278 | |
| 279 | - `<http://github.com/cawka/ndnSIM-sample-topologies>`_, or |