iDRAC10-generation TSR bundles no longer ship sysinfo_dcim_view.xml / sysinfo_dcim_softwareidentity.xml, so the dell parser produced events but no hardware inventory for them. These bundles instead carry redfishidracwalk.tar.gz, a captured dump of the iDRAC's own Redfish tree. Add vendors/redfishtree, a shared helper that reconstructs a path->document map from a tar.gz/zip-packaged Redfish walk (vendor-independent detection: path hint + /redfish/v1 service-root/Systems/Chassis structural check) and replays it through the existing collector.ReplayRedfishFromRawPayloads. vendors/dell uses it to enrich DCIM-XML-derived data (append-only, existing dedupe passes resolve overlaps). Also register vendors/redfishwalk, a low-confidence fallback VendorParser using the same helpers, so any other vendor that starts shipping this kind of raw Redfish walk is picked up automatically without a dedicated parser. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
61 lines
2.1 KiB
Go
61 lines
2.1 KiB
Go
// Package redfishwalk is a vendor-agnostic fallback for archives that carry
|
|
// a captured Redfish directory-tree walk (see vendors/redfishtree for the
|
|
// detection rule) but aren't claimed by a dedicated vendor parser. Dell TSR
|
|
// bundles from iDRAC10-generation firmware are the first known source of
|
|
// this format, and are handled directly by vendors/dell (which also carries
|
|
// other Dell-specific markers and merges the walk into DCIM-XML-derived
|
|
// data). This parser exists so any other vendor that starts shipping the
|
|
// same kind of raw Redfish walk is picked up automatically, without needing
|
|
// a dedicated parser first.
|
|
package redfishwalk
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.mchus.pro/mchus/logpile/internal/collector"
|
|
"git.mchus.pro/mchus/logpile/internal/models"
|
|
"git.mchus.pro/mchus/logpile/internal/parser"
|
|
"git.mchus.pro/mchus/logpile/internal/parser/vendors/redfishtree"
|
|
)
|
|
|
|
const parserVersion = "1.0"
|
|
|
|
func init() {
|
|
parser.Register(&Parser{})
|
|
}
|
|
|
|
// Parser implements VendorParser for archives containing a raw Redfish
|
|
// directory-tree walk with no other recognizable vendor markers.
|
|
type Parser struct{}
|
|
|
|
func (p *Parser) Name() string { return "Generic Redfish Walk Parser" }
|
|
func (p *Parser) Vendor() string { return "redfish_walk" }
|
|
func (p *Parser) Version() string { return parserVersion }
|
|
|
|
// Detect returns a confidence deliberately placed above the generic text
|
|
// fallback (15) but below any dedicated vendor parser, so a vendor-specific
|
|
// parser always wins when both recognize the same archive.
|
|
func (p *Parser) Detect(files []parser.ExtractedFile) int {
|
|
for _, f := range redfishtree.FindCandidateArchives(files) {
|
|
if redfishtree.Build(f.Content) != nil {
|
|
return 35
|
|
}
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (p *Parser) Parse(files []parser.ExtractedFile) (*models.AnalysisResult, error) {
|
|
for _, f := range redfishtree.FindCandidateArchives(files) {
|
|
tree := redfishtree.Build(f.Content)
|
|
if tree == nil {
|
|
continue
|
|
}
|
|
result, err := collector.ReplayRedfishFromRawPayloads(map[string]any{"redfish_tree": tree}, nil)
|
|
if err != nil {
|
|
continue
|
|
}
|
|
return result, nil
|
|
}
|
|
return nil, fmt.Errorf("redfish_walk: no Redfish tree snapshot found")
|
|
}
|