Copyright 2017-2019 DMTF. All rights reserved.
libRedfish is a C client library that allows for Creation of Entities (POST), Read of Entities (GET), Update of Entities (PATCH), Deletion of Entities (DELETE), running Actions (POST), receiving events, and providing some basic query abilities.
- Add the EPEL repository
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
- Install libjansson, libcurl, and libreadline
# yum install jansson libcurl readline
- Download RPM (example only please download latest RPM)
$ wget https://github.com/DMTF/libredfish/releases/download/1.2.0/libredfish-1.2.0-1.el7.x86_64.rpm
- Install the RPM (substititue the file name from the lastest RPM)
# rpm -ivh libredfish-1.2.0-1.el7.x86_64.rpm
- Add the EPEL repository
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
- Install libjansson, libcurl, and libreadline
# yum install jansson libcurl readline
- Download RPM (example only please download latest RPM)
$ wget https://github.com/DMTF/libredfish/releases/download/1.2.0/libredfish-1.2.0-1.el6.x86_64.rpm
- Install the RPM (substititue the file name from the lastest RPM)
# rpm -ivh libredfish-1.2.0-1.el6.x86_64.rpm
- Install libjansson, libcurl, and libreadline
apt-get install libjansson4 libcurl4 libreadline7
- Download Debian Package
- Install Debian Package
#dpkg -i libredfish-1.2.0-1.x86_64.deb
Compile from source, see below.
libRedfish is based on C and the compiling system is required to have:
- CMake
- C Compiler
- libjansson - http://www.digip.org/jansson/
- libcurl - https://curl.haxx.se/libcurl/ To receive events a user needs an existing webserver supporting FastCGI (such as Apache or nginx) and libczmq (https://github.com/zeromq/czmq).
Run cmake.
libRedfish uses a query language based on XPath (https://www.w3.org/TR/1999/REC-xpath-19991116/). This library and query language essentially treat the entire Redfish Service like it was a single JSON document. In other words whenever it encounters an @odata.id it will retrieve the new document (if needed).
Expression | Description |
---|---|
nodename | Selects the JSON entity with the name "nodename" |
/ | Selects from the root node |
[index] | Selects the index number JSON entity from an array or object. For arrays, the index is 0-based. |
[last()] | Selects the last index number JSON entity from an array or object |
[nodename] | Selects all the elements from an array or object that contain a property named "nodename" |
[name=value] | Selects all the elements from an array or object where the property "name" is equal to "value" |
[name<value] | Selects all the elements from an array or object where the property "name" is less than "value" |
[name<=value] | Selects all the elements from an array or object where the property "name" is less than or equal to "value" |
[name>value] | Selects all the elements from an array or object where the property "name" is greater than "value" |
[name>=value] | Selects all the elements from an array or object where the property "name" is greater than or equal to "value" |
[name!=value] | Selects all the elements from an array or object where the property "name" does not equal "value" |
[*] | Selects all the elements from an array or object |
[node.child] | Selects all the elements from an array or object that contain a property named "node" which contains "child" |
Some examples:
- /Chassis[0] - Will return the first Chassis instance
- /Chassis[SKU=1234] - Will return all Chassis instances with a SKU field equal to 1234
- /Systems[Storage] - Will return all the System instances that have Storage field populated
- /Systems[*] - Will return all the System instances
- /SessionService/Sessions[last()] - Will return the last Session instance
- /Chassis[Location.Info] - Will return all the Chassis instances that have a Location field and a Info subfield of Location
- /Systems[Status.Health=OK] - Will return all System instances that have a Health of OK
#include <redfish.h>
#include <stdio.h>
int main(int argc, char** argv)
{
redfishService* service = createRedfishServiceEnumerator(argv[1], NULL, NULL, 0);
redfishPayload* payload = getPayloadByPath(service, argv[2]);
char* payloadStr = payloadToString(payload, true);
printf("Payload Value = %s\n", payloadStr);
free(payloadStr);
cleanupPayload(payload);
cleanupEnumerator(service);
}
- Go to the "Actions" page
- Select the "Release and Publish" workflow
- Click "Run workflow"
- Fill out the form
- Click "Run workflow"