-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(redfish/bios): Add GetActiveSoftwareImage (#158)
Specification "Redfish Resource and Schema Guide" defines field "Links" in Bios.v1.1+, which contains "ActiveSoftwareImage". See: https://www.dmtf.org/sites/default/files/standards/documents/DSP2046_2020.3.pdf Adding support of the field. Signed-off-by: Dmitrii Okunev <[email protected]>
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,9 @@ type Bios struct { | |
// settingsApplyTimes is a set of allowed settings update apply times. If none | ||
// are specified, then the system does not provide that information. | ||
settingsApplyTimes []common.ApplyTime | ||
// activeSoftwareImage is the @odata.id of SoftwareInventory responsible | ||
// for the active BIOS firmware image (see [email protected]). | ||
activeSoftwareImage string | ||
// rawData holds the original serialized JSON so we can compare updates. | ||
rawData []byte | ||
} | ||
|
@@ -99,9 +102,15 @@ func (bios *Bios) UnmarshalJSON(b []byte) error { | |
Target string | ||
} `json:"#Bios.ResetBios"` | ||
} | ||
type Links struct { | ||
ActiveSoftwareImage struct { | ||
ODataID string `json:"@odata.id"` | ||
} | ||
} | ||
var t struct { | ||
temp | ||
Actions Actions | ||
Links Links | ||
Settings common.Settings `json:"@Redfish.Settings"` | ||
} | ||
|
||
|
@@ -116,6 +125,7 @@ func (bios *Bios) UnmarshalJSON(b []byte) error { | |
bios.changePasswordTarget = t.Actions.ChangePassword.Target | ||
bios.resetBiosTarget = t.Actions.ResetBios.Target | ||
bios.settingsApplyTimes = t.Settings.SupportedApplyTimes | ||
bios.activeSoftwareImage = t.Links.ActiveSoftwareImage.ODataID | ||
|
||
// Some implementations use a @Redfish.Settings object to direct settings updates to a | ||
// different URL than the object being updated. Others don't, so handle both. | ||
|
@@ -257,3 +267,13 @@ func (bios *Bios) UpdateBiosAttributes(attrs BiosAttributes) error { | |
|
||
return nil | ||
} | ||
|
||
// GetActiveSoftwareImage gets the SoftwareInventory which represents the | ||
// active BIOS firmware image. | ||
func (bios *Bios) GetActiveSoftwareImage() (*SoftwareInventory, error) { | ||
if bios.activeSoftwareImage == "" { | ||
return nil, nil | ||
} | ||
|
||
return GetSoftwareInventory(bios.Client, bios.activeSoftwareImage) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters