Support multiple inventory objects per EEPROM
This commit enables the IBM VPD parser to add multiple
inventory objects based on the contents of a single EEPROM.
An example would be inventory items that share data with the
parent FRU that actually contains the VPD, such as an ethernet
port on the BMC card.
The commit also adds support for encoding keyword data in
formats other than just converting them to string before
publishing it on D-Bus. While this commit only adds MAC address
as a possible encoding, more can be added in the future by
specifying the encoding in the inventory JSON.
Tested: Verified the following:
* D-Bus objects added to the inventory for the BMC FRU and its
associated connectors.
* The ethernet objects are populated with the MACAddress property.
Sample output from D-Bus:
root@rainier:~# busctl get-property xyz.openbmc_project.Inventory.Manager
/xyz/openbmc_project/inventory/system/chassis/motherboard/ebmc_card_bmc/ethernet0
xyz.openbmc_project.Inventory.Item.NetworkInterface MACAddress --no-pager
s "00:11:25:c1:00:00"
root@rainier:~# busctl get-property xyz.openbmc_project.Inventory.Manager
/xyz/openbmc_project/inventory/system/chassis/motherboard/ebmc_card_bmc/ethernet1
xyz.openbmc_project.Inventory.Item.NetworkInterface MACAddress --no-pager
s "00:11:25:c1:00:01"
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: Iee839b405c60e7e825f709e4ad0bb0f63d11a1b3
diff --git a/impl.cpp b/impl.cpp
index 35a0e0f..25da01f 100644
--- a/impl.cpp
+++ b/impl.cpp
@@ -1,6 +1,7 @@
#include "impl.hpp"
#include "defines.hpp"
+#include "utils.hpp"
#include <algorithm>
#include <exception>
@@ -67,12 +68,6 @@
using ECCOffset = uint16_t;
using ECCLength = uint16_t;
-constexpr auto toHex(size_t c)
-{
- constexpr auto map = "0123456789abcdef";
- return map[c];
-}
-
} // namespace
namespace offsets
@@ -221,6 +216,7 @@
std::size_t dataLength,
Binary::const_iterator iterator)
{
+ using namespace openpower::vpd;
switch (std::get<keyword::Encoding>(keyword))
{
case keyword::Encoding::ASCII: