blob: fad445e556a9eda2932b0884172a158857ac7964 [file] [log] [blame]
George Keishinge62d8b02018-11-29 12:01:56 -06001#!/usr/bin/env python
2
3r"""
George Keishing97c93942019-03-04 12:45:07 -06004See class prolog below for details.
George Keishinge62d8b02018-11-29 12:01:56 -06005"""
6
George Keishing97c93942019-03-04 12:45:07 -06007from redfish_plus import redfish_plus
George Keishing2296e8c2019-02-01 05:49:58 -06008from robot.libraries.BuiltIn import BuiltIn
George Keishinge62d8b02018-11-29 12:01:56 -06009
10
George Keishing97c93942019-03-04 12:45:07 -060011class bmc_redfish(redfish_plus):
George Keishinge62d8b02018-11-29 12:01:56 -060012 r"""
George Keishing97c93942019-03-04 12:45:07 -060013 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 Keishinge62d8b02018-11-29 12:01:56 -060017 """
George Keishinge62d8b02018-11-29 12:01:56 -060018
19 def login(self, *args, **kwargs):
20 r"""
George Keishing97c93942019-03-04 12:45:07 -060021 Assign BMC default values for username, password and auth arguments
22 and call parent class login method.
George Keishinge62d8b02018-11-29 12:01:56 -060023
24 Description of argument(s):
George Keishing97c93942019-03-04 12:45:07 -060025 args See parent class prolog for details.
26 kwargs See parent class prolog for details.
George Keishinge62d8b02018-11-29 12:01:56 -060027 """
George Keishing4c394012019-02-01 06:03:02 -060028
George Keishing97c93942019-03-04 12:45:07 -060029 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 Keishing4c394012019-02-01 06:03:02 -060038
George Keishing97c93942019-03-04 12:45:07 -060039 super(redfish_plus, self).login(username, password, auth,
40 *args, **kwargs)