exporter: filter Supermicro Redfish device-bound firmware from hardware.firmware

isDeviceBoundFirmwareName did not catch Supermicro FirmwareInventory naming
conventions where a digit follows the type prefix directly ("GPU1 System Slot0",
"NIC1 System Slot0 AOM-DP805-IO") instead of a space. Also missing: "Power supply N",
"NVMeController N", and "Software Inventory" (generic label for all HGX per-component
firmware slots — GPU, NVSwitch, PCIeRetimer, ERoT, InfoROM, etc.).

On SYS-A21GE-NBRT (HGX B200) this caused 29 device-bound entries to leak into
hardware.firmware: 8 GPU, 9 NIC, 1 NVMe, 6 PSU, 4 PCIeSwitch, 1 Software Inventory.

Fix: extend isDeviceBoundFirmwareName with patterns for all four new cases.
Add TestIsDeviceBoundFirmwareName covering both excluded and kept entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-03-12 13:48:55 +03:00
parent 1eb639e6bf
commit 5815100e2f
2 changed files with 63 additions and 0 deletions

View File

@@ -881,3 +881,54 @@ func TestConvertToReanimator_PreservesVitalsAcrossCanonicalDedup(t *testing.T) {
}
func boolPtr(v bool) *bool { return &v }
// TestIsDeviceBoundFirmwareName verifies that device-bound firmware entries from
// Supermicro Redfish FirmwareInventory are correctly identified and excluded from
// hardware.firmware.
//
// Regression guard: names like "GPU1 System Slot0" and "NIC1 System Slot0 ..." were
// not caught because the old check required "gpu " / "nic " (with space), while
// Supermicro places a digit immediately after the type prefix. (2026-03-12)
func TestIsDeviceBoundFirmwareName(t *testing.T) {
cases := []struct {
name string
want bool
}{
// Supermicro Redfish — device-bound, must be excluded
{"GPU1 System Slot0", true},
{"GPU8 System Slot0", true},
{"NIC1 System Slot0 AOM-DP805-IO", true},
{"NIC9 System Slot8 MCX75310AAS-NEAT", true},
{"NVMeController1", true},
{"Power supply 1", true},
{"Power supply 6", true},
{"Software Inventory", true},
{"software inventory", true}, // case-insensitive
// Generic / legacy names already covered before this fix
{"GPU SomeDevice", true},
{"NIC OnboardLAN", true},
{"PSU1", true},
{"NVMe Drive", true},
// HGX FW ID patterns (in case Id is used as name)
{"HGX_FW_GPU_SXM_1", true},
{"HGX_InfoROM_GPU_SXM_2", true},
// System-level firmware — must NOT be excluded
{"BIOS", false},
{"BMC", false},
{"BMC Backup", false},
{"Capsule BIOS", false},
{"Capsule ME", false},
{"CPLD Motherboard Golden", false},
{"CPLD AOMboard", false},
{"FrontFanboard CPLD", false},
{"Motherboard PCIeSwitch 1", false}, // board-integrated, no device record
{"SecureBoot", false},
{"BIOS ME", false},
}
for _, tc := range cases {
got := isDeviceBoundFirmwareName(tc.name)
if got != tc.want {
t.Errorf("isDeviceBoundFirmwareName(%q) = %v, want %v", tc.name, got, tc.want)
}
}
}