Workaround issues with lldp information from GS108Tv1 (#13971)

The GS108Tv1 doesn't present the same information over snmp as they do
over lldp. This tries to detect such a remote device and figure out
which remote port we actually should map it to.
This commit is contained in:
Anton Lundin
2022-05-23 13:10:28 +03:00
committed by GitHub
parent e34e6e07a5
commit f40693b503
@@ -347,6 +347,18 @@ if (($device['os'] == 'routeros')) {
$remote_port_name = (string) ($n_slot * 1000 + $n_port);
}
if ($remote_device['os'] == 'netgear' &&
$remote_device['sysDescr'] == 'GS108T' &&
$lldp['lldpRemSysDesc'] == 'Smart Switch') {
// Some netgear switches, as Netgear GS108Tv1 presents it's port name over snmp as
// "Port 1 Gigabit Ethernet" but as 'lldpRemPortId' => 'g1' and
// 'lldpRemPortDesc' => 'Port #1' over lldp.
// So remap g1 to 1 so it matches ifIndex
if (preg_match("/^g(\d+)$/", $lldp['lldpRemPortId'], $matches)) {
$remote_port_name = $matches[1];
}
}
$remote_port_id = find_port_id(
$lldp['lldpRemPortDesc'],
$remote_port_name,