L2 switch
Project type: Main
L2 switch is an MD-SAL-based implementation of a learning switch with optimizations on how a packet should be forwarded. L2 switch is a basic layer 2 switch feature within ODL. It includes layer 2-specific handling and also provides several reusable services, as follows:
- PacketHandler: This provides an infrastructure in an ODL controller to process incoming packets and forward them as required. It gives a pluggable architecture for handling the life cycle of a packet (term from OpenFlow's OFPT_PACKET_IN message) in the ODL controller. This infrastructure can limit to handle only packets with reason as No matching flow (table-miss flow entry).
Packets are decoded, modified and transmitted as part of PacketHandler.
- AddressTracker (Endpoint tracker): AddressTracker builds and maintains a mapping table that may have multiple attributes such as:
-
- Host MAC address
- Connected switch ID
- Switch port number
- VLAN, VNI (VXLAN),
- MPLS tag.
- Path Computation Service: This provides an optimal path (route) between hosts. It can be the shortest path, lowest cost, and so on, similar to the algorithms of routing protocols. Path Communication Service leverages and modifies topology data. It can also work with multiple topologies.
- Flow Writer Service: This service takes care of programming all the intermediate switches with appropriate flows once an optimal path has been computed between two hosts. It keeps track of mapping, from metaflow to individual flows, such that appropriate flows can be reprogrammed when a port goes down or an entire switch goes down.
- STP Service: This is the spanning tree protocol service that allows ODL to participate in a spanning tree. It is useful when ODL is deployed in a hybrid network (SDN and non-SDN with layer 2 connections) and you need to let ODL participate in a spanning tree. For a spanning tree, standard protocols are available.
Additional functionality that can be implemented by the L2 switch includes MAC address aging, packet filtering, static MAC addresses, and so on:
Remember that the L2 switch is a software module running on the ODL server. When one of the switches in the SDN domain receives a packet that doesn't have any entry that matches with its headers (source, destination MAC and IP, and so on), then the switch encapsulates the whole packet in an OpenFlow PACKET_IN message and sends it to the ODL. This packet is decapsulated and handed over to the L2 switch module to handle (find where the packet needs to be forwarded).
The L2 switch module performs MAC address learning using the OpenFlow-PACKET_IN messages it receives from the switches in the SDN domain. It is similar to a standard L2 switch. The following is a list of switch actions:
The following diagram illustrates the communication between L2 switch components: