summaryrefslogtreecommitdiffstats
path: root/REDFISH-cheatsheet.md
blob: 7f3bad91cea3dce6bdb39e5d5ee928231c9c1a57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# OpenBMC Redfish cheat sheet

This document is intended to provide a set of [Redfish][1] client
commands for OpenBMC usage.

## Using CURL commands
* Query Root
   ```
   $ export bmc=xx.xx.xx.xx
   $ curl -b cjar -k https://${bmc}/redfish/v1
   ```

* Establish Redfish connection session:
    ```
   $ export bmc=xx.xx.xx.xx
   $ curl --insecure -X POST -D headers.txt https://${bmc}/redfish/v1/SessionService/Sessions -d '{"UserName":"root", "Password":"0penBmc"}'
    ```
    A file, headers.txt, will be created. Find the "X-Auth-Token"
    in that file. Save it away in an env variable like so:
    ```
    export bmc_token=<token>
    ```

* View Redfish Objects
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Chassis
    $ curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers
    $ curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Systems
    ```

* Host soft power off:
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/1/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulShutdown"}'
    ```

* Host hard power off:
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/1/Actions/ComputerSystem.Reset -d '{"ResetType": "ForceOff"}'
    ```

* Host power on:
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/1/Actions/ComputerSystem.Reset -d '{"ResetType": "On"}'
    ```

* Reboot Host:
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/1/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulRestart"}'
    ```

* Display logging entries:
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Systems/1/LogServices/SEL/Entries
    ```

* Delete logging entries:
    ```
    $ curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/1/LogServices/SEL/Actions/LogService.Reset
    ```
[1]: https://www.dmtf.org/standards/redfish
OpenPOWER on IntegriCloud