-
Notifications
You must be signed in to change notification settings - Fork 91
Reset server
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)
The method ex4_reset_server takes an instance of rest object (or redfish object if using redfish API) and BIOS password (default None) as arguments.
def ex4_reset_server(restobj, bios_password=None):
Find and get the Computer System settings URI from the systems resources collection.
instances = restobj.search_for_type("ComputerSystem.")
Next the HTTP request body is set for the reset of each Computer System URI.
for instance in instances:
body = dict()
body["Action"] = "Reset"
body["ResetType"] = "ForceRestart"
POST request is sent next and response error is handled if any.
response = restobj.rest_post(instance["href"], body)
restobj.error_handler(response)
A successful POST response will restart the system.