ironic_inspector.common.lldp_parsers module¶
Names and mapping functions used to map LLDP TLVs to name/value pairs
- class ironic_inspector.common.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_mgmt_address(struct, name, data)[source]¶
Handle LLDP_TLV_MGMT_ADDRESS
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 http://www.ieee802.org/1/pages/802.1Q-2014.html, Annex D and http://standards.ieee.org/about/get/802/802.3.html
- class ironic_inspector.common.lldp_parsers.LLDPParser(node_info, 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’s 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_dot1_link_aggregation(struct, name, data)[source]¶
Add name/value pairs for TLV Dot1_LinkAggregationId
This is in base class since it can be used by both dot1 and dot3.
- 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.
- Param:
tlv_type - type identifier for TLV
- Param:
data - raw TLV value
- Returns:
True if TLV in parser_map and data is valid, otherwise False.
- class ironic_inspector.common.lldp_parsers.LLDPdot1Parser(node_info, nv=None)[source]¶
Bases:
LLDPParser
Class to handle parsing of 802.1Q TLVs
- class ironic_inspector.common.lldp_parsers.LLDPdot3Parser(node_info, nv=None)[source]¶
Bases:
LLDPParser
Class to handle parsing of 802.3 TLVs