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 |
| 8 | ============== |
| 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 | 4a4ea60 | 2012-06-06 11:12:45 -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) <CcnxPit>`, :ndnsim:`forwarding information base (FIB) <CcnxFib>`, :ndnsim:`content store <CcnxContentStore>`, :ndnsim:`network <CcnxNetDeviceFace>` and :ndnsim:`application <CcnxAppFace>` interfaces, :ndnsim:`Interest forwarding strategies <CcnxForwardingStrategy>`, 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 | . +------------------+ +----------------------+ . |
| 36 | . | "CcnxFace" | | "CcnxFace" | . |
Alexander Afanasyev | 4a4ea60 | 2012-06-06 11:12:45 -0700 | [diff] [blame] | 37 | . | "(CcnxAppFace)" | | "(CcnxNetDeviceFace)"| . |
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 . |
| 45 | . XX "(CcnxL3Protocol)" XX |
| 46 | . XX XX . |
| 47 | . XXXXXXXXXXXXXXXXXXXXXXXXXXXXX . |
| 48 | . ^ ^ ^ ^ . |
| 49 | . | | | | . |
| 50 | . +-------------------+ +---+ +---+ +------------+ . |
| 51 | . | | | | . |
| 52 | . v v v v . |
| 53 | . +-------------------+ +-------+ +-------+ +-------------+ . |
| 54 | . | "CcnxContentStore"| | PIT | | FIB | | "Pluggable" | . |
| 55 | . +-------------------+ +-------+ +-------+ | "Forwarding"| . |
| 56 | . | "Strategy" | . |
| 57 | . +-------------+ . |
| 58 | . . |
| 59 | ............................................................................... |
| 60 | |
| 61 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 62 | 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. |
| 63 | |
| 64 | .. _CCNx Project's NDN implementation: http://www.ccnx.org/ |
| 65 | |
| 66 | Getting Started |
| 67 | =============== |
| 68 | |
| 69 | Portability |
| 70 | ------------ |
| 71 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 72 | ndnSIM has been successfully compiled and used under Ubuntu Linux 11.04 (stock gcc), Mac OS 10.6/10.7 (gcc-4.2 apple/llvm, macports gcc 4.6), FreeBSD 8.2 (requires gcc from ports - the stock gcc will not work!). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 73 | |
| 74 | Requirements |
| 75 | ------------- |
| 76 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 77 | 1. ndnSIM requires the latest version of NS-3 simulator (as of May 31st, 2012, development branch of NS-3). |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 78 | |
| 79 | 2. ndnSIM requires boost libraries: |
| 80 | |
| 81 | * For Ubuntu:: |
| 82 | |
| 83 | sudo aptitude install libboost-all-dev |
| 84 | |
| 85 | * For MacOS (macports):: |
| 86 | |
| 87 | sudo port instal boost |
| 88 | |
| 89 | 3. Other NS-3 modules have additional dependencies. For example, in |
| 90 | order to run `visualizer`_ module, the following should be installed: |
| 91 | |
| 92 | * For Ubuntu:: |
| 93 | |
| 94 | sudo apt-get install python-dev python-pygraphviz python-kiwi |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 95 | sudo apt-get install python-pygoocanvas python-gnome2 |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 96 | sudo apt-get install python-gnomedesktop python-rsvg ipython |
| 97 | |
| 98 | * For MacOS (macports):: |
| 99 | |
| 100 | sudo port install py27-pygraphviz py27-kiwi py27-goocanvas |
| 101 | |
| 102 | .. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz |
| 103 | |
| 104 | Downloading ndnSIM source |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 105 | ------------------------- |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 106 | |
| 107 | Only ndnSIM |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 108 | +++++++++++ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 109 | |
| 110 | Download NS-3 simulator. For example:: |
| 111 | |
| 112 | hg clone http://code.nsnam.org/ns-3-allinone/ ns-3-all |
| 113 | cd ns-3-all |
| 114 | ./download.py |
| 115 | |
| 116 | ndnSIM source code should be placed in ``src/ndnSIM`` folder under NS-3 simulator source tree. For example:: |
| 117 | |
| 118 | cd ns-3-dev |
Alexander Afanasyev | 98c9dbb | 2012-06-05 11:56:42 -0700 | [diff] [blame] | 119 | git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 120 | |
| 121 | After cloning, a number of patches need to be applied to the base NS-3 to make sure ndnSIM compiles and works:: |
| 122 | |
| 123 | find src/ndnSIM/patches/ -type f -print 0 | xargs -0 patch -p1 |
| 124 | |
| 125 | |
| 126 | Custom (unsupported) branch of NS-3 |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 127 | +++++++++++++++++++++++++++++++++++ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 128 | |
| 129 | Alternatively, it is possible to download a custom (unsupported) branch of NS-3 that contains all necessary patches and more:: |
| 130 | |
| 131 | mkdir ndnSIM |
| 132 | cd ndnSIM |
Alexander Afanasyev | 98c9dbb | 2012-06-05 11:56:42 -0700 | [diff] [blame] | 133 | git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 |
| 134 | git clone git://github.com/cawka/pybindgen.git pybindgen |
| 135 | git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 136 | |
| 137 | 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. The third clone gets actual ndnSIM code and places it in src/ directory. |
| 138 | |
| 139 | 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. |
| 140 | |
| 141 | Compiling and running ndnSIM |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 142 | ---------------------------- |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 143 | |
| 144 | ndnSIM uses standard NS-3 compilation procedure. For example:: |
| 145 | |
| 146 | cd <ns-3-folder> |
| 147 | ./waf configure --enable-examples |
| 148 | ./waf |
| 149 | |
| 150 | To run :doc:`sample ndnSIM simulations <examples>`:: |
| 151 | |
| 152 | ./waf --run=ccnx-simple |
| 153 | |
| 154 | or:: |
| 155 | |
| 156 | ./waf --run=ccnx-grid |
| 157 | |
| 158 | .. note:: |
| 159 | Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d optimized``) in order to run actual simulations. |
| 160 | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 161 | |
| 162 | Documentation |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 163 | ============= |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 164 | |
| 165 | Overall structure of ndnSIM is described in our technical report. |
| 166 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 167 | `ndnSIM API documentation <doxygen/index.html>`_ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 168 | |
Alexander Afanasyev | 97fb44d | 2012-06-04 18:50:47 -0700 | [diff] [blame] | 169 | .. 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:: |
| 170 | |
| 171 | .. ./waf doxygen |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 172 | |
| 173 | |
| 174 | A very short guide to the code |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 175 | ------------------------------ |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 176 | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 177 | All the NDN related code is in ``ns-3/src/ndnSIM`` |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 178 | |
| 179 | +-----------------+---------------------------------------------------------------------+ |
| 180 | | Folder | Description | |
| 181 | +=================+=====================================================================+ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 182 | | ``model/`` | implementation of NDN base: :ndnsim:`CcnxL3Protocol`, faces | |
| 183 | | | (:ndnsim:`CcnxFace`, :ndnsim:`CcnxNetDeviceFace`, forwarding | |
Alexander Afanasyev | 4a4ea60 | 2012-06-06 11:12:45 -0700 | [diff] [blame] | 184 | | | :ndnsim:`CcnxAppFace`), | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 185 | | | strategies (:ndnsim:`CcnxForwardingStrategy`, | |
| 186 | | | :ndnsim:`CcnxFloodingStrategy`, :ndnsim:`CcnxBestRouteStrategy`), | |
| 187 | | | etc. | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 188 | +-----------------+---------------------------------------------------------------------+ |
| 189 | | ``apps/`` | applications (in NS-3 sense) that can be installed on the nodes. | |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 190 | | | Right now we have one producer (:ndnsim:`CcnxProducer`) and a | |
| 191 | | | collection of consumer (:ndnsim:`CcnxConsumerCbr`, | |
| 192 | | | :ndnsim:`CcnxConsumerWindow`, | |
| 193 | | | :ndnsim:`CcnxConsumerBatches`). See doxygen documentation or | |
| 194 | | | source code for details | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 195 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 196 | | ``helper/`` | a number of :doc:`useful helpers <helpers>` | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 197 | +-----------------+---------------------------------------------------------------------+ |
Alexander Afanasyev | 6315ef7 | 2012-06-01 20:56:31 -0700 | [diff] [blame] | 198 | | ``examples/`` | contain :doc:`several example scenarios <examples>` | |
Alexander Afanasyev | 4d32516 | 2012-06-01 12:28:50 -0700 | [diff] [blame] | 199 | +-----------------+---------------------------------------------------------------------+ |
| 200 | | ``utils/`` | helper classes | |
| 201 | +-----------------+---------------------------------------------------------------------+ |
| 202 | | ``plugins/`` | a number of plugins that may be helpful to run simulation scenarios | |
| 203 | +-----------------+---------------------------------------------------------------------+ |
| 204 | |
Alexander Afanasyev | d4e97b3 | 2012-06-04 15:09:50 -0700 | [diff] [blame] | 205 | Logging |
| 206 | ----------------- |
| 207 | |
| 208 | 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:`CcnxFace` and :ndnsim:`CcnxConsumer` will show everything what happens on :ndnsim:`CcnxFace` and :ndnsim:`CcnxConsumer` classes:: |
| 209 | |
| 210 | NS_LOG=CcnxFace:CcnxConsumer ./waf --run=ccnx-simple |
| 211 | |
| 212 | 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] | 213 | |
| 214 | .. Indices and tables |
| 215 | .. ================== |
| 216 | |
| 217 | .. * :ref:`genindex` |
| 218 | .. * :ref:`modindex` |
| 219 | .. * :ref:`search` |
| 220 | |