Handle entity association records from host

- Get the PDRs from host, traverse the entity association structure
  and construct the D-Bus object path according to the entity type ID
  and container type ID.

- eg:
 /xyz/openbmc_project/inventory/system1/chassis1/io_board1/powersupply1
 /xyz/openbmc_project/inventory/system1/chassis1/io_board1/powersupply2
 /xyz/openbmc_project/inventory/system1/chassis2/io_board2/powersupply1
 /xyz/openbmc_project/inventory/system1/chassis2/io_board2/powersupply2

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I1c606ea943624f2601be4f5f6b5c30d1bf71cd11
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index 9409b30..3ceae13 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -234,15 +234,22 @@
             return;
         }
 
+        Entities entityAssoc;
+        entityAssoc.push_back(pNode);
         for (size_t i = 1; i < numEntities; ++i)
         {
-            pldm_entity_association_tree_add_entity(
+            auto node = pldm_entity_association_tree_add_entity(
                 entityTree, &entities[i], entities[i].entity_instance_num,
                 pNode, entityPdr->association_type, true, true, 0xFFFF);
             merged = true;
+            entityAssoc.push_back(node);
         }
 
         mergedHostParents = true;
+        if (merged)
+        {
+            entityAssociations.push_back(entityAssoc);
+        }
     }
 
     if (merged)
@@ -547,6 +554,8 @@
     }
     if (!nextRecordHandle)
     {
+        updateEntityAssociation(entityAssociations, entityTree, objPathMap);
+
         /*received last record*/
         this->parseStateSensorPDRs(stateSensorPDRs);
         if (isHostUp())
@@ -554,6 +563,8 @@
             this->setHostSensorState(stateSensorPDRs);
         }
         stateSensorPDRs.clear();
+        entityAssociations.clear();
+
         if (merged)
         {
             merged = false;