summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@in.ibm.com>2018-02-04 23:24:44 +0530
committerRatan Gupta <ratagupt@in.ibm.com>2018-02-04 23:29:19 +0530
commitc19c054c01b7a42c24cdf38a270b33f56290abf3 (patch)
treefacd1c74c94462dac182ba1552a17c5ac13c741c
parent9606ba3efe9d61458ad2ede6f0639856d580ef7e (diff)
downloadipmi-fru-parser-c19c054c01b7a42c24cdf38a270b33f56290abf3.zip
ipmi-fru-parser-c19c054c01b7a42c24cdf38a270b33f56290abf3.tar.gz
Inventory:- Make changes in the mako and the C++ structure
This change lies in the Write Fru Data command processing. As fru yaml would be having extra properties like entityID,entityInstance,So changes were needed to make the change in the corresponding c++ structure. Change-Id: If23bb12563cdef34438746e2d6a8be7f54b7486d Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
-rw-r--r--frup.hpp17
-rw-r--r--scripts/example.yaml221
-rw-r--r--scripts/writefru.mako.cpp13
-rw-r--r--writefrudata.cpp6
4 files changed, 143 insertions, 114 deletions
diff --git a/frup.hpp b/frup.hpp
index 15b5eaf..3f68acd 100644
--- a/frup.hpp
+++ b/frup.hpp
@@ -84,16 +84,25 @@ struct IPMIFruData
};
using DbusProperty = std::string;
-using DbusPropertyVec = std::vector<std::pair<DbusProperty,IPMIFruData>>;
+using DbusPropertyVec = std::vector<std::pair<DbusProperty, IPMIFruData>>;
using DbusInterface = std::string;
-using DbusInterfaceVec = std::vector<std::pair<DbusInterface,DbusPropertyVec>>;
+using DbusInterfaceVec = std::vector<std::pair<DbusInterface, DbusPropertyVec>>;
using FruInstancePath = std::string;
-using FruInstanceVec = std::vector<std::pair<FruInstancePath,DbusInterfaceVec>>;
+
+struct FruInstance
+{
+ uint8_t entityID;
+ uint8_t entityInstance;
+ FruInstancePath path;
+ DbusInterfaceVec interfaces;
+};
+
+using FruInstanceVec = std::vector<FruInstance>;
using FruId = uint32_t;
-using FruMap = std::map<FruId,FruInstanceVec>;
+using FruMap = std::map<FruId, FruInstanceVec>;
/* Parse an IPMI write fru data message into a dictionary containing name value pair of VPD entries.*/
int parse_fru (const void* msgbuf, sd_bus_message* vpdtbl);
diff --git a/scripts/example.yaml b/scripts/example.yaml
index 69d7ebd..d257d42 100644
--- a/scripts/example.yaml
+++ b/scripts/example.yaml
@@ -7,118 +7,133 @@
# Format of the YAML:
# Fruid:
# Associated Fru paths
-# d-bus Interafaces
+# d-bus Interfaces
# d-bus Properties
# IPMI Fru mapping
0:
/system:
- xyz.openbmc_project.Inventory.Item:
- PrettyName:
- IPMIFruProperty: Product Name
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Decorator.Asset:
- Manufacturer:
- IPMIFruProperty: Manufacturer
- IPMIFruSection: Product
- PartNumber:
- IPMIFruProperty: Part Number
- IPMIFruSection: Product
- SerialNumber:
- IPMIFruProperty: Serial Number
- IPMIFruSection: Product
- BuildDate:
- IPMIFruProperty: Mfg Date
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Revision:
- Version:
- IPMIFruProperty: Version
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Item.System:
+ entityID: 200
+ entityInstance: 1
+ interfaces:
+ xyz.openbmc_project.Inventory.Item:
+ PrettyName:
+ IPMIFruProperty: Product Name
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Decorator.Asset:
+ Manufacturer:
+ IPMIFruProperty: Manufacturer
+ IPMIFruSection: Product
+ PartNumber:
+ IPMIFruProperty: Part Number
+ IPMIFruSection: Product
+ SerialNumber:
+ IPMIFruProperty: Serial Number
+ IPMIFruSection: Product
+ BuildDate:
+ IPMIFruProperty: Mfg Date
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Decorator.Revision:
+ Version:
+ IPMIFruProperty: Version
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Item.System:
1:
/system/chassis/motherboard/dimm0:
- xyz.openbmc_project.Inventory.Item:
- PrettyName:
- IPMIFruProperty: Product Name
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Decorator.Asset:
- Manufacturer:
- IPMIFruProperty: Manufacturer
- IPMIFruSection: Product
- BuildDate:
- IPMIFruProperty: Mfg Date
- IPMIFruSection: Product
- SerialNumber:
- IPMIFruProperty: Serial Number
- IPMIFruSection: Product
- PartNumber:
- IPMIFruProperty: Part Number
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Revision:
- Version:
- IPMIFruProperty: Version
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Item.Dimm:
+ entityID: 8
+ entityInstance: 1
+ interfaces:
+ xyz.openbmc_project.Inventory.Item:
+ PrettyName:
+ IPMIFruProperty: Product Name
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Decorator.Asset:
+ Manufacturer:
+ IPMIFruProperty: Manufacturer
+ IPMIFruSection: Product
+ BuildDate:
+ IPMIFruProperty: Mfg Date
+ IPMIFruSection: Product
+ SerialNumber:
+ IPMIFruProperty: Serial Number
+ IPMIFruSection: Product
+ PartNumber:
+ IPMIFruProperty: Part Number
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Decorator.Revision:
+ Version:
+ IPMIFruProperty: Version
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Item.Dimm:
2:
/system/chassis/motherboard/dimm1:
- xyz.openbmc_project.Inventory.Item:
- PrettyName:
- IPMIFruProperty: Product Name
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Decorator.Asset:
- Manufacturer:
- IPMIFruProperty: Manufacturer
- IPMIFruSection: Product
- BuildDate:
- IPMIFruProperty: Mfg Date
- IPMIFruSection: Product
- SerialNumber:
- IPMIFruProperty: Serial Number
- IPMIFruSection: Product
- PartNumber:
- IPMIFruProperty: Part Number
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Revision:
- Version:
- IPMIFruProperty: Version
- IPMIFruSection: Product
- xyz.openbmc_project.Inventory.Item.Dimm:
+ entityID: 8
+ entityInstance: 2
+ interfaces:
+ xyz.openbmc_project.Inventory.Item:
+ PrettyName:
+ IPMIFruProperty: Product Name
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Decorator.Asset:
+ Manufacturer:
+ IPMIFruProperty: Manufacturer
+ IPMIFruSection: Product
+ BuildDate:
+ IPMIFruProperty: Mfg Date
+ IPMIFruSection: Product
+ SerialNumber:
+ IPMIFruProperty: Serial Number
+ IPMIFruSection: Product
+ PartNumber:
+ IPMIFruProperty: Part Number
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Decorator.Revision:
+ Version:
+ IPMIFruProperty: Version
+ IPMIFruSection: Product
+ xyz.openbmc_project.Inventory.Item.Dimm:
3:
/system/chassis/motherboard/cpu0:
- xyz.openbmc_project.Inventory.Item:
- PrettyName:
- IPMIFruProperty: Product Name
- IPMIFruSection: Board
- xyz.openbmc_project.Inventory.Decorator.Asset:
- BuildDate:
- IPMIFruProperty: Mfg Date
- IPMIFruSection: Board
- SerialNumber:
- IPMIFruProperty: Serial Number
- IPMIFruSection: Board
- PartNumber:
- IPMIFruProperty: Part Number
- IPMIFruSection: Board
- Manufacturer:
- IPMIFruProperty: Manufacturer
- IPMIFruSection: Board
- xyz.openbmc_project.Inventory.Item.Cpu:
+ entityID: 3
+ entityInstance: 1
+ interfaces:
+ xyz.openbmc_project.Inventory.Item:
+ PrettyName:
+ IPMIFruProperty: Product Name
+ IPMIFruSection: Board
+ xyz.openbmc_project.Inventory.Decorator.Asset:
+ BuildDate:
+ IPMIFruProperty: Mfg Date
+ IPMIFruSection: Board
+ SerialNumber:
+ IPMIFruProperty: Serial Number
+ IPMIFruSection: Board
+ PartNumber:
+ IPMIFruProperty: Part Number
+ IPMIFruSection: Board
+ Manufacturer:
+ IPMIFruProperty: Manufacturer
+ IPMIFruSection: Board
+ xyz.openbmc_project.Inventory.Item.Cpu:
4:
/system/chassis/motherboard/cpu1:
- xyz.openbmc_project.Inventory.Item:
- PrettyName:
- IPMIFruProperty: Product Name
- IPMIFruSection: Board
- xyz.openbmc_project.Inventory.Decorator.Asset:
- BuildDate:
- IPMIFruProperty: Mfg Date
- IPMIFruSection: Board
- SerialNumber:
- IPMIFruProperty: Serial Number
- IPMIFruSection: Board
- PartNumber:
- IPMIFruProperty: Part Number
- IPMIFruSection: Board
- Manufacturer:
- IPMIFruProperty: Manufacturer
- IPMIFruSection: Board
- xyz.openbmc_project.Inventory.Item.Cpu:
+ entityID: 3
+ entityInstance: 2
+ interfaces:
+ xyz.openbmc_project.Inventory.Item:
+ PrettyName:
+ IPMIFruProperty: Product Name
+ IPMIFruSection: Board
+ xyz.openbmc_project.Inventory.Decorator.Asset:
+ BuildDate:
+ IPMIFruProperty: Mfg Date
+ IPMIFruSection: Board
+ SerialNumber:
+ IPMIFruProperty: Serial Number
+ IPMIFruSection: Board
+ PartNumber:
+ IPMIFruProperty: Part Number
+ IPMIFruSection: Board
+ Manufacturer:
+ IPMIFruProperty: Manufacturer
+ IPMIFruSection: Board
+ xyz.openbmc_project.Inventory.Item.Cpu:
diff --git a/scripts/writefru.mako.cpp b/scripts/writefru.mako.cpp
index 0a0a14f..a3de4b5 100644
--- a/scripts/writefru.mako.cpp
+++ b/scripts/writefru.mako.cpp
@@ -6,17 +6,22 @@ extern const FruMap frus = {
% for key in fruDict.keys():
{${key},{
<%
- fru = fruDict[key]
+ instanceList = fruDict[key]
%>
- % for object,interfaces in fru.items():
- {"${object}",{
+ % for instancePath,instanceInfo in instanceList.items():
+<%
+ entityID = instanceInfo["entityID"]
+ entityInstance = instanceInfo["entityInstance"]
+ interfaces = instanceInfo["interfaces"]
+%>
+ {${entityID}, ${entityInstance}, "${instancePath}",{
% for interface,properties in interfaces.items():
{"${interface}",{
% if properties:
% for dbus_property,property_value in properties.items():
{"${dbus_property}",{
"${property_value.get("IPMIFruSection", "")}",
- "${property_value.get("IPMIFruProperty", "")}", \
+ "${property_value.get("IPMIFruProperty", "")}",\
<%
delimiter = property_value.get("IPMIFruValueDelimiter")
if not delimiter:
diff --git a/writefrudata.cpp b/writefrudata.cpp
index 97282ea..6e1fbec 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -353,9 +353,9 @@ int ipmi_update_inventory(fru_area_vec_t& area_vec, sd_bus* bus_sd)
for (auto& instance : instanceList)
{
InterfaceMap interfaces;
- const auto& extrasIter = extras.find(instance.first);
+ const auto& extrasIter = extras.find(instance.path);
- for (auto& interfaceList : instance.second)
+ for (auto& interfaceList : instance.interfaces)
{
PropertyMap props;//store all the properties
for (auto& properties : interfaceList.second)
@@ -388,7 +388,7 @@ int ipmi_update_inventory(fru_area_vec_t& area_vec, sd_bus* bus_sd)
}
// Call the inventory manager
- sdbusplus::message::object_path path = instance.first;
+ sdbusplus::message::object_path path = instance.path;
// Check and update extra properties
if(extras.end() != extrasIter)
{
OpenPOWER on IntegriCloud