NAME
SNMP::Info::IEEE802_STP - SNMP Interface to spanning tree data in the IEEE8021-SPANNING-TREE-MIB and IEEE8021-MSTP-MIB
AUTHOR
SNMP::Info Developers
SYNOPSIS
my $stp = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $trees = $stp->stp_trees() || {};
foreach my $key ( sort keys %$trees ) {
my $root = $trees->{$key}{root} || {};
print "$key root ", ( $root->{mac} // 'unknown' ), "\n";
}
DESCRIPTION
A role for devices that serve the IEEE 802.1 spanning tree MIBs. It fills the spanning tree API that SNMP::Info::Bridge documents.
Trees are built only for MSTP, when ieee8021SpanningTreeVersion reads mstp: the CIST from ieee8021MstpCistTable and one MSTI per ieee8021MstpTable row. Under any other version the tree methods return what SNMP::Info::Bridge returns. hasSTP(), hasRSTP() and hasMSTP() report the served indicator whatever its value.
Every table is indexed by bridge component first. Only the lowest component is read.
A device class that cannot trust the served version overrides the private hooks _ieee_stp_protocol(), which returns mstp, rstp, stp or nothing, and _ieee_stp_measured(), which sets measured in each tree record and returns 0 here.
Create or use a subclass of SNMP::Info that inherits this class. Do not use directly.
For debugging you can call new() directly as you would in SNMP::Info
my $stp = new SNMP::Info::IEEE802_STP(...);
Inherited Classes
Required MIBs
Inherited MIBs
See "Required MIBs" in SNMP::Info::Bridge for its MIB requirements.
GLOBALS
These are methods that return scalar values from SNMP.
- $stp->hasSTP()
-
Returns 1 when
_ieee_stp_protocol()reportsstp, else 0. That hook readsieee8021SpanningTreeVersionby default, and a class may override it. - $stp->hasRSTP()
-
Returns 1 when
_ieee_stp_protocol()reportsrstp, else 0. That hook readsieee8021SpanningTreeVersionby default, and a class may override it. - $stp->hasMSTP()
-
Returns 1 when
_ieee_stp_protocol()reportsmstp, else 0. That hook readsieee8021SpanningTreeVersionby default, and a class may override it.
Global Methods imported from SNMP::Info::Bridge
See "GLOBALS" in SNMP::Info::Bridge for details.
TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash.
Overrides
- $stp->stp_protocols()
-
Returns
['mstp']under MSTP. Otherwise returns what SNMP::Info::Bridge returns. - $stp->stp_trees()
-
Under MSTP, returns reference to hash of tree records, in the form SNMP::Info::Bridge documents:
cist.0-
bridgefromieee8021MstpCistBridgeIdentifier,rootfromieee8021SpanningTreeDesignatedRoot. msti.N-
One per
ieee8021MstpTablerow.bridgefromieee8021MstpBridgeId,rootfromieee8021MstpDesignatedRoot.
ports_completeis 0 when a port row of the tree is on a bridge port missing frombp_index(), or when a component other than the lowest serves rows. Otherwise returns what SNMP::Info::Bridge returns. - $stp->stp_tree_ports($tree_key)
-
Under MSTP, returns reference to hash of port rows keyed by ifIndex, in the form SNMP::Info::Bridge documents, for the tree
$tree_keynames. Setserror()and returns nothing for a keystp_trees()does not hold. Otherwise returns what SNMP::Info::Bridge returns.cist.0-
statefromieee8021SpanningTreePortState.role_rawisieee8021MstpCistPortRoleas served, androleis it when it isroot,alternate,designatedorbackup, else undef.enabledfromieee8021SpanningTreePortEnabled, and the designated bridge and port fromieee8021SpanningTreePortDesignatedBridgeandieee8021SpanningTreePortDesignatedPort. msti.N-
statefromieee8021MstpPortState,roleandrole_rawfromieee8021MstpPortRole,enabledfrom the same port'sieee8021SpanningTreePortEnabled, anddesignated_bridgefromieee8021MstpPortDesignatedBridge.designated_portis undef, because the MIB serves no usable value.
- $stp->i_edgeport_admin()
-
Returns reference to hash of ifIndex to 1 or 0, the configured edge port setting, from
ieee8021SpanningTreeRstpPortAdminEdgePort, or fromieee8021MstpCistPortAdminEdgePortwhen that is empty. Returns what SNMP::Info::Bridge returns when both are empty. Does not depend on the protocol. - $stp->i_edgeport_oper()
-
As
i_edgeport_admin(), for the operational state, fromieee8021SpanningTreeRstpPortOperEdgePortorieee8021MstpCistPortOperEdgePort. - $stp->stp_trees_complete()
-
Under MSTP, returns 1 when
stp_trees()holds trees and theieee8021MstpTableandieee8021MstpCistPortTablewalks completed, else 0. Otherwise returns what SNMP::Info::Bridge returns. - $stp->stp_vlan_map()
-
Under MSTP, returns reference to hash of VLAN to tree key,
cist.0ormsti.N, fromieee8021MstpVlanMstId. Returns nothing when the column is empty. Otherwise returns what SNMP::Info::Bridge returns.
Spanning Tree Table (ieee8021SpanningTreeTable)
- $stp->ieee_stp_version()
-
Returns reference to hash. The spanning tree version by component.
(
ieee8021SpanningTreeVersion) - $stp->ieee_stp_root()
-
Returns reference to hash. The root bridge ID by component.
(
ieee8021SpanningTreeDesignatedRoot)
Spanning Tree Port Table (ieee8021SpanningTreePortTable)
- $stp->ieee_stp_p_state()
-
Returns reference to hash. The port state.
(
ieee8021SpanningTreePortState) - $stp->ieee_stp_p_enable()
-
Returns reference to hash. Whether spanning tree is enabled on the port.
(
ieee8021SpanningTreePortEnabled) - $stp->ieee_stp_p_bridge()
-
Returns reference to hash. The designated bridge ID.
(
ieee8021SpanningTreePortDesignatedBridge) - $stp->ieee_stp_p_port()
-
Returns reference to hash. The designated port ID.
(
ieee8021SpanningTreePortDesignatedPort)
RSTP Port Table (ieee8021SpanningTreeRstpPortTable)
- $stp->ieee_rstp_p_edge_admin()
-
Returns reference to hash. The configured edge port setting.
(
ieee8021SpanningTreeRstpPortAdminEdgePort) - $stp->ieee_rstp_p_edge_oper()
-
Returns reference to hash. The operational edge port state.
(
ieee8021SpanningTreeRstpPortOperEdgePort)
MSTP CIST Table (ieee8021MstpCistTable)
- $stp->mstp_cist_bridge()
-
Returns reference to hash. The CIST bridge ID by component.
(
ieee8021MstpCistBridgeIdentifier)
MSTP CIST Port Table (ieee8021MstpCistPortTable)
- $stp->mstp_cist_p_role()
-
Returns reference to hash. The CIST port role.
(
ieee8021MstpCistPortRole) - $stp->mstp_cist_p_edge_admin()
-
Returns reference to hash. The configured edge port setting.
(
ieee8021MstpCistPortAdminEdgePort) - $stp->mstp_cist_p_edge_oper()
-
Returns reference to hash. The operational edge port state.
(
ieee8021MstpCistPortOperEdgePort)
MSTP Table (ieee8021MstpTable)
- $stp->mstp_i_bridge()
-
Returns reference to hash. The MSTI bridge ID, keyed by component and MSTI.
(
ieee8021MstpBridgeId) - $stp->mstp_i_root()
-
Returns reference to hash. The MSTI root bridge ID, keyed by component and MSTI.
(
ieee8021MstpDesignatedRoot)
MSTP Port Table (ieee8021MstpPortTable)
- $stp->mstp_p_state()
-
Returns reference to hash. The port state, keyed by component, MSTI and port.
(
ieee8021MstpPortState) - $stp->mstp_p_role()
-
Returns reference to hash. The port role, keyed by component, MSTI and port.
(
ieee8021MstpPortRole) - $stp->mstp_p_bridge()
-
Returns reference to hash. The designated bridge ID, keyed by component, MSTI and port.
(
ieee8021MstpPortDesignatedBridge)
MSTP VLAN Table (ieee8021MstpVlanTable)
- $stp->mstp_vlan_msti()
-
Returns reference to hash. The MSTI each VLAN maps to, 0 for the CIST, keyed by component and VLAN.
(
ieee8021MstpVlanMstId)
Table Methods imported from SNMP::Info::Bridge
See "TABLE METHODS" in SNMP::Info::Bridge for details.