Drop support for old association interface
A new association interface is defined in phosphor-dbus-interfaces
It would be nice to move the local version of the interface
to the new one.
The behavior of how association work is described here:
https://github.com/openbmc/docs/blob/master/object-mapper.md#associations
I did some searching and confirmed that all the old interfaces
(except the openbmc/pyphosphor, but we have removed support for python)
should have been removed, so drop the support for the old interface here.
Partially resolves openbmc/openbmc#3584
In addition, when I commited this change, ci reported code format error:
@libmapper/mapper.h
-int mapper_wait_async(sd_bus*, sd_event*, char* [], void (*)(int, void*), void*,
+int mapper_wait_async(sd_bus*, sd_event*, char*[], void (*)(int, void*), void*,
Fixed that.
Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: I0c2d0458a3f55f4671b91f6492e7218ecc3df4aa
diff --git a/src/main.cpp b/src/main.cpp
index 0b254ec..a42c1fe 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,7 +8,6 @@
#include <tinyxml2.h>
#include <atomic>
-#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_map.hpp>
#include <chrono>
@@ -130,8 +129,7 @@
void do_associations(sdbusplus::asio::connection* system_bus,
interface_map_type& interfaceMap,
sdbusplus::asio::object_server& objectServer,
- const std::string& processName, const std::string& path,
- const std::string& assocDefIface)
+ const std::string& processName, const std::string& path)
{
system_bus->async_method_call(
[&objectServer, path, processName, &interfaceMap](
@@ -149,7 +147,7 @@
interfaceMap, associationMaps);
},
processName, path, "org.freedesktop.DBus.Properties", "Get",
- assocDefIface, getAssocDefPropName(assocDefIface));
+ assocDefsInterface, assocDefsProperty);
}
void do_introspect(sdbusplus::asio::connection* system_bus,
@@ -199,11 +197,10 @@
thisPathMap[transaction->process_name].emplace(iface_name);
- if (isAssocDefIface(iface_name))
+ if (std::strcmp(iface_name, assocDefsInterface) == 0)
{
do_associations(system_bus, interface_map, objectServer,
- transaction->process_name, path,
- iface_name);
+ transaction->process_name, path);
}
pElement = pElement->NextSiblingElement("interface");
@@ -550,7 +547,7 @@
continue;
}
- if (isAssocDefIface(interface))
+ if (interface == assocDefsInterface)
{
removeAssociation(obj_path.str, sender, server,
associationMaps);
@@ -604,13 +601,7 @@
sdbusplus::message::variant<std::vector<Association>>>
values;
message.read(objectName, values);
-
- auto prop =
- std::find_if(values.begin(), values.end(), [](const auto& v) {
- using namespace boost::algorithm;
- return to_lower_copy(v.first) == "associations";
- });
-
+ auto prop = values.find(assocDefsProperty);
if (prop != values.end())
{
std::vector<Association> associations =
@@ -635,14 +626,6 @@
sdbusplus::bus::match::rules::argN(0, assocDefsInterface),
associationChangedHandler);
- sdbusplus::bus::match::match orgOpenbmcAssocChangedMatch(
- static_cast<sdbusplus::bus::bus&>(*system_bus),
- sdbusplus::bus::match::rules::interface(
- "org.freedesktop.DBus.Properties") +
- sdbusplus::bus::match::rules::member("PropertiesChanged") +
- sdbusplus::bus::match::rules::argN(0, orgOpenBMCAssocDefsInterface),
- associationChangedHandler);
-
std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
server.add_interface(MAPPER_PATH, MAPPER_INTERFACE);