fix(snmp): the SNMP setup over REST opened its SSH side session on optional_args["port"] (the REST port); it now uses port 22, like the running-config fallback (#17, first half).
fix(connect): "maximum number of telnet sessions" is a connection error ("telnet: the switch has no free session …"), an HTML answer to the REST login is a connection error naming the web page, and a non-timeout SSH failure names the underlying paramiko/socket error (#13). The Telnet greeting is kept in an in-memory session log (≤ 4 KB, only what the switch sent, never the password) — this needs netmiko ≥ 4.3.0, so the floor is raised from 4.0.0.
fix(snmp): over REST, get_snmp_config runs show snmp-server through the /cli endpoint and uses the SSH path's parser; a failed read raises (#10). The show snmp-server fixture is recorded from a ProCurve (trap receiver address replaced).
fix(cli): over REST, cli() returned the raw base64 answer (with a trailing NUL); a new pure parse_cli_answer decodes it for cli() and get_snmp_config (found while recording the fixture).
Still open in #17: the REST certificate is never verified in practice (_try_api silently retries without verification). Strictly honouring ssl_verify would make every self-signed ProCurve fall back to SSH and then Telnet; that needs a decision, so #17 stays open.
Tested: fixtures only. pytest 106 passed, ruff, mypy, napalm-standard check/ratchet green (baseline only shrank).
Three bug fixes, one commit each.
- `fix(snmp)`: the SNMP setup over REST opened its SSH side session on `optional_args["port"]` (the REST port); it now uses port 22, like the running-config fallback (#17, first half).
- `fix(connect)`: "maximum number of telnet sessions" is a connection error ("telnet: the switch has no free session …"), an HTML answer to the REST login is a connection error naming the web page, and a non-timeout SSH failure names the underlying paramiko/socket error (#13). The Telnet greeting is kept in an in-memory session log (≤ 4 KB, only what the switch sent, never the password) — this needs netmiko ≥ 4.3.0, so the floor is raised from 4.0.0.
- `fix(snmp)`: over REST, `get_snmp_config` runs `show snmp-server` through the `/cli` endpoint and uses the SSH path's parser; a failed read raises (#10). The `show snmp-server` fixture is recorded from a ProCurve (trap receiver address replaced).
- `fix(cli)`: over REST, `cli()` returned the raw base64 answer (with a trailing NUL); a new pure `parse_cli_answer` decodes it for `cli()` and `get_snmp_config` (found while recording the fixture).
**Still open in #17:** the REST certificate is never verified in practice (`_try_api` silently retries without verification). Strictly honouring `ssl_verify` would make every self-signed ProCurve fall back to SSH and then Telnet; that needs a decision, so #17 stays open.
Tested: fixtures only. pytest 106 passed, ruff, mypy, `napalm-standard check`/`ratchet` green (baseline only shrank).
Closes #13
Closes #10
configure_snmp_agent over the REST API opened its temporary SSH session
on optional_args["port"], which names the REST API's port when REST is
the transport. It now uses port 22, as the running-config fallback
already did.
The second finding of the issue, the unverified REST certificate, needs
a decision and stays open.
Refs #17
A switch whose Telnet sessions were all taken, and a REST API answering
the login with the web UI's HTML page, were both reported as an
authentication failure, which sent the operator after the password. The
Telnet login now keeps the switch's greeting in an in-memory session log
and reports a full switch as a connection error; an HTML answer to the
REST login says so. An SSH attempt records netmiko's underlying error
instead of "timed out" when it was not a timeout.
Session log objects need netmiko 4.3.0, which becomes the floor.
Closes#13
get_snmp_config sent "show snmp-server" through the CLI session, which
does not exist on the REST transport, and returned None, so every switch
managed over REST read as "SNMP not configured". Over REST the command
now runs through the API's /cli endpoint and the output goes through the
parser the SSH path uses. A failed REST read raises.
Closes#10
The #10 tests read a hand-written show snmp-server. They now read the
output recorded from a ProCurve switch: as the CLI prints it, and as the
REST /cli endpoint answers it, base64 with a trailing NUL byte. The
trap receiver's address is replaced. The read-only preference and the
no-community case put a line into, or take one out of, the recording.
Over the REST API, cli() returned the /cli endpoint's
result_base64_encoded field as it came: base64 instead of the command's
output. It now decodes it and drops the NUL byte the switch ends it with,
in the same parser the SNMP read over REST uses.
New finding, confirmed by the show snmp-server answer recorded from a
ProCurve switch; no issue filed.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Three bug fixes, one commit each.
fix(snmp): the SNMP setup over REST opened its SSH side session onoptional_args["port"](the REST port); it now uses port 22, like the running-config fallback (#17, first half).fix(connect): "maximum number of telnet sessions" is a connection error ("telnet: the switch has no free session …"), an HTML answer to the REST login is a connection error naming the web page, and a non-timeout SSH failure names the underlying paramiko/socket error (#13). The Telnet greeting is kept in an in-memory session log (≤ 4 KB, only what the switch sent, never the password) — this needs netmiko ≥ 4.3.0, so the floor is raised from 4.0.0.fix(snmp): over REST,get_snmp_configrunsshow snmp-serverthrough the/cliendpoint and uses the SSH path's parser; a failed read raises (#10). Theshow snmp-serverfixture is recorded from a ProCurve (trap receiver address replaced).fix(cli): over REST,cli()returned the raw base64 answer (with a trailing NUL); a new pureparse_cli_answerdecodes it forcli()andget_snmp_config(found while recording the fixture).Still open in #17: the REST certificate is never verified in practice (
_try_apisilently retries without verification). Strictly honouringssl_verifywould make every self-signed ProCurve fall back to SSH and then Telnet; that needs a decision, so #17 stays open.Tested: fixtures only. pytest 106 passed, ruff, mypy,
napalm-standard check/ratchetgreen (baseline only shrank).Closes #13
Closes #10