From c9ae96ab76fe2d370c257d7218728bea55c6dd34 Mon Sep 17 00:00:00 2001 From: "David J. Allen" Date: Thu, 17 Oct 2024 15:54:45 -0600 Subject: [PATCH] crawler: add check to get IP address from manager's ethernet interface --- pkg/crawler/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/crawler/main.go b/pkg/crawler/main.go index e90593a..ac5b0ea 100644 --- a/pkg/crawler/main.go +++ b/pkg/crawler/main.go @@ -263,13 +263,17 @@ func walkManagers(rf_managers []*redfish.Manager, baseURI string) ([]Manager, er } var ethernet_interfaces []EthernetInterface for _, rf_ethernetinterface := range rf_ethernetinterfaces { - ethernet_interfaces = append(ethernet_interfaces, EthernetInterface{ + ethernetinterface := EthernetInterface{ URI: baseURI + rf_ethernetinterface.ODataID, MAC: rf_ethernetinterface.MACAddress, Name: rf_ethernetinterface.Name, Description: rf_ethernetinterface.Description, Enabled: rf_ethernetinterface.InterfaceEnabled, - }) + } + if len(rf_ethernetinterface.IPv4Addresses) > 0 { + ethernetinterface.IP = rf_ethernetinterface.IPv4Addresses[0].Address + } + ethernet_interfaces = append(ethernet_interfaces, ethernetinterface) } managers = append(managers, Manager{ URI: baseURI + "/redfish/v1/Managers/" + rf_manager.ID,