1#!/usr/bin/env python
2
3r"""
4See class prolog below for details.
5"""
6
7from redfish_plus import redfish_plus
8from robot.libraries.BuiltIn import BuiltIn
9
10
11class bmc_redfish(redfish_plus):
12    r"""
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.
17    """
18
19    def login(self, *args, **kwargs):
20        r"""
21        Assign BMC default values for username, password and auth arguments
22        and call parent class login method.
23
24        Description of argument(s):
25        args                        See parent class prolog for details.
26        kwargs                      See parent class prolog for details.
27        """
28
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')
38
39        super(redfish_plus, self).login(username, password, auth,
40                                        *args, **kwargs)
41