HPE DL380 Gen11 BEE-SP v14.23 blackbox bundle (ADL-077): - topology: accept "PROC n" DIMM locators, show the storage controller filtered from the export by ADL-062 when disks resolve to it, resolve storcli EID:Slt drives via VD -> OS drive -> controller BDF, hide BMC VGA, label numeric PSU slots "PSU n" - easy_bee: parse SEL / dmesg -T event times, keep message_id and component_ref, pass platform_config through - exporter: map ipmi-sel -> bmc and dmesg/kernel -> host in event_logs - privacy: treat journald/syslog kernel lines as noise (linux.it false positive) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
146 lines
5.6 KiB
Go
146 lines
5.6 KiB
Go
package topology
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.mchus.pro/mchus/logpile/internal/exporter"
|
|
"git.mchus.pro/mchus/logpile/internal/models"
|
|
)
|
|
|
|
func intp(v int) *int { return &v }
|
|
|
|
func TestBuildDistinguishesNUMAZeroFromUnknown(t *testing.T) {
|
|
snapshot := &exporter.ReanimatorExport{Hardware: exporter.ReanimatorHardware{
|
|
Board: exporter.ReanimatorBoard{SerialNumber: "SN1"},
|
|
CPUs: []exporter.ReanimatorCPU{{Socket: 0}, {Socket: 1}},
|
|
PCIeDevices: []exporter.ReanimatorPCIe{
|
|
{Slot: "0000:01:00.0", DeviceClass: "VideoController", Model: "GPU A", NUMANode: intp(0)},
|
|
{Slot: "0000:02:00.0", DeviceClass: "NetworkController", Model: "NIC A", NUMANode: nil},
|
|
},
|
|
}}
|
|
doc := Build(snapshot, nil)
|
|
var gpuAttached, nicAttached bool
|
|
for _, e := range doc.Edges {
|
|
gpuAttached = gpuAttached || (e.From == "cpu:0" && e.To == "gpu:0000:01:00.0")
|
|
nicAttached = nicAttached || strings.Contains(e.To, "nic:")
|
|
}
|
|
if !gpuAttached {
|
|
t.Fatal("NUMA node 0 GPU was not attached to CPU 0")
|
|
}
|
|
if nicAttached {
|
|
t.Fatal("unknown-affinity NIC must not be attached")
|
|
}
|
|
body, err := json.Marshal(doc)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.Contains(string(body), `"numa_node":0`) {
|
|
t.Fatalf("topology JSON lost NUMA zero: %s", body)
|
|
}
|
|
}
|
|
|
|
func TestBuildUsesBeeStaticEvidence(t *testing.T) {
|
|
snapshot := &exporter.ReanimatorExport{Hardware: exporter.ReanimatorHardware{
|
|
Board: exporter.ReanimatorBoard{SerialNumber: "SN1"},
|
|
CPUs: []exporter.ReanimatorCPU{{Socket: 0}, {Socket: 1}},
|
|
Memory: []exporter.ReanimatorMemory{{Slot: "DIMM000(A)", SerialNumber: "M1", Status: "OK"}},
|
|
Storage: []exporter.ReanimatorStorage{{Slot: "0:0:0:0", SerialNumber: "D1", Model: "Disk"}},
|
|
PCIeDevices: []exporter.ReanimatorPCIe{
|
|
{Slot: "0000:01:00.0", DeviceClass: "StorageController", NUMANode: intp(0)},
|
|
{Slot: "0000:31:00.0", DeviceClass: "VideoController", Model: "GPU 0", NUMANode: intp(0)},
|
|
{Slot: "0000:32:00.0", DeviceClass: "VideoController", Model: "GPU 1", NUMANode: intp(0)},
|
|
},
|
|
}}
|
|
e := &models.TopologyEvidence{
|
|
DIMMType17: "Memory Device\n Locator: DIMM000(A)\n Bank Locator: Node0_Channel0",
|
|
StorageMap: "sda hctl=0:0:0:0 ctrl=0000:01:00.0",
|
|
NVIDIAQueryCSV: "0, 0000:31:00.0\n1, 0000:32:00.0\n",
|
|
NVIDIATopology: " GPU0 GPU1\nGPU0 X NV4\nGPU1 NV4 X\n",
|
|
}
|
|
doc := Build(snapshot, e)
|
|
kinds := map[string]int{}
|
|
for _, edge := range doc.Edges {
|
|
kinds[edge.Kind]++
|
|
}
|
|
for _, kind := range []string{"memory", "storage", "nvlink"} {
|
|
if kinds[kind] == 0 {
|
|
t.Fatalf("missing %s edge: %+v", kind, doc.Edges)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestRenderHTMLIsStaticAndEscapesLabels(t *testing.T) {
|
|
body := string(RenderHTML(&models.TopologyDocument{Version: ContractVersion, Title: `<script>x</script>`, Nodes: []models.TopologyNode{{ID: "cpu:0", Kind: "cpu", Label: "CPU 0", Socket: intp(0)}}}))
|
|
if strings.Contains(body, `<script>x</script>`) {
|
|
t.Fatal("title was not escaped")
|
|
}
|
|
for _, forbidden := range []string{"setInterval(", "fetch(", "nvidia-smi"} {
|
|
if strings.Contains(body, forbidden) {
|
|
t.Fatalf("rendered page contains live behavior %q", forbidden)
|
|
}
|
|
}
|
|
}
|
|
|
|
// HPE ProLiant DL380 Gen11 (BEE-SP v14.23): DIMM locators read "PROC 1 DIMM 10",
|
|
// the MegaRAID controller is not part of the Reanimator projection, and its
|
|
// physical drives carry storcli "EID:Slt" slots instead of an HCTL.
|
|
func TestBuildAttachesHPEMemoryAndRAIDMemberDisks(t *testing.T) {
|
|
snapshot := &exporter.ReanimatorExport{Hardware: exporter.ReanimatorHardware{
|
|
Board: exporter.ReanimatorBoard{SerialNumber: "SN1"},
|
|
CPUs: []exporter.ReanimatorCPU{{Socket: 1}},
|
|
Memory: []exporter.ReanimatorMemory{{Slot: "PROC 1 DIMM 10", SizeMB: 32768}},
|
|
Storage: []exporter.ReanimatorStorage{
|
|
{Slot: "252:1", Model: "Micron_7450"},
|
|
{Slot: "252:2", Model: "Micron_7450"},
|
|
{Slot: "252:3", Model: "Micron_7450"},
|
|
},
|
|
PCIeDevices: []exporter.ReanimatorPCIe{
|
|
{Slot: "0000:01:00.1", VendorID: 0x102b, DeviceClass: "VideoController", Model: "MGA G200eH3", NUMANode: intp(0)},
|
|
{Slot: "0000:6c:00.0", DeviceClass: "NetworkController", NUMANode: intp(0)},
|
|
},
|
|
}}
|
|
e := &models.TopologyEvidence{
|
|
StorageMap: "sda hctl=0:3:111:0 ctrl=0000:6d:00.0\nsdb hctl=1:0:0:0 ctrl=0000:00:14.0\n",
|
|
StorcliVDs: `{"Controllers":[{"Command Status":{"Controller":0},"Response Data":{
|
|
"/c0/v239":[{"DG/VD":"0/239","TYPE":"RAID1"}],
|
|
"PDs for VD 239":[{"EID:Slt":"252:1"},{"EID:Slt":"252:2"}],
|
|
"VD239 Properties":{"OS Drive Name":"/dev/sda"}}}]}`,
|
|
StorcliDrives: `{"Controllers":[{"Command Status":{"Controller":0},"Response Data":{
|
|
"Drive /c0/e252/s1":[{"EID:Slt":"252:1"}],
|
|
"Drive /c0/e252/s3":[{"EID:Slt":"252:3"}],
|
|
"Drive /c0/e252/s3 - Detailed Information":{}}}]}`,
|
|
}
|
|
controllers := []exporter.ReanimatorPCIe{
|
|
{Slot: "0000:6d:00.0", DeviceClass: "MassStorageController", Model: "MegaRAID", NUMANode: intp(0)},
|
|
{Slot: "0000:00:17.0", DeviceClass: "SATAController", Model: "AHCI", NUMANode: intp(0)},
|
|
}
|
|
doc := Build(snapshot, e, controllers...)
|
|
|
|
edges := map[string]string{}
|
|
for _, edge := range doc.Edges {
|
|
edges[edge.To] = edge.From
|
|
}
|
|
want := map[string]string{
|
|
"memory:PROC 1 DIMM 10": "cpu:1",
|
|
"raid:0000:6d:00.0": "cpu:1",
|
|
"storage:252:1": "raid:0000:6d:00.0",
|
|
"storage:252:2": "raid:0000:6d:00.0",
|
|
"storage:252:3": "raid:0000:6d:00.0",
|
|
}
|
|
for to, from := range want {
|
|
if edges[to] != from {
|
|
t.Errorf("edge to %s: got from %q, want %q", to, edges[to], from)
|
|
}
|
|
}
|
|
for _, n := range doc.Nodes {
|
|
if n.Kind == "gpu" {
|
|
t.Errorf("BMC VGA rendered as a GPU: %+v", n)
|
|
}
|
|
if n.BDF == "0000:00:17.0" {
|
|
t.Errorf("diskless onboard controller must stay hidden: %+v", n)
|
|
}
|
|
}
|
|
}
|