feat(access-point): a radio's runtime state beside its configuration (NetOrk/netork#31)
RadioStatusDict carries up, pending and setup_failed, each optional: a driver that cannot read the state leaves them out. A radio can be enabled and not run, as on 2026-07-16, when a rejected value kept every radio of a fleet in a restart loop the configuration never showed. The access point shapes move to access_point_models.py for the file size ratchet; models re-exports each where it was.
This commit is contained in:
1 parent
419d3ee0e0
commit
e4fde2283a
5 files changed
+166
-97
No files matched your search
@@ -31,7 +31,7 @@
|
||||
},
|
||||
"mypy_relaxed": [],
|
||||
"python_file_lines": {
|
||||
"napalm_device_types/models.py": 1436
|
||||
"napalm_device_types/models.py": 1353
|
||||
},
|
||||
"untyped_public": []
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"""A radio's runtime state beside its configuration (NetOrk/netork#31).
|
||||
|
||||
A radio can be enabled in the configuration and still not run: the 2026-07-16
|
||||
incident put every radio of a fleet into a restart loop that the configuration
|
||||
never showed. The state the device reports is three facts, each optional,
|
||||
because a driver that cannot read it leaves it out rather than guessing.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import get_type_hints
|
||||
|
||||
from napalm_device_types.models import RadioStatusDict
|
||||
|
||||
RUNTIME = {"up", "pending", "setup_failed"}
|
||||
|
||||
|
||||
def test_a_radio_may_say_whether_it_runs():
|
||||
hints = get_type_hints(RadioStatusDict)
|
||||
assert RUNTIME <= set(hints)
|
||||
assert all(hints[key] is bool for key in RUNTIME)
|
||||
|
||||
|
||||
def test_the_runtime_state_is_optional():
|
||||
assert RUNTIME <= RadioStatusDict.__optional_keys__
|
||||
|
||||
|
||||
def test_the_configured_fields_stay_required():
|
||||
assert {"enabled", "band", "channel"} <= RadioStatusDict.__required_keys__
|
||||
Reference in new issue
Block a user