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
This commit is contained in:
parent
216d8b5254
commit
1aec39a2d7
2 changed files with 45 additions and 1 deletions
|
@ -893,6 +893,48 @@ class RedfishUtils(object):
|
||||||
result["entries"] = fan_results
|
result["entries"] = fan_results
|
||||||
return result
|
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):
|
def get_cpu_inventory(self, systems_uri):
|
||||||
result = {}
|
result = {}
|
||||||
cpu_list = []
|
cpu_list = []
|
||||||
|
|
|
@ -162,7 +162,7 @@ CATEGORY_COMMANDS_ALL = {
|
||||||
"GetMemoryInventory", "GetNicInventory",
|
"GetMemoryInventory", "GetNicInventory",
|
||||||
"GetStorageControllerInventory", "GetDiskInventory",
|
"GetStorageControllerInventory", "GetDiskInventory",
|
||||||
"GetBiosAttributes", "GetBootOrder"],
|
"GetBiosAttributes", "GetBootOrder"],
|
||||||
"Chassis": ["GetFanInventory", "GetPsuInventory"],
|
"Chassis": ["GetFanInventory", "GetPsuInventory", "GetChassisThermals"],
|
||||||
"Accounts": ["ListUsers"],
|
"Accounts": ["ListUsers"],
|
||||||
"Update": ["GetFirmwareInventory"],
|
"Update": ["GetFirmwareInventory"],
|
||||||
"Manager": ["GetManagerNicInventory", "GetLogs"],
|
"Manager": ["GetManagerNicInventory", "GetLogs"],
|
||||||
|
@ -271,6 +271,8 @@ def main():
|
||||||
result["fan"] = rf_utils.get_fan_inventory()
|
result["fan"] = rf_utils.get_fan_inventory()
|
||||||
elif command == "GetPsuInventory":
|
elif command == "GetPsuInventory":
|
||||||
result["psu"] = rf_utils.get_psu_inventory()
|
result["psu"] = rf_utils.get_psu_inventory()
|
||||||
|
elif command == "GetChassisThermals":
|
||||||
|
result["thermals"] = rf_utils.get_chassis_thermals()
|
||||||
|
|
||||||
elif category == "Accounts":
|
elif category == "Accounts":
|
||||||
# execute only if we find an Account service resource
|
# execute only if we find an Account service resource
|
||||||
|
|
Loading…
Reference in a new issue