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

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