Activation: Delete version interface after activation

When activation is finished, the version interface and the related
images created by phosphor-version-software-manager shall be deleted.

This is done by invoking the Delete method of the related service, so we
need to get all the services from the object, and get the correct
service to invoke the Delete method.

Tested: Verify the Version interface created by
        xyz.openbmc_project.Software.Version service, and the related
        files in /tmp/image/<versionId> are removed after activation is
        completed.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Icb14731bbea35175c2519bd40b9f88a0b54a034a
diff --git a/src/utils.hpp b/src/utils.hpp
index 86ee5dd..fe376a8 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -37,6 +37,17 @@
 std::string getService(sdbusplus::bus::bus& bus, const char* path,
                        const char* interface);
 
+/** @brief Get all the service names from object path and interface
+ *
+ * @param[in] bus          - The Dbus bus object
+ * @param[in] path         - The Dbus object path
+ * @param[in] interface    - The Dbus interface
+ *
+ * @return The name of the services
+ */
+std::vector<std::string> getServices(sdbusplus::bus::bus& bus, const char* path,
+                                     const char* interface);
+
 /** @brief The template function to get property from the requested dbus path
  *
  * @param[in] bus          - The Dbus bus object
@@ -88,6 +99,10 @@
     virtual std::string getService(sdbusplus::bus::bus& bus, const char* path,
                                    const char* interface) const = 0;
 
+    virtual std::vector<std::string>
+        getServices(sdbusplus::bus::bus& bus, const char* path,
+                    const char* interface) const = 0;
+
     virtual std::string getVersionId(const std::string& version) const = 0;
 
     virtual std::string getVersion(const std::string& inventoryPath) const = 0;
@@ -117,6 +132,10 @@
     std::string getService(sdbusplus::bus::bus& bus, const char* path,
                            const char* interface) const override;
 
+    std::vector<std::string> getServices(sdbusplus::bus::bus& bus,
+                                         const char* path,
+                                         const char* interface) const override;
+
     std::string getVersionId(const std::string& version) const override;
 
     std::string getVersion(const std::string& inventoryPath) const override;
@@ -132,6 +151,13 @@
     return getUtils().getService(bus, path, interface);
 }
 
+inline std::vector<std::string> getServices(sdbusplus::bus::bus& bus,
+                                            const char* path,
+                                            const char* interface)
+{
+    return getUtils().getServices(bus, path, interface);
+}
+
 inline std::vector<std::string> getPSUInventoryPath(sdbusplus::bus::bus& bus)
 {
     return getUtils().getPSUInventoryPath(bus);