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>
This commit is contained in:
TSKushal 2023-02-17 12:19:54 +05:30 committed by GitHub
parent 33df7b61c0
commit 49e3da3646
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"
}