From b9747ecfce682f15dce0bb6e41e0c894f29419f3 Mon Sep 17 00:00:00 2001 From: Snehalatha Venkatesh Date: Thu, 8 Apr 2021 14:42:07 +0000 Subject: [PATCH] bmcweb: Add PhysicalContext to Thermal resources Adding PhysicalContext to make redfish data compliance with OCP Server Mgmt Interface v0.2.1.pdf and specific to Thermal resources. https://github.com/opencomputeproject/OCP-Profiles/blob/master/ OCPServerHardwareManagement.v0_2_4.json Tested: 1. Redfish validator - passed for this new change 2. GET - https:///redfish/v1/Chassis//Thermal Response: { "@odata.id": "/redfish/v1/Chassis//Thermal#/Temperatures/0", "@odata.type": "#Thermal.v1_3_0.Temperature", "LowerThresholdCritical": 0.0, "LowerThresholdNonCritical": 5.0, "MaxReadingRangeTemp": 127.0, "MemberId": "BMC_Temp", "MinReadingRangeTemp": -128.0, "Name": "BMC Temp", "PhysicalContext": "SystemBoard", "ReadingCelsius": 25.75, "Status": { "Health": "OK", "State": "Enabled" }, "UpperThresholdCritical": 115.0, "UpperThresholdNonCritical": 110.0 }, { "@odata.id": "/redfish/v1/Chassis//Thermal#/Temperatures/1", "@odata.type": "#Thermal.v1_3_0.Temperature", "LowerThresholdCritical": 0.0, "LowerThresholdNonCritical": 5.0, "MaxReadingRangeTemp": 255.0, "MemberId": "CPU1_P12V_PVCCIN_VR_Temp", "MinReadingRangeTemp": 0.0, "Name": "CPU1 P12V PVCCIN VR Temp", "PhysicalContext": "CPU", "ReadingCelsius": 41.0, "Status": { "Health": "OK", "State": "Enabled" }, "UpperThresholdCritical": 115.0, "UpperThresholdNonCritical": 110.0 }, { "@odata.id": "/redfish/v1/Chassis//Thermal#/Temperatures/28", "@odata.type": "#Thermal.v1_3_0.Temperature", "LowerThresholdCritical": 0.0, "LowerThresholdNonCritical": 5.0, "MaxReadingRangeTemp": 127.0, "MemberId": "Inlet_BRD_Temp", "MinReadingRangeTemp": -128.0, "Name": "Inlet BRD Temp", "PhysicalContext": "Intake", "ReadingCelsius": 23.187, "Status": { "Health": "OK", "State": "Enabled" }, "UpperThresholdCritical": 115.0, "UpperThresholdNonCritical": 110.0 }, { @odata.id": "/redfish/v1/Chassis/F2U8X25_HSBP_2/Thermal#/Temperatures/0", @odata.type": "#Thermal.v1_3_0.Temperature", LowerThresholdCritical": 7.0, LowerThresholdNonCritical": 12.0, MaxReadingRangeTemp": 127.0, MemberId": "HSBP2_Temp", MinReadingRangeTemp": -128.0, Name": "HSBP2 Temp", PhysicalContext": "Backplane", ReadingCelsius": 21.437, Status": { "Health": "OK", "State": "Enabled" }, UpperThresholdCritical": 57.0, UpperThresholdNonCritical": 52.0 } 3. GET - https:///redfish/v1/Chassis//Power Response: { "@odata.id": "/redfish/v1/Chassis//Power#/Voltages/3", "@odata.type": "#Power.v1_0_0.Voltage", "LowerThresholdCritical": 1.648, "LowerThresholdNonCritical": 1.699, "MaxReadingRange": 2.3984009912875566, "MemberId": "P1V8_PCH", "MinReadingRange": 0.0, "Name": "P1V8 PCH", "ReadingVolts": 1.8055, "Status": { "Health": "OK", "State": "Enabled" }, "UpperThresholdCritical": 1.961, "UpperThresholdNonCritical": 1.904 } 4. GET - https:///redfish/v1/Chassis//Sensors/PSU1_Input_Current Response: { "@odata.id": "/redfish/v1/Chassis//Sensors/PSU1_Input_Current", "@odata.type": "#Sensor.v1_0_0.Sensor", "Id": "PSU1_Input_Current", "Name": "PSU1 Input Current", "Reading": 0.947, "ReadingRangeMax": 12.0, "ReadingRangeMin": 0.0, "ReadingType": "Current", "ReadingUnits": "A", "Status": { "Health": "OK", "State": "Enabled" } } Signed-off-by: Snehalatha Venkatesh Signed-off-by: sunitakx --- redfish-core/lib/sensors.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 5d27577..d51d09f 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -973,6 +973,22 @@ inline void objectInterfacesToJson( { unit = "/ReadingCelsius"_json_pointer; sensorJson["@odata.type"] = "#Thermal.v1_3_0.Temperature"; + if (sensorName.find("CPU") != std::string::npos) + { + sensorJson["PhysicalContext"] = "CPU"; + } + else if (sensorName.find("Inlet") != std::string::npos) + { + sensorJson["PhysicalContext"] = "Intake"; + } + else if (sensorName.find("HSBP") != std::string::npos) + { + sensorJson["PhysicalContext"] = "Backplane"; + } + else + { + sensorJson["PhysicalContext"] = "SystemBoard"; + } // TODO(ed) Documentation says that path should be type fan_tach, // implementation seems to implement fan } -- 2.17.1