Add compile flag to turn off the old Power/Thermal

The compile flag should initially be enable(allowing the old
Power/Thermal). At a later date,we can move this flag to
defaulted off. At an even later date we can remove the old
Power/Thermal implementation.

Test:
1. Validator passed.
2.The default value is enable, so old Power/Thermal can be used
normally.Use the curl commond, old Power/Thermal still exists.
~$ curl -i -k -H "X-Auth-Token: $token" -X GET
"https://${bmc}/redfish/v1/Chassis/chassis"
{
"@odata.id": "/redfish/v1/Chassis/chassis",
"@odata.type": "#Chassis.v1_15_0.Chassis",
"Actions": {
"#Chassis.Reset": {
"@Redfish.ActionInfo": "/redfish/v1/Chassis/chassis/ResetActionInfo",
"target": "/redfish/v1/Chassis/chassis/Actions/Chassis.Reset"
}
},
"ChassisType": "RackMount",
"Id": "chassis",
"Links": {
"ComputerSystems": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
]
},
"Name": "chassis",
"PCIeDevices": {
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices"
},
"PCIeSlots": {
"@odata.id": "/redfish/v1/Chassis/chassis/PCIeSlots"
},
"Power": {
"@odata.id": "/redfish/v1/Chassis/chassis/Power"
},
"PowerState": "Off",
"PowerSubsystem": {
"@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem"
},
"Sensors": {
"@odata.id": "/redfish/v1/Chassis/chassis/Sensors"
},
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "StandbyOffline"
},
"Thermal": {
"@odata.id": "/redfish/v1/Chassis/chassis/Thermal"
}
}

Signed-off-by: zhanghaicheng <zhanghch05@inspur.com>
Change-Id: Id3556c18dc6aac95fd5aa02cdf2983378c01fb68
diff --git a/meson.build b/meson.build
index a7e8243..cf1bc3c 100644
--- a/meson.build
+++ b/meson.build
@@ -213,6 +213,15 @@
               },section : 'Enabled Features')
     endif
 
+    if( get_option('redfish-allow-deprecated-power-thermal').enabled())
+     add_project_arguments([
+       '-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL'
+       ],
+      language : 'cpp')
+
+      summary({'power-thermal' :'-DBMCWEB_ALLOW_DEPRECATED_POWER_THERMAL'
+              },section : 'Enabled Features')
+    endif
   endif
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 92f13e7..b938e82 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -29,6 +29,7 @@
 option('ibm-management-console', type : 'feature', value : 'disabled', description : 'Enable the IBM management console specific functionality. Paths are under \'/ibm/v1/\'')
 option('http-body-limit', type: 'integer', min : 0, max : 512, value : 30, description : 'Specifies the http request body length limit')
 option('redfish-allow-deprecated-hostname-patch', type : 'feature', value : 'disabled', description : 'Enable/disable Managers/bmc/NetworkProtocol HostName PATCH commands. The default condition is to prevent HostName changes from this URI, following the Redfish schema. Enabling this switch permits the HostName to be PATCHed at this URI. In Q4 2021 this feature will be removed, and the Redfish schema enforced, making the HostName read-only.')
+option('redfish-allow-deprecated-power-thermal', type : 'feature', value : 'enabled', description : 'Enable/disable the old Power / Thermal. The default condition is allowing the old Power / Thermal.')
 
 # Insecure options. Every option that starts with a `insecure` flag should
 # not be enabled by default for any platform, unless the author fully comprehends
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index e4d732c..1c7b695 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -68,13 +68,15 @@
         requestRoutesNetworkProtocol(app);
         requestRoutesSession(app);
         requestEthernetInterfacesRoutes(app);
+#ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
         requestRoutesThermal(app);
+        requestRoutesPower(app);
+#endif
         requestRoutesManagerCollection(app);
         requestRoutesManager(app);
         requestRoutesManagerResetAction(app);
         requestRoutesManagerResetActionInfo(app);
         requestRoutesManagerResetToDefaultsAction(app);
-        requestRoutesPower(app);
         requestRoutesChassisCollection(app);
         requestRoutesChassis(app);
         requestRoutesChassisResetAction(app);
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index b072818..8fa25f0 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -362,6 +362,7 @@
                                 }
                                 asyncResp->res.jsonValue["Name"] = chassisId;
                                 asyncResp->res.jsonValue["Id"] = chassisId;
+#ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
                                 asyncResp->res.jsonValue["Thermal"] = {
                                     {"@odata.id", "/redfish/v1/Chassis/" +
                                                       chassisId + "/Thermal"}};
@@ -369,6 +370,7 @@
                                 asyncResp->res.jsonValue["Power"] = {
                                     {"@odata.id", "/redfish/v1/Chassis/" +
                                                       chassisId + "/Power"}};
+#endif
                                 // SensorCollection
                                 asyncResp->res.jsonValue["Sensors"] = {
                                     {"@odata.id", "/redfish/v1/Chassis/" +