-
Notifications
You must be signed in to change notification settings - Fork 96
Get resource directory
First 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 ex1_get_resource_directory takes an instance of rest object (or redfish object if using Redfish API) as argument.
def ex1_get_resource_directory(restobj):
A Restful GET request is performed next by calling the Rest object's get method with the resource directory URI ('/rest/v1/resourcedirectory') as parameter. For Redfish RESTful request the URI is ('/redfish/v1/resourcedirectory')
response = restobj.rest_get("/rest/v1/resourcedirectory")
For a successful response status, resource directory is retrieved from the response body.
if response.status == 200:
sys.stdout.write("\tFound resource directory at /rest/v1/resource" \
"directory" + "\n")
SYSTEMS_RESOURCES["resources"] = response.dict["Instances"]
else:
sys.stderr.write("\tResource directory missing at /rest/v1/resource" \
"directory" + "\n")