entity-manager: Allow exposing BMC inventory with "ContainsThisBMC"
Recently there appeared use cases involving the usage of a BMC Inventory
item. One example is the utilization sensors in phosphor-health-monitor;
those sensors need to be connected to the BMC inventory item via an
association edge so they can be found by bmcweb.
Based on the conventions of OpenBMC, when a daemon owns a BMC Inventory
item, it is expected to have a complete understanding of the underlying
object. As such, Entity-Manager is in a better position to own the BMC
Inventory item compared to any other daemon.
Customarily, an Inventory item must always refer to a tangible, physical
object such as a board. The BMC Inventory item Inventory item is an
exception, since in most cases a BMC is not a discrete physical object
and is usually embedded into another physical component, such as a
DC-SCM module or a Board. A such, the information regarding a BMC must
be encoded in the board's JSON file, rather than a JSON file of its own.
This change makes entity-manager add an Inventory.Item.Bmc upon seeing
an "Exposed" entry with "BMC" type.
Tested: After adding 'HasThisBMC: true' to a board .JSON file, the BMC
item shows up:
bmc# busctl tree xyz.openbmc_project.EntityManager
`-/xyz
`-/xyz/openbmc_project
|-/xyz/openbmc_project/EntityManager
`-/xyz/openbmc_project/inventory
`-/xyz/openbmc_project/inventory/system
|-/xyz/openbmc_project/inventory/system/board
| `-/xyz/openbmc_project/inventory/system/board/SuperBoard
| `-/xyz/openbmc_project/inventory/system/board/SuperBoard/BMC
Signed-off-by: Sui Chen <suichen@google.com>
Change-Id: Iaf3595d4c336dbcf1f4e42f4aaa2c6c1840f9584
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index 12c57c5..2ab88e3 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -684,6 +684,17 @@
"xyz.openbmc_project.Configuration." + itemType,
boardKeyOrig);
+ if (itemType == "BMC")
+ {
+ std::shared_ptr<sdbusplus::asio::dbus_interface> bmcIface =
+ createInterface(objServer, ifacePath,
+ "xyz.openbmc_project.Inventory.Item.Bmc",
+ boardKeyOrig);
+ populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
+ bmcIface, item, objServer,
+ getPermission(itemType));
+ }
+
populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
itemIface, item, objServer,
getPermission(itemType));