blob: 0cc2ae6e8bb9bade6fe4b9897833085a6dbdbffe [file] [log] [blame]
Ashlesh Gawande6c86e302019-09-17 22:27:05 -05001Experiment
2==========
3
4Configuration
5-------------
6
7Mini-NDN uses a configuration file describing the topology and its parameters to setup a network.
8
9The [nodes] section:
10
11At the bare minimum, the node section describes the nodes present in the
12topology.
13
14::
15
16 [nodes]
17 a: key1=value1 key2=value2
18 b: key1=value1
19
20Any 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
27One 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
35To 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
41This will turn on FORWARDER logging to INFO for all nodes.
42
43.. Todo: Add switch section
44
45The [links] section:
46
47The links section describes the links in the topology.
48
49::
50
51 e.g.)
52
53 [links]
54 a:b delay=10ms
55
56This would create a link between a and b. 'b:a' would also result in the
57same. 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
66Example configuration file
67
68::
69
70 [nodes]
71 a:
72 b:
73 [links]
74 a:b delay=10ms bw=100
75
76See ``ndn_utils/topologies`` for more sample files
77
78Sample
79------
80
81Sample 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
127Users may look at how the NFD and NLSR applications are written as a sub class of Application
128in the ``minindn/apps`` folder. Or users may choose to directly run their application on nodes
129such as ndnpingserver is run in ``minindn/helpers/experiment.py``.
130
Saurab Dulal576a4192020-08-25 00:55:22 -0500131**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 Gawande6c86e302019-09-17 22:27:05 -0500135Execution
136---------
137
138To 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
145To run Mini-NDN with a topology file, provide the filename as the first
146argument:
147
148::
149
150 sudo python examples/minindn.py my-topology.conf
151
152After 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
158The 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
160CLI Interface
161_____________
162
163During set up, the list of nodes in the network will be listed as they
164are initialized:
165
166::
167
168 *** Adding hosts:
169 a b c d
170
171After set up, the command-line interface (CLI) will display a prompt.
172
173::
174
175 mini-ndn>
176
177To interact with a node, first type the node's name and then the command
178to be executed:
179
180::
181
182 mini-ndn> a echo "Hello, world!"
183 Hello, world!
184
185To see the status of the forwarder on the node:
186
187::
188
189 mini-ndn> a nfdc status report
190
191To see the status of routing on the node:
192
193::
194
195 mini-ndn> a nlsrc status
196
197To 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
205For a more in depth explanation of the CLI, please see the `Mininet
206Walkthrough <http://mininet.org/walkthrough/>`__.
207
208To run NDN commands from the outside the command line user can also open a new terminal
209and export the HOME folder of a node ``export HOME=/tmp/minindn/a && cd ~``
210
211Working Directory Structure
212---------------------------
213
214Currently Mini-NDN uses /tmp/minindn as the working directory if not
215specified otherwise by using the option --work-dir.
216
217Each 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
219the conf file.
220
221NFD
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
230NLSR
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
236When security is enabled, NLSR security certificates are stored in:
237``/tmp/minindn/<node-name>/security`` Note that no NLSR publishes the root
238certificate, Mini-NDN installs root.cert in security folder for each
239NLSR.
Saurab Dulal576a4192020-08-25 00:55:22 -0500240
awlaned8e6b8e2022-05-16 23:49:56 -0500241While a host's NLSR neighbors are by default populated by adjacent nodes in wired scenarios,
242for those running NLSR on wifi stations it is required that you specify "neighbor" faces
243manually. The framework for this is provided either via a dictionary object or through
244additional sections in topology files, and may also be used for wired experiments.
245See an example of a topo of this sort in ``mini-ndn/topologies/wifi/nlsr_wifi_example.conf``.
246NLSR faces to be created can be manually specified from topology files in a ``[faces]``
247section, with the format ``nodeA:nodeB [cost=X]``. You should then call the ``setupFaces()``
248method 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
250helper via the faceDict parameter. An example experiment using this methodology is located
251at ``mini-ndn/examples/wifi/nlsr_wifi.py``. Note that the aforementioned dict can also be
252created manually in the previously established format.
253
Saurab Dulal576a4192020-08-25 00:55:22 -0500254Routing Options
255----------------
256
257Link State Routing (NLSR)
258_________________________
259By 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
262NDN Routing Helper
263____________________
264Computes 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
270IP Routing Helper
271____________________
272
273The 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
274reachable, even when relaying is required. Please see ``examples/ip_rounting_experiment.py`` for a simple example.