Files
napalm-vmware/napalm_vmware/parse/licenses.py
T
Christian Manivong 990dfe2f3c
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 25s
CI / test (3.12) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 26s
feat!: report hosts and licenses as facts, not warnings (0.2.0)
get_device_warnings is gone; netOrk names the warnings from facts
(netOrk #1111). get_hypervisor_hosts() reports each host's connection
state, maintenance mode, configuration issues and managing vCenter;
get_licenses() the assigned licenses with the edition key as edition,
never the key itself.

The reach stays: the ESXi driver reports connected as None (a
disconnected host could not have answered), and managed_by only for a
host it reached directly. parse/warnings.py is replaced by
parse/hosts.py and parse/licenses.py.
2026-10-17 09:41:47 +02:00

20 lines
628 B
Python

"""Licenses assigned on an endpoint, as facts (``LicenseMixin.get_licenses``).
The edition key says which edition runs -- ``esxBasic`` is the free vSphere
Hypervisor, whose API refuses every write; what follows from that is the
caller's to decide. The license key itself is never reported.
"""
from __future__ import annotations
from typing import Any
from napalm_device_types.models import LicenseDict
def license_list(licenses: list[dict[str, Any]]) -> list[LicenseDict]:
return [
{"name": lic.get("name", ""), "status": "active", "edition": str(lic.get("editionKey", ""))}
for lic in licenses
]