ironic.drivers.modules.inspector.lldp_parsers module

Names and mapping functions used to map LLDP TLVs to name/value pairs

class ironic.drivers.modules.inspector.lldp_parsers.LLDPBasicMgmtParser(nv=None)[source]

Bases: LLDPParser

Class to handle parsing of 802.1AB Basic Management set

This class will also handle 802.1Q and 802.3 OUI TLVs.

add_capabilities(struct, name, data)[source]


add_mgmt_address(struct, name, data)[source]


There can be multiple Mgmt Address TLVs, store in list.

handle_org_specific_tlv(struct, name, data)[source]

Handle Organizationally Unique ID TLVs

This class supports 802.1Q and 802.3 OUI TLVs.

See, Annex D and

class ironic.drivers.modules.inspector.lldp_parsers.LLDPParser(node_uuid, nv=None)[source]

Bases: object

Base class to handle parsing of LLDP TLVs

Each class that inherits from this base class must provide a parser map. Parser maps are used to associate a LLDP TLV with a function handler and arguments necessary to parse the TLV and generate one or more name/value pairs. Each LLDP TLV maps to a tuple with the following fields:

function - Handler function to generate name/value pairs

construct - Name of construct definition for TLV

name - User-friendly name of TLV. For TLVs that generate only one name/value pair, this is the name used

len_check - Boolean indicating if length check should be done on construct

It is valid to have a function handler of None, this is for TLVs that are not mapped to a name/value pair (e.g.LLDP_TLV_TTL).

Add name/value pairs for TLV Dot1_LinkAggregationId

This is in the base class since it can be used by both dot1 and dot3.

add_nested_value(struct, name, data)[source]

Add a single nested name/value pair to the dictionary

add_single_value(struct, name, data)[source]

Add a single name/value pair to the nv dictionary

append_value(name, value)[source]

Add value to a list mapped to name

parse_tlv(tlv_type, data)[source]

Parse TLVs from mapping table

This functions takes the TLV type and the raw data for this TLV and gets a tuple from the parser_map. The construct field in the tuple contains the construct lib definition of the TLV which can be parsed to access individual fields. Once the TLV is parsed, the handler function for each TLV will store the individual fields as name/value pairs in nv_dict.

If the handler function does not exist, then no name/value pairs will be added to nv_dict, but since the TLV was handled, True will be returned.


tlv_type - type identifier for TLV


data - raw TLV value


True if TLV in parser_map and data is valid, otherwise False.

set_value(name, value)[source]

Set name value pair in dictionary

The value for a name should not be changed if it exists.

class ironic.drivers.modules.inspector.lldp_parsers.LLDPdot1Parser(node_uuid, nv=None)[source]

Bases: LLDPParser

Class to handle parsing of 802.1Q TLVs

add_dot1_port_protocol_vlan(struct, name, data)[source]


add_dot1_protocol_identities(struct, name, data)[source]


There can be multiple protocol ids TLVs, store in list

add_dot1_vlans(struct, name, data)[source]

Handle dot1_VLAN_NAME

There can be multiple VLAN TLVs, add dictionary entry with id/vlan to list.

class ironic.drivers.modules.inspector.lldp_parsers.LLDPdot3Parser(node_uuid, nv=None)[source]

Bases: LLDPParser

Class to handle parsing of 802.3 TLVs

add_dot3_macphy_config(struct, name, data)[source]