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

SNMP::Info::Bridge

Required MIBs

IEEE8021-SPANNING-TREE-MIB
IEEE8021-MSTP-MIB

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() reports stp, else 0. That hook reads ieee8021SpanningTreeVersion by default, and a class may override it.

$stp->hasRSTP()

Returns 1 when _ieee_stp_protocol() reports rstp, else 0. That hook reads ieee8021SpanningTreeVersion by default, and a class may override it.

$stp->hasMSTP()

Returns 1 when _ieee_stp_protocol() reports mstp, else 0. That hook reads ieee8021SpanningTreeVersion by 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

bridge from ieee8021MstpCistBridgeIdentifier, root from ieee8021SpanningTreeDesignatedRoot.

msti.N

One per ieee8021MstpTable row. bridge from ieee8021MstpBridgeId, root from ieee8021MstpDesignatedRoot.

ports_complete is 0 when a port row of the tree is on a bridge port missing from bp_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_key names. Sets error() and returns nothing for a key stp_trees() does not hold. Otherwise returns what SNMP::Info::Bridge returns.

cist.0

state from ieee8021SpanningTreePortState. role_raw is ieee8021MstpCistPortRole as served, and role is it when it is root, alternate, designated or backup, else undef. enabled from ieee8021SpanningTreePortEnabled, and the designated bridge and port from ieee8021SpanningTreePortDesignatedBridge and ieee8021SpanningTreePortDesignatedPort.

msti.N

state from ieee8021MstpPortState, role and role_raw from ieee8021MstpPortRole, enabled from the same port's ieee8021SpanningTreePortEnabled, and designated_bridge from ieee8021MstpPortDesignatedBridge. designated_port is 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 from ieee8021MstpCistPortAdminEdgePort when 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, from ieee8021SpanningTreeRstpPortOperEdgePort or ieee8021MstpCistPortOperEdgePort.

$stp->stp_trees_complete()

Under MSTP, returns 1 when stp_trees() holds trees and the ieee8021MstpTable and ieee8021MstpCistPortTable walks 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.0 or msti.N, from ieee8021MstpVlanMstId. 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.