diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-02-21 03:35:20 -0600 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-02-24 13:38:22 +0000 |
commit | 0cc20121312ec99cd6855566669e56dcca922f5d (patch) | |
tree | 0085e0968f3015f7a224d9f41782c3955d389de3 | |
parent | 623ec6c9ab829b4deedbd90c2d0175567a813bcd (diff) | |
download | openpower-vpd-parser-0cc20121312ec99cd6855566669e56dcca922f5d.tar.gz openpower-vpd-parser-0cc20121312ec99cd6855566669e56dcca922f5d.zip |
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>
-rwxr-xr-x | writefru.mako.hpp | 22 |
1 files changed, 19 insertions, 3 deletions
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 @@ void writeFru<Fru::${key}>(const Store& vpdStore, { 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 @@ void writeFru<Fru::${key}>(const Store& vpdStore, 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)); |