LLDP¶
Link Layer Discovery Protocol(LLDP, IEEE 802.1AB) http://standards.ieee.org/getieee802/download/802.1AB-2009.pdf
basic TLV format:
octets | 1 | 2 | 3 ... n + 2 |
--------------------------------------------------------
| TLV type | TLV information | TLV information string |
| (7bits) | string length | (0-507 octets) |
| | (9bits) | |
--------------------------------------------------------
bits |8 2|1|8 1|
Organizationally specific TLV format:
octets | 1 | 2 | 3 ... 5 | 6 | 7 ... n + 6 |
---------------------------------------------------------------
| TLV type | Length | OUI | Subtype | Infomation |
| (7bits) | (9bits) | (24bits) | (8bits) | (0-507 octets) |
---------------------------------------------------------------
bits |8 2|1|8 1|
LLDPDU format:
------------------------------------------------------------------------
| Chassis ID | Port ID | TTL | optional TLV | ... | optional TLV | End |
------------------------------------------------------------------------
Chasis ID, Port ID, TTL, End are mandatory optional TLV may be inserted in any order
-
class
ryu.lib.packet.lldp.
ChassisID
(buf=None, *args, **kwargs)¶ Chassis ID TLV encoder/decoder class
Attribute Description buf Binary data to parse. subtype Subtype. chassis_id Chassis id corresponding to subtype.
-
class
ryu.lib.packet.lldp.
End
(buf=None, *args, **kwargs)¶ End TLV encoder/decoder class
Attribute Description buf Binary data to parse.
-
class
ryu.lib.packet.lldp.
ManagementAddress
(buf=None, *args, **kwargs)¶ Management Address TLV encoder/decoder class
Attribute Description buf Binary data to parse. addr_subtype Address type. addr Device address. intf_subtype Interface type. intf_num Interface number. oid Object ID.
-
class
ryu.lib.packet.lldp.
OrganizationallySpecific
(buf=None, *args, **kwargs)¶ Organizationally Specific TLV encoder/decoder class
Attribute Description buf Binary data to parse. oui Organizationally unique ID. subtype Organizationally defined subtype. info Organizationally defined information string.
-
class
ryu.lib.packet.lldp.
PortDescription
(buf=None, *args, **kwargs)¶ Port description TLV encoder/decoder class
Attribute Description buf Binary data to parse. port_description Port description.
-
class
ryu.lib.packet.lldp.
PortID
(buf=None, *args, **kwargs)¶ Port ID TLV encoder/decoder class
Attribute Description buf Binary data to parse. subtype Subtype. port_id Port ID corresponding to subtype.
-
class
ryu.lib.packet.lldp.
SystemCapabilities
(buf=None, *args, **kwargs)¶ System Capabilities TLV encoder/decoder class
Attribute Description buf Binary data to parse. system_cap System Capabilities. enabled_cap Enabled Capabilities.
-
class
ryu.lib.packet.lldp.
SystemDescription
(buf=None, *args, **kwargs)¶ System description TLV encoder/decoder class
Attribute Description buf Binary data to parse. system_description System description.
-
class
ryu.lib.packet.lldp.
SystemName
(buf=None, *args, **kwargs)¶ System name TLV encoder/decoder class
Attribute Description buf Binary data to parse. system_name System name.
-
class
ryu.lib.packet.lldp.
TTL
(buf=None, *args, **kwargs)¶ Time To Live TLV encoder/decoder class
Attribute Description buf Binary data to parse. ttl Time To Live.
-
class
ryu.lib.packet.lldp.
lldp
(tlvs)¶ LLDPDU encoder/decoder class.
An instance has the following attributes at least.
Attribute Description tlvs List of TLV instance. -
classmethod
parser
(buf)¶ Decode a protocol header.
This method is used only when decoding a packet.
Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.
- An object to describe the decoded header.
- A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.
- The rest of packet.
-
serialize
(payload, prev)¶ Encode a protocol header.
This method is used only when encoding a packet.
Encode a protocol header. Returns a bytearray which contains the header.
payload is the rest of the packet which will immediately follow this header.
prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.
-
classmethod