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
This commit is contained in:
paulierco
2021-07-03 16:23:58 +03:00
committed by GitHub
parent 7e2ce6179a
commit bc5a62dcbd

View File

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