
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”), 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_host, login_account, login_password)
Redfish Object creation:
REDFISH_OBJ = RedfishObject(iLO_https_host, login_account, login_password)
Example 47: Clear AHS data¶
The method ex47_clear_ahs_data takes an instance of rest object (or redfish object if using Redfish API) as an argument.
def ex47_clear_ahs_data(restobj):
Search for Manager URI type.
instances = restobj.search_for_type("Manager.")
Set body to the ClearLog action, then set the response to the ActiveHealthSystem URI.
for instance in instances:
tmp = restobj.rest_get(instance["href"])
body = {"Action": "ClearLog"}
response = restobj.rest_get(tmp.dict["Oem"]["Hp"]["links"]\
["ActiveHealthSystem"]["href"], body)