コード例 #1
0
ファイル: endpoint.py プロジェクト: radoslawKuschel/rsd-lib
class Endpoint(base.ResourceBase):

    identity = base.Field('Id', required=True)
    """The endpoint identity string"""

    name = base.Field('Name')
    """The endpoint name"""

    description = base.Field('Description')
    """The endpoint description"""

    endpoint_protocol = base.Field('EndpointProtocol')
    """Protocol for endpoint (i.e. PCIe)"""

    connected_entities = ConnectedEntitiesField('ConnectedEntities')
    """Entities connected to endpoint"""

    identifiers = IdentifiersField('Identifiers')
    """Identifiers for endpoint"""

    status = rsd_lib_common.StatusField('Status')
    """The endpoint status"""

    pci_id = PciIdField('PciId')
    """PCI ID of the endpoint"""

    host_reservation_memory_bytes = base.Field('HostReservationMemoryBytes')
    """The amount of memory in bytes that the Host should allocate to connect
       to this endpoint
    """

    ip_transport_details = IPTransportDetailsField('IPTransportDetails')
    """IP transport details info of this endpoint"""

    links = LinksField('Links')
    """These links to related components of this endpoint"""

    oem = OemField('Oem')
    """The OEM additional info of this endpoint"""
    def __init__(self, connector, identity, redfish_version=None):
        """A class representing an Endpoint

        :param connector: A Connector instance
        :param identity: The identity of the RemoteTarget resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(Endpoint, self).__init__(connector, identity, redfish_version)

    def delete(self):
        """Delete this endpoint"""
        self._conn.delete(self.path)
コード例 #2
0
class UpdateService(base.ResourceBase):
    identity = base.Field("Id")
    """The update service identity"""

    name = base.Field("Name")
    """The update service name"""

    status = rsd_lib_common.StatusField('Status')
    """The update service name"""

    service_enabled = base.Field("ServiceEnabled", adapter=bool)
    """Whether the update service is enabled"""

    actions = ActionsField("Actions")
    """The update service actions"""

    oem = base.Field("Oem")
    """The update service oem"""

    odata_context = base.Field("@odata.context")
    """The update service odata context"""
    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a UpdateService

        :param connector: A Connector instance
        :param identity: The identity of the UpdateService resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(UpdateService, self).__init__(connector, identity,
                                            redfish_version)

    def _get_action_info_path(self):
        """Helper function to find the ActionInfo path"""
        return self.json.get("Actions").get("#UpdateService.SimpleUpdate").get(
            "@Redfish.ActionInfo")

    @property
    @utils.cache_it
    def action_info(self):
        """Property to provide reference to `ActionInfo` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return action_info.ActionInfo(self._conn,
                                      self._get_action_info_path(),
                                      redfish_version=self.redfish_version)
コード例 #3
0
ファイル: metric.py プロジェクト: radoslawKuschel/rsd-lib
class Metric(base.ResourceBase):
    identity = base.Field("Id")
    """The metric identity"""

    name = base.Field('Name')
    """The metric name"""

    description = base.Field('Description')
    """The metric description"""

    metric_properties = base.Field("MetricProperties")
    """The report definition metric properties"""

    collection_function = base.Field('CollectionFunction')
    """If present, the value shall define the function to apply over the
       collection duration
    """

    collection_duration = base.Field('CollectionDuration')
    """This property shall not be present if  MetricDefinition.Timescope=Point
       or if MetricDefintion.Duration is present.  If present, the value shall
       be an ISO 8601 duration of the interval over which this metric value
       shall be computed.
    """

    trigger_condition = TriggerConditionField("TriggerCondition")
    """If present the values define conditions that shall be met before the
       event is triggered.  This trigger applies to all properties defined by
       the value of the MetricPropertyDeclaration property in the associated
       MetricDefinition and as constrained by the MetricScope property.
    """

    status = rsd_lib_common.StatusField('Status')
    """The report definition status"""
    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a Metric

        :param connector: A Connector instance
        :param identity: The identity of the Metric resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(Metric, self).__init__(connector, identity, redfish_version)
