summaryrefslogtreecommitdiff
path: root/redfish-core/lib/sensors.hpp
diff options
context:
space:
mode:
authorBruce Lee <Bruce_Lee@quantatw.com>2021-06-04 10:41:39 +0300
committerBruce Lee <Bruce_Lee@quantatw.com>2021-06-04 10:41:39 +0300
commit80ac402428ec8c5f61a28829f3222ee3fe51e426 (patch)
treeacdbcc2cf09f438b3bb650d1c82c545cdf867323 /redfish-core/lib/sensors.hpp
parent90e97e1d26b78d899a543831a8051dacbbdde71a (diff)
downloadbmcweb-80ac402428ec8c5f61a28829f3222ee3fe51e426.tar.xz
Remove checkAndDoSensorsOverride function
Remove checkAndDoSensorsOverride function, this will be handled via dbus-sensor when the user set-value from external. This is unlikely to break any users because the Intel special mode function is no change, only move to dbus-sensor to handle, "busctl" command also belongs to the external setting, so move to dbus-sensor is more suitable, this will including users to set value use busctl command and Redfish from external. Dbus-sensor needs to be merged at the same time. Dbus-sensor changes are pushed to Gerrit: https://gerrit.openbmc-project.xyz/c/openbmc/dbus-sensors/+/42453 The mailing list discussion links: https://lists.ozlabs.org/pipermail/openbmc/2021-March/025597.html Signed-off-by: Bruce Lee <Bruce_Lee@quantatw.com> Change-Id: I74356f2b65e41cc0e9d8947c160f313334b78331
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r--redfish-core/lib/sensors.hpp130
1 files changed, 0 insertions, 130 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 0fc7e702db..b476d32e37 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -2938,136 +2938,6 @@ inline void setSensorsOverride(
getChassis(sensorAsyncResp, std::move(getChassisSensorListCb));
}
-inline bool isOverridingAllowed(const std::string& manufacturingModeStatus)
-{
- if (manufacturingModeStatus ==
- "xyz.openbmc_project.Control.Security.SpecialMode.Modes.Manufacturing")
- {
- return true;
- }
-
-#ifdef BMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE
- if (manufacturingModeStatus == "xyz.openbmc_project.Control.Security."
- "SpecialMode.Modes.ValidationUnsecure")
- {
- return true;
- }
-
-#endif
-
- return false;
-}
-
-/**
- * @brief Entry point for Checking the manufacturing mode before doing sensor
- * override values of given sensor
- *
- * @param sensorAsyncResp response object
- * @param allCollections Collections extract from sensors' request patch info
- * @param chassisSubNode Chassis Node for which the query has to happen
- */
-inline void checkAndDoSensorsOverride(
- const std::shared_ptr<SensorsAsyncResp>& sensorAsyncResp,
- std::unordered_map<std::string, std::vector<nlohmann::json>>&
- allCollections)
-{
- BMCWEB_LOG_INFO << "checkAndDoSensorsOverride for subnode"
- << sensorAsyncResp->chassisSubNode << "\n";
-
- const std::array<std::string, 1> interfaces = {
- "xyz.openbmc_project.Security.SpecialMode"};
-
- crow::connections::systemBus->async_method_call(
- [sensorAsyncResp, allCollections](const boost::system::error_code ec2,
- const GetSubTreeType& resp) mutable {
- if (ec2)
- {
- BMCWEB_LOG_DEBUG
- << "Error in querying GetSubTree with Object Mapper. "
- << ec2;
- messages::internalError(sensorAsyncResp->asyncResp->res);
- return;
- }
-#ifdef BMCWEB_INSECURE_UNRESTRICTED_SENSOR_OVERRIDE
- // Proceed with sensor override
- setSensorsOverride(sensorAsyncResp, allCollections);
- return;
-#endif
-
- if (resp.size() != 1)
- {
- BMCWEB_LOG_WARNING
- << "Overriding sensor value is not allowed - Internal "
- "error in querying SpecialMode property.";
- messages::internalError(sensorAsyncResp->asyncResp->res);
- return;
- }
- const std::string& path = resp[0].first;
- const std::string& serviceName = resp[0].second.begin()->first;
-
- if (path.empty() || serviceName.empty())
- {
- BMCWEB_LOG_DEBUG
- << "Path or service name is returned as empty. ";
- messages::internalError(sensorAsyncResp->asyncResp->res);
- return;
- }
-
- // Sensor override is allowed only in manufacturing mode or
- // validation unsecure mode .
- crow::connections::systemBus->async_method_call(
- [sensorAsyncResp, allCollections,
- path](const boost::system::error_code ec,
- std::variant<std::string>& getManufactMode) mutable {
- if (ec)
- {
- BMCWEB_LOG_DEBUG
- << "Error in querying Special mode property " << ec;
- messages::internalError(
- sensorAsyncResp->asyncResp->res);
- return;
- }
-
- const std::string* manufacturingModeStatus =
- std::get_if<std::string>(&getManufactMode);
-
- if (nullptr == manufacturingModeStatus)
- {
- BMCWEB_LOG_DEBUG << "Sensor override mode is not "
- "Enabled. Returning ... ";
- messages::internalError(
- sensorAsyncResp->asyncResp->res);
- return;
- }
-
- if (isOverridingAllowed(*manufacturingModeStatus))
- {
- BMCWEB_LOG_INFO << "Manufacturing mode is Enabled. "
- "Proceeding further... ";
- setSensorsOverride(sensorAsyncResp, allCollections);
- }
- else
- {
- BMCWEB_LOG_WARNING
- << "Manufacturing mode is not Enabled...can't "
- "Override the sensor value. ";
-
- messages::actionNotSupported(
- sensorAsyncResp->asyncResp->res,
- "Overriding of Sensor Value for non "
- "manufacturing mode");
- return;
- }
- },
- serviceName, path, "org.freedesktop.DBus.Properties", "Get",
- "xyz.openbmc_project.Security.SpecialMode", "SpecialMode");
- },
-
- "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", 5, interfaces);
-}
-
/**
* @brief Retrieves mapping of Redfish URIs to sensor value property to D-Bus
* path of the sensor.