Skip to content

fix: resolve NIC port MAC misattribution when NetworkPort IDs collide across adapters#449

Open
mcanevet wants to merge 1 commit into
bmc-toolbox:mainfrom
mcanevet:fix/network-port-mac-attribution
Open

fix: resolve NIC port MAC misattribution when NetworkPort IDs collide across adapters#449
mcanevet wants to merge 1 commit into
bmc-toolbox:mainfrom
mcanevet:fix/network-port-mac-attribution

Conversation

@mcanevet

@mcanevet mcanevet commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR implement/change/remove?

collectEthernetInfo matched a NetworkPort's local ID against the system-wide
EthernetInterfaces collection by ID (exact match or "-"-delimited prefix).
NetworkPort.ID is only unique within its own adapter, 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 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.id rather than by the ambiguous local
ID, and prefers MAC-based matching in collectEthernetInfo when available.
Falls back to the existing ID-based matching for adapters that don't expose
NetworkDeviceFunctions.

Checklist

  • Tests added
  • Similar commits squashed

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 NetworkPort IDs
collide with unrelated EthernetInterfaces IDs.

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

fix: NIC ports on add-on adapters (e.g. Supermicro AOC-S25G-m2S) no longer
report the wrong MAC address when their local port IDs collide with an
unrelated adapter's. MACs are now resolved via NetworkDeviceFunctions when
available, which is unambiguous across adapters.

Copilot AI review requested due to automatic review settings July 9, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.NetworkDeviceFunctions mapped to NetworkPort by PhysicalPortAssignment (@odata.id).
  • Prefer MAC-based matching in collectEthernetInfo when 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.

Comment thread internal/redfishwrapper/inventory_collect.go
…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.
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.

2 participants