lldp fix for nxos6 #372 (#375)

* 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:
nick n
2020-10-28 11:54:25 +01:00
committed by GitHub
parent a263f54744
commit 39b5b3af9f
2 changed files with 38 additions and 8 deletions

View File

@@ -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