Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 1 | Getting Started |
| 2 | =============== |
| 3 | |
| 4 | Portability |
| 5 | ------------ |
| 6 | |
| 7 | 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-1.52). |
| 8 | |
| 9 | .. _requirements: |
| 10 | |
| 11 | Requirements |
| 12 | ------------- |
| 13 | |
| 14 | 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). |
| 15 | |
| 16 | 2. Boost libraries should be installed on the system: |
| 17 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 18 | * For Ubuntu (for Ubuntu 12.10 and later only): |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 19 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 20 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 21 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 22 | sudo aptitude install libboost-all-dev |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 23 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 24 | * For Fedora (for Fedora 18 and later only): |
| 25 | |
| 26 | .. code-block:: bash |
| 27 | |
| 28 | sudo yum install boost-devel |
| 29 | |
| 30 | * For MacOS (macports): |
| 31 | |
| 32 | .. code-block:: bash |
| 33 | |
| 34 | sudo port instal boost |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 35 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 36 | .. role:: red |
| 37 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 38 | .. note:: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 39 | :red:`!!! ndnSIM requires boost version at least 1.48.` Many linux distribution (including Ubuntu 12.04.1 and Fedore 16, 17 at the time of this writing) ship an old version of boost, making it impossible to compile ndnSIM out-of-the-box. Please install the latest version, following :ref:`these simple instructions <Installing boost libraries>`. |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 40 | |
| 41 | .. note:: |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 42 | !!! 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 :ref:`the following example <Installing boost libraries>` for the hints how to successfully compile and install boost libraries on Ubuntu Linux. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 43 | |
| 44 | |
| 45 | 3. If you are planning to use other modules, like visualizer, a number of additional dependencies should be installed. For example, in |
| 46 | order to run `visualizer`_ module, the following should be installed: |
| 47 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 48 | * For Ubuntu (tested on Ubuntu 12.04.1): |
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 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 51 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 52 | sudo apt-get install python-dev python-pygraphviz python-kiwi |
| 53 | sudo apt-get install python-pygoocanvas python-gnome2 |
| 54 | sudo apt-get install python-gnomedesktop python-rsvg ipython |
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 | * For Fedora (tested on Fedora 16): |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 57 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 58 | .. code-block:: bash |
| 59 | |
| 60 | sudo yum install pygoocanvas python-kiwi graphviz-python |
| 61 | |
| 62 | # easy_install method, since pygraphviz is not yet packaged into Fedora (https://bugzilla.redhat.com/show_bug.cgi?id=740687) |
| 63 | sudo yum install graphviz-devel |
| 64 | sudo yum install python-pip |
| 65 | sudo easy_install pygraphviz |
| 66 | |
| 67 | * For MacOS (macports): |
| 68 | |
| 69 | .. code-block:: bash |
| 70 | |
| 71 | sudo port install py27-pygraphviz py27-goocanvas |
| 72 | |
| 73 | .. py27-kiwi |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 74 | |
| 75 | .. _visualizer: http://www.nsnam.org/wiki/index.php/PyViz |
| 76 | |
| 77 | Downloading ndnSIM source |
| 78 | ------------------------- |
| 79 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 80 | Download a custom branch of NS-3 that contains all necessary patches and more: |
| 81 | |
| 82 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 83 | |
| 84 | mkdir ndnSIM |
| 85 | cd ndnSIM |
| 86 | git clone git://github.com/cawka/ns-3-dev-ndnSIM.git ns-3 |
| 87 | git clone git://github.com/cawka/pybindgen.git pybindgen |
| 88 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 89 | 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. |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 90 | |
| 91 | Finally, clone actual ndnSIM code and place it in src/ folder:: |
| 92 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 93 | .. code-block:: bash |
| 94 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 95 | git clone git://github.com/NDN-Routing/ndnSIM.git ns-3/src/ndnSIM |
| 96 | |
| 97 | 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. |
| 98 | |
| 99 | Compiling and running ndnSIM |
| 100 | ---------------------------- |
| 101 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 102 | ndnSIM uses standard NS-3 compilation procedure. Normally the following commands should be sufficient to configure and build ndnSIM with python bindings enabled: |
| 103 | |
| 104 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 105 | |
| 106 | cd <ns-3-folder> |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 107 | ./waf configure --enable-examples |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 108 | ./waf |
| 109 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 110 | On MacOS (with macports), you may need to modify the configure command to use macports version of python: |
| 111 | |
| 112 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 113 | |
| 114 | cd <ns-3-folder> |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 115 | ./waf configure --with-python=/opt/local/bin/python2.7 --enable-examples |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 116 | ./waf |
| 117 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 118 | 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'"): |
| 119 | |
| 120 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 121 | |
| 122 | cd <ns-3-folder> |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 123 | ./waf configure --disable-python --enable-examples |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 124 | ./waf |
| 125 | |
| 126 | For more configuration options, please refer to ``./waf --help``. |
| 127 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 128 | To run :doc:`sample ndnSIM simulations <examples>`: |
| 129 | |
| 130 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 131 | |
| 132 | ./waf --run=ndn-simple |
| 133 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 134 | or: |
| 135 | |
| 136 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 137 | |
| 138 | ./waf --run=ndn-grid |
| 139 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 140 | If you have compiled with python bindings, then you can try to run these simulations with visualizer: |
| 141 | |
| 142 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 143 | |
| 144 | ./waf --run=ndn-simple --vis |
| 145 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 146 | or: |
| 147 | |
| 148 | .. code-block:: bash |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 149 | |
| 150 | ./waf --run=ndn-grid --vis |
| 151 | |
| 152 | .. note:: |
| 153 | Do not forget to configure and compile NS-3 in optimized mode (``./waf configure -d optimized``) in order to run actual simulations. |
| 154 | |
Alexander Afanasyev | e095f0f | 2012-11-21 17:43:32 -0800 | [diff] [blame] | 155 | |