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 20: Get iLO NIC

The method ex20_get_ilo_nic takes an instance of rest object ( or redfish object if using Redfish API ) and active flag as arguments.

def ex20_get_ilo_nic(restobj, get_active):

Find and get the system resource for manager.

instances = restobj.search_for_type("Manager.")

Send a HTTP GET request to the manager URI(s).

for instance in instances:
    tmp = restobj.rest_get(instance["href"])

Send another GET request to the ethernet interfaces URI.

response = restobj.rest_get(tmp.dict["links"]["EthernetNICs"]["href"])

Print the active NIC from the response body.

for nic in response.dict["Items"]:
         if get_active and nic["Status"]["State"] == "Enabled":
             sys.stdout.write("Active\t" + nic["links"]["self"]["href"] + \
                                             ": " + json.dumps(nic) + "\n")
         elif get_active == False and nic["Status"]["State"] == "Disabled":
             sys.stdout.write("InActive\t" + nic["links"]["self"]["href"] + \
                                             ": " + json.dumps(nic) + "\n")
Clone this wiki locally