Merge "Migrate OpFlex user docs to rst"
[docs.git] / docs / user-guide / l2switch-user-guide.rst
1 L2Switch User Guide
2 ===================
3
4 Overview
5 --------
6
7 The L2Switch project provides Layer2 switch functionality.
8
9 L2Switch Architecture
10 ---------------------
11
12 -  Packet Handler
13
14    -  Decodes the packets coming to the controller and dispatches them
15       appropriately
16
17 -  Loop Remover
18
19    -  Removes loops in the network
20
21 -  Arp Handler
22
23    -  Handles the decoded ARP packets
24
25 -  Address Tracker
26
27    -  Learns the Addresses (MAC and IP) of entities in the network
28
29 -  Host Tracker
30
31    -  Tracks the locations of hosts in the network
32
33 -  L2Switch Main
34
35    -  Installs flows on each switch based on network traffic
36
37 Configuring L2Switch
38 --------------------
39
40 This sections below give details about the configuration settings for
41 the components that can be configured.
42
43 Configuring Loop Remover
44 ------------------------
45
46 -  52-loopremover.xml
47
48    -  is-install-lldp-flow
49
50       -  "true" means a flow that sends all LLDP packets to the
51          controller will be installed on each switch
52
53       -  "false" means this flow will not be installed
54
55    -  lldp-flow-table-id
56
57       -  The LLDP flow will be installed on the specified flow table of
58          each switch
59
60       -  This field is only relevant when "is-install-lldp-flow" is set
61          to "true"
62
63    -  lldp-flow-priority
64
65       -  The LLDP flow will be installed with the specified priority
66
67       -  This field is only relevant when "is-install-lldp-flow" is set
68          to "true"
69
70    -  lldp-flow-idle-timeout
71
72       -  The LLDP flow will timeout (removed from the switch) if the
73          flow doesn’t forward a packet for *x* seconds
74
75       -  This field is only relevant when "is-install-lldp-flow" is set
76          to "true"
77
78    -  lldp-flow-hard-timeout
79
80       -  The LLDP flow will timeout (removed from the switch) after *x*
81          seconds, regardless of how many packets it is forwarding
82
83       -  This field is only relevant when "is-install-lldp-flow" is set
84          to "true"
85
86    -  graph-refresh-delay
87
88       -  A graph of the network is maintained and gets updated as
89          network elements go up/down (i.e. links go up/down and switches
90          go up/down)
91
92       -  After a network element going up/down, it waits
93          *graph-refresh-delay* seconds before recomputing the graph
94
95       -  A higher value has the advantage of doing less graph updates,
96          at the potential cost of losing some packets because the graph
97          didn’t update immediately.
98
99       -  A lower value has the advantage of handling network topology
100          changes quicker, at the cost of doing more computation.
101
102 Configuring Arp Handler
103 -----------------------
104
105 -  54-arphandler.xml
106
107    -  is-proactive-flood-mode
108
109       -  "true" means that flood flows will be installed on each switch.
110          With this flood flow, each switch will flood a packet that
111          doesn’t match any other flows.
112
113          -  Advantage: Fewer packets are sent to the controller because
114             those packets are flooded to the network.
115
116          -  Disadvantage: A lot of network traffic is generated.
117
118       -  "false" means the previously mentioned flood flows will not be
119          installed. Instead an ARP flow will be installed on each switch
120          that sends all ARP packets to the controller.
121
122          -  Advantage: Less network traffic is generated.
123
124          -  Disadvantage: The controller handles more packets (ARP
125             requests & replies) and the ARP process takes longer than if
126             there were flood flows.
127
128    -  flood-flow-table-id
129
130       -  The flood flow will be installed on the specified flow table of
131          each switch
132
133       -  This field is only relevant when "is-proactive-flood-mode" is
134          set to "true"
135
136    -  flood-flow-priority
137
138       -  The flood flow will be installed with the specified priority
139
140       -  This field is only relevant when "is-proactive-flood-mode" is
141          set to "true"
142
143    -  flood-flow-idle-timeout
144
145       -  The flood flow will timeout (removed from the switch) if the
146          flow doesn’t forward a packet for *x* seconds
147
148       -  This field is only relevant when "is-proactive-flood-mode" is
149          set to "true"
150
151    -  flood-flow-hard-timeout
152
153       -  The flood flow will timeout (removed from the switch) after *x*
154          seconds, regardless of how many packets it is forwarding
155
156       -  This field is only relevant when "is-proactive-flood-mode" is
157          set to "true"
158
159    -  arp-flow-table-id
160
161       -  The ARP flow will be installed on the specified flow table of
162          each switch
163
164       -  This field is only relevant when "is-proactive-flood-mode" is
165          set to "false"
166
167    -  arp-flow-priority
168
169       -  The ARP flow will be installed with the specified priority
170
171       -  This field is only relevant when "is-proactive-flood-mode" is
172          set to "false"
173
174    -  arp-flow-idle-timeout
175
176       -  The ARP flow will timeout (removed from the switch) if the flow
177          doesn’t forward a packet for *x* seconds
178
179       -  This field is only relevant when "is-proactive-flood-mode" is
180          set to "false"
181
182    -  arp-flow-hard-timeout
183
184       -  The ARP flow will timeout (removed from the switch) after
185          *arp-flow-hard-timeout* seconds, regardless of how many packets
186          it is forwarding
187
188       -  This field is only relevant when "is-proactive-flood-mode" is
189          set to "false"
190
191 Configuring Address Tracker
192 ---------------------------
193
194 -  56-addresstracker.xml
195
196    -  timestamp-update-interval
197
198       -  A last-seen timestamp is associated with each address. This
199          last-seen timestamp will only be updated after
200          *timestamp-update-interval* milliseconds.
201
202       -  A higher value has the advantage of performing less writes to
203          the database.
204
205       -  A lower value has the advantage of knowing how fresh an address
206          is.
207
208    -  observe-addresses-from
209
210       -  IP and MAC addresses can be observed/learned from ARP, IPv4,
211          and IPv6 packets. Set which packets to make these observations
212          from.
213
214 Configuring L2Switch Main
215 -------------------------
216
217 -  58-l2switchmain.xml
218
219    -  is-install-dropall-flow
220
221       -  "true" means a drop-all flow will be installed on each switch,
222          so the default action will be to drop a packet instead of
223          sending it to the controller
224
225       -  "false" means this flow will not be installed
226
227    -  dropall-flow-table-id
228
229       -  The dropall flow will be installed on the specified flow table
230          of each switch
231
232       -  This field is only relevant when "is-install-dropall-flow" is
233          set to "true"
234
235    -  dropall-flow-priority
236
237       -  The dropall flow will be installed with the specified priority
238
239       -  This field is only relevant when "is-install-dropall-flow" is
240          set to "true"
241
242    -  dropall-flow-idle-timeout
243
244       -  The dropall flow will timeout (removed from the switch) if the
245          flow doesn’t forward a packet for *x* seconds
246
247       -  This field is only relevant when "is-install-dropall-flow" is
248          set to "true"
249
250    -  dropall-flow-hard-timeout
251
252       -  The dropall flow will timeout (removed from the switch) after
253          *x* seconds, regardless of how many packets it is forwarding
254
255       -  This field is only relevant when "is-install-dropall-flow" is
256          set to "true"
257
258    -  is-learning-only-mode
259
260       -  "true" means that the L2Switch will only be learning addresses.
261          No additional flows to optimize network traffic will be
262          installed.
263
264       -  "false" means that the L2Switch will react to network traffic
265          and install flows on the switches to optimize traffic.
266          Currently, MAC-to-MAC flows are installed.
267
268    -  reactive-flow-table-id
269
270       -  The reactive flow will be installed on the specified flow table
271          of each switch
272
273       -  This field is only relevant when "is-learning-only-mode" is set
274          to "false"
275
276    -  reactive-flow-priority
277
278       -  The reactive flow will be installed with the specified priority
279
280       -  This field is only relevant when "is-learning-only-mode" is set
281          to "false"
282
283    -  reactive-flow-idle-timeout
284
285       -  The reactive flow will timeout (removed from the switch) if the
286          flow doesn’t forward a packet for *x* seconds
287
288       -  This field is only relevant when "is-learning-only-mode" is set
289          to "false"
290
291    -  reactive-flow-hard-timeout
292
293       -  The reactive flow will timeout (removed from the switch) after
294          *x* seconds, regardless of how many packets it is forwarding
295
296       -  This field is only relevant when "is-learning-only-mode" is set
297          to "false"
298
299 Running the L2Switch project
300 ----------------------------
301
302 To run the L2 Switch inside the Lithium OpenDaylight distribution simply
303 install the ``odl-l2switch-switch-ui`` feature;
304
305 ::
306
307     feature:install odl-l2switch-switch-ui
308
309 Create a network using mininet
310 ------------------------------
311
312 ::
313
314     sudo mn --controller=remote,ip=<Controller IP> --topo=linear,3 --switch ovsk,protocols=OpenFlow13
315     sudo mn --controller=remote,ip=127.0.0.1 --topo=linear,3 --switch ovsk,protocols=OpenFlow13
316
317 The above command will create a virtual network consisting of 3
318 switches. Each switch will connect to the controller located at the
319 specified IP, i.e. 127.0.0.1
320
321 ::
322
323     sudo mn --controller=remote,ip=127.0.0.1 --mac --topo=linear,3 --switch ovsk,protocols=OpenFlow13
324
325 The above command has the "mac" option, which makes it easier to
326 distinguish between Host MAC addresses and Switch MAC addresses.
327
328 Generating network traffic using mininet
329 ----------------------------------------
330
331 ::
332
333     h1 ping h2
334
335 The above command will cause host1 (h1) to ping host2 (h2)
336
337 ::
338
339     pingall
340
341 *pingall* will cause each host to ping every other host.
342
343 Checking Address Observations
344 -----------------------------
345
346 Address Observations are added to the Inventory data tree.
347
348 The Address Observations on a Node Connector can be checked through a
349 browser or a REST Client.
350
351 ::
352
353     http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:1
354
355 .. figure:: ./images/l2switch-address-observations.png
356    :alt: Address Observations
357
358    Address Observations
359
360 Checking Hosts
361 --------------
362
363 Host information is added to the Topology data tree.
364
365 -  Host address
366
367 -  Attachment point (link) to a node/switch
368
369 This host information and attachment point information can be checked
370 through a browser or a REST Client.
371
372 ::
373
374     http://10.194.126.91:8080/restconf/operational/network-topology:network-topology/topology/flow:1/
375
376 .. figure:: ./images/l2switch-hosts.png
377    :alt: Hosts
378
379    Hosts
380
381 Checking STP status of each link
382 --------------------------------
383
384 STP Status information is added to the Inventory data tree.
385
386 -  A status of "forwarding" means the link is active and packets are
387    flowing on it.
388
389 -  A status of "discarding" means the link is inactive and packets are
390    not sent over it.
391
392 The STP status of a link can be checked through a browser or a REST
393 Client.
394
395 ::
396
397     http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:2
398
399 .. figure:: ./images/l2switch-stp-status.png
400    :alt: STP status
401
402    STP status
403
404 Miscellaneous mininet commands
405 ------------------------------
406
407 ::
408
409     link s1 s2 down
410
411 This will bring the link between switch1 (s1) and switch2 (s2) down
412
413 ::
414
415     link s1 s2 up
416
417 This will bring the link between switch1 (s1) and switch2 (s2) up
418
419 ::
420
421     link s1 h1 down
422
423 This will bring the link between switch1 (s1) and host1 (h1) down
424