コード例 #4
0
ファイル: trigger.py プロジェクト: radoslawKuschel/rsd-lib
class Trigger(base.ResourceBase):
    identity = base.Field("Id")
    """The trigger identity"""

    name = base.Field("Name")
    """The trigger name"""

    description = base.Field("Description")
    """The trigger description"""

    metric_type = base.Field("MetricType")
    """The type of trigger"""

    trigger_actions = base.Field("TriggerActions")
    """The metric report description"""

    numeric_triggers = NumericTriggersField("NumericTriggers")
    """List of numeric triggers"""

    discrete_trigger_condition = base.Field("DiscreteTriggerCondition")
    """The value shall indicate how the corresponding metric"""

    discrete_triggers = DiscreteTriggersField("DiscreteTriggers")
    """List of discrete triggers"""

    status = rsd_lib_common.StatusField('Status')
    """The trigger status"""

    wildcards = WildcardsField("Wildcards")
    """The property shall contain an array of wildcards and their replacements
       strings, which are to appliced to the MetricProperties array property
    """

    metric_properties = base.Field("MetricProperties")
    """The report definition metric properties"""
    def delete(self):
        """Delete trigger"""
        self._conn.delete(self.path)
コード例 #5
0
class MetricReportDefinition(base.ResourceBase):
    identity = base.Field("Id")
    """The metric report definition identity"""

    name = base.Field('Name')
    """The metric report definition name"""

    description = base.Field('Description')
    """The metric report definition description"""

    schedule = ScheduleField("Schedule")
    """If present, A metric values collected starting at each scheduled
       interval and for the time specified by Duration. No more than
       Schedule.MaxOccurrences values shall be collected for this metric. If
       not present, the corresponding metric values shall be collected when the
       related metric report is retrieved.
    """

    metric_report_type = base.Field("MetricReportType")
    """The value shall specify the collection type for the corresponding
       metric values
    """

    collection_time_scope = base.Field("CollectionTimeScope")
    """The value shall specify the time scope for collecting the corresponding
       metric values
    """

    report_actions = base.Field("ReportActions")
    """The value of this property shall specify the action to perform when the
       metric report is generated. When a metric report is generated, place the
       metric information in the resource specified by the MetricReport
       property. The Volatile property will specify the behavior if
       MetricReport resource already exists.
    """

    volatile = base.Field("Volatile")
    """Entries in the resulting metric value properties are reused on each
       scheduled interval
    """

    wildcards = WildcardsField("Wildcards")
    """The property shall contain an array of wildcards and their replacements
       strings, which are to appliced to the MetricProperties array property
    """

    status = rsd_lib_common.StatusField('Status')
    """The report definition status"""

    metric_properties = base.Field("MetricProperties")
    """The report definition metric properties"""
    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a MetricReportDefinition

        :param connector: A Connector instance
        :param identity: The identity of the MetricReportDefinition resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(MetricReportDefinition, self).__init__(connector, identity,
                                                     redfish_version)

    def _get_metrics_path(self):
        """Helper function to find the metrics path"""
        if 'Metrics' not in self.json:
            raise exceptions.MissingAttributeError(attribute='Metrics',
                                                   resource=self.path)

        return utils.get_members_identities(self.json.get('Metrics'))

    @property
    @utils.cache_it
    def metrics(self):
        """Property to provide collection to `Metric`

        It is calculated once the first time it is queried. On refresh,
        this property is reset.
        """
        return [
            metric.Metric(self._conn,
                          path,
                          redfish_version=self.redfish_version)
            for path in self._get_metrics_path()
        ]

    def _get_metric_report_path(self):
        """Helper function to find the metric report path"""
        return utils.get_sub_resource_path_by(self, 'MetricReport')

    @property
    @utils.cache_it
    def metric_report(self):
        """Property to provide reference to `MetricReport` instance

        It is calculated once the first time it is queried. On refresh,
        this property is reset.
        """
        return metric_report.MetricReport(self._conn,
                                          self._get_metric_report_path(),
                                          redfish_version=self.redfish_version)

    def delete(self):
        """Delete report definition"""
        self._conn.delete(self.path)
