4 The L2Switch project provides Layer2 switch functionality.
6 === L2Switch Architecture
8 ** Decodes the packets coming to the controller and dispatches them appropriately
10 ** Removes loops in the network
12 ** Handles the decoded ARP packets
14 ** Learns the Addresses (MAC and IP) of entities in the network
16 ** Tracks the locations of hosts in the network
18 ** Installs flows on each switch based on network traffic
20 === Configuring L2Switch
21 This sections below give details about the configuration settings for the components that can be configured.
23 //The base distribution configuration files are located in distribution/base/target/distributions-l2switch-base-0.1.0-SNAPSHOT-osgipackage/opendaylight/configuration/initial
25 //The karaf distribution configuration files are located in distribution/karaf/target/assembly/etc/opendaylight/karaf
27 === Configuring Loop Remover
29 ** is-install-lldp-flow
30 *** "true" means a flow that sends all LLDP packets to the controller will be installed on each switch
31 *** "false" means this flow will not be installed
33 *** The LLDP flow will be installed on the specified flow table of each switch
34 *** This field is only relevant when "is-install-lldp-flow" is set to "true"
36 *** The LLDP flow will be installed with the specified priority
37 *** This field is only relevant when "is-install-lldp-flow" is set to "true"
38 ** lldp-flow-idle-timeout
39 *** The LLDP flow will timeout (removed from the switch) if the flow doesn't forward a packet for _x_ seconds
40 *** This field is only relevant when "is-install-lldp-flow" is set to "true"
41 ** lldp-flow-hard-timeout
42 *** The LLDP flow will timeout (removed from the switch) after _x_ seconds, regardless of how many packets it is forwarding
43 *** This field is only relevant when "is-install-lldp-flow" is set to "true"
44 ** graph-refresh-delay
45 *** A graph of the network is maintained and gets updated as network elements go up/down (i.e. links go up/down and switches go up/down)
46 *** After a network element going up/down, it waits _graph-refresh-delay_ seconds before recomputing the graph
47 *** A higher value has the advantage of doing less graph updates, at the potential cost of losing some packets because the graph didn't update immediately.
48 *** A lower value has the advantage of handling network topology changes quicker, at the cost of doing more computation.
50 === Configuring Arp Handler
52 ** is-proactive-flood-mode
53 *** "true" means that flood flows will be installed on each switch. With this flood flow, each switch will flood a packet that doesn't match any other flows.
54 **** Advantage: Fewer packets are sent to the controller because those packets are flooded to the network.
55 **** Disadvantage: A lot of network traffic is generated.
56 *** "false" means the previously mentioned flood flows will not be installed. Instead an ARP flow will be installed on each switch that sends all ARP packets to the controller.
57 **** Advantage: Less network traffic is generated.
58 **** Disadvantage: The controller handles more packets (ARP requests & replies) and the ARP process takes longer than if there were flood flows.
59 ** flood-flow-table-id
60 *** The flood flow will be installed on the specified flow table of each switch
61 *** This field is only relevant when "is-proactive-flood-mode" is set to "true"
62 ** flood-flow-priority
63 *** The flood flow will be installed with the specified priority
64 *** This field is only relevant when "is-proactive-flood-mode" is set to "true"
65 ** flood-flow-idle-timeout
66 *** The flood flow will timeout (removed from the switch) if the flow doesn't forward a packet for _x_ seconds
67 *** This field is only relevant when "is-proactive-flood-mode" is set to "true"
68 ** flood-flow-hard-timeout
69 *** The flood flow will timeout (removed from the switch) after _x_ seconds, regardless of how many packets it is forwarding
70 *** This field is only relevant when "is-proactive-flood-mode" is set to "true"
72 *** The ARP flow will be installed on the specified flow table of each switch
73 *** This field is only relevant when "is-proactive-flood-mode" is set to "false"
75 *** The ARP flow will be installed with the specified priority
76 *** This field is only relevant when "is-proactive-flood-mode" is set to "false"
77 ** arp-flow-idle-timeout
78 *** The ARP flow will timeout (removed from the switch) if the flow doesn't forward a packet for _x_ seconds
79 *** This field is only relevant when "is-proactive-flood-mode" is set to "false"
80 ** arp-flow-hard-timeout
81 *** The ARP flow will timeout (removed from the switch) after _arp-flow-hard-timeout_ seconds, regardless of how many packets it is forwarding
82 *** This field is only relevant when "is-proactive-flood-mode" is set to "false"
84 === Configuring Address Tracker
85 * 56-addresstracker.xml
86 ** timestamp-update-interval
87 *** A last-seen timestamp is associated with each address. This last-seen timestamp will only be updated after _timestamp-update-interval_ milliseconds.
88 *** A higher value has the advantage of performing less writes to the database.
89 *** A lower value has the advantage of knowing how fresh an address is.
90 ** observe-addresses-from
91 *** IP and MAC addresses can be observed/learned from ARP, IPv4, and IPv6 packets. Set which packets to make these observations from.
93 === Configuring L2Switch Main
95 ** is-install-dropall-flow
96 *** "true" means a drop-all flow will be installed on each switch, so the default action will be to drop a packet instead of sending it to the controller
97 *** "false" means this flow will not be installed
98 ** dropall-flow-table-id
99 *** The dropall flow will be installed on the specified flow table of each switch
100 *** This field is only relevant when "is-install-dropall-flow" is set to "true"
101 ** dropall-flow-priority
102 *** The dropall flow will be installed with the specified priority
103 *** This field is only relevant when "is-install-dropall-flow" is set to "true"
104 ** dropall-flow-idle-timeout
105 *** The dropall flow will timeout (removed from the switch) if the flow doesn't forward a packet for _x_ seconds
106 *** This field is only relevant when "is-install-dropall-flow" is set to "true"
107 ** dropall-flow-hard-timeout
108 *** The dropall flow will timeout (removed from the switch) after _x_ seconds, regardless of how many packets it is forwarding
109 *** This field is only relevant when "is-install-dropall-flow" is set to "true"
110 ** is-learning-only-mode
111 *** "true" means that the L2Switch will only be learning addresses. No additional flows to optimize network traffic will be installed.
112 *** "false" means that the L2Switch will react to network traffic and install flows on the switches to optimize traffic. Currently, MAC-to-MAC flows are installed.
113 ** reactive-flow-table-id
114 *** The reactive flow will be installed on the specified flow table of each switch
115 *** This field is only relevant when "is-learning-only-mode" is set to "false"
116 ** reactive-flow-priority
117 *** The reactive flow will be installed with the specified priority
118 *** This field is only relevant when "is-learning-only-mode" is set to "false"
119 ** reactive-flow-idle-timeout
120 *** The reactive flow will timeout (removed from the switch) if the flow doesn't forward a packet for _x_ seconds
121 *** This field is only relevant when "is-learning-only-mode" is set to "false"
122 ** reactive-flow-hard-timeout
123 *** The reactive flow will timeout (removed from the switch) after _x_ seconds, regardless of how many packets it is forwarding
124 *** This field is only relevant when "is-learning-only-mode" is set to "false"
126 === Running the L2Switch project
128 To run the L2 Switch inside the Lithium OpenDaylight distribution simply install the `odl-l2switch-switch-ui` feature;
130 feature:install odl-l2switch-switch-ui
132 //==== Check out the project using git
133 // git clone https://git.opendaylight.org/gerrit/p/l2switch.git
135 //The above command will create a directory called "l2switch" with the project.
137 //==== Run the distribution
138 //To run the base distribution, you can use the following command
140 // ./distribution/base/target/distributions-l2switch-base-0.1.0-SNAPSHOT-osgipackage/opendaylight/run.sh
142 //If you need additional resources, you can use these command line arguments:
144 // -Xms1024m -Xmx2048m -XX:PermSize=512m -XX:MaxPermSize=1024m'
146 //To run the karaf distribution, you can use the following command:
148 // ./distribution/karaf/target/assembly/bin/karaf
150 === Create a network using mininet
151 sudo mn --controller=remote,ip=<Controller IP> --topo=linear,3 --switch ovsk,protocols=OpenFlow13
152 sudo mn --controller=remote,ip=127.0.0.1 --topo=linear,3 --switch ovsk,protocols=OpenFlow13
154 The above command will create a virtual network consisting of 3 switches.
155 Each switch will connect to the controller located at the specified IP, i.e. 127.0.0.1
157 sudo mn --controller=remote,ip=127.0.0.1 --mac --topo=linear,3 --switch ovsk,protocols=OpenFlow13
159 The above command has the "mac" option, which makes it easier to distinguish between Host MAC addresses and Switch MAC addresses.
161 === Generating network traffic using mininet
164 The above command will cause host1 (h1) to ping host2 (h2)
168 'pingall' will cause each host to ping every other host.
170 === Checking Address Observations
171 Address Observations are added to the Inventory data tree.
173 The Address Observations on a Node Connector can be checked through a browser or a REST Client.
175 http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:1
177 .Address Observations
178 image::l2switch-address-observations.png["AddressObservations image",width=500]
181 Host information is added to the Topology data tree.
184 * Attachment point (link) to a node/switch
186 This host information and attachment point information can be checked through a browser or a REST Client.
188 http://10.194.126.91:8080/restconf/operational/network-topology:network-topology/topology/flow:1/
191 image::l2switch-hosts.png["Hosts image",width=500]
193 === Checking STP status of each link
194 STP Status information is added to the Inventory data tree.
196 * A status of "forwarding" means the link is active and packets are flowing on it.
197 * A status of "discarding" means the link is inactive and packets are not sent over it.
199 The STP status of a link can be checked through a browser or a REST Client.
201 http://10.194.126.91:8080/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:2
204 image::l2switch-stp-status.png["STPStatus image",width=500]
206 === Miscellaneous mininet commands
209 This will bring the link between switch1 (s1) and switch2 (s2) down
213 This will bring the link between switch1 (s1) and switch2 (s2) up
217 This will bring the link between switch1 (s1) and host1 (h1) down