Set iLO NIC active - HewlettPackard/python-ilorest-library GitHub Wiki
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:
:
Redfish Object creation:
:
The method ex21_set_active_ilo_nic takes an instance of rest object (or redfish object if using Redfish API) and shared nic boolean as arguments.
:
Find and get the system resource for manager.
:
Send a HTTP GET request to the manager URI(s).
:
Send another GET request to the ethernet interfaces URI.
:
Find the iLO NIC URI from the response body.
for nic in response.dict["Items"]:
try:
if (nic["Oem"]["Hp"]["SupportsFlexibleLOM"] == True and \
shared_nic == True):
selected_nic_uri = nic["links"]["self"]["href"]
break
except KeyError:
pass
try:
if (nic["Oem"]["Hp"]["SupportsLOM"] == True and \
shared_nic == True):
selected_nic_uri = nic["links"]["self"]["href"]
break
except KeyError:
pass
if not shared_nic:
selected_nic_uri = nic["links"]["self"]["href"]
break
elif not selected_nic_uri:
sys.stderr.write("\tShared NIC is not supported\n")
break
:
Set the request body.
:
Perform PATCH request.
: