Add inventory & chassis association to PSU sensors

For PSU sensor object paths, inventory and chassis
associations is missing due to double initialization
of association interface. Due to this PSU information
and PSU sensors  are not show up in Redfish under
chassis. Corrected the code to register association
property and initialize it only after filling all
associations.

Tested:
 - PowerSupplies information shows up in redfish /<chassisid>/Power
 - PSU sensors shows up in redfish /<chassisid>/Thermal
   and <chassisid>/sensors

Change-Id: If2a16e55681718d5b21f3d38c5465d36bda65460
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index d5f1b23..e94d1c4 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -81,10 +81,14 @@
         thresholdInterfaceCritical = objectServer.add_interface(
             dbusPath, "xyz.openbmc_project.Sensor.Threshold.Critical");
     }
-    association = objectServer.add_interface(dbusPath, association::interface);
 
+    // This should be called before initializing association.
+    // createInventoryAssoc() does add more associations before doing
+    // register and initialize "Associations" property.
     setInitialProperties(conn);
 
+    association = objectServer.add_interface(dbusPath, association::interface);
+
     createInventoryAssoc(conn, association, configurationPath);
     setupRead();
 }
@@ -96,6 +100,7 @@
     objServer.remove_interface(sensorInterface);
     objServer.remove_interface(thresholdInterfaceWarning);
     objServer.remove_interface(thresholdInterfaceCritical);
+    objServer.remove_interface(association);
 }
 
 void PSUSensor::setupRead(void)