collector/redfish: collect and parse platform model fallback
This commit is contained in:
@@ -964,7 +964,10 @@ func redfishCriticalEndpoints(systemPaths, chassisPaths, managerPaths []string)
|
||||
add(p)
|
||||
add(joinPath(p, "/Bios"))
|
||||
add(joinPath(p, "/SecureBoot"))
|
||||
add(joinPath(p, "/Oem/Public"))
|
||||
add(joinPath(p, "/Oem/Public/FRU"))
|
||||
add(joinPath(p, "/Oem/Public/ThermalConfig"))
|
||||
add(joinPath(p, "/ThermalConfig"))
|
||||
add(joinPath(p, "/Processors"))
|
||||
add(joinPath(p, "/Memory"))
|
||||
add(joinPath(p, "/Storage"))
|
||||
@@ -977,7 +980,10 @@ func redfishCriticalEndpoints(systemPaths, chassisPaths, managerPaths []string)
|
||||
}
|
||||
for _, p := range chassisPaths {
|
||||
add(p)
|
||||
add(joinPath(p, "/Oem/Public"))
|
||||
add(joinPath(p, "/Oem/Public/FRU"))
|
||||
add(joinPath(p, "/Oem/Public/ThermalConfig"))
|
||||
add(joinPath(p, "/ThermalConfig"))
|
||||
add(joinPath(p, "/Power"))
|
||||
add(joinPath(p, "/Thermal"))
|
||||
add(joinPath(p, "/Sensors"))
|
||||
@@ -1497,7 +1503,7 @@ func parseBoardInfoFromFRUDoc(doc map[string]interface{}) models.BoardInfo {
|
||||
}
|
||||
return models.BoardInfo{
|
||||
Manufacturer: findFirstNormalizedStringByKeys(doc, "Manufacturer", "BoardManufacturer", "Vendor"),
|
||||
ProductName: findFirstNormalizedStringByKeys(doc, "ProductName", "BoardName", "Model"),
|
||||
ProductName: findFirstNormalizedStringByKeys(doc, "ProductName", "BoardName", "PlatformId", "PlatformName", "MachineTypeModel", "Model"),
|
||||
SerialNumber: findFirstNormalizedStringByKeys(doc, "SerialNumber", "BoardSerialNumber"),
|
||||
PartNumber: findFirstNormalizedStringByKeys(doc, "PartNumber", "BoardPartNumber", "ProductPartNumber"),
|
||||
}
|
||||
@@ -2632,7 +2638,10 @@ func redfishSnapshotPrioritySeeds(systemPaths, chassisPaths, managerPaths []stri
|
||||
add(p)
|
||||
add(joinPath(p, "/Bios"))
|
||||
add(joinPath(p, "/SecureBoot"))
|
||||
add(joinPath(p, "/Oem/Public"))
|
||||
add(joinPath(p, "/Oem/Public/FRU"))
|
||||
add(joinPath(p, "/Oem/Public/ThermalConfig"))
|
||||
add(joinPath(p, "/ThermalConfig"))
|
||||
add(joinPath(p, "/Processors"))
|
||||
add(joinPath(p, "/Memory"))
|
||||
add(joinPath(p, "/EthernetInterfaces"))
|
||||
@@ -2651,7 +2660,10 @@ func redfishSnapshotPrioritySeeds(systemPaths, chassisPaths, managerPaths []stri
|
||||
}
|
||||
for _, p := range chassisPaths {
|
||||
add(p)
|
||||
add(joinPath(p, "/Oem/Public"))
|
||||
add(joinPath(p, "/Oem/Public/FRU"))
|
||||
add(joinPath(p, "/Oem/Public/ThermalConfig"))
|
||||
add(joinPath(p, "/ThermalConfig"))
|
||||
add(joinPath(p, "/Sensors"))
|
||||
add(joinPath(p, "/HealthSummary"))
|
||||
add(joinPath(p, "/ThresholdSensors"))
|
||||
|
||||
@@ -56,7 +56,7 @@ func ReplayRedfishFromRawPayloads(rawPayloads map[string]any, emit ProgressFn) (
|
||||
if len(fruDoc) == 0 {
|
||||
fruDoc = chassisFRUDoc
|
||||
}
|
||||
boardFallbackDocs := r.collectBoardFallbackDocs(chassisPaths)
|
||||
boardFallbackDocs := r.collectBoardFallbackDocs(systemPaths, chassisPaths)
|
||||
|
||||
if emit != nil {
|
||||
emit(Progress{Status: "running", Progress: 55, Message: "Redfish snapshot: replay CPU/RAM/Storage..."})
|
||||
@@ -445,7 +445,7 @@ func dedupeStrings(items []string) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
func (r redfishSnapshotReader) collectBoardFallbackDocs(chassisPaths []string) []map[string]interface{} {
|
||||
func (r redfishSnapshotReader) collectBoardFallbackDocs(systemPaths, chassisPaths []string) []map[string]interface{} {
|
||||
out := make([]map[string]interface{}, 0)
|
||||
for _, chassisPath := range chassisPaths {
|
||||
for _, suffix := range []string{"/Boards", "/Backplanes"} {
|
||||
@@ -459,6 +459,14 @@ func (r redfishSnapshotReader) collectBoardFallbackDocs(chassisPaths []string) [
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, path := range append(append([]string{}, systemPaths...), chassisPaths...) {
|
||||
for _, suffix := range []string{"/Oem/Public", "/Oem/Public/ThermalConfig", "/ThermalConfig"} {
|
||||
docPath := joinPath(path, suffix)
|
||||
if doc, err := r.getJSON(docPath); err == nil && len(doc) > 0 {
|
||||
out = append(out, doc)
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ func TestApplyBoardInfoFallbackFromDocs_SkipsComponentProductNames(t *testing.T)
|
||||
"SerialNumber": "802C1A2507D284B001",
|
||||
},
|
||||
{
|
||||
"ProductName": "NF5688M7",
|
||||
"PlatformId": "NF5688M7",
|
||||
"Manufacturer": "Inspur",
|
||||
"PartNumber": "YZMB-00001",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user