mapper: Add GetAssociatedSubTreeById and GetAssociatedSubTreePathsById

These methods are similar to the existing GetSubTree and GetSubTreePaths
methods, but they retrieve the paths of the associated endpoints
corresponding to the provided identifier. Here, the "Id" refers to the
leaf name of the D-Bus path, which uniquely identifies a specific
component or entity within the system. For example, in the path
/xyz/openbmc_project/inventory/system/ChassisId/motherboard/FanId, the
identifiers could be ChassisId and FanId, where each Id uniquely
identifies a chassis or a fan.

These methods use two arrays of interfaces: one to filter paths with the
specified identifier and another to filter the endpoint paths of the
identifier.

These methods simplify the process by combining subtree retrieval and
association lookup into a single call, reducing the number of D-Bus
calls needed.

ex:
'''
busctl call -j  "xyz.openbmc_project.ObjectMapper"   "/xyz/openbmc_project/object_mapper" \
"xyz.openbmc_project.ObjectMapper" "GetAssociatedSubTreePathsById" ssiassas "chassis" \
"/xyz/openbmc_project/inventory" 0 1 "xyz.openbmc_project.Inventory.Item.Chassis" "powered_by" \
1  "xyz.openbmc_project.Inventory.Item.PowerSupply"
{
        "type" : "as",
        "data" : [
                [
                        "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0",
                        "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1",
                        "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply2",
                        "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply3"
                ]
        ]
}
'''

Change-Id: I7f23ad585a46064aaccb0a3c789ca4a69c923291
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
diff --git a/yaml/xyz/openbmc_project/ObjectMapper.interface.yaml b/yaml/xyz/openbmc_project/ObjectMapper.interface.yaml
index 0fd1be5..11be242 100644
--- a/yaml/xyz/openbmc_project/ObjectMapper.interface.yaml
+++ b/yaml/xyz/openbmc_project/ObjectMapper.interface.yaml
@@ -153,6 +153,100 @@
                 An array of paths.
       errors:
           - xyz.openbmc_project.Common.Error.ResourceNotFound
+    - name: GetAssociatedSubTreeById
+      description: >
+          Retrieves a dictionary of D-Bus paths -> services of associated
+          endpoints with the provided identifier, filtering based on their
+          association with specified endpoint interfaces.
+
+          Implementation steps:
+
+          1. Retrieve the subtree D-Bus paths that implement the
+             "subtreeInterfaces" and have the path endpoint "id".
+          2. Create an association path by concatenating the subtree path with
+             "/" and "association"
+             associationPath = subtreePath + "/" + "association"
+          3. Call getAssociatedSubTree to get the endpoint path -> services of
+             the associationPath that implements the "endpointInterfaces".
+      parameters:
+          - name: id
+            type: string
+            description: >
+                The leaf name of the dbus path, uniquely identifying a specific
+                component or entity within the system. For example, in the path
+                `/xyz/openbmc_project/inventory/system/{ChassisId}/motherboard/{FanId}`,
+                the identifiers would be {FanId}.
+          - name: objectPath
+            type: string
+            description: >
+                The object path for which the result should be fetched.
+          - name: subtreeInterfaces
+            type: array[string]
+            description: >
+                An array of interfaces used to retrieve dbus paths with the
+                specified identifier.
+          - name: association
+            type: string
+            description: >
+                The endpoint association.
+          - name: endpointInterfaces
+            type: array[string]
+            description: >
+                An array of interfaces used to filter associated endpoint paths.
+      returns:
+          - name: objects
+            type: dict[string,dict[string,array[string]]]
+            description: >
+                A dictionary of path -> services.
+      errors:
+          - xyz.openbmc_project.Common.Error.ResourceNotFound
+    - name: GetAssociatedSubTreePathsById
+      description: >
+          Retrieves the D-Bus paths of associated endpoints with the provided
+          identifier, filtering based on their association with specified
+          endpoint interfaces.
+
+          Implementation steps:
+
+          1. Retrieve the subtree D-Bus paths that implement the
+             "subtreeInterfaces" and have the path endpoint "id".
+          2. Create an association path by concatenating the subtree path with
+             "/" and "association"
+             associationPath = subtreePath + "/" + "association"
+          3. Call getAssociatedSubTreePaths to get the endpoint paths of the
+             associationPath that implements the "endpointInterfaces".
+      parameters:
+          - name: id
+            type: string
+            description: >
+                The leaf name of the dbus path, uniquely identifying a specific
+                component or entity within the system. For example, in the path
+                `/xyz/openbmc_project/inventory/system/{ChassisId}/motherboard/{FanId}`,
+                the identifiers would be {FanId}.
+          - name: objectPath
+            type: string
+            description: >
+                The object path for which the result should be fetched.
+          - name: subtreeInterfaces
+            type: array[string]
+            description: >
+                An array of interfaces used to retrieve dbus paths with the
+                specified identifier.
+          - name: association
+            type: string
+            description: >
+                The endpoint association.
+          - name: endpointInterfaces
+            type: array[string]
+            description: >
+                An array of interfaces used to filter associated endpoint paths.
+      returns:
+          - name: paths
+            type: array[string]
+            description: >
+                An array of paths.
+      errors:
+          - xyz.openbmc_project.Common.Error.ResourceNotFound
 
 service_names:
     - default: xyz.openbmc_project.ObjectMapper