Quick Start Local - HewlettPackard/python-ilorest-library GitHub Wiki

Local machine iLO restful operation

Requirements

Instead of HTTPS, CHIF is used for the transportation. The HPE python iLO Restful library provides support for both remote (HTTPS) and in-band (CHIF).

Make sure that ilorest library is imported.

:

Creation of local rest/redfish objects are same as remote rest/redfish object creation with the exception of the local hostname being 'blobstore://.'. Once the object is created with proper hostname, the iLO Restful API provides the built-in support of performing RESTful requests on local machine iLO.

Create a Redfish Object

A Redfish Rest object instance is created by calling the redfish_client method of the imported redfish library. The redfish_client method returns an instance of the Redfish RESTful client and takes as parameters iLO hostname/ ip address('blobstore://.'), user name, password, default rest prefix ('/redfish/v1') and other optional arguments.

:

Create a Rest Object

A Rest object instance is created by calling the rest_client method of the imported redfish library. The rest_client method returns an instance of the RESTful client and takes as parameters iLO hostname/ ip address('blobstore://.'), user name, password, default rest prefix ('/rest/v1') and other optional arguments.

:

Create a login session

Next the rest object's login method is called to initiate a rest session. The parameters for the login method are iLO user name, password and login type (default is Basic authentication). For "session" login, a session key is generated through a rest request.

:

Please remember to call logout method once the session is completed.

Perform first Restful API operation

This is a very simple request example that shows the basic libraries involved and how to properly form the request. The following example performs a GET operation on the systems resource (/rest/v1/systems/1) using the HPE Restful API for iLO. It does a GET request on the iLO and returns a HTTP style response.

After creating a Redfish/Rest object as mentioned above in Create a Rest Object section followed by a login session.

Next the Rest object's get method is called with the system uri (/rest/v1/systems/1) as the parameter. For this simple GET example no additional parameter is required but the Rest object's put and post method may take request header and body as parameters while patch method can take request body as parameter.

:

Print the HTTP GET response, the response includes response status, response header and response body.

:

Close the login session

Logout of the current session.

:

Additional Examples

Please look into the examples section for more details on how to perform certain iLO tasks through RESTful requests using scripts.

⚠️ **GitHub.com Fallback** ⚠️