Move bmcweb over to sdbusplus
This patchset moves bmcweb from using boost-dbus over entirely to
sdbusplus. This has some nice improvements in performance (about 30%
of CPU cycles saved in dbus transactions), as well as makes this
project manuver closer to the upstream way of thinking.
Changes to bmcweb are largely ceremonial, and fall into a few
categories:
1. Moves async_method_call instances to the new format, and deletes any
use of the "endpoint" object in leiu of the sdbusplus style interface
2. sdbus object_path object doesn't allow access to the string
directly, so code that uses it moves to explicit casts.
3. The mapbox variant, while attempting to recreate boost::variant,
misses a T* get<T*>() method implementation, which allows using variant
without exceptions. Currently, there is an overload for
mapbox::get_ptr implementation which replecates the functionality.
Tested by: Booting the bmcweb on a target, iterating through redfish
basic phosphor-webui usage, and websockets usage
Change-Id: I2d95882908d6eb6dba00b9219a221dd96449ca7b
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/include/redfish_v1.hpp b/include/redfish_v1.hpp
index c28208d..03b9051 100644
--- a/include/redfish_v1.hpp
+++ b/include/redfish_v1.hpp
@@ -1,10 +1,6 @@
#pragma once
-#include <dbus/connection.hpp>
-#include <dbus/endpoint.hpp>
-#include <dbus/filter.hpp>
-#include <dbus/match.hpp>
-#include <dbus/message.hpp>
+#include <dbus_singleton.hpp>
#include <persistent_data_middleware.hpp>
#include <token_authorization_middleware.hpp>
#include <fstream>
@@ -43,10 +39,13 @@
return result;
}
+// GetManagedObjects unpack type. Observe that variant has only one bool type,
+// because we don't actually use the values it provides
using ManagedObjectType = std::vector<std::pair<
- dbus::object_path, boost::container::flat_map<
- std::string, boost::container::flat_map<
- std::string, dbus::dbus_variant>>>>;
+ sdbusplus::message::object_path,
+ boost::container::flat_map<
+ std::string, boost::container::flat_map<
+ std::string, sdbusplus::message::variant<bool>>>>>;
template <typename... Middlewares>
void request_routes(Crow<Middlewares...>& app) {
@@ -79,7 +78,8 @@
nlohmann::json member_array = nlohmann::json::array();
int user_index = 0;
for (auto& user : users) {
- const std::string& path = user.first.value;
+ const std::string& path =
+ static_cast<std::string>(user.first);
std::size_t last_index = path.rfind("/");
if (last_index == std::string::npos) {
last_index = 0;
@@ -94,8 +94,8 @@
}
res.end();
},
- {"xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
- "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"});
+ "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
+ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
});
CROW_ROUTE(app, "/redfish/v1/AccountService/Accounts/<str>/")
@@ -110,7 +110,8 @@
res.code = 500;
} else {
for (auto& user : users) {
- const std::string& path = user.first.value;
+ const std::string& path =
+ static_cast<std::string>(user.first);
std::size_t last_index = path.rfind("/");
if (last_index == std::string::npos) {
last_index = 0;
@@ -145,8 +146,8 @@
}
res.end();
},
- {"xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
- "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"});
+ "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user",
+ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
});
}
} // namespace redfish