コード例 #6
0
ファイル: telemetry.py プロジェクト: radoslawKuschel/rsd-lib
class Telemetry(base.ResourceBase):

    max_reports = base.Field('MaxReports', adapter=rsd_lib_utils.num_or_none)
    """If present, the value shall specify the maximum number of metric
       collectors that can be supported by this service
    """

    min_collection_interval = base.Field('MinCollectionInterval')
    """If present, the value shall be an ISO 8601 duration specifying the
       minimum time between collections
    """

    supported_collection_functions = base.Field('SupportedCollectionFunctions')
    """If present, the value shall define the function to apply over the
       collection duration
    """

    status = rsd_lib_common.StatusField('Status')
    """The telemetry service status"""
    def _get_metric_definitions_path(self):
        """Helper function to find the metric definitions path"""
        return utils.get_sub_resource_path_by(self, 'MetricDefinitions')

    @property
    @utils.cache_it
    def metric_definitions(self):
        """Property to provide reference to `MetricDefinitions` instance

        It is calculated once the first time it is queried. On refresh,
        this property is reset.
        """
        return metric_definition.MetricDefinitionCollection(
            self._conn,
            self._get_metric_definitions_path(),
            redfish_version=self.redfish_version)

    def _get_metric_report_definitions_path(self):
        """Helper function to find the metric report definitions path"""
        return utils.get_sub_resource_path_by(self, 'MetricReportDefinitions')

    @property
    @utils.cache_it
    def metric_report_definitions(self):
        """Property to provide reference to `MetricReportDefinitionCollection`

        It is calculated once the first time it is queried. On refresh,
        this property is reset.
        """
        return metric_report_definition.MetricReportDefinitionCollection(
            self._conn,
            self._get_metric_definitions_path(),
            redfish_version=self.redfish_version)

    def _get_metric_reports_path(self):
        """Helper function to find the metric reports path"""
        return utils.get_sub_resource_path_by(self, 'MetricReports')

    @property
    @utils.cache_it
    def metric_reports(self):
        """Property to provide reference to `MetricReportCollection`

        It is calculated once the first time it is queried. On refresh,
        this property is reset.
        """
        return metric_report.MetricReportCollection(
            self._conn,
            self._get_metric_reports_path(),
            redfish_version=self.redfish_version)

    def _get_triggers_path(self):
        """Helper function to find the triggers path"""
        return utils.get_sub_resource_path_by(self, 'Triggers')

    @property
    @utils.cache_it
    def triggers(self):
        """Property to provide reference to `TriggerCollection`

        It is calculated once the first time it is queried. On refresh,
        this property is reset.
        """
        return trigger.TriggerCollection(self._conn,
                                         self._get_triggers_path(),
                                         redfish_version=self.redfish_version)
コード例 #7
0
class StorageService(base.ResourceBase):

    description = base.Field('Description')
    """The storage service description"""

    identity = base.Field('Id', required=True)
    """The storage service identity string"""

    name = base.Field('Name')
    """The storage service name"""

    status = rsd_lib_common.StatusField('Status')
    """The storage service status"""

    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a StorageService

        :param connector: A Connector instance
        :param identity: The identity of the StorageService resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(StorageService, self).__init__(connector, identity,
                                             redfish_version)

    def _get_volume_collection_path(self):
        """Helper function to find the VolumeCollection path"""
        return utils.get_sub_resource_path_by(self, 'Volumes')

    @property
    @utils.cache_it
    def volumes(self):
        """Property to provide reference to `VolumeCollection` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return volume.VolumeCollection(
            self._conn, self._get_volume_collection_path(),
            redfish_version=self.redfish_version)

    def _get_storage_pool_collection_path(self):
        """Helper function to find the StoragePoolCollection path"""
        return utils.get_sub_resource_path_by(self, 'StoragePools')

    @property
    @utils.cache_it
    def storage_pools(self):
        """Property to provide reference to `StoragePoolCollection` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return storage_pool.StoragePoolCollection(
            self._conn, self._get_storage_pool_collection_path(),
            redfish_version=self.redfish_version)

    def _get_drive_collection_path(self):
        """Helper function to find the DriveCollection path"""
        return utils.get_sub_resource_path_by(self, 'Drives')

    @property
    @utils.cache_it
    def drives(self):
        """Property to provide reference to `DriveCollection` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return drive.DriveCollection(
            self._conn, self._get_drive_collection_path(),
            redfish_version=self.redfish_version)

    def _get_endpoint_collection_path(self):
        """Helper function to find the EndpointCollection path"""
        return utils.get_sub_resource_path_by(self, 'Endpoints')

    @property
    @utils.cache_it
    def endpoints(self):
        """Property to provide reference to `EndpointCollection` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return endpoint.EndpointCollection(
            self._conn, self._get_endpoint_collection_path(),
            redfish_version=self.redfish_version)
