feat: get_network_targets names each bridge's uplinks (NetOrk/netork#1325) #38

Merged
christianmanivong merged 1 commits from feat/network-target-uplinks into main 2026-10-30 09:20:32 +00:00
Owner

Summary

get_network_targets() fills NetworkTargetDict.uplinks for every bridge: the physical NICs it leaves the node through, one group per bridge port. netOrk follows them to the switch port behind the bridge, to warn in the VM dialog when a VM without a VLAN tag would land nowhere (NetOrk/netork#1325).

Depends on NAPALM/napalm-device-types#58 (the uplinks field).

Changes

  • napalm_proxmox/uplinks.py (new): bridge_uplinks(bridge, network) reads bridge_ports (Linux bridge) or ovs_ports (OVS bridge) from GET /nodes/{node}/network.
    • A bond (slaves, OVS ovs_bonds) becomes one group of its NICs; a NIC (eth, OVSPort) its own group. An OVS bond slave without a type of its own counts as a NIC.
    • OVSIntPort and VLAN subinterfaces (vlan, dotted names) are no uplinks: they never carry the bridge's untagged traffic to the switch.
    • A port missing from the config or of a kind it cannot place leaves uplinks out (unknown) rather than guessing; a bridge without ports gets [].
  • get_network_targets() sets it on bridges; vnets get none. The bridge loop was folded into one branch.
  • CHANGELOG under Unreleased.

Tests

  • tests/test_network_target_uplinks.py, 10 cases: Linux bridge on a NIC, on a bond, on a VLAN subinterface, host-only; OVS bridge with a bond and an OVSIntPort (pve-dual's shape: [["nic0", "nic1"]]); OVS bridge on one port and on two ports (two groups); port missing from the config; port of an unknown kind; vnet.
  • pytest 360 passed; ruff, ruff format clean; mypy clean for this package; napalm-standard check meets the standard, ratchet within the baseline.

Related

  • NAPALM/napalm-proxmox#37: _VIRTUAL_IFACE_PREFIXES was removed, so set_vlan never finds a switch uplink. Not fixed here.
  • pyproject.toml still requires napalm_device_types>=4.22.0; raise it to the release that carries uplinks once that is out.

Priority: P4

## Summary `get_network_targets()` fills `NetworkTargetDict.uplinks` for every bridge: the physical NICs it leaves the node through, one group per bridge port. netOrk follows them to the switch port behind the bridge, to warn in the VM dialog when a VM without a VLAN tag would land nowhere (NetOrk/netork#1325). Depends on NAPALM/napalm-device-types#58 (the `uplinks` field). ## Changes - `napalm_proxmox/uplinks.py` (new): `bridge_uplinks(bridge, network)` reads `bridge_ports` (Linux bridge) or `ovs_ports` (OVS bridge) from `GET /nodes/{node}/network`. - A bond (`slaves`, OVS `ovs_bonds`) becomes one group of its NICs; a NIC (`eth`, `OVSPort`) its own group. An OVS bond slave without a type of its own counts as a NIC. - `OVSIntPort` and VLAN subinterfaces (`vlan`, dotted names) are no uplinks: they never carry the bridge's untagged traffic to the switch. - A port missing from the config or of a kind it cannot place leaves `uplinks` out (unknown) rather than guessing; a bridge without ports gets `[]`. - `get_network_targets()` sets it on bridges; vnets get none. The bridge loop was folded into one branch. - CHANGELOG under Unreleased. ## Tests - `tests/test_network_target_uplinks.py`, 10 cases: Linux bridge on a NIC, on a bond, on a VLAN subinterface, host-only; OVS bridge with a bond and an `OVSIntPort` (pve-dual's shape: `[["nic0", "nic1"]]`); OVS bridge on one port and on two ports (two groups); port missing from the config; port of an unknown kind; vnet. - pytest 360 passed; ruff, ruff format clean; mypy clean for this package; `napalm-standard check` meets the standard, `ratchet` within the baseline. ## Related - NAPALM/napalm-proxmox#37: `_VIRTUAL_IFACE_PREFIXES` was removed, so `set_vlan` never finds a switch uplink. Not fixed here. - `pyproject.toml` still requires `napalm_device_types>=4.22.0`; raise it to the release that carries `uplinks` once that is out. Priority: P4
christianmanivong added 1 commit 2026-10-30 08:28:27 +00:00
feat: get_network_targets names each bridge's uplinks (NetOrk/netork#1325)
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m21s
CI / driver (pull_request) Successful in 3m5s
driver / publish (pull_request) Skipped
72c30dd4c2
netOrk's VM dialog follows a bridge's physical NICs to the switch port
behind it, to warn when a VM without a VLAN tag would land nowhere. The
driver knows those NICs from the node's network config.

uplinks is read from bridge_ports (Linux bridge) or ovs_ports (OVS
bridge), one group per bridge port: a bond (slaves / ovs_bonds) as its
NICs together, a NIC alone. Internal ports (OVSIntPort) and VLAN
subinterfaces leave out, as they never carry the bridge's untagged
traffic to the switch. A port missing from the config or of a kind the
driver cannot place leaves the key out rather than guessing.
christianmanivong merged commit d8ac209fb9 into main 2026-10-30 09:20:32 +00:00
christianmanivong deleted branch feat/network-target-uplinks 2026-10-30 09:20:32 +00:00
Sign in to join this conversation.