feat: the firmware a vendor offers, as a fact (4.16.0)
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 24s
CI / test (3.12) (push) Successful in 27s
CI / test (3.13) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 25s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 27s
CI / test (3.13) (pull_request) Successful in 25s

FirmwareOfferMixin.get_firmware_offer() -> FirmwareOfferDict
{current_version, latest_version, newer, download_url?}: what runs and
the newest firmware the vendor offers, from its download catalogue or
the device's own update check. Comparing vendor version strings stays
with the driver, so it says whether the offer is newer; whether that is a
warning is the application's call (NetOrk/netork#1111). Declared only.
This commit is contained in:
christianmanivong committed 2026-10-17 13:00:43 +02:00
1 parent 4641063db6
commit 59fb1273e8
5 files changed
+62 -1

No files matched your search

+15
View File
@@ -47,3 +47,18 @@ def test_the_getters_are_declared_only():
assert not hasattr(PackageProxyMixin, "get_package_proxy")
assert not hasattr(LicenseMixin, "get_licenses")
assert not hasattr(HypervisorDriver, "get_hypervisor_hosts")
def test_a_firmware_offer_says_what_runs_and_what_is_offered():
"""The vendor's newer firmware is a fact the driver can know (a download
catalogue, the device's own update check); whether it is a warning is the
application's call. Comparing vendor version strings stays with the driver,
so it says itself whether the offer is newer."""
from napalm_device_types import FirmwareOfferDict, FirmwareOfferMixin
hints = get_type_hints(FirmwareOfferDict)
assert set(hints) == {"current_version", "latest_version", "newer", "download_url"}
assert FirmwareOfferDict.__required_keys__ == frozenset(
{"current_version", "latest_version", "newer"}
)
assert not hasattr(FirmwareOfferMixin, "get_firmware_offer")