Skip to content

Quick fix primary MAC lookup for shared MAC addresses - #413

Open
LambdaLightSource wants to merge 1 commit into
Solvik:masterfrom
LambdaLightSource:fix-shared-mac-primary-address
Open

LambdaLightSource wants to merge 1 commit into
Solvik:masterfrom
LambdaLightSource:fix-shared-mac-primary-address

Conversation

@LambdaLightSource

Copy link
Copy Markdown

Title

Fix primary MAC lookup for shared MAC addresses

Description

For NetBox 4.2+, MAC addresses are represented by MACAddress objects assigned to interfaces.

When a physical interface and its VLAN interfaces legitimately share the same MAC address, selecting the primary MAC using only the MAC value is ambiguous because multiple MACAddress objects may exist with that value.

This change scopes the lookup to both the current interface ID and MAC address, then assigns the matching MACAddress object's ID as primary_mac_address.

A regression test covers the shared-MAC case.

Validation:

  • focused shared-MAC regression test: 1 passed
  • tests/network.py: 4 passed
  • ruff check: passed
  • ruff format --check: passed
  • git diff --check: passed
  • py_compile: passed

This is intentionally submitted separately from #412 because the named VLAN parsing issue and the shared MAC primary address ambiguity have independent root causes.

@LambdaLightSource LambdaLightSource changed the title Quick Fix primary MAC lookup for shared MAC addresses Quick fix primary MAC lookup for shared MAC addresses Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant