Author SHA1 Message Date
christianmanivong a37dc8d632 Merge feature/network-target-vlan-tag: expose fixed VLAN tag for SDN vnets 2026-07-07 10:20:42 +02:00
christianmanivong cb274156a4 feat(models): add fixed_vlan_tag to NetworkTargetDict for SDN vnets 2026-07-07 10:20:36 +02:00
christianmanivong a16ca77156 Merge feature/network-targets: add get_network_targets() interface 2026-07-07 09:09:57 +02:00
christianmanivong fcf72b6dad feat(hypervisor): add get_network_targets() interface for VM NIC provisioning
Returns selectable bridge/vnet targets for a new VM's NIC, distinguishing
real bridges (Linux, OVS) from SDN vnets, and exposing whether a NIC on that
target may additionally carry a vlan_tag (Linux bridge vlan_aware flag, OVS
always, SDN vnet never — the VLAN is already fixed by the vnet's zone/tag).
2026-07-07 09:03:44 +02:00
christianmanivong 2cc93885b4 Reapply "Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface"
This reverts commit 97cab9754b.
2026-07-07 08:20:55 +02:00
christianmanivong 97cab9754b Revert "Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface"
This reverts commit 7d18c12579, reversing
changes made to 7f0dd789b0.
2026-07-07 00:53:06 +02:00
christianmanivong 7d18c12579 Merge feature/generic-vm-provisioning: generalize create_vm_from_cloud_init interface 2026-07-07 00:46:30 +02:00
2 changed files with 38 additions and 0 deletions
+19
View File
@@ -16,6 +16,7 @@ from napalm_device_types._ucd_metrics import IF_SKIP_DEFAULT, collect_ucd_metric
from napalm_device_types.models import (
HealthMetricsDict,
NICConfigDict,
NetworkTargetDict,
PackageDict,
SnapshotDict,
StorageVolumeDict,
@@ -655,3 +656,21 @@ class HypervisorDriver(DeviceTypeDriver):
timeout is exceeded.
"""
raise NotImplementedError
def get_network_targets(self) -> List[NetworkTargetDict]:
"""
List the network targets a new VM's NIC may attach to.
Returns only targets that are actually valid ``NICConfigDict.bridge``
values — real bridges (Linux or OVS) and SDN network segments (vnets).
Physical NICs, bonds, and other non-bridge interface types are excluded,
since VMs cannot attach directly to them on any hypervisor this interface
supports.
Returns:
List[NetworkTargetDict] - each entry's ``vlan_aware`` flag tells the
caller whether a ``NICConfigDict.vlan_tag`` may additionally be set
for a NIC using that target (see ``NetworkTargetDict`` for the
per-kind rules).
"""
raise NotImplementedError
+19
View File
@@ -730,3 +730,22 @@ class VMStatusDict(TypedDict):
ip_address: NotRequired[str] # Management NIC IP (absent if VM has no IP or is stopped)
hostname: NotRequired[str] # Hostname resolved from IP (if available)
mac_address: NotRequired[str] # MAC of management NIC
class NetworkTargetDict(TypedDict):
"""A selectable network target for a new VM's NIC (``NICConfigDict.bridge``).
Distinguishes real bridges (Linux or OVS) from SDN network segments (vnets),
and tells the caller whether a separate ``vlan_tag`` may be applied on top:
- Linux bridge: vlan_aware reflects the bridge's own ``bridge_vlan_aware`` flag.
- OVS bridge: always vlan_aware (OVS bridges tag per-port regardless of a
dedicated "VLAN aware" setting).
- SDN vnet: never vlan_aware — the VLAN is already fixed by the vnet's zone/tag,
so a NIC attached to it must not also carry a ``vlan_tag``. That fixed VLAN
is surfaced via ``fixed_vlan_tag`` instead, for display purposes.
"""
name: str # Bridge or vnet name, usable directly as NICConfigDict.bridge
kind: str # "bridge" or "vnet"
vlan_aware: bool # True if a NICConfigDict.vlan_tag may be set on top of this target
fixed_vlan_tag: NotRequired[int | None] # vnet only: the VLAN ID already baked into it