In the previous modules, you had the opportunity to experiment with some RackHD APIs. In this module you will learn about two different RESTful endpoints in RackHD and experiment with them.
RackHD is designed to provide a REST (Representational state transfer) architecture to provide a RESTful API. RackHD currently has two RESTful interfaces: a Redfish API and native REST API 2.0.
The Redfish API is compliant with the Redfish specification as an additional REST API. It provides a common data model for representing bare metal hardware, as an aggregate for multiple backend servers and systems.
The REST API 2.0 provides unique features that are not provided in the Redfish API.
REST API ( v 2.0) - Get workflow history
The <Node-ID> is retrieved from 7.2.
curl localhost:9090/api/2.0/nodes/<Node-ID>/workflows | jq '.'
REST API ( v 2.0) - Get active workflow
curl localhost:9090/api/2.0/nodes/<Node-ID>/workflows?active=true | jq '.'
In the following example, the return is blank ([]), which means no workflow is actively running on this node.
REST API ( v 2.0) - Show RackHD configurations
Show the RackHD configurations, by running the following command.
curl localhost:9090/api/2.0/config | jq '.'
REST API ( v 2.0) - lookup table
Dump the IP address in the lookup table (where RackHD maintain the nodes IP), by running the following command.
curl localhost:9090/api/2.0/lookups | jq '.'
REST API ( v 2.0) - built-in workflow
curl localhost:9090/api/2.0/workflows/graphs | jq '.' | grep injectableName | grep "Graph.*" | grep -v "Task"
As below output example, you will find lots of handy built-in workflow which RackHD carries, which you can leverage them directly.
REST API ( v 2.0) - issue a workflow
Post a workflow to a specific node by running the following command.
In the following example, to post a workflow to Reset a Node, the Node_id is obtained by the “curl localhost:9090/api/2.0/nodes | jq ‘.’ ” API.
curl -X POST -H 'Content-Type: application/json' 127.0.0.1:9090/api/2.0/nodes/<Node_id>/workflows?name=Graph.Reset.Node | jq '.'
Then the vNode is powered cycle and rebooted.
Redfish API - Chassis
List the Chassis that is managed by RackHD (equivalent to the enclosure node in REST API 2.0), by running the following command.
curl 127.0.0.1:9090/redfish/v1/Chassis| jq '.'
Redfish API - System
curl 127.0.0.1:9090/redfish/v1/Systems| jq '.'
Redfish API - SEL Log
curl 127.0.0.1:9090/redfish/v1/systems/<System-ID>/LogServices/Sel| jq '.'
Redfish API - CPU info
curl 127.0.0.1:9090/redfish/v1/Systems/<System-ID>/Processors/0| jq '.'
Redfish API - Helper
Show the list of RackHD Redfish APIs’ by running below command:
curl 127.0.0.1:9090/redfish/v1| jq '.'
The following steps provide an overview of how to use the Swagger UI.
http://<IP>:9090/swagger-ui
in the URL address box. The <IP> should be set to the node ip where the environment is set up. For example, if you set up environemt on windows, the <IP> should be set to localhost
. If you set up environment on Linux, you can get node ip first by the command ifconfig eth0
and then replace <IP>.Notes: Some APIs do not require parameters. Some APIs require that you specify a unique Node ID or other parameters. Enter any necessary parameters and Swagger UI builds the RESTful API request and sends it when you click Try it Out.