sensor_utils: Support upper/lower fatal threshold
Add support of upper and lower fatal threshold settings. The fatal
thresholds use the `xyz.openbmc_project.Sensor.Threshold.HardShutdown`
interface as the source of threshold value.
Tested on catalina:
```
{
"@odata.id": "/redfish/v1/Chassis/NVIDIA_HMC/Sensors/temperature_HGX_GPU_0_TEMP_0",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "temperature_HGX_GPU_0_TEMP_0",
"Name": "HGX GPU 0 TEMP 0",
"Reading": 81.34375,
"ReadingRangeMax": 127.0,
"ReadingRangeMin": -128.0,
"ReadingType": "Temperature",
"ReadingUnits": "Cel",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"Thresholds": {
"UpperCaution": {
"Reading": 82.0
},
"UpperCritical": {
"Reading": 84.0
},
"UpperFatal": {
"Reading": 87.0
}
}
}
```
```
{
"@odata.id": "/redfish/v1/Chassis/NVIDIA_HMC/Sensors/temperature_HGX_GPU_0_TEMP_1",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "temperature_HGX_GPU_0_TEMP_1",
"Name": "HGX GPU 0 TEMP 1",
"Reading": 5.4375,
"ReadingRangeMax": 127.0,
"ReadingRangeMin": -128.0,
"ReadingType": "Temperature",
"ReadingUnits": "Cel",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"Thresholds": {
"LowerCaution": {
"Reading": -0.05
},
"LowerCritical": {
"Reading": -4.0
},
"LowerFatal": {
"Reading": -5.0
}
}
}
```
Change-Id: Ida54d663efdb042d21ea433d9c198c1ee4890173
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
diff --git a/redfish-core/include/utils/sensor_utils.hpp b/redfish-core/include/utils/sensor_utils.hpp
index 718df34..de1998d 100644
--- a/redfish-core/include/utils/sensor_utils.hpp
+++ b/redfish-core/include/utils/sensor_utils.hpp
@@ -585,6 +585,14 @@
properties.emplace_back(
"xyz.openbmc_project.Sensor.Threshold.Critical", "CriticalLow",
"/Thresholds/LowerCritical/Reading"_json_pointer);
+ properties.emplace_back(
+ "xyz.openbmc_project.Sensor.Threshold.HardShutdown",
+ "HardShutdownHigh",
+ "/Thresholds/UpperFatal/Reading"_json_pointer);
+ properties.emplace_back(
+ "xyz.openbmc_project.Sensor.Threshold.HardShutdown",
+ "HardShutdownLow",
+ "/Thresholds/LowerFatal/Reading"_json_pointer);
/* Add additional properties specific to sensorType */
if (sensorType == "fan_tach")