fix(inspur): strip iBMC firmware build-timestamp suffix

A second NF5280M6 BMC-dump/live-CD pair showed RESTful version info
firmware versions carrying a build stamp ("08.05.01 (02/21/2024
16:51:27)") the live-CD does not, which churns a FIRMWARE_CHANGED event
on every source switch. cleanFirmwareVersion strips a trailing " (...)"
so BIOS/BMC match the bare live-CD version. See ADL-064 amendment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011LffAvostt3uMkiUbVUiyM
This commit is contained in:
Mikhail Chusavitin
2026-09-01 12:02:19 +03:00
co-authored by Claude Sonnet 5
parent 2fa0f78f94
commit 8278c77d98
3 changed files with 50 additions and 1 deletions
+30
View File
@@ -310,6 +310,36 @@ BMC`
}
}
// TestExtractComponentFirmware_StripsBuildStamp guards against the iBMC
// "RESTful version info" build-timestamp suffix leaking into hardware.firmware,
// which made BIOS/BMC versions churn against the bare live-CD values.
func TestExtractComponentFirmware_StripsBuildStamp(t *testing.T) {
text := `RESTful version info:
[ { "id": 0, "dev_name": "Activate(BMC0)", "dev_version": "7.11.02 (2024-01-05 16:01:47)" },
{ "id": 1, "dev_name": "Inactivate(BMC1)", "dev_version": "7.11.02 (2024-01-05 16:01:47)" },
{ "id": 2, "dev_name": "BIOS", "dev_version": "08.05.01 (02/21/2024 16:51:27)" },
{ "id": 3, "dev_name": "ME", "dev_version": "4.4.4.500" } ]
RESTful CPU info:
{ }`
hw := &models.HardwareConfig{}
extractComponentFirmware(text, hw)
got := map[string]string{}
for _, fw := range hw.Firmware {
got[fw.DeviceName] = fw.Version
}
if got["BIOS"] != "08.05.01" {
t.Errorf("BIOS version = %q, want 08.05.01", got["BIOS"])
}
if got["BMC"] != "7.11.02" {
t.Errorf("BMC version = %q, want 7.11.02", got["BMC"])
}
if got["ME"] != "4.4.4.500" {
t.Errorf("ME version = %q, want 4.4.4.500 (untouched)", got["ME"])
}
}
func TestParseHDDInfo_MergesIntoExistingStorage(t *testing.T) {
text := `RESTful HDD info:
[