From 397fd61f34fab6922cdf84c4f411a2b1bd174a1f Mon Sep 17 00:00:00 2001 From: jayaprakash Mutyala Date: Thu, 6 Feb 2020 23:33:34 +0000 Subject: Remove unused variables for setSensorsOverride Remove unused variables for setSensorsOverride and checkAndDoSensorsOverride methods Tested: 1. Redfish validator - passed for this new change Case 1: 1. Enable manufacturing mode by pressing power button while bmc booting 2. Patch sensor values from Redfish. Redfish URI: PATCH https:///redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } Response: { "@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [], "Id": "Thermal", "Name": "Thermal", "Temperatures": [] } 3. Sensor value Overridden successfully Case 2: Varified for ValidationUnsecure mode. Case 3: Tested without SpecialMode mode 1. Stop the specialmodemgr.service service 2. Patch sensor values from Redfish. 3. Sensor value Overridden successfully Case 4: 1. Disable manufacturing mode Command: ipmitool raw 0x30 0xB4 3 0 Response: //Success 2. Patch sensor values from Redfish. Redfish URI: PATCH https:///redfish/v1/Chassis/WC_Baseboard/Thermal Body: { "Temperatures": [ { "MemberId": "SSB_Temp", "ReadingCelsius":112 } ] } 3. Returning proper error. Response : { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The action Overriding of Sensor Value for non manufacturing mode is not supported by the resource.", "MessageArgs": [ "Overriding of Sensor Value for non manufacturing mode" ], "MessageId": "Base.1.4.0.ActionNotSupported", "Resolution": "The action supplied cannot be resubmitted to the implementation. Perhaps the action was invalid, the wrong resource was the target or the implementation documentation may be of assistance.", "Severity": "Critical" } ], "code": "Base.1.4.0.ActionNotSupported", "message": "The action Overriding of Sensor Value for non manufacturing mode is not supported by the resource." } } Signed-off-by: jayaprakash Mutyala Change-Id: I0598f1ff16a391864cd1371e514fb8da1797d8d5 --- redfish-core/lib/power.hpp | 3 +-- redfish-core/lib/sensors.hpp | 24 +++++++++--------------- redfish-core/lib/thermal.hpp | 3 +-- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp index 5e6ba8a8f0..67e40b2ec9 100644 --- a/redfish-core/lib/power.hpp +++ b/redfish-core/lib/power.hpp @@ -360,8 +360,7 @@ class Power : public Node std::unordered_map> allCollections; allCollections.emplace("Voltages", *std::move(voltageCollections)); - checkAndDoSensorsOverride(asyncResp, allCollections, chassisName, - typeList); + checkAndDoSensorsOverride(asyncResp, allCollections); } } }; diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 6c1f830545..3caaeedec9 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -2597,14 +2597,12 @@ bool findSensorNameUsingSensorPath( * * @param res response object * @param allCollections Collections extract from sensors' request patch info - * @param typeList TypeList of sensors for the resource queried * @param chassisSubNode Chassis Node for which the query has to happen */ void setSensorsOverride( std::shared_ptr sensorAsyncResp, std::unordered_map>& - allCollections, - const std::string& chassisName, const std::vector typeList) + allCollections) { BMCWEB_LOG_INFO << "setSensorsOverride for subNode" << sensorAsyncResp->chassisSubNode << "\n"; @@ -2752,13 +2750,12 @@ bool isOverridingAllowed(const std::string& manufacturingModeStatus) * * @param res response object * @param allCollections Collections extract from sensors' request patch info - * @param typeList TypeList of sensors for the resource queried - * @param chassisSubNode Chassis Node for which the query has to happen + * @param chassisSubNode Chassis Node for which the query has to happen */ void checkAndDoSensorsOverride( std::shared_ptr sensorAsyncResp, - std::unordered_map>& allCollect, - const std::string& chassisName, const std::vector typeList) + std::unordered_map>& + allCollections) { BMCWEB_LOG_INFO << "checkAndDoSensorsOverride for subnode" << sensorAsyncResp->chassisSubNode << "\n"; @@ -2767,9 +2764,8 @@ void checkAndDoSensorsOverride( "xyz.openbmc_project.Security.SpecialMode"}; crow::connections::systemBus->async_method_call( - [sensorAsyncResp, allCollect, chassisName, - typeList](const boost::system::error_code ec, - const GetSubTreeType& resp) mutable { + [sensorAsyncResp, allCollections](const boost::system::error_code ec, + const GetSubTreeType& resp) mutable { if (ec) { BMCWEB_LOG_DEBUG @@ -2782,8 +2778,7 @@ void checkAndDoSensorsOverride( { // Special mode manager doesn't exist, proceed with sensor // override - setSensorsOverride(sensorAsyncResp, allCollect, chassisName, - typeList); + setSensorsOverride(sensorAsyncResp, allCollections); return; } @@ -2807,7 +2802,7 @@ void checkAndDoSensorsOverride( // Sensor override is allowed only in manufacturing mode or // validation unsecure mode . crow::connections::systemBus->async_method_call( - [sensorAsyncResp, allCollect, chassisName, typeList, + [sensorAsyncResp, allCollections, path](const boost::system::error_code ec, std::variant& getManufactMode) mutable { if (ec) @@ -2833,8 +2828,7 @@ void checkAndDoSensorsOverride( { BMCWEB_LOG_INFO << "Manufacturing mode is Enabled. " "Proceeding further... "; - setSensorsOverride(sensorAsyncResp, allCollect, - chassisName, typeList); + setSensorsOverride(sensorAsyncResp, allCollections); } else { diff --git a/redfish-core/lib/thermal.hpp b/redfish-core/lib/thermal.hpp index ac74657e25..28b11a5d26 100644 --- a/redfish-core/lib/thermal.hpp +++ b/redfish-core/lib/thermal.hpp @@ -98,8 +98,7 @@ class Thermal : public Node allCollections.emplace("Fans", *std::move(fanCollections)); } - checkAndDoSensorsOverride(asyncResp, allCollections, chassisName, - typeList); + checkAndDoSensorsOverride(asyncResp, allCollections); } }; -- cgit v1.2.3