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/libmapper/mapper.h b/libmapper/mapper.h
index 5b596a6..1b37f34 100644
--- a/libmapper/mapper.h
+++ b/libmapper/mapper.h
@@ -13,7 +13,7 @@
 void mapper_wait_async_free(mapper_async_wait*);
 void mapper_subtree_async_free(mapper_async_subtree*);
 
-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*,
                       mapper_async_wait**);
 int mapper_subtree_async(sd_bus*, sd_event*, char*, char*, void (*)(int, void*),
                          void*, mapper_async_subtree**, int);
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);
 
diff --git a/src/processing.cpp b/src/processing.cpp
index 2dfebfd..f3f59a9 100644
--- a/src/processing.cpp
+++ b/src/processing.cpp
@@ -65,9 +65,8 @@
         auto ifaces = pathIt->second.find(wellKnown);
         if (ifaces != pathIt->second.end())
         {
-            auto assoc = std::find_if(
-                ifaces->second.begin(), ifaces->second.end(),
-                [](const auto& iface) { return isAssocDefIface(iface); });
+            auto assoc = std::find(ifaces->second.begin(), ifaces->second.end(),
+                                   assocDefsInterface);
             if (assoc != ifaces->second.end())
             {
                 removeAssociation(pathIt->first, wellKnown, server, assocMaps);
@@ -110,13 +109,13 @@
     {
         ifaceList[wellKnown].emplace(interfacePair.first);
 
-        if (isAssocDefIface(interfacePair.first))
+        if (interfacePair.first == assocDefsInterface)
         {
             const sdbusplus::message::variant<std::vector<Association>>*
                 variantAssociations = nullptr;
             for (const auto& interface : interfacePair.second)
             {
-                if (interface.first == getAssocDefPropName(interfacePair.first))
+                if (interface.first == assocDefsProperty)
                 {
                     variantAssociations = &(interface.second);
                 }
diff --git a/src/processing.hpp b/src/processing.hpp
index 53669a5..75a4350 100644
--- a/src/processing.hpp
+++ b/src/processing.hpp
@@ -11,38 +11,12 @@
 /** @brief Define white list and black list data structure */
 using WhiteBlackList = boost::container::flat_set<std::string>;
 
-/** @brief The old associations definitions interface */
-constexpr const char* orgOpenBMCAssocDefsInterface = "org.openbmc.Associations";
-/** @brief The new associations definitions interface */
+/** @brief The associations definitions interface */
 constexpr const char* assocDefsInterface =
     "xyz.openbmc_project.Association.Definitions";
 
-/** @brief Says if the interface is the association definition interface.
- * Supports either the new or old interface.
- *
- * @param[in] iface - the interface to check
- * @return bool - if the interface is one of the association definition
- *                ones.
- */
-inline bool isAssocDefIface(std::string_view iface)
-{
-    return (iface == assocDefsInterface) ||
-           (iface == orgOpenBMCAssocDefsInterface);
-}
-
-/** @brief Returns the property name used by the defs iface.
- *
- * The old interface broke convention and used a lower case property
- * name.  This was resolved with the new interface.
- *
- * @param[in] iface - the interface to check
- * @return std::string - the property name
- */
-inline std::string getAssocDefPropName(std::string_view iface)
-{
-    assert(isAssocDefIface(iface));
-    return (iface == assocDefsInterface) ? "Associations" : "associations";
-}
+/** @brief The associations definitions property name */
+constexpr const char* assocDefsProperty = "Associations";
 
 /** @brief InterfacesAdded represents the dbus data from the signal
  *
diff --git a/src/test/interfaces_added.cpp b/src/test/interfaces_added.cpp
index bee978f..5aa4212 100644
--- a/src/test/interfaces_added.cpp
+++ b/src/test/interfaces_added.cpp
@@ -37,8 +37,8 @@
     auto interfaceMap = createDefaultInterfaceMap();
     AssociationMaps assocMaps;
 
-    auto intfAdded = createInterfacesAdded(
-        assocDefsInterface, getAssocDefPropName(assocDefsInterface));
+    auto intfAdded =
+        createInterfacesAdded(assocDefsInterface, assocDefsProperty);
 
     processInterfaceAdded(interfaceMap, DEFAULT_SOURCE_PATH, intfAdded,
                           DEFAULT_DBUS_SVC, assocMaps, *server);
@@ -59,31 +59,3 @@
     // No pending associations
     EXPECT_EQ(assocMaps.pending.size(), 0);
 }
-
-TEST_F(TestInterfacesAdded, OrgOpenBmcInterfacesAddedGoodPath)
-{
-    auto interfaceMap = createDefaultInterfaceMap();
-    AssociationMaps assocMaps;
-
-    auto intfAdded = createInterfacesAdded(
-        orgOpenBMCAssocDefsInterface,
-        getAssocDefPropName(orgOpenBMCAssocDefsInterface));
-
-    processInterfaceAdded(interfaceMap, DEFAULT_SOURCE_PATH, intfAdded,
-                          DEFAULT_DBUS_SVC, assocMaps, *server);
-
-    // Interface map will get the following:
-    // /logging/entry/1 /logging/entry /logging/ /  system/chassis
-    EXPECT_EQ(interfaceMap.size(), 5);
-
-    // New association ower created so ensure it now contains a single entry
-    // dump_AssociationOwnersType(assocOwners);
-    EXPECT_EQ(assocMaps.owners.size(), 1);
-
-    // Ensure the 2 association interfaces were created
-    // dump_AssociationInterfaces(assocInterfaces);
-    EXPECT_EQ(assocMaps.ifaces.size(), 2);
-
-    // No pending associations
-    EXPECT_EQ(assocMaps.pending.size(), 0);
-}