item_updater: Look for BMC inventory interface

There were some TODOs to more efficiently find the BMC inventory
object. The pending issues have been resolved so update the code
to search for the BMC inventory interface from the whole
inventory root path.

Change-Id: I4331814bb6b9cc8e8b0bba7b85c8d75b8c1bacf6
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index bbfdef4..df53747 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -533,20 +533,15 @@
 
 void ItemUpdater::setBMCInventoryPath()
 {
-    //TODO: openbmc/openbmc#1786 - Get the BMC path by looking for objects
-    //      that implement the BMC inventory interface
     auto depth = 0;
     auto mapperCall = bus.new_method_call(MAPPER_BUSNAME,
                                           MAPPER_PATH,
                                           MAPPER_INTERFACE,
                                           "GetSubTreePaths");
 
-    mapperCall.append(CHASSIS_INVENTORY_PATH);
+    mapperCall.append(INVENTORY_PATH);
     mapperCall.append(depth);
-
-    // TODO: openbmc/openbmc#2226 - Add Inventory Item filter when
-    //       mapper is fixed.
-    std::vector<std::string> filter = {};
+    std::vector<std::string> filter = {BMC_INVENTORY_INTERFACE};
     mapperCall.append(filter);
 
     auto response = bus.call(mapperCall);
@@ -560,21 +555,12 @@
     ObjectPaths result;
     response.read(result);
 
-    if (result.empty())
+    if (!result.empty())
     {
-        log<level::ERR>("Invalid response from mapper");
-        return;
+        bmcInventoryPath = result.front();
     }
 
-    for (auto& iter : result)
-    {
-        const auto& path = iter;
-        if (path.substr(path.find_last_of('/') + 1).compare("bmc") == 0)
-        {
-            bmcInventoryPath = path;
-            return;
-        }
-    }
+    return;
 }
 
 void ItemUpdater::createActiveAssociation(const std::string& path)