Skip to content
Jack Garcia edited this page May 25, 2017 · 1 revision

If not created already, create an instance of Rest or Redfish Object using the RestObject or RedfishObject class respectively. The class constructor takes iLO hostname/ ip address, 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_host, login_account, login_password)

Redfish Object creation:

REDFISH_OBJ = RedfishObject(iLO_host, login_account, login_password)

Example 5: Enable secured boot

The method ex5_enable_secure_boot takes an instance of rest object (or redfish object if using Redfish API), boolean secure boot enable value and BIOS password (default None).

def ex5_enable_secure_boot(restobj, secure_boot_enable, bios_password=None):

Find and get the Secure Boot URI(s) from the systems resources collection.

instances = restobj.search_for_type("SecureBoot.")

Prepare the HTTP request body with the boolean value of secure boot enable parameter.

for instance in instances:
    body = {"SecureBootEnable": secure_boot_enable}

PATCH request is sent next to the secure boot URI and response error is handled if any.

response = restobj.rest_patch(instance["href"], body, \
                                     optionalpassword=bios_password)
restobj.error_handler(response)

A successful PATCH response implies that Secure Boot is set, however the changes will get affected only after a system reset or reboot.

Clone this wiki locally