blob: 58cc303bd0dfdd7e631a69e1d56c05304aaff65c [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
131Execution
132---------
133
134To run Mini-NDN with the default topology,
135``ndn_utils/topologies/default-topology.conf``, type:
136
137::
138
139 sudo python examples/minindn.py
140
141To run Mini-NDN with a topology file, provide the filename as the first
142argument:
143
144::
145
146 sudo python examples/minindn.py my-topology.conf
147
148After Mini-NDN is installed, users can run examples from anywhere with python directly as follows:
149
150::
151
152 sudo python /path/to/myexample.py
153
154The 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.
155
156CLI Interface
157_____________
158
159During set up, the list of nodes in the network will be listed as they
160are initialized:
161
162::
163
164 *** Adding hosts:
165 a b c d
166
167After set up, the command-line interface (CLI) will display a prompt.
168
169::
170
171 mini-ndn>
172
173To interact with a node, first type the node's name and then the command
174to be executed:
175
176::
177
178 mini-ndn> a echo "Hello, world!"
179 Hello, world!
180
181To see the status of the forwarder on the node:
182
183::
184
185 mini-ndn> a nfdc status report
186
187To see the status of routing on the node:
188
189::
190
191 mini-ndn> a nlsrc status
192
193To exit Mini-NDN, type ``quit`` in the CLI or use ``ctrl + D``:
194
195::
196
197 mini-ndn> quit
198
199``Ctrl + C`` is used to quit an application run in the foreground of the command line.
200
201For a more in depth explanation of the CLI, please see the `Mininet
202Walkthrough <http://mininet.org/walkthrough/>`__.
203
204To run NDN commands from the outside the command line user can also open a new terminal
205and export the HOME folder of a node ``export HOME=/tmp/minindn/a && cd ~``
206
207Working Directory Structure
208---------------------------
209
210Currently Mini-NDN uses /tmp/minindn as the working directory if not
211specified otherwise by using the option --work-dir.
212
213Each node is given a HOME directory under /tmp/minindn/<node-name> where
214<node-name> is the name of the node specified in the [nodes] section of
215the conf file.
216
217NFD
218___
219
220- NFD conf file is stored at ``/tmp/minindn/<node-name>/nfd.conf``
221
222- NFD log file is stored at ``/tmp/minindn/<node-name>/log/nfd.log``
223
224- ``.ndn`` folder is stored at ``/tmp/minindn/<node-name>/.ndn``
225
226NLSR
227____
228
229- NLSR conf file is stored at ``/tmp/minindn/<node-name>/nlsr.conf``
230- NLSR log file is stored at ``/tmp/minindn/<node-name>/log/nlsr.log``
231
232When security is enabled, NLSR security certificates are stored in:
233``/tmp/minindn/<node-name>/security`` Note that no NLSR publishes the root
234certificate, Mini-NDN installs root.cert in security folder for each
235NLSR.