sdn: _VIRTUAL_IFACE_PREFIXES was removed, so set_vlan never finds a switch uplink #37

Closed
opened 2026-10-30 08:21:22 +00:00 by christianmanivong · 0 comments
Owner

sdn_mixin.py:225 (_is_physical_uplink) reads self._VIRTUAL_IFACE_PREFIXES, but commit b1ba991 (set_hostname, 2026-06-19) removed that constant and nothing defines it any more (grep over the repo and napalm-device-types finds only the use).

Effect: _is_physical_uplink raises AttributeError; _find_switch_uplink swallows it and always returns None, so set_vlan always fails with "no LLDP-detected switch uplink found" — on every Proxmox host, whatever its LLDP says. netOrk pins 16f1b87, which contains b1ba991.

Repro:

from unittest.mock import MagicMock
from napalm_proxmox.sdn_mixin import ProxmoxSDNMixin
m = ProxmoxSDNMixin()
m._get_node_network = MagicMock(return_value=[{"iface": "eno1", "type": "eth"}])
m.get_lldp_neighbors_detail = MagicMock(return_value={"eno1": [{"remote_system_capab": ["bridge"]}]})
m.get_lldp_neighbors = MagicMock(return_value={"eno1": [{"hostname": "sw"}]})
m._find_switch_uplink()   # None
m._is_physical_uplink("eno1", {"eno1": {"type": "eth"}})   # AttributeError

No test covers _is_physical_uplink/_find_switch_uplink, which is how it went unnoticed.

Fix: restore the constant (or derive the check from the interface type, as the new uplinks.py on feat/network-target-uplinks does), plus a test for _find_switch_uplink with one physical and one virtual interface.

Found while building NetOrk/netork#1325.

Priority: P2 — VLAN provisioning on Proxmox hosts has been broken since June without any sign beyond the error message.

`sdn_mixin.py:225` (`_is_physical_uplink`) reads `self._VIRTUAL_IFACE_PREFIXES`, but commit b1ba991 (set_hostname, 2026-06-19) removed that constant and nothing defines it any more (grep over the repo and napalm-device-types finds only the use). **Effect:** `_is_physical_uplink` raises `AttributeError`; `_find_switch_uplink` swallows it and always returns `None`, so `set_vlan` always fails with "no LLDP-detected switch uplink found" — on every Proxmox host, whatever its LLDP says. netOrk pins 16f1b87, which contains b1ba991. **Repro:** ```python from unittest.mock import MagicMock from napalm_proxmox.sdn_mixin import ProxmoxSDNMixin m = ProxmoxSDNMixin() m._get_node_network = MagicMock(return_value=[{"iface": "eno1", "type": "eth"}]) m.get_lldp_neighbors_detail = MagicMock(return_value={"eno1": [{"remote_system_capab": ["bridge"]}]}) m.get_lldp_neighbors = MagicMock(return_value={"eno1": [{"hostname": "sw"}]}) m._find_switch_uplink() # None m._is_physical_uplink("eno1", {"eno1": {"type": "eth"}}) # AttributeError ``` No test covers `_is_physical_uplink`/`_find_switch_uplink`, which is how it went unnoticed. **Fix:** restore the constant (or derive the check from the interface `type`, as the new `uplinks.py` on feat/network-target-uplinks does), plus a test for `_find_switch_uplink` with one physical and one virtual interface. Found while building NetOrk/netork#1325. Priority: P2 — VLAN provisioning on Proxmox hosts has been broken since June without any sign beyond the error message.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-proxmox#37