Skip to content

feat: collect the BMC's own management NIC from Manager EthernetInterfaces - #454

Merged
mergify[bot] merged 1 commit into
bmc-toolbox:mainfrom
mcanevet:feat/bmc-management-nic
Aug 6, 2026
Merged

feat: collect the BMC's own management NIC from Manager EthernetInterfaces#454
mergify[bot] merged 1 commit into
bmc-toolbox:mainfrom
mcanevet:feat/bmc-management-nic

Conversation

@mcanevet

@mcanevet mcanevet commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR implement/change/remove?

device.BMC.NIC was always left nil: bmcAttributes only populated the
BMC's identity/firmware fields (vendor, model, serial, firmware) from the
Manager resource. The BMC's own network interface(s) — the one you actually
connect to for out-of-band management — live under a separate Redfish
subtree, /redfish/v1/Managers/{id}/EthernetInterfaces, distinct from the
host's NICs under ComputerSystem, which collectNICs already handles.

Adds collectBMCNIC, wired into bmcAttributes, to walk the Manager's
EthernetInterfaces and populate device.BMC.NIC. Filters the same
00:00:00:00:00:00 placeholder MAC convention used elsewhere in this
package, falling back to PermanentMACAddress when MACAddress is empty
or the placeholder. Best-effort: does nothing if the Manager has no
EthernetInterfaces link or every interface lacks a usable MAC.

Checklist

  • Tests added
  • Similar commits squashed

The HW vendor this change applies to (if applicable)

Generic — Manager.EthernetInterfaces is a standard Redfish resource, not
vendor-specific. Validated end-to-end on Supermicro.

The HW model number, product name this change applies to (if applicable)

Validated on a Supermicro AS-1114S-WN10RT-EU, which exposed two Manager
EthernetInterfaces (a dedicated "ToHost" port and a shared NIC port).

The BMC firmware and/or BIOS versions that this change applies to (if applicable)

Observed on BMC firmware 01.04.04.

What version of tooling - vendor specific or opensource does this change depend on (if applicable)

N/A

Description for changelog/release notes

feat: populate device.BMC.NIC (the BMC's own out-of-band management
network interface) from the Manager resource's EthernetInterfaces,
previously never collected. Distinct from device.NICs, which lists the
host's own network interfaces.

Copilot AI review requested due to automatic review settings July 9, 2026 16:18

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

This PR updates the Redfish inventory collection to populate device.BMC.NIC by walking the BMC Manager’s EthernetInterfaces subtree, so the out-of-band management NIC is captured separately from host NICs collected under ComputerSystem.

Changes:

  • Wire BMC NIC collection into bmcAttributes so device.BMC.NIC is populated from Manager/EthernetInterfaces.
  • Add collectBMCNIC to translate Manager EthernetInterface data into common.NICPort entries.
  • Add a unit test and fixtures covering Manager EthernetInterfaces inventory.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/redfishwrapper/inventory.go Calls into new BMC NIC collection during BMC attribute gathering.
internal/redfishwrapper/inventory_collect.go Adds collectBMCNIC to build device.BMC.NIC from Manager EthernetInterfaces.
internal/redfishwrapper/inventory_test.go Adds a new test asserting device.BMC.NIC is populated and host NICs remain unaffected.
internal/redfishwrapper/fixtures/bmc_nic/ethernet_interfaces.json Adds a fixture for the Manager EthernetInterface collection.
internal/redfishwrapper/fixtures/bmc_nic/ethernet_1.json Adds a fixture for a Manager EthernetInterface member resource.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/redfishwrapper/inventory.go Outdated
Comment thread internal/redfishwrapper/inventory_collect.go Outdated
Comment thread internal/redfishwrapper/fixtures/bmc_nic/ethernet_1.json Outdated
Comment thread internal/redfishwrapper/inventory_collect.go
joelrebel
joelrebel previously approved these changes Jul 14, 2026

@joelrebel joelrebel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this contribution

@joelrebel

Copy link
Copy Markdown
Member

@mcanevet this requires the conflicts to be resolved

@mcanevet

Copy link
Copy Markdown
Contributor Author

@joelrebel rebased

@mcanevet
mcanevet force-pushed the feat/bmc-management-nic branch from c2dba8a to 88b6b25 Compare July 31, 2026 06:27
@joelrebel

Copy link
Copy Markdown
Member

@mcanevet another conflict here, if you can resolve it please

…faces

