MCTP.Endpoint: use PDI constants
Use PDI constants for `xyz.openbmc_project.MCTP.Endpoint` interface
instead of defining them locally.
Tested: Inspection only.
Change-Id: I047069a493143564e938b72658e1af4a2927f6e9
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/requester/mctp_endpoint_discovery.cpp b/requester/mctp_endpoint_discovery.cpp
index cbcf333..41ad909 100644
--- a/requester/mctp_endpoint_discovery.cpp
+++ b/requester/mctp_endpoint_discovery.cpp
@@ -60,13 +60,13 @@
try
{
mapperResponse = pldm::utils::DBusHandler().getSubtree(
- MCTPPath, 0, std::vector<std::string>({MCTPInterface}));
+ MCTPPath, 0, std::vector<std::string>({MCTPEndpoint::interface}));
}
catch (const sdbusplus::exception_t& e)
{
error(
"Failed to getSubtree call at path '{PATH}' and interface '{INTERFACE}', error - {ERROR} ",
- "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPInterface);
+ "ERROR", e, "PATH", MCTPPath, "INTERFACE", MCTPEndpoint::interface);
return;
}
@@ -100,15 +100,19 @@
try
{
auto properties = pldm::utils::DBusHandler().getDbusPropertiesVariant(
- service.c_str(), path.c_str(), MCTPInterface);
+ service.c_str(), path.c_str(), MCTPEndpoint::interface);
- if (properties.contains("NetworkId") && properties.contains("EID") &&
- properties.contains("SupportedMessageTypes"))
+ if (properties.contains(MCTPEndpoint::property_names::network_id) &&
+ properties.contains(MCTPEndpoint::property_names::eid) &&
+ properties.contains(
+ MCTPEndpoint::property_names::supported_message_types))
{
- auto networkId = std::get<NetworkId>(properties.at("NetworkId"));
- auto eid = std::get<mctp_eid_t>(properties.at("EID"));
- auto types = std::get<std::vector<uint8_t>>(
- properties.at("SupportedMessageTypes"));
+ auto networkId = std::get<NetworkId>(
+ properties.at(MCTPEndpoint::property_names::network_id));
+ auto eid = std::get<mctp_eid_t>(
+ properties.at(MCTPEndpoint::property_names::eid));
+ auto types = std::get<std::vector<uint8_t>>(properties.at(
+ MCTPEndpoint::property_names::supported_message_types));
return MctpEndpointProps(networkId, eid, types);
}
}
@@ -208,17 +212,19 @@
for (const auto& [intfName, properties] : interfaces)
{
- if (intfName == MCTPInterface)
+ if (intfName == MCTPEndpoint::interface)
{
- if (properties.contains("NetworkId") &&
- properties.contains("EID") &&
- properties.contains("SupportedMessageTypes"))
+ if (properties.contains(MCTPEndpoint::property_names::network_id) &&
+ properties.contains(MCTPEndpoint::property_names::eid) &&
+ properties.contains(
+ MCTPEndpoint::property_names::supported_message_types))
{
- auto networkId =
- std::get<NetworkId>(properties.at("NetworkId"));
- auto eid = std::get<mctp_eid_t>(properties.at("EID"));
- auto types = std::get<std::vector<uint8_t>>(
- properties.at("SupportedMessageTypes"));
+ auto networkId = std::get<NetworkId>(
+ properties.at(MCTPEndpoint::property_names::network_id));
+ auto eid = std::get<mctp_eid_t>(
+ properties.at(MCTPEndpoint::property_names::eid));
+ auto types = std::get<std::vector<uint8_t>>(properties.at(
+ MCTPEndpoint::property_names::supported_message_types));
if (!availability)
{
@@ -310,8 +316,8 @@
if (key == MCTPConnectivityProp)
{
- service = pldm::utils::DBusHandler().getService(objPath.c_str(),
- MCTPInterface);
+ service = pldm::utils::DBusHandler().getService(
+ objPath.c_str(), MCTPEndpoint::interface);
const MctpEndpointProps& epProps =
getMctpEndpointProps(service, objPath);
diff --git a/requester/mctp_endpoint_discovery.hpp b/requester/mctp_endpoint_discovery.hpp
index 7692849..1db6292 100644
--- a/requester/mctp_endpoint_discovery.hpp
+++ b/requester/mctp_endpoint_discovery.hpp
@@ -6,11 +6,14 @@
#include <libpldm/pldm.h>
#include <sdbusplus/bus/match.hpp>
+#include <xyz/openbmc_project/MCTP/Endpoint/client.hpp>
#include <filesystem>
#include <initializer_list>
#include <vector>
+using MCTPEndpoint = sdbusplus::common::xyz::openbmc_project::mctp::Endpoint;
+
class TestMctpDiscovery;
namespace pldm
@@ -18,7 +21,6 @@
const std::string emptyUUID = "00000000-0000-0000-0000-000000000000";
constexpr const char* MCTPService = "au.com.codeconstruct.MCTP1";
-constexpr const char* MCTPInterface = "xyz.openbmc_project.MCTP.Endpoint";
constexpr const char* EndpointUUID = "xyz.openbmc_project.Common.UUID";
constexpr const char* MCTPPath = "/au/com/codeconstruct/mctp1";
constexpr const char* MCTPInterfaceCC = "au.com.codeconstruct.MCTP.Endpoint1";