inventory: merge vpd and additional properties

A FRU may have to implement an interface, whose properties may be
provided by vpd alone, MRW alone, or a combination of both. Handle the
latter case.

Change-Id: Ie8aec0069548f52bb576b358bce022e681fa951f
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/writefru.mako.hpp b/writefru.mako.hpp
index 8912738..7bbd079 100755
--- a/writefru.mako.hpp
+++ b/writefru.mako.hpp
@@ -41,6 +41,7 @@
 {
     ObjectMap objects;
     InterfaceMap interfaces;
+    auto iter = extra::objects.find(path);
 
     // Inventory manager needs object path, list of interface names to be
     // implemented, and property:value pairs contained in said interfaces
@@ -60,17 +61,32 @@
         vpdStore.get<Record::${record}, record::Keyword::${keyword}>();
             % endif
         % endfor
+    // Check and update extra properties
+    if(extra::objects.end() != iter)
+    {
+        auto propIter = (iter->second).find("${interface}");
+        if((iter->second).end() != propIter)
+        {
+            for(const auto& map : propIter->second)
+            {
+                ${intfName}Props[map.first] = map.second;
+            }
+        }
+    }
     interfaces.emplace("${interface}",
                        std::move(${intfName}Props));
     % endfor
 
     sdbusplus::message::object_path object(path);
     // Check and update extra properties
-    if(extra::objects.end() != extra::objects.find(path))
+    if(extra::objects.end() != iter)
     {
-        for(const auto& entry : extra::objects.at(path))
+        for(const auto& entry : iter->second)
         {
-            interfaces.emplace(entry.first, entry.second);
+            if(interfaces.end() == interfaces.find(entry.first))
+            {
+                interfaces.emplace(entry.first, entry.second);
+            }
         }
     }
     objects.emplace(std::move(object), std::move(interfaces));