コード例 #8
0
class StoragePool(base.ResourceBase):

    identity = base.Field('Id', required=True)
    """The storage pool  identity string"""

    description = base.Field('Description')
    """The storage pool  description string"""

    name = base.Field('Name')
    """The storage pool  name string"""

    status = rsd_lib_common.StatusField('Status')
    """The storage pool  status"""

    capacity = CapacityField('Capacity')
    """The storage pool capacity info"""

    capacity_sources = CapacitySourcesField('CapacitySources')
    """The storage pool capacity source info"""

    identifier = IdentifierField('Identifier')
    """These identifiers list of this volume"""
    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a LogicalDrive

        :param connector: A Connector instance
        :param identity: The identity of the LogicalDrive resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(StoragePool, self).__init__(connector, identity, redfish_version)

    def _get_allocated_volumes_path(self):
        """Helper function to find the AllocatedVolumes path"""
        return utils.get_sub_resource_path_by(self, 'AllocatedVolumes')

    @property
    @utils.cache_it
    def allocated_volumes(self):
        """Property to provide reference to `AllocatedVolumes` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return volume.VolumeCollection(self._conn,
                                       self._get_allocated_volumes_path(),
                                       redfish_version=self.redfish_version)

    def _get_allocated_pools_path(self):
        """Helper function to find the AllocatedPools path"""
        return utils.get_sub_resource_path_by(self, 'AllocatedPools')

    @property
    @utils.cache_it
    def allocated_pools(self):
        """Property to provide reference to `AllocatedPools` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return StoragePoolCollection(self._conn,
                                     self._get_allocated_pools_path(),
                                     redfish_version=self.redfish_version)
