diff options
author | Shawn McCarney <shawnmm@us.ibm.com> | 2019-05-03 21:20:24 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-05-09 20:02:40 +0300 |
commit | 26f0389959179b37bae5410dfd5a84831fbdaee6 (patch) | |
tree | 113dda0097e517c902aea8219176189627c3693e /redfish-core/lib/sensors.hpp | |
parent | 49c53ac9b88fbf71f55076121a1605a760fa0096 (diff) | |
download | bmcweb-26f0389959179b37bae5410dfd5a84831fbdaee6.tar.xz |
Redfish: Remove BMCWEB_ENABLE_REDFISH_ONE_CHASSIS
Removed the BMCWEB_ENABLE_REDFISH_ONE_CHASSIS #define. The new support
for finding chassis sensors via associations is now used on all systems.
Test Plan:
https://gist.github.com/smccarney/f5b4783d8cf41a486ceff9b941b1ba9a
Tested: Verified the Chassis, Power, and Thermal output was valid on a
Witherspoon system. Verified sensor associations on Witherspoon
work with bmcweb implementation. Ran Redfish Service Validator.
Change-Id: I975f79da2c9de63e4ddd155d39ea872ca9fbffa9
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r-- | redfish-core/lib/sensors.hpp | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 69ee983184..6fba7c07be 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -28,8 +28,6 @@ namespace redfish { -constexpr const char* dbusSensorPrefix = "/xyz/openbmc_project/sensors/"; - using GetSubTreeType = std::vector< std::pair<std::string, std::vector<std::pair<std::string, std::vector<std::string>>>>>; @@ -172,65 +170,6 @@ void getConnections( } /** - * @brief Gets all DBus sensor names. - * - * Finds the sensor names asynchronously. Invokes callback when information has - * been obtained. - * - * The callback must have the following signature: - * @code - * callback(boost::container::flat_set<std::string>& sensorNames) - * @endcode - * - * @param SensorsAsyncResp Pointer to object holding response data. - * @param callback Callback to invoke when sensor names obtained. - */ -template <typename Callback> -void getAllSensors(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp, - Callback&& callback) -{ - BMCWEB_LOG_DEBUG << "getAllSensors enter"; - const std::array<std::string, 1> interfaces = { - "xyz.openbmc_project.Sensor.Value"}; - - // Response handler for GetSubTreePaths DBus method - auto respHandler = [callback{std::move(callback)}, SensorsAsyncResp]( - const boost::system::error_code ec, - const std::vector<std::string>& sensorList) { - BMCWEB_LOG_DEBUG << "getAllSensors respHandler enter"; - if (ec) - { - messages::internalError(SensorsAsyncResp->res); - BMCWEB_LOG_ERROR << "getAllSensors respHandler: DBus error " << ec; - return; - } - boost::container::flat_set<std::string> sensorNames; - for (const std::string& sensor : sensorList) - { - std::size_t lastPos = sensor.rfind("/"); - if (lastPos == std::string::npos) - { - BMCWEB_LOG_ERROR << "Failed to find '/' in " << sensor; - continue; - } - std::string sensorName = sensor.substr(lastPos + 1); - sensorNames.emplace(sensorName); - BMCWEB_LOG_DEBUG << "Added sensor name " << sensorName; - } - callback(sensorNames); - BMCWEB_LOG_DEBUG << "getAllSensors respHandler exit"; - }; - - // Query mapper for all DBus sensor object paths - crow::connections::systemBus->async_method_call( - std::move(respHandler), "xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", - "/xyz/openbmc_project/sensors", int32_t(0), interfaces); - BMCWEB_LOG_DEBUG << "getAllSensors exit"; -} - -/** * @brief Shrinks the list of sensors for processing * @param SensorsAysncResp The class holding the Redfish response * @param allSensors A list of all the sensors associated to the @@ -1076,13 +1015,8 @@ void getChassisData(std::shared_ptr<SensorsAsyncResp> SensorsAsyncResp) BMCWEB_LOG_DEBUG << "getChassisCb exit"; }; -#ifdef BMCWEB_ENABLE_REDFISH_ONE_CHASSIS - // Get all sensor names - getAllSensors(SensorsAsyncResp, std::move(getChassisCb)); -#else - // Get sensor names in chassis + // Get set of sensors in chassis getChassis(SensorsAsyncResp, std::move(getChassisCb)); -#endif BMCWEB_LOG_DEBUG << "getChassisData exit"; }; |