feat(host-status): get_host_status through HostStatusMixin
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m16s
driver / test (3.13) (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m16s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m38s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m16s
driver / test (3.13) (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m16s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m38s
driver / publish (pull_request) Skipped
The router's host status, read by napalm-device-types' command over an SSH exec channel: whether it needs a reboot, how full its filesystems are, and, with napalm-device-types 4.32, whether apk or opkg was left halfway. Refs NetOrk/netork#851
This commit is contained in:
1 parent
e2eda54fe4
commit
29872243ba
4 files changed
+85
No files matched your search
@@ -36,6 +36,7 @@ from napalm_device_types import (
|
||||
SnmpAgentMixin,
|
||||
)
|
||||
from napalm_device_types.channel import open_stream_on_transport, run_on_transport
|
||||
from napalm_device_types.host_status import HostStatusMixin
|
||||
from napalm_device_types.listening import ListeningSocketsMixin
|
||||
from napalm_device_types.ssh_host_keys import HostKeyCheck, SshHostKeyMismatch
|
||||
from netmiko import ConnectHandler
|
||||
@@ -80,6 +81,7 @@ class OpenWrtDriver(
|
||||
OpenWrtRoutingMixin,
|
||||
OpenWrtScheduledJobsMixin,
|
||||
ListeningSocketsMixin,
|
||||
HostStatusMixin,
|
||||
SnmpAgentMixin,
|
||||
OpenWrtLldpAgentMixin,
|
||||
EnsurePackageMixin,
|
||||
@@ -248,6 +250,14 @@ class OpenWrtDriver(
|
||||
reason = result.stderr.strip() or result.stdout.strip()
|
||||
raise RuntimeError(reason or f"reboot exited with status {result.exit_code}")
|
||||
|
||||
def _run_host_status_command(self, command: str) -> str:
|
||||
"""Run the host status command for ``HostStatusMixin``; it needs no root.
|
||||
|
||||
Over an SSH exec channel of its own: busybox ash cuts a typed line at 512
|
||||
characters, and the command is longer.
|
||||
"""
|
||||
return self.run_command(command).stdout
|
||||
|
||||
def _run_listening_sockets_command(self, command: str, *, privileged: bool) -> str:
|
||||
"""Run the listening-socket command for ``ListeningSocketsMixin``.
|
||||
|
||||
|
||||
Reference in new issue
Block a user