From d7047bda13cfb39426c67ddee6c422822e584545 Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Tue, 11 Nov 2014 22:55:30 -0500 Subject: [PATCH] Add methods to gather PVST information in L3::Foundry --- Info/Layer3/Foundry.pm | 69 ++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/Info/Layer3/Foundry.pm b/Info/Layer3/Foundry.pm index 8166849f..2f122c6c 100644 --- a/Info/Layer3/Foundry.pm +++ b/Info/Layer3/Foundry.pm @@ -97,6 +97,24 @@ $VERSION = '3.20'; # FOUNDRY-SN-AGENT-MIB::snAgentConfigModuleTable 'ag_mod_type' => 'snAgentConfigModuleType', + # FOUNDRY-SN-AGENT-MIB::snVLanByPortTable + 'stp_i_id' => 'snVLanByPortVLanId', + 'stp_i_mac' => 'snVLanByPortBaseBridgeAddress', + 'stp_i_time' => 'snVLanByPortStpTimeSinceTopologyChange', + 'stp_i_ntop' => 'snVLanByPortStpTopChanges', + 'stp_i_root' => 'snVLanByPortStpDesignatedRoot', + 'stp_i_root_port' => 'snVLanByPortStpRootPort', + 'stp_i_priority' => 'snVLanByPortStpPriority', + + # FOUNDRY-SN-AGENT-MIB::snPortStpTable + 'stp_p_id' => 'snPortStpPortNum', + 'stp_p_stg_id' => 'snPortStpVLanId', + 'stp_p_priority' => 'snPortStpPortPriority', + 'stp_p_state' => 'snPortStpPortState', + 'stp_p_cost' => 'snPortStpPortDesignatedCost', + 'stp_p_root' => 'snPortStpPortDesignatedRoot', + 'stp_p_bridge' => 'snPortStpPortDesignatedBridge', + 'stp_p_port' => 'snPortStpPortDesignatedPort', ); %MUNGE = ( @@ -106,6 +124,11 @@ $VERSION = '3.20'; 'ag_mod2_type' => \&SNMP::Info::munge_e_type, 'ag_mod_type' => \&SNMP::Info::munge_e_type, + 'stp_i_mac' => \&SNMP::Info::munge_prio_mac, + 'stp_i_root' => \&SNMP::Info::munge_prio_mac, + 'stp_p_root' => \&SNMP::Info::munge_prio_mac, + 'stp_p_bridge' => \&SNMP::Info::munge_prio_mac, + 'stp_p_port' => \&SNMP::Info::munge_prio_port, ); sub i_ignore { @@ -277,20 +300,6 @@ sub interfaces { return $i_descr; } -# Reported hangs on a EdgeIron 24G -sub stp_p_state { - my $foundry = shift; - my $partial = shift; - - my $descr = $foundry->description(); - if ( $descr =~ m/\bEdgeIron 24G\b/ ) { - return; - } - - return $foundry->SUPER::stp_p_state($partial) || {}; - -} - # Entity MIB is supported on the Brocade NetIron XMR, NetIron MLX, MLXe, # NetIron CES, NetIron CER, and older EdgeIron series devices. # Try Entity MIB methods first and fall back to Pseudo ENTITY-MIB methods for @@ -817,6 +826,26 @@ sub agg_ports { return $ret; } +sub i_stp_state { + my $foundry = shift; + my $partial = shift; + + my $bp_index = $foundry->bp_index($partial); + my $stp_p_state = $foundry->dot1dStpPortState($partial); + + my %i_stp_state; + + foreach my $index ( keys %$stp_p_state ) { + my $state = $stp_p_state->{$index}; + my $iid = $bp_index->{$index}; + next unless defined $iid; + next unless defined $state; + $i_stp_state{$iid} = $state; + } + + return \%i_stp_state; +} + 1; __END__ @@ -1007,14 +1036,10 @@ Returns reference to hash of interface link duplex status. Crosses $foundry->sw_duplex() with $foundry->sw_index() -=item $foundry->stp_p_state() - -"The port's current state as defined by application of the Spanning Tree -Protocol. - -Skipped if device is an EdgeIron 24G due to reports of hangs. - -(C) +=item $foundry->i_stp_state() + +Returns the mapping of (C) to the interface +index (iid). =item $foundry->agg_ports()