diff --git a/Changes b/Changes index 6d65b3fc..b74bdd6e 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +version 3.46 () + + [ENHANCEMENTS] + + * Add method to get err-disable cause for interfaces on Cisco + version 3.45 (2018-02-14) [ENHANCEMENTS] diff --git a/lib/SNMP/Info/CiscoPortSecurity.pm b/lib/SNMP/Info/CiscoPortSecurity.pm index b0a76b1f..a34d2fcb 100644 --- a/lib/SNMP/Info/CiscoPortSecurity.pm +++ b/lib/SNMP/Info/CiscoPortSecurity.pm @@ -44,6 +44,7 @@ $VERSION = '3.45'; 'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB', 'CISCO-PAE-MIB' => 'ciscoPaeMIB', 'IEEE8021-PAE-MIB' => 'dot1xAuthLastEapolFrameSource', + 'CISCO-ERR-DISABLE-MIB' => 'ciscoErrDisableMIB', ); %GLOBALS = ( @@ -99,6 +100,9 @@ $VERSION = '3.45'; # IEEE8021-PAE-MIB::dot1xPaePortEntry 'pae_i_capabilities' => 'dot1xPaePortCapabilities', 'pae_i_last_eapol_frame_source' => 'dot1xAuthLastEapolFrameSource', + + # CISCO-ERR-DISABLE-MIB::cErrDisableIfStatusEntry + 'cerr_i_cause' => 'cErrDisableIfStatusCause', ); %MUNGE = ( @@ -123,13 +127,29 @@ sub munge_pae_capabilities { return join( ' ', @vals ); } +# Define a generic method to show the cause for a port to be err-disabled. +# Cisco indexes cErrDisableIfStatusCause by {ifindex,vlan}, but for a more +# generic method, using ifIndex only makes it easier to implement across +# device classes. Besides, several (most?) err-disable features will disable +# the whole interface anyway, and not just a vlan on the interface. +sub i_err_disable_cause { + my $cps = shift; + my $ret; + my $causes = $cps->cerr_i_cause() || {}; + foreach my $interfacevlan (keys %$causes) { + my ($iid, $vid) = split(/\./, $interfacevlan); + $ret->{$iid} = $causes->{$interfacevlan}; + } + return $ret; +} + 1; __END__ =head1 NAME SNMP::Info::CiscoPortSecurity - SNMP Interface to data from -F and F +F, F and F. =head1 AUTHOR @@ -153,8 +173,9 @@ Eric Miller =head1 DESCRIPTION SNMP::Info::CiscoPortSecurity is a subclass of SNMP::Info that provides -an interface to the F and F. These -MIBs are used across the Catalyst family under CatOS and IOS. +an interface to the F, F and +F. These MIBs are used across the Catalyst +family under CatOS and IOS. Use or create in a subclass of SNMP::Info. Do not use directly. @@ -172,6 +193,8 @@ None. =item F +=item F + =back =head1 GLOBALS @@ -374,6 +397,31 @@ The source MAC address carried in the most recently received EAPOL frame. =back +=head2 C + +=over + +=item $cps->cerr_i_cause() + +C + +Indicates the feature/event that caused the {interface, vlan} (or the entire +interface) to be error-disabled. + +=back + +=head1 METHODS + +=over + +=item C + +Returns a HASH reference mapping ifIndex to err-disabled cause. The returned +data is sparse, so if the ifIndex is not present in the return value, the port +is not err-disabled. + +=back + =head1 Data Munging Callback Subroutines =over