Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 1 | Getting Started |
| 2 | =============== |
| 3 | |
| 4 | Portability |
| 5 | ------------ |
| 6 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 7 | ndnSIM has been successfully compiled and used under Ubuntu Linux 12.04 (only with boost |
| 8 | libraries **1.48**), 14.04 (default version of boost), OS X 10.10 (Xcode 6.1.1, macports boost |
| 9 | 1.56-1.57). |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 10 | |
| 11 | .. _requirements: |
| 12 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 13 | Prerequisites |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 14 | ------------- |
| 15 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 16 | 1. `ndnSIM also required ndn-cxx library and all of its prerequisites |
| 17 | <http://named-data.net/doc/ndn-cxx/current/INSTALL.html>`_. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 18 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 19 | .. role:: red |
| 20 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 21 | .. note:: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 22 | :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 Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 26 | |
| 27 | .. note:: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 28 | :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 Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 33 | |
| 34 | .. note:: |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 35 | !!! 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 40 | |
| 41 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 42 | 2. If you are planning to use other modules, like visualizer, a number of additional |
| 43 | dependencies should be installed. For example, in order to run `visualizer`_ module, the |
| 44 | following should be installed: |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 45 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 46 | * For Ubuntu (tested on Ubuntu 14.04, should work on later versions as well): |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 47 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 48 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 49 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 50 | 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 53 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 54 | * For Fedora (tested on Fedora 16): |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 55 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 56 | .. code-block:: bash |
| 57 | |
| 58 | sudo yum install pygoocanvas python-kiwi graphviz-python |
| 59 | |
Alexander Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 60 | # 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] | 61 | 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 Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 71 | # 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 75 | |
| 76 | .. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz |
| 77 | |
| 78 | Downloading ndnSIM source |
| 79 | ------------------------- |
| 80 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 81 | ndnSIM 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 | |
| 89 | The following commands download all pieces from GitHub repositories: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 90 | |
| 91 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 92 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 93 | 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 99 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 100 | The few modification to the base NS-3 code are necessary to run ndnSIM, and the code is |
| 101 | periodically synchronized with the official developer branch. Eventually, all the changes will |
| 102 | be merged to the official branch, but for the time being, it is necessary to use the customized |
| 103 | branch. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 104 | |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 105 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 106 | Compiling and running ndnSIM |
| 107 | ---------------------------- |
| 108 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 109 | - Compile and install ndn-cxx library |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 110 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 111 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 112 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 113 | cd ndnSIM/ndn-cxx |
| 114 | ./waf configure |
| 115 | ./waf |
| 116 | sudo ./waf install |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 117 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 118 | .. 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 Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 121 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 122 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 123 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 124 | sudo apt-get install ndn-cxx |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 125 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 126 | - Compile NS-3 with ndnSIM module |
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 | 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 130 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 131 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 132 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 133 | cd <ns-3-folder> |
| 134 | ./waf configure --enable-examples |
| 135 | ./waf |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 136 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 137 | On MacOS (with macports), you may need to modify the configure command to use macports |
| 138 | version of python: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 139 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 140 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 141 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 142 | 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 Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 146 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 147 | 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 Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 151 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 152 | .. code-block:: bash |
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 | cd <ns-3-folder> |
| 155 | ./waf configure --disable-python --enable-examples |
| 156 | ./waf |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 157 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 158 | For more configuration options, please refer to ``./waf --help``. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 159 | |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 160 | Simulating using ndnSIM |
| 161 | ----------------------- |
| 162 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 163 | - Examples simulations |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 164 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 165 | 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 Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 168 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 169 | .. code-block:: bash |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 170 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 171 | ./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 Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 220 | |
| 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 Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 231 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 232 | export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH |
| 233 | |
| 234 | ./waf configure |
| 235 | |
| 236 | ./waf --run <scenario> |
| 237 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 238 | For more detailed information, refer to `README file |
| 239 | <https://github.com/cawka/ndnSIM-scenario-template/blob/master/README.md>`_. |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 240 | |
| 241 | Examples of template-based simulations |
| 242 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 243 | |
Alexander Afanasyev | 9ab7d67 | 2013-08-11 11:02:52 -0700 | [diff] [blame] | 244 | 1. ndnSIM examples from `<http://ndnsim.net>`_ website and more: |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 245 | |
| 246 | - `<http://github.com/cawka/ndnSIM-examples>`_, or |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 247 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 248 | 2. 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 Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 250 | |
| 251 | - `<http://github.com/cawka/ndnSIM-comcom-stateful-fw>`_, or |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 252 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 253 | 3. 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 Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 256 | |
| 257 | - `<http://github.com/cawka/ndnSIM-nom-rapid-car2car>`_, or |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 258 | |
Spyridon Mastorakis | 460f57c | 2014-12-17 00:44:14 -0800 | [diff] [blame] | 259 | - Rocketfuel-based topology generator for ndnSIM preferred format (randomly assigned link |
| 260 | delays and bandwidth, based on estimated types of connections between nodes): |
Alexander Afanasyev | 701e508 | 2013-03-13 09:47:50 -0700 | [diff] [blame] | 261 | |
| 262 | - `<http://github.com/cawka/ndnSIM-sample-topologies>`_, or |