Implement Association interface

Implement xyz/openbmc_project/Association/Definitions.interface in
activation and item_updater.

Tested: Verify the association is created after uploading a dummy
        tarball.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I217bddc48534a0b3b17359e0f3409f6c7c953f08
diff --git a/src/item_updater.hpp b/src/item_updater.hpp
index bc86af1..96006f4 100644
--- a/src/item_updater.hpp
+++ b/src/item_updater.hpp
@@ -3,9 +3,11 @@
 #include "config.h"
 
 #include "activation.hpp"
+#include "types.hpp"
 #include "version.hpp"
 
 #include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Association/Definitions/server.hpp>
 #include <xyz/openbmc_project/Collection/DeleteAll/server.hpp>
 
 namespace phosphor
@@ -18,6 +20,7 @@
 class Version;
 
 using ItemUpdaterInherit = sdbusplus::server::object::object<
+    sdbusplus::xyz::openbmc_project::Association::server::Definitions,
     sdbusplus::xyz::openbmc_project::Collection::server::DeleteAll>;
 namespace MatchRules = sdbusplus::bus::match::rules;
 
@@ -54,6 +57,26 @@
     void deleteAll();
 
   private:
+    /** @brief Creates an active association to the
+     *  newly active software image
+     *
+     * @param[in]  path - The path to create the association to.
+     */
+    void createActiveAssociation(const std::string& path);
+
+    /** @brief Updates the functional association to the
+     *  new "running" PSU images
+     *
+     * @param[in]  versionId - The id of the image to update the association to.
+     */
+    void updateFunctionalAssociation(const std::string& versionId);
+
+    /** @brief Removes the associations from the provided software image path
+     *
+     * @param[in]  path - The path to remove the association from.
+     */
+    void removeAssociation(const std::string& path);
+
     /** @brief Callback function for Software.Version match.
      *  @details Creates an Activation D-Bus object.
      *
@@ -66,7 +89,8 @@
         const std::string& path, const std::string& versionId,
         const std::string& extVersion,
         sdbusplus::xyz::openbmc_project::Software::server::Activation::
-            Activations activationStatus);
+            Activations activationStatus,
+        const AssociationList& assocs);
 
     /** @brief Create Version object */
     std::unique_ptr<Version>
@@ -90,6 +114,9 @@
 
     /** @brief sdbusplus signal match for Software.Version */
     sdbusplus::bus::match_t versionMatch;
+
+    /** @brief This entry's associations */
+    AssociationList assocs;
 };
 
 } // namespace updater