summaryrefslogtreecommitdiff
path: root/redfish-core/lib/sensors.hpp
diff options
context:
space:
mode:
authorAdrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>2020-06-02 14:26:33 +0300
committerAdrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>2020-06-08 12:52:09 +0300
commitf8ede15e7ffc7ecc70429fa1ef53c13c95181910 (patch)
treef4b7c33c96ee75db26702784d788d1eeb4d90985 /redfish-core/lib/sensors.hpp
parentfb4fd5d43bc621e84add3499911a6f2a08694f8b (diff)
downloadbmcweb-f8ede15e7ffc7ecc70429fa1ef53c13c95181910.tar.xz
Add 'utilization' sensor to 'Sensors' page
Recent change to xyz.openbmc_project.Sensor.Value interface has introduced new type of sensor - 'utilization'. This change makes bmcweb able to expose this kind of sensors in Sensors schema under /Chassis/{}/Sensors. Testing: - implemented simple mocked sensor and verified that: -- sensor appears in /Chassis/{}/Sensors -- sensor values are properly shown in /Chassis/{}/Sensors/{} -- 'ReadingUnits' is shown in /Chassis/{}/Sensors/{} - RedfishServiceValidator passed Change-Id: I9e4dc0b9db049a9815e79a0a64df60f275eeb822 Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz@linux.intel.com>
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r--redfish-core/lib/sensors.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index b158c78829..35b312700d 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -764,6 +764,10 @@ void objectInterfacesToJson(
{
sensor_json["ReadingUnits"] = "Amperes";
}
+ else if (sensorType == "utilization")
+ {
+ sensor_json["ReadingUnits"] = "Percent";
+ }
}
else if (sensorType == "temperature")
{
@@ -2869,7 +2873,8 @@ class SensorCollection : public Node
private:
std::vector<const char*> typeList = {
"/xyz/openbmc_project/sensors/power",
- "/xyz/openbmc_project/sensors/current"};
+ "/xyz/openbmc_project/sensors/current",
+ "/xyz/openbmc_project/sensors/utilization"};
void doGet(crow::Response& res, const crow::Request& req,
const std::vector<std::string>& params) override
{