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