コード例 #1
0
    def get_chassis(self, identity):
        """Given the identity return a Chassis object

        :param identity: The identity of the Chassis resource
        :returns: The Chassis object
        """
        return chassis.Chassis(self._conn, identity,
                               redfish_version=self.redfish_version)
コード例 #2
0
    def setUp(self):
        super(ChassisTestCase, self).setUp()
        self.conn = mock.Mock()
        with open('sushy/tests/unit/json_samples/chassis.json') as f:
            self.conn.get.return_value.json.return_value = json.load(f)

        self.chassis = chassis.Chassis(self.conn,
                                       '/redfish/v1/Chassis/Blade1',
                                       redfish_version='1.8.0')
コード例 #3
0
ファイル: system.py プロジェクト: nikitaomare/sushy
    def chassis(self):
        """A list of chassis where this system resides.

        Returns a list of `Chassis` objects representing the chassis
        or cabinets where this system is mounted.

        :raises: MissingAttributeError if '@odata.id' field is missing.
        :returns: A list of `Chassis` instances
        """
        paths = utils.get_sub_resource_path_by(
            self, ["Links", "Chassis"], is_collection=True)

        return [chassis.Chassis(self._conn, path,
                                redfish_version=self.redfish_version)
                for path in paths]
コード例 #4
0
    def chassis(self):
        """A list of chassis managed by this manager.

        Returns a list of `Chassis` objects representing the chassis
        or cabinets managed by this manager.

        :raises: MissingAttributeError if '@odata.id' field is missing.
        :returns: A list of `Chassis` instances
        """
        paths = utils.get_sub_resource_path_by(self,
                                               ["Links", "ManagerForChassis"],
                                               is_collection=True)

        from sushy.resources.chassis import chassis
        return [
            chassis.Chassis(self._conn, path, self.redfish_version,
                            self.registries) for path in paths
        ]
コード例 #5
0
ファイル: main.py プロジェクト: inmotionhosting/sushy
    def get_chassis(self, identity=None):
        """Given the identity return a Chassis object

        :param identity: The identity of the Chassis resource. If not given,
            sushy will default to the single available chassis or fail
            if there appear to be more or less then one Chassis listed.
        :raises: `UnknownDefaultError` if default system can't be determined.
        :returns: The Chassis object
        """
        if identity is None:
            chassis_collection = self.get_chassis_collection()
            listed_chassis = chassis_collection.get_members()
            if len(listed_chassis) != 1:
                raise exceptions.UnknownDefaultError(
                    entity='Chassis', error='Chassis count is not exactly one')

            identity = listed_chassis[0].path

        return chassis.Chassis(self._conn,
                               identity,
                               redfish_version=self.redfish_version,
                               registries=self.lazy_registries)