Patch support for sensor overrride

Support added for overriding sensor, which can be
used for validation / ad-hoc debugging. This provides
option to make PATCH call to redfish/v1/<chassisId>/Thermal
or power id. Based on schema, will accept Temperatures /
Voltages collection with properties MemberId and
ReadingCelsius / ReadingVolts.

TODO:
1. Need to make a dynamic way of enabling / disbaling this command.

Unit-Test:
1. Verified sensor values are getting updated by doing PATCH
method to a known sensor. Verified the value got updated
using ipmitool sensor list.
2. Verified negative cases of making PATCH call on invalid
chasisId, Invalid MemberId etc.

Testedeby:
Used Postman tool to issue the PATCH call to the
1. https://xx.xx.xx.xx/redfish/v1/Chassis/XXYYZZ/Thermal with
content
{
  "Temperatures": [
    {
      "MemberId" : "SensorNameXX",
      "ReadingCelsius" : valueXX
    }
  ]
}
2. https://xx.xx.xx.xx/redfish/v1/Chassis/XXYYZZ/Power with
content
{
  "Voltages": [
    {
      "MemberId" : "SensorNameXX",
      "ReadingVolts" : valueXX
    }
  ]
}

Change-Id: Idf2d891ac0d10b5d20f78c386232cae8a6896f1a
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index 0cb1aa0..a76f191 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -38,6 +38,9 @@
     }
 
   private:
+    std::initializer_list<const char*> typeList = {
+        "/xyz/openbmc_project/sensors/voltage",
+        "/xyz/openbmc_project/sensors/power"};
     void doGet(crow::Response& res, const crow::Request& req,
                const std::vector<std::string>& params) override
     {
@@ -56,14 +59,15 @@
         res.jsonValue["Id"] = "Power";
         res.jsonValue["Name"] = "Power";
         auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
-            res, chassis_name,
-            std::initializer_list<const char*>{
-                "/xyz/openbmc_project/sensors/voltage",
-                "/xyz/openbmc_project/sensors/power"},
-            "Power");
+            res, chassis_name, typeList, "Power");
         // TODO Need to retrieve Power Control information.
         getChassisData(sensorAsyncResp);
     }
+    void doPatch(crow::Response& res, const crow::Request& req,
+                 const std::vector<std::string>& params) override
+    {
+        setSensorOverride(res, req, params, typeList, "Power");
+    }
 };
 
 } // namespace redfish