8acef92a60
Extend Inventory stage from a one-liner summary to a per-probe substep emitter with ~20-30 narrative log lines per run. - spec: per-DIMM memory (slot/size/speed/manufacturer/part_number), richer CPU (vendor/stepping/physical_cores/flags), disk model/transport/rotational, NIC driver/pci_addr, GPU vram/pci/driver, new System/Baseboard/PSU/OS top-level sections. All fields omitempty so existing expected-spec YAML and artifacts stay compatible. - spec.Diff: new diffDIMMs/diffSystem/diffBaseboard/diffPSU/diffOS helpers; extended diffDisks/diffNICs/diffGPUs for new fields. GPU diff gains PCIAddr-pinned matching alongside count-by-model. - agent/probes/inventory: CPU (/proc/cpuinfo extended), Memory (dmidecode -t 17 multi-block), Disks (+model/transport/rotational), NICs (+driver/pci from sysfs), GPUs (VRAM from lspci -vv), new System/Baseboard (dmidecode -t system/baseboard), PSU (dmidecode -t 39), OS (/proc/sys/kernel/osrelease + /etc/os-release). All probes accept a Logger and emit per-finding info/warn lines. - agent/probes/firmware: parseDmidecodeAllSections for multi-block fixtures (memory / PSU). - agent/runner: Inventory case becomes 9 substep rows (CPU / Memory / Disks / NICs / GPUs / System / Baseboard / PSU / OS) with per-probe start/complete timestamps. - report: new Inventory HTML section between Stages and Firmware; resolveReporting loads the inventory.json artifact. - agent/tests/fakes/dmidecode: dispatches on -t flag to serve bios / memory / system / baseboard / 39 fixtures for unit tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
174 lines
3.7 KiB
Go
174 lines
3.7 KiB
Go
// fake_dmidecode simulates the subset of `dmidecode -t <type>` output
|
|
// the Vetting probes actually parse. Dispatches on the argument after
|
|
// `-t` so the same binary serves both firmware (BIOS) and inventory
|
|
// (memory / system / baseboard / power-supply) probes under test. Exits
|
|
// 0 for every supported type; prints nothing for unknown types.
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
t := ""
|
|
for i, a := range os.Args {
|
|
if a == "-t" && i+1 < len(os.Args) {
|
|
t = os.Args[i+1]
|
|
break
|
|
}
|
|
}
|
|
switch t {
|
|
case "bios":
|
|
fmt.Println(biosFixture)
|
|
case "memory", "17":
|
|
fmt.Println(memoryFixture)
|
|
case "system":
|
|
fmt.Println(systemFixture)
|
|
case "baseboard":
|
|
fmt.Println(baseboardFixture)
|
|
case "39":
|
|
fmt.Println(psuFixture)
|
|
default:
|
|
// No-op: tests expecting "no data" for an unknown -t value get
|
|
// an empty body and exit 0 (matches dmidecode behavior).
|
|
}
|
|
}
|
|
|
|
const biosFixture = `# dmidecode 3.3
|
|
Getting SMBIOS data from sysfs.
|
|
SMBIOS 3.2.0 present.
|
|
|
|
Handle 0x0000, DMI type 0, 26 bytes
|
|
BIOS Information
|
|
Vendor: American Megatrends Inc.
|
|
Version: 3.2
|
|
Release Date: 07/15/2021
|
|
Address: 0xF0000
|
|
Runtime Size: 64 kB
|
|
ROM Size: 32 MB
|
|
Characteristics:
|
|
PCI is supported
|
|
BIOS is upgradeable`
|
|
|
|
const memoryFixture = `# dmidecode 3.3
|
|
Getting SMBIOS data from sysfs.
|
|
SMBIOS 3.2.0 present.
|
|
|
|
Handle 0x0032, DMI type 17, 84 bytes
|
|
Memory Device
|
|
Array Handle: 0x0031
|
|
Total Width: 64 bits
|
|
Data Width: 64 bits
|
|
Size: 16 GB
|
|
Form Factor: DIMM
|
|
Set: None
|
|
Locator: DIMM_A1
|
|
Bank Locator: BANK 0
|
|
Type: DDR4
|
|
Type Detail: Synchronous
|
|
Speed: 3200 MT/s
|
|
Manufacturer: Micron
|
|
Serial Number: 12345678
|
|
Asset Tag: None
|
|
Part Number: 8ATF2G64AZ-3G2E1
|
|
Rank: 2
|
|
Configured Memory Speed: 3200 MT/s
|
|
|
|
Handle 0x0033, DMI type 17, 84 bytes
|
|
Memory Device
|
|
Array Handle: 0x0031
|
|
Total Width: Unknown
|
|
Data Width: Unknown
|
|
Size: No Module Installed
|
|
Form Factor: DIMM
|
|
Set: None
|
|
Locator: DIMM_A2
|
|
Bank Locator: BANK 1
|
|
Type: Unknown
|
|
Type Detail: Unknown
|
|
Speed: Unknown
|
|
Manufacturer: Not Specified
|
|
Part Number: Not Specified
|
|
|
|
Handle 0x0034, DMI type 17, 84 bytes
|
|
Memory Device
|
|
Array Handle: 0x0031
|
|
Total Width: 64 bits
|
|
Data Width: 64 bits
|
|
Size: 16 GB
|
|
Form Factor: DIMM
|
|
Locator: DIMM_B1
|
|
Bank Locator: BANK 2
|
|
Type: DDR4
|
|
Speed: 3200 MT/s
|
|
Manufacturer: Micron
|
|
Part Number: 8ATF2G64AZ-3G2E1
|
|
Configured Memory Speed: 3200 MT/s
|
|
|
|
Handle 0x0035, DMI type 17, 84 bytes
|
|
Memory Device
|
|
Array Handle: 0x0031
|
|
Size: No Module Installed
|
|
Locator: DIMM_B2
|
|
Bank Locator: BANK 3
|
|
Manufacturer: Not Specified
|
|
Part Number: Not Specified`
|
|
|
|
const systemFixture = `# dmidecode 3.3
|
|
Getting SMBIOS data from sysfs.
|
|
SMBIOS 3.2.0 present.
|
|
|
|
Handle 0x0001, DMI type 1, 27 bytes
|
|
System Information
|
|
Manufacturer: Beelink
|
|
Product Name: Mini S12 Pro
|
|
Version: Default string
|
|
Serial Number: SN-MINI-001
|
|
UUID: 03000200-0400-0500-0006-000700080009
|
|
Wake-up Type: Power Switch
|
|
SKU Number: Default string
|
|
Family: Default string`
|
|
|
|
const baseboardFixture = `# dmidecode 3.3
|
|
Getting SMBIOS data from sysfs.
|
|
SMBIOS 3.2.0 present.
|
|
|
|
Handle 0x0002, DMI type 2, 15 bytes
|
|
Base Board Information
|
|
Manufacturer: Beelink
|
|
Product Name: AZW SEi
|
|
Version: 1.0
|
|
Serial Number: BB-0001
|
|
Asset Tag: Default string`
|
|
|
|
const psuFixture = `# dmidecode 3.3
|
|
Getting SMBIOS data from sysfs.
|
|
SMBIOS 3.2.0 present.
|
|
|
|
Handle 0x0040, DMI type 39, 22 bytes
|
|
System Power Supply
|
|
Power Unit Group: 1
|
|
Location: PSU1
|
|
Name: PWR SPLY,760W
|
|
Manufacturer: DELTA
|
|
Serial Number: ABC123
|
|
Asset Tag: 00000000
|
|
Model Part Number: ABC760
|
|
Revision: 1.0
|
|
Max Power Capacity: 760 W
|
|
Status: Present, OK
|
|
Type: Switching
|
|
|
|
Handle 0x0041, DMI type 39, 22 bytes
|
|
System Power Supply
|
|
Power Unit Group: 1
|
|
Location: PSU2
|
|
Name: PWR SPLY,760W
|
|
Manufacturer: DELTA
|
|
Serial Number: XYZ789
|
|
Model Part Number: ABC760
|
|
Max Power Capacity: 760 W
|
|
Status: Present, OK
|
|
Type: Switching`
|