Create mappings for System Indicator LED

Add mappings and constants for the Indicator LED
value in the System class.

Change-Id: I5ecad5d81a6ca1487fab2002d2bc8b57736ab4ef
This commit is contained in:
Nate Potter 2017-07-19 16:13:43 -07:00 committed by Julia Kreger
parent fc012cb706
commit 0b9497dfa6
5 changed files with 30 additions and 3 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds mappings and constants for possible values of the Indicator LED
value in the System class.

View File

@ -44,6 +44,20 @@ SYSTEM_POWER_STATE_POWERING_OFF = 'powering off'
"""A temporary state between On and Off. The power off action can take
time while the OS is in the shutdown process"""
# Indicator LED Constants
SYSTEM_INDICATOR_LED_LIT = 'Lit'
"""The Indicator LED is lit"""
SYSTEM_INDICATOR_LED_BLINKING = 'Blinking'
"""The Indicator LED is blinking"""
SYSTEM_INDICATOR_LED_OFF = 'Off'
"""The Indicator LED is off"""
SYSTEM_INDICATOR_LED_UNKNOWN = 'Unknown'
"""The state of the Indicator LED cannot be determine"""
# Boot source target constants
BOOT_SOURCE_TARGET_NONE = 'none'

View File

@ -39,6 +39,13 @@ SYSTEM_POWER_STATE_MAP = {
SYSTEM_POWER_STATE_MAP_REV = utils.revert_dictionary(SYSTEM_POWER_STATE_MAP)
SYSTEM_INDICATOR_LED_MAP = {
'Lit': sys_cons.SYSTEM_INDICATOR_LED_LIT,
'Blinking': sys_cons.SYSTEM_INDICATOR_LED_BLINKING,
'Off': sys_cons.SYSTEM_INDICATOR_LED_OFF,
'Unknown': sys_cons.SYSTEM_INDICATOR_LED_UNKNOWN,
}
BOOT_SOURCE_TARGET_MAP = {
'None': sys_cons.BOOT_SOURCE_TARGET_NONE,
'Pxe': sys_cons.BOOT_SOURCE_TARGET_PXE,

View File

@ -88,8 +88,8 @@ class System(base.ResourceBase):
identity = base.Field('Id', required=True)
"""The system identity string"""
# TODO(lucasagomes): Create mappings for the indicator_led
indicator_led = base.Field('IndicatorLED')
indicator_led = base.MappedField('IndicatorLED',
sys_maps.SYSTEM_INDICATOR_LED_MAP)
"""Whether the indicator LED is lit or off"""
manufacturer = base.Field('Manufacturer')

View File

@ -47,7 +47,8 @@ class SystemTestCase(base.TestCase):
self.assertEqual('Web Front End node', self.sys_inst.description)
self.assertEqual('web483', self.sys_inst.hostname)
self.assertEqual('437XR1138R2', self.sys_inst.identity)
self.assertEqual('Off', self.sys_inst.indicator_led)
self.assertEqual(sushy.SYSTEM_INDICATOR_LED_OFF,
self.sys_inst.indicator_led)
self.assertEqual('Contoso', self.sys_inst.manufacturer)
self.assertEqual('WebFrontEnd483', self.sys_inst.name)
self.assertEqual('224071-J23', self.sys_inst.part_number)