feat: report the running kernel's modules and build configuration

LinuxDriver mixes in KernelFactsMixin from napalm-device-types and supplies
only the transport: the shared read-only command over the existing SSH
session, no sudo, one round trip. OpenMediaVault and QNAP inherit it.

Requires napalm-device-types 2.1.0.
This commit is contained in:
Christian Manivong
2026-10-05 06:17:30 +02:00
parent b6b1827f96
commit a6e5568e0b
3 changed files with 46 additions and 3 deletions
+10 -2
View File
@@ -31,7 +31,7 @@ from netmiko.exceptions import (
)
from napalm.base.exceptions import ConnectionException, ConnectionClosedException
from napalm.base.netmiko_helpers import netmiko_args
from napalm_device_types import FingerprintRule, OSDriver
from napalm_device_types import FingerprintRule, KernelFactsMixin, OSDriver
from napalm_device_types.models import (
ApplyUpdatesResultDict,
CronJobDict,
@@ -138,7 +138,7 @@ def _short_image_id(raw: str) -> str:
return raw.strip().removeprefix("sha256:")[:12]
class LinuxDriver(OSDriver):
class LinuxDriver(KernelFactsMixin, OSDriver):
"""NAPALM driver for generic Linux systems.
Connects via SSH (netmiko ``linux`` device type) and auto-detects the
@@ -840,6 +840,14 @@ class LinuxDriver(OSDriver):
}
}
# ------------------------------------------------------------------
# KernelFactsMixin – the transport for get_kernel_facts
# ------------------------------------------------------------------
def _run_kernel_facts_command(self, command: str) -> str:
"""The transport for ``KernelFactsMixin.get_kernel_facts``: read-only, no sudo."""
return self._send(command, read_timeout=60)
# ------------------------------------------------------------------
# OSDriver – package management
# ------------------------------------------------------------------