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).
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
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
get_network_targets()fillsNetworkTargetDict.uplinksfor 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
uplinksfield).Changes
napalm_proxmox/uplinks.py(new):bridge_uplinks(bridge, network)readsbridge_ports(Linux bridge) orovs_ports(OVS bridge) fromGET /nodes/{node}/network.slaves, OVSovs_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.OVSIntPortand VLAN subinterfaces (vlan, dotted names) are no uplinks: they never carry the bridge's untagged traffic to the switch.uplinksout (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.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 anOVSIntPort(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.napalm-standard checkmeets the standard,ratchetwithin the baseline.Related
_VIRTUAL_IFACE_PREFIXESwas removed, soset_vlannever finds a switch uplink. Not fixed here.pyproject.tomlstill requiresnapalm_device_types>=4.22.0; raise it to the release that carriesuplinksonce that is out.Priority: P4