forked from DMTF/python-redfish-library
-
Notifications
You must be signed in to change notification settings - Fork 93
Get AHS data
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)
The method ex46_get_ahs_data takes an instance of rest object ( or redfish object if using Redfish API ) as an argument.
def ex46_get_ahs_data(restobj):
Send HTTP GET request to manager URI '/rest/v1/Manager'.
response = restobj.rest_get("/rest/v1/Manager.")
From the response body find the ActiveHealthSystem URI.
for instance in instances:
tmp = restobj.rest_get(instance["href"])
response = restobj.rest_get(tmp.dict["Oem"]["Hp"]["links"]\
["ActiveHealthSystem"]["href"])
Get the extref link for download through GET request.
ahslink = restobj.rest_get(response.dict["links"]["AHSLocation"]\
["extref"])
Create and write to a binary file.
with open("data.ahs", 'wb') as ahsoutput:
ahsoutput.write(ahslink.read)
ahsoutput.close()