Redfish snapshot/export overhaul and portable release build
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -70,11 +70,59 @@ func TestRedfishConnectorCollect(t *testing.T) {
|
||||
"CapacityGB": 960,
|
||||
"SerialNumber": "SN123",
|
||||
})
|
||||
register("/redfish/v1/Systems/1/PCIeDevices", map[string]interface{}{
|
||||
"Members": []map[string]string{
|
||||
{"@odata.id": "/redfish/v1/Systems/1/PCIeDevices/GPU1"},
|
||||
},
|
||||
})
|
||||
register("/redfish/v1/Systems/1/PCIeDevices/GPU1", map[string]interface{}{
|
||||
"Id": "GPU1",
|
||||
"Name": "NVIDIA H100",
|
||||
"Model": "NVIDIA H100 PCIe",
|
||||
"Manufacturer": "NVIDIA",
|
||||
"SerialNumber": "GPU-SN-001",
|
||||
"PCIeFunctions": map[string]interface{}{
|
||||
"@odata.id": "/redfish/v1/Systems/1/PCIeDevices/GPU1/PCIeFunctions",
|
||||
},
|
||||
})
|
||||
register("/redfish/v1/Systems/1/PCIeDevices/GPU1/PCIeFunctions", map[string]interface{}{
|
||||
"Members": []map[string]string{
|
||||
{"@odata.id": "/redfish/v1/Systems/1/PCIeFunctions/GPU1F0"},
|
||||
},
|
||||
})
|
||||
register("/redfish/v1/Systems/1/PCIeFunctions/GPU1F0", map[string]interface{}{
|
||||
"FunctionId": "0000:65:00.0",
|
||||
"VendorId": "0x10DE",
|
||||
"DeviceId": "0x2331",
|
||||
"ClassCode": "0x030200",
|
||||
"CurrentLinkWidth": 16,
|
||||
"CurrentLinkSpeed": "16.0 GT/s",
|
||||
"MaxLinkWidth": 16,
|
||||
"MaxLinkSpeed": "16.0 GT/s",
|
||||
})
|
||||
register("/redfish/v1/Chassis/1/NetworkAdapters", map[string]interface{}{
|
||||
"Members": []map[string]string{
|
||||
{"@odata.id": "/redfish/v1/Chassis/1/NetworkAdapters/1"},
|
||||
},
|
||||
})
|
||||
register("/redfish/v1/Chassis/1/Power", map[string]interface{}{
|
||||
"PowerSupplies": []map[string]interface{}{
|
||||
{
|
||||
"MemberId": "PSU1",
|
||||
"Name": "PSU Slot 1",
|
||||
"Model": "PWS-2K01A-1R",
|
||||
"Manufacturer": "Delta",
|
||||
"PowerCapacityWatts": 2000,
|
||||
"PowerInputWatts": 1600,
|
||||
"LastPowerOutputWatts": 1200,
|
||||
"LineInputVoltage": 230,
|
||||
"Status": map[string]interface{}{
|
||||
"Health": "OK",
|
||||
"State": "Enabled",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
register("/redfish/v1/Chassis/1/NetworkAdapters/1", map[string]interface{}{
|
||||
"Name": "Mellanox",
|
||||
"Model": "ConnectX-6",
|
||||
@@ -122,7 +170,33 @@ func TestRedfishConnectorCollect(t *testing.T) {
|
||||
if len(result.Hardware.NetworkAdapters) != 1 {
|
||||
t.Fatalf("expected one nic, got %d", len(result.Hardware.NetworkAdapters))
|
||||
}
|
||||
if len(result.Hardware.GPUs) != 1 {
|
||||
t.Fatalf("expected one gpu, got %d", len(result.Hardware.GPUs))
|
||||
}
|
||||
if result.Hardware.GPUs[0].BDF != "0000:65:00.0" {
|
||||
t.Fatalf("unexpected gpu BDF: %q", result.Hardware.GPUs[0].BDF)
|
||||
}
|
||||
if len(result.Hardware.PCIeDevices) != 1 {
|
||||
t.Fatalf("expected one pcie device, got %d", len(result.Hardware.PCIeDevices))
|
||||
}
|
||||
if len(result.Hardware.PowerSupply) != 1 {
|
||||
t.Fatalf("expected one psu, got %d", len(result.Hardware.PowerSupply))
|
||||
}
|
||||
if result.Hardware.PowerSupply[0].WattageW != 2000 {
|
||||
t.Fatalf("unexpected psu wattage: %d", result.Hardware.PowerSupply[0].WattageW)
|
||||
}
|
||||
if len(result.Hardware.Firmware) == 0 {
|
||||
t.Fatalf("expected firmware entries")
|
||||
}
|
||||
if result.RawPayloads == nil {
|
||||
t.Fatalf("expected raw payloads")
|
||||
}
|
||||
treeAny, ok := result.RawPayloads["redfish_tree"]
|
||||
if !ok {
|
||||
t.Fatalf("expected redfish_tree in raw payloads")
|
||||
}
|
||||
tree, ok := treeAny.(map[string]interface{})
|
||||
if !ok || len(tree) == 0 {
|
||||
t.Fatalf("expected non-empty redfish_tree, got %#v", treeAny)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user