device.BMC.NIC was always left nil: bmcAttributes only populated the BMC's
identity/firmware fields from the Manager resource. The BMC's own network
interface(s) live under /redfish/v1/Managers/{id}/EthernetInterfaces, a
separate Redfish subtree from the host's NICs (ComputerSystem), which
collectNICs already handles.

Add collectBMCNIC to walk the Manager's EthernetInterfaces and populate
device.BMC.NIC, filtering the same 00:00:00:00:00:00 placeholder MAC
convention used elsewhere and falling back to PermanentMACAddress.
@mcanevet
mcanevet force-pushed the feat/bmc-management-nic branch from 88b6b25 to b536841 Compare August 5, 2026 07:57
@mcanevet

mcanevet commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@joelrebel done

@joelrebel joelrebel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-06 06:40 UTC · Rule: default · triggered by rule refactored queue action rule
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-06 06:41 UTC · at b536841b4ca4a9b8ffe5a5d2d52b93ebd0301233 · merge

This pull request spent 15 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 83f0b7a into bmc-toolbox:main Aug 6, 2026
4 of 5 checks passed
@mergify mergify Bot removed the queued label Aug 6, 2026
mergify Bot added a commit to tinkerbell/tinkerbell that referenced this pull request Aug 10, 2026
## Summary
- Adds `Hardware.status.bmcInventory`, populated out-of-band via the BMC (Redfish/IPMI
  through bmclib), covering BIOS, BMC (incl. its own management NIC), mainboard, CPUs,
  memory, host NICs, drives, storage controllers, PSUs, TPMs, and GPUs.
- Rufio's Machine controller collects this by reusing the BMC connection it already
  opens for power polling — no second connection. Collection only actually runs once
  per 24h per Machine (or immediately if a `tinkerbell.org/refresh-inventory: "true"`
  annotation is set on the Machine), independent of the 3-minute power-poll cadence.
- Every list field is sorted by a stable per-component key before being compared/written,
  so BMCs returning components in non-deterministic order don't cause a spurious status
  diff (and reconcile loop) every poll.
- Status writes go through Server-Side Apply under a dedicated `machine-controller` field
  manager, so this can be extended independently of other status sub-fields later.
- BMC unreachable/unsupported (e.g. IPMI-only hardware, which bmclib can't collect
  inventory from at all) is treated as a permanent, non-fatal condition: logged, an
  `InventoryUnreachable` Warning event is emitted, and the Machine's own reconciliation
  and last-known-good inventory are left untouched.
- Every field on the new API types is optional — field coverage varies significantly by
  BMC vendor/protocol, so an absent field reflects what the BMC reports, not an error.

While validating this against real hardware, I found and fixed several upstream bmclib
Redfish-collection bugs/gaps that were producing missing or wrong inventory data. Those
are submitted separately, upstream, and are independent of this PR (Tinkerbell degrades
gracefully to missing data without them, and gets more accurate/complete data once they
land):
- bmc-toolbox/bmclib#449 — NIC port MAC misattribution when NetworkPort IDs collide across adapters
- bmc-toolbox/bmclib#450 — DIMM capacity used the wrong Redfish field (VolatileSizeMiB instead of CapacityMiB)
- bmc-toolbox/bmclib#451 — drive collection incorrectly gated on Storage.DrivesCount
- bmc-toolbox/bmclib#452 — Mainboard left unpopulated instead of sourced from the Chassis resource
- bmc-toolbox/bmclib#453 — BIOS.Vendor left unpopulated instead of sourced from the system manufacturer
- bmc-toolbox/bmclib#454 — collect the BMC's own out-of-band management NIC (distinct from host NICs)

This is a UI-less, additive change. A follow-up PR surfaces this data in the Hardware
detail page.

## Test plan
- [x] `make generate manifests` — CRD and deepcopy regenerated, no unrelated diff
- [x] Unit tests for `bmcInventoryFromDevice` (full fixture + nil-safety)
- [x] `sortDevice` determinism test (two orderings of the same logical inventory produce
      identical mapped output)
- [x] `dueForInventoryRefresh` table test (never collected, stale, fresh, manual-refresh
      annotation override)
- [x] Reconciler-level tests against a fake BMC provider: successful collection, an
      IPMI-only-style hard error, refresh cadence (3 calls → 1 actual `Inventory()` call),
      no-linked-Hardware no-op, and an end-to-end smoke test through `Reconcile()`
- [x] Verified live against real hardware in my own cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants