* $ssh->capture() aka. directly executing a command via
ssh <device> <command> does not seem to work on NXOS7, maybe
also others
* changed this module to use Expect, successfully tested on
NXOS6 - NXOS9
* We meant well but it turns out that the array unnest and join is
actually very slow, as the join arguments do not get pushed down
into the CTE (in Postgres 9/10 at least, later versions remove some
of the optimization barriers in that specifc type of query)
* This caused a seq scan on both device and device_port, and the query
is executed many times during macsuck
* The query is now rewritten to use ANY (macaddr[]) and without CTE,
which seems to be around 20x faster
* The previous module only worked for 32-bit IOSXR, and already
there some fiddling with the STDIN of the process was required
when being run from netdisco-backend
* In 64-bit IOSXR, the STDIN workaround stopped working and
created a stuck ssh process on every arpnip
* This new version uses Expect instead of plain SSH, so a proper
pty is provided under any circumstances
* Successfully tested on recent 32- and 64-bit variants
Hi @ollyg! Unfortunately I have found some issues with the code we
finally released in #680:
* get_port_macs expects an array ref but values() returns array,
so the code was never called due to the return unless... check
* When fw_mac_list had exactly two entries, only the second value
was bound as a scalar to the parameter. This is probably due
to the shorthand bind formats described in
https://metacpan.org/pod/DBIx::Class::ResultSet#DBIC-BIND-VALUES,
but I'm not a 100% on this.
* return unless now checks for an entry in the list, with the old
check the statement was also executed for empty lists
In cases where only the device(_port)?.mac lookup worked for uplink
detection, users of 02.044005 - 010 might get a lot of uplinks not
labeled as such.
* Reduce macsuck bandwidth usage to database
get_port_macs transfers a full list of all device_port.(mac,ip) in every macsuck.
With 8k devices and 40k interfaces it takes up around 15MB. Transferring them 8k times
during an 1h macsuck cycle requires bandwidth in the 300 to 400 mbit/s range.
This patch changes get_port_macs to be called inside walk_fwtable and only transfer
the macs found in the current target device/vlan.
Give the user wanting to manually run a discover|arpnip|macsuck job in
the foreground preference over the respective `_min_age` setting. Tiny
quality of life improvement that mostly comes up in debugging.
* On e.g. Cisco N9K, ipv6 objects can be returned undef which crashes the ip alias discovery with `Can't use an undefined value as a HASH reference at .../Discover/Properties.pm line 346.`
* Discovery continues but leaves device_ip empty, which in turn makes device->neighbor non-functional
* Fixed by adding various `$snmp->x || {}` safeguards
* Embedded # characters in the output for show names cause sshcollector not to collect any ARP entries on the ASA platform, since the $prompt variable matches in the middle of the output. Fix is to modify $prompt to match end-of-line.
* Changing the terminal pager length should be done before sending show names instead of after.
* Matching on IP address to see if a name needs to be mapped should include start and end field markers, in the event that the name returned from "show arp" embeds an IP address (eg, "abc1.2.3.4xyz")
* Improve netdisco-sshcollector CLI experience
* add -d <device>
* add -O debug option to toggle Net::OpenSSH::debug
* add -w MCE::Loop max_workers
* updated POD for all of the above
* Fix -Q documentation
* Specifying -Q multiple times has no effect, removed part talking about that.
* Emit Net::OpenSSH connection failures as warnings
Some devices can contain random non-utf8 data in syscontact and syslocation,
making the insert fail with "ERROR: invalid byte sequence for encoding "UTF8"
on discovery. Work around this with Encode::decode.