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)

Legacy; see i_edgeport_admin().

$stpx->i_edgeport_admin()

Returns 1 or 0 depending on whether the port is configured as an edge port (FastStart, aka PortFast). A port in network mode returns 0, and a port with no configured value is absent. Cisco can only report ports that appear in the bridge table (bp_index()) of the context being polled. On IOS under PVST+ the default context lists only VLAN 1 ports and trunks; ports in other VLANs need the per-VLAN context. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxFastStartPortEnable and stpxFastStartPortMode)

$stpx->i_edgeport_oper()

Returns 1 or 0 depending on whether the port is operating as an edge port (FastStart, aka PortFast). Under PVST+ and Rapid-PVST+ the value is read from the tree of the port's native VLAN (the access VLAN on an access port, from i_vlan()); a trunk whose native VLAN has no row, or a port with no i_vlan() entry, is absent. Under MST the value is read from instance 0. A port in network mode returns 0. Under any other protocol the result is empty. Cisco can only report ports that appear in the bridge table (bp_index()) of the context being polled. On IOS under PVST+ the default context lists only VLAN 1 ports and trunks; ports in other VLANs need the per-VLAN context. Format is a hash reference with key = ifIndex, value = [1|0]

(stpxFastStartOperMode)

Spanning Tree Trees

These override "Spanning Tree Trees" in SNMP::Info::Bridge, where the records are described. The tree list, the protocol, the port roles and the MST VLAN map are served in the default context. Each tree's port states and designated bridges and ports are served in BRIDGE-MIB in the tree's own context; to switch, see "SNMP Contexts" in SNMP::Info.

The tree records:

Keys

vlan.N for each VLAN under PVST+ and Rapid-PVST+. cist.0 and msti.N under MST.

vlan

The VLAN id, on vlan.N trees.

protocol

pvst, rapid-pvst or mstp, from stpxSpanningTreeType.

measured

1 on IOS and IOS XE, and on NX-OS except under PVST+. 0 otherwise.

ports_complete

0 for cist.0, on every platform: IOS serves the CIST's trunk ports in no context. 1 for every other tree.

contexts
  • vlan.1: the default context.

  • Another vlan.N: VLAN N's context.

  • msti.N: first the instance's own mst context, where snmp_context('mst', N) gives one (SNMP::Info::Layer3::Nexus). Then the context of each VLAN mapped to the instance, VLAN 1 as the default context. Where v_index() lists VLANs, only those are used.

  • cist.0: the instance's own mst context where there is one, else the default context.

bridge

Undef: IOS serves a placeholder dot1dBaseBridgeAddress, not the bridge address.

root

Only on vlan.1 and cist.0, from dot1dStpDesignatedRoot in the default context. Undef on other trees: read stp_root() in the tree's context.

The port records:

state, enabled, designated_bridge, designated_port

From BRIDGE-MIB in the context being read.

role, role_raw

From stpxRSTPPortRoleValue where the context serves it, normalized by munge_stpx_port_role(). PVST+ serves no role, and some IOS images serve none in a VLAN context.

$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: one per VLAN that runs spanning tree under PVST+ and Rapid-PVST+, one per MST instance under MST.

(stpxFastStartOperModeTable, stpxRSTPPortRoleTable and, where neither serves a row, stpxPVSTVlanEnable with vtpVlanType; stpxSMSTInstanceTable under MST)

$stpx->stp_trees_complete()

Returns 1 or 0, as "Spanning Tree Trees" in SNMP::Info::Bridge describes. 0 when no tree is listed, as when the device names no protocol this class reads, and when a walk of the tables that list the trees was incomplete.

$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. Rows are labeled from $tree_key, never from the context.

  • In the default context, pass a tree whose contexts include the default context. For any other tree it returns nothing, with error() naming the tree's contexts.

  • In another context, it cannot check the key against the tree list. Pass a tree whose contexts list this context: rows read in any other context 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