summaryrefslogtreecommitdiffstats
path: root/writefrudata.cpp
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-02-20 01:21:59 -0600
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-02-22 05:51:45 -0600
commit788bd1f58886dd68141dff659161da5804c05063 (patch)
tree96d028d57a2ebfa86de9e47906b00e2df2c3f286 /writefrudata.cpp
parente8c4ffd43623eeddb9750faf801531813dcb05ad (diff)
downloadipmi-fru-parser-788bd1f58886dd68141dff659161da5804c05063.tar.gz
ipmi-fru-parser-788bd1f58886dd68141dff659161da5804c05063.zip
inventory: update extra properties
Change-Id: I8b403f07855cccb001eb63d6c5f11c5e1f58c874 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'writefrudata.cpp')
-rw-r--r--writefrudata.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/writefrudata.cpp b/writefrudata.cpp
index b36de7e..e090903 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -13,6 +13,7 @@
#include <fstream>
#include <sstream>
#include <mapper.h>
+#include "types.hpp"
#include "frup.hpp"
#include "fru-area.hpp"
#include <sdbusplus/server.hpp>
@@ -21,21 +22,10 @@
const char *sys_object_name = "/org/openbmc/managers/System";
const char *sys_intf_name = "org.openbmc.managers.System";
-extern const FruMap frus;
-
-using Property = std::string;
-using Value = sdbusplus::message::variant<bool, int64_t, std::string>;
-// Association between property and its value
-using PropertyMap = std::map<Property, Value>;
-
-using Interface = std::string;
-// Association between interface and the dbus property
-using InterfaceMap = std::map<Interface, PropertyMap>;
+using namespace ipmi::vpd;
-using Object = sdbusplus::message::object_path;
-
-// Association between object and the interfaces.
-using ObjectMap = std::map<Object, InterfaceMap>;
+extern const FruMap frus;
+extern const std::map<Path, InterfaceMap> extras;
//----------------------------------------------------------------
// Constructor
@@ -518,6 +508,7 @@ int ipmi_update_inventory(fru_area_vec_t& area_vec)
for (auto& instance : instanceList)
{
InterfaceMap interfaces;
+ const auto& extrasIter = extras.find(instance.first);
for (auto& interfaceList : instance.second)
{
@@ -558,11 +549,36 @@ int ipmi_update_inventory(fru_area_vec_t& area_vec)
}
props.emplace(std::move(properties.first), std::move(value));
}
- interfaces.emplace(std::move(interfaceList.first), std::move(props));
+ // Check and update extra properties
+ if(extras.end() != extrasIter)
+ {
+ const auto& propsIter =
+ (extrasIter->second).find(interfaceList.first);
+ if((extrasIter->second).end() != propsIter)
+ {
+ for(const auto& map : propsIter->second)
+ {
+ props.emplace(map.first, map.second);
+ }
+ }
+ }
+ interfaces.emplace(std::move(interfaceList.first),
+ std::move(props));
}
- //Call the inventory manager
+ // Call the inventory manager
sdbusplus::message::object_path path = instance.first;
+ // Check and update extra properties
+ if(extras.end() != extrasIter)
+ {
+ for(const auto& entry : extrasIter->second)
+ {
+ if(interfaces.end() == interfaces.find(entry.first))
+ {
+ interfaces.emplace(entry.first, entry.second);
+ }
+ }
+ }
objects.emplace(path,interfaces);
}
OpenPOWER on IntegriCloud