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 27: Get schema

The method ex27_get_schema takes an instance of rest object ( or redfish object if using Redfish API ) and schema prefix as arguments.

def ex27_get_schema(restobj, schema_prefix):

Send HTTP GET request to schema URI '/rest/v1/Schemas'.

response = restobj.rest_get("/rest/v1/Schemas")

From the response body find the requested schema URI.

for schema in response.dict["Items"]:
  if schema["Schema"].startswith(schema_prefix):
      for location in schema["Location"]:
          extref_uri = location["Uri"]["extref"]

Get the schema with the requested schema prefix through GET request.

response = restobj.rest_get(extref_uri)

Check the status.

if response.status == 200:
    sys.stdout.write("\tFound " + schema_prefix + " at "\
                                        + extref_uri + "\n")
    return
else:
    sys.stderr.write("\t" + schema_prefix + " not found at " \
                                        + extref_uri + "\n")
    return
Clone this wiki locally