requester: Modified MctpDiscovery class
Modified MctpDiscovery class to take list of managers instead of single
fwManager. The change is for adding platform-mc manager.
Added loadStaticEndpoints API for MCTP layer which doesn't implement
/xyz/openbmc_project/MCTP/Endpoint.Interface
The patch is part of implementation of design document below.
https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/47252
Signed-off-by: Gilbert Chen <gilbert.chen@arm.com>
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: I1e1673504583a87f2a9bc3adf76fb49c2dc30254
diff --git a/common/types.hpp b/common/types.hpp
index 0c7514c..90c94c6 100644
--- a/common/types.hpp
+++ b/common/types.hpp
@@ -16,10 +16,16 @@
{
using eid = uint8_t;
+using UUID = std::string;
using Request = std::vector<uint8_t>;
using Response = std::vector<uint8_t>;
using Command = uint8_t;
+using MctpMedium = std::string;
+using NetworkId = uint32_t;
+using MctpInfo = std::tuple<eid, UUID, MctpMedium, NetworkId>;
+using MctpInfos = std::vector<MctpInfo>;
+
namespace dbus
{
diff --git a/common/utils.cpp b/common/utils.cpp
index 9eed1be..e9b2c68 100644
--- a/common/utils.cpp
+++ b/common/utils.cpp
@@ -569,6 +569,18 @@
return bus.call(method).unpack<ObjectValueTree>();
}
+PropertyMap
+ DBusHandler::getDbusPropertiesVariant(const char* serviceName,
+ const char* objPath,
+ const char* dbusInterface) const
+{
+ auto& bus = DBusHandler::getBus();
+ auto method = bus.new_method_call(serviceName, objPath, dbusProperties,
+ "GetAll");
+ method.append(dbusInterface);
+ return bus.call(method, dbusTimeout).unpack<PropertyMap>();
+}
+
PropertyValue jsonEntryToDbusVal(std::string_view type,
const nlohmann::json& value)
{
diff --git a/common/utils.hpp b/common/utils.hpp
index c2bdb0d..10038b4 100644
--- a/common/utils.hpp
+++ b/common/utils.hpp
@@ -16,6 +16,7 @@
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Inventory/Manager/client.hpp>
#include <xyz/openbmc_project/Logging/Entry/server.hpp>
+#include <xyz/openbmc_project/ObjectMapper/client.hpp>
#include <deque>
#include <exception>
@@ -46,6 +47,14 @@
using Entities = std::vector<pldm_entity_node*>;
using EntityAssociations = std::vector<Entities>;
using ObjectPathMaps = std::map<fs::path, pldm_entity_node*>;
+using ObjectMapper = sdbusplus::client::xyz::openbmc_project::ObjectMapper<>;
+
+using inventoryManager =
+ sdbusplus::client::xyz::openbmc_project::inventory::Manager<>;
+
+constexpr auto dbusProperties = "org.freedesktop.DBus.Properties";
+constexpr auto mapperService = ObjectMapper::default_service;
+constexpr auto inventoryPath = "/xyz/openbmc_project/inventory";
const std::map<EntityType, EntityName> entityMaps = {
{PLDM_ENTITY_SYSTEM_CHASSIS, "chassis"},
@@ -166,13 +175,6 @@
return bcd;
}
-using inventoryManager =
- sdbusplus::client::xyz::openbmc_project::inventory::Manager<>;
-
-constexpr auto dbusProperties = "org.freedesktop.DBus.Properties";
-constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
-constexpr auto inventoryPath = "/xyz/openbmc_project/inventory";
-
struct DBusMapping
{
std::string objectPath; //!< D-Bus object path
@@ -220,6 +222,10 @@
virtual PropertyValue
getDbusPropertyVariant(const char* objPath, const char* dbusProp,
const char* dbusInterface) const = 0;
+
+ virtual PropertyMap
+ getDbusPropertiesVariant(const char* serviceName, const char* objPath,
+ const char* dbusInterface) const = 0;
};
/**
@@ -284,6 +290,20 @@
getDbusPropertyVariant(const char* objPath, const char* dbusProp,
const char* dbusInterface) const override;
+ /** @brief Get All properties(type: variant) from the requested dbus
+ *
+ * @param[in] serviceName - The Dbus service name
+ * @param[in] objPath - The Dbus object path
+ * @param[in] dbusInterface - The Dbus interface
+ *
+ * @return The values of the properties(type: variant)
+ *
+ * @throw sdbusplus::exception_t when it fails
+ */
+ PropertyMap
+ getDbusPropertiesVariant(const char* serviceName, const char* objPath,
+ const char* dbusInterface) const override;
+
/** @brief The template function to get property from the requested dbus
* path
*