[PR #5900/49e3da36 backport][stable-6] Adding VerifyBiosAttributes functionality (#6006)

Adding VerifyBiosAttributes functionality (#5900)

* Adding VerifyBiosAttributes functionality

* Updating authors information

* PR comment changes

* Update plugins/modules/redfish_command.py

Agreed

Co-authored-by: Felix Fontein <felix@fontein.de>

* Adding author as redfish maintainer

* Adding changelog fragment

* Update changelogs/fragments/5900-adding-verifybiosattribute-fucntionality-to-redfish-command.yml

Agreed

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Kushal <t-s.kushal@hpe.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 49e3da3646)

Co-authored-by: TSKushal <44438079+TSKushal@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2023-02-17 08:08:27 +01:00 committed by GitHub
parent ec7f885e2f
commit 4266163c13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 3 deletions

View file

@ -3163,3 +3163,38 @@ class RedfishUtils(object):
if resp['ret'] and resp['changed']:
resp['msg'] = 'Modified session service'
return resp
def verify_bios_attributes(self, bios_attributes):
# This method verifies BIOS attributes against the provided input
server_bios = self.get_multi_bios_attributes()
if server_bios["ret"] is False:
return server_bios
bios_dict = {}
wrong_param = {}
# Verify bios_attributes with BIOS settings available in the server
for key, value in bios_attributes.items():
if key in server_bios["entries"][0][1]:
if server_bios["entries"][0][1][key] != value:
bios_dict.update({key: value})
else:
wrong_param.update({key: value})
if wrong_param:
return {
"ret": False,
"msg": "Wrong parameters are provided: %s" % wrong_param
}
if bios_dict:
return {
"ret": False,
"msg": "BIOS parameters are not matching: %s" % bios_dict
}
return {
"ret": True,
"changed": False,
"msg": "BIOS verification completed"
}