Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 1 | .. ndnSIM: NS-3 based NDN simulator |
| 2 | .. ============================================================ |
| 3 | |
| 4 | .. .. toctree:: |
| 5 | .. :maxdepth: 2 |
| 6 | |
| 7 | Introduction |
Alexander Afanasyev | 5d79e68 | 2012-11-19 14:12:23 -0800 | [diff] [blame] | 8 | ============ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 9 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 10 | The ndnSIM is NS-3 module that implements Named Data Networking (NDN) communication model, the clean slate Internet design. ndnSIM is specially optimized for simulation purposes and has a cleaner and more extensible internal structure comparing to the existing NDN implementation (Project CCNx). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 11 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 12 | Following the NDN architecture, ndnSIM is implemented as a new network-layer protocol model, which can run on top of any available link-layer protocol model (point-to-point, CSMA, wireless, etc.). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 13 | |
| 14 | .. note:: |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 15 | It will also be possible to run ndnSIM on top of network-layer (IPv4, IPv6) and transport-layer (TCP, UDP) protocols. |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 16 | However, it is not yet implemented and patches are welcome. |
| 17 | |
| 18 | .. This flexibility allows ndnSIM to simulate scenarios of various homogeneous and heterogeneous networks (e.g., NDN-only, NDN-over-IP, etc.). |
| 19 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 20 | The simulator is implemented in a modular fashion, using separate C++ classes to model behavior of each network-layer entity in NDN: :ndnsim:`pending Interest table (PIT) <Pit>`, :ndnsim:`forwarding information base (FIB) <Fib>`, :ndnsim:`content store <ContentStore>`, :ndnsim:`network <NetDeviceFace>` and :ndnsim:`application <AppFace>` interfaces, :ndnsim:`Interest forwarding strategies <ForwardingStrategy>`, etc. |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 21 | This modular structure allows any component to be easily modified or replaced with no or minimal impact on other components. |
| 22 | In addition, the simulator provides an extensive collection of interfaces and helpers to perform detailed tracing behavior of every component, as well as NDN traffic flow. |
| 23 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 24 | |
| 25 | .. aafig:: |
| 26 | :aspect: 60 |
| 27 | :scale: 120 |
| 28 | |
| 29 | +----------------+ +-----------+ |
| 30 | | "Applications" | | NetDevice | |
| 31 | +----------------+ +-----------+ |
| 32 | ^ ^ |
| 33 | .................|......................................|...................... |
| 34 | . v v . |
| 35 | . +------------------+ +----------------------+ . |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 36 | . | "Face" | | "Face" | . |
| 37 | . | "(AppFace)" | | "(NetDeviceFace)" | . |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 38 | . +------------------+ +----------------------+ . |
| 39 | . ^ ^ . |
| 40 | . | | . |
| 41 | . v v . |
| 42 | . XXXXXXXXXXXXXXXXXXXXXXXXXXXXX . |
| 43 | . XX XX . |
| 44 | . XX Core NDN protocol XX . |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 45 | . XX "(L3Protocol)" XX |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 46 | . XX XX . |
| 47 | . XXXXXXXXXXXXXXXXXXXXXXXXXXXXX . |
| 48 | . ^ ^ ^ ^ . |
| 49 | . | | | | . |
| 50 | . +-------------------+ +---+ +---+ +------------+ . |
| 51 | . | | | | . |
| 52 | . v v v v . |
| 53 | . +-------------------+ +-------+ +-------+ +-------------+ . |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 54 | . | "ContentStore" | | PIT | | FIB | | "Forwarding"| . |
| 55 | . +-------------------+ +-------+ +-------+ | "Strategy" | . |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 56 | . +-------------+ . |
| 57 | . . |
| 58 | ............................................................................... |
| 59 | |
| 60 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 61 | The wire format of Interest and Data packets follows the format of the existing `CCNx Project's NDN implementation`_ (CCNx Binary Encoding), allowing reuse of the existing traffic analysis tools, as well as driving simulations using real NDN traffic traces. |
| 62 | |
| 63 | .. _CCNx Project's NDN implementation: http://www.ccnx.org/ |
| 64 | |
| 65 | Getting Started |
| 66 | =============== |
| 67 | |
| 68 | Portability |
| 69 | ------------ |
| 70 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 71 | ndnSIM has been successfully compiled and used under Ubuntu Linux 12.04 (stock gcc, boost 1.48), Mac OS 10.8 (gcc-4.2 apple/llvm, macports gcc 4.7, boost 1.49 or 1.50). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 72 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 73 | .. _requirements: |
| 74 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 75 | Requirements |
| 76 | ------------- |
| 77 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 78 | 1. 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). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 79 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 80 | 2. Boost libraries should be installed on the system: |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 81 | |
| 82 | * For Ubuntu:: |
| 83 | |
| 84 | sudo aptitude install libboost-all-dev |
| 85 | |
| 86 | * For MacOS (macports):: |
| 87 | |
| 88 | sudo port instal boost |
| 89 | |
Alexander Afanasyev | 7099ffb | 2012-10-16 20:42:11 -0700 | [diff] [blame] | 90 | .. note:: |
| 91 | !!! 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 :doc:`the following example <boost-custom-install>` for the hints how to successfully compile and install boost libraries on Ubuntu Linux. |
| 92 | |
| 93 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 94 | 3. If you are planning to use other modules, like visualizer, a number of additional dependencies should be installed. For example, in |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 95 | order to run `visualizer`_ module, the following should be installed: |
| 96 | |
| 97 | * For Ubuntu:: |
| 98 | |
| 99 | sudo apt-get install python-dev python-pygraphviz python-kiwi |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 100 | sudo apt-get install python-pygoocanvas python-gnome2 |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 101 | sudo apt-get install python-gnomedesktop python-rsvg ipython |
| 102 | |
| 103 | * For MacOS (macports):: |
| 104 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 105 | sudo port install py27-pygraphviz py27-goocanvas |
| 106 | |
| 107 | .. py27-kiwi |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 108 | |
| 109 | .. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz |
| 110 | |
| 111 | Downloading ndnSIM source |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 112 | ------------------------- |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 113 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 114 | Download a custom branch of NS-3 that contains all necessary patches and more:: |
Alexander Afanasyev | d4a5951 | 2012-06-22 10:14:55 -0700 | [diff] [blame] | 115 | |
| 116 | mkdir ndnSIM |
| 117 | cd ndnSIM |
| 118 | git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 |
| 119 | git clone git://github.com/cawka/pybindgen.git pybindgen |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 120 | |
| 121 | The first command is to create a directory, which will contain everything NS-3 related. The bare minimum is just base NS-3 (the first clone above). The second clone gets a module necessary to build python bindings, which are necessary for the visualizer module. |
| 122 | |
| 123 | Finally, clone actual ndnSIM code and place it in src/ folder:: |
| 124 | |
Alexander Afanasyev | d4a5951 | 2012-06-22 10:14:55 -0700 | [diff] [blame] | 125 | git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM |
| 126 | |
Alexander Afanasyev | d4a5951 | 2012-06-22 10:14:55 -0700 | [diff] [blame] | 127 | There 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. |
| 128 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 129 | Compiling and running ndnSIM |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 130 | ---------------------------- |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 131 | |
Alexander Afanasyev | 3cdda24 | 2012-09-04 16:26:46 -0700 | [diff] [blame] | 132 | ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be sufficient to configure and build ndnSIM with python bindings enabled:: |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 133 | |
| 134 | cd <ns-3-folder> |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 135 | ./waf configure --enable-examples --enable-ndn-plugins=topology,mobility |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 136 | ./waf |
| 137 | |
Alexander Afanasyev | 3cdda24 | 2012-09-04 16:26:46 -0700 | [diff] [blame] | 138 | On MacOS (with macports), you may need to modify the configure command to use macports version of python:: |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 139 | |
Alexander Afanasyev | 3cdda24 | 2012-09-04 16:26:46 -0700 | [diff] [blame] | 140 | cd <ns-3-folder> |
| 141 | ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples --enable-ndn-plugins=topology,mobility |
| 142 | ./waf |
| 143 | |
| 144 | Python 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'"):: |
| 145 | |
| 146 | cd <ns-3-folder> |
| 147 | ./waf configure --disable-python --enable-examples --enable-ndn-plugins=topology,mobility |
| 148 | ./waf |
| 149 | |
| 150 | For more configuration options, please refer to ``./waf --help``. |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 151 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 152 | To run :doc:`sample ndnSIM simulations <examples>`:: |
| 153 | |
Alexander Afanasyev | 3cdda24 | 2012-09-04 16:26:46 -0700 | [diff] [blame] | 154 | ./waf --run=ndn-simple |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 155 | |
| 156 | or:: |
| 157 | |
Alexander Afanasyev | 3cdda24 | 2012-09-04 16:26:46 -0700 | [diff] [blame] | 158 | ./waf --run=ndn-grid |
| 159 | |
| 160 | If you have compiled with python bindings, then you can try to run these simulations with visualizer:: |
| 161 | |
| 162 | ./waf --run=ndn-simple --vis |
| 163 | |
| 164 | or:: |
| 165 | |
| 166 | ./waf --run=ndn-grid --vis |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 167 | |
| 168 | .. note:: |
| 169 | Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d optimized``) in order to run actual simulations. |
| 170 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 171 | Additional compiling options |
| 172 | ++++++++++++++++++++++++++++ |
| 173 | |
| 174 | ndnSIM contains a number of NS-3 extensions that are not technically part of the ndnSIM. Right now there are two optional plugins---topology and mobility---which can be enabled using the following configuration option:: |
| 175 | |
| 176 | ./waf configure --enable-ndn-plugins=topology,mobility |
| 177 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 178 | |
| 179 | Documentation |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 180 | ============= |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 181 | |
Alexander Afanasyev | 5b147e8 | 2012-06-22 10:39:46 -0700 | [diff] [blame] | 182 | Overall structure of ndnSIM is described in our `technical report <http://lasr.cs.ucla.edu/afanasyev/data/files/Afanasyev/ndnSIM-TR.pdf>`_. |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 183 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 184 | `ndnSIM API documentation <doxygen/index.html>`_ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 185 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 186 | .. It is also possible to build doxygen documentation of ndnSIM API (in ``ns-3/doc/html/``), provided that ``doxygen`` and ``graphviz`` modules are installed on system:: |
| 187 | |
| 188 | .. ./waf doxygen |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 189 | |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 190 | Support |
| 191 | ======= |
| 192 | |
| 193 | The code of ndnSIM is in active development. Bug reports (issues) as well as new feature implementation are always welcome. |
| 194 | |
| 195 | To file a bug report, please use `GitHub Issues <https://github.com/NDN-Routing/ndnSIM/issues>`_. |
| 196 | |
| 197 | To create new feature, please fork the code and submit Pull Request on GitHub. |
| 198 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 199 | |
| 200 | A very short guide to the code |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 201 | ------------------------------ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 202 | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 203 | All the NDN related code is in ``ns-3/src/ndnSIM`` |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 204 | |
| 205 | +-----------------+---------------------------------------------------------------------+ |
| 206 | | Folder | Description | |
| 207 | +=================+=====================================================================+ |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 208 | | ``model/`` | implementation of NDN base: :ndnsim:`L3Protocol`, faces | |
| 209 | | | (:ndnsim:`Face`, :ndnsim:`NetDeviceFace`, forwarding | |
| 210 | | | :ndnsim:`AppFace`), | |
| 211 | | | strategies (:ndnsim:`ForwardingStrategy`, | |
Alexander Afanasyev | b8d14ad | 2012-08-09 13:19:37 -0700 | [diff] [blame] | 212 | | | :ndnsim:`Flooding`, :ndnsim:`SmartFlooding`, :ndnsim:`BestRoute`), | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 213 | | | etc. | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 214 | +-----------------+---------------------------------------------------------------------+ |
| 215 | | ``apps/`` | applications (in NS-3 sense) that can be installed on the nodes. | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 216 | | | Right now we have one producer (:ndnsim:`Producer`) and a | |
| 217 | | | collection of consumer (:ndnsim:`ConsumerCbr`, | |
| 218 | | | :ndnsim:`ConsumerWindow`, | |
| 219 | | | :ndnsim:`ConsumerBatches`). See doxygen documentation or | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 220 | | | source code for details | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 221 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 222 | | ``helper/`` | a number of :doc:`useful helpers <helpers>` | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 223 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 224 | | ``examples/`` | contain :doc:`several example scenarios <examples>` | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 225 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 508269a | 2012-07-28 13:59:54 -0700 | [diff] [blame] | 226 | | ``utils/`` | helper classes, including implementation of generalized data | |
| 227 | | | structures | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 228 | +-----------------+---------------------------------------------------------------------+ |
| 229 | | ``plugins/`` | a number of plugins that may be helpful to run simulation scenarios | |
| 230 | +-----------------+---------------------------------------------------------------------+ |
| 231 | |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 232 | Logging |
| 233 | ----------------- |
| 234 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 235 | Almost every component in ndnSIM exports logging interface, so it is possible in debug compilation of simulator to track many details. For example, by enabling logging of :ndnsim:`Face` and :ndnsim:`Consumer` will show everything what happens on :ndnsim:`Face` and :ndnsim:`Consumer` classes:: |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 236 | |
Alexander Afanasyev | f6807a5 | 2012-08-10 18:11:43 -0700 | [diff] [blame] | 237 | NS_LOG=ndn.Face:ndn.Consumer ./waf --run=ndn-simple |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 238 | |
| 239 | Refer to the source code and NS-3 documentation to see what logging interfaces are available and about details how enable one or more logging interfaces. |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 240 | |
| 241 | .. Indices and tables |
| 242 | .. ================== |
| 243 | |
| 244 | .. * :ref:`genindex` |
| 245 | .. * :ref:`modindex` |
| 246 | .. * :ref:`search` |
| 247 | |