Refactor getAssociationEndPoints method
Since the getAssociationEndPoints method has been implemented in
dbus_utility and this commit is to integrate all the places where the
endpoints attribute is obtained, and use the method in dbus_utility
uniformly.
Tested:
1. Redfish Validator Passed
2. For all the endpoints we changed, we got the same result as before
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I91a5e80de5bc3b5712c2d5b81f2f8b982d1c884e
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 5f3ccd3..0388ccd 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -702,12 +702,11 @@
asyncResp->res.jsonValue["Name"] = "Drive Collection";
// Association lambda
- sdbusplus::asio::getProperty<std::vector<std::string>>(
- *crow::connections::systemBus,
- "xyz.openbmc_project.ObjectMapper", path + "/drive",
- "xyz.openbmc_project.Association", "endpoints",
- [asyncResp, chassisId](const boost::system::error_code& ec3,
- const std::vector<std::string>& resp) {
+ dbus::utility::getAssociationEndPoints(
+ path + "/drive",
+ [asyncResp,
+ chassisId](const boost::system::error_code& ec3,
+ const dbus::utility::MapperEndPoints& resp) {
if (ec3)
{
BMCWEB_LOG_ERROR << "Error in chassis Drive association ";
@@ -867,13 +866,11 @@
continue;
}
- sdbusplus::asio::getProperty<std::vector<std::string>>(
- *crow::connections::systemBus,
- "xyz.openbmc_project.ObjectMapper", path + "/drive",
- "xyz.openbmc_project.Association", "endpoints",
+ dbus::utility::getAssociationEndPoints(
+ path + "/drive",
[asyncResp, chassisId,
driveName](const boost::system::error_code& ec3,
- const std::vector<std::string>& resp) {
+ const dbus::utility::MapperEndPoints& resp) {
if (ec3)
{
return; // no drives = no failures