#263 discover neighbors advertising ipv6 management addresses

This commit is contained in:
Oliver Gorwits
2017-06-24 19:41:57 +01:00
parent 4ad9497784
commit 39927dee68
2 changed files with 11 additions and 2 deletions

View File

@@ -710,7 +710,15 @@ sub store_neighbors {
_set_manual_topology($device, $snmp);
my $c_ip = $snmp->c_ip;
unless ($snmp->hasCDP or scalar keys %$c_ip) {
my %c_ipv6 = %{ ($snmp->can('hasLLDP') and $snmp->hasLLDP)
? $snmp->lldp_ipv6 : {} };
# remove keys with undef values, as c_ip does
delete @c_ipv6{ grep { not defined $c_ipv6{$_} } keys %c_ipv6 };
# now combine them, v6 wins
$c_ip = { %$c_ip, %c_ipv6 };
unless (($snmp->can('hasCDP') and $snmp->hasCDP) or scalar keys %$c_ip) {
debug sprintf ' [%s] neigh - CDP/LLDP not enabled!', $device->ip;
return @to_discover;
}