Exemple #1
0
class Storage(rsd_lib_base.ResourceBase):
    """Storage resource class

       This schema defines a storage subsystem and its respective properties.
       A storage subsystem represents a set of storage controllers (physical
       or virtual) and the resources such as volumes that can be accessed from
       that subsystem.
    """

    links = LinksField("Links")
    """Contains references to other resources that are related to this
       resource.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    storage_controllers = StorageControllerCollectionField(
        "StorageControllers")
    """The set of storage controllers represented by this resource."""

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """Redundancy information for the storage subsystem"""

    # TODO(linyang): Add Action Field

    @property
    @utils.cache_it
    def drives(self):
        """Property to provide a list of `Drive` instance

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return [
            drive.Drive(self._conn, path, redfish_version=self.redfish_version)
            for path in rsd_lib_utils.get_sub_resource_path_list_by(
                self, "Drives")
        ]

    @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,
            utils.get_sub_resource_path_by(self, "Volumes"),
            redfish_version=self.redfish_version,
        )
Exemple #2
0
class Thermal(rsd_lib_base.ResourceBase):
    """Thermal resource class

       This is the schema definition for the Thermal properties.  It
       represents the properties for Temperature and Cooling.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    temperatures = TemperatureCollectionField("Temperatures")
    """This is the definition for temperature sensors."""

    fans = FanCollectionField("Fans")
    """This is the definition for fans."""

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """This structure is used to show redundancy for fans.  The Component ids
Exemple #3
0
class Power(rsd_lib_base.ResourceBase):
    """Power resource class

       This is the schema definition for the Power Metrics.  It represents the
       properties for Power Consumption and Power Limiting.
    """

    power_control = PowerControlCollectionField("PowerControl")
    """This is the definition for power control function (power
       reading/limiting).
    """

    voltages = VoltageCollectionField("Voltages")
    """This is the definition for voltage sensors."""

    power_supplies = PowerSupplyCollectionField("PowerSupplies")
    """Details of the power supplies associated with this system or device"""

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """Redundancy information for the power subsystem of this system or device
Exemple #4
0
class Endpoint(rsd_lib_base.ResourceBase):
    """Endpoint resource class

       This is the schema definition for the Endpoint resource. It represents
       the properties of an entity that sends or receives protocol defined
       messages over a transport.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    endpoint_protocol = base.Field("EndpointProtocol")
    """The protocol supported by this endpoint."""

    connected_entities = ConnectedEntityCollectionField("ConnectedEntities")
    """All the entities connected to this endpoint."""

    identifiers = rsd_lib_base.IdentifierCollectionField("Identifiers")
    """Identifiers for this endpoint"""

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

    host_reservation_memory_bytes = base.Field(
        "HostReservationMemoryBytes", adapter=rsd_lib_utils.num_or_none)
    """The amount of memory in Bytes that the Host should allocate to connect
       to this endpoint.
    """

    links = LinksField("Links")
    """The links object contains the links to other resources that are related
       to this resource.
    """

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """Redundancy information for the lower level endpoints supporting this
Exemple #5
0
class Switch(rsd_lib_base.ResourceBase):
    """Switch resource class

       Switch contains properties describing a simple fabric switch.
    """

    switch_type = base.Field("SwitchType")
    """The protocol being sent over this switch."""

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    manufacturer = base.Field("Manufacturer")
    """This is the manufacturer of this switch."""

    model = base.Field("Model")
    """The product model number of this switch."""

    sku = base.Field("SKU")
    """This is the SKU for this switch."""

    serial_number = base.Field("SerialNumber")
    """The serial number for this switch."""

    part_number = base.Field("PartNumber")
    """The part number for this switch."""

    asset_tag = base.Field("AssetTag")
    """The user assigned asset tag for this switch."""

    domain_id = base.Field("DomainID", adapter=rsd_lib_utils.num_or_none)
    """The Domain ID for this switch."""

    is_managed = base.Field("IsManaged", adapter=bool)
    """This indicates whether the switch is in a managed or unmanaged state."""

    total_switch_width = base.Field("TotalSwitchWidth",
                                    adapter=rsd_lib_utils.num_or_none)
    """The total number of lanes, phys, or other physical transport links that
       this switch contains.
    """

    indicator_led = base.Field("IndicatorLED")
    """The state of the indicator LED, used to identify the switch."""

    power_state = base.Field("PowerState")
    """This is the current power state of the switch."""

    links = LinksField("Links")
    """Contains references to other resources that are related to this
       resource.
    """

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """Redundancy information for the switches"""

    actions = ActionsField("Actions")
    """The switch actions"""
    def _get_reset_action_element(self):
        reset_action = self.actions.reset
        if not reset_action:
            raise exceptions.MissingActionError(action="#Switch.Reset",
                                                resource=self._path)
        return reset_action

    def get_allowed_reset_switch_values(self):
        """Get the allowed values for resetting the switch.

        :returns: A set with the allowed values.
        """
        reset_action = self._get_reset_action_element()

        return reset_action.allowed_values

    def reset_switch(self, value):
        """Reset the switch.

        :param value: The target value.
        :raises: InvalidParameterValueError, if the target value is not
            allowed.
        """
        valid_resets = self.get_allowed_reset_switch_values()
        if value not in valid_resets:
            raise exceptions.InvalidParameterValueError(
                parameter="value", value=value, valid_values=valid_resets)

        target_uri = self._get_reset_action_element().target_uri

        self._conn.post(target_uri, data={"ResetType": value})

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return port.PortCollection(
            self._conn,
            utils.get_sub_resource_path_by(self, "Ports"),
            redfish_version=self.redfish_version,
        )

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return log_service.LogServiceCollection(
            self._conn,
            utils.get_sub_resource_path_by(self, "LogServices"),
            redfish_version=self.redfish_version,
        )
Exemple #6
0
class Manager(rsd_lib_base.ResourceBase):
    """Manager resource class

       This is the schema definition for a Manager.  Examples of managers are
       BMCs, Enclosure Managers, Management Controllers and other subsystems
       assigned managability functions.
    """

    manager_type = base.Field("ManagerType")
    """This property represents the type of manager that this resource
       represents.
    """

    links = LinksField("Links")
    """Contains references to other resources that are related to this
       resource.
    """

    service_entry_point_uuid = base.Field("ServiceEntryPointUUID")
    """The UUID of the Redfish Service provided by this manager"""

    uuid = base.Field("UUID")
    """The Universal Unique Identifier (UUID) for this Manager"""

    model = base.Field("Model")
    """The model information of this Manager as defined by the manufacturer"""

    date_time = base.Field("DateTime")
    """The current DateTime (with offset) for the manager, used to set or read
       time.
    """

    date_time_local_offset = base.Field("DateTimeLocalOffset")
    """The time offset from UTC that the DateTime property is set to in
       format: +06:00 .
    """

    firmware_version = base.Field("FirmwareVersion")
    """The firmware version of this Manager"""

    serial_console = SerialConsoleField("SerialConsole")
    """Information about the Serial Console service provided by this manager.
    """

    command_shell = CommandShellField("CommandShell")
    """Information about the Command Shell service provided by this manager."""

    graphical_console = GraphicalConsoleField("GraphicalConsole")
    """The value of this property shall contain the information about the
       Graphical Console (KVM-IP) service of this manager.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """Redundancy information for the managers of this system"""

    power_state = base.Field("PowerState")
    """This is the current power state of the Manager."""

    # TODO(linyang): Add Action Field

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return ethernet_interface.EthernetInterfaceCollection(
            self._conn,
            utils.get_sub_resource_path_by(self, "EthernetInterfaces"),
            redfish_version=self.redfish_version,
        )

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return serial_interface.SerialInterfaceCollection(
            self._conn,
            utils.get_sub_resource_path_by(self, "SerialInterfaces"),
            redfish_version=self.redfish_version,
        )

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return manager_network_protocol.ManagerNetworkProtocol(
            self._conn,
            utils.get_sub_resource_path_by(self, "NetworkProtocol"),
            redfish_version=self.redfish_version,
        )

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return log_service.LogServiceCollection(
            self._conn,
            utils.get_sub_resource_path_by(self, "LogServices"),
            redfish_version=self.redfish_version,
        )

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

           It is calculated once when it is queried for the first time. On
           refresh, this property is reset.
        """
        return virtual_media.VirtualMediaCollection(
            self._conn,
            utils.get_sub_resource_path_by(self, "VirtualMedia"),
            redfish_version=self.redfish_version,
        )
Exemple #7
0
class FanCollectionField(rsd_lib_base.ReferenceableMemberField):

    fan_name = base.Field("FanName")
    """Name of the fan"""

    physical_context = base.Field("PhysicalContext")
    """Describes the area or device associated with this fan."""

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    reading = base.Field("Reading", adapter=rsd_lib_utils.num_or_none)
    """Current fan speed"""

    upper_threshold_non_critical = base.Field(
        "UpperThresholdNonCritical", adapter=rsd_lib_utils.num_or_none)
    """Above normal range"""

    upper_threshold_critical = base.Field("UpperThresholdCritical",
                                          adapter=rsd_lib_utils.num_or_none)
    """Above normal range but not yet fatal"""

    upper_threshold_fatal = base.Field("UpperThresholdFatal",
                                       adapter=rsd_lib_utils.num_or_none)
    """Above normal range and is fatal"""

    lower_threshold_non_critical = base.Field(
        "LowerThresholdNonCritical", adapter=rsd_lib_utils.num_or_none)
    """Below normal range"""

    lower_threshold_critical = base.Field("LowerThresholdCritical",
                                          adapter=rsd_lib_utils.num_or_none)
    """Below normal range but not yet fatal"""

    lower_threshold_fatal = base.Field("LowerThresholdFatal",
                                       adapter=rsd_lib_utils.num_or_none)
    """Below normal range and is fatal"""

    min_reading_range = base.Field("MinReadingRange",
                                   adapter=rsd_lib_utils.num_or_none)
    """Minimum value for Reading"""

    max_reading_range = base.Field("MaxReadingRange",
                                   adapter=rsd_lib_utils.num_or_none)
    """Maximum value for Reading"""

    related_item = base.Field("RelatedItem",
                              adapter=utils.get_members_identities)
    """The ID(s) of the resources serviced with this fan"""

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """This structure is used to show redundancy for fans.  The Component ids
       will reference the members of the redundancy groups.
    """

    reading_units = base.Field("ReadingUnits")
    """Units in which the reading and thresholds are measured."""

    name = base.Field("Name")
    """Name of the fan"""
Exemple #8
0
class PowerSupplyCollectionField(rsd_lib_base.ReferenceableMemberField):
    """PowerSupply field

       Details of a power supplies associated with this system or device
    """

    name = base.Field("Name")
    """The name of the Power Supply"""

    power_supply_type = base.Field("PowerSupplyType")
    """The Power Supply type (AC or DC)"""

    line_input_voltage_type = base.Field("LineInputVoltageType")
    """The line voltage type supported as an input to this Power Supply"""

    line_input_voltage = base.Field("LineInputVoltage",
                                    adapter=rsd_lib_utils.num_or_none)
    """The line input voltage at which the Power Supply is operating"""

    power_capacity_watts = base.Field("PowerCapacityWatts",
                                      adapter=rsd_lib_utils.num_or_none)
    """The maximum capacity of this Power Supply"""

    last_power_output_watts = base.Field("LastPowerOutputWatts",
                                         adapter=rsd_lib_utils.num_or_none)
    """The average power output of this Power Supply"""

    model = base.Field("Model")
    """The model number for this Power Supply"""

    firmware_version = base.Field("FirmwareVersion")
    """The firmware version for this Power Supply"""

    serial_number = base.Field("SerialNumber")
    """The serial number for this Power Supply"""

    part_number = base.Field("PartNumber")
    """The part number for this Power Supply"""

    spare_part_number = base.Field("SparePartNumber")
    """The spare part number for this Power Supply"""

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    related_item = base.Field("RelatedItem",
                              adapter=utils.get_members_identities)
    """The ID(s) of the resources associated with this Power Limit"""

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """This structure is used to show redundancy for power supplies.  The
       Component ids will reference the members of the redundancy groups.
    """

    manufacturer = base.Field("Manufacturer")
    """This is the manufacturer of this power supply."""

    input_ranges = InputRangeCollectionField("InputRanges")
    """This is the input ranges that the power supply can use."""