Add method to show err-disable cause on Cisco (#248)
Method i_err_disable_cause implemented on CiscoPortSecurity.pm. Returns sparse data: ifIndex -> textual err-disable cause, for interfaces that are err-disabled.
This commit is contained in:
6
Changes
6
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)
|
version 3.45 (2018-02-14)
|
||||||
|
|
||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ $VERSION = '3.45';
|
|||||||
'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
|
'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
|
||||||
'CISCO-PAE-MIB' => 'ciscoPaeMIB',
|
'CISCO-PAE-MIB' => 'ciscoPaeMIB',
|
||||||
'IEEE8021-PAE-MIB' => 'dot1xAuthLastEapolFrameSource',
|
'IEEE8021-PAE-MIB' => 'dot1xAuthLastEapolFrameSource',
|
||||||
|
'CISCO-ERR-DISABLE-MIB' => 'ciscoErrDisableMIB',
|
||||||
);
|
);
|
||||||
|
|
||||||
%GLOBALS = (
|
%GLOBALS = (
|
||||||
@@ -99,6 +100,9 @@ $VERSION = '3.45';
|
|||||||
# IEEE8021-PAE-MIB::dot1xPaePortEntry
|
# IEEE8021-PAE-MIB::dot1xPaePortEntry
|
||||||
'pae_i_capabilities' => 'dot1xPaePortCapabilities',
|
'pae_i_capabilities' => 'dot1xPaePortCapabilities',
|
||||||
'pae_i_last_eapol_frame_source' => 'dot1xAuthLastEapolFrameSource',
|
'pae_i_last_eapol_frame_source' => 'dot1xAuthLastEapolFrameSource',
|
||||||
|
|
||||||
|
# CISCO-ERR-DISABLE-MIB::cErrDisableIfStatusEntry
|
||||||
|
'cerr_i_cause' => 'cErrDisableIfStatusCause',
|
||||||
);
|
);
|
||||||
|
|
||||||
%MUNGE = (
|
%MUNGE = (
|
||||||
@@ -123,13 +127,29 @@ sub munge_pae_capabilities {
|
|||||||
return join( ' ', @vals );
|
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;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
SNMP::Info::CiscoPortSecurity - SNMP Interface to data from
|
SNMP::Info::CiscoPortSecurity - SNMP Interface to data from
|
||||||
F<CISCO-PORT-SECURITY-MIB> and F<CISCO-PAE-MIB>
|
F<CISCO-PORT-SECURITY-MIB>, F<CISCO-PAE-MIB> and F<CISCO-ERR-DISABLE-MIB>.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
@@ -153,8 +173,9 @@ Eric Miller
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
SNMP::Info::CiscoPortSecurity is a subclass of SNMP::Info that provides
|
SNMP::Info::CiscoPortSecurity is a subclass of SNMP::Info that provides
|
||||||
an interface to the F<CISCO-PORT-SECURITY-MIB> and F<CISCO-PAE-MIB>. These
|
an interface to the F<CISCO-PORT-SECURITY-MIB>, F<CISCO-PAE-MIB> and
|
||||||
MIBs are used across the Catalyst family under CatOS and IOS.
|
F<CISCO-ERR-DISABLE-MIB>. 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.
|
Use or create in a subclass of SNMP::Info. Do not use directly.
|
||||||
|
|
||||||
@@ -172,6 +193,8 @@ None.
|
|||||||
|
|
||||||
=item F<IEEE8021-PAE-MIB>
|
=item F<IEEE8021-PAE-MIB>
|
||||||
|
|
||||||
|
=item F<CISCO-ERR-DISABLE-MIB>
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head1 GLOBALS
|
=head1 GLOBALS
|
||||||
@@ -374,6 +397,31 @@ The source MAC address carried in the most recently received EAPOL frame.
|
|||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
=head2 C<CISCO-ERR-DISABLE-MIB::cErrDisableIfStatusEntry>
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item $cps->cerr_i_cause()
|
||||||
|
|
||||||
|
C<cErrDisableIfStatusCause>
|
||||||
|
|
||||||
|
Indicates the feature/event that caused the {interface, vlan} (or the entire
|
||||||
|
interface) to be error-disabled.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 METHODS
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item C<i_err_disable_cause>
|
||||||
|
|
||||||
|
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
|
=head1 Data Munging Callback Subroutines
|
||||||
|
|
||||||
=over
|
=over
|
||||||
|
|||||||
Reference in New Issue
Block a user