diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2019-07-02 21:07:16 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-07-08 21:27:01 +0300 |
commit | 7ab06f49454378a9b5c1934f5e155a4f3c352fdb (patch) | |
tree | 054ebc8ac919e37eb6c59a3c7dd059f7099cd96b /redfish-core/lib/power.hpp | |
parent | 27062605f8ddbafeec691ed9556fe90f2c1ab8d2 (diff) | |
download | bmcweb-7ab06f49454378a9b5c1934f5e155a4f3c352fdb.tar.xz |
Move PowerLimit to correct location
See the following Redfish Validator errors and warning:
/redfish/v1/Chassis/chassis/Power
ERROR - PowerLimit not defined in schema Power.v1_5_2
(check version, spelling and casing)
/redfish/v1/Chassis/chassis/Power#/PowerControl/
ERROR - Decoded object no longer a dictionary /redfish/v1/Chassis/chassis/Power
ERROR - @odata.id of ReferenceableMember does not properly
resolve: /redfish/v1/Chassis/chassis/Power#/PowerControl/
WARNING - No @odata.type present, assuming highest type
Power.v1_0_0.PowerControl Power.v1_4_0.PowerControl
If you look at the specification/mockups, PowerLimit is
under PowerControl.
From the https://redfish.dmtf.org/redfish/mockups/v1/893 mockup:
PowerControl": [
{
"@odata.id": "/redfish/v1/Chassis/1U/Power#/PowerControl/0",
"MemberId": "0",
...
"PowerAvailableWatts": 0,
"PowerCapacityWatts": 800,
...
"PowerLimit": {
"LimitInWatts": 500,
"LimitException": "LogEventOnly",
"CorrectionInMs": 50
} ,
...
}
],
Added an odata.type and fixed the odata.id for PowerControl.
Put all power control sensors under the same PowerControl
like we do for PowerSupplies.
Tested: No longer see the errors.
If no total_power (happens when a Open Power system is off):
curl -k https://${bmc}/redfish/v1/Chassis/chassis/Power
...
"PowerControl": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
"@odata.type": "#Power.v1_0_0.PowerControl",
"MemberId": "0",
"Name": "Chassis Power Control",
"PowerLimit": {
"LimitInWatts": null
}
}
],
"Redundancy": [],
...
curl -k https://${bmc}/redfish/v1/Chassis/chassis/Power/
{
"PowerControl": [
{
"@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
"@odata.type": "#Power.v1_0_0.PowerControl",
"MemberId": "0",
"Name": "Chassis Power Control",
"PowerConsumedWatts": 232.0,
"PowerLimit": {
"LimitInWatts": null
},
"Status": {
"Health": "OK",
"State": "Enabled"
Change-Id: I8ca47bd6c7dedf5d0685886e2e45e6f964f69060
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'redfish-core/lib/power.hpp')
-rw-r--r-- | redfish-core/lib/power.hpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp index e6f1ebaffc..8c3927b8d0 100644 --- a/redfish-core/lib/power.hpp +++ b/redfish-core/lib/power.hpp @@ -124,11 +124,21 @@ class Power : public Node } nlohmann::json& tempArray = - sensorAsyncResp->res.jsonValue["PowerLimit"]; + sensorAsyncResp->res.jsonValue["PowerControl"]; + // Put multiple "sensors" into a single PowerControl, 0, so + // only create the first one if (tempArray.empty()) { - tempArray.push_back({}); + // Mandatory properties odata.id and MemberId + // A warning without a odata.type + tempArray.push_back( + {{"@odata.type", "#Power.v1_0_0.PowerControl"}, + {"@odata.id", "/redfish/v1/Chassis/" + + sensorAsyncResp->chassisId + + "/Power#/PowerControl/0"}, + {"Name", "Chassis Power Control"}, + {"MemberId", "0"}}); } nlohmann::json& sensorJson = tempArray.back(); @@ -188,7 +198,8 @@ class Power : public Node } } - nlohmann::json& value = sensorJson["LimitInWatts"]; + nlohmann::json& value = + sensorJson["PowerLimit"]["LimitInWatts"]; if (enabled) { |