feat: get_system_identity for matching a host to its BMC (0.7.0)
CI / test (3.10) (push) Successful in 38s
CI / test (3.11) (push) Successful in 37s
CI / test (3.12) (push) Successful in 41s

Mixes in napalm-device-types 4.9's SystemIdentityMixin: the host's
SMBIOS system UUID, product serial and board serial, read as root on an
exec channel, vendor placeholders empty. netOrk links a server's BMC to
the host on these.
This commit is contained in:
christianmanivong committed 2026-10-13 12:20:12 +02:00
1 parent 350e3a6d6e
commit c98dd928e6
4 files changed
+49 -2

No files matched your search

+33
View File
@@ -1725,6 +1725,39 @@ class TestGetListeningSockets:
assert plain.startswith("sh -c '")
# ---------------------------------------------------------------------------
# get_system_identity (napalm-device-types SystemIdentityMixin)
# ---------------------------------------------------------------------------
class TestGetSystemIdentity:
"""What ties a host to its BMC: SMBIOS UUID and serials, read as root on an exec
channel (product_uuid and product_serial are root's)."""
def test_it_reads_the_shared_command_as_root_on_an_exec_channel(self, driver):
from napalm_device_types import SYSTEM_IDENTITY_COMMAND, CommandResult, SystemIdentityMixin
assert isinstance(driver, SystemIdentityMixin)
calls = []
def run_command(command, *, privileged=False, timeout=60, stdin=None):
calls.append((command, privileged))
out = "IDBEGIN\n31303043-534D-C40C-7A72-6F1300000000\n0123456789\nZM155S026022\nIDEND\n"
return CommandResult(out, "", 0)
driver.run_command = run_command
identity = driver.get_system_identity()
assert identity == {
"system_uuid": "31303043-534d-c40c-7a72-6f1300000000",
"product_serial": "", # Supermicro's placeholder
"board_serial": "ZM155S026022",
}
assert calls == [(SYSTEM_IDENTITY_COMMAND, True)]
driver._device.send_command.assert_not_called()
# ---------------------------------------------------------------------------
# get_virtual_ips (napalm-device-types VirtualIpsMixin)
# ---------------------------------------------------------------------------