diff --git a/common/types.go b/common/types.go index 7e01366e..166b1137 100644 --- a/common/types.go +++ b/common/types.go @@ -191,6 +191,10 @@ const ( // UpdatingState indicates the element is updating and may be unavailable // or degraded. UpdatingState State = "Updating" + // DegradedState shall indicate the resource is enabled but operating in a degraded mode. + DegradedState State = "Degraded" + // QualifiedState indicates that the element is within the acceptable range of operation (deprecated in v1.19) + QualifiedState State = "Qualified" ) type Severity string diff --git a/redfish/computersystem.go b/redfish/computersystem.go index 8f7dead6..b314e223 100644 --- a/redfish/computersystem.go +++ b/redfish/computersystem.go @@ -588,12 +588,8 @@ type Composition struct { // BootOption represents the properties of a bootable device available in the // system. type BootOption struct { - common.Entity + common.Resource - // ODataContext is the odata context. - ODataContext string `json:"@odata.context"` - // ODataType is the odata type. - ODataType string `json:"@odata.type"` // Alias is the alias of this boot source if one exists. Alias BootSourceOverrideTarget // BootOptionEnabled is an indication of whether the boot option is @@ -610,6 +606,7 @@ type BootOption struct { // UefiDevicePath is the UEFI device path to access this UEFI boot // option. UefiDevicePath string + RelatedItem common.Links } // GetBootOption will get a BootOption instance from the service. @@ -1257,7 +1254,7 @@ func (computersystem *ComputerSystem) UpdateBootAttributesApplyAt(attrs Settings data["@Redfish.SettingsApplyTime"] = map[string]string{"ApplyTime": string(applyTime)} } - var header = make(map[string]string) + header := make(map[string]string) if resp.Header["Etag"] != nil { header["If-Match"] = resp.Header["Etag"][0] } diff --git a/redfish/networkadapter.go b/redfish/networkadapter.go index 42efa8b2..b47a21c9 100644 --- a/redfish/networkadapter.go +++ b/redfish/networkadapter.go @@ -211,7 +211,6 @@ type DataCenterBridging struct { // NPIV shall contain N_Port ID Virtualization (NPIV) capabilities for a // controller. type NPIV struct { - // MaxDeviceLogins shall be the maximum number of N_Port ID Virtualization // (NPIV) logins allowed simultaneously from all ports on this controller. MaxDeviceLogins int @@ -355,6 +354,9 @@ func (networkadapter *NetworkAdapter) Assembly() (*Assembly, error) { // Certificatea gets the certificates for device identity and attestation. func (networkadapter *NetworkAdapter) Certificates() ([]*Certificate, error) { + if networkadapter.certificates == "" { + return nil, nil + } return ListReferencedCertificates(networkadapter.GetClient(), networkadapter.certificates) } @@ -368,21 +370,33 @@ func (networkadapter *NetworkAdapter) EnvironmentMetrics() (*EnvironmentMetrics, // NetworkDeviceFunctions gets the collection of NetworkDeviceFunctions of this network adapter func (networkadapter *NetworkAdapter) NetworkDeviceFunctions() ([]*NetworkDeviceFunction, error) { + if networkadapter.networkDeviceFunctions == "" { + return nil, nil + } return ListReferencedNetworkDeviceFunctions(networkadapter.GetClient(), networkadapter.networkDeviceFunctions) } // NetworkPorts gets the collection of NetworkPorts for this network adapter func (networkadapter *NetworkAdapter) NetworkPorts() ([]*NetworkPort, error) { + if networkadapter.networkPorts == "" { + return nil, nil + } return ListReferencedNetworkPorts(networkadapter.GetClient(), networkadapter.networkPorts) } // Ports gets the ports associated with this network adapter. func (networkadapter *NetworkAdapter) Ports() ([]*Port, error) { + if networkadapter.ports == "" { + return nil, nil + } return ListReferencedPorts(networkadapter.GetClient(), networkadapter.ports) } // Processors gets the offload processors contained in this network adapter. func (networkadapter *NetworkAdapter) Processors() ([]*Processor, error) { + if networkadapter.processors == "" { + return nil, nil + } return ListReferencedProcessors(networkadapter.GetClient(), networkadapter.processors) } diff --git a/redfish/pciedevice.go b/redfish/pciedevice.go index 2639c89a..38e0b008 100644 --- a/redfish/pciedevice.go +++ b/redfish/pciedevice.go @@ -413,6 +413,9 @@ func (pciedevice *PCIeDevice) PCIeFunctions() ([]*PCIeFunction, error) { if len(pciedevice.pcieFunctionsArray) > 0 { return common.GetObjects[PCIeFunction](pciedevice.GetClient(), pciedevice.pcieFunctionsArray) } + if pciedevice.pcieFunctions == "" { + return nil, nil + } return ListReferencedPCIeFunctions(pciedevice.GetClient(), pciedevice.pcieFunctions) } diff --git a/redfish/pciefunction.go b/redfish/pciefunction.go index 51df42b4..32bcea26 100644 --- a/redfish/pciefunction.go +++ b/redfish/pciefunction.go @@ -231,21 +231,33 @@ func (pciefunction *PCIeFunction) CXLLogicalDevice() (*CXLLogicalDevice, error) // Drives gets the PCIe function's drives. func (pciefunction *PCIeFunction) Drives() ([]*Drive, error) { + if len(pciefunction.drives) == 0 { + return nil, nil + } return common.GetObjects[Drive](pciefunction.GetClient(), pciefunction.drives) } // EthernetInterfaces gets the PCIe function's ethernet interfaces. func (pciefunction *PCIeFunction) EthernetInterfaces() ([]*EthernetInterface, error) { + if len(pciefunction.ethernetInterfaces) == 0 { + return nil, nil + } return common.GetObjects[EthernetInterface](pciefunction.GetClient(), pciefunction.ethernetInterfaces) } // MemoryDomains gets the memory domains associated with this PCIe function. func (pciefunction *PCIeFunction) MemoryDomains() ([]*MemoryDomain, error) { + if len(pciefunction.memoryDomains) == 0 { + return nil, nil + } return common.GetObjects[MemoryDomain](pciefunction.GetClient(), pciefunction.memoryDomains) } // NetworkDeviceFunctions gets the PCIe function's ethernet interfaces. func (pciefunction *PCIeFunction) NetworkDeviceFunctions() ([]*NetworkDeviceFunction, error) { + if len(pciefunction.networkDeviceFunctions) == 0 { + return nil, nil + } return common.GetObjects[NetworkDeviceFunction](pciefunction.GetClient(), pciefunction.networkDeviceFunctions) } @@ -267,5 +279,8 @@ func (pciefunction *PCIeFunction) Processor() (*Processor, error) { // StorageControllers gets the associated storage controllers. func (pciefunction *PCIeFunction) StorageControllers() ([]*StorageController, error) { + if len(pciefunction.storageControllers) == 0 { + return nil, nil + } return common.GetObjects[StorageController](pciefunction.GetClient(), pciefunction.storageControllers) }