From d5ffb0f0fada9e84e48c7966a5ec348fe04e2cec Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Sat, 5 Dec 2026 14:05:47 +0100 Subject: [PATCH 1/2] feat: network controller role and get_vlans_detail, 4.60.0 NetworkControllerDriver (network_controller) is a role for a controller that manages switches, access points and gateways. It declares get_managed_devices(), returning ManagedDeviceDict per managed or pending device; each such device is polled with a driver of its own, so the controller never reports their ports or neighbours as its own. SwitchDriver now declares get_vlans_detail() with VlanDetailDict, which several switch drivers already offered and netOrk's poll already read. The new shapes live in network_controller_models.py and switch_models.py: models.py is over the size limit and may not grow. Refs NetOrk/netork#2787 --- CHANGELOG.md | 15 +++ README.md | 10 ++ docs/STRUCTURE.md | 2 +- napalm_device_types/__init__.py | 13 +++ napalm_device_types/network_controller.py | 70 ++++++++++++++ .../network_controller_models.py | 49 ++++++++++ napalm_device_types/switch.py | 19 ++++ napalm_device_types/switch_models.py | 19 ++++ pyproject.toml | 2 +- tests/test_network_controller.py | 94 +++++++++++++++++++ tests/test_role_contracts.py | 4 + tests/test_type_label.py | 2 + 12 files changed, 297 insertions(+), 2 deletions(-) create mode 100644 napalm_device_types/network_controller.py create mode 100644 napalm_device_types/network_controller_models.py create mode 100644 napalm_device_types/switch_models.py create mode 100644 tests/test_network_controller.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 1513eea..daaece1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,21 @@ recorded here; their history is the git log. ## [Unreleased] +## [4.60.0] - 2026-12-05 + +### Added +- `NetworkControllerDriver` (`network_controller`): a role for a controller that manages + switches, access points and gateways (UniFi Network, Omada, Instant On). It declares + `get_managed_devices()`, which reports each managed or pending device as a + `ManagedDeviceDict` (MAC, name, model, role, state, site, address; serial, firmware and + the controller's own id where known). `MANAGED_DEVICE_ROLES` and + `MANAGED_DEVICE_STATES` name the words. Each managed device is polled with a driver of + its own; the controller never reports their ports or neighbours as its own + (NetOrk/netork#2787). +- `SwitchDriver.get_vlans_detail()` and `VlanDetailDict`: every VLAN with its tagged and + untagged ports kept apart. Several switch drivers already offered it and netOrk's poll + already read it; now the contract declares it. + ## [4.59.1] - 2026-12-05 ### Fixed diff --git a/README.md b/README.md index d8113d6..c2abd75 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,15 @@ UUID and NIC MACs -- what ties the BMC to the host it manages. Its sensors come NAPALM's `get_environment`, with `cpu` and `memory` empty, since a BMC does not know the host OS's load; it has no `HealthMetricsMixin` (SNMP) and no command channel. +A network controller (UniFi Network, TP-Link Omada, Aruba Instant On) is a role of its +own, `NetworkControllerDriver` (`network_controller`), reached over its API +(`USES_SSH = False`). It is not the switches, access points and gateways it manages: +`get_managed_devices` reports *which* devices it manages (`ManagedDeviceDict`: MAC, name, +model, role, state, site, address, and where known serial and firmware), and each of them is +polled as a device of its own with its own driver. Its `get_interfaces`, +`get_lldp_neighbors` and `get_mac_address_table` are the controller's own, never its +children's (NetOrk/netork#2787). + A backup server (Proxmox Backup Server) is a role of its own too, `BackupServerDriver` (`backup_server`). Its datastores, the backup groups in them (each with its newest snapshot), its jobs (garbage collection, verify, prune, sync, tape) and its remotes have @@ -748,6 +757,7 @@ Requires Python ≥ 3.12 (tested up to 3.13) and NAPALM ≥ 4.0. | `PhoneDriver` | IP telephony endpoints | Yealink | | `MediaDriver` | Speakers, streamers, media renderers | Sonos, Chromecast | | `ManagementControllerDriver` | Server baseboard management controllers | Supermicro BMC, Dell iDRAC, HPE iLO, Lenovo XCC | +| `NetworkControllerDriver` | Controllers that manage switches, APs and gateways | UniFi Network, TP-Link Omada | | `BackupServerDriver` | Backup servers: datastores, backup groups, GC/verify/prune/sync/tape jobs | Proxmox Backup Server | Mixins that come with the classes above: `PingSweepMixin` (subnet sweeps, in diff --git a/docs/STRUCTURE.md b/docs/STRUCTURE.md index d7b7504..1864847 100644 --- a/docs/STRUCTURE.md +++ b/docs/STRUCTURE.md @@ -35,7 +35,7 @@ application SNMP polling, ping sweeps, discovery scoring, guest | Kind | Rule | Modules | |---|---|---| -| **Role** | Declares only, under `TYPE_CHECKING`. No runtime method. | `access_point`, `switch`, `firewall`, `hypervisor`, `os`, `storage`, `phone`, `media`, `residential_gateway`, `management_controller`, `backup_server` | +| **Role** | Declares only, under `TYPE_CHECKING`. No runtime method. | `access_point`, `switch`, `firewall`, `hypervisor`, `os`, `storage`, `phone`, `media`, `residential_gateway`, `management_controller`, `network_controller`, `backup_server` | | **Capability** | Declares only. | `packages`, `services`, `updates`, `nat_vpn`, `mac_acl`, `config_lifecycle`, `interface_filter`, `host_reboot`, `dhcp_leases`, `wireless_writes`, `ap_config`, `host_storage` | | **Template** | A concrete method that runs a fixed sequence of abstract steps. A driver implements the steps, or overrides the whole method when its device does it in one go. All values come from the caller. | the fix routines below | | **Contract types** | Interfaces and data shapes other packages implement or fill. | `CommandChannelMixin`, `CommandResult`, `ByteStream`; the declaration of `ContainerEngineMixin`; the reader mixins' public method declarations; the SNMP profile type; `models` | diff --git a/napalm_device_types/__init__.py b/napalm_device_types/__init__.py index b264713..cc39538 100644 --- a/napalm_device_types/__init__.py +++ b/napalm_device_types/__init__.py @@ -31,6 +31,7 @@ Role bases -- what a device *is*: * :class:`~napalm_device_types.phone.PhoneDriver` * :class:`~napalm_device_types.media.MediaDriver` * :class:`~napalm_device_types.management_controller.ManagementControllerDriver` +* :class:`~napalm_device_types.network_controller.NetworkControllerDriver` * :class:`~napalm_device_types.residential_gateway.ResidentialGatewayDriver` Function classes -- what a device *can do*. Shared behaviour lives here once @@ -359,6 +360,12 @@ from napalm_device_types.models import ( UpdateProgressDict, ) from napalm_device_types.nat_vpn import NatVpnMixin +from napalm_device_types.network_controller import NetworkControllerDriver +from napalm_device_types.network_controller_models import ( + MANAGED_DEVICE_ROLES, + MANAGED_DEVICE_STATES, + ManagedDeviceDict, +) from napalm_device_types.network_mounts import ( NETWORK_MOUNTS_COMMAND, NetworkMountDict, @@ -489,6 +496,7 @@ from napalm_device_types.sudo_history import ( SudoHistoryMixin, ) from napalm_device_types.switch import SwitchDriver +from napalm_device_types.switch_models import VlanDetailDict from napalm_device_types.system_identity import ( SYSTEM_IDENTITY_COMMAND, SystemIdentityMixin, @@ -694,6 +702,9 @@ __all__ = [ "HypervisorDriver", "InterfaceFilterMixin", "MacAclMixin", + "MANAGED_DEVICE_ROLES", + "MANAGED_DEVICE_STATES", + "ManagedDeviceDict", "ManagementControllerDriver", "ARP_AGE_UNKNOWN", "POWER_ACTIONS", @@ -707,6 +718,8 @@ __all__ = [ "FirmwareDict", "ManagementProtocolsDict", "MediaDriver", + "NetworkControllerDriver", + "VlanDetailDict", "NatVpnMixin", "OSDriver", "PackageManagementMixin", diff --git a/napalm_device_types/network_controller.py b/napalm_device_types/network_controller.py new file mode 100644 index 0000000..5f0e2c9 --- /dev/null +++ b/napalm_device_types/network_controller.py @@ -0,0 +1,70 @@ +""" +Abstract base class for network controllers: devices that manage other devices. + +Usage:: + + from napalm_device_types import NetworkControllerDriver + + class UnifiNetworkDriver(NetworkControllerDriver): + def get_managed_devices(self): + ... +""" + +from typing import TYPE_CHECKING + +from napalm_device_types.base import DeviceTypeDriver + +if TYPE_CHECKING: # pragma: no cover - for type checkers only + from napalm_device_types.network_controller_models import ManagedDeviceDict + + +class NetworkControllerDriver(DeviceTypeDriver): + """ + Abstract intermediate driver for a controller that adopts, configures and + watches switches, access points and gateways (e.g. UniFi Network, TP-Link + Omada, Aruba Instant On), reached over its API. + + A controller is a device of its own, and it is not the devices it manages. + :meth:`get_managed_devices` reports *which* devices it manages; each of them + is polled as a device of its own -- through the controller, or directly -- + with its own driver. The controller's ``get_interfaces``, + ``get_interfaces_ip``, ``get_lldp_neighbors`` and ``get_mac_address_table`` + are therefore its own, never its children's: reporting a switch's ports here + would attach that switch's MAC addresses to the wrong device. + + What a managed device means to the application (a new device, a link to one + it already knows) is the application's decision; the driver reports. + """ + + #: Stable key netOrk exposes as ``device_class``. The order in which a + #: driver lists its role bases is the ranking; see + #: :func:`napalm_device_types.roles.primary_role_of`. + ROLE: str = "network_controller" + TYPE_LABEL: str = "Network Controller" + USES_SSH: bool = False + + if TYPE_CHECKING: + + def get_managed_devices(self) -> list[ManagedDeviceDict]: + """ + Returns every device the controller manages or that waits to be + adopted by it, across all of its sites. + + A device the controller has lost contact with is listed as + ``offline``, not left out. A read that fails raises; an empty list + means a controller that manages nothing. + + Example:: + + [ + {"mac": "f4:92:bf:00:00:01", "name": "usw-office", + "model": "USW24P250", "role": "switch", "state": "online", + "site": "default", "ip": "192.0.2.21", + "id": "5e2f7c1b8a5d3f0012345678", "serial": "F492BF000001", + "model_name": "USW 24 PoE", "firmware": "7.1.26.15869"}, + {"mac": "78:8a:20:00:00:02", "name": "", "model": "U7PG2", + "role": "access_point", "state": "pending", + "site": "default", "ip": None}, + ] + """ + ... diff --git a/napalm_device_types/network_controller_models.py b/napalm_device_types/network_controller_models.py new file mode 100644 index 0000000..7922888 --- /dev/null +++ b/napalm_device_types/network_controller_models.py @@ -0,0 +1,49 @@ +"""The shapes a network controller's getters return. + +No ``from __future__ import annotations`` here: TypedDict reads ``NotRequired`` only +in an evaluated annotation (#144). +""" + +from typing import NotRequired + +from typing_extensions import TypedDict + +#: What a managed device is, in the controller's report. +MANAGED_DEVICE_ROLES: tuple[str, ...] = ("switch", "access_point", "gateway", "other") + +#: Where a managed device stands with its controller. ``pending`` waits to be +#: adopted; ``busy`` is adopting, provisioning or upgrading. +MANAGED_DEVICE_STATES: tuple[str, ...] = ("online", "offline", "pending", "busy") + + +class ManagedDeviceDict(TypedDict): + """One device a controller manages, as the controller reports it. + + * mac (str) - the device's base MAC address, lower case, colon-separated + * name (str) - its name on the controller; ``""`` when it has none + * model (str) - the vendor's model code, e.g. ``"USW24P250"`` + * role (str) - one of :data:`MANAGED_DEVICE_ROLES` + * state (str) - one of :data:`MANAGED_DEVICE_STATES` + * site (str) - the controller's site the device belongs to, in the controller's + own words (a controller can run several) + * ip (str or None) - its management address; ``None`` while it has none + * id (str, optional) - the controller's own identifier for the device + * serial (str, optional) - the serial number, where the controller reports it + * model_name (str, optional) - the product name, e.g. ``"USW Pro 24 PoE"`` + * firmware (str, optional) - the running firmware version + * firmware_available (str, optional) - the version the controller would + upgrade it to; left out when it has none + """ + + mac: str + name: str + model: str + role: str + state: str + site: str + ip: str | None + id: NotRequired[str] + serial: NotRequired[str] + model_name: NotRequired[str] + firmware: NotRequired[str] + firmware_available: NotRequired[str] diff --git a/napalm_device_types/switch.py b/napalm_device_types/switch.py index 704c4f2..aa3cd7d 100644 --- a/napalm_device_types/switch.py +++ b/napalm_device_types/switch.py @@ -24,6 +24,7 @@ from napalm_device_types.models import ( SpanningTreeDict, VlanConfigDict, ) +from napalm_device_types.switch_models import VlanDetailDict class SwitchDriver(MacAclMixin, DeviceTypeDriver): @@ -247,6 +248,24 @@ class SwitchDriver(MacAclMixin, DeviceTypeDriver): """ ... + def get_vlans_detail(self) -> dict[str, VlanDetailDict]: + """ + Returns every VLAN on the switch with its ports, tagged and untagged + kept apart -- what NAPALM's ``get_vlans`` folds into one list. + + Keyed by the VLAN ID as a string. A port is in ``untagged`` of the + VLAN that is its native (PVID) VLAN, and in ``tagged`` of every VLAN + it carries tagged. + + Example:: + + { + "1": {"name": "Default", "tagged": [], "untagged": ["Port 2", "Port 3"]}, + "20": {"name": "Voice", "tagged": ["Port 1"], "untagged": ["Port 4"]}, + } + """ + ... + def set_vlan(self, vlan_id: int, config: VlanConfigDict) -> None: """ Creates or updates a VLAN on the switch. diff --git a/napalm_device_types/switch_models.py b/napalm_device_types/switch_models.py new file mode 100644 index 0000000..8836147 --- /dev/null +++ b/napalm_device_types/switch_models.py @@ -0,0 +1,19 @@ +"""The shapes a switch's getters return, beyond the older ones in ``models.py``. + +``models.py`` is over the size limit and may not grow; new switch shapes live here. +""" + +from typing_extensions import TypedDict + + +class VlanDetailDict(TypedDict): + """One VLAN with its ports, tagged and untagged kept apart. + + * name (str) - the VLAN's name; ``""`` when it has none + * tagged (list of str) - interfaces that carry the VLAN tagged + * untagged (list of str) - interfaces whose untagged (native, PVID) VLAN it is + """ + + name: str + tagged: list[str] + untagged: list[str] diff --git a/pyproject.toml b/pyproject.toml index e7e3d42..532b70f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "napalm-device-types" -version = "4.59.1" +version = "4.60.0" description = "Abstract device-type base classes for NAPALM drivers" readme = "README.md" requires-python = ">=3.12" diff --git a/tests/test_network_controller.py b/tests/test_network_controller.py new file mode 100644 index 0000000..d555a34 --- /dev/null +++ b/tests/test_network_controller.py @@ -0,0 +1,94 @@ +"""The network controller role: a device that manages other devices (NetOrk/netork#2787). + +A controller (UniFi Network, Omada, Aruba Instant On, ...) is a device of its own. +It reports *which* switches, access points and gateways it manages; each of those +is polled as a device of its own, so the controller never reports their ports, +addresses or neighbours as its own. +""" + +from __future__ import annotations + +import typing + +import pytest + +import napalm_device_types as package +from napalm_device_types import ( + FirewallDriver, + ManagedDeviceDict, + NetworkControllerDriver, + SwitchDriver, + VlanDetailDict, +) +from napalm_device_types.roles import primary_role_of, role_keys_of + + +class TestRole: + def test_role_key_label_and_transport(self): + assert NetworkControllerDriver.ROLE == "network_controller" + assert NetworkControllerDriver.TYPE_LABEL == "Network Controller" + assert NetworkControllerDriver.USES_SSH is False + + def test_get_managed_devices_is_declared_not_implemented(self): + """hasattr is the capability probe: absent until a driver provides it.""" + assert not hasattr(NetworkControllerDriver, "get_managed_devices") + + def test_docstring_says_the_children_are_not_its_own(self): + doc = NetworkControllerDriver.__doc__ or "" + assert "get_managed_devices" in doc + assert "get_interfaces" in doc + + def test_a_console_that_also_routes_ranks_its_roles(self): + class Console(NetworkControllerDriver, FirewallDriver): + pass + + assert primary_role_of(Console) == "network_controller" + assert role_keys_of(Console) == ["network_controller", "firewall"] + + +class TestManagedDeviceDict: + def test_required_keys(self): + assert ManagedDeviceDict.__required_keys__ == frozenset( + {"mac", "name", "model", "role", "state", "site", "ip"} + ) + + def test_optional_keys(self): + assert ManagedDeviceDict.__optional_keys__ == frozenset( + {"id", "serial", "model_name", "firmware", "firmware_available"} + ) + + def test_every_annotation_resolves(self): + hints = typing.get_type_hints(ManagedDeviceDict) + assert hints["ip"] == str | None + + def test_roles_and_states_are_exported_words(self): + assert package.MANAGED_DEVICE_ROLES == ("switch", "access_point", "gateway", "other") + assert package.MANAGED_DEVICE_STATES == ("online", "offline", "pending", "busy") + + @pytest.mark.parametrize( + "name", + [ + "NetworkControllerDriver", + "ManagedDeviceDict", + "MANAGED_DEVICE_ROLES", + "MANAGED_DEVICE_STATES", + "VlanDetailDict", + ], + ) + def test_exported(self, name): + assert name in package.__all__ and hasattr(package, name) + + +class TestVlansDetail: + """The poll has read get_vlans_detail for years; now the switch contract says so.""" + + def test_declared_on_the_switch_not_implemented(self): + assert not hasattr(SwitchDriver, "get_vlans_detail") + from napalm_device_types import switch + + assert "def get_vlans_detail" in open(switch.__file__, encoding="utf-8").read() + + def test_shape(self): + assert VlanDetailDict.__required_keys__ == frozenset({"name", "tagged", "untagged"}) + hints = typing.get_type_hints(VlanDetailDict) + assert hints["tagged"] == list[str] diff --git a/tests/test_role_contracts.py b/tests/test_role_contracts.py index 00f1c4c..147a351 100644 --- a/tests/test_role_contracts.py +++ b/tests/test_role_contracts.py @@ -25,6 +25,7 @@ from napalm_device_types import ( HypervisorDriver, ManagementControllerDriver, MediaDriver, + NetworkControllerDriver, OSDriver, PhoneDriver, ResidentialGatewayDriver, @@ -40,6 +41,7 @@ ROLE_BASES = [ HypervisorDriver, ManagementControllerDriver, MediaDriver, + NetworkControllerDriver, OSDriver, PhoneDriver, ResidentialGatewayDriver, @@ -97,6 +99,8 @@ class TestDeclaredMethodsDoNotExistAtRuntime: (ManagementControllerDriver, "get_event_log"), (ManagementControllerDriver, "get_firmware_inventory"), (ManagementControllerDriver, "get_management_protocols"), + (NetworkControllerDriver, "get_managed_devices"), + (SwitchDriver, "get_vlans_detail"), ], ) def test_absent_until_a_driver_implements_it(self, base, method): diff --git a/tests/test_type_label.py b/tests/test_type_label.py index 22418dc..a7436ef 100644 --- a/tests/test_type_label.py +++ b/tests/test_type_label.py @@ -8,6 +8,7 @@ from napalm_device_types import ( FirewallDriver, HypervisorDriver, ManagementControllerDriver, + NetworkControllerDriver, OSDriver, ResidentialGatewayDriver, StorageDriver, @@ -20,6 +21,7 @@ BASE_CLASSES = [ (FirewallDriver, "Firewall"), (HypervisorDriver, "Hypervisor"), (ManagementControllerDriver, "Management Controller"), + (NetworkControllerDriver, "Network Controller"), (OSDriver, "OS"), (ResidentialGatewayDriver, "Gateway"), (StorageDriver, "Storage"), From 081ef62d227b820a99fab84c5093fbde8a6a19c8 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Sat, 5 Dec 2026 17:16:32 +0100 Subject: [PATCH 2/2] feat: a managed device names its driver and how to reach it ManagedDeviceDict gets two optional keys: driver, the entry point that polls the device, and driver_args, the optional args that reach it through the controller (never a secret). With them a caller can add a controller's devices without knowing the vendor (NetOrk/netork#2787). --- CHANGELOG.md | 3 ++- README.md | 4 +++- napalm_device_types/network_controller_models.py | 9 ++++++++- tests/test_network_controller.py | 14 +++++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daaece1..8d69002 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ recorded here; their history is the git log. switches, access points and gateways (UniFi Network, Omada, Instant On). It declares `get_managed_devices()`, which reports each managed or pending device as a `ManagedDeviceDict` (MAC, name, model, role, state, site, address; serial, firmware and - the controller's own id where known). `MANAGED_DEVICE_ROLES` and + the controller's own id where known; the driver that polls it and the optional args + that driver needs to reach it through the controller, never a secret). `MANAGED_DEVICE_ROLES` and `MANAGED_DEVICE_STATES` name the words. Each managed device is polled with a driver of its own; the controller never reports their ports or neighbours as its own (NetOrk/netork#2787). diff --git a/README.md b/README.md index c2abd75..da32fe0 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,9 @@ own, `NetworkControllerDriver` (`network_controller`), reached over its API (`USES_SSH = False`). It is not the switches, access points and gateways it manages: `get_managed_devices` reports *which* devices it manages (`ManagedDeviceDict`: MAC, name, model, role, state, site, address, and where known serial and firmware), and each of them is -polled as a device of its own with its own driver. Its `get_interfaces`, +polled as a device of its own with its own driver. Where the controller knows that driver, it +names it (`driver`) with the optional args that reach the device through the controller +(`driver_args`, never a secret); the caller links the controller's credential to the child. Its `get_interfaces`, `get_lldp_neighbors` and `get_mac_address_table` are the controller's own, never its children's (NetOrk/netork#2787). diff --git a/napalm_device_types/network_controller_models.py b/napalm_device_types/network_controller_models.py index 7922888..d2d2742 100644 --- a/napalm_device_types/network_controller_models.py +++ b/napalm_device_types/network_controller_models.py @@ -4,7 +4,7 @@ No ``from __future__ import annotations`` here: TypedDict reads ``NotRequired`` in an evaluated annotation (#144). """ -from typing import NotRequired +from typing import Any, NotRequired from typing_extensions import TypedDict @@ -33,6 +33,11 @@ class ManagedDeviceDict(TypedDict): * firmware (str, optional) - the running firmware version * firmware_available (str, optional) - the version the controller would upgrade it to; left out when it has none + * driver (str, optional) - the NAPALM driver that polls this device, by its + entry point name (``"unifi_switch"``); left out where none does + * driver_args (dict, optional) - the optional args that driver needs to reach + the device through this controller (address, site, device id). Never a + secret: the caller hands the child the controller's credential itself """ mac: str @@ -47,3 +52,5 @@ class ManagedDeviceDict(TypedDict): model_name: NotRequired[str] firmware: NotRequired[str] firmware_available: NotRequired[str] + driver: NotRequired[str] + driver_args: NotRequired[dict[str, Any]] diff --git a/tests/test_network_controller.py b/tests/test_network_controller.py index d555a34..6ecacde 100644 --- a/tests/test_network_controller.py +++ b/tests/test_network_controller.py @@ -54,12 +54,24 @@ class TestManagedDeviceDict: def test_optional_keys(self): assert ManagedDeviceDict.__optional_keys__ == frozenset( - {"id", "serial", "model_name", "firmware", "firmware_available"} + { + "id", + "serial", + "model_name", + "firmware", + "firmware_available", + "driver", + "driver_args", + } ) def test_every_annotation_resolves(self): hints = typing.get_type_hints(ManagedDeviceDict) assert hints["ip"] == str | None + assert hints["driver_args"] == dict[str, typing.Any] + + def test_the_docstring_keeps_secrets_out_of_driver_args(self): + assert "never a secret" in " ".join((ManagedDeviceDict.__doc__ or "").lower().split()) def test_roles_and_states_are_exported_words(self): assert package.MANAGED_DEVICE_ROLES == ("switch", "access_point", "gateway", "other")