NAME
App::Netdisco::SSHCollector::Platform::NXOS
DESCRIPTION
Collect ARP, MAC table, and connected subnet data from Cisco NXOS devices.
PUBLIC METHODS
- arpnip($host, $ssh)
-
Retrieve ARP entries from device.
$hostis the hostname or IP address of the device.$sshis a Net::OpenSSH connection to the device.Returns a list of hashrefs in the format
{ mac => MACADDR, ip => IPADDR }. Entries from all VRFs are flattened into a single returned list. Example:[ { ip => '192.0.2.10', mac => '0011.2233.4455' }, { ip => '2001:db8::1', mac => 'aabb.ccdd.eeff' } ]. - arpnip_by_vrf($host, $ssh, $args)
-
As
arpnip, used whenstore_vrfsis on. Readsshow vrf | json, then sends theshow ip arp vrf NAME | jsonandshow ipv6 neighbor vrf NAME | jsoncommands of the listed VRFs chained with;, at most 16 commands and 640 bytes per exec request, and names each entry's VRF from the list (defaultis''). Each reply document is assigned by its own VRF name and table shape, not its position. A VRF's family is read whole only when exactly one document for it decodes and holds as many rows as its own count (cnt-totalfor ARP,countfor IPv6); a request that fails, or a document that does not decode, leaves the VRF and families after it unread. VRF names that differ only in case are all 0 and never queried, and makevrf_list_complete0. Rows without a MAC (INCOMPLETE) are skipped but count as rows. Link-local neighbors are kept.Returns
{ entries => [ { ip, mac, vrf } ], vrf_read => { VRF => 0|1 }, vrf_list_complete => 0|1, families => [4, 6] }, or undef whenshow vrf | jsonfails or lists no VRF. A list row with no usable name, or a list withoutdefault, makesvrf_list_complete0; the global table is read either way. A VRF namedallis 0 and is never queried. A VRF is 1 only when both families were read whole.A subclass that overrides
arpnipmust also overridearpnip_by_vrf, or withstore_vrfson thisarpnip_by_vrfis used instead of the override. - macsuck($host, $ssh)
-
Retrieve MAC address table entries from device.
$hostis the hostname or IP address of the device.$sshis a Net::OpenSSH connection to the device.Returns a hashref keyed by VLAN and interface, where leaf keys are MAC addresses, in the format
{ VLAN => { PORT => { MACADDR => COUNT } } }. Example:{ 10 => { 'Ethernet1/1' => { '00:11:22:33:44:55' => 1 } }, 20 => { 'port-channel12' => { 'aa:bb:cc:dd:ee:ff' => 2 } } }. - subnets($host, $ssh)
-
Retrieve directly connected IPv4 subnets from device routing tables.
$hostis the hostname or IP address of the device.$sshis a Net::OpenSSH connection to the device.Returns a list of IPv4 CIDR strings in the format
X.X.X.X/NN. Example:[ '10.1.1.0/24', '192.0.2.0/25' ]. - subnets_by_vrf($host, $ssh, $args)
-
As
subnets, used whenstore_vrfsis on, and reading IPv6 as well. Sendsshow ip route direct vrf all | jsonandshow ipv6 route direct vrf all | json, each as one exec request (no pty), and names each prefix's VRF fromvrf-name-out(the worker mapsdefaultto'').directlists only connected and local-direct routes, so no default or learned route is returned, but host routes (/32,/128) are: the worker filters them. VRF names, such asegress-loadbalance-resolution-, are passed through as the device prints them. Where NX-OS prints a hash for a one-row table, it is read as a list of one.Returns
{ VRF => [ { prefix => '10.1.1.0', len => 24 }, ... ] }, or undef when neither command returned usable JSON. A VRF with no connected routes is absent. A command that fails contributes nothing and the other family's prefixes are still returned. A failure is an SSH error (including a non-zero exit, which aSyntax errorreply gives), a reply that does not decode, or a reply that is not the expected table. Some images leave the exec channel open after a complete reply; that costs the SSH inactivity timeout and that family.A subclass that overrides
subnetsmust also overridesubnets_by_vrf, or withstore_vrfson thissubnets_by_vrfis used instead of the override.