If the port ID claims to be interfaceName, use it for lldp_port
The LLDP spec says that if lldpRemPortIdSubtype is "interface name", then lldpRemPortId should contain ifName. It doesn't say much about lldpRemPortDesc; some vendors seem to always leave it empty, some use the interface description / ifAlias. Our algorithm for lldp_port is now basically: If we find that lldpRemPortIdSubtype is "interface name", then use the lldpRemPortId, else use lldpRemPortDesc if set, else use lldpRemPortId.
This commit is contained in:
@@ -168,10 +168,15 @@ sub lldp_port {
|
||||
my %lldp_port;
|
||||
foreach my $key ( sort keys %$pid ) {
|
||||
my $port = $pdesc->{$key};
|
||||
my $type = $ptype->{$key};
|
||||
if ( $type and $type eq 'interfaceName' ) {
|
||||
# If the pid claims to be an interface name,
|
||||
# believe it.
|
||||
$port = $pid->{$key};
|
||||
}
|
||||
unless ($port) {
|
||||
$port = $pid->{$key};
|
||||
next unless $port;
|
||||
my $type = $ptype->{$key};
|
||||
next unless $type;
|
||||
|
||||
# May need to format other types in the future, i.e. Network address
|
||||
|
||||
Reference in New Issue
Block a user