7 The L2 Switch project provides Layer2 switch functionality.
10 ----------------------
14 - Decodes the packets coming to the controller and dispatches them
19 - Removes loops in the network
23 - Handles the decoded ARP packets
27 - Learns the Addresses (MAC and IP) of entities in the network
31 - Tracks the locations of hosts in the network
35 - Installs flows on each switch based on network traffic
37 Configurable parameters in L2 Switch
38 ------------------------------------
40 The sections below give details about the configuration settings for
41 the components that can be configured.
43 The process to change the configuration has been changed with
44 the introduction of Blueprint in the Boron release. Please
45 refer to :ref:`l2switch-change-config` for an
46 example illustrating how to change the configurations.
48 Configurable parameters in Loop Remover
49 ---------------------------------------
51 - l2switch/loopremover/implementation/src/main/yang/loop-remover-config.yang
53 - is-install-lldp-flow
55 - "true" means a flow that sends all LLDP packets to the
56 controller will be installed on each switch
58 - "false" means this flow will not be installed
60 - default value is true
64 - The LLDP flow will be installed on the specified flow table of
67 - This field is only relevant when "is-install-lldp-flow" is set
74 - The LLDP flow will be installed with the specified priority
76 - This field is only relevant when "is-install-lldp-flow" is set
79 - default value is 100
81 - lldp-flow-idle-timeout
83 - The LLDP flow will timeout (removed from the switch) if the
84 flow doesn’t forward a packet for *x* seconds
86 - This field is only relevant when "is-install-lldp-flow" is set
91 - lldp-flow-hard-timeout
93 - The LLDP flow will timeout (removed from the switch) after *x*
94 seconds, regardless of how many packets it is forwarding
96 - This field is only relevant when "is-install-lldp-flow" is set
101 - graph-refresh-delay
103 - A graph of the network is maintained and gets updated as
104 network elements go up/down (i.e. links go up/down and switches
107 - After a network element going up/down, it waits
108 *graph-refresh-delay* seconds before recomputing the graph
110 - A higher value has the advantage of doing less graph updates,
111 at the potential cost of losing some packets because the graph
112 didn’t update immediately.
114 - A lower value has the advantage of handling network topology
115 changes quicker, at the cost of doing more computation.
117 - default value is 1000
119 Configurable parameters in Arp Handler
120 --------------------------------------
122 - l2switch/arphandler/src/main/yang/arp-handler-config.yang
124 - is-proactive-flood-mode
126 - "true" means that flood flows will be installed on each switch.
127 With this flood flow, each switch will flood a packet that
128 doesn’t match any other flows.
130 - Advantage: Fewer packets are sent to the controller because
131 those packets are flooded to the network.
133 - Disadvantage: A lot of network traffic is generated.
135 - "false" means the previously mentioned flood flows will not be
136 installed. Instead an ARP flow will be installed on each switch
137 that sends all ARP packets to the controller.
139 - Advantage: Less network traffic is generated.
141 - Disadvantage: The controller handles more packets (ARP
142 requests & replies) and the ARP process takes longer than if
143 there were flood flows.
145 - default value is true
147 - flood-flow-table-id
149 - The flood flow will be installed on the specified flow table of
152 - This field is only relevant when "is-proactive-flood-mode" is
157 - flood-flow-priority
159 - The flood flow will be installed with the specified priority
161 - This field is only relevant when "is-proactive-flood-mode" is
166 - flood-flow-idle-timeout
168 - The flood flow will timeout (removed from the switch) if the
169 flow doesn’t forward a packet for *x* seconds
171 - This field is only relevant when "is-proactive-flood-mode" is
176 - flood-flow-hard-timeout
178 - The flood flow will timeout (removed from the switch) after *x*
179 seconds, regardless of how many packets it is forwarding
181 - This field is only relevant when "is-proactive-flood-mode" is
188 - The ARP flow will be installed on the specified flow table of
191 - This field is only relevant when "is-proactive-flood-mode" is
198 - The ARP flow will be installed with the specified priority
200 - This field is only relevant when "is-proactive-flood-mode" is
205 - arp-flow-idle-timeout
207 - The ARP flow will timeout (removed from the switch) if the flow
208 doesn’t forward a packet for *x* seconds
210 - This field is only relevant when "is-proactive-flood-mode" is
215 - arp-flow-hard-timeout
217 - The ARP flow will timeout (removed from the switch) after
218 *arp-flow-hard-timeout* seconds, regardless of how many packets
221 - This field is only relevant when "is-proactive-flood-mode" is
226 Configurable parameters in Address Tracker
227 ------------------------------------------
229 - l2switch/addresstracker/implementation/src/main/yang/address-tracker-config.yang
231 - timestamp-update-interval
233 - A last-seen timestamp is associated with each address. This
234 last-seen timestamp will only be updated after
235 *timestamp-update-interval* milliseconds.
237 - A higher value has the advantage of performing less writes to
240 - A lower value has the advantage of knowing how fresh an address
243 - default value is 600000
245 - observe-addresses-from
247 - IP and MAC addresses can be observed/learned from ARP, IPv4,
248 and IPv6 packets. Set which packets to make these observations
251 - default value is arp
253 Configurable parameters in L2 Switch Main
254 -----------------------------------------
256 - l2switch/l2switch-main/src/main/yang/l2switch-config.yang
258 - is-install-dropall-flow
260 - "true" means a drop-all flow will be installed on each switch,
261 so the default action will be to drop a packet instead of
262 sending it to the controller
264 - "false" means this flow will not be installed
266 - default value is true
268 - dropall-flow-table-id
270 - The dropall flow will be installed on the specified flow table
273 - This field is only relevant when "is-install-dropall-flow" is
278 - dropall-flow-priority
280 - The dropall flow will be installed with the specified priority
282 - This field is only relevant when "is-install-dropall-flow" is
287 - dropall-flow-idle-timeout
289 - The dropall flow will timeout (removed from the switch) if the
290 flow doesn’t forward a packet for *x* seconds
292 - This field is only relevant when "is-install-dropall-flow" is
297 - dropall-flow-hard-timeout
299 - The dropall flow will timeout (removed from the switch) after
300 *x* seconds, regardless of how many packets it is forwarding
302 - This field is only relevant when "is-install-dropall-flow" is
307 - is-learning-only-mode
309 - "true" means that the L2 Switch will only be learning addresses.
310 No additional flows to optimize network traffic will be
313 - "false" means that the L2 Switch will react to network traffic
314 and install flows on the switches to optimize traffic.
315 Currently, MAC-to-MAC flows are installed.
317 - default value is false
319 - reactive-flow-table-id
321 - The reactive flow will be installed on the specified flow table
324 - This field is only relevant when "is-learning-only-mode" is set
329 - reactive-flow-priority
331 - The reactive flow will be installed with the specified priority
333 - This field is only relevant when "is-learning-only-mode" is set
336 - default value is 10
338 - reactive-flow-idle-timeout
340 - The reactive flow will timeout (removed from the switch) if the
341 flow doesn’t forward a packet for *x* seconds
343 - This field is only relevant when "is-learning-only-mode" is set
346 - default value is 600
348 - reactive-flow-hard-timeout
350 - The reactive flow will timeout (removed from the switch) after
351 *x* seconds, regardless of how many packets it is forwarding
353 - This field is only relevant when "is-learning-only-mode" is set
356 - default value is 300
358 .. _l2switch-change-config:
360 Change configuration in L2 Switch
361 ---------------------------------
363 .. note:: For more information on Blueprint in OpenDaylight, see `this wiki page <https://wiki.opendaylight.org/view/Using_Blueprint>`_.
365 The following is an example on how to change the configurations of the L2 Switch components.
367 **Use Case:** Change the L2 switch from proactive flood mode to reactive mode.
369 **Option 1:** (external xml file)
371 #. Navigate to etc folder under download distribution
372 #. Create following directory structure::
374 mkdir - p opendaylight/datastore/initial/config
376 #. Create a new xml file corresponding to ``<yang module name>_<container name>.xml``::
378 vi arp-handler-config_arp-handler-config.xml
380 #. Add following contents to the created file::
382 <?xml version="1.0" encoding="UTF-8"?>
383 <arp-handler-config xmlns="urn:opendaylight:packet:arp-handler-config">
384 <is-proactive-flood-mode>false</is-proactive-flood-mode>
385 </arp-handler-config>
387 #. Restart the controller which injects the configurations.
389 **Option 2:** (REST URL)
391 #. Make the following REST call
393 * *URL:* ``http://{{LOCALIP}}:8181/restconf/config/arp-handler-config:arp-handler-config/``
394 * *Content-Type:* application/json
398 "arp-handler-config":
400 "is-proactive-flood-mode":false
404 * *Expected Result:* 201 Created
406 #. Restart the controller to see updated configurations. With out a restart
407 new configurations will be merged with old configurations which is not desirable.
409 Running the L2 Switch
410 ---------------------
412 To run the L2 Switch inside the OpenDaylight distribution simply
413 install the ``odl-l2switch-switch-ui`` feature;
417 feature:install odl-l2switch-switch-ui
419 Create a network using mininet
420 ------------------------------
424 sudo mn --controller=remote,ip=<Controller IP> --topo=linear,3 --switch ovsk,protocols=OpenFlow13
425 sudo mn --controller=remote,ip=127.0.0.1 --topo=linear,3 --switch ovsk,protocols=OpenFlow13
427 The above command will create a virtual network consisting of 3
428 switches. Each switch will connect to the controller located at the
429 specified IP, i.e. 127.0.0.1
433 sudo mn --controller=remote,ip=127.0.0.1 --mac --topo=linear,3 --switch ovsk,protocols=OpenFlow13
435 The above command has the "mac" option, which makes it easier to
436 distinguish between Host MAC addresses and Switch MAC addresses.
438 Generating network traffic using mininet
439 ----------------------------------------
445 The above command will cause host1 (h1) to ping host2 (h2)
451 *pingall* will cause each host to ping every other host.
453 Checking Address Observations
454 -----------------------------
456 Address Observations are added to the Inventory data tree.
458 The Address Observations on a Node Connector can be checked through a
459 browser or a REST Client.
463 http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:1
465 .. figure:: ./images/l2switch-address-observations.png
466 :alt: Address Observations
473 Host information is added to the Topology data tree.
477 - Attachment point (link) to a node/switch
479 This host information and attachment point information can be checked
480 through a browser or a REST Client.
484 http://10.194.126.91:8080/restconf/operational/network-topology:network-topology/topology/flow:1/
486 .. figure:: ./images/l2switch-hosts.png
491 Checking STP status of each link
492 --------------------------------
494 STP Status information is added to the Inventory data tree.
496 - A status of "forwarding" means the link is active and packets are
499 - A status of "discarding" means the link is inactive and packets are
502 The STP status of a link can be checked through a browser or a REST
507 http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:2
509 .. figure:: ./images/l2switch-stp-status.png
514 Miscellaneous mininet commands
515 ------------------------------
521 This will bring the link between switch1 (s1) and switch2 (s2) down
527 This will bring the link between switch1 (s1) and switch2 (s2) up
533 This will bring the link between switch1 (s1) and host1 (h1) down