1
1
# Redfish cheat sheet
2
+
2
3
This document is intended to provide a set of example [ Redfish] [ 1 ] client
3
- commands for OpenBMC usage. This document uses cURL.
4
- This document assumes several ids, such as ManagerId, "bmc", and
5
- ComputerSystemId, "system". Assuming an id is not correct and any software
6
- written to use the Redfish API should not. From the Redfish Specification,
7
- DSP0266, "Clients shall not make assumptions about the URIs for the members of a
8
- resource collection."
4
+ commands for OpenBMC usage. This document uses cURL. This document assumes
5
+ several ids, such as ManagerId, "bmc", and ComputerSystemId, "system". Assuming
6
+ an id is not correct and any software written to use the Redfish API should not.
7
+ From the Redfish Specification, DSP0266, "Clients shall not make assumptions
8
+ about the URIs for the members of a resource collection."
9
9
10
10
## Query Redfish Service Root
11
+
11
12
```
12
13
export bmc=xx.xx.xx.xx
13
14
curl -k https://${bmc}/redfish/v1
@@ -16,29 +17,35 @@ curl -k https://${bmc}/redfish/v1
16
17
---
17
18
18
19
## Establish Redfish connection session
20
+
19
21
##### Method 1
22
+
20
23
```
21
24
export bmc=xx.xx.xx.xx
22
25
curl --insecure -H "Content-Type: application/json" -X POST -D headers.txt https://${bmc}/redfish/v1/SessionService/Sessions -d '{"UserName":"root", "Password":"0penBmc"}'
23
26
```
24
- A file, headers.txt, will be created. Find the ` "X-Auth-Token" `
25
- in that file. Save it away in an env variable like so:
27
+
28
+ A file, headers.txt, will be created. Find the ` "X-Auth-Token" ` in that file.
29
+ Save it away in an env variable like so:
26
30
27
31
```
28
32
export bmc_token=<token>
29
33
```
30
34
31
- ##### Method 2
35
+ ##### Method 2
36
+
32
37
```
33
38
export bmc=xx.xx.xx.xx
34
39
export token=`curl -k -H "Content-Type: application/json" -X POST https://${bmc}/login -d '{"username" : "root", "password" : "0penBmc"}' | grep token | awk '{print $2;}' | tr -d '"'`
35
40
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/...
36
41
```
42
+
37
43
Note: Method 2 is used in this document.
38
44
39
45
---
40
46
41
47
## View Redfish Objects
48
+
42
49
```
43
50
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis
44
51
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Managers
@@ -48,64 +55,77 @@ curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems
48
55
---
49
56
50
57
## View sessions
58
+
51
59
```
52
60
curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/SessionService/Sessions
53
61
```
54
62
55
63
---
56
64
57
65
## Host power
66
+
58
67
Host soft power off:
68
+
59
69
```
60
70
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulShutdown"}'
61
71
```
62
72
63
73
Host hard power off:
74
+
64
75
```
65
76
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "ForceOff"}'
66
77
```
67
78
68
79
Host power on:
80
+
69
81
```
70
82
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "On"}'
71
83
```
72
84
73
85
Reboot Host:
86
+
74
87
```
75
88
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Systems/system/Actions/ComputerSystem.Reset -d '{"ResetType": "GracefulRestart"}'
76
89
```
77
90
78
91
---
79
92
80
93
## BMC reboot
94
+
81
95
```
82
96
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Managers/bmc/Actions/Manager.Reset -d '{"ResetType": "GracefulRestart"}'
83
97
```
84
98
85
99
---
86
100
87
101
## BMC factory reset
102
+
88
103
Proceed with caution:
104
+
89
105
```
90
106
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults -d '{"ResetToDefaultsType": "ResetAll"}'
91
107
```
92
108
93
109
---
94
110
95
111
## Log entry
112
+
96
113
Display logging entries:
114
+
97
115
```
98
116
curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries
99
117
```
100
118
101
119
Delete logging entries:
120
+
102
121
```
103
122
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.Reset
104
123
```
105
124
106
125
---
107
126
108
127
## Firmware ApplyTime:
128
+
109
129
```
110
130
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"HttpPushUriOptions":{"HttpPushUriApplyTime":{"ApplyTime":"Immediate"}}}' https://${bmc}/redfish/v1/UpdateService
111
131
```
@@ -119,71 +139,83 @@ curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -
119
139
---
120
140
121
141
## Firmware update
122
- Firmware update:
123
- Note the ` <image file path> ` must be a tarball.
142
+
143
+ Firmware update: Note the ` <image file path> ` must be a tarball.
124
144
125
145
```
126
146
uri=$(curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/UpdateService | jq -r ' .HttpPushUri')
127
147
128
148
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/octet-stream" -X POST -T <image file path> https://${bmc}${uri}
129
149
```
130
150
131
- TFTP Firmware update using TransferProtocol:
132
- Note: The ` <image file path> ` contains the address of the TFTP service: ` xx.xx.xx.xx/obmc-phosphor-xxxxx-xxxxxxxxx.static.mtd.tar `
151
+ TFTP Firmware update using TransferProtocol: Note: The ` <image file path> `
152
+ contains the address of the TFTP service:
153
+ ` xx.xx.xx.xx/obmc-phosphor-xxxxx-xxxxxxxxx.static.mtd.tar `
133
154
134
155
```
135
156
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"TransferProtocol":"TFTP","ImageURI":"<image file path>"}'
136
157
```
158
+
137
159
TFTP Firmware update with protocol in ImageURI:
160
+
138
161
```
139
162
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate -d '{"ImageURI":"tftp://<image file path>"}'
140
163
```
141
164
142
165
---
143
166
144
167
## Update "root" password
168
+
145
169
Change password to "0penBmc1":
170
+
146
171
```
147
172
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"Password": "0penBmc1"}' https://${bmc}/redfish/v1/AccountService/Accounts/root
148
173
```
149
174
150
175
---
151
176
152
177
## BIOS firmware boot control
178
+
153
179
Enter into BIOS setup on boot
180
+
154
181
```
155
182
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Systems/system -d '{"Boot":{"BootSourceOverrideEnabled": "Continuous","BootSourceOverrideTarget": "BiosSetup"}}'
156
183
```
157
184
158
185
Fully boot
186
+
159
187
```
160
188
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Systems/system -d '{"Boot":{"BootSourceOverrideEnabled": "Disabled","BootSourceOverrideTarget": "None"}}'
161
189
```
162
190
163
191
Change Legacy/EFI selector (valid only if host is based on the x86 CPU)
192
+
164
193
```
165
194
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Systems/system -d '{"Boot":{"BootSourceOverrideEnabled": "Once","BootSourceOverrideTarget": "None","BootSourceOverrideMode": "UEFI"}}'
166
195
```
167
196
168
197
---
169
198
170
199
## Enable NTP
200
+
171
201
Add a NTP Server
202
+
172
203
```
173
204
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol -d '{"NTP":{"NTPServers":["time.nist.gov"]}}'
174
205
```
175
206
176
207
Now enable NTP
208
+
177
209
```
178
210
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol -d '{"NTP":{"ProtocolEnabled": true}}'
179
211
```
180
212
181
213
---
182
214
183
215
## Disable IPMI
216
+
184
217
```
185
218
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Managers/bmc/NetworkProtocol -d '{"IPMI":{"ProtocolEnabled": false}}'
186
219
```
187
220
188
-
189
221
[ 1 ] : https://www.dmtf.org/standards/redfish
0 commit comments