Remove default interfaces

When association is used, mapper will create DBus objects on the leaf
of the associated objects, and will "assign" the "default interfaces" to
the parent objects:
* org.freedesktop.DBus.Introspectable
* org.freedesktop.DBus.Peer
* org.freedesktop.DBus.Properties

For example, software manager will create BMC version object and create
association, and we could see below DBus objects created by mapper:
```
 /xyz/openbmc_project/software/64876e4e/inventory
 /xyz/openbmc_project/software/64876e4e/software_version
```

And we could mapper's `GetObject` method will return the default
interfaces on the parent object:

```json
 # busctl --json=pretty call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetObject sas /xyz/openbmc_project/software/64876e4e 0
 {
         "type" : "a{sas}",
         "data" : [
                 {
                         "xyz.openbmc_project.ObjectMapper" : [
                                 "org.freedesktop.DBus.Introspectable",
                                 "org.freedesktop.DBus.Peer",
                                 "org.freedesktop.DBus.Properties"
                         ],
                         "xyz.openbmc_project.Software.BMC.Updater" : [
                                 "org.freedesktop.DBus.Introspectable",
                                 "org.freedesktop.DBus.Peer",
                                 "org.freedesktop.DBus.Properties",
                                 "xyz.openbmc_project.Association.Definitions",
                                 "xyz.openbmc_project.Common.FilePath",
                                 "xyz.openbmc_project.Inventory.Decorator.Compatible",
                                 "xyz.openbmc_project.Software.Activation",
                                 "xyz.openbmc_project.Software.ExtendedVersion",
                                 "xyz.openbmc_project.Software.RedundancyPriority",
                                 "xyz.openbmc_project.Software.Version"
                         ]
                 }
         ]
 }
```

This patch removes registering the default interfaces (peer, properties,
Introspectable) when done as part of an ObjectManager event, because
they're generally not received as part of an InterfacesAdded call. These
don't generally get searched on, and don't make a ton of sense to have
the mapper implicitly add, but were done to make the introspect and
objectmapper results match.

However, the default interfaces returned by introspect on the parents
could not be called, e.g.

```
 # The leaf object is OK:
 busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/software/64876e4e/inventory org.freedesktop.DBus.Properties GetAll s org.freedesktop.DBus.Properties
 a{sv} 0

 # The parent object fails to call:
 busctl call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/software/64876e4e org.freedesktop.DBus.Properties GetAll s org.freedesktop.DBus.Properties
 Call failed: Unknown object '/xyz/openbmc_project/software/64876e4e'.
```

This probably means that the default interfaces returned by introspect
could not really be used, and thus we could remove then in mapper here.

Tested: With this patch, the parent object does not show default
interfaces:
```json
 # busctl --json=pretty call xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetObject sas /xyz/openbmc_project/software/64876e4e 0
 {
         "type" : "a{sas}",
         "data" : [
                 {
                         "xyz.openbmc_project.ObjectMapper" : [],
                         "xyz.openbmc_project.Software.BMC.Updater" : [
                                 "org.freedesktop.DBus.Introspectable",
                                 "org.freedesktop.DBus.Peer",
                                 "org.freedesktop.DBus.Properties",
                                 "xyz.openbmc_project.Association.Definitions",
                                 "xyz.openbmc_project.Common.FilePath",
                                 "xyz.openbmc_project.Inventory.Decorator.Compatible",
                                 "xyz.openbmc_project.Software.Activation",
                                 "xyz.openbmc_project.Software.ExtendedVersion",
                                 "xyz.openbmc_project.Software.RedundancyPriority",
                                 "xyz.openbmc_project.Software.Version"
                         ]
                 }
         ]
 }
```

Note: if this gets merged, bmcweb's related code in
openbmc_dbus_rest.hpp shall be updated to handle this case.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I568f618141ac514f9720e83960a1b4e76f77eb54
1 file changed
tree: 9ff70a77f9e5bc5995589f053c6f8e9e86536949
  1. fail-monitor/
  2. libmapper/
  3. src/
  4. subprojects/
  5. .clang-format
  6. .gitignore
  7. LICENSE
  8. meson.build
  9. meson.options
  10. OWNERS
  11. README.md
README.md

The Mapper

This repository contains the mapper, which assists in finding things on D-Bus. There is documentation about it here.

Prerequisites

Non-OpenBMC build dependencies are:

  • meson/ninja
  • boost
  • libsystemd
  • systemd
  • tinyxml2

Build

meson build && ninja -C build

Run Unit Tests

meson build && ninja -C build test

Clean the repository

rm -rf build