Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 1 | Experiment |
| 2 | ========== |
| 3 | |
| 4 | Configuration |
| 5 | ------------- |
| 6 | |
| 7 | Mini-NDN uses a configuration file describing the topology and its parameters to setup a network. |
| 8 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 9 | **The [nodes] section** |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 10 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 11 | At the bare minimum, the ``nodes`` section describes the nodes present in the |
| 12 | topology, e.g.: |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 13 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 14 | .. code-block:: cfg |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 15 | |
| 16 | [nodes] |
| 17 | a: key1=value1 key2=value2 |
| 18 | b: key1=value1 |
| 19 | |
| 20 | Any key and value passed here is accessible in Mini-NDN as: |
| 21 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 22 | .. code-block:: python |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 23 | |
| 24 | ndn = Minindn(...) |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 25 | value = ndn.net.hosts[0].params['params'].get('key1', 'defaultValue') |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 26 | |
| 27 | One can specify log levels for each node's NFD and NLSR using this key-value system: |
| 28 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 29 | .. code-block:: cfg |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 30 | |
| 31 | [nodes] |
| 32 | a: nfd-log-level=DEBUG nlsr-log-level=DEBUG |
| 33 | b: nfd-log-level=INFO |
| 34 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 35 | To specify a log level for certain modules of NFD, the following line can be added to ``nfd.py``: |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 36 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 37 | .. code-block:: python |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 38 | |
| 39 | node.cmd('infoedit -f {} -s log.Forwarder -v {}'.format(self.confFile, 'INFO')) |
| 40 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 41 | This will turn on Forwarder logging to INFO for all nodes. |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 42 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 43 | .. todo:: |
| 44 | Document [switches] section |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 45 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 46 | **The [links] section** |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 47 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 48 | The ``links`` section describes the links in the topology, e.g.: |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 49 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 50 | .. code-block:: cfg |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 51 | |
| 52 | [links] |
| 53 | a:b delay=10ms |
| 54 | |
| 55 | This would create a link between a and b. 'b:a' would also result in the |
| 56 | same. The following parameters can be configured for a node: |
| 57 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 58 | - ``delay`` : Delay parameter is a required parameter which defines the |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 59 | delay of the link (1-1000ms) |
| 60 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 61 | - ``bw`` : Bandwidth of a link (<1-1000> Mbps) |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 62 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 63 | - ``loss`` : Percentage of packet loss (<1-100>) |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 64 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 65 | Example configuration file: |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 66 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 67 | .. code-block:: cfg |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 68 | |
| 69 | [nodes] |
| 70 | a: |
| 71 | b: |
| 72 | [links] |
| 73 | a:b delay=10ms bw=100 |
| 74 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 75 | See the ``topologies`` folder for more sample files. |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 76 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 77 | Example |
| 78 | ------- |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 79 | |
| 80 | Sample experiment may written as follows: |
| 81 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 82 | .. code-block:: python |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 83 | |
| 84 | from mininet.log import setLogLevel, info |
| 85 | |
| 86 | from minindn.minindn import Minindn |
| 87 | from minindn.util import MiniNDNCLI |
| 88 | from minindn.apps.appmanager import AppManager |
| 89 | from minindn.apps.nfd import Nfd |
| 90 | from minindn.apps.nlsr import Nlsr |
| 91 | from minindn.helpers.routing_helper import IPRoutingHelper |
| 92 | |
| 93 | if __name__ == '__main__': |
| 94 | setLogLevel('info') |
| 95 | |
| 96 | Minindn.cleanUp() |
| 97 | Minindn.verifyDependencies() |
| 98 | |
| 99 | # Can pass a custom parser, custom topology, or any Mininet params here |
| 100 | ndn = Minindn() |
| 101 | |
| 102 | ndn.start() |
| 103 | |
| 104 | # IP reachability if needed |
| 105 | # IPRoutingHelper.calcAllRoutes(ndn.net) |
| 106 | # info("IP routes configured, start ping\n") |
| 107 | # ndn.net.pingAll() |
| 108 | |
| 109 | # Start apps with AppManager which registers a clean up function with ndn |
| 110 | info('Starting NFD on nodes\n') |
| 111 | nfds = AppManager(ndn, ndn.net.hosts, Nfd) |
| 112 | info('Starting NLSR on nodes\n') |
| 113 | nlsrs = AppManager(ndn, ndn.net.hosts, Nlsr) |
| 114 | |
| 115 | # or can not start NLSRs with some delay in between: |
| 116 | # nlsrs = AppManager(ndn, ndn.net.hosts, Nlsr) |
| 117 | # for host in ndn.net.hosts: |
| 118 | # nlsrs.startOnNode(host) |
| 119 | # time.sleep(30) |
| 120 | |
| 121 | MiniNDNCLI(ndn.net) |
| 122 | |
| 123 | # Calls the clean up functions registered via AppManager |
| 124 | ndn.stop() |
| 125 | |
| 126 | Users may look at how the NFD and NLSR applications are written as a sub class of Application |
| 127 | in the ``minindn/apps`` folder. Or users may choose to directly run their application on nodes |
| 128 | such as ndnpingserver is run in ``minindn/helpers/experiment.py``. |
| 129 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 130 | **Note:** A certain log level can be configured for all the NFD or NLSR nodes at once by passing it as an argument during startup, e.g.: |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 131 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 132 | .. code-block:: python |
| 133 | |
| 134 | nfds = AppManager(self.ndn, self.ndn.net.hosts, Nfd, logLevel='DEBUG') |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 135 | |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 136 | Execution |
| 137 | --------- |
| 138 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 139 | To run Mini-NDN with the default topology, ``topologies/default-topology.conf``, type: |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 140 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 141 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 142 | |
| 143 | sudo python examples/minindn.py |
| 144 | |
| 145 | To run Mini-NDN with a topology file, provide the filename as the first |
| 146 | argument: |
| 147 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 148 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 149 | |
| 150 | sudo python examples/minindn.py my-topology.conf |
| 151 | |
| 152 | After Mini-NDN is installed, users can run examples from anywhere with python directly as follows: |
| 153 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 154 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 155 | |
| 156 | sudo python /path/to/myexample.py |
| 157 | |
| 158 | The user no longer needs to create an experiment in the old Mini-NDN way, then install it to the system before executing it via the minindn binary. The new examples can be separate from the Mini-NDN folder if the core is not being modified. |
| 159 | |
| 160 | CLI Interface |
| 161 | _____________ |
| 162 | |
| 163 | During set up, the list of nodes in the network will be listed as they |
| 164 | are initialized: |
| 165 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 166 | .. code-block:: none |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 167 | |
| 168 | *** Adding hosts: |
| 169 | a b c d |
| 170 | |
| 171 | After set up, the command-line interface (CLI) will display a prompt. |
| 172 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 173 | .. code-block:: none |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 174 | |
| 175 | mini-ndn> |
| 176 | |
| 177 | To interact with a node, first type the node's name and then the command |
| 178 | to be executed: |
| 179 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 180 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 181 | |
| 182 | mini-ndn> a echo "Hello, world!" |
| 183 | Hello, world! |
| 184 | |
| 185 | To see the status of the forwarder on the node: |
| 186 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 187 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 188 | |
| 189 | mini-ndn> a nfdc status report |
| 190 | |
| 191 | To see the status of routing on the node: |
| 192 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 193 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 194 | |
| 195 | mini-ndn> a nlsrc status |
| 196 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 197 | To exit Mini-NDN, type ``quit`` in the CLI or use :kbd:`Ctrl-d`: |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 198 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 199 | .. code-block:: sh |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 200 | |
| 201 | mini-ndn> quit |
| 202 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 203 | :kbd:`Ctrl-c` is used to quit an application run in the foreground of the command line. |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 204 | |
| 205 | For a more in depth explanation of the CLI, please see the `Mininet |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 206 | Walkthrough <https://mininet.org/walkthrough/>`__. |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 207 | |
| 208 | To run NDN commands from the outside the command line user can also open a new terminal |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 209 | and export the HOME folder of a node: |
| 210 | |
| 211 | .. code-block:: sh |
| 212 | |
| 213 | export HOME=/tmp/minindn/a && cd ~ |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 214 | |
| 215 | Working Directory Structure |
| 216 | --------------------------- |
| 217 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 218 | Currently Mini-NDN uses ``/tmp/minindn`` as the working directory if not |
| 219 | specified otherwise by using the option ``--work-dir``. |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 220 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 221 | Each node is given a HOME directory under ``/tmp/minindn/<node-name>`` where |
| 222 | ``<node-name>`` is the name of the node specified in the ``[nodes]`` section of |
Ashlesh Gawande | 6c86e30 | 2019-09-17 22:27:05 -0500 | [diff] [blame] | 223 | the conf file. |
| 224 | |
| 225 | NFD |
| 226 | ___ |
| 227 | |
| 228 | - NFD conf file is stored at ``/tmp/minindn/<node-name>/nfd.conf`` |
| 229 | |
| 230 | - NFD log file is stored at ``/tmp/minindn/<node-name>/log/nfd.log`` |
| 231 | |
| 232 | - ``.ndn`` folder is stored at ``/tmp/minindn/<node-name>/.ndn`` |
| 233 | |
| 234 | NLSR |
| 235 | ____ |
| 236 | |
| 237 | - NLSR conf file is stored at ``/tmp/minindn/<node-name>/nlsr.conf`` |
| 238 | - NLSR log file is stored at ``/tmp/minindn/<node-name>/log/nlsr.log`` |
| 239 | |
| 240 | When security is enabled, NLSR security certificates are stored in: |
| 241 | ``/tmp/minindn/<node-name>/security`` Note that no NLSR publishes the root |
| 242 | certificate, Mini-NDN installs root.cert in security folder for each |
| 243 | NLSR. |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 244 | |
awlane | d8e6b8e | 2022-05-16 23:49:56 -0500 | [diff] [blame] | 245 | While a host's NLSR neighbors are by default populated by adjacent nodes in wired scenarios, |
| 246 | for those running NLSR on wifi stations it is required that you specify "neighbor" faces |
| 247 | manually. The framework for this is provided either via a dictionary object or through |
| 248 | additional sections in topology files, and may also be used for wired experiments. |
| 249 | See an example of a topo of this sort in ``mini-ndn/topologies/wifi/nlsr_wifi_example.conf``. |
| 250 | NLSR faces to be created can be manually specified from topology files in a ``[faces]`` |
| 251 | section, with the format ``nodeA:nodeB [cost=X]``. You should then call the ``setupFaces()`` |
| 252 | method of an initialized Mini-NDN object to get a dictionary based on this parse in the format |
| 253 | ``faceA:[(faceB, cost), (faceC, cost),...]``, which can finally be passed to the NLSR |
| 254 | helper via the faceDict parameter. An example experiment using this methodology is located |
| 255 | at ``mini-ndn/examples/wifi/nlsr_wifi.py``. Note that the aforementioned dict can also be |
| 256 | created manually in the previously established format. |
| 257 | |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 258 | Routing Options |
| 259 | ---------------- |
| 260 | |
| 261 | Link State Routing (NLSR) |
| 262 | _________________________ |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 263 | |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 264 | By default, Mini-NDN uses `NLSR <https://github.com/named-data/NLSR>`__ for route management, i.e., route computation, route installation, etc. |
| 265 | Additionally, the command-line utility ``nlsrc`` can be used to advertise and withdraw prefixes and route status. |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 266 | |
| 267 | NDN Routing Helper |
Davide Pesavento | 750d040 | 2025-02-25 16:50:50 -0500 | [diff] [blame^] | 268 | __________________ |
| 269 | |
Saurab Dulal | 576a419 | 2020-08-25 00:55:22 -0500 | [diff] [blame] | 270 | Computes link-state or hyperbolic route/s from a given minindn topology and installs them in the FIB. The major benefit of the routing helper is to eliminate the overhead of NLSR when using larger topology. See ``examples/static_routing_experiment.py`` on how to use the helper class. |
| 271 | |
| 272 | **IMPORTANT:** NLSR and NDN Routing Helper are mutually exclusive, meaning you can only use one at a time, not both. |
| 273 | |
| 274 | **Note:** The current version of ``ndn_routing_helper`` is still in the experimental phase. It doesn't support node or link failure and runtime prefix advertisement/withdrawal. If you find any bug please report `here <https://redmine.named-data.net/projects/mini-ndn>`__ or contact the :doc:`authors <authors>`. |
| 275 | |
| 276 | IP Routing Helper |
| 277 | ____________________ |
| 278 | |
| 279 | The routing helper allows to run IP-based evaluations with Mini-NDN. It configures static IP routes to all nodes, which means that all nodes can reach all other nodes in the network |
| 280 | reachable, even when relaying is required. Please see ``examples/ip_rounting_experiment.py`` for a simple example. |