This NApp implements the Link Layer Discovery Protocol (LLDP).
This NApps is responsible for providing these major features:
- Link discovery
- Link liveness detection
- Interface loop detection
In order to track connections between switches under the present SDN controller, this NAPP uses the LLDP protocol with the following procedure:
- Periodically this NApp builds and sends a PacketOut OpenFlow message containing an Ethernet Packet with LLDP data through all datapaths's interfaces. This LLDP packet is designed to the specific switch and port related to the PacketOut, by carrying the switch DPID and the Port that it will be forwarded through.
- The switches forward the packet through the given Port and, if another
switch is connected to that port, it will have a flow (pre-installed by the
NApp) instructing it to send it back to the controller. So, it will generate
a
PacketIn
with that Ethernet packet to the controller. - This NApp will get all
PacketIn
messages and look for Ethernet packets with LLDP content. If it is one of the LLDP packets generated by the NApp itself, then it will get the information from thePacketIn
(switch/dpid and in_port). - At last but not least, the NApp will generate a KytosEvent with the 'source-destination' information, denoting those interfaces are NNIs.
This protocol is vendor free and used to discover network devices and all links between them. This protocol is implemented at layer 2 (L2) and defined in the IEEE 802.1ab. A network management system (NMS) can rapidly obtain the L2 network topology and topology changes over time using LLDP.
Link liveness detection via LLDP leverages the existing link discovery messages to provide this functionality. Link liveness detection is enabled per interface and it needs to be enabled on each pair to work. This implementation is meant to be a generic alternative to BFD (Bidirectional Forwarding Detection - RFC 5880) where the protocol states is being tracked by the control plane. For more information, check out EP030.
Interface loop detection is a mechanism to detect if an interface of a switch is looped, this feature uses the existing LLDP messages. This feature is enabled by default once LLDP is enabled, but interfaces that have intentional loops can be configured to be ignored. By default, once a loop is detected, it'll generate a log warning message, additional actions such as disable can also be configured. For more information, check out EP025.
To install this NApp, first, make sure to have the same venv activated as you have kytos
installed on:
$ git clone https://github.com/kytos-ng/of_lldp.git
$ cd of_lldp
$ python3 -m pip install --editable .
To install the kytos environment, please follow our development environment setup.
kytos/of_core.v0x04.messages.in.ofpt_packet_in
kytos/topology.switch.enabled
kytos/topology.switch.disabled
kytos/topology.topology_loaded
kytos/topology.switches.metadata.(added|removed)
kytos/of_multi_table.enable_table
buffer: message_out
Standard "message out" event with a PacketOut message to the switch containing a LLDP packet inside it.
Content:
{ 'message': <object>, # instance of a python-openflow PacketOut message
'destination': <object> # instance of kytos.core.switch.Connection class
}
buffer: app
An evento to notify that a link between two network-to-network interfaces (NNIs) was identified. This identification is possible due to the fact that a connection between two switches was identified. This does not mean that it is a new connection, it may be an already known connection between two switches. This event contains two attributes, interface_a and interface_b, and each one of them contains an attribute switch and another port, the first one contains the switch id and the second one the port number.
Content:
{
'interface_a': <interface_a>, # Object instance of Interface
'interface_b': <interface_b>
}
buffer: app
Event reporting that a loop has been detected.
Content:
{
'dpid': <str>,
'interface_id': <str>,
'port_numbers': [<int>, <int>],
}
buffer: app
Event reporting that a loop has stopped.
Content:
{
'dpid': <str>,
'interface_id': <str>,
'port_numbers': [<int>, <int>],
}
buffer: app
Event reporting that link liveness is up
Content:
{
"interface_a": <Interface obj>
"interface_b": <Interface obj>
}
buffer: app
Event reporting that link liveness is down
Content:
{
"interface_a": <Interface obj>
"interface_b": <Interface obj>
}
buffer: app
Event reporting that liveness has been enabled on interfaces
Content:
{
"interfaces": [<Interface obj>]
}
buffer: app
Event reporting that liveness has been disabled on interfaces
Content:
{
"interfaces": [<Interface obj>]
}
A response from the kytos/of_multi_table.enable_table
event to confirm table settings.
{
'table_group': <object>
}