Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions redfish/computersystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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]
}
Expand Down
16 changes: 15 additions & 1 deletion redfish/networkadapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down
3 changes: 3 additions & 0 deletions redfish/pciedevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
15 changes: 15 additions & 0 deletions redfish/pciefunction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}