@@ -49,14 +49,16 @@ type NetworkInterface struct {
4949}
5050
5151type Manager struct {
52- URI string `json:"uri,omitempty"`
53- UUID string `json:"uuid,omitempty"`
54- Name string `json:"name,omitempty"`
55- Description string `json:"description,omitempty"`
56- Model string `json:"model,omitempty"`
57- Type string `json:"type,omitempty"`
58- FirmwareVersion string `json:"firmware_version,omitempty"`
59- EthernetInterfaces []EthernetInterface `json:"ethernet_interfaces,omitempty"`
52+ URI string `json:"uri,omitempty"`
53+ UUID string `json:"uuid,omitempty"`
54+ Name string `json:"name,omitempty"`
55+ Description string `json:"description,omitempty"`
56+ Model string `json:"model,omitempty"`
57+ Type string `json:"type,omitempty"`
58+ FirmwareVersion string `json:"firmware_version,omitempty"`
59+ EthernetInterfaces []EthernetInterface `json:"ethernet_interfaces,omitempty"`
60+ SerialConsoleSupported []string `json:"serial_console"`
61+ CommandShellSupported []string `json:"command_shell"`
6062}
6163
6264type Links struct {
@@ -71,14 +73,26 @@ type Power struct {
7173 PowerControlIDs []string `json:"power_control_ids,omitempty"`
7274}
7375
76+ type SerialConsoleConfig struct {
77+ Port int `json:"port,omitempty"`
78+ Enabled bool `json:"enabled,omitempty"`
79+ }
80+
81+ type SerialConsole struct {
82+ IPMI SerialConsoleConfig `json:"impi,omitempty"`
83+ Telnet SerialConsoleConfig `json:"telnet,omitempty"`
84+ SSH SerialConsoleConfig `json:"ssh,omitempty"`
85+ }
86+
7487type InventoryDetail struct {
7588 URI string `json:"uri,omitempty"` // URI of the BMC
7689 UUID string `json:"uuid,omitempty"` // UUID of Node
7790 Manufacturer string `json:"manufacturer,omitempty"` // Manufacturer of the Node
7891 SystemType string `json:"system_type,omitempty"` // System type of the Node
7992 Name string `json:"name,omitempty"` // Name of the Node
80- Model string `json:"model,omitempty"` // Model of the Node
81- Serial string `json:"serial,omitempty"` // Serial number of the Node
93+ ModelNumber string `json:"model,omitempty"` // Model of the Node
94+ SerialNumber string `json:"serial,omitempty"` // Serial number of the Node
95+ SerialConsole SerialConsole `json:"serial_console,omitempty"` // Supported serial console types of the Node
8296 BiosVersion string `json:"bios_version,omitempty"` // Version of the BIOS
8397 EthernetInterfaces []EthernetInterface `json:"ethernet_interfaces,omitempty"` // Ethernet interfaces of the Node
8498 NetworkInterfaces []NetworkInterface `json:"network_interfaces,omitempty"` // Network interfaces of the Node
@@ -204,11 +218,7 @@ func CrawlBMCForSystems(config CrawlerConfig) ([]InventoryDetail, error) {
204218 }
205219 // If nodes are found under both Chassis and Systems, Systems is assumed to be "more definitive"
206220 // and will override corresponding fields from the Chassis version.
207- // err = mergo.Merge(&systems, newSystems, mergo.WithOverride)
208- systems , err = merge (systems , newSystems )
209- if err != nil {
210- return extractPtrMapValues (systems ), fmt .Errorf ("failed to merge systems from Chassis and Systems endpoints: %v" , err )
211- }
221+ systems = merge (systems , newSystems )
212222 return extractPtrMapValues (systems ), nil
213223}
214224
@@ -329,9 +339,23 @@ func walkSystems(rf_systems []*redfish.ComputerSystem, rf_chassis *redfish.Chass
329339 Name : rf_computersystem .Name ,
330340 Manufacturer : rf_computersystem .Manufacturer ,
331341 SystemType : string (rf_computersystem .SystemType ),
332- Model : rf_computersystem .Model ,
333- Serial : rf_computersystem .SerialNumber ,
334- BiosVersion : rf_computersystem .BIOSVersion ,
342+ ModelNumber : rf_computersystem .Model ,
343+ SerialNumber : rf_computersystem .SerialNumber ,
344+ SerialConsole : SerialConsole {
345+ IPMI : SerialConsoleConfig {
346+ Port : rf_computersystem .SerialConsole .IPMI .Port ,
347+ Enabled : rf_computersystem .SerialConsole .IPMI .ServiceEnabled ,
348+ },
349+ SSH : SerialConsoleConfig {
350+ Port : rf_computersystem .SerialConsole .SSH .Port ,
351+ Enabled : rf_computersystem .SerialConsole .SSH .ServiceEnabled ,
352+ },
353+ Telnet : SerialConsoleConfig {
354+ Port : rf_computersystem .SerialConsole .Telnet .Port ,
355+ Enabled : rf_computersystem .SerialConsole .Telnet .ServiceEnabled ,
356+ },
357+ },
358+ BiosVersion : rf_computersystem .BIOSVersion ,
335359 Links : Links {
336360 Managers : managerLinks ,
337361 Chassis : chassisLinks ,
@@ -356,6 +380,7 @@ func walkSystems(rf_systems []*redfish.ComputerSystem, rf_chassis *redfish.Chass
356380 system .Chassis_Model = rf_chassis .Model
357381 }
358382
383+ // add ethernet interfaces
359384 rf_ethernetinterfaces , err := rf_computersystem .EthernetInterfaces ()
360385 if err != nil {
361386 log .Error ().Err (err ).Msg ("failed to get ethernet interfaces from computer system" )
@@ -381,6 +406,7 @@ func walkSystems(rf_systems []*redfish.ComputerSystem, rf_chassis *redfish.Chass
381406 return systems , err
382407 }
383408
409+ // add network interfaces
384410 for _ , rf_networkInterface := range rf_networkInterfaces {
385411 rf_networkAdapter , err := rf_networkInterface .NetworkAdapter ()
386412 if err != nil {
@@ -457,15 +483,26 @@ func walkManagers(rf_managers []*redfish.Manager, baseURI string) ([]Manager, er
457483 IP : rf_ethernetinterface .IPv4Addresses [0 ].Address ,
458484 })
459485 }
486+
487+ var supported_serial_console []string
488+ for _ , console_type := range rf_manager .SerialConsole .ConnectTypesSupported {
489+ supported_serial_console = append (supported_serial_console , string (console_type ))
490+ }
491+ var supported_command_shell []string
492+ for _ , shell_type := range rf_manager .CommandShell .ConnectTypesSupported {
493+ supported_command_shell = append (supported_command_shell , string (shell_type ))
494+ }
460495 managers = append (managers , Manager {
461- URI : baseURI + "/redfish/v1/Managers/" + rf_manager .ID ,
462- UUID : rf_manager .UUID ,
463- Name : rf_manager .Name ,
464- Description : rf_manager .Description ,
465- Model : rf_manager .Model ,
466- Type : string (rf_manager .ManagerType ),
467- FirmwareVersion : rf_manager .FirmwareVersion ,
468- EthernetInterfaces : ethernet_interfaces ,
496+ URI : baseURI + "/redfish/v1/Managers/" + rf_manager .ID ,
497+ UUID : rf_manager .UUID ,
498+ Name : rf_manager .Name ,
499+ Description : rf_manager .Description ,
500+ Model : rf_manager .Model ,
501+ Type : string (rf_manager .ManagerType ),
502+ FirmwareVersion : rf_manager .FirmwareVersion ,
503+ EthernetInterfaces : ethernet_interfaces ,
504+ SerialConsoleSupported : supported_serial_console ,
505+ CommandShellSupported : supported_command_shell ,
469506 })
470507 }
471508 return managers , nil
@@ -528,10 +565,10 @@ func extractPtrMapValues[T any](m map[string]*T) []T {
528565 return slice
529566}
530567
531- func merge (systems map [string ]* InventoryDetail , newSystems []InventoryDetail ) ( map [string ]* InventoryDetail , error ) {
568+ func merge (systems map [string ]* InventoryDetail , newSystems []InventoryDetail ) map [string ]* InventoryDetail {
532569 // add and replace values in systems with values from newSystems
533570 for _ , system := range newSystems {
534571 systems [system .URI ] = & system
535572 }
536- return systems , nil
573+ return systems
537574}
0 commit comments