diff --git a/Netdisco/Changes b/Netdisco/Changes index 117ba8f9..f973a84b 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,3 +1,9 @@ +2.028013 + + [ENHANCEMENTS] + + * [#122] CDP/LLDP discovery for some HP switches (M. Kosmach) + 2.028012 - 2014-07-22 [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Core/Discover.pm b/Netdisco/lib/App/Netdisco/Core/Discover.pm index dbacbbdd..48ead720 100644 --- a/Netdisco/lib/App/Netdisco/Core/Discover.pm +++ b/Netdisco/lib/App/Netdisco/Core/Discover.pm @@ -730,7 +730,22 @@ sub store_neighbors { if (!defined $neigh) { my $mac = Net::MAC->new(mac => $remote_id, 'die' => 0, verbose => 0); if (not $mac->get_error) { - $neigh = $devices->single({mac => $remote_id}); + $neigh = $devices->single({mac => $mac->as_IEEE()}); + } + } + + # some HP switches send 127.0.0.1 as remote_ip if no ip address + # on default vlan for HP switches remote_ip looks like + # "myswitchname(012345-012345)" + if (!defined $neigh) { + (my $tmpid = $remote_id) =~ s/.([0-9a-f]{6})-([0-9a-f]{6})./$1$2/; + my $mac = Net::MAC->new(mac => $tmpid, 'die' => 0, verbose => 0); + + if (not $mac->get_error) { + info sprintf + '[%s] neigh - found neighbor %s by MAC %s', + $device->ip, $remote_id, $mac->as_IEEE(); + $neigh = $devices->single({mac => $mac->as_IEEE()}); } }