diff --git a/Changes b/Changes index eb13692f..4b891e59 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ [ENHANCEMENTS] * #302 Device searching now searches on module serial numbers + * #298 NXOS SSHCollector and note in docs about VRFs 2.034003 - 2017-04-14 diff --git a/lib/App/Netdisco/Manual/Vendors.pod b/lib/App/Netdisco/Manual/Vendors.pod index 9287dbc7..a47deb29 100644 --- a/lib/App/Netdisco/Manual/Vendors.pod +++ b/lib/App/Netdisco/Manual/Vendors.pod @@ -12,6 +12,14 @@ The LLDP configuration should look like: interface all; } +=head1 VRFs and NXOS + +Netdsico at this time does not support VRFs. In particular, overlapping IP +address spaces will not be shown in the interface. + +However if you're running Cisco NXOS and do not have overlapping IP address +space, then you can use the NXOS SSHCollector profile for that platform. + =head1 Report Cisco 37xx as Single Device Instead of Stacked Add this to your 37xx config: diff --git a/lib/App/Netdisco/SSHCollector/Platform/NXOS.pm b/lib/App/Netdisco/SSHCollector/Platform/NXOS.pm new file mode 100644 index 00000000..d9fa28ec --- /dev/null +++ b/lib/App/Netdisco/SSHCollector/Platform/NXOS.pm @@ -0,0 +1,61 @@ +package App::Netdisco::SSHCollector::Platform::NXOS; + +# vim: set expandtab tabstop=8 softtabstop=4 shiftwidth=4: + +=head1 NAME + +App::Netdisco::SSHCollector::Platform::NXOS + +=head1 DESCRIPTION + +Collect ARP entries from Cisco NXOS devices. + +=cut + +use strict; +use warnings; + +use Dancer ':script'; +use Moo; + +=head1 PUBLIC METHODS + +=over 4 + +=item B + +Retrieve ARP entries from device. C<$host> is the hostname or IP 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 } >>. + +=cut + +sub arpnip { + my ($self, $hostlabel, $ssh, $args) = @_; + + debug "$hostlabel $$ arpnip()"; + my @data = $ssh->capture("show ip arp vrf all"); + + chomp @data; + my @arpentries; + + #IP ARP Table for all contexts + #Total number of entries: 5 + #Address Age MAC Address Interface + #192.168.228.1 00:00:43 0000.abcd.1111 mgmt0 + #192.168.228.9 00:05:24 cccc.7777.1b1b mgmt0 + + foreach (@data) { + my ($ip, $age, $mac, $iface) = split(/\s+/); + + if ($ip && $ip =~ m/(\d{1,3}\.){3}\d{1,3}/ + && $mac =~ m/([0-9a-f]{4}\.){2}[0-9a-f]{4}/i) { + push(@arpentries, { ip => $ip, mac => $mac }); + } + } + + return @arpentries; +} + +1;