From bc5a62dcbda24de18ef4baa148d24bb793f1314b Mon Sep 17 00:00:00 2001 From: paulierco Date: Sat, 3 Jul 2021 16:23:58 +0300 Subject: [PATCH] Alcatel-Lucent aos7 LLDP Neighbors (#12886) * first commit * fix style * fix style * fix style * fix style * fix style * fix style * fix style * change local_port_id * fix style * fix style * fix style --- .../discovery/discovery-protocols.inc.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 076d27745e..2114c77d9d 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -221,20 +221,29 @@ if (($device['os'] == 'routeros')) { } } } - - $dot1d_array = snmpwalk_group($device, 'dot1dBasePortIfIndex', 'BRIDGE-MIB'); - $lldp_ports = snmpwalk_group($device, 'lldpLocPortId', 'LLDP-MIB'); + if (($device['os'] == 'aos7')) { + $lldp_local = snmpwalk_cache_oid($device, 'lldpLocPortEntry', [], 'LLDP-MIB'); + $lldp_ports = snmpwalk_group($device, 'lldpLocPortId', 'LLDP-MIB'); + } else { + $dot1d_array = snmpwalk_group($device, 'dot1dBasePortIfIndex', 'BRIDGE-MIB'); + $lldp_ports = snmpwalk_group($device, 'lldpLocPortId', 'LLDP-MIB'); + } } foreach ($lldp_array as $key => $lldp_if_array) { foreach ($lldp_if_array as $entry_key => $lldp_instance) { - if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex'])) { + if (($device['os'] == 'aos7')) { + $ifName = $lldp_local[$entry_key]['lldpLocPortDesc']; + } elseif (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex'])) { $ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex']; } else { $ifIndex = $entry_key; } - - $local_port_id = find_port_id($lldp_ports[$entry_key]['lldpLocPortId'], $ifIndex, $device['device_id']); + if (($device['os'] == 'aos7')) { + $local_port_id = find_port_id($ifName, null, $device['device_id']); + } else { + $local_port_id = find_port_id($lldp_ports[$entry_key]['lldpLocPortId'], $ifIndex, $device['device_id']); + } $interface = get_port_by_id($local_port_id); d_echo($lldp_instance);