How to use the redfish.rest.v1.redfish_client function in redfish

To help you get started, we’ve selected a few redfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DMTF / python-redfish-library / tests / rest / test_v1.py View on Github external
def test_redfish_client(self):
        base_url = "http://foo.bar"
        username = "rstallman"
        password = "123456"
        default_prefix = "/custom/redfish/v1/"
        sessionkey = "fg687glgkf56vlgkf"
        capath = "/path/to/the/dir"
        cafile = "filename.test"
        timeout = 666
        max_retry = 42
        # NOTE(hberaud) the client try to connect when we initialize the
        # http client object so we need to catch the retries exception first.
        # In a second time we need to mock the six.http_client to simulate
        # server responses and do some other tests
        with self.assertRaises(RetriesExhaustedError):
            client = redfish_client(base_url=base_url)
            # Check the object type
            self.assertTrue(isinstance(client, HttpClient))
            # Check the object attributes values.
            # Here we check if the client object is properly initialized
            self.assertEqual(client.base_url, base_url)
            self.assertEqual(client.username, username)
            self.assertEqual(client.password, password)
            self.assertEqual(client.default_prefix, default_prefix)
            self.assertEqual(client.sessionkey, sessionkey)
            self.assertEqual(client.capath, capath)
            self.assertEqual(client.cafile, cafile)
            self.assertEqual(client.timeout, timeout)
            self.assertEqual(client.max_retry, max_retry)
github DMTF / python-redfish-library / src / redfish / ris / rmc_helper.py View on Github external
def __init__(self, url=None, username=None, password=None, sessionkey=None):
        """Initialized RmcClient
        :param url: redfish host name or IP address.
        :type url: str.
        :param username: user name required to login to server.
        :type: str.
        :param password: password credentials required to login.
        :type password: str.
        :param sessionkey: session key credential for current login
        :type sessionkey: str

        """
        self._rest_client = redfish.rest.v1.redfish_client(base_url=url, \
                   username=username, password=password, sessionkey=sessionkey)

        self._get_cache = dict()
        self._monolith = RisMonolith(self)
        self._selector = None
        self._filter_attr = None
        self._filter_value = None
github HewlettPackard / python-ilorest-library-old / src / redfish / ris / rmc_helper.py View on Github external
:type: str.
        :param password: password credentials required to login.
        :type password: str.
        :param sessionkey: session key credential for current login
        :type sessionkey: str
        :param typepath: path to be used for client.
        :type typepath: str.
        :param biospassword: BIOS password for the server if set.
        :type biospassword: str.
        :param is_redfish: If True, a Redfish specific header (OData) will be
            added to every request.
        :type is_redfish: boolean.

        """
        if is_redfish:
            self._rest_client = redfish.rest.v1.redfish_client(base_url=url, \
                           username=username, password=password, \
                           sessionkey=sessionkey, biospassword=biospassword, \
                           is_redfish=is_redfish)
        else:
            self._rest_client = redfish.rest.v1.rest_client(base_url=url, \
                            username=username, password=password, \
                            sessionkey=sessionkey, biospassword=biospassword, \
                            is_redfish=is_redfish)

        self.typepath = typepath
        self._get_cache = dict()
        self._monolith = RisMonolith(self)
        self._selector = None
        self._filter_attr = None
        self._filter_value = None