1 .. _l2switch-user-guide:
9 The L2 Switch project provides Layer2 switch functionality.
11 L2 Switch Architecture
12 ----------------------
16 - Decodes the packets coming to the controller and dispatches them
21 - Removes loops in the network
25 - Handles the decoded ARP packets
29 - Learns the Addresses (MAC and IP) of entities in the network
33 - Tracks the locations of hosts in the network
37 - Installs flows on each switch based on network traffic
39 Configurable parameters in L2 Switch
40 ------------------------------------
42 The sections below give details about the configuration settings for
43 the components that can be configured.
45 The process to change the configuration has been changed with
46 the introduction of Blueprint in the Boron release. Please
47 refer to :ref:`l2switch-change-config` for an
48 example illustrating how to change the configurations.
50 Configurable parameters in Loop Remover
51 ---------------------------------------
53 - l2switch/loopremover/implementation/src/main/yang/loop-remover-config.yang
55 - is-install-lldp-flow
57 - "true" means a flow that sends all LLDP packets to the
58 controller will be installed on each switch
60 - "false" means this flow will not be installed
62 - default value is true
66 - The LLDP flow will be installed on the specified flow table of
69 - This field is only relevant when "is-install-lldp-flow" is set
76 - The LLDP flow will be installed with the specified priority
78 - This field is only relevant when "is-install-lldp-flow" is set
81 - default value is 100
83 - lldp-flow-idle-timeout
85 - The LLDP flow will timeout (removed from the switch) if the
86 flow doesn’t forward a packet for *x* seconds
88 - This field is only relevant when "is-install-lldp-flow" is set
93 - lldp-flow-hard-timeout
95 - The LLDP flow will timeout (removed from the switch) after *x*
96 seconds, regardless of how many packets it is forwarding
98 - This field is only relevant when "is-install-lldp-flow" is set
103 - graph-refresh-delay
105 - A graph of the network is maintained and gets updated as
106 network elements go up/down (i.e. links go up/down and switches
109 - After a network element going up/down, it waits
110 *graph-refresh-delay* seconds before recomputing the graph
112 - A higher value has the advantage of doing less graph updates,
113 at the potential cost of losing some packets because the graph
114 didn’t update immediately.
116 - A lower value has the advantage of handling network topology
117 changes quicker, at the cost of doing more computation.
119 - default value is 1000
121 Configurable parameters in Arp Handler
122 --------------------------------------
124 - l2switch/arphandler/src/main/yang/arp-handler-config.yang
126 - is-proactive-flood-mode
128 - "true" means that flood flows will be installed on each switch.
129 With this flood flow, each switch will flood a packet that
130 doesn’t match any other flows.
132 - Advantage: Fewer packets are sent to the controller because
133 those packets are flooded to the network.
135 - Disadvantage: A lot of network traffic is generated.
137 - "false" means the previously mentioned flood flows will not be
138 installed. Instead an ARP flow will be installed on each switch
139 that sends all ARP packets to the controller.
141 - Advantage: Less network traffic is generated.
143 - Disadvantage: The controller handles more packets (ARP
144 requests & replies) and the ARP process takes longer than if
145 there were flood flows.
147 - default value is true
149 - flood-flow-table-id
151 - The flood flow will be installed on the specified flow table of
154 - This field is only relevant when "is-proactive-flood-mode" is
159 - flood-flow-priority
161 - The flood flow will be installed with the specified priority
163 - This field is only relevant when "is-proactive-flood-mode" is
168 - flood-flow-idle-timeout
170 - The flood flow will timeout (removed from the switch) if the
171 flow doesn’t forward a packet for *x* seconds
173 - This field is only relevant when "is-proactive-flood-mode" is
178 - flood-flow-hard-timeout
180 - The flood flow will timeout (removed from the switch) after *x*
181 seconds, regardless of how many packets it is forwarding
183 - This field is only relevant when "is-proactive-flood-mode" is
190 - The ARP flow will be installed on the specified flow table of
193 - This field is only relevant when "is-proactive-flood-mode" is
200 - The ARP flow will be installed with the specified priority
202 - This field is only relevant when "is-proactive-flood-mode" is
207 - arp-flow-idle-timeout
209 - The ARP flow will timeout (removed from the switch) if the flow
210 doesn’t forward a packet for *x* seconds
212 - This field is only relevant when "is-proactive-flood-mode" is
217 - arp-flow-hard-timeout
219 - The ARP flow will timeout (removed from the switch) after
220 *arp-flow-hard-timeout* seconds, regardless of how many packets
223 - This field is only relevant when "is-proactive-flood-mode" is
228 Configurable parameters in Address Tracker
229 ------------------------------------------
231 - l2switch/addresstracker/implementation/src/main/yang/address-tracker-config.yang
233 - timestamp-update-interval
235 - A last-seen timestamp is associated with each address. This
236 last-seen timestamp will only be updated after
237 *timestamp-update-interval* milliseconds.
239 - A higher value has the advantage of performing less writes to
242 - A lower value has the advantage of knowing how fresh an address
245 - default value is 600000
247 - observe-addresses-from
249 - IP and MAC addresses can be observed/learned from ARP, IPv4,
250 and IPv6 packets. Set which packets to make these observations
253 - default value is arp
255 Configurable parameters in L2 Switch Main
256 -----------------------------------------
258 - l2switch/l2switch-main/src/main/yang/l2switch-config.yang
260 - is-install-dropall-flow
262 - "true" means a drop-all flow will be installed on each switch,
263 so the default action will be to drop a packet instead of
264 sending it to the controller
266 - "false" means this flow will not be installed
268 - default value is true
270 - dropall-flow-table-id
272 - The dropall flow will be installed on the specified flow table
275 - This field is only relevant when "is-install-dropall-flow" is
280 - dropall-flow-priority
282 - The dropall flow will be installed with the specified priority
284 - This field is only relevant when "is-install-dropall-flow" is
289 - dropall-flow-idle-timeout
291 - The dropall flow will timeout (removed from the switch) if the
292 flow doesn’t forward a packet for *x* seconds
294 - This field is only relevant when "is-install-dropall-flow" is
299 - dropall-flow-hard-timeout
301 - The dropall flow will timeout (removed from the switch) after
302 *x* seconds, regardless of how many packets it is forwarding
304 - This field is only relevant when "is-install-dropall-flow" is
309 - is-learning-only-mode
311 - "true" means that the L2 Switch will only be learning addresses.
312 No additional flows to optimize network traffic will be
315 - "false" means that the L2 Switch will react to network traffic
316 and install flows on the switches to optimize traffic.
317 Currently, MAC-to-MAC flows are installed.
319 - default value is false
321 - reactive-flow-table-id
323 - The reactive flow will be installed on the specified flow table
326 - This field is only relevant when "is-learning-only-mode" is set
331 - reactive-flow-priority
333 - The reactive flow will be installed with the specified priority
335 - This field is only relevant when "is-learning-only-mode" is set
338 - default value is 10
340 - reactive-flow-idle-timeout
342 - The reactive flow will timeout (removed from the switch) if the
343 flow doesn’t forward a packet for *x* seconds
345 - This field is only relevant when "is-learning-only-mode" is set
348 - default value is 600
350 - reactive-flow-hard-timeout
352 - The reactive flow will timeout (removed from the switch) after
353 *x* seconds, regardless of how many packets it is forwarding
355 - This field is only relevant when "is-learning-only-mode" is set
358 - default value is 300
360 .. _l2switch-change-config:
362 Change configuration in L2 Switch
363 ---------------------------------
365 .. note:: For more information on Blueprint in OpenDaylight, see `this wiki page <https://wiki.opendaylight.org/view/Using_Blueprint>`_.
367 The following is an example on how to change the configurations of the L2 Switch components.
369 **Use Case:** Change the L2 switch from proactive flood mode to reactive mode.
371 **Option 1:** (external xml file)
373 #. Navigate to etc folder under download distribution
374 #. Create following directory structure::
376 mkdir - p opendaylight/datastore/initial/config
378 #. Create a new xml file corresponding to ``<yang module name>_<container name>.xml``::
380 vi arp-handler-config_arp-handler-config.xml
382 #. Add following contents to the created file::
384 <?xml version="1.0" encoding="UTF-8"?>
385 <arp-handler-config xmlns="urn:opendaylight:packet:arp-handler-config">
386 <is-proactive-flood-mode>false</is-proactive-flood-mode>
387 </arp-handler-config>
389 #. Restart the controller which injects the configurations.
391 **Option 2:** (REST URL)
393 #. Make the following REST call
395 * *URL:* ``http://{{LOCALIP}}:8181/restconf/config/arp-handler-config:arp-handler-config/``
396 * *Content-Type:* application/json
400 "arp-handler-config":
402 "is-proactive-flood-mode":false
406 * *Expected Result:* 201 Created
408 #. Restart the controller to see updated configurations. With out a restart
409 new configurations will be merged with old configurations which is not desirable.
411 Running the L2 Switch
412 ---------------------
414 To run the L2 Switch inside the OpenDaylight distribution simply
415 install the ``odl-l2switch-switch-ui`` feature;
419 feature:install odl-l2switch-switch-ui
421 Create a network using mininet
422 ------------------------------
426 sudo mn --controller=remote,ip=<Controller IP> --topo=linear,3 --switch ovsk,protocols=OpenFlow13
427 sudo mn --controller=remote,ip=127.0.0.1 --topo=linear,3 --switch ovsk,protocols=OpenFlow13
429 The above command will create a virtual network consisting of 3
430 switches. Each switch will connect to the controller located at the
431 specified IP, i.e. 127.0.0.1
435 sudo mn --controller=remote,ip=127.0.0.1 --mac --topo=linear,3 --switch ovsk,protocols=OpenFlow13
437 The above command has the "mac" option, which makes it easier to
438 distinguish between Host MAC addresses and Switch MAC addresses.
440 Generating network traffic using mininet
441 ----------------------------------------
447 The above command will cause host1 (h1) to ping host2 (h2)
453 *pingall* will cause each host to ping every other host.
455 Checking Address Observations
456 -----------------------------
458 Address Observations are added to the Inventory data tree.
460 The Address Observations on a Node Connector can be checked through a
461 browser or a REST Client.
465 http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:1
467 .. figure:: ./images/l2switch-address-observations.png
468 :alt: Address Observations
475 Host information is added to the Topology data tree.
479 - Attachment point (link) to a node/switch
481 This host information and attachment point information can be checked
482 through a browser or a REST Client.
486 http://10.194.126.91:8080/restconf/operational/network-topology:network-topology/topology/flow:1/
488 .. figure:: ./images/l2switch-hosts.png
493 Checking STP status of each link
494 --------------------------------
496 STP Status information is added to the Inventory data tree.
498 - A status of "forwarding" means the link is active and packets are
501 - A status of "discarding" means the link is inactive and packets are
504 The STP status of a link can be checked through a browser or a REST
509 http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:2
511 .. figure:: ./images/l2switch-stp-status.png
516 Miscellaneous mininet commands
517 ------------------------------
523 This will bring the link between switch1 (s1) and switch2 (s2) down
529 This will bring the link between switch1 (s1) and switch2 (s2) up
535 This will bring the link between switch1 (s1) and host1 (h1) down