blob: 6c60c99c9b94e177f7c2e0aa2320d24456a2cbd6 [file] [log] [blame]
Alexander Afanasyev4d325162012-06-01 12:28:50 -07001.. ndnSIM: NS-3 based NDN simulator
2.. ============================================================
3
4.. .. toctree::
5.. :maxdepth: 2
6
7Introduction
8==============
9
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070010The 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 Afanasyev4d325162012-06-01 12:28:50 -070011
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070012Following 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 Afanasyev4d325162012-06-01 12:28:50 -070013
14.. note::
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070015 It will also be possible to run ndnSIM on top of network-layer (IPv4, IPv6) and transport-layer (TCP, UDP) protocols.
Alexander Afanasyev4d325162012-06-01 12:28:50 -070016 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 Afanasyevf6807a52012-08-10 18:11:43 -070020The 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 Afanasyev4d325162012-06-01 12:28:50 -070021This modular structure allows any component to be easily modified or replaced with no or minimal impact on other components.
22In 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 Afanasyev97fb44d2012-06-04 18:50:47 -070024
25.. aafig::
26 :aspect: 60
27 :scale: 120
28
29 +----------------+ +-----------+
30 | "Applications" | | NetDevice |
31 +----------------+ +-----------+
32 ^ ^
33 .................|......................................|......................
34 . v v .
35 . +------------------+ +----------------------+ .
Alexander Afanasyevf6807a52012-08-10 18:11:43 -070036 . | "Face" | | "Face" | .
37 . | "(AppFace)" | | "(NetDeviceFace)" | .
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070038 . +------------------+ +----------------------+ .
39 . ^ ^ .
40 . | | .
41 . v v .
42 . XXXXXXXXXXXXXXXXXXXXXXXXXXXXX .
43 . XX XX .
44 . XX Core NDN protocol XX .
Alexander Afanasyevf6807a52012-08-10 18:11:43 -070045 . XX "(L3Protocol)" XX
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070046 . XX XX .
47 . XXXXXXXXXXXXXXXXXXXXXXXXXXXXX .
48 . ^ ^ ^ ^ .
49 . | | | | .
50 . +-------------------+ +---+ +---+ +------------+ .
51 . | | | | .
52 . v v v v .
53 . +-------------------+ +-------+ +-------+ +-------------+ .
Alexander Afanasyevf6807a52012-08-10 18:11:43 -070054 . | "ContentStore" | | PIT | | FIB | | "Forwarding"| .
55 . +-------------------+ +-------+ +-------+ | "Strategy" | .
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070056 . +-------------+ .
57 . .
58 ...............................................................................
59
60
Alexander Afanasyev4d325162012-06-01 12:28:50 -070061The 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
65Getting Started
66===============
67
68Portability
69------------
70
Alexander Afanasyevf6807a52012-08-10 18:11:43 -070071ndnSIM 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 Afanasyev4d325162012-06-01 12:28:50 -070072
73Requirements
74-------------
75
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700761. 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 Afanasyev4d325162012-06-01 12:28:50 -070077
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700782. Boost libraries should be installed on the system:
Alexander Afanasyev4d325162012-06-01 12:28:50 -070079
80 * For Ubuntu::
81
82 sudo aptitude install libboost-all-dev
83
84 * For MacOS (macports)::
85
86 sudo port instal boost
87
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700883. If you are planning to use other modules, like visualizer, a number of additional dependencies should be installed. For example, in
Alexander Afanasyev4d325162012-06-01 12:28:50 -070089order to run `visualizer`_ module, the following should be installed:
90
91 * For Ubuntu::
92
93 sudo apt-get install python-dev python-pygraphviz python-kiwi
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -070094 sudo apt-get install python-pygoocanvas python-gnome2
Alexander Afanasyev4d325162012-06-01 12:28:50 -070095 sudo apt-get install python-gnomedesktop python-rsvg ipython
96
97 * For MacOS (macports)::
98
Alexander Afanasyev508269a2012-07-28 13:59:54 -070099 sudo port install py27-pygraphviz py27-goocanvas
100
101.. py27-kiwi
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700102
103.. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz
104
105Downloading ndnSIM source
Alexander Afanasyevd4e97b32012-06-04 15:09:50 -0700106-------------------------
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700107
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700108Download a custom branch of NS-3 that contains all necessary patches and more::
Alexander Afanasyevd4a59512012-06-22 10:14:55 -0700109
110 mkdir ndnSIM
111 cd ndnSIM
112 git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3
113 git clone git://github.com/cawka/pybindgen.git pybindgen
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700114
115The 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.
116
117Finally, clone actual ndnSIM code and place it in src/ folder::
118
Alexander Afanasyevd4a59512012-06-22 10:14:55 -0700119 git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM
120
Alexander Afanasyevd4a59512012-06-22 10:14:55 -0700121There 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.
122
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700123Compiling and running ndnSIM
Alexander Afanasyevd4e97b32012-06-04 15:09:50 -0700124----------------------------
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700125
126ndnSIM uses standard NS-3 compilation procedure. For example::
127
128 cd <ns-3-folder>
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700129 ./waf configure --enable-examples --enable-ndn-plugins=topology,mobility
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700130 ./waf
131
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700132
133
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700134To run :doc:`sample ndnSIM simulations <examples>`::
135
136 ./waf --run=ccnx-simple
137
138or::
139
140 ./waf --run=ccnx-grid
141
142.. note::
143 Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d optimized``) in order to run actual simulations.
144
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700145Additional compiling options
146++++++++++++++++++++++++++++
147
148ndnSIM 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::
149
150 ./waf configure --enable-ndn-plugins=topology,mobility
151
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700152
153Documentation
Alexander Afanasyevd4e97b32012-06-04 15:09:50 -0700154=============
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700155
Alexander Afanasyev5b147e82012-06-22 10:39:46 -0700156Overall structure of ndnSIM is described in our `technical report <http://lasr.cs.ucla.edu/afanasyev/data/files/Afanasyev/ndnSIM-TR.pdf>`_.
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700157
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -0700158`ndnSIM API documentation <doxygen/index.html>`_
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700159
Alexander Afanasyev97fb44d2012-06-04 18:50:47 -0700160.. 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::
161
162.. ./waf doxygen
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700163
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700164Support
165=======
166
167The code of ndnSIM is in active development. Bug reports (issues) as well as new feature implementation are always welcome.
168
169To file a bug report, please use `GitHub Issues <https://github.com/NDN-Routing/ndnSIM/issues>`_.
170
171To create new feature, please fork the code and submit Pull Request on GitHub.
172
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700173
174A very short guide to the code
Alexander Afanasyevd4e97b32012-06-04 15:09:50 -0700175------------------------------
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700176
Alexander Afanasyev6315ef72012-06-01 20:56:31 -0700177All the NDN related code is in ``ns-3/src/ndnSIM``
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700178
179+-----------------+---------------------------------------------------------------------+
180| Folder | Description |
181+=================+=====================================================================+
Alexander Afanasyevf6807a52012-08-10 18:11:43 -0700182| ``model/`` | implementation of NDN base: :ndnsim:`L3Protocol`, faces |
183| | (:ndnsim:`Face`, :ndnsim:`NetDeviceFace`, forwarding |
184| | :ndnsim:`AppFace`), |
185| | strategies (:ndnsim:`ForwardingStrategy`, |
Alexander Afanasyevb8d14ad2012-08-09 13:19:37 -0700186| | :ndnsim:`Flooding`, :ndnsim:`SmartFlooding`, :ndnsim:`BestRoute`), |
Alexander Afanasyev6315ef72012-06-01 20:56:31 -0700187| | etc. |
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700188+-----------------+---------------------------------------------------------------------+
189| ``apps/`` | applications (in NS-3 sense) that can be installed on the nodes. |
Alexander Afanasyevf6807a52012-08-10 18:11:43 -0700190| | Right now we have one producer (:ndnsim:`Producer`) and a |
191| | collection of consumer (:ndnsim:`ConsumerCbr`, |
192| | :ndnsim:`ConsumerWindow`, |
193| | :ndnsim:`ConsumerBatches`). See doxygen documentation or |
Alexander Afanasyev6315ef72012-06-01 20:56:31 -0700194| | source code for details |
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700195+-----------------+---------------------------------------------------------------------+
Alexander Afanasyev6315ef72012-06-01 20:56:31 -0700196| ``helper/`` | a number of :doc:`useful helpers <helpers>` |
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700197+-----------------+---------------------------------------------------------------------+
Alexander Afanasyev6315ef72012-06-01 20:56:31 -0700198| ``examples/`` | contain :doc:`several example scenarios <examples>` |
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700199+-----------------+---------------------------------------------------------------------+
Alexander Afanasyev508269a2012-07-28 13:59:54 -0700200| ``utils/`` | helper classes, including implementation of generalized data |
201| | structures |
Alexander Afanasyev4d325162012-06-01 12:28:50 -0700202+-----------------+---------------------------------------------------------------------+
203| ``plugins/`` | a number of plugins that may be helpful to run simulation scenarios |
204+-----------------+---------------------------------------------------------------------+
205
Alexander Afanasyevd4e97b32012-06-04 15:09:50 -0700206Logging
207-----------------
208
Alexander Afanasyevf6807a52012-08-10 18:11:43 -0700209Almost 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 Afanasyevd4e97b32012-06-04 15:09:50 -0700210
Alexander Afanasyevf6807a52012-08-10 18:11:43 -0700211 NS_LOG=ndn.Face:ndn.Consumer ./waf --run=ndn-simple
Alexander Afanasyevd4e97b32012-06-04 15:09:50 -0700212
213Refer 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 Afanasyev4d325162012-06-01 12:28:50 -0700214
215.. Indices and tables
216.. ==================
217
218.. * :ref:`genindex`
219.. * :ref:`modindex`
220.. * :ref:`search`
221