コード例 #9
0
class Drive(base.ResourceBase):

    identity = base.Field('Id', required=True)
    """The drive identity string"""

    name = base.Field('Name')
    """The drive name string"""

    protocol = base.Field('Protocol')
    """The protocol of this drive"""

    drive_type = base.Field('Type')
    """The protocol of this drive"""

    media_type = base.Field('MediaType')
    """The media type of this drive"""

    capacity_bytes = base.Field('CapacityBytes',
                                adapter=rsd_lib_utils.num_or_none)
    """The capacity in Bytes of this drive"""

    manufacturer = base.Field('Manufacturer')
    """The manufacturer of this drive"""

    model = base.Field('Model')
    """The drive model"""

    revision = base.Field('Revision')
    """The revision of this drive"""

    sku = base.Field('SKU')
    """The sku of this drive"""

    serial_number = base.Field('SerialNumber')
    """The serial number of this drive"""

    part_number = base.Field('PartNumber')
    """The part number of this drive"""

    asset_tag = base.Field('AssetTag')
    """The asset tag of this drive"""

    rotation_speed_rpm = base.Field('RotationSpeedRPM')
    """The rotation speed of this drive"""

    identifiers = IdentifiersField('Identifiers')
    """These identifiers list of this drive"""

    location = LocationField('Location')
    """The location of this drive"""

    status = rsd_lib_common.StatusField('Status')
    """The drive status"""

    oem = OemField('Oem')
    """The OEM additional info of this drive"""

    status_indicator = base.Field('StatusIndicator')
    """The status indicator state for the status indicator associated
       with this drive"""

    indicator_led = base.Field('IndicatorLED')
    """The indicator light state for the indicator light associated
       with the drive"""

    capable_speed_gbs = base.Field('CapableSpeedGbs')
    """The current bus speed of the associated drive"""

    negotiated_speed_gbs = base.Field('NegotiatedSpeedGbs')
    """The current bus speed of the associated drive"""

    predicted_media_life_left_percent = base.Field(
        'PredictedMediaLifeLeftPercent')
    """An indicator of the percentage of life remaining in the drive's media"""

    links = LinksField('Links')
    """These links to related components of this volume"""

    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a Volume

        :param connector: A Connector instance
        :param identity: The identity of the Volume resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(Drive, self).__init__(connector, identity, redfish_version)

    def _get_metrics_path(self):
        """Helper function to find the Metrics path"""
        return utils.get_sub_resource_path_by(self,
                                              ['Links',
                                               'Oem',
                                               'Intel_RackScale',
                                               'Metrics'])

    @property
    @utils.cache_it
    def metrics(self):
        """Property to provide reference to `Metrics` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return drive_metrics.DriveMetrics(
            self._conn, self._get_metrics_path(),
            redfish_version=self.redfish_version)
コード例 #10
0
class Endpoint(base.ResourceBase):

    connected_entities = ConnectedEntitiesField('ConnectedEntities')
    """Entities connected to endpoint"""

    description = base.Field('Description')
    """The endpoint description"""

    protocol = base.Field('EndpointProtocol')
    """Protocol for endpoint (i.e. PCIe)"""

    identifiers = IdentifiersField('Identifiers')
    """Identifiers for endpoint"""

    identity = base.Field('Id', required=True)
    """The endpoint identity string"""

    name = base.Field('Name')
    """The endpoint name"""

    status = rsd_lib_common.StatusField('Status')
    """The endpoint status"""

    links = LinksField('Links')
    """These links to related components of this endpoint"""

    ip_transport_details = IPTransportDetailsField('IPTransportDetails')
    """IP transport details info of this endpoint"""

    oem = OemField('Oem')
    """The OEM additional info of this endpoint"""
    def __init__(self, connector, identity, redfish_version=None):
        """A class representing an Endpoint

        :param connector: A Connector instance
        :param identity: The identity of the RemoteTarget resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(Endpoint, self).__init__(connector, identity, redfish_version)

    def update_authentication(self, username=None, password=None):
        """Update endpoint authentication

        :param username: an endpoint username used to authenticate it on the
                         other side of a communication channel
        :param password: an endpoint password
        :raises: BadRequestError if at least one param isn't specified
        """
        if username is None and password is None:
            raise ValueError('At least "username" or "password" parameter has '
                             'to be specified')

        data = {
            "Oem": {
                "Intel_RackScale": {
                    "@odata.type": "#Intel.Oem.Endpoint",
                    "Authentication": {}
                }
            }
        }
        if username is not None:
            data['Oem']['Intel_RackScale']['Authentication']['Username'] = \
                username
        if password is not None:
            data['Oem']['Intel_RackScale']['Authentication']['Password'] = \
                password

        self._conn.patch(self.path, data=data)

    def delete(self):
        """Delete this endpoint"""
        self._conn.delete(self.path)
コード例 #11
0
class Volume(base.ResourceBase):

    identity = base.Field('Id', required=True)
    """The volume identity string"""

    description = base.Field('Description')
    """The volume description string"""

    name = base.Field('Name')
    """The volume name string"""

    model = base.Field('Model')
    """The volume model"""

    manufacturer = base.Field('Manufacturer')
    """The volume manufacturer"""

    access_capabilities = base.Field('AccessCapabilities')
    """The access capabilities of volume"""

    capacity_bytes = base.Field('CapacityBytes',
                                adapter=rsd_lib_utils.num_or_none)
    """The capacity of volume in bytes"""

    allocated_Bytes = base.Field(['Capacity', 'Data', 'AllocatedBytes'],
                                 adapter=rsd_lib_utils.num_or_none)
    """The allocated capacity of volume in bytes"""

    capacity_sources = CapacitySourcesField('CapacitySources')
    """The logical drive status"""

    identifiers = IdentifiersField('Identifiers')
    """These identifiers list of this volume"""

    links = LinksField('Links')
    """These links to related components of this volume"""

    replica_infos = ReplicaInfosField('ReplicaInfos')
    """These replica related info of this volume"""

    status = rsd_lib_common.StatusField('Status')
    """The volume status"""

    bootable = base.Field(['Oem', 'Intel_RackScale', 'Bootable'], adapter=bool)
    """The bootable info of this volume"""

    erased = base.Field(['Oem', 'Intel_RackScale', 'Erased'])
    """The erased info of this volume"""

    erase_on_detach = base.Field(['Oem', 'Intel_RackScale', 'EraseOnDetach'],
                                 adapter=bool)
    """The rrase on detach info of this volume"""

    _actions = VolumeActionsField('Actions', required=True)

    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a Volume

        :param connector: A Connector instance
        :param identity: The identity of the Volume resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(Volume, self).__init__(connector, identity, redfish_version)

    def update(self, bootable=None, erased=None):
        """Update volume properties

        :param bootable: Change bootable ability of the volume
        :param erased: Provide information if the drive was erased
        :raises: BadRequestError if at least one param isn't specified
        """
        if bootable is None and erased is None:
            raise ValueError('At least "bootable" or "erased" parameter has '
                             'to be specified')

        if bootable and not isinstance(bootable, bool):
            raise exceptions.InvalidParameterValueError(
                parameter='bootable', value=bootable,
                valid_values=[True, False])

        if erased and not isinstance(erased, bool):
            raise exceptions.InvalidParameterValueError(
                parameter='erased', value=erased,
                valid_values=[True, False])

        data = {'Oem': {'Intel_RackScale': {}}}
        if bootable is not None:
            data['Oem']['Intel_RackScale']['Bootable'] = bootable
        if erased is not None:
            data['Oem']['Intel_RackScale']['Erased'] = erased

        self._conn.patch(self.path, data=data)

    def _get_initialize_action_element(self):
        initialize_action = self._actions.initialize
        if not initialize_action:
            raise exceptions.MissingActionError(
                action='#Volume.Initialize',
                resource=self._path)
        return initialize_action

    def initialize(self, init_type):
        """Change initialize type of this volume

        :param type: volume initialize type
        :raises: InvalidParameterValueError if invalid "type" parameter
        """
        allowed_init_type_values = ['Fast', 'Slow']
        if init_type not in allowed_init_type_values:
            raise exceptions.InvalidParameterValueError(
                parameter='init_type', value=init_type,
                valid_values=allowed_init_type_values)

        data = {"InitializeType": init_type}

        target_uri = self._get_initialize_action_element().target_uri
        self._conn.post(target_uri, data=data)

    def delete(self):
        """Delete this volume"""
        self._conn.delete(self.path)

    def _get_metrics_path(self):
        """Helper function to find the Metrics path"""
        return utils.get_sub_resource_path_by(self,
                                              ['Links',
                                               'Oem',
                                               'Intel_RackScale',
                                               'Metrics'])

    @property
    @utils.cache_it
    def metrics(self):
        """Property to provide reference to `Metrics` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return volume_metrics.VolumeMetrics(
            self._conn, self._get_metrics_path(),
            redfish_version=self.redfish_version)
コード例 #12
0
class Fabric(base.ResourceBase):

    description = base.Field('Description')
    """The fabric description"""

    fabric_type = base.Field('FabricType')
    """The fabric type"""

    identity = base.Field('Id', required=True)
    """The fabric identity string"""

    max_zones = base.Field('MaxZones')
    """Maximum number of zones for the fabric"""

    name = base.Field('Name')
    """The fabric name"""

    status = rsd_lib_common.StatusField('Status')

    def __init__(self, connector, identity, redfish_version=None):
        """A class representing a Fabric

        :param connector: A Connector instance
        :param identity: The identity of the Fabric resource
        :param redfish_version: The version of RedFish. Used to construct
            the object according to schema of the given version.
        """
        super(Fabric, self).__init__(connector, identity,
                                     redfish_version)

    def _get_endpoint_collection_path(self):
        """Helper function to find the EndpointCollection path"""
        return utils.get_sub_resource_path_by(self, 'Endpoints')

    @property
    @utils.cache_it
    def endpoints(self):
        """Property to provide reference to `EndpointCollection` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return endpoint.EndpointCollection(
            self._conn, self._get_endpoint_collection_path(),
            redfish_version=self.redfish_version)

    def _get_zone_collection_path(self):
        """Helper function to find the ZoneCollection path"""
        return utils.get_sub_resource_path_by(self, 'Zones')

    @property
    @utils.cache_it
    def zones(self):
        """Property to provide reference to `ZoneCollection` instance

        It is calculated once when it is queried for the first time. On
        refresh, this property is reset.
        """
        return zone.ZoneCollection(
            self._conn, self._get_zone_collection_path(),
            redfish_version=self.redfish_version)