Migrate Chassis to enums
Change-Id: Ia2a2a03c9cf998d424ed317178a8aa8031dc8855
This commit is contained in:
parent
d61ed8218f
commit
69c4b38850
@ -17,7 +17,7 @@ import logging
|
|||||||
|
|
||||||
from sushy import exceptions
|
from sushy import exceptions
|
||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
from sushy.resources.chassis import mappings as cha_maps
|
from sushy.resources.chassis import constants as cha_cons
|
||||||
from sushy.resources.chassis.power import power
|
from sushy.resources.chassis.power import power
|
||||||
from sushy.resources.chassis.thermal import thermal
|
from sushy.resources.chassis.thermal import thermal
|
||||||
from sushy.resources import common
|
from sushy.resources import common
|
||||||
@ -35,7 +35,7 @@ class ActionsField(base.CompositeField):
|
|||||||
|
|
||||||
class PhysicalSecurity(base.CompositeField):
|
class PhysicalSecurity(base.CompositeField):
|
||||||
intrusion_sensor = base.MappedField('IntrusionSensor',
|
intrusion_sensor = base.MappedField('IntrusionSensor',
|
||||||
cha_maps.CHASSIS_INTRUSION_SENSOR_MAP)
|
cha_cons.IntrusionSensor)
|
||||||
"""IntrusionSensor
|
"""IntrusionSensor
|
||||||
This indicates the known state of the physical security sensor, such as if
|
This indicates the known state of the physical security sensor, such as if
|
||||||
it is hardware intrusion detected.
|
it is hardware intrusion detected.
|
||||||
@ -44,9 +44,8 @@ class PhysicalSecurity(base.CompositeField):
|
|||||||
intrusion_sensor_number = base.Field('IntrusionSensorNumber')
|
intrusion_sensor_number = base.Field('IntrusionSensorNumber')
|
||||||
"""A numerical identifier to represent the physical security sensor"""
|
"""A numerical identifier to represent the physical security sensor"""
|
||||||
|
|
||||||
intrusion_sensor_re_arm = (
|
intrusion_sensor_re_arm = base.MappedField('IntrusionSensorReArm',
|
||||||
base.MappedField('IntrusionSensorReArm',
|
cha_cons.IntrusionSensorReArm)
|
||||||
cha_maps.CHASSIS_INTRUSION_SENSOR_RE_ARM_MAP))
|
|
||||||
"""This indicates how the Normal state to be restored"""
|
"""This indicates how the Normal state to be restored"""
|
||||||
|
|
||||||
|
|
||||||
@ -58,8 +57,7 @@ class Chassis(base.ResourceBase):
|
|||||||
such as racks, enclosures, chassis and all other containers.
|
such as racks, enclosures, chassis and all other containers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
chassis_type = base.MappedField('ChassisType',
|
chassis_type = base.MappedField('ChassisType', cha_cons.ChassisType,
|
||||||
cha_maps.CHASSIS_TYPE_VALUE_MAP,
|
|
||||||
required=True)
|
required=True)
|
||||||
"""The type of physical form factor of the chassis"""
|
"""The type of physical form factor of the chassis"""
|
||||||
|
|
||||||
|
@ -10,153 +10,153 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# Values comes from the Redfish Chassis json-schema 1.8.0:
|
# Values comes from the Redfish Chassis json-schema:
|
||||||
# http://redfish.dmtf.org/schemas/v1/Chassis.v1_8_0.json#/definitions/Chassis
|
# https://redfish.dmtf.org/schemas/v1/Chassis.v1_17_0.json
|
||||||
|
|
||||||
# Chassis Types constants
|
import enum
|
||||||
|
|
||||||
CHASSIS_TYPE_RACK = 'rack chassis type'
|
|
||||||
"""An equipment rack, typically a 19-inch wide freestanding unit"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_BLADE = 'blade chassis type'
|
class ChassisType(enum.Enum):
|
||||||
"""Blade
|
"""Chassis Types constants"""
|
||||||
|
|
||||||
An enclosed or semi-enclosed, typically vertically-oriented, system
|
RACK = 'Rack'
|
||||||
chassis which must be plugged into a multi-system chassis to function
|
"""An equipment rack, typically a 19-inch wide freestanding unit."""
|
||||||
normally.
|
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_ENCLOSURE = 'enclosure chassis type'
|
BLADE = 'Blade'
|
||||||
"""A generic term for a chassis that does not fit any other description"""
|
"""An enclosed or semi-enclosed, typically vertically-oriented, system
|
||||||
|
chassis that must be plugged into a multi-system chassis to function
|
||||||
|
normally."""
|
||||||
|
|
||||||
CHASSIS_TYPE_STAND_ALONE = 'stand alone chassis type'
|
ENCLOSURE = 'Enclosure'
|
||||||
"""StandAlone
|
"""A generic term for a chassis that does not fit any other description."""
|
||||||
|
|
||||||
A single, free-standing system, commonly called a tower or desktop
|
STAND_ALONE = 'StandAlone'
|
||||||
chassis.
|
"""A single, free-standing system, commonly called a tower or desktop
|
||||||
"""
|
chassis."""
|
||||||
|
|
||||||
CHASSIS_TYPE_RACK_MOUNT = 'rack mount chassis type'
|
RACK_MOUNT = 'RackMount'
|
||||||
"""RackMount
|
"""A single-system chassis designed specifically for mounting in an
|
||||||
|
equipment rack."""
|
||||||
|
|
||||||
A single system chassis designed specifically for mounting in an
|
CARD = 'Card'
|
||||||
equipment rack.
|
"""A loose device or circuit board intended to be installed in a system
|
||||||
"""
|
or other enclosure."""
|
||||||
|
|
||||||
CHASSIS_TYPE_CARD = 'card chassis type'
|
CARTRIDGE = 'Cartridge'
|
||||||
"""Card
|
"""A small self-contained system intended to be plugged into a multi-
|
||||||
|
system chassis."""
|
||||||
|
|
||||||
A loose device or circuit board intended to be installed in a system or
|
ROW = 'Row'
|
||||||
other enclosure.
|
"""A collection of equipment racks."""
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_CARTRIDGE = 'cartridge chassis type'
|
POD = 'Pod'
|
||||||
"""Cartridge
|
"""A collection of equipment racks in a large, likely transportable,
|
||||||
|
container."""
|
||||||
|
|
||||||
A small self-contained system intended to be plugged into a multi-system
|
EXPANSION = 'Expansion'
|
||||||
chassis"""
|
"""A chassis that expands the capabilities or capacity of another
|
||||||
|
chassis."""
|
||||||
|
|
||||||
CHASSIS_TYPE_ROW = 'row chassis type'
|
SIDECAR = 'Sidecar'
|
||||||
"""A collection of equipment rack"""
|
"""A chassis that mates mechanically with another chassis to expand its
|
||||||
|
capabilities or capacity."""
|
||||||
|
|
||||||
CHASSIS_TYPE_POD = 'pod chassis type'
|
ZONE = 'Zone'
|
||||||
"""Pod
|
"""A logical division or portion of a physical chassis that contains
|
||||||
|
multiple devices or systems that cannot be physically separated."""
|
||||||
|
|
||||||
A collection of equipment racks in a large, likely transportable,
|
SLED = 'Sled'
|
||||||
container"""
|
"""An enclosed or semi-enclosed, system chassis that must be plugged
|
||||||
|
into a multi-system chassis to function normally similar to a blade
|
||||||
|
type chassis."""
|
||||||
|
|
||||||
CHASSIS_TYPE_EXPANSION = 'expansion chassis type'
|
SHELF = 'Shelf'
|
||||||
"""A chassis which expands the capabilities or capacity of another chassis"""
|
"""An enclosed or semi-enclosed, typically horizontally-oriented, system
|
||||||
|
chassis that must be plugged into a multi-system chassis to function
|
||||||
|
normally."""
|
||||||
|
|
||||||
CHASSIS_TYPE_SIDECAR = 'sidecar chassis type'
|
DRAWER = 'Drawer'
|
||||||
"""Sidecar
|
"""An enclosed or semi-enclosed, typically horizontally-oriented, system
|
||||||
|
chassis that can be slid into a multi-system chassis."""
|
||||||
|
|
||||||
A chassis that mates mechanically with another chassis to expand its
|
MODULE = 'Module'
|
||||||
capabilities or capacity.
|
"""A small, typically removable, chassis or card that contains devices
|
||||||
"""
|
for a particular subsystem or function."""
|
||||||
|
|
||||||
CHASSIS_TYPE_ZONE = 'zone chassis type'
|
COMPONENT = 'Component'
|
||||||
"""Zone
|
"""A small chassis, card, or device that contains devices for a
|
||||||
|
particular subsystem or function."""
|
||||||
|
|
||||||
A logical division or portion of a physical chassis that contains multiple
|
IP_BASED_DRIVE = 'IPBasedDrive'
|
||||||
devices or systems that cannot be physically separated.
|
"""A chassis in a drive form factor with IP-based network connections."""
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_SLED = 'sled chassis type'
|
RACK_GROUP = 'RackGroup'
|
||||||
"""Sled
|
"""A group of racks that form a single entity or share infrastructure."""
|
||||||
|
|
||||||
An enclosed or semi-enclosed, system chassis which must be plugged into a
|
STORAGE_ENCLOSURE = 'StorageEnclosure'
|
||||||
multi-system chassis to function normally similar to a blade type chassis.
|
"""A chassis that encloses storage."""
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_SHELF = 'shelf chassis type'
|
OTHER = 'Other'
|
||||||
"""Shelf
|
"""A chassis that does not fit any of these definitions."""
|
||||||
|
|
||||||
An enclosed or semi-enclosed, typically horizontally-oriented, system chassis
|
|
||||||
which must be plugged into a multi-system chassis to function
|
|
||||||
normally.
|
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_DRAWER = 'drawer chassis type'
|
# Backward compatibility
|
||||||
"""Drawer
|
CHASSIS_TYPE_RACK = ChassisType.RACK
|
||||||
|
CHASSIS_TYPE_BLADE = ChassisType.BLADE
|
||||||
|
CHASSIS_TYPE_ENCLOSURE = ChassisType.ENCLOSURE
|
||||||
|
CHASSIS_TYPE_STAND_ALONE = ChassisType.STAND_ALONE
|
||||||
|
CHASSIS_TYPE_RACK_MOUNT = ChassisType.RACK_MOUNT
|
||||||
|
CHASSIS_TYPE_CARD = ChassisType.CARD
|
||||||
|
CHASSIS_TYPE_CARTRIDGE = ChassisType.CARTRIDGE
|
||||||
|
CHASSIS_TYPE_ROW = ChassisType.ROW
|
||||||
|
CHASSIS_TYPE_POD = ChassisType.POD
|
||||||
|
CHASSIS_TYPE_EXPANSION = ChassisType.EXPANSION
|
||||||
|
CHASSIS_TYPE_SIDECAR = ChassisType.SIDECAR
|
||||||
|
CHASSIS_TYPE_ZONE = ChassisType.ZONE
|
||||||
|
CHASSIS_TYPE_SLED = ChassisType.SLED
|
||||||
|
CHASSIS_TYPE_SHELF = ChassisType.SHELF
|
||||||
|
CHASSIS_TYPE_DRAWER = ChassisType.DRAWER
|
||||||
|
CHASSIS_TYPE_MODULE = ChassisType.MODULE
|
||||||
|
CHASSIS_TYPE_COMPONENT = ChassisType.COMPONENT
|
||||||
|
CHASSIS_TYPE_IP_BASED_DRIVE = ChassisType.IP_BASED_DRIVE
|
||||||
|
CHASSIS_TYPE_RACK_GROUP = ChassisType.RACK_GROUP
|
||||||
|
CHASSIS_TYPE_STORAGE_ENCLOSURE = ChassisType.STORAGE_ENCLOSURE
|
||||||
|
CHASSIS_TYPE_OTHER = ChassisType.OTHER
|
||||||
|
|
||||||
An enclosed or semi-enclosed, typically horizontally-oriented, system
|
|
||||||
chassis which may be slid into a multi-system chassis.
|
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_MODULE = 'module chassis type'
|
class IntrusionSensor(enum.Enum):
|
||||||
"""Module
|
"""Chassis IntrusionSensor constants"""
|
||||||
|
|
||||||
A small, typically removable, chassis or card which contains devices for
|
NORMAL = 'Normal'
|
||||||
a particular subsystem or function.
|
"""No abnormal physical security condition is detected at this time."""
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_COMPONENT = 'component chassis type'
|
HARDWARE_INTRUSION = 'HardwareIntrusion'
|
||||||
"""Component
|
"""A door, lock, or other mechanism protecting the internal system
|
||||||
|
hardware from being accessed is detected to be in an insecure state."""
|
||||||
|
|
||||||
A small chassis, card, or device which contains devices for a particular
|
TAMPERING_DETECTED = 'TamperingDetected'
|
||||||
subsystem or function.
|
"""Physical tampering of the monitored entity is detected."""
|
||||||
"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_IP_BASED_DRIVE = 'IP based drive chassis type'
|
|
||||||
"""A chassis in a drive form factor with IP-based network connections"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_RACK_GROUP = 'rack group chassis type'
|
# Backward compatibility
|
||||||
"""A group of racks which form a single entity or share infrastructure"""
|
CHASSIS_INTRUSION_SENSOR_NORMAL = IntrusionSensor.NORMAL
|
||||||
|
CHASSIS_INTRUSION_SENSOR_HARDWARE_INTRUSION = \
|
||||||
|
IntrusionSensor.HARDWARE_INTRUSION
|
||||||
|
CHASSIS_INTRUSION_SENSOR_TAMPERING_DETECTED = \
|
||||||
|
IntrusionSensor.TAMPERING_DETECTED
|
||||||
|
|
||||||
CHASSIS_TYPE_STORAGE_ENCLOSURE = 'storage enclosure chassis type'
|
|
||||||
"""A chassis which encloses storage"""
|
|
||||||
|
|
||||||
CHASSIS_TYPE_OTHER = 'other chassis type'
|
class IntrusionSensorReArm(enum.Enum):
|
||||||
"""A chassis that does not fit any of these definitions"""
|
"""Chassis IntrusionSensorReArm constants"""
|
||||||
|
|
||||||
# Chassis IntrusionSensor constants
|
MANUAL = 'Manual'
|
||||||
|
"""A manual re-arm of this sensor restores it to the normal state."""
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_NORMAL = 'normal chassis intrusion sensor'
|
AUTOMATIC = 'Automatic'
|
||||||
"""No abnormal physical security conditions are detected at this time"""
|
"""Because no abnormal physical security condition is detected, this
|
||||||
|
sensor is automatically restored to the normal state."""
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_HARDWARE_INTRUSION = 'hardware intrusion chassis ' \
|
|
||||||
'intrusion sensor'
|
|
||||||
"""HardwareIntrusion
|
|
||||||
|
|
||||||
A door, lock, or other mechanism protecting the internal system hardware from
|
# Backward compatibility
|
||||||
being accessed is detected as being in an insecure state.
|
CHASSIS_INTRUSION_SENSOR_RE_ARM_MANUAL = IntrusionSensorReArm.MANUAL
|
||||||
"""
|
CHASSIS_INTRUSION_SENSOR_RE_ARM_AUTOMATIC = IntrusionSensorReArm.AUTOMATIC
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_TAMPERING_DETECTED = 'tampering detected chassis ' \
|
|
||||||
'intrusion sensor'
|
|
||||||
"""Physical tampering of the monitored entity is detected"""
|
|
||||||
|
|
||||||
# Chassis IntrusionSensorReArm constants
|
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_RE_ARM_MANUAL = 'manual re arm chassis intrusion ' \
|
|
||||||
'sensor'
|
|
||||||
"""This sensor would be restored to the Normal state by a manual re-arm"""
|
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_RE_ARM_AUTOMATIC = 'automatic re arm chassis ' \
|
|
||||||
'intrusion sensor'
|
|
||||||
"""Automatic
|
|
||||||
|
|
||||||
This sensor would be restored to the Normal state automatically as no abnormal
|
|
||||||
physical security conditions are detected.
|
|
||||||
"""
|
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from sushy.resources.chassis import constants as cha_cons
|
|
||||||
|
|
||||||
CHASSIS_TYPE_VALUE_MAP = {
|
|
||||||
'Rack': cha_cons.CHASSIS_TYPE_RACK,
|
|
||||||
'Blade': cha_cons.CHASSIS_TYPE_BLADE,
|
|
||||||
'Enclosure': cha_cons.CHASSIS_TYPE_ENCLOSURE,
|
|
||||||
'StandAlone': cha_cons.CHASSIS_TYPE_STAND_ALONE,
|
|
||||||
'RackMount': cha_cons.CHASSIS_TYPE_RACK_MOUNT,
|
|
||||||
'Card': cha_cons.CHASSIS_TYPE_CARD,
|
|
||||||
'Cartridge': cha_cons.CHASSIS_TYPE_CARTRIDGE,
|
|
||||||
'Row': cha_cons.CHASSIS_TYPE_ROW,
|
|
||||||
'Pod': cha_cons.CHASSIS_TYPE_POD,
|
|
||||||
'Expansion': cha_cons.CHASSIS_TYPE_EXPANSION,
|
|
||||||
'Sidecar': cha_cons.CHASSIS_TYPE_SIDECAR,
|
|
||||||
'Zone': cha_cons.CHASSIS_TYPE_ZONE,
|
|
||||||
'Sled': cha_cons.CHASSIS_TYPE_SLED,
|
|
||||||
'Shelf': cha_cons.CHASSIS_TYPE_SHELF,
|
|
||||||
'Drawer': cha_cons.CHASSIS_TYPE_DRAWER,
|
|
||||||
'Module': cha_cons.CHASSIS_TYPE_MODULE,
|
|
||||||
'Component': cha_cons.CHASSIS_TYPE_COMPONENT,
|
|
||||||
'IPBasedDrive': cha_cons.CHASSIS_TYPE_IP_BASED_DRIVE,
|
|
||||||
'RackGroup': cha_cons.CHASSIS_TYPE_RACK_GROUP,
|
|
||||||
'StorageEnclosure': cha_cons.CHASSIS_TYPE_STORAGE_ENCLOSURE,
|
|
||||||
'Other': cha_cons.CHASSIS_TYPE_OTHER,
|
|
||||||
}
|
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_MAP = {
|
|
||||||
'Normal': cha_cons.CHASSIS_INTRUSION_SENSOR_NORMAL,
|
|
||||||
'HardwareIntrusion': cha_cons.CHASSIS_INTRUSION_SENSOR_HARDWARE_INTRUSION,
|
|
||||||
'TamperingDetected': cha_cons.CHASSIS_INTRUSION_SENSOR_TAMPERING_DETECTED,
|
|
||||||
}
|
|
||||||
|
|
||||||
CHASSIS_INTRUSION_SENSOR_RE_ARM_MAP = {
|
|
||||||
'Manual': cha_cons.CHASSIS_INTRUSION_SENSOR_RE_ARM_MANUAL,
|
|
||||||
'Automatic': cha_cons.CHASSIS_INTRUSION_SENSOR_RE_ARM_AUTOMATIC,
|
|
||||||
}
|
|
@ -10,60 +10,94 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
# Values comes from the Redfish Chassis json-schema:
|
||||||
|
# https://redfish.dmtf.org/schemas/v1/Power.v1_7_1.json
|
||||||
|
|
||||||
# Power Supply Types
|
import enum
|
||||||
POWER_SUPPLY_TYPE_UNKNOWN = 'unknown'
|
|
||||||
"""The power supply type cannot be determined."""
|
|
||||||
|
|
||||||
POWER_SUPPLY_TYPE_AC = 'ac'
|
|
||||||
"""Alternating Current (AC) power supply."""
|
|
||||||
|
|
||||||
POWER_SUPPLY_TYPE_DC = 'dc'
|
class PowerSupplyType(enum.Enum):
|
||||||
"""Direct Current (DC) power supply."""
|
UNKNOWN = 'Unknown'
|
||||||
|
"""The power supply type cannot be determined."""
|
||||||
|
|
||||||
POWER_SUPPLY_TYPE_ACDC = 'acdc'
|
AC = 'AC'
|
||||||
"""Power Supply supports both DC or AC."""
|
"""Alternating Current (AC) power supply."""
|
||||||
|
|
||||||
# Line Input Voltage Types
|
DC = 'DC'
|
||||||
LINE_INPUT_VOLTAGE_TYPE_UNKNOWN = 'unknown'
|
"""Direct Current (DC) power supply."""
|
||||||
"""The power supply line input voltage tpye cannot be determined."""
|
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_ACLOW = 'aclowline'
|
AC_OR_DC = 'ACorDC'
|
||||||
"""100-127V AC input."""
|
"""The power supply supports both DC or AC."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_ACMID = 'acmidline'
|
|
||||||
"""200-240V AC input."""
|
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_ACHIGH = 'achighline'
|
# Backward compatibility
|
||||||
"""277V AC input."""
|
POWER_SUPPLY_TYPE_UNKNOWN = PowerSupplyType.UNKNOWN
|
||||||
|
POWER_SUPPLY_TYPE_AC = PowerSupplyType.AC
|
||||||
|
POWER_SUPPLY_TYPE_DC = PowerSupplyType.DC
|
||||||
|
POWER_SUPPLY_TYPE_ACDC = PowerSupplyType.AC_OR_DC
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_DCNEG48 = 'dcneg48v'
|
|
||||||
"""-48V DC input."""
|
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_DC380 = 'dc380v'
|
class LineInputVoltageType(enum.Enum):
|
||||||
"""High Voltage DC input (380V)."""
|
UNKNOWN = 'Unknown'
|
||||||
|
"""The power supply line input voltage type cannot be determined."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_AC120 = 'ac120v'
|
AC_LOW_LINE = 'ACLowLine'
|
||||||
"""AC 120V nominal input."""
|
"""100-127V AC input."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_AC240 = 'ac240v'
|
AC_MID_LINE = 'ACMidLine'
|
||||||
"""AC 240V nominal input."""
|
"""200-240V AC input."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_AC277 = 'ac277v'
|
AC_HIGH_LINE = 'ACHighLine'
|
||||||
"""AC 277V nominal input."""
|
"""277V AC input."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_ACDCWIDE = 'acdcwiderange'
|
DC_NEG48V = 'DCNeg48V'
|
||||||
"""Wide range AC or DC input."""
|
"""-48V DC input."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_ACWIDE = 'acwiderange'
|
DC_380V = 'DC380V'
|
||||||
"""Wide range AC input."""
|
"""High Voltage DC input (380V)."""
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_DC240 = 'dc240v'
|
AC_120V = 'AC120V'
|
||||||
"""DC 240V nominal input."""
|
"""AC 120V nominal input."""
|
||||||
|
|
||||||
# Input Types
|
AC_240V = 'AC240V'
|
||||||
INPUT_TYPE_AC = 'ac'
|
"""AC 240V nominal input."""
|
||||||
"""Alternating Current (AC) input range."""
|
|
||||||
|
|
||||||
INPUT_TYPE_DC = 'dc'
|
AC_277V = 'AC277V'
|
||||||
"""Direct Current (DC) input range."""
|
"""AC 277V nominal input."""
|
||||||
|
|
||||||
|
AC_AND_DC_WIDE_RANGE = 'ACandDCWideRange'
|
||||||
|
"""Wide range AC or DC input."""
|
||||||
|
|
||||||
|
AC_WIDE_RANGE = 'ACWideRange'
|
||||||
|
"""Wide range AC input."""
|
||||||
|
|
||||||
|
DC_240V = 'DC240V'
|
||||||
|
"""DC 240V nominal input."""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_UNKNOWN = LineInputVoltageType.UNKNOWN
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_ACLOW = LineInputVoltageType.AC_LOW_LINE
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_ACMID = LineInputVoltageType.AC_MID_LINE
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_ACHIGH = LineInputVoltageType.AC_HIGH_LINE
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_DCNEG48 = LineInputVoltageType.DC_NEG48V
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_DC380V = LineInputVoltageType.DC_380V
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_AC120V = LineInputVoltageType.AC_120V
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_AC240V = LineInputVoltageType.AC_240V
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_AC277V = LineInputVoltageType.AC_277V
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_ACDCWIDE = LineInputVoltageType.AC_AND_DC_WIDE_RANGE
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_ACWIDE = LineInputVoltageType.AC_WIDE_RANGE
|
||||||
|
LINE_INPUT_VOLTAGE_TYPE_DC240V = LineInputVoltageType.DC_240V
|
||||||
|
|
||||||
|
|
||||||
|
class PowerInputType(enum.Enum):
|
||||||
|
AC = 'AC'
|
||||||
|
"""Alternating Current (AC) input range."""
|
||||||
|
|
||||||
|
DC = 'DC'
|
||||||
|
"""Direct Current (DC) input range."""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
INPUT_TYPE_AC = PowerInputType.AC
|
||||||
|
INPUT_TYPE_DC = PowerInputType.DC
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from sushy.resources.chassis.power import constants as pow_cons
|
|
||||||
|
|
||||||
POWER_SUPPLY_TYPE_MAP = {
|
|
||||||
'Unknown': pow_cons.POWER_SUPPLY_TYPE_UNKNOWN,
|
|
||||||
'AC': pow_cons.POWER_SUPPLY_TYPE_AC,
|
|
||||||
'DC': pow_cons.POWER_SUPPLY_TYPE_DC,
|
|
||||||
'ACorDC': pow_cons.POWER_SUPPLY_TYPE_ACDC,
|
|
||||||
}
|
|
||||||
|
|
||||||
POWER_SUPPLY_INPUT_TYPE_MAP = {
|
|
||||||
'AC': pow_cons.INPUT_TYPE_AC,
|
|
||||||
'DC': pow_cons.INPUT_TYPE_DC,
|
|
||||||
}
|
|
||||||
|
|
||||||
LINE_INPUT_VOLTAGE_TYPE_MAP = {
|
|
||||||
'Unknown': pow_cons.LINE_INPUT_VOLTAGE_TYPE_UNKNOWN,
|
|
||||||
'ACLowLine': pow_cons.LINE_INPUT_VOLTAGE_TYPE_ACLOW,
|
|
||||||
'ACMidLine': pow_cons.LINE_INPUT_VOLTAGE_TYPE_ACMID,
|
|
||||||
'ACHighLine': pow_cons.LINE_INPUT_VOLTAGE_TYPE_ACHIGH,
|
|
||||||
'DCNeg48V': pow_cons.LINE_INPUT_VOLTAGE_TYPE_DCNEG48,
|
|
||||||
'DC380V': pow_cons.LINE_INPUT_VOLTAGE_TYPE_DC380,
|
|
||||||
'AC120V': pow_cons.LINE_INPUT_VOLTAGE_TYPE_AC120,
|
|
||||||
'AC240V': pow_cons.LINE_INPUT_VOLTAGE_TYPE_AC240,
|
|
||||||
'AC277V': pow_cons.LINE_INPUT_VOLTAGE_TYPE_AC277,
|
|
||||||
'ACandDCWideRange': pow_cons.LINE_INPUT_VOLTAGE_TYPE_ACDCWIDE,
|
|
||||||
'ACWideRange': pow_cons.LINE_INPUT_VOLTAGE_TYPE_ACWIDE,
|
|
||||||
'DC240V': pow_cons.LINE_INPUT_VOLTAGE_TYPE_DC240,
|
|
||||||
}
|
|
@ -14,7 +14,7 @@
|
|||||||
# http://redfish.dmtf.org/schemas/v1/Power.v1_3_0.json
|
# http://redfish.dmtf.org/schemas/v1/Power.v1_3_0.json
|
||||||
|
|
||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
from sushy.resources.chassis.power import mappings as pow_maps
|
from sushy.resources.chassis.power import constants as pow_cons
|
||||||
from sushy.resources import common
|
from sushy.resources import common
|
||||||
from sushy.resources import constants as res_cons
|
from sushy.resources import constants as res_cons
|
||||||
from sushy import utils
|
from sushy import utils
|
||||||
@ -23,8 +23,7 @@ from sushy import utils
|
|||||||
class InputRangeListField(base.ListField):
|
class InputRangeListField(base.ListField):
|
||||||
"""This type describes an input range for a power supply"""
|
"""This type describes an input range for a power supply"""
|
||||||
|
|
||||||
input_type = base.MappedField('InputType',
|
input_type = base.MappedField('InputType', pow_cons.PowerInputType)
|
||||||
pow_maps.POWER_SUPPLY_INPUT_TYPE_MAP)
|
|
||||||
"""The Input type (AC or DC)"""
|
"""The Input type (AC or DC)"""
|
||||||
|
|
||||||
maximum_frequency_hz = base.Field('MaximumFrequencyHz',
|
maximum_frequency_hz = base.Field('MaximumFrequencyHz',
|
||||||
@ -73,9 +72,8 @@ class PowerSupplyListField(base.ListField):
|
|||||||
adapter=utils.int_or_none)
|
adapter=utils.int_or_none)
|
||||||
"""The line input voltage at which the Power Supply is operating"""
|
"""The line input voltage at which the Power Supply is operating"""
|
||||||
|
|
||||||
line_input_voltage_type = base.MappedField(
|
line_input_voltage_type = base.MappedField('LineInputVoltageType',
|
||||||
'LineInputVoltageType',
|
pow_cons.LineInputVoltageType)
|
||||||
pow_maps.LINE_INPUT_VOLTAGE_TYPE_MAP)
|
|
||||||
"""The line voltage type supported as an input to this Power Supply"""
|
"""The line voltage type supported as an input to this Power Supply"""
|
||||||
|
|
||||||
manufacturer = base.Field('Manufacturer')
|
manufacturer = base.Field('Manufacturer')
|
||||||
@ -95,7 +93,7 @@ class PowerSupplyListField(base.ListField):
|
|||||||
"""The maximum capacity of this Power Supply"""
|
"""The maximum capacity of this Power Supply"""
|
||||||
|
|
||||||
power_supply_type = base.MappedField('PowerSupplyType',
|
power_supply_type = base.MappedField('PowerSupplyType',
|
||||||
pow_maps.POWER_SUPPLY_TYPE_MAP)
|
pow_cons.PowerSupplyType)
|
||||||
"""The Power Supply type (AC or DC)"""
|
"""The Power Supply type (AC or DC)"""
|
||||||
|
|
||||||
serial_number = base.Field('SerialNumber')
|
serial_number = base.Field('SerialNumber')
|
||||||
|
@ -10,9 +10,22 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
FAN_READING_UNIT_PERCENTAGE = 'Percentage'
|
# Values comes from the Redfish Chassis json-schema:
|
||||||
"""Indicates that the fan reading and thresholds are measured in percentage"""
|
# https://redfish.dmtf.org/schemas/v1/Thermal.v1_7_1.json
|
||||||
|
|
||||||
FAN_READING_UNIT_RPM = 'RPM'
|
import enum
|
||||||
"""Indicates that the fan reading and thresholds
|
|
||||||
are measured in rotations per minute."""
|
|
||||||
|
class FanReadingUnit(enum.Enum):
|
||||||
|
|
||||||
|
RPM = 'RPM'
|
||||||
|
"""The fan reading and thresholds are measured in revolutions per
|
||||||
|
minute."""
|
||||||
|
|
||||||
|
PERCENT = 'Percent'
|
||||||
|
"""The fan reading and thresholds are measured as a percentage."""
|
||||||
|
|
||||||
|
|
||||||
|
# Backward compatibility
|
||||||
|
FAN_READING_UNIT_PERCENTAGE = FanReadingUnit.PERCENT
|
||||||
|
FAN_READING_UNIT_RPM = FanReadingUnit.RPM
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
from sushy.resources.chassis.thermal import constants as the_cons
|
|
||||||
|
|
||||||
FAN_READING_UNITS_MAP = {
|
|
||||||
'Percentage': the_cons.FAN_READING_UNIT_PERCENTAGE,
|
|
||||||
'RPM': the_cons.FAN_READING_UNIT_RPM,
|
|
||||||
}
|
|
@ -14,7 +14,7 @@
|
|||||||
# http://redfish.dmtf.org/schemas/v1/Thermal.v1_3_0.json
|
# http://redfish.dmtf.org/schemas/v1/Thermal.v1_3_0.json
|
||||||
|
|
||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
from sushy.resources.chassis.thermal import mappings as the_maps
|
from sushy.resources.chassis.thermal import constants as the_cons
|
||||||
from sushy.resources import common
|
from sushy.resources import common
|
||||||
from sushy.resources import constants as res_cons
|
from sushy.resources import constants as res_cons
|
||||||
from sushy import utils
|
from sushy import utils
|
||||||
@ -86,8 +86,7 @@ class FansListField(Sensor):
|
|||||||
reading = base.Field('Reading', adapter=utils.int_or_none)
|
reading = base.Field('Reading', adapter=utils.int_or_none)
|
||||||
"""Current Fan Speed"""
|
"""Current Fan Speed"""
|
||||||
|
|
||||||
reading_units = base.MappedField('ReadingUnits',
|
reading_units = base.MappedField('ReadingUnits', the_cons.FanReadingUnit)
|
||||||
the_maps.FAN_READING_UNITS_MAP)
|
|
||||||
"""Units in which the reading and thresholds are measured"""
|
"""Units in which the reading and thresholds are measured"""
|
||||||
|
|
||||||
serial_number = base.Field('SerialNumber')
|
serial_number = base.Field('SerialNumber')
|
||||||
|
@ -47,8 +47,7 @@ class ChassisTestCase(base.TestCase):
|
|||||||
self.assertEqual('Blade', self.chassis.name)
|
self.assertEqual('Blade', self.chassis.name)
|
||||||
self.assertEqual('Test description', self.chassis.description)
|
self.assertEqual('Test description', self.chassis.description)
|
||||||
self.assertEqual('45Z-2381', self.chassis.asset_tag)
|
self.assertEqual('45Z-2381', self.chassis.asset_tag)
|
||||||
self.assertEqual(sushy.CHASSIS_TYPE_BLADE,
|
self.assertEqual(sushy.ChassisType.BLADE, self.chassis.chassis_type)
|
||||||
self.chassis.chassis_type)
|
|
||||||
self.assertEqual('Contoso', self.chassis.manufacturer)
|
self.assertEqual('Contoso', self.chassis.manufacturer)
|
||||||
self.assertEqual('SX1000', self.chassis.model)
|
self.assertEqual('SX1000', self.chassis.model)
|
||||||
self.assertEqual('529QB9450R6', self.chassis.serial_number)
|
self.assertEqual('529QB9450R6', self.chassis.serial_number)
|
||||||
@ -66,12 +65,12 @@ class ChassisTestCase(base.TestCase):
|
|||||||
self.assertEqual(711, self.chassis.depth_mm)
|
self.assertEqual(711, self.chassis.depth_mm)
|
||||||
self.assertEqual(15.31, self.chassis.weight_kg)
|
self.assertEqual(15.31, self.chassis.weight_kg)
|
||||||
self.assertEqual(sushy.Health.OK, self.chassis.status.health)
|
self.assertEqual(sushy.Health.OK, self.chassis.status.health)
|
||||||
self.assertEqual(sushy.CHASSIS_INTRUSION_SENSOR_NORMAL,
|
self.assertEqual(sushy.IntrusionSensor.NORMAL,
|
||||||
self.chassis.physical_security.intrusion_sensor)
|
self.chassis.physical_security.intrusion_sensor)
|
||||||
self.assertEqual(123,
|
self.assertEqual(123,
|
||||||
self.chassis.physical_security.intrusion_sensor_number
|
self.chassis.physical_security.intrusion_sensor_number
|
||||||
)
|
)
|
||||||
self.assertEqual(sushy.CHASSIS_INTRUSION_SENSOR_RE_ARM_MANUAL,
|
self.assertEqual(sushy.IntrusionSensorReArm.MANUAL,
|
||||||
self.chassis.physical_security.intrusion_sensor_re_arm
|
self.chassis.physical_security.intrusion_sensor_re_arm
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -83,12 +82,10 @@ class ChassisTestCase(base.TestCase):
|
|||||||
self.assertEqual(sushy.IndicatorLED.OFF,
|
self.assertEqual(sushy.IndicatorLED.OFF,
|
||||||
attributes.get('indicator_led'))
|
attributes.get('indicator_led'))
|
||||||
self.assertEqual(sushy.POWER_STATE_ON, attributes.get('power_state'))
|
self.assertEqual(sushy.POWER_STATE_ON, attributes.get('power_state'))
|
||||||
self.assertEqual({'intrusion_sensor':
|
self.assertEqual({'intrusion_sensor': sushy.IntrusionSensor.NORMAL,
|
||||||
sushy.CHASSIS_INTRUSION_SENSOR_NORMAL,
|
'intrusion_sensor_number': 123,
|
||||||
'intrusion_sensor_number':
|
|
||||||
123,
|
|
||||||
'intrusion_sensor_re_arm':
|
'intrusion_sensor_re_arm':
|
||||||
'manual re arm chassis intrusion sensor'},
|
sushy.IntrusionSensorReArm.MANUAL},
|
||||||
attributes.get('physical_security'))
|
attributes.get('physical_security'))
|
||||||
|
|
||||||
def test_get_allowed_reset_chasis_values(self):
|
def test_get_allowed_reset_chasis_values(self):
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import json
|
import json
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from sushy.resources.chassis.power import constants as pow_cons
|
||||||
from sushy.resources.chassis.power import power
|
from sushy.resources.chassis.power import power
|
||||||
from sushy.resources import constants as res_cons
|
from sushy.resources import constants as res_cons
|
||||||
from sushy.tests.unit import base
|
from sushy.tests.unit import base
|
||||||
@ -46,14 +47,15 @@ class PowerTestCase(base.TestCase):
|
|||||||
self.power.power_supplies[0].status.state)
|
self.power.power_supplies[0].status.state)
|
||||||
self.assertEqual(res_cons.Health.OK,
|
self.assertEqual(res_cons.Health.OK,
|
||||||
self.power.power_supplies[0].status.health)
|
self.power.power_supplies[0].status.health)
|
||||||
self.assertEqual('ac', self.power.power_supplies[0].power_supply_type)
|
self.assertEqual(pow_cons.PowerSupplyType.AC,
|
||||||
self.assertEqual('ac240v',
|
self.power.power_supplies[0].power_supply_type)
|
||||||
|
self.assertEqual(pow_cons.LineInputVoltageType.AC_240V,
|
||||||
self.power.power_supplies[0].line_input_voltage_type)
|
self.power.power_supplies[0].line_input_voltage_type)
|
||||||
self.assertEqual(220, self.power.power_supplies[0].line_input_voltage)
|
self.assertEqual(220, self.power.power_supplies[0].line_input_voltage)
|
||||||
self.assertEqual(1450,
|
self.assertEqual(1450,
|
||||||
self.power.power_supplies[0].power_capacity_watts)
|
self.power.power_supplies[0].power_capacity_watts)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'ac',
|
pow_cons.PowerInputType.AC,
|
||||||
self.power.power_supplies[0].input_ranges[0].input_type
|
self.power.power_supplies[0].input_ranges[0].input_type
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -96,14 +98,15 @@ class PowerTestCase(base.TestCase):
|
|||||||
self.power.power_supplies[1].status.state)
|
self.power.power_supplies[1].status.state)
|
||||||
self.assertEqual(res_cons.Health.OK,
|
self.assertEqual(res_cons.Health.OK,
|
||||||
self.power.power_supplies[1].status.health)
|
self.power.power_supplies[1].status.health)
|
||||||
self.assertEqual('ac', self.power.power_supplies[1].power_supply_type)
|
self.assertEqual(pow_cons.PowerSupplyType.AC,
|
||||||
self.assertEqual('ac240v',
|
self.power.power_supplies[1].power_supply_type)
|
||||||
|
self.assertEqual(pow_cons.LineInputVoltageType.AC_240V,
|
||||||
self.power.power_supplies[1].line_input_voltage_type)
|
self.power.power_supplies[1].line_input_voltage_type)
|
||||||
self.assertEqual(222, self.power.power_supplies[1].line_input_voltage)
|
self.assertEqual(222, self.power.power_supplies[1].line_input_voltage)
|
||||||
self.assertEqual(1450,
|
self.assertEqual(1450,
|
||||||
self.power.power_supplies[1].power_capacity_watts)
|
self.power.power_supplies[1].power_capacity_watts)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'ac',
|
pow_cons.PowerInputType.AC,
|
||||||
self.power.power_supplies[1].input_ranges[0].input_type
|
self.power.power_supplies[1].input_ranges[0].input_type
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -149,7 +152,7 @@ class PowerTestCase(base.TestCase):
|
|||||||
'identity': '0',
|
'identity': '0',
|
||||||
'indicator_led': None,
|
'indicator_led': None,
|
||||||
'input_ranges':
|
'input_ranges':
|
||||||
[{'input_type': 'ac',
|
[{'input_type': pow_cons.PowerInputType.AC,
|
||||||
'maximum_frequency_hz': 63,
|
'maximum_frequency_hz': 63,
|
||||||
'maximum_voltage': 250,
|
'maximum_voltage': 250,
|
||||||
'minimum_frequency_hz': 47,
|
'minimum_frequency_hz': 47,
|
||||||
@ -157,13 +160,14 @@ class PowerTestCase(base.TestCase):
|
|||||||
'output_wattage': 1450}],
|
'output_wattage': 1450}],
|
||||||
'last_power_output_watts': 650,
|
'last_power_output_watts': 650,
|
||||||
'line_input_voltage': 220,
|
'line_input_voltage': 220,
|
||||||
'line_input_voltage_type': 'ac240v',
|
'line_input_voltage_type':
|
||||||
|
pow_cons.LineInputVoltageType.AC_240V,
|
||||||
'manufacturer': 'Cyberdyne',
|
'manufacturer': 'Cyberdyne',
|
||||||
'model': '325457-A06',
|
'model': '325457-A06',
|
||||||
'name': 'Power Supply 0',
|
'name': 'Power Supply 0',
|
||||||
'part_number': '425-591-654',
|
'part_number': '425-591-654',
|
||||||
'power_capacity_watts': 1450,
|
'power_capacity_watts': 1450,
|
||||||
'power_supply_type': 'ac',
|
'power_supply_type': pow_cons.PowerSupplyType.AC,
|
||||||
'serial_number': '1S0000523',
|
'serial_number': '1S0000523',
|
||||||
'spare_part_number': '425-591-654',
|
'spare_part_number': '425-591-654',
|
||||||
'status': {'health': res_cons.Health.OK,
|
'status': {'health': res_cons.Health.OK,
|
||||||
@ -173,7 +177,7 @@ class PowerTestCase(base.TestCase):
|
|||||||
'identity': '1',
|
'identity': '1',
|
||||||
'indicator_led': None,
|
'indicator_led': None,
|
||||||
'input_ranges':
|
'input_ranges':
|
||||||
[{'input_type': 'ac',
|
[{'input_type': pow_cons.PowerInputType.AC,
|
||||||
'maximum_frequency_hz': 63,
|
'maximum_frequency_hz': 63,
|
||||||
'maximum_voltage': 250,
|
'maximum_voltage': 250,
|
||||||
'minimum_frequency_hz': 47,
|
'minimum_frequency_hz': 47,
|
||||||
@ -181,13 +185,14 @@ class PowerTestCase(base.TestCase):
|
|||||||
'output_wattage': 1450}],
|
'output_wattage': 1450}],
|
||||||
'last_power_output_watts': 635,
|
'last_power_output_watts': 635,
|
||||||
'line_input_voltage': 222,
|
'line_input_voltage': 222,
|
||||||
'line_input_voltage_type': 'ac240v',
|
'line_input_voltage_type':
|
||||||
|
pow_cons.LineInputVoltageType.AC_240V,
|
||||||
'manufacturer': 'Cyberdyne',
|
'manufacturer': 'Cyberdyne',
|
||||||
'model': '325457-A06',
|
'model': '325457-A06',
|
||||||
'name': 'Power Supply 1',
|
'name': 'Power Supply 1',
|
||||||
'part_number': '425-591-654',
|
'part_number': '425-591-654',
|
||||||
'power_capacity_watts': 1450,
|
'power_capacity_watts': 1450,
|
||||||
'power_supply_type': 'ac',
|
'power_supply_type': pow_cons.PowerSupplyType.AC,
|
||||||
'serial_number': '1S0000524',
|
'serial_number': '1S0000524',
|
||||||
'spare_part_number': '425-591-654',
|
'spare_part_number': '425-591-654',
|
||||||
'status': {'health': res_cons.Health.OK,
|
'status': {'health': res_cons.Health.OK,
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import json
|
import json
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from sushy.resources.chassis.thermal import constants as the_cons
|
||||||
from sushy.resources.chassis.thermal import thermal
|
from sushy.resources.chassis.thermal import thermal
|
||||||
from sushy.resources import constants as res_cons
|
from sushy.resources import constants as res_cons
|
||||||
from sushy.tests.unit import base
|
from sushy.tests.unit import base
|
||||||
@ -48,7 +49,8 @@ class ThermalTestCase(base.TestCase):
|
|||||||
self.assertEqual(res_cons.Health.OK,
|
self.assertEqual(res_cons.Health.OK,
|
||||||
self.thermal.fans[0].status.health)
|
self.thermal.fans[0].status.health)
|
||||||
self.assertEqual(6000, self.thermal.fans[0].reading)
|
self.assertEqual(6000, self.thermal.fans[0].reading)
|
||||||
self.assertEqual('RPM', self.thermal.fans[0].reading_units)
|
self.assertEqual(the_cons.FanReadingUnit.RPM,
|
||||||
|
self.thermal.fans[0].reading_units)
|
||||||
self.assertEqual(2000, self.thermal.fans[0].lower_threshold_fatal)
|
self.assertEqual(2000, self.thermal.fans[0].lower_threshold_fatal)
|
||||||
self.assertEqual(0, self.thermal.fans[0].min_reading_range)
|
self.assertEqual(0, self.thermal.fans[0].min_reading_range)
|
||||||
self.assertEqual(10000, self.thermal.fans[0].max_reading_range)
|
self.assertEqual(10000, self.thermal.fans[0].max_reading_range)
|
||||||
@ -95,7 +97,7 @@ class ThermalTestCase(base.TestCase):
|
|||||||
'part_number': None,
|
'part_number': None,
|
||||||
'physical_context': 'CPU',
|
'physical_context': 'CPU',
|
||||||
'reading': 6000,
|
'reading': 6000,
|
||||||
'reading_units': 'RPM',
|
'reading_units': the_cons.FanReadingUnit.RPM,
|
||||||
'serial_number': None,
|
'serial_number': None,
|
||||||
'status':
|
'status':
|
||||||
{'health': res_cons.Health.OK,
|
{'health': res_cons.Health.OK,
|
||||||
|
Loading…
Reference in New Issue
Block a user