* first part of fix for #372 makes lldp stop using lldpLocPortDesc directly but maps it to a function start framework to allow nexus.pm to overwrite that function for nx-os6 * second part of fix for #372 make nx-os 6 return lldpLocPortId for lldp_lport_desc * munge_null and whitespace nits
This commit is contained in:
@@ -55,10 +55,13 @@ $VERSION = '3.70';
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
|
||||
# LLDP-MIB::lldpLocManAddrTable
|
||||
'lldp_lman_addr' => 'lldpLocManAddrIfId',
|
||||
|
||||
# LLDP-MIB::LldpLocPortEntry
|
||||
'lldp_lport_id' => 'lldpLocPortId',
|
||||
'lldp_lport_desc' => 'lldpLocPortDesc',
|
||||
|
||||
# LLDP-MIB::lldpRemTable
|
||||
'lldp_rem_id_type' => 'lldpRemChassisIdSubtype',
|
||||
'lldp_rem_id' => 'lldpRemChassisId',
|
||||
@@ -92,6 +95,8 @@ $VERSION = '3.70';
|
||||
'lldp_rem_sysname' => \&SNMP::Info::munge_null,
|
||||
'lldp_rem_sysdesc' => \&SNMP::Info::munge_null,
|
||||
'lldp_rem_port_desc' => \&SNMP::Info::munge_null,
|
||||
'lldp_lport_id' => \&SNMP::Info::munge_null,
|
||||
'lldp_lport_desc' => \&SNMP::Info::munge_null,
|
||||
'lldp_sys_cap' => \&SNMP::Info::munge_bits,
|
||||
'lldp_rem_sys_cap' => \&SNMP::Info::munge_bits,
|
||||
'lldp_rem_cap_spt' => \&SNMP::Info::munge_bits,
|
||||
@@ -146,7 +151,11 @@ sub lldp_if {
|
||||
# ifAlias because using cross ref with description is correct
|
||||
# behavior according to the LLDP-MIB. Some devices (eg H3C gear)
|
||||
# seem to use ifAlias though.
|
||||
my $lldp_desc = $lldp->lldpLocPortDesc($port);
|
||||
# snmp::info #372 -> to make things even more complex some devices
|
||||
# have different behaviour depending on os version (nx-os 6 vs 7)
|
||||
# so we made this a function to allow overrides in more specific
|
||||
# modules
|
||||
my $lldp_desc = $lldp->lldp_lport_desc($port);
|
||||
my $desc = $lldp_desc->{$port};
|
||||
|
||||
# If cross reference is successful use it, otherwise stick with
|
||||
|
||||
@@ -40,7 +40,7 @@ our ($VERSION, %GLOBALS, %MIBS, %FUNCS, %MUNGE);
|
||||
@SNMP::Info::Layer3::Nexus::ISA = qw/
|
||||
SNMP::Info::Layer3::CiscoSwitch
|
||||
Exporter
|
||||
/;
|
||||
/;
|
||||
|
||||
@SNMP::Info::Layer3::Nexus::EXPORT_OK = qw//;
|
||||
|
||||
@@ -53,14 +53,14 @@ $VERSION = '3.70';
|
||||
# The @ISA order should be reverse of these orders.
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MIBS,
|
||||
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevMIBObjects',
|
||||
'CISCO-CONTEXT-MAPPING-MIB' => 'cContextMappingMIBObjects',
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MIBS,
|
||||
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevMIBObjects',
|
||||
'CISCO-CONTEXT-MAPPING-MIB' => 'cContextMappingMIBObjects',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::GLOBALS,
|
||||
'mac' => 'dot1dBaseBridgeAddress',
|
||||
%SNMP::Info::Layer3::CiscoSwitch::GLOBALS,
|
||||
'mac' => 'dot1dBaseBridgeAddress',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
@@ -137,6 +137,21 @@ sub model {
|
||||
return $model;
|
||||
}
|
||||
|
||||
# nx-os 6 seems to swap the data of lldpLocPortDesc with that of
|
||||
# lldpLocPortId, so remap it to make the main lldp module happy.
|
||||
# nx-os 7 behaves as expected.
|
||||
sub lldp_lport_desc {
|
||||
my $nexus = shift;
|
||||
my $osver = $nexus->os_ver();
|
||||
|
||||
if (defined ($osver)) {
|
||||
if ($osver =~ /^6.*/) {
|
||||
return $nexus->SUPER::lldp_lport_id();
|
||||
}
|
||||
}
|
||||
return $nexus->SUPER::lldp_lport_desc();
|
||||
}
|
||||
|
||||
# Reported version 6.x of NX-OS doesn't use the IPv4 address as index
|
||||
# override methods in ipAddrTable
|
||||
sub ip_table {
|
||||
@@ -377,6 +392,12 @@ Gives broadcast address for IP table entry.
|
||||
|
||||
(C<ipAdEntBcastAddr>)
|
||||
|
||||
=item $nexus->lldp_lport_desc()
|
||||
|
||||
On nx-os 6 only this will return data from C<lldpLocPortId> instead of
|
||||
the expected C<lldpLocPortDesc>. For all other nx-os versions uses the
|
||||
function from L<SNMP::Info::LLDP>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
Reference in New Issue
Block a user