NAME

SNMP::Info::CiscoStpExtensions - SNMP Interface to CISCO-STP-EXTENSIONS-MIB

AUTHOR

Carlos Vicente

SYNOPSIS

my $stpx = new SNMP::Info(
                      AutoSpecify => 1,
                      Debug       => 1,
                      DestHost    => 'myswitch',
                      Community   => 'public',
                      Version     => 2
                    )

or die "Can't connect to DestHost.\n";

my $class = $stpx->class();
print " Using device sub class : $class\n";

DESCRIPTION

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 $stpx = new SNMP::Info::CiscoStpExtensions(...);

In the default context, i_stp_state() reports VLAN 1's tree under PVST+ and Rapid-PVST+, with rows for VLAN 1's member ports only. Under MST the BRIDGE-MIB globals are the CIST's and the port rows are again VLAN 1's member ports.

Inherited Classes

SNMP::Info
SNMP::Info::Bridge

Required MIBs

CISCO-STP-EXTENSIONS-MIB

GLOBALS

These are methods that return scalar values from SNMP

$stpx->stp_ver()

Returns the particular STP version running on this device. Meant to override SNMP::Info::Brigde::stp_ver()

Values: pvstPlus, mistp, mistpPvstPlus, mst, rapidPvstPlus

(stpxSpanningTreeType)

$stpx->hasPVST()

Returns 1 when stpxSpanningTreeType is pvstPlus.

$stpx->hasRapidPVST()

Returns 1 when stpxSpanningTreeType is rapidPvstPlus.

$stpx->hasMSTP()

Returns 1 when stpxSpanningTreeType is mst. The MST region and its instances are served under every mode, so they are not the test.

$stpx->context_kinds($feature)

See "context_kinds" in SNMP::Info. Returns ['vlan'] for stp: each VLAN's tree is served in that VLAN's context.

$stpx->snmp_context($kind, $id)

See "snmp_context" in SNMP::Info. A vlan context is reached as the community suffix @N under SNMPv2c and the context vlan-N under SNMPv3. No mst context is served.

TABLE METHODS

These are methods that return tables of information in the form of a reference to a hash.

$stpx->mst_config_digest()

Returns the Multiple Spanning Tree (MST) configuration digest

(stpxSMSTConfigDigest)

$stpx->mst_region_name()

Returns the Multiple Spanning Tree (MST) region name

(stpxMSTRegionName)

$stpx->mst_region_rev()

Returns the Multiple Spanning Tree (MST) region name

(stpxSMSTRegionRevision)

$stpx->mst_vlan2instance()

Returns the mapping of vlan to MST instance in the form of a hash reference with key = VLAN id, value = STP instance

$stpx->i_rootguard_enabled()

Returns 1 or 0 depending on whether RootGuard is enabled on a given port. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxRootGuardConfigEnabled)

$stpx->i_loopguard_enabled()

Returns 1 or 0 depending on whether LoopGuard is enabled on a given port. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxLoopGuardConfigEnabled)

$stpx->i_bpduguard_enabled()

Returns 1 or 0 depending on whether BpduGuard is enabled on a given port. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxFastStartPortBpduGuardMode)

$stpx->i_bpdufilter_enabled()

Returns 1 or 0 depending on whether BpduFilter is enabled on a given port. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxFastStartBpduFilterEnable)

$stpx->i_faststart_enabled()

Returns 1 or 0 depending on whether FastStart (aka PortFast) is enabled on a given port. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxFastStartPortEnable and stpxFastStartPortMode)

Spanning Tree Trees

These override "Spanning Tree Trees" in SNMP::Info::Bridge; records are as described there. The tree list, protocol, port roles and MST VLAN map are served in the default context; each tree's port states and designated bridge and port are served in BRIDGE-MIB in the tree's own context. To switch contexts, see "SNMP Contexts" in SNMP::Info.

Trees are keyed vlan.N (one per VLAN under PVST+ and Rapid-PVST+, with vlan the VLAN id), cist.0 and msti.N under MST. Each record's contexts lists where to read its ports: VLAN 1's tree is the default context's; an MSTI is read through the context of any VLAN mapped to it, and every such VLAN is listed. bridge is undef: IOS serves a placeholder dot1dBaseBridgeAddress, not the bridge address. root is set only where the default context serves it (vlan.1, cist.0); read stp_root() in a tree's context for the others. On IOS the CIST's trunk ports are served in no context, so cist.0 has ports_complete 0.

$stpx->stp_protocols()

Returns reference to an array holding pvst, rapid-pvst or mstp from stpxSpanningTreeType, or nothing (including under MISTP).

$stpx->stp_trees()

Returns reference to hash of tree records. Under PVST+ and Rapid-PVST+ the VLANs come from the index of (stpxFastStartOperModeTable) and (stpxRSTPPortRoleTable), or, where neither serves a row, from (stpxPVSTVlanEnable), keeping only VLANs whose vtpVlanType is ethernet where VTP is served. Under MST the instances come from (stpxSMSTInstanceTable).

$stpx->stp_trees_complete()

Returns 1 when trees were read, 0 otherwise.

$stpx->stp_vlan_map()

Returns reference to hash mapping each VLAN 1 to 4094 to its tree key under MST, from (stpxSMSTInstanceVlansMapped1k2k) and (stpxSMSTInstanceVlansMapped3k4k), as served; nothing under PVST+ and Rapid-PVST+, where each VLAN is its own tree.

$stpx->stp_tree_ports($tree_key)

Returns reference to hash of port records keyed by ifIndex, read in the session's current context: states and designated bridge and port from BRIDGE-MIB, and role (stpxRSTPPortRoleValue normalized by munge_stpx_port_role(), undef for a label it does not know) and role_raw (as served) from (stpxRSTPPortRoleTable) where the context serves it. IOL-L2 serves no role in a VLAN context, and PVST+ serves no role anywhere. Rows are labeled from $tree_key, never from the context string.

Call it in the default context for a tree whose contexts include kind none, or in one of the tree's own contexts. In the default context it refuses, with error() naming the contexts, a tree that is read elsewhere; in another context it cannot check the key against the list, and rows read in a context the tree does not list describe another tree.

$stpx->stpx_pvst_vlan_enable()

(stpxPVSTVlanEnable)

$stpx->stpx_faststart_oper()

(stpxFastStartOperMode)

$stpx->stpx_rstp_port_role()

(stpxRSTPPortRoleValue)

MUNGES

oct2str()

Unpacks H* into a string