feat: public contracts for update progress, DNS forwards and OSPF (4.17.0)
CI / test (3.10) (push) Successful in 35s
CI / test (3.11) (push) Successful in 32s
CI / test (3.12) (push) Successful in 30s
CI / test (3.13) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.11) (pull_request) Successful in 25s
CI / test (3.12) (pull_request) Successful in 26s
CI / test (3.13) (pull_request) Successful in 26s
CI / test (3.10) (push) Successful in 35s
CI / test (3.11) (push) Successful in 32s
CI / test (3.12) (push) Successful in 30s
CI / test (3.13) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.11) (pull_request) Successful in 25s
CI / test (3.12) (pull_request) Successful in 26s
CI / test (3.13) (pull_request) Successful in 26s
An application followed a firewall's upgrade, edited its resolver's forwards and read its OSPF state through the driver's private REST helpers (NetOrk/netork#1113). Declared contracts, neutral shapes: - UpdateMixin.get_update_progress() -> UpdateProgressDict {state, log} for an update apply_updates only starts. - DnsForwardMixin: get_dns_forwards(), set_dns_forward(domain, server, port), remove_dns_forward(domain); the driver applies. - OspfMixin.get_ospf() -> OspfDict {router_id, areas, interfaces}; the routing daemon's format is the driver's to translate. All declared only.
This commit is contained in:
1 parent
753ddc5eda
commit
1dd448e1d3
7 files changed
+181
-2
No files matched your search
@@ -0,0 +1,47 @@
|
||||
"""Public contracts for what an application reached through driver internals.
|
||||
|
||||
netOrk followed a firewall's upgrade, edited its resolver's forwards and read
|
||||
its OSPF state through the driver's private REST helpers (NetOrk/netork#1113).
|
||||
Each becomes a declared method with a neutral shape; the vendor's own format
|
||||
is translated by the driver.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import get_type_hints
|
||||
|
||||
from napalm_device_types import (
|
||||
DnsForwardDict,
|
||||
DnsForwardMixin,
|
||||
OspfDict,
|
||||
OspfInterfaceDict,
|
||||
OspfMixin,
|
||||
UpdateMixin,
|
||||
UpdateProgressDict,
|
||||
)
|
||||
|
||||
|
||||
def test_update_progress_is_a_state_and_its_log():
|
||||
assert set(get_type_hints(UpdateProgressDict)) == {"state", "log"}
|
||||
assert not hasattr(UpdateMixin, "get_update_progress")
|
||||
|
||||
|
||||
def test_a_dns_forward_names_the_domain_and_where_it_goes():
|
||||
assert set(get_type_hints(DnsForwardDict)) == {"domain", "server", "port", "enabled"}
|
||||
for name in ("get_dns_forwards", "set_dns_forward", "remove_dns_forward"):
|
||||
assert not hasattr(DnsForwardMixin, name), name
|
||||
|
||||
|
||||
def test_ospf_in_neutral_terms():
|
||||
assert set(get_type_hints(OspfDict)) == {"router_id", "areas", "interfaces"}
|
||||
assert set(get_type_hints(OspfInterfaceDict)) == {
|
||||
"address",
|
||||
"prefix_length",
|
||||
"area",
|
||||
"network_type",
|
||||
"authentication",
|
||||
"neighbors",
|
||||
"neighbors_adjacent",
|
||||
"cost",
|
||||
}
|
||||
assert not hasattr(OspfMixin, "get_ospf")
|
||||
Reference in new issue
Block a user