Debian Codegraph @

README.md

raw symbols SCIP
1 Copyright 2016-2018 DMTF. All rights reserved.
2
3 # redfishtool
4
5 ## About
6
7 ***redfishtool*** is a commandline tool that implements the client side of the Redfish RESTful API for Data Center Hardware Management.
8
9 **Redfish** is the new RESTful API for hardware management defined by the DMTF Scalable Platform Management Forum (SPMF). It provides a modern, secure, multi-node, extendable interface for doing hardware management. The initial release included hardware inventory, server power-on/off/reset, reading power draw, setting power limits, reading sensors such as fans, read/write of ID LEDs, asset tags, and went beyond IPMI in functionality to include inventory of processors, storage, Ethernet controllers, and total memory. New Redfish extensions have now been added to the spec and include firmware update, BIOS config, memory inventory, direct attached storage control, and the list grows.
10
11 ***redfishtool*** makes it simple to use the Redfish API from a BASH script or interactively from a client command shell.
12
13 While other generic HTTP clients such as Linux curl can send and receive Redfish requests, ***redfishtool*** goes well beyond these generic HTTP clients by automatically handling many of the hypermedia and Redfish-specific protocol aspects of the Redfish API that require a client to often execute multiple queries to a redfish service to walk the hypermedia links from the redfish root down to the detailed URI of a specific resource (eg Processor-2 of Blade-4 in a computer blade system). Specifically, redfishtool provides the following functions over curl:
14
15 * implements Redfish Session Authentication as well as HTTP Basic Auth
16 * walks the Redfish schema following strict interoperpbility processors...] to find find the targeted instance based on Id, UUID, URL or other attributes
17 * handles GETs for collections that are returned in multiple pieces--requiring client to read in a loop until the full collection is returned
18 * handles ETag and If-Match headers when PATCHing a resource to write properties
19 * implements many common set or action operations with simple commandline syntax (eg server reset, setting LEDs, assetTag, powerLimits, etc)
20 * negotiates the latest redfish protocol version between client and service (demonstrating the proper way to do this)
21 * can read specific properties of a resource, or expand collections to include all members of the collection expanded
22 * supports adding and deleting users, and common Redfish account service operations
23 * For debug, provides multiple levels of verbose output to add descriptive headers, and show what HTTP requests are being executed
24 * For debug, includes multiple levels of status display showing HTTP status codes and headers returned and sent
25 * For easy parsing, outputs all responses in JSON format unless verbose or status debug options were specified
26
27
28 ## Why redfishtool?
29
30 1. ***redfishtool*** was originally written during the development of the Redfish specification to help find ambiguities in the spec.
31 1. ***redfishtool*** is now also being used to test inter-operability between redfish service implementations.
32 1. In addition, ***redfishtool*** provides an example implementation for how a client can execute common server management functions like inventory; power-on/off/reset; setting power limits, indicator LEDs, and AssetTags, and searching a multi-node redfish service to find a specific node (with specific UUID, redfish Id, etc). redfishtool follows strict rules of interoperability. To support this goal, liberal comments are added throughout code to explain why each step is being executed.
33 1. As described above, it makes it easy to use the Redfish API from a BASH script, or as an easy-to-use interactive CLI -- but WITHOUIT creating a 'new API'. All (rather most) of the responses from ***redfishtool*** are Redfish-defined responses. The properties and resources are defined in the redfish spec. ***redfishtool*** is just a tool to access the Redfish API-not a new interface itself.
34 * The execption is that a 'list' operation was added for all collections to display the key properties for each of the members--rather than just the URIs to the members.
35
36
37 ## Installation
38 `redfishtool` can be installed via [pip](https://pip.pypa.io/en/stable/).
39
40 ```
41 pip install redfishtool
42 ```
43
44
45 ## Requirements
46
47 ***redfishtool*** is based on Python 3 and the client system is required to have the Python framework installed before the tool can be installed and executed on the system.
48
49 If cloning the tool from Github, as opposed to performing the installation via pip, the following packages are required to be installed and accessible from the python environment:
50
51 * requests - [https://github.com/psf/requests]()
52 * python-dateutil - [https://github.com/dateutil/dateutil]()
53
54 You may install the required packages by running:
55
56 pip install -r requirements.txt
57
58
59 ## Usage
60
61 ***python*** ***redfishtool*** [ ***Options*** ] [ ***SubCommands*** ] [ ***Operation*** ] [ ***OtherArgs*** ]
62
63 * ***redfishtool*** is a python3.4+ program. It uses the python3 "requests" lib for sending HTTP requests, and a host of other standard libs in python3.4+
64 * The ***redfishtool*** option/optarg parsing strictly follows the well established linux/GNU getopt syntax where arguments and options can be specified in any order, and both short (eg -r <host>) or long (--rhost=<host>) syntax is supported.
65 * ***options*** are used to pass usernames, passwords, Host:port, authentication options, verbose/status flags, and also to specify how to search to find specific collection members (-I <Id>, -a (all), -M <prop>:<val> ).
66 * ***subCommands*** indicate the general area of the API (following ipmitool convention), and align with Redfish navigation property names like "Chassis", "Systems", "AccountService", etc.
67 * ***Operations*** are specify an action or operation you want to perform like S`ystems setBootOverride` ..., or `Systems reset`.
68 * ***OtherArgs*** are any other arguments after the Operation that are sometimes required--like: `Systems <setBootOverride> <enableValue>` <targetValue>`
69
70 ### Common OPTIONS:
71
72 -V, --version -- show redfishtool version, and exit
73 -h, --help -- show Usage, Options, and list of subCommands, and exit
74 -v, --verbose -- verbose level, can repeat up to 5 times for more verbose output
75 -v(header), -vv(+addl info), -vvv(Request trace), -vvvv(+subCmd dbg), -vvvvv(max dbg)
76 -s, --status -- status level, can repeat up to 5 times for more status output
77 -s(http_status),
78 -ss(+r.url, +r.elapsed executionTime ),
79 -sss(+request hdrs,data,authType, +response status_code, +response executionTime,
80 +login auth token/sessId/sessUri)
81 -ssss(+response headers), -sssss(+response data
82 -u <user>, --user=<usernm> -- username used for remote redfish authentication
83 -p <passwd>, --password=<passwd> -- password used for remote redfish authentication
84 -r <rhost>, --rhost=<rhost> -- remote redfish service hostname or IP:port
85 -t <token>, --token=<token> -- redfish auth session token-for sessions across multiple calls
86 -q, --quiet -- quiet mode--suppress error, warning, and diagnostic messages
87 -c <cfgFile>,--config=<cfgFile> -- read options (including credentials) from file <cfgFile>
88 -T <timeout>,--Timeout=<timeout> -- timeout in seconds for each http request. Default=10
89
90 -P <property>, --Prop=<property> -- return only the specified property. Applies only to all "get" operations
91 -E, --Entries -- Fetch the Logs entries. Applies to Logs sub-command of Systems, Chassis and Managers
92
93
94 ###### Options used by "raw" subcommand:
95
96 -d <data> --data=<data> -- the http request "data" to send on PATCH,POST,or PUT requests
97
98
99 ###### Options to specify top-level collection members: eg: `Systems -I <sysId>`
100 For `Systems`, `Managers`, and `Chassis` commands that require specifying a top-level collection member, if no option is specified the default is `--One`.
101
102 -I <Id>, --Id=<Id> -- Use <Id> to specify the collection member
103 -M <prop>:<val> --Match=<prop>:<val>-- Use <prop>=<val> search to find the collection member
104 -F, --First -- Use the 1st link returned in the collection or 1st "matching" link if used with -M
105 -1, --One -- Use the single link returned in the collection. Return error if more than one member exists
106 -a, --all -- Returns all members if the operation is a Get on a top-level collection like Systems
107 -L <Link>, --Link=<Link> -- Use <Link> (eg /redfish/v1/Systems/1) to reference the collection member.
108 -- If <Link> is not one of the links in the collection, and error is returned.
109
110
111 ###### Options to specify 2nd-level collection members: eg: `Systems -I<sysId> Processors -i<procId>`
112
113 -i <id>, --id=<id> -- use <id> to specify the 2nd-level collection member
114 -m <prop>:<val> --match=<prop>:val>--use <prop>=<val> search of 2nd-level collection to specify member
115 -l <link> --link=<link> -- Use <link> (eg /redfish/v1/SYstems/1/Processors/1) to reference a 2nd level resource
116 -- A -I|M|F|1|L option is still required to specify the link to the top-lvl collection
117 -a, --all -- Returns all members of the 2nd level collection if the operation is a Get on the
118 -- 2nd level collection (eg Processors). -I|M|F|1|L still specifies the top-lvl collection.
119
120
121 ###### Additional OPTIONS:
122
123 -W <num>:<connTimeout>, -- Send up to <num> {GET /redfish} requests with <connTimeout> TCP connection timeout
124 --Wait=<num>:<ConnTimeout> -- before sending subcommand to rhost. Default is -W 1:3
125 -A <Authn>, --Auth <Authn> -- Authentication type to use: Authn={None|Basic|Session} Default is Basic
126 -S <Secure>, --Secure=<Secure> -- When to use https: (Note: doesn't stop rhost from redirect http to https)
127 <Secure>={Always | IfSendingCredentials | IfLoginOrAuthenticatedApi(default) }
128 -R <ver>, --RedfishVersion=<ver>-- The Major Redfish Protocol version to use: ver={v1(dflt), v<n>, Latest}
129 -C --CheckRedfishVersion -- tells Redfishtool to execute GET /redfish to verify that the rhost supports
130 the specified redfish protocol version before executing a sub-command.
131 The -C flag is auto-set if the -R Latest or -W ... options are selected
132 -N, --NonBlocking -- Do not wait for asynchronous requests to complete.
133 -n, --no-proxy -- Ignore any PROXY environment variables.
134 -H <hdrs>, --Headers=<hdrs> -- Specify the request header list--overrides defaults. Format "{ A:B, C:D...}"
135 -D <flag>, --Debug=<flag> -- Flag for dev debug. <flag> is a 32-bit uint: 0x<hex> or <dec> format
136
137
138 ### Subcommands:
139
140 hello -- redfishtool hello world subcommand for dev testing
141 about -- display version and other information about this version of redfishtool
142 versions -- get redfishProtocol versions supported by rhost: GET ^/redfish
143 root | serviceRoot -- get serviceRoot resouce: GET ^/redfish/v1/
144 Systems -- operations on Computer Systems in the /Systems collection
145 Chassis -- operations on Chassis in the /Chassis collection
146 Managers -- operations on Managers in the /Managers collection
147 AccountService -- operations on AccountService including user administration
148 SessionService -- operations on SessionService including Session login/logout
149 odata -- get the Odata Service document: GET ^/redfish/v1/odata
150 metadata -- get the CSDL metadata document: GET ^/redfish/v1/$metadata
151 raw -- subcommand to execute raw http methods(GET,PATCH,POST...) and URIs
152
153 For Subcommand usage, including subcommand Operations and OtherArgs, execute:
154
155 redfishtool <SubCommand> -h -- usage and options for specific subCommand
156
157 ### Subcommand Operations and Addl Args
158
159 ###### Systems Operations
160
161 python redfishtool.py -r <rhost> -u <username> -p <password> Systems -h
162 Usage:
163 redfishtool [OPTNS] Systems <operation> [<args>] -- perform <operation> on the system specified
164 <operations>:
165 [collection] -- get the main Systems collection. (Default operation if no member specified)
166 [get] -- get the computerSystem object. (Default operation if collection member specified)
167 list -- list information about the Systems collection members("Id", URI, and AssetTag)
168 patch {A: B,C: D,...} -- patch the json-formatted {prop: value...} data to the object
169 reset <resetType> -- reset a system. <resetType>= On, GracefulShutdown, GracefulRestart,
170 ForceRestart, ForceOff, ForceOn, Nmi, PushPowerButton, PowerCycle
171 setAssetTag <assetTag> -- set the system's asset tag
172 setIndicatorLed <state> -- set the indicator LED. <state>=redfish defined values: Off, Lit, Blinking
173 setBootOverride <enabledVal> <targetVal> -- set Boot Override properties. <enabledVal>=Disabled|Once|Continuous
174 -- <targetVal> =None|Pxe|Floppy|Cd|Usb|Hdd|BiosSetup|Utilities|Diags|UefiTarget|
175 Processors [list] -- get the "Processors" collection, or list "id" and URI of members.
176 Processors [IDOPTN] -- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
177 Inventory [list] -- get the "Inventory" collection, or list "id" and URI of members.
178
179 EthernetInterfaces [list] -- get the "EthernetInterfaces" collection, or list "id" and URI of members.
180 EthernetInterfaces [IDOPTN]-- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
181
182 SimpleStorage [list] -- get the ComputerSystem "SimpleStorage" collection, or list "id" and URI of members.
183 SimpleStorage [IDOPTN] -- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
184
185 Logs [list] -- get the ComputerSystem "LogServices" collection , or list "id" and URI of members.
186 Logs [IDOPTN] -- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
187 clearLog <id> -- clears the log defined by <id>
188 examples -- example commands with syntax
189 hello -- Systems hello -- debug command
190
191
192 ###### Chassis Operations
193
194 python redfishtool.py -r <rhost> -u <username> -p <password> Chassis -h
195 Usage:
196 redfishtool [OPTNS] Chassis <operation> [<args>] -- perform <operation> on the Chassis specified
197 <operations>:
198 [collection] -- get the main Chassis collection. (Default operation if no member specified)
199 [get] -- get the Chassis object. (Default operation if collection member specified)
200 list -- list information about the Chassis collection members("Id", URI, and AssetTag)
201 patch {A: B,C: D,...} -- patch the json-formatted {prop: value...} data to the object
202 setAssetTag <assetTag> -- set the Chassis's asset tag
203 setIndicatorLed <state> -- set the indicator LED. <state>=redfish defined values: Off, Lit, Blinking
204 Power -- get the full Power resource under a specified Chassis instance.
205 Thermal -- get the full Thermal resource under a specified Chassis instance.
206 Sensors -- get all sensors
207
208 getPowerReading [-i<indx>] [consumed]-- get powerControl resource w/ power capacity, PowerConsumed, and power limits
209 if "consumed" keyword is added, then only current usage of powerControl[indx] is returned
210 <indx> is the powerControl array index. default is 0. normally, 0 is the only entry
211 setPowerLimit [-i<indx>] <limit> [<exception> [<correctionTime>]] -- set powerLimit control properties
212 <limit>=null disables power limiting. <indx> is the powerControl array indx (dflt=0)
213
214 Logs [list] -- get the Chassis "LogServices" collection , or list "id" and URI of members.
215 Logs [IDOPTN] -- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
216 clearLog <id> -- clears the log defined by <id>
217 examples -- example commands with syntax
218 hello -- Chassis hello -- debug command
219
220
221 ###### Managers Operations
222
223 python redfishtool.py -r <rhost> -u <username> -p <password> Managers -h
224 Usage:
225 redfishtool [OPTNS] Managers <operation> [<args>] -- perform <operation> on the Managers specified
226 <operations>:
227 [collection] -- get the main Managers collection. (Default operation if no member specified)
228 [get] -- get the specified Manager object. (Default operation if collection member specified)
229 list -- list information about the Managers collection members("Id", URI, and UUID)
230 patch {A: B,C: D,...} -- patch the json-formatted {prop: value...} data to the object
231 reset <resetType> -- reset a Manager. <resetType>= On, GracefulShutdown, GracefulRestart,
232 ForceRestart, ForceOff, ForceOn, Nmi, PushPowerButton, PowerCycle
233 setDateTime <dateTimeString>--set the date and time
234 setTimeOffset offset=<offsetString> --set the time offset w/o changing time setting
235 <offsetString> is of form "[+/-]mm:ss". Ex: "-10:01"
236 NetworkProtocol -- get the "NetworkProtocol" resource under the specified manager.
237 setIpAddress [-i<indx>]... -- set the Manager IP address -NOT IMPLEMENTED YET
238
239 EthernetInterfaces [list] -- get the managers "EthernetInterfaces" collection, or list "id",URI, Name of members.
240 EthernetInterfaces [IDOPTN]-- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -a #all
241
242 SerialInterfaces [list] -- get the managers "SerialInterfaces" collection, or list "id",URI, Name of members.
243 SerialInterfaces [IDOPTN] -- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
244
245 Logs [list] -- get the Managers "LogServices" collection , or list "id",URI, Name of members.
246 Logs [IDOPTN] -- get the member specified by IDOPTN: -i<id>, -m<prop>:<val>, -l<link>, -a #all
247 clearLog <id> -- clears the log defined by <id>
248 examples -- example commands with syntax
249 hello -- Systems hello -- debug command
250
251
252 ###### AccountService Operations
253
254 python redfishtool.py -r <rhost> -u <username> -p <password> AccountService -h
255 Usage:
256 redfishtool [OPTNS] AccountService <operation> [<args>] -- perform <operation> on the AccountService
257 <operations>:
258 [get] -- get the AccountService object.
259 patch {A: B,C: D,...} -- patch the AccountService w/ json-formatted {prop: value...}
260 Accounts [list] -- get the "Accounts" collection, or list "Id", username, and Url
261 Accounts [IDOPTN] -- get the member specified by IDOPTN: -i<Id>, -m<prop>:<val>, -l<link>, -a #all
262 Roles [list] -- get the "Roles" collection, or list "Id", IsPredefined, and Url
263 Roles [IDOPTN] -- get the member specified by IDOPTN: -i<Id>, -m<prop>:<val>, -l<link>, -a #all
264 adduser <usernm> <passwd> [<roleId>] -- add a new user to the Accounts collection
265 -- <roleId>:{Administrator | Operator | ReadOnlyUser | <a custom roleId}, dflt=Operator
266 deleteuser <usernm> -- delete an existing user from Accouts collection
267 setpassword <usernm> <passwd> -- set (change) the password of an existing user account
268 useradmin <userName> [enable|disable|unlock|[setRoleId <roleId>]] -- enable|disable|unlock.. a user account
269 setusername <id> <userName> -- set UserName for account with given Id
270 examples -- example commands with syntax
271 hello -- AccountService hello -- debug command
272
273
274 ###### SessionService Operations
275
276 python redfishtool.py -r <rhost> -u <username> -p <password> SessionService -h
277 Usage:
278 redfishtool [OPTNS] SessionService <operation> [<args>] -- perform <operation> on the SessionService
279 <operations>:
280 [get] -- get the sessionService object.
281 patch {A: B,C: D,...} -- patch the sessionService w/ json-formatted {prop: value...}
282 setSessionTimeout <timeout> -- patches the SessionTimeout property w/ etag support
283 Sessions [list] -- get the "Sessions" collection, or list "Id", username, and Url
284 Sessions [IDOPTN] -- get the member specified by IDOPTN: -i<Id>, -m<prop>:<val>, -l<link>, -a #all
285 login -- sessionLogin. post to Sessions collection to create a session
286 the user is -u<user>, password is -p<password>
287 logout -- logout or delete the session by identified by -i<SessionId> or -l<link>
288 where <link> is the session path returned in Location from login
289 examples -- example commands with syntax
290 hello -- Systems hello -- debug command
291
292
293 ###### raw Operations
294
295 python redfishtool.py -r <rhost> -u <username> -p <password> raw -h
296 Usage:
297 redfishtool [OPTNS] raw <method> <path>
298
299 redfishtool raw -h # for help
300 redfishtool raw examples #for example commands
301
302 <method> is one of: GET, PATCH, POST, DELETE, HEAD, PUT
303 <path> is full URI path to a redfish resource--the full path following <ipaddr:port>, starting with forward slash /
304
305 Common OPTNS:
306 -u <user>, --user=<usernm> -- username used for remote redfish authentication
307 -p <passwd>, --password=<passwd> -- password used for remote redfish authentication
308 -t <token>, --token=<token> - redfish auth session token-for sessions across multiple calls
309
310 -r <rhost>, --rhost=<rhost> -- remote redfish service hostname or IP:port
311 -X <method> --request=<method> -- the http method to use. <method>={GET,PATCH,POST,DELETE,HEAD,PUT}. Default=GET
312 -d <data> --data=<data> -- the http request "data" to send on PATCH,POST,or PUT requests
313 -H <hdrs>, --Headers=<hdrs> -- Specify the request header list--overrides defaults. Format "{ A:B, C:D...}"
314 -S <Secure>, --Secure=<Secure> -- When to use https: (Note: doesn't stop rhost from redirect http to https)
315 <operations / methods>:
316 GET -- HTTP GET method
317 PATCH -- HTTP PATCH method
318 POST -- HTTP POST method
319 DELETE -- HTTP DELETE method
320 HEAD -- HTTP HEAD method
321 PUT -- HTTP PUT method
322 examples -- example raw commands with syntax
323 hello -- raw hello -- debug command
324
325
326 # Example Usage
327
328 ### System subcommand Examples
329
330 $ python redfishtool.py -r <ip> -u <username> -p <password> Systems examples
331 # Shows the Systems Collection
332 redfishtool -r <ip> -u <username> -p <password> Systems
333
334 # Lists Id, Uri, AssetTag for all systems
335 redfishtool -r <ip> -u <username> -p <password> Systems list
336
337 # Gets the system with Id=<d>
338 redfishtool -r <ip> -u <username> -p <password> Systems -I <id>
339
340 # Gets the system with AssetTag=12345
341 redfishtool -r <ip> -u <username> -p <password> Systems -M AssetTag:12345
342
343 # Gets the system at URI=<systemUrl>
344 redfishtool -r <ip> -u <username> -p <password> Systems -L <systemUrl>
345
346 # Gets the first system returned (for debug)
347 redfishtool -r <ip> -u <username> -p <password> Systems -F
348
349 # Gets the first system and verify that there is only one system
350 redfishtool -r <ip> -u <username> -p <password> Systems -1
351
352 # Patches the json-formated {prop: value...} data to the specified system
353 redfishtool -r <ip> -u <username> -p <password> Systems -I <id> patch {A: B,C: D,...}
354
355 # Patches the json-formated {prop: value...} data to all systems
356 redfishtool -r <ip> -u <username> -p <password> Systems --all patch {A: B,C: D,...}
357
358 # Resets a system. <resetType>=the redfish-defined values: On, Off, gracefulOff...
359 redfishtool -r <ip> -u <username> -p <password> Systems -I <id> reset <resetType>
360
361 # Resets all systems. <resetType>=the redfish-defined values: On, Off, gracefulOff...
362 redfishtool -r <ip> -u <username> -p <password> Systems --all reset <resetType>
363
364 # Sets the system's asset tag to <assetTag>
365 redfishtool -r <ip> -u <username> -p <password> Systems -I <id> setAssetTag <assetTag>
366
367 # Sets all system's asset tags to <assetTag>
368 redfishtool -r <ip> -u <username> -p <password> Systems --all setAssetTag <assetTag>
369
370 # Sets the indicator LED. <state>=redfish defined values: Off, Lit, Blinking
371 redfishtool -r <ip> -u <username> -p <password> Systems -I <id> setIndicatorLed <state>
372
373 # Sets the indicator LED on all systems. <state>=redfish defined values: Off, Lit, Blinking
374 redfishtool -r <ip> -u <username> -p <password> Systems --all setIndicatorLed <state>
375
376 # Sets Boot Override properties. <enabledVal>=Disabled|Once|Continuous
377 redfishtool -r <ip> -u <username> -p <password> Systems -I <id> setBootOverride <enabledVal> <targetVal>
378
379 # Sets Boot Override properties on all systems. <enabledVal>=Disabled|Once|Continuous
380 redfishtool -r <ip> -u <username> -p <password> Systems --all setBootOverride <enabledVal> <targetVal>
381
382 # Gets the Processor Collection
383 redfishtool -r <ip> -u <username> -p <password> Systems -I <Id> Processors
384
385 # Lists Id, Uri, & Socket for all processors in system w/ Id=<Id>
386 redfishtool -r <ip> -u <username> -p <password> Systems -I <Id> Processors list
387
388 # Gets the processor with id=1 in system with Id=<Id>
389 redfishtool -r <ip> -u <username> -p <password> Systems -I <Id> Processors -i 1
390
391 # Gets processor with property Socket=CPU_1, on system at url <sysUrl>
392 redfishtool -r <ip> -u <username> -p <password> Systems -L <sysUrl> Processors -m Socket:CPU_1
393
394 # Gets log member with Id=SEL from the first System
395 redfishtool -r <ip> -u <username> -p <password> Systems -1 Logs -i SEL
396
397 # Gets log entries with Id=SEL from the first System
398 redfishtool -r <ip> -u <username> -p <password> Systems -1 Logs -E -i SEL
399
400 # Gets System inventory
401 redfishtool -r <ip> -u <username> -p <password> Systems Inventory
402
403
404 ### Chassis subcommand Examples
405
406 $ python redfishtool.py -r <ip> -u <username> -p <password> Chassis examples
407 # Shows the Chassis Collection
408 redfishtool -r <ip> -u <username> -p <password> Chassis
409
410 # Lists Id, Uri, AssetTag for all Chassis
411 redfishtool -r <ip> -u <username> -p <password> Chassis list
412
413 # Gets the Chassis with Id=<d>
414 redfishtool -r <ip> -u <username> -p <password> Chassis -I <id>
415
416 # Gets the Chassis with AssetTag=12345
417 redfishtool -r <ip> -u <username> -p <password> Chassis -M AssetTag:12345
418
419 # Gets the Chassis at URI=<chassisUrl>
420 redfishtool -r <ip> -u <username> -p <password> Chassis -L <chassisUrl>
421
422 # Gets the first Chassis returned (for debug)
423 redfishtool -r <ip> -u <username> -p <password> Chassis -F
424
425 # Gets the first Chassis and verify that there is only one system
426 redfishtool -r <ip> -u <username> -p <password> Chassis -1
427
428 # Patches the json-formated {prop: value...} data to the specified chassis
429 redfishtool -r <ip> -u <username> -p <password> Chassis -I <id> patch {A: B,C: D,...}
430
431 # Patches the json-formated {prop: value...} data to all chassis
432 redfishtool -r <ip> -u <username> -p <password> Chassis --all patch {A: B,C: D,...}
433
434 # Sets the chassis's asset tag
435 redfishtool -r <ip> -u <username> -p <password> Chassis -I <id> setAssetTag <assetTag>
436
437 # Sets all chassis's asset tags
438 redfishtool -r <ip> -u <username> -p <password> Chassis --all setAssetTag <assetTag>
439
440 # Sets the indicator LED. <state>=redfish defined values: Off, Lit, Blinking
441 redfishtool -r <ip> -u <username> -p <password> Chassis -I <id> setIndicatorLed <state>
442
443 # Sets the indicator LED on all chassis. <state>=redfish defined values: Off, Lit, Blinking
444 redfishtool -r <ip> -u <username> -p <password> Chassis --all setIndicatorLed <state>
445
446 # Gets the full chassis Power resource
447 redfishtool -r <ip> -u <username> -p <password> Chassis -I <Id> Power
448
449 # Gets the full chassis Thermal resource
450 redfishtool -r <ip> -u <username> -p <password> Chassis -I <Id> Thermal
451
452 # Gets chassis/Power powerControl[<indx>] resource if optional "consumed" arg, then return only the PowerConsumedWatts prop
453 redfishtool -r <ip> -u <username> -p <password> Chassis -I <Id> getPowerReading[-i<indx> [consumed]
454
455 # Sets the power limit
456 redfishtool -r <ip> -u <username> -p <password> Chassis -L<Url> setPowerLimit [-i<indx>] <limit> [<exception> [<correctionTime>]]
457
458 # Sets the power limit on all chassis
459 redfishtool -r <ip> -u <username> -p <password> Chassis --all setPowerLimit [-i<indx>] <limit> [<exception> [<correctionTime>]]
460
461 # Gets log member with Id=SEL from the first Chassis
462 redfishtool -r <ip> -u <username> -p <password> Chassis -1 Logs -i SEL
463
464 # Gets log entries with Id=SEL from the first Chassis
465 redfishtool -r <ip> -u <username> -p <password> Chassis -1 Logs -E -i SEL
466
467 # Gets all Sensors
468 redfishtool -r <ip> -u <username> -p <password> Chassis Sensors
469
470
471 ### Managers subcommand Examples
472
473 $ python redfishtool.py -r <ip> -u <username> -p <password> Managers examples
474 # Shows the Managers Collection
475 redfishtool -r <ip> -u <username> -p <password>
476
477 # Lists Id, Uri, AssetTag for all Managers
478 redfishtool -r <ip> -u <username> -p <password> Managers list
479
480 # Gets the Manager with Id=<d>
481 redfishtool -r <ip> -u <username> -p <password> Managers -I <id>
482
483 # Gets the Manager with AssetTag=12345
484 redfishtool -r <ip> -u <username> -p <password> Managers -M AssetTag:12345
485
486 # Gets the Manager at URI=<mgrUrl>
487 redfishtool -r <ip> -u <username> -p <password> Managers -L <mgrUrl>
488
489 # Gets the first Manager returned (for debug)
490 redfishtool -r <ip> -u <username> -p <password> Managers -F
491
492 # Gets the first Manager and verify that there is only one Manager
493 redfishtool -r <ip> -u <username> -p <password> Managers -1
494
495 # Patches the json-formated {prop: value...} data to the object
496 redfishtool -r <ip> -u <username> -p <password> Managers -I <id> patch {A: B,C: D,...}
497
498 # Resets a Manager. <resetType>=the redfish-defined values: On, Off, gracefulOff...
499 redfishtool -r <ip> -u <username> -p <password> Managers -I <id> reset <resetType>
500
501 # Gets the NetworkProtocol resource under the specified manager
502 redfishtool -r <ip> -u <username> -p <password> Managers -I <Id> NetworkProtocol
503
504 # Lists Id, Uri, and Name for all of the NICs for Manager w/ Id=<Id>
505 redfishtool -r <ip> -u <username> -p <password> Managers -I <Id> EthernetInterfaces list
506
507 # Gets the NIC with id=1 in manager with Id=<Id>
508 redfishtool -r <ip> -u <username> -p <password> Managers -I <Id> EthernetInterfaces -i 1
509
510 # Gets the NIC with MAC AA:BB:CC:DD:EE:FF for manager at url <Url>
511 redfishtool -r <ip> -u <username> -p <password> Managers -L <Url> EthernetInterfaces -m MACAddress:AA:BB:CC:DD:EE:FF
512
513 # Gets log member with Id=SEL from the first Manager
514 redfishtool -r <ip> -u <username> -p <password> Managers -1 Logs -i SEL
515
516 # Gets log entries with Id=SEL from the first Manager
517 redfishtool -r <ip> -u <username> -p <password> Managers -1 Logs -E -i SEL
518
519
520 ### AccountService subcommand Examples
521
522 $ python redfishtool.py -r <ip> -u <username> -p <password> AccountService examples
523 # Gets the AccountService
524 redfishtool -r <ip> -u <username> -p <password> AccountService
525
526 # Sets the failed login lockout threshold
527 redfishtool -r <ip> -u <username> -p <password> AccountService patch { "AccountLockoutThreshold": 5 } ]
528
529 # Gets the Accounts collection
530 redfishtool -r <ip> -u <username> -p <password> AccountService Accounts
531
532 # List Accounts to get Id, username, url for each account
533 redfishtool -r <ip> -u <username> -p <password> AccountService Accounts list
534
535 # Gets the Accounts member with username: john
536 redfishtool -r <ip> -u <username> -p <password> AccountService Accounts -m UserName:john
537
538 # Lists the Roles collection to get RoleId, IsPredefined, & url for each role
539 redfishtool -r <ip> -u <username> -p <password> AccountService Roles list
540
541 # Gets the Roles member with RoleId=Admin
542 redfishtool -r <ip> -u <username> -p <password> AccountService Roles -i Admin
543
544 # Adds the new user (john) w/ passwd "12345" and role: Admin
545 redfishtool -r <ip> -u <username> -p <password> AccountService adduser john 12345 Admin
546
547 # Deletes the account with the username "john"
548 redfishtool -r <ip> -u <username> -p <password> AccountService deleteuser john
549
550 # Disables the account with the username "john"
551 redfishtool -r <ip> -u <username> -p <password> AccountService useradmin john disable
552
553 # Unlocks the account with the username "john"
554 redfishtool -r <ip> -u <username> -p <password> AccountService useradmin john unlock
555
556 # Sets the username for account with id=3 to "alice"
557 redfishtool -r <ip> -u <username> -p <password> AccountService setusername 3 alice
558
559
560 ### SessionService subcommand Examples
561
562 $ python redfishtool.py -r <ip> -u <username> -p <password> SessionService examples
563 # Gets the sessionService
564 redfishtool -r <ip> -u <username> -p <password> SessionService
565
566 # Sets the session timeout property
567 redfishtool -r <ip> -u <username> -p <password> SessionService setSessionTimeout <timeout>
568
569 # Gets Sessions collection
570 redfishtool -r <ip> -u <username> -p <password> SessionService Sessions
571
572 # Gets the session at URI=<sessUrl>
573 redfishtool -r <ip> -u <username> -p <password> SessionService Sessions -l <sessUrl>
574
575 # Gets the session with session Id <sessId>
576 redfishtool -r <ip> -u <username> -p <password> SessionService Sessions -i <sessId>
577
578 # Patches the json-formated {prop: value...} data to the sessionService object
579 redfishtool -r <ip> -u <username> -p <password> SessionService patch {A: B,C: D,...}
580
581 # Login (create session)
582 redfishtool -r <ip> -u <username> -p <password> SessionService login -u <user> -p <password>
583
584 # Logout (delete session <sessId>)
585 redfishtool -r <ip> -u <username> -p <password> SessionService logout -i <sessionId>
586
587
588 ## Running in Windows
589
590 In order for executables to resolve if using Windows, ensure both the "Python" and "Scripts" folder are included in the PATH environment variable. For example, if Python is installed to "C:\Python", the PATH environment variable should include "C:\Python" and "C:\Python\scripts".
591
592
593 ## Known Issues, and ToDo Enhancements
594
595 1. modifications to make PATCH commands work better with Windows cmd shell quoting
596 2. support clearlog
597 3. add additional APIs that have been added to Redfish after 1.0---this version supports only 1.0 APIs
598 4. add custom role create and delete
599
600
601 ## Release Process
602
603 1. Update `CHANGELOG.md` with the list of changes since the last release
604 2. Update the `self.version` and `self.releaseDate` variables in `redfishtool/redfishtoolTransport.py` to reflect the new tool version
605 3. Update setup.py to reflect the new tool version
606 4. Push changes to Github
607 5. Create a new release in Github
608 6. Push the new tool version to pypi.org
609 * `python setup.py sdist`
610 * `twine upload dist/*`