Add GetChassisThermals command to Chassis category of redfish_facts (#54399)

* Add GetChassisThermals command to Chassis list

* Add GetChassisThermals conditional and point to rf_utils.get_chassis_thermals() function

* Implement get_chassis_thermals() in redfish_utils

* Remove trailing whitespace

* Add more properties, including RelatedItem tto distinguish entries' contexts from each other.

* Remove trailing whitespace
pull/55923/head
Xander Madsen 6 years ago committed by John R Barker
parent 216d8b5254
commit 1aec39a2d7

@ -893,6 +893,48 @@ class RedfishUtils(object):
result["entries"] = fan_results
return result
def get_chassis_thermals(self):
result = {}
sensors = []
key = "Thermal"
# Get these entries, but does not fail if not found
properties = ['Name', 'PhysicalContext', 'UpperThresholdCritical',
'UpperThresholdFatal', 'UpperThresholdNonCritical',
'LowerThresholdCritical', 'LowerThresholdFatal',
'LowerThresholdNonCritical', 'MaxReadingRangeTemp',
'MinReadingRangeTemp', 'ReadingCelsius', 'RelatedItem',
'SensorNumber']
# Go through list
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 in data:
thermal_uri = data[key]["@odata.id"]
response = self.get_request(self.root_uri + thermal_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
if "Temperatures" in data:
for sensor in data[u'Temperatures']:
sensor_result = {}
for property in properties:
if property in sensor:
if sensor[property] is not None:
sensor_result[property] = sensor[property]
sensors.append(sensor_result)
if sensors is None:
return {'ret': False, 'msg': 'Key Temperatures was not found.'}
result['entries'] = sensors
return result
def get_cpu_inventory(self, systems_uri):
result = {}
cpu_list = []

@ -162,7 +162,7 @@ CATEGORY_COMMANDS_ALL = {
"GetMemoryInventory", "GetNicInventory",
"GetStorageControllerInventory", "GetDiskInventory",
"GetBiosAttributes", "GetBootOrder"],
"Chassis": ["GetFanInventory", "GetPsuInventory"],
"Chassis": ["GetFanInventory", "GetPsuInventory", "GetChassisThermals"],
"Accounts": ["ListUsers"],
"Update": ["GetFirmwareInventory"],
"Manager": ["GetManagerNicInventory", "GetLogs"],
@ -271,6 +271,8 @@ def main():
result["fan"] = rf_utils.get_fan_inventory()
elif command == "GetPsuInventory":
result["psu"] = rf_utils.get_psu_inventory()
elif command == "GetChassisThermals":
result["thermals"] = rf_utils.get_chassis_thermals()
elif category == "Accounts":
# execute only if we find an Account service resource

Loading…
Cancel
Save