George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | r""" |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 4 | See class prolog below for details. |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 5 | """ |
| 6 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 7 | from redfish_plus import redfish_plus |
George Keishing | 2296e8c | 2019-02-01 05:49:58 -0600 | [diff] [blame] | 8 | from robot.libraries.BuiltIn import BuiltIn |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 9 | |
| 10 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 11 | class bmc_redfish(redfish_plus): |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 12 | r""" |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 13 | bmc_redfish is a child class of redfish_plus that is designed to provide |
| 14 | benefits specifically for using redfish to communicate with an OpenBMC. |
| 15 | |
| 16 | See the prologs of the methods below for details. |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 17 | """ |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 18 | |
| 19 | def login(self, *args, **kwargs): |
| 20 | r""" |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 21 | Assign BMC default values for username, password and auth arguments |
| 22 | and call parent class login method. |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 23 | |
| 24 | Description of argument(s): |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 25 | args See parent class prolog for details. |
| 26 | kwargs See parent class prolog for details. |
George Keishing | e62d8b0 | 2018-11-29 12:01:56 -0600 | [diff] [blame] | 27 | """ |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 28 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 29 | args = list(args) |
| 30 | # Assign default values for username, password, auth where necessary. |
| 31 | username = args.pop(0) if args else \ |
| 32 | kwargs.pop('username', |
| 33 | BuiltIn().get_variable_value("${OPENBMC_USERNAME}")) |
| 34 | password = args.pop(0) if args else \ |
| 35 | kwargs.pop('password', |
| 36 | BuiltIn().get_variable_value("${OPENBMC_PASSWORD}")) |
| 37 | auth = args.pop(0) if args else kwargs.pop('auth', 'session') |
George Keishing | 4c39401 | 2019-02-01 06:03:02 -0600 | [diff] [blame] | 38 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 39 | super(redfish_plus, self).login(username, password, auth, |
| 40 | *args, **kwargs) |