feat: network controller role and get_vlans_detail, 4.60.0 (NetOrk/netork#2787) #151

Merged
christianmanivong merged 2 commits from feature/network-controller-role into main 2026-12-05 16:20:34 +00:00
Owner

A role for a controller that manages switches, access points and gateways (UniFi Network first; Omada and Instant On fit the same shape), and the VLAN-with-ports getter the switch contract was missing. Both for the UniFi drivers (NetOrk/netork#2787).

  • NetworkControllerDriver (network_controller, TYPE_LABEL "Network Controller", USES_SSH = False) declares get_managed_devices() -> list[ManagedDeviceDict]: MAC, name, model, role, state, site and address of each managed or pending device; serial, model name, firmware, available firmware and the controller's own id where known. MANAGED_DEVICE_ROLES and MANAGED_DEVICE_STATES name the words.
  • A managed device can name the driver that polls it (driver) and the optional args that reach it through the controller (driver_args, never a secret), so a caller adds a controller's devices without knowing the vendor and links the controller's credential to them.
  • Each managed device is polled with a driver of its own. The docstring says so: a controller's get_interfaces/get_lldp_neighbors/get_mac_address_table are its own, never its devices'.
  • SwitchDriver.get_vlans_detail() and VlanDetailDict (name, tagged, untagged): several switch drivers already offer it and netOrk's poll already reads it; the contract now declares it.
  • New shapes live in new modules (network_controller_models.py, switch_models.py); models.py does not grow.
  • Tests: role contract, type label, the new module at 100 %. 2440 passed.

First user: napalm-ubiquiti (unifi_network, unifi_switch, unifi_ap).

Release commit 4.60.0 included; the tag follows the merge.

A role for a controller that manages switches, access points and gateways (UniFi Network first; Omada and Instant On fit the same shape), and the VLAN-with-ports getter the switch contract was missing. Both for the UniFi drivers (NetOrk/netork#2787). - `NetworkControllerDriver` (`network_controller`, TYPE_LABEL "Network Controller", `USES_SSH = False`) declares `get_managed_devices() -> list[ManagedDeviceDict]`: MAC, name, model, role, state, site and address of each managed or pending device; serial, model name, firmware, available firmware and the controller's own id where known. `MANAGED_DEVICE_ROLES` and `MANAGED_DEVICE_STATES` name the words. - A managed device can name the driver that polls it (`driver`) and the optional args that reach it through the controller (`driver_args`, never a secret), so a caller adds a controller's devices without knowing the vendor and links the controller's credential to them. - Each managed device is polled with a driver of its own. The docstring says so: a controller's `get_interfaces`/`get_lldp_neighbors`/`get_mac_address_table` are its own, never its devices'. - `SwitchDriver.get_vlans_detail()` and `VlanDetailDict` (name, tagged, untagged): several switch drivers already offer it and netOrk's poll already reads it; the contract now declares it. - New shapes live in new modules (`network_controller_models.py`, `switch_models.py`); `models.py` does not grow. - Tests: role contract, type label, the new module at 100 %. 2440 passed. First user: napalm-ubiquiti (`unifi_network`, `unifi_switch`, `unifi_ap`). Release commit 4.60.0 included; the tag follows the merge.
christianmanivong added 1 commit 2026-12-05 16:14:22 +00:00
feat: network controller role and get_vlans_detail, 4.60.0
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 24s
driver / types (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 1m3s
driver / test (3.13) (pull_request) Successful in 1m18s
driver / build (pull_request) Successful in 43s
driver / test (3.12) (pull_request) Successful in 2m13s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m18s
driver / publish (pull_request) Skipped
d5ffb0f0fa
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
christianmanivong added 1 commit 2026-12-05 16:16:38 +00:00
feat: a managed device names its driver and how to reach it
driver / standard (pull_request) Successful in 22s
driver / lint (pull_request) Successful in 20s
driver / types (pull_request) Successful in 54s
driver / lowest (pull_request) Successful in 53s
driver / test (3.13) (pull_request) Successful in 1m8s
driver / build (pull_request) Successful in 34s
driver / test (3.12) (pull_request) Successful in 1m39s
driver / security (pull_request) Successful in 1m3s
CI / driver (pull_request) Successful in 2m19s
driver / publish (pull_request) Skipped
081ef62d22
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).
christianmanivong merged commit 402c0aabc2 into main 2026-12-05 16:20:34 +00:00
christianmanivong deleted branch feature/network-controller-role 2026-12-05 16:20:34 +00:00
Sign in to join this conversation.