diff --git a/CHANGELOG.md b/CHANGELOG.md index 52a4336..3e15e52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.0] - 2026-11-26 + +### Added +- `get_vms()` reports each VM's `uid` (napalm-device-types 4.44.0's `VMDict.uid`, + NetOrk/netork#2728): its instance UUID, which already survives a migration and a + restore. netOrk knows a guest by `uid` on every hypervisor that has one. + ## [0.4.0] - 2026-11-25 ### Added diff --git a/napalm_vmware/parse/vms.py b/napalm_vmware/parse/vms.py index 3126a6f..a195b4c 100644 --- a/napalm_vmware/parse/vms.py +++ b/napalm_vmware/parse/vms.py @@ -87,6 +87,8 @@ def _vm( return { "name": vm.get("name", ""), "vmid": vm["config.instanceUuid"], + # VMDict.uid: the instance UUID already survives a migration and a restore. + "uid": vm["config.instanceUuid"], "moref": vm["_moref"], "type": "vm", "status": _STATUS.get(vm.get("runtime.powerState", ""), "unknown"), diff --git a/pyproject.toml b/pyproject.toml index 7cdfceb..326dab1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "napalm-vmware" -version = "0.4.0" +version = "0.5.0" description = "NAPALM drivers for VMware ESXi hosts and vCenter Server (vSphere API via pyVmomi)" readme = "README.md" requires-python = ">=3.12" diff --git a/tests/test_parse_vms.py b/tests/test_parse_vms.py index 1c2b394..923514a 100644 --- a/tests/test_parse_vms.py +++ b/tests/test_parse_vms.py @@ -33,6 +33,11 @@ class TestVmListFromVcsim: assert vm["node"] == "localhost.localdomain" assert vm["type"] == "vm" + def test_the_uid_is_the_instance_uuid(self, esxi_data, vm0): + # VMDict.uid: an identity that survives a migration and a restore; vSphere's + # instance UUID is one (NetOrk/netork#2728). + assert _vms(esxi_data)[0]["uid"] == vm0["config.instanceUuid"] + def test_vcenter_node_is_the_esxi_host(self, vcenter_data): nodes = {vm["name"]: vm["node"] for vm in _vms(vcenter_data)} assert nodes["DC0_H0_VM0"] == "DC0_H0"