fix: resolve NIC port MAC misattribution when NetworkPort IDs collide across adapters#449
Open
mcanevet wants to merge 1 commit into
Open
fix: resolve NIC port MAC misattribution when NetworkPort IDs collide across adapters#449mcanevet wants to merge 1 commit into
mcanevet wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a Redfish NIC inventory bug where NetworkPort.ID collisions across different adapters could cause ports to be attributed the wrong MAC (and related EthernetInterface-derived attributes). The change resolves MACs via NetworkDeviceFunctions + PhysicalPortAssignment (by @odata.id) when available, and adds a regression test/fixtures modeling the collision scenario.
Changes:
- Resolve per-port MACs authoritatively via
NetworkAdapter.NetworkDeviceFunctionsmapped toNetworkPortbyPhysicalPortAssignment(@odata.id). - Prefer MAC-based matching in
collectEthernetInfowhen an authoritative MAC is available; keep the existing ID-based matching as fallback. - Add a full end-to-end test + fixtures reproducing adapter-local port ID collisions (“1”/“2” on multiple adapters).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/redfishwrapper/inventory_collect.go | Adds authoritative MAC resolution via NetworkDeviceFunctions and uses preferred MAC matching in EthernetInterface correlation. |
| internal/redfishwrapper/inventory_test.go | Adds an end-to-end regression test for adapter-local NetworkPort.ID collisions across distinct adapters. |
| internal/redfishwrapper/inventory_collect_test.go | Updates the unit test callsite for the new collectEthernetInfo signature. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_interfaces.json | New fixtures: system NetworkInterfaces collection for the ID-collision scenario. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_interface_integrated_1.json | New fixtures: onboard network interface resource. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_interface_slot_1.json | New fixtures: add-on (slot) network interface resource. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_adapter_onboard.json | New fixtures: onboard adapter resource (ports “1”/“2”). |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_adapter_aoc.json | New fixtures: add-on adapter resource including NetworkDeviceFunctions. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_ports_onboard.json | New fixtures: onboard adapter NetworkPorts collection. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_ports_aoc.json | New fixtures: add-on adapter NetworkPorts collection. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_port_onboard_1.json | New fixtures: onboard port 1 resource with AssociatedNetworkAddresses. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_port_onboard_2.json | New fixtures: onboard port 2 resource with AssociatedNetworkAddresses. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_port_aoc_1.json | New fixtures: add-on port 1 resource (no AssociatedNetworkAddresses). |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_port_aoc_2.json | New fixtures: add-on port 2 resource (no AssociatedNetworkAddresses). |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_device_functions_aoc.json | New fixtures: add-on adapter NetworkDeviceFunctions collection. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_device_function_aoc_1.json | New fixtures: device function 1 linking MAC to physical port assignment. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/network_device_function_aoc_2.json | New fixtures: device function 2 linking MAC to physical port assignment. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/ethernet_interfaces.json | New fixtures: EthernetInterfaces collection used for attribute matching. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/ethernet_1.json | New fixtures: onboard EthernetInterface 1. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/ethernet_2.json | New fixtures: onboard EthernetInterface 2. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/ethernet_3.json | New fixtures: add-on EthernetInterface 3. |
| internal/redfishwrapper/fixtures/smc_aoc_id_collision/ethernet_4.json | New fixtures: add-on EthernetInterface 4. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…t ID NetworkPort.ID is only unique within its own adapter. collectEthernetInfo matched it exactly (or as a "-"-delimited prefix) against the system-wide EthernetInterfaces collection, so an add-on card whose local port IDs happen to collide with an unrelated adapter's (e.g. both using "1"/"2") silently inherited that adapter's MAC address and other ethernet attributes. Resolve each port's MAC authoritatively via the adapter's NetworkDeviceFunctions (Ethernet.MACAddress + PhysicalPortAssignment), which links a specific port by odata.id rather than by the ambiguous local ID, and prefer MAC-based matching in collectEthernetInfo when available. Falls back to the existing ID-based matching for adapters that don't expose NetworkDeviceFunctions. Reproduces and fixes a real-world case on a Supermicro AS-1114S-WN10RT-EU with an AOC-S25G-m2S add-on card, where the AOC's ports were reported with the onboard NIC's MAC addresses.
mcanevet
force-pushed
the
fix/network-port-mac-attribution
branch
from
July 9, 2026 14:12
e40b010 to
3c41db9
Compare
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR implement/change/remove?
collectEthernetInfomatched aNetworkPort's local ID against the system-wideEthernetInterfacescollection by ID (exact match or "-"-delimited prefix).NetworkPort.IDis only unique within its own adapter, so an add-on cardwhose local port IDs happen to collide with an unrelated adapter's (e.g. both
using "1"/"2") silently inherited that other adapter's MAC address and other
ethernet attributes — a real card can end up reported with a different
physical card's MAC.
This PR resolves each port's MAC authoritatively via the adapter's own
NetworkDeviceFunctions(Ethernet.MACAddress+PhysicalPortAssignment),which links a specific port by
odata.idrather than by the ambiguous localID, and prefers MAC-based matching in
collectEthernetInfowhen available.Falls back to the existing ID-based matching for adapters that don't expose
NetworkDeviceFunctions.Checklist
The HW vendor this change applies to (if applicable)
Supermicro
The HW model number, product name this change applies to (if applicable)
AS-1114S-WN10RT-EU with an AOC-S25G-m2S add-on card (25GbE). Likely affects
any Redfish implementation where an add-on adapter's local
NetworkPortIDscollide with unrelated
EthernetInterfacesIDs.The BMC firmware and/or BIOS versions that this change applies to (if applicable)
Observed on BMC firmware 01.04.04, BIOS 2.9.
What version of tooling - vendor specific or opensource does this change depend on (if applicable)
N/A
Description for changelog/release notes