How to use the redfish.rest 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 HewlettPackard / python-ilorest-library-old / src / redfish / ris / rmc_helper.py View on Github external
if u'filter_attr' in client:
                        rmc_client.filter_attr = client['filter_attr']

                    if u'filter_value' in client:
                        rmc_client.filter_value = client['filter_value']

                    getdata = client['get']
                    rmc_client._get_cache = dict()

                    for key in getdata.keys():
                        restreq = redfish.rest.v1.RestRequest(\
                                                        method='GET', path=key)

                        getdata[key]['restreq'] = restreq
                        rmc_client._get_cache[key] = (\
                                  redfish.rest.v1.StaticRestResponse(\
                                                                **getdata[key]))

                    rmc_client._monolith = RisMonolith(rmc_client)
                    rmc_client._monolith.load_from_dict(client['monolith'])
                    self._rmc._rmc_clients.append(rmc_client)
            except BaseException, excp:
                self._rmc.warn(u'Unable to read cache data %s' % excp)
github DMTF / python-redfish-utility / src / rdmc.py View on Github external
except redfish.ris.NothingSelectedSetError as excp:
            self.retcode = ReturnCodes.RIS_NOTHING_SELECTED_SET_ERROR
            UI().nothing_selected_set()
        except redfish.ris.InvalidSelectionError as excp:
            self.retcode = ReturnCodes.RIS_INVALID_SELECTION_ERROR
            UI().error(excp)
        except redfish.ris.rmc_helper.SessionExpired as excp:
            self.retcode = ReturnCodes.RIS_SESSION_EXPIRED
            self.app.logout()
            UI().printmsg(u"Current session has expired or is invalid, "\
                    "please login again with proper credentials to continue.\n")
        # ****** RMC/RIS ERRORS ******
        except redfish.rest.v1.RetriesExhaustedError as excp:
            self.retcode = ReturnCodes.V1_RETRIES_EXHAUSTED_ERROR
            UI().retries_exhausted_attemps()
        except redfish.rest.v1.InvalidCredentialsError as excp:
            self.retcode = ReturnCodes.V1_INVALID_CREDENTIALS_ERROR
            UI().invalid_credentials(excp)
        except redfish.rest.v1.ServerDownOrUnreachableError as excp:
            self.retcode = \
                    ReturnCodes.V1_SERVER_DOWN_OR_UNREACHABLE_ERROR
            UI().error(excp)
        except redfish.ris.rmc_helper.InvalidPathError as excp:
            self.retcode = ReturnCodes.RIS_REF_PATH_NOT_FOUND_ERROR
            UI().printmsg(u"Reference path not found.")
        # ****** GENERAL ERRORS ******
        except SystemExit:
            self.retcode = ReturnCodes.GENERAL_ERROR
            raise
        except Exception as excp:
            self.retcode = ReturnCodes.GENERAL_ERROR
            sys.stderr.write(u'ERROR: %s\n' % excp)
github HewlettPackard / python-ilorest-library-old / src / redfish / ris / ris.py View on Github external
def load_from_dict(self, src):
        """Load variables from dict monolith

        :param src: source to load from
        :type src: dict

        """
        if u'Type' in src:
            self._type = src[u'Type']
            restreq = redfish.rest.v1.RestRequest(method='GET', \
                                                    path=src[u'OriginalUri'])

            src['restreq'] = restreq
            self._resp = redfish.rest.v1.StaticRestResponse(**src)
            self._patches = src[u'Patches']
github DMTF / python-redfish-library / src / redfish / ris / ris.py View on Github external
def load_from_dict(self, src):
        """Load variables from dict monolith"""
        """

        :param src: source to load from
        :type src: dict

        """
        if "Type" in src:
            self._type = src["Type"]
            restreq = redfish.rest.v1.RestRequest(method="GET",
                                                  path=src["OriginalUri"])

            src["restreq"] = restreq
            self._resp = redfish.rest.v1.StaticRestResponse(**src)
            self._patches = src["Patches"]
github DMTF / python-redfish-library / src / redfish / ris / rmc_helper.py View on Github external
login_data.get('session_location'))

                    if 'selector' in client:
                        rmc_client.selector = client['selector']

                    if 'filter_attr' in client:
                        rmc_client.filter_attr = client['filter_attr']

                    if 'filter_value' in client:
                        rmc_client.filter_value = client['filter_value']

                    getdata = client['get']
                    rmc_client._get_cache = dict()

                    for key in list(getdata.keys()):
                        restreq = redfish.rest.v1.RestRequest(\
                                                        method='GET', path=key)

                        getdata[key]['restreq'] = restreq
                        rmc_client._get_cache[key] = (\
                                  redfish.rest.v1.StaticRestResponse(\
                                                                **getdata[key]))

                    rmc_client._monolith = RisMonolith(rmc_client)
                    rmc_client._monolith.load_from_dict(client['monolith'])
                    self._rmc._rmc_clients.append(rmc_client)
            except BaseException as excp:
                self._rmc.warn('Unable to read cache data %s' % excp)
github HewlettPackard / python-ilorest-library-old / src / redfish / ris / ris.py View on Github external
def load_from_dict(self, src):
        """Load variables from dict monolith

        :param src: source to load from
        :type src: dict

        """
        if u'Type' in src:
            self._type = src[u'Type']
            restreq = redfish.rest.v1.RestRequest(method='GET', \
                                                    path=src[u'OriginalUri'])

            src['restreq'] = restreq
            self._resp = redfish.rest.v1.StaticRestResponse(**src)
            self._patches = src[u'Patches']
github DMTF / python-redfish-library / src / redfish / ris / ris.py View on Github external
def load_from_dict(self, src):
        """Load variables from dict monolith"""
        """

        :param src: source to load from
        :type src: dict

        """
        if "Type" in src:
            self._type = src["Type"]
            restreq = redfish.rest.v1.RestRequest(method="GET",
                                                  path=src["OriginalUri"])

            src["restreq"] = restreq
            self._resp = redfish.rest.v1.StaticRestResponse(**src)
            self._patches = src["Patches"]