Fix Chassis Topology Links Handling

https://gerrit.openbmc.org/c/openbmc/bmcweb/+/60914 implements topology
links for chassis using `getAssociationEndPoints()` for
`containing/contained_by` associations.

If the association is used only between chassis, the desired result is
obtained.

```
busctl get-property xyz.openbmc_project.Inventory.Manager  \
       /xyz/openbmc_project/inventory/system/chassis  \
       xyz.openbmc_project.Association.Definitions Associations

a(sss)  ...
containing" "contained_by" "/xyz/openbmc_project/inventory/system/chassis/motherboard/rdx0"
```

```
$ curl -k -X GET https://${bmc}/redfish/v1/Chassis/chassis
{
  "@odata.id": "/redfish/v1/Chassis/chassis",
  "@odata.type": "#Chassis.v1_22_0.Chassis",

  "Links": {
    "Contains": [
      ...
      {
        "@odata.id": "/redfish/v1/Chassis/rdx0"
      },
```

However, the same associations can also be used for the other cases
which may also be used for the other types[1].

For example, https://gerrit.openbmc.org/c/openbmc/openbmc/+/70372 also
adds the associations between chassis and the non-chassis/board
resources.

```
busctl get-property xyz.openbmc_project.Inventory.Manager  \
       /xyz/openbmc_project/inventory/system/chassis \
       xyz.openbmc_project.Association.Definitions Associations
…

"containing" "contained_by" "/xyz/openbmc_project/inventory/system/chassis/motherboard/connector0"
…
"containing" "contained_by" "/xyz/openbmc_project/inventory/system/chassis/motherboard/rdx0"

```

In that case, Chassis Links gives the undesired result including
the non-chassis resources in `Contains` collection.

```
$ curl -k -X GET https://${bmc}/redfish/v1/Chassis/chassis
{
  "@odata.id": "/redfish/v1/Chassis/chassis",
  "@odata.type": "#Chassis.v1_22_0.Chassis",

  "Links": {
    "Contains": [
      ...
      {
        "@odata.id": "/redfish/v1/Chassis/connector0"
      },
...
```

This commit is to limit to get the chassis/board resources for Chassis
`Contains` collection.

Tested:
- Check Chassis/Links collection to see whether there are non-chassis
  `curl -k -X GET https://${bmc}/redfish/v1/Chassis/chassis`

- Redfish Service Validator passes

[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/e2c9bc74f2b8c0e78c305894289f8938d75ee108/yaml/xyz/openbmc_project/Inventory/Item/README.md?plain=1#L21

Change-Id: I472fc12379694acc35055965400141dbb1b33bfc
Signed-off-by: Myung Bae <myungbae@us.ibm.com>
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 723cc1e..f250c2f 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -205,7 +205,7 @@
 inline void getChassisContainedBy(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& chassisId, const boost::system::error_code& ec,
-    const dbus::utility::MapperEndPoints& upstreamChassisPaths)
+    const dbus::utility::MapperGetSubTreePathsResponse& upstreamChassisPaths)
 {
     if (ec)
     {
@@ -244,7 +244,7 @@
 inline void getChassisContains(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& chassisId, const boost::system::error_code& ec,
-    const dbus::utility::MapperEndPoints& downstreamChassisPaths)
+    const dbus::utility::MapperGetSubTreePathsResponse& downstreamChassisPaths)
 {
     if (ec)
     {
@@ -290,13 +290,20 @@
 {
     BMCWEB_LOG_DEBUG("Get chassis connectivity");
 
-    dbus::utility::getAssociationEndPoints(
+    constexpr std::array<std::string_view, 2> interfaces{
+        "xyz.openbmc_project.Inventory.Item.Board",
+        "xyz.openbmc_project.Inventory.Item.Chassis"};
+
+    dbus::utility::getAssociatedSubTreePaths(
         chassisPath + "/contained_by",
+        sdbusplus::message::object_path("/xyz/openbmc_project/inventory"), 0,
+        interfaces,
         std::bind_front(getChassisContainedBy, asyncResp, chassisId));
 
-    dbus::utility::getAssociationEndPoints(
+    dbus::utility::getAssociatedSubTreePaths(
         chassisPath + "/containing",
-        std::bind_front(getChassisContains, asyncResp, chassisId));
+        sdbusplus::message::object_path("/xyz/openbmc_project/inventory"), 0,
+        interfaces, std::bind_front(getChassisContains, asyncResp, chassisId));
 }
 
 /**