
First create an instance of Rest or Redfish Object using the RestObject or RedfishObject class respectively. The class constructor takes iLO hostname/ ip address formatted as a string (“https://xx.xx.xx.xx”, “https://box1.america.corp.net” both work!), iLO login username and password as arguments. The class also initializes a login session, gets systems resources and message registries.
Rest Object creation:
REST_OBJ = RestObject(iLO_https_url, login_account, login_password)
Redfish Object creation:
REDFISH_OBJ = RedfishObject(iLO_https_url, login_account, login_password)
Example 48: Set BIOS password¶
The method ex48_set_bios_password takes an instance of rest object, bios property of interest, the new value for the bios property and bios password as arguments.
def ex48_set_bios_password(restobj, new_password, bios_password):
Find and get the BIOS settings URI from the systems resources collection.
instances = restobj.search_for_type("Bios.")
For the BIOS settings URI/s prepare the request body with the password we want to change and perform the PATCH request.
for instance in instances:
body = {"AdminPassword": new_password, \
"OldAdminPassword": bios_password}
response = restobj.rest_patch(instance["href"], body, \
bios_password)
restobj.error_handler(response)
A successful PATCH response will set the BIOS password with the new BIOS password, however the BIOS setting changes will get affected only after a system reset or reboot. Additionally, bios_password is a required parameter in this case, since both the new and old password must be supplied for this command to work.
Note: The Bios. type is not supported in Gen9 servers for Redfish but the example includes Redfish implementation for Redfish Bios. type support in Gen10. Rest works as intended.