Activation: create associations

Create activation, functional, activate associations during PSU update.

Tested: With dummy psu update service, verify the assocations are
        created when the PSU update is completed, and not created
        when PSU update fails.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I3d457e65b55066b93f7fc9a3311093dcec05d020
diff --git a/src/activation.cpp b/src/activation.cpp
index f63352a..f1181fb 100644
--- a/src/activation.cpp
+++ b/src/activation.cpp
@@ -105,7 +105,8 @@
 
 bool Activation::doUpdate(const std::string& psuInventoryPath)
 {
-    psuUpdateUnit = internal::getUpdateService(psuInventoryPath, versionId);
+    currentUpdatingPsu = psuInventoryPath;
+    psuUpdateUnit = internal::getUpdateService(currentUpdatingPsu, versionId);
     try
     {
         auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
@@ -141,6 +142,13 @@
     auto progress = activationProgress->progress() + progressStep;
     activationProgress->progress(progress);
 
+    // Update the activation association
+    auto assocs = associations();
+    assocs.emplace_back(ACTIVATION_FWD_ASSOCIATION, ACTIVATION_REV_ASSOCIATION,
+                        currentUpdatingPsu);
+    currentUpdatingPsu.clear();
+    associations(assocs);
+
     psuQueue.pop();
     doUpdate(); // Update the next psu
 }
@@ -202,8 +210,11 @@
     activationProgress->progress(100);
 
     // TODO: delete the old software object
-    // TODO: create related associations
     deleteImageManagerObject();
+
+    associationInterface->createActiveAssociation(path);
+    associationInterface->addFunctionalAssociation(path);
+
     activation(Status::Active);
 }