Add IndicatorLED control commands to redfish_command module (#53752)

* Add Chassis commands IndicatorLedOn, IndicatorLedOff, and IndicatorLedBlink

* Add manage_indicator_led function to redfish_utils

* Add Chassis command category with IndicatorLedOn/Off/Blink commands to redfish_command

* Add IndicatorLedBlink example to EXAMPLES docstring, and make the category == 'Chassis' section more generic for future development
This commit is contained in:
Xander Madsen 2019-03-28 16:58:46 -04:00 committed by John R Barker
parent eebebb1a83
commit 31b02fdd58
2 changed files with 51 additions and 0 deletions

View file

@ -438,6 +438,32 @@ class RedfishUtils(object):
return response
return {'ret': True}
def manage_indicator_led(self, command):
result = {}
key = 'IndicatorLED'
payloads = {'IndicatorLedOn': 'Lit', 'IndicatorLedOff': 'Off', "IndicatorLedBlink": 'Blinking'}
result = {}
for chassis_uri in self.chassis_uri_list:
response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
if key not in data:
return {'ret': False, 'msg': "Key %s not found" % key}
if command in payloads.keys():
payload = {'IndicatorLED': payloads[command]}
response = self.patch_request(self.root_uri + chassis_uri, payload, HEADERS)
if response['ret'] is False:
return response
else:
return {'ret': False, 'msg': 'Invalid command'}
return result
def manage_system_power(self, command):
result = {}
key = "Actions"