feat!: report hosts and licenses as facts, not warnings (0.2.0)
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
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
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.
This commit is contained in:
1 parent
276276bd9f
commit
990dfe2f3c
10 files changed
+154
-100
No files matched your search
+11
-5
@@ -6,8 +6,10 @@ from pathlib import Path
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from napalm.base.exceptions import ConnectionException
|
||||
from napalm_device_types import HypervisorDriver
|
||||
from napalm_device_types import HypervisorDriver, LicenseMixin
|
||||
from napalm_device_types.models import (
|
||||
HypervisorHostDict,
|
||||
LicenseDict,
|
||||
SnapshotDict,
|
||||
StorageVolumeDict,
|
||||
VirtualNetworkDict,
|
||||
@@ -17,12 +19,13 @@ from napalm_device_types.models import (
|
||||
from napalm_vmware import _session, paths
|
||||
from napalm_vmware._inventory import Inventory
|
||||
from napalm_vmware.parse.environment import environment
|
||||
from napalm_vmware.parse.hosts import hypervisor_hosts
|
||||
from napalm_vmware.parse.licenses import license_list
|
||||
from napalm_vmware.parse.networks import NetworkIndex, network_index, virtual_networks
|
||||
from napalm_vmware.parse.snapshots import snapshot_list
|
||||
from napalm_vmware.parse.storage import storage_pools
|
||||
from napalm_vmware.parse.vm_config import vm_config
|
||||
from napalm_vmware.parse.vms import vm_list
|
||||
from napalm_vmware.parse.warnings import host_warnings
|
||||
from napalm_vmware.provision.image import DEFAULT_CACHE_DIR
|
||||
|
||||
_DEFAULT_PORT = 443
|
||||
@@ -30,7 +33,7 @@ _DEFAULT_PORT = 443
|
||||
_DRIVER_FOR_API = {"HostAgent": "vmware_esxi", "VirtualCenter": "vmware_vcenter"}
|
||||
|
||||
|
||||
class VmwareBaseDriver(HypervisorDriver):
|
||||
class VmwareBaseDriver(LicenseMixin, HypervisorDriver):
|
||||
"""Shared implementation. Concrete drivers set ``API_TYPE`` and ``STANDALONE``."""
|
||||
|
||||
VENDOR = "VMware"
|
||||
@@ -154,5 +157,8 @@ class VmwareBaseDriver(HypervisorDriver):
|
||||
def get_environment(self) -> dict[str, Any]:
|
||||
return environment(self._hosts())
|
||||
|
||||
def get_device_warnings(self) -> list[dict[str, Any]]:
|
||||
return host_warnings(self._hosts(), self._inventory.licenses(), standalone=self.STANDALONE)
|
||||
def get_hypervisor_hosts(self) -> list[HypervisorHostDict]:
|
||||
return hypervisor_hosts(self._hosts(), standalone=self.STANDALONE)
|
||||
|
||||
def get_licenses(self) -> list[LicenseDict]:
|
||||
return license_list(self._inventory.licenses())
|
||||
Reference in new issue
Block a user