fix(redfish): narrow MSI PCIeFunctions crawl
This commit is contained in:
@@ -1287,6 +1287,87 @@ func TestEnrichNICFromPCIeFunctions_FillsMissingIdentityFromFunctionDoc(t *testi
|
||||
}
|
||||
}
|
||||
|
||||
func TestReplayCollectNICs_UsesNetworkDeviceFunctionPCIeFunctionLink(t *testing.T) {
|
||||
tree := map[string]interface{}{
|
||||
"/redfish/v1/Chassis/1/NetworkAdapters": map[string]interface{}{
|
||||
"Members": []interface{}{
|
||||
map[string]interface{}{"@odata.id": "/redfish/v1/Chassis/1/NetworkAdapters/NIC1"},
|
||||
},
|
||||
},
|
||||
"/redfish/v1/Chassis/1/NetworkAdapters/NIC1": map[string]interface{}{
|
||||
"Id": "DevType7_NIC1",
|
||||
"Name": "NetworkAdapter_1",
|
||||
"Controllers": []interface{}{
|
||||
map[string]interface{}{
|
||||
"ControllerCapabilities": map[string]interface{}{
|
||||
"NetworkPortCount": 2,
|
||||
},
|
||||
"Links": map[string]interface{}{
|
||||
"PCIeDevices": []interface{}{
|
||||
map[string]interface{}{"@odata.id": "/redfish/v1/Chassis/1/PCIeDevices/00_0F_00"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"NetworkDeviceFunctions": map[string]interface{}{
|
||||
"@odata.id": "/redfish/v1/Chassis/1/NetworkAdapters/NIC1/NetworkDeviceFunctions",
|
||||
},
|
||||
},
|
||||
"/redfish/v1/Chassis/1/NetworkAdapters/NIC1/NetworkDeviceFunctions": map[string]interface{}{
|
||||
"Members": []interface{}{
|
||||
map[string]interface{}{"@odata.id": "/redfish/v1/Chassis/1/NetworkAdapters/NIC1/NetworkDeviceFunctions/Function0"},
|
||||
},
|
||||
},
|
||||
"/redfish/v1/Chassis/1/NetworkAdapters/NIC1/NetworkDeviceFunctions/Function0": map[string]interface{}{
|
||||
"Id": "Function0",
|
||||
"Links": map[string]interface{}{
|
||||
"PCIeFunction": map[string]interface{}{
|
||||
"@odata.id": "/redfish/v1/Chassis/1/PCIeDevices/00_0F_00/PCIeFunctions/Function0",
|
||||
},
|
||||
},
|
||||
},
|
||||
"/redfish/v1/Chassis/1/PCIeDevices/00_0F_00": map[string]interface{}{
|
||||
"Id": "00_0F_00",
|
||||
"Name": "PCIeDevice_00_0F_00",
|
||||
"Manufacturer": "Mellanox Technologies",
|
||||
"FirmwareVersion": "26.43.25.66",
|
||||
"Slot": map[string]interface{}{
|
||||
"Location": map[string]interface{}{
|
||||
"PartLocation": map[string]interface{}{
|
||||
"ServiceLabel": "RISER4",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"/redfish/v1/Chassis/1/PCIeDevices/00_0F_00/PCIeFunctions/Function0": map[string]interface{}{
|
||||
"Id": "Function0",
|
||||
"FunctionId": "0000:0f:00.0",
|
||||
"VendorId": "0x15b3",
|
||||
"DeviceId": "0x101f",
|
||||
"SerialNumber": "MT2412X00001",
|
||||
"PartNumber": "MCX623432AC-GDA_Ax",
|
||||
},
|
||||
}
|
||||
|
||||
r := redfishSnapshotReader{tree: tree}
|
||||
nics := r.collectNICs([]string{"/redfish/v1/Chassis/1"})
|
||||
if len(nics) != 1 {
|
||||
t.Fatalf("expected one NIC, got %d", len(nics))
|
||||
}
|
||||
if nics[0].Slot != "RISER4" {
|
||||
t.Fatalf("expected slot from PCIe device, got %q", nics[0].Slot)
|
||||
}
|
||||
if nics[0].SerialNumber != "MT2412X00001" {
|
||||
t.Fatalf("expected serial from NetworkDeviceFunction PCIeFunction link, got %q", nics[0].SerialNumber)
|
||||
}
|
||||
if nics[0].PartNumber != "MCX623432AC-GDA_Ax" {
|
||||
t.Fatalf("expected part number from linked PCIeFunction, got %q", nics[0].PartNumber)
|
||||
}
|
||||
if nics[0].BDF != "0000:0f:00.0" {
|
||||
t.Fatalf("expected BDF from linked PCIeFunction, got %q", nics[0].BDF)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseNIC_PortCountFromControllerCapabilities(t *testing.T) {
|
||||
nic := parseNIC(map[string]interface{}{
|
||||
"Id": "1",
|
||||
@@ -3527,8 +3608,11 @@ func TestShouldCrawlPath_MemoryAndProcessorMetricsAreAllowed(t *testing.T) {
|
||||
if !shouldCrawlPath("/redfish/v1/Systems/1/Processors/CPU0/ProcessorMetrics") {
|
||||
t.Fatalf("expected CPU metrics subresource to be crawlable")
|
||||
}
|
||||
if shouldCrawlPath("/redfish/v1/Chassis/1/PCIeDevices/0/PCIeFunctions") {
|
||||
t.Fatalf("expected broad chassis PCIeFunctions collection to be skipped")
|
||||
}
|
||||
if !shouldCrawlPath("/redfish/v1/Chassis/1/PCIeDevices/0/PCIeFunctions/1") {
|
||||
t.Fatalf("expected chassis pciefunctions resource to be crawlable for NIC/GPU identity recovery")
|
||||
t.Fatalf("expected direct chassis PCIeFunction member to remain crawlable")
|
||||
}
|
||||
if !shouldCrawlPath("/redfish/v1/Fabrics/HGX_NVLinkFabric_0/Switches/NVSwitch_0") {
|
||||
t.Fatalf("expected NVSwitch fabric resource to be crawlable")
|
||||
|
||||
Reference in New Issue
Block a user