Add Inspur Group OEM Redfish profile

This commit is contained in:
Mikhail Chusavitin
2026-03-25 15:08:40 +03:00
parent 9b71c4a95f
commit 8942991f0c
10 changed files with 583 additions and 28 deletions

View File

@@ -938,7 +938,9 @@ func TestParseComponents_UseNestedSerialNumberFallback(t *testing.T) {
"Manufacturer": "vendor0",
"SerialNumber": "N/A",
"Oem": map[string]interface{}{
"SerialNumber": "SN-OK-001",
"VendorX": map[string]interface{}{
"SerialNumber": "SN-OK-001",
},
},
}
@@ -978,6 +980,38 @@ func TestParseComponents_UseNestedSerialNumberFallback(t *testing.T) {
}
}
func TestParseCPU_UsesPublicSerialAsPPINAndCurrentSpeedMHz(t *testing.T) {
cpus := parseCPUs([]map[string]interface{}{
{
"Id": "CPU0",
"Model": "Intel Xeon",
"TotalCores": 48,
"TotalThreads": 96,
"MaxSpeedMHz": 4000,
"OperatingSpeedMHz": 0,
"Oem": map[string]interface{}{
"Public": map[string]interface{}{
"SerialNumber": "6FB5241E81CECDFD",
"CurrentSpeedMHz": 2700,
},
},
},
})
if len(cpus) != 1 {
t.Fatalf("expected one CPU, got %d", len(cpus))
}
if cpus[0].PPIN != "6FB5241E81CECDFD" {
t.Fatalf("expected PPIN from Oem.Public.SerialNumber, got %+v", cpus[0])
}
if cpus[0].SerialNumber != "" {
t.Fatalf("expected empty CPU serial number when only Public serial exists, got %+v", cpus[0])
}
if cpus[0].FrequencyMHz != 2700 {
t.Fatalf("expected CPU frequency from Oem.Public.CurrentSpeedMHz, got %+v", cpus[0])
}
}
func TestParseCPUAndMemory_CollectOemDetails(t *testing.T) {
cpus := parseCPUs([]map[string]interface{}{
{
@@ -1687,7 +1721,7 @@ func TestReplayCollectStorage_UsesKnownControllerRecoveryWhenEnabled(t *testing.
}}
got := r.collectStorage("/redfish/v1/Systems/1", redfishprofile.ResolvedAnalysisPlan{
Directives: redfishprofile.AnalysisDirectives{EnableKnownStorageControllerRecovery: true},
Directives: redfishprofile.AnalysisDirectives{EnableKnownStorageControllerRecovery: true},
KnownStorageDriveCollections: []string{"/Storage/IntelVROC/Drives"},
})
if len(got) != 1 {
@@ -2357,6 +2391,20 @@ func TestAppendPSU_MergesRicherDuplicate(t *testing.T) {
}
}
func TestRedfishPSUNominalWattage_PrefersInputRangeOutputWattage(t *testing.T) {
doc := map[string]interface{}{
"PowerCapacityWatts": 22600,
"InputRanges": []interface{}{
map[string]interface{}{"OutputWattage": 2700},
map[string]interface{}{"OutputWattage": 3200},
},
}
if got := redfishPSUNominalWattage(doc); got != 3200 {
t.Fatalf("redfishPSUNominalWattage() = %d, want 3200", got)
}
}
func TestReplayCollectGPUs_DropsModelOnlyPlaceholderWhenConcreteDiscoveredLater(t *testing.T) {
r := redfishSnapshotReader{tree: map[string]interface{}{
"/redfish/v1/Systems/1/GraphicsControllers": map[string]interface{}{
@@ -2677,7 +2725,7 @@ func TestCollectGPUsFromProcessors_SupermicroHGXUsesChassisAliasSerial(t *testin
gpus := r.collectGPUs(systemPaths, chassisPaths, testAnalysisPlan(redfishprofile.AnalysisDirectives{EnableGenericGraphicsControllerDedup: true}))
gpus = r.collectGPUsFromProcessors(systemPaths, chassisPaths, gpus, redfishprofile.ResolvedAnalysisPlan{
Directives: redfishprofile.AnalysisDirectives{EnableProcessorGPUFallback: true, EnableProcessorGPUChassisAlias: true},
Directives: redfishprofile.AnalysisDirectives{EnableProcessorGPUFallback: true, EnableProcessorGPUChassisAlias: true},
ProcessorGPUChassisLookupModes: []string{"hgx-alias"},
})
@@ -2715,7 +2763,7 @@ func TestCollectGPUsFromProcessors_MSIUsesIndexedChassisLookup(t *testing.T) {
[]string{"/redfish/v1/Chassis/GPU1"},
nil,
redfishprofile.ResolvedAnalysisPlan{
Directives: redfishprofile.AnalysisDirectives{EnableProcessorGPUFallback: true, EnableMSIProcessorGPUChassisLookup: true},
Directives: redfishprofile.AnalysisDirectives{EnableProcessorGPUFallback: true, EnableMSIProcessorGPUChassisLookup: true},
ProcessorGPUChassisLookupModes: []string{"msi-index"},
},
)