get IPv6 neighbors via sshcollector from Cisco ASA (G. Rappenecker)
This commit is contained in:
1
Changes
1
Changes
@@ -3,6 +3,7 @@
|
|||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
* #323 c_ip only ever returns one IP per value
|
* #323 c_ip only ever returns one IP per value
|
||||||
|
* get IPv6 neighbors via sshcollector from Cisco ASA (G. Rappenecker)
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ App::Netdisco::SSHCollector::Platform::ASA
|
|||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Collect ARP entries from Cisco ASA devices.
|
Collect IPv4 ARP and IPv6 neighbor entries from Cisco ASA devices.
|
||||||
|
|
||||||
You will need the following configuration for the user to automatically enter
|
You will need the following configuration for the user to automatically enter
|
||||||
C<enable> status after login:
|
C<enable> status after login:
|
||||||
@@ -39,11 +39,13 @@ use Moo;
|
|||||||
|
|
||||||
=item B<arpnip($host, $ssh)>
|
=item B<arpnip($host, $ssh)>
|
||||||
|
|
||||||
Retrieve ARP entries from device. C<$host> is the hostname or IP address
|
Retrieve ARP and neighbor entries from device. C<$host> is the hostname or IP
|
||||||
of the device. C<$ssh> is a Net::OpenSSH connection to the device.
|
address of the device. C<$ssh> is a Net::OpenSSH connection to the device.
|
||||||
|
|
||||||
Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>.
|
Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub arpnip {
|
sub arpnip {
|
||||||
@@ -92,6 +94,24 @@ sub arpnip {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# start ipv6
|
||||||
|
$expect->send("show ipv6 neighbor\n");
|
||||||
|
($pos, $error, $match, $before, $after) = $expect->expect(60, -re, $prompt);
|
||||||
|
|
||||||
|
@lines = split(m/\n/, $before);
|
||||||
|
|
||||||
|
# IPv6 age MAC state ifname
|
||||||
|
$linereg = qr/([0-9a-fA-F\:]+)\s+[0-9]+\s
|
||||||
|
([0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4})/x;
|
||||||
|
|
||||||
|
foreach my $line (@lines) {
|
||||||
|
if ($line =~ $linereg) {
|
||||||
|
my ($ip, $mac) = ($1, $2);
|
||||||
|
push @arpentries, { mac => $mac, ip => $ip };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# end ipv6
|
||||||
|
|
||||||
$expect->send("exit\n");
|
$expect->send("exit\n");
|
||||||
$expect->soft_close();
|
$expect->soft_close();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user