Files
logpile/internal/collector/redfishprofile/profile_giga_ast2600.go
T

178 lines
6.0 KiB
Go

package redfishprofile
import "strings"
// gigaAST2600Profile models the Redfish shape documented by Giga Computing's
// "Redfish API Reference Guide for ASPEED AST2600" (Rev. 1.0). The guide is a
// BMC-family reference rather than a server SKU list, so matching uses the Giga
// manufacturer plus Gbt/Gct OEM namespaces. Aggressive crawl pruning is enabled
// only for the G894/HGX accelerator topology observed on B300 systems.
func gigaAST2600Profile() Profile {
return staticProfile{
name: "giga-ast2600",
priority: 110, // apply platform-specific overrides after generic/HGX tuning
safeForFallback: false,
matchFn: func(s MatchSignals) int {
isGiga := isGigaManufacturer(s.SystemManufacturer) || isGigaManufacturer(s.ChassisManufacturer)
hasGigaOEM := false
for _, namespace := range s.OEMNamespaces {
if strings.EqualFold(strings.TrimSpace(namespace), "Gbt") || strings.EqualFold(strings.TrimSpace(namespace), "Gct") {
hasGigaOEM = true
break
}
}
if isGiga && hasGigaOEM {
return 100
}
return 0
},
extendAcquisition: func(plan *AcquisitionPlan, signals MatchSignals) {
addPlanNote(plan, "giga ast2600 Redfish profile enabled")
if !isGigaB300Topology(signals) {
return
}
// These branches are linked from the service/component roots but contain
// security state, telemetry histories, fabric counters, or actions. They
// are not inputs to normalized hardware inventory. On G894 they accounted
// for more than 1,300 saved documents and hundreds of additional requests.
ensureSnapshotExcludeContains(plan,
"/Fabrics",
"/TrustedComponents",
"/ComponentIntegrity",
"/Certificates",
"/Oem/NvidiaRoT/RoTProtectedComponents",
"/Oem/Nvidia/Histograms",
"/EnvironmentMetrics",
"/MemoryMetrics",
"/ProcessorMetrics",
"/SwitchMetrics",
"/Metrics",
"/Actions/",
"/CompositionService",
"/TelemetryService",
"/JobService",
"/LogServices/DebugTokenService",
)
// The AST2600 guide specifies collection Members. The G894 dump confirms
// that numeric probing of empty collections is both unnecessary and the
// main source of the 30-minute runtime. Trust advertised members for this
// topology and retain ordinary retry of explicitly advertised members.
plan.Tuning.SnapshotMaxDocuments = 12000
plan.Tuning.PostProbePolicy.EnableNumericCollectionProbe = false
plan.Tuning.PostProbePolicy.EnableSensorCollectionProbe = false
plan.Tuning.RecoveryPolicy.EnableCriticalSlowProbe = false
plan.Tuning.RecoveryPolicy.EnableEmptyCriticalCollectionRetry = false
plan.Tuning.RecoveryPolicy.EnableProfilePlanB = false
plan.Tuning.ETABaseline = AcquisitionETABaseline{
DiscoverySeconds: 15,
SnapshotSeconds: 180,
PrefetchSeconds: 25,
CriticalPlanBSeconds: 30,
ProfilePlanBSeconds: 0,
}
addPlanNote(plan, "giga b300 bounded inventory walker enabled: fabric telemetry, security branches, numeric probes, and empty-collection plan-B disabled")
},
refineAcquisition: func(resolved *ResolvedAcquisitionPlan, _ DiscoveredResources, signals MatchSignals) {
if !isGigaB300Topology(signals) {
return
}
resolved.SeedPaths = filterGigaB300PlanPaths(resolved.SeedPaths)
resolved.CriticalPaths = filterGigaB300PlanPaths(resolved.CriticalPaths)
resolved.Plan.SeedPaths = filterGigaB300PlanPaths(resolved.Plan.SeedPaths)
resolved.Plan.CriticalPaths = filterGigaB300PlanPaths(resolved.Plan.CriticalPaths)
resolved.Plan.PlanBPaths = filterGigaB300PlanPaths(resolved.Plan.PlanBPaths)
},
applyAnalysisDirectives: func(d *AnalysisDirectives, _ MatchSignals) {
d.EnableGenericGraphicsControllerDedup = true
d.EnableStorageEnclosureRecovery = true
},
}
}
func isGigaManufacturer(value string) bool {
value = strings.ToLower(strings.TrimSpace(value))
return strings.Contains(value, "giga computing") || strings.Contains(value, "gigabyte")
}
func isGigaB300Topology(signals MatchSignals) bool {
if containsFold(signals.SystemModel, "g894") || containsFold(signals.SystemModel, "b300") ||
containsFold(signals.ChassisModel, "g894") || containsFold(signals.ChassisModel, "b300") {
return true
}
for _, hint := range append(append([]string{}, signals.ResourceHints...), signals.DocHints...) {
if containsFold(hint, "/systems/hgx_baseboard_") || containsFold(hint, "b300") {
return true
}
}
return false
}
func filterGigaB300PlanPaths(paths []string) []string {
if len(paths) == 0 {
return nil
}
out := make([]string, 0, len(paths))
for _, rawPath := range paths {
path := normalizePath(rawPath)
if path == "" || gigaB300PlanPathIsNoise(path) {
continue
}
if root, suffix := gigaB300ResourceRoot(path, "/redfish/v1/Systems/HGX_Baseboard_"); root != "" {
switch {
case suffix == "", suffix == "/Processors", suffix == "/Memory":
out = append(out, path)
}
continue
}
if root, suffix := gigaB300ResourceRoot(path, "/redfish/v1/Chassis/HGX_"); root != "" {
// Component root documents advertise their real supported children.
// Do not seed generic guessed suffixes on every HGX sub-chassis.
if suffix == "" {
out = append(out, path)
}
continue
}
out = append(out, path)
}
return dedupeSorted(out)
}
func gigaB300PlanPathIsNoise(path string) bool {
for _, fragment := range []string{
"/Fabrics",
"/TrustedComponents",
"/ComponentIntegrity",
"/Certificates",
"/Oem/NvidiaRoT/RoTProtectedComponents",
"/Oem/Nvidia/Histograms",
"/Metrics",
"/Actions/",
"/CompositionService",
"/TelemetryService",
"/JobService",
"/LogServices/DebugTokenService",
} {
if strings.Contains(path, fragment) {
return true
}
}
return false
}
func gigaB300ResourceRoot(path, prefix string) (string, string) {
if !strings.HasPrefix(path, prefix) {
return "", ""
}
rest := strings.TrimPrefix(path, prefix)
if rest == "" {
return "", ""
}
if idx := strings.IndexByte(rest, '/'); idx >= 0 {
root := prefix + rest[:idx]
return root, strings.TrimPrefix(path, root)
}
return path, ""
}