The switch's community table starts with an Index column, and
get_snmp_config took a row's first word, so it reported the community
as "1". The name now comes from the column headed Name, found in the
header line above the dashes; the tests read the recorded table.
Found while recording fixtures for #3.
get_snmp_config started from community "public" and returned it with
running=True when no row of the community table parsed. Without a listed
community it now reports the agent as not running, as it already did for
"no community entry exists".
The issue's other two points were already fixed on main: the management
VLAN is matched exactly since c2f0f7c (_management_vlan, with the
caller's listen address), and the floor on napalm-device-types is 4.21.1
with no requirements.txt since 4e171bf.
Closes#3
Each "Request timed out" line went into results with the timeout as its
RTT. NAPALM's results hold replies, and a sweep treats a non-empty
results list as a live host, so dead hosts showed up in LAN scans.
Closes#2
The switch offers diffie-hellman-group14-sha256 and group16-sha512 only,
and paramiko picks group16. On an SG2210P with firmware 5.30 that 4096-bit
exchange takes 9 to 16 seconds, against netmiko's 10-second conn_timeout:
paramiko then tries to log in on a transport whose key exchange has not
finished and fails with "No existing session", so every other poll failed
and netOrk flapped the switch between online and offline. group14 takes
1.5 seconds.
group16 is now disabled by default; a disabled_algorithms passed in
optional_args still wins. The netmiko arguments move into _ssh.py, so
tplink_jetstream.py keeps its recorded length.
- set_interface: the except Exception: pass around reading the old
untagged VLANs now logs at debug level (B110), with a module logger.
- nosec for the empty password field of get_users (B105, now a named
constant); a false positive.
- Two docstrings quoting tabular device output keep their lines (noqa
E501); a long docstring and an error message are shortened or split;
the unused duplex column is named _duplex.
- tests: a get_facts test named SHOW_INTERFACE, which does not exist; it
is SHOW_INTERFACE_STATUS. raise ... from exc.
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
The driver accepted any SSH host key. It now verifies through
napalm-device-types' HostKeyCheck (>= 4.19.0): with a known key in
optional_args["ssh_host_keys"] any other key is refused before login, and
every key seen is reported to optional_args["ssh_host_key_observer"].
Without either argument it connects as before (first use).
fix_snmp hard-coded community "public" and found the management VLAN
for the source interface with a substring match, so 10.0.0.1 matched
10.0.0.10 and a DNS name never matched (#3).
The driver implements napalm-device-types 4.13's configure_snmp_agent
steps: the caller's community (read-only, viewDefault), the source
interface set to the VLAN whose address is exactly the listen address
or the management address, configuration saved, and the community
checked in show snmp community. Contact and location are reported as
not set; there is no verified CLI for them on this switch. A value
that would break the CLI is refused.
The requirements now name napalm-device-types 4.13 in both files.
BREAKING CHANGE: run_device_action is removed.
Part of #3 and #4.
The driver no longer collects over SNMP. SNMP_HEALTH_PROFILE states
where the switch publishes uptime (TimeTicks), CPU and memory (tables
with one row per stack unit, first row as before); the application
polls and computes (napalm-device-types docs/STRUCTURE.md).
Interface counters now come from the 64-bit ifXTable where the switch
has it, as the application reads them for every device.