feat(access-point): declared AP writes and a DHCP lease reader, 4.54.0 (NetOrk/netork#695) #142

Merged
christianmanivong merged 4 commits from feature/ap-dhcp-contracts-695 into main 2026-11-29 22:03:14 +00:00
6 changed files with 30 additions and 34 deletions
Showing only changes of commit 2ad1ead2f5 - Show all commits

No files matched your search

+7 -6
View File
@@ -86,6 +86,12 @@ Introspection -- :func:`~napalm_device_types.roles.roles_of`,
"""
from napalm_device_types.access_point import AccessPointDriver
from napalm_device_types.access_point_models import (
ApConfigDict,
ApConfigResultDict,
ApSsidConfigDict,
SsidConfigDict,
)
from napalm_device_types.ap_config import (
AP_CONFIG_PARTS,
AP_CONFIG_SSID_ATTRIBUTES,
@@ -180,7 +186,7 @@ from napalm_device_types.credential_expiry import (
CredentialKind,
)
from napalm_device_types.dhcp import DhcpApplyError, DhcpServerMixin, normalize_cidr, normalize_mac
from napalm_device_types.dhcp_leases import DhcpLeasesMixin
from napalm_device_types.dhcp_leases import DhcpLeaseDict, DhcpLeasesMixin
from napalm_device_types.dns_forward import DnsForwardMixin
from napalm_device_types.firewall import FirewallDriver
from napalm_device_types.firewall_rules import FirewallRuleMixin
@@ -277,13 +283,9 @@ from napalm_device_types.management_controller import ManagementControllerDriver
from napalm_device_types.media import MediaDriver
from napalm_device_types.models import (
POWER_ACTIONS,
ApConfigDict,
ApConfigResultDict,
ApSsidConfigDict,
ConfigSyncDict,
DhcpHaDict,
DhcpHaPeerDict,
DhcpLeaseDict,
DnsForwardDict,
EventLogEntryDict,
FirmwareDict,
@@ -299,7 +301,6 @@ from napalm_device_types.models import (
PowerAction,
PowerStateDict,
SnmpAgentSettingsDict,
SsidConfigDict,
UpdateProgressDict,
)
from napalm_device_types.nat_vpn import NatVpnMixin
+1 -1
View File
@@ -17,7 +17,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from napalm_device_types.models import ApConfigDict, ApConfigResultDict
from napalm_device_types.access_point_models import ApConfigDict, ApConfigResultDict
#: The parts without a subject, and the values of ``ApConfigDict`` each writes.
AP_CONFIG_PARTS = frozenset(
+16 -1
View File
@@ -15,7 +15,22 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from napalm_device_types.models import DhcpLeaseDict
from typing_extensions import TypedDict
class DhcpLeaseDict(TypedDict):
"""A lease a DHCP server handed out (``DhcpLeasesMixin.get_dhcp_leases``).
``mac`` lower-case and colon-separated; ``hostname`` "" when the client sent
none; ``lease_end`` the Unix time the lease ends, 0 when it does not end or is
not known; ``state`` the server's own word for it ("" when it has none).
"""
mac: str
ip: str
hostname: str
lease_end: int
state: str
class DhcpLeasesMixin:
-20
View File
@@ -8,10 +8,6 @@ from typing import Literal, NotRequired, get_args
from typing_extensions import TypedDict
from napalm_device_types.access_point_models import ApConfigDict as ApConfigDict
from napalm_device_types.access_point_models import ApConfigResultDict as ApConfigResultDict
from napalm_device_types.access_point_models import ApSsidConfigDict as ApSsidConfigDict
# The SNMP health profile shapes live in snmp_health_profile.py, those of the access
# point getters in access_point_models.py; re-exported here, where they were.
from napalm_device_types.access_point_models import ChannelScanEntryDict as ChannelScanEntryDict
@@ -22,7 +18,6 @@ from napalm_device_types.access_point_models import MeshConfigDict as MeshConfig
from napalm_device_types.access_point_models import MeshPeerDict as MeshPeerDict
from napalm_device_types.access_point_models import RadioStatusDict as RadioStatusDict
from napalm_device_types.access_point_models import SSIDBridgeDict as SSIDBridgeDict
from napalm_device_types.access_point_models import SsidConfigDict as SsidConfigDict
from napalm_device_types.access_point_models import SSIDDict as SSIDDict
from napalm_device_types.access_point_models import WirelessClientDict as WirelessClientDict
from napalm_device_types.access_point_models import WirelessConfigDict as WirelessConfigDict
@@ -540,21 +535,6 @@ class FirewallRuleDiffDict(TypedDict):
update: list[FirewallRuleUpdateDict]
class DhcpLeaseDict(TypedDict):
"""A lease a DHCP server handed out (``DhcpLeasesMixin.get_dhcp_leases``).
``mac`` lower-case and colon-separated; ``hostname`` "" when the client sent
none; ``lease_end`` the Unix time the lease ends, 0 when it does not end or is
not known; ``state`` the server's own word for it ("" when it has none).
"""
mac: str
ip: str
hostname: str
lease_end: int
state: str
class DhcpReservationDict(TypedDict):
"""A single static DHCP reservation (MAC -> IP), in vendor-neutral form.
+1 -1
View File
@@ -10,7 +10,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING
from napalm_device_types.models import SsidConfigDict
from napalm_device_types.access_point_models import SsidConfigDict
#: The channel that lets a radio choose its own (``set_radio_channels``).
AUTO_CHANNEL = 0
+5 -5
View File
@@ -179,12 +179,12 @@ class TestDeclarations:
):
assert name in napalm_device_types.__all__, name
def test_models_re_exports_the_shapes(self):
from napalm_device_types import models
def test_the_shapes_live_beside_their_declarations(self):
from napalm_device_types import access_point_models, dhcp_leases
assert models.DhcpLeaseDict is DhcpLeaseDict
assert models.SsidConfigDict is SsidConfigDict
assert models.ApConfigDict is ApConfigDict
assert dhcp_leases.DhcpLeaseDict is DhcpLeaseDict
assert access_point_models.SsidConfigDict is SsidConfigDict
assert access_point_models.ApConfigDict is ApConfigDict
class TestParts: