fix(ssh): raise when a node command cannot run, drop the execute call
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 35s
driver / build (pull_request) Successful in 40s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Successful in 2m53s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 35s
driver / build (pull_request) Successful in 40s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Successful in 2m53s
driver / publish (pull_request) Skipped
_exec_ssh_command returned "" on any failure (no SSH credential, a
refused login or host key, an unreachable node, a timeout), so a
getter that could not look read like one that found nothing; on
API-token-only nodes get_snmp_config answered None and the SSH-backed
getters empty lists on every poll. It now raises ConnectionException
with the cause (SshHostKeyMismatch as it is), and refuses before
connecting when there is neither a password nor a usable key.
It returned stderr when stdout was empty; output is stdout now. It
first posted every command to /nodes/{node}/execute, which runs a
batch of API calls rather than a shell; that dead round trip is gone.
The key types, the key before the password, the host-key check and the
single connect path were done in f491f9f and 6bb3035. The shared
transport is NAPALM/napalm-device-types#35.
Closes #17
This commit is contained in:
1 parent
bfba804ec2
commit
daf1b519eb
13 files changed
+261
-108
No files matched your search
@@ -103,7 +103,7 @@ device = driver(
|
||||
| `get_interfaces_ip` | IPv4/IPv6 from classic ifaces + SDN subnet gateways |
|
||||
| `get_interfaces_counters` | From `node/netstat` RRD data |
|
||||
| `get_environment` | CPU %, memory (bytes), hardware temperature sensors |
|
||||
| `get_arp_table` | Reads `/proc/net/arp` via exec endpoint |
|
||||
| `get_arp_table` | Reads `/proc/net/arp` over SSH |
|
||||
| `get_mac_address_table` | `bridge fdb show` (Linux) + `ovs-appctl fdb/show` (OVS) |
|
||||
| `get_vlans` | SDN VNet tags + `bridge vlan show` |
|
||||
| `get_network_instances` | SDN zones (VLAN→L2VPN, EVPN→L3VRF) + default instance |
|
||||
@@ -116,13 +116,13 @@ device = driver(
|
||||
| `compare_config` | Unified diff |
|
||||
| `commit_config` | Writes `/etc/network/interfaces` + `ifreload -a` |
|
||||
| `discard_config` / `rollback` | Revert candidate |
|
||||
| `get_lldp_neighbors` | `lldpcli show neighbors` via exec |
|
||||
| `get_lldp_neighbors` | `lldpcli show neighbors` over SSH |
|
||||
| `get_lldp_neighbors_detail` | Full LLDP detail |
|
||||
| `get_ipv6_neighbors_table` | `ip -6 neigh show` |
|
||||
| `ping` | Linux `ping` via exec endpoint |
|
||||
| `traceroute` | `traceroute -n` via exec endpoint |
|
||||
| `cli` | Arbitrary command execution via exec endpoint |
|
||||
| `get_route_to` | `ip route show` via exec endpoint |
|
||||
| `ping` | Linux `ping` over SSH |
|
||||
| `traceroute` | `traceroute -n` over SSH |
|
||||
| `cli` | Arbitrary commands over SSH (stdout) |
|
||||
| `get_route_to` | `ip route show` over SSH |
|
||||
|
||||
**Not implemented** (raise `NotImplementedError`):
|
||||
`get_bgp_config`, `get_bgp_neighbors`, `get_bgp_neighbors_detail`,
|
||||
@@ -138,6 +138,13 @@ device = driver(
|
||||
| `node` | str | *auto* | Override target node name |
|
||||
| `token_name` | str | `None` | API token identifier (`user@realm!tokenid`) |
|
||||
| `token_value` | str | `None` | API token secret |
|
||||
| `ssh_username` | str | *username* | Login for the node's SSH (port 22) |
|
||||
| `ssh_password` | str | *password* | SSH password; the API password when not set |
|
||||
| `ssh_private_key_str` | str | `None` | SSH private key (Ed25519, ECDSA or RSA), tried before the password |
|
||||
|
||||
What the API does not offer (ARP, LLDP, packages, SNMP config, `cli`, …) runs in the
|
||||
node's shell over SSH. Without an SSH password or key — a node reached with an API
|
||||
token only — those calls raise `ConnectionException` instead of reading as empty.
|
||||
|
||||
## Development
|
||||
|
||||
|
||||
Reference in new issue
Block a user