mapper: Add Associated subtree method definition

dbus-interface change in:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/57821

Create new mapper function to make subtree call and association call at
the same time. With the association definition, we will have more
endpoints to fetch and verify that it is actually the resource that we
are looking for. We need to verify that it has the expected interface to
confirm that it is right device. In the current workflow this will take
two dbus calls to the mapper to get the association and the subtree.

This change aims to reduce that down to one by combining the two
operations. It will not significant performance increase for the daemons,
but it can help reduce the load on the dbus-broker.service.

Tested:
```
Normal Call:
busctl call   "xyz.openbmc_project.ObjectMapper" \
    "/xyz/openbmc_project/object_mapper" \
    "xyz.openbmc_project.ObjectMapper" "GetSubTreePaths" sias \
     "/xyz/openbmc_project/inventory" 0 1 \
     "xyz.openbmc_project.Inventory.Item.Storage"
as 4 "/xyz/openbmc_project/inventory/storage_0" "/xyz/openbmc_project/inventory/storage_1"
     "/xyz/openbmc_project/inventory/storage_4" "/xyz/openbmc_project/inventory/storage_3"

Associated Call: (Only 0 and 1 is associated to the chassis)
busctl call   "xyz.openbmc_project.ObjectMapper" \
    "/xyz/openbmc_project/object_mapper" \
    "xyz.openbmc_project.ObjectMapper" "GetAssociatedSubTreePaths" ssias \
    "/xyz/openbmc_project/inventory/chassis_0/storage" \
     "/xyz/openbmc_project/inventory" 0 1 "xyz.openbmc_project.Inventory.Item.Storage"
as 2 "/xyz/openbmc_project/inventory/storage_0" "/xyz/openbmc_project/inventory/storage_1"
```

Change-Id: Ib532e660cf20b9efc83045fb1cbd9143d0c1841e
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/src/main.cpp b/src/main.cpp
index 5f43767..568f460 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -596,6 +596,26 @@
             return getSubTreePaths(interfaceMap, reqPath, depth, interfaces);
         });
 
+    iface->register_method(
+        "GetAssociatedSubTree",
+        [&interfaceMap](const sdbusplus::message::object_path& associationPath,
+                        const sdbusplus::message::object_path& reqPath,
+                        int32_t depth, std::vector<std::string>& interfaces) {
+            return getAssociatedSubTree(interfaceMap, associationMaps,
+                                        associationPath, reqPath, depth,
+                                        interfaces);
+        });
+
+    iface->register_method(
+        "GetAssociatedSubTreePaths",
+        [&interfaceMap](const sdbusplus::message::object_path& associationPath,
+                        const sdbusplus::message::object_path& reqPath,
+                        int32_t depth, std::vector<std::string>& interfaces) {
+            return getAssociatedSubTreePaths(interfaceMap, associationMaps,
+                                             associationPath, reqPath, depth,
+                                             interfaces);
+        });
+
     iface->initialize();
 
     io.post([&]() {