VPD Tool: Emplace Present property
This commit adds logic which emplaces fru's
"Present" property in vpd-tool output.
Some frus doesn't have Present property by itself.
In such case, vpd-tool emplaces the fru's parent's
present property value and displays it to the user.
Test:
Tested on rainier.
1.
root@rain148bmc:/tmp# ./vpd-tool -i
[
{
"/system": {
"LocationCode": "U9105.42B.13BE920",
"Model": "9105-42B",
"Present": "true",
"SerialNumber": "13BE920",
"SubModel": "S0",
"TYPE": "FRU",
"type": "xyz.openbmc_project.Inventory.Item.System"
},
..
.
}
]
2.
root@p10bmc:/tmp# ./vpd-tool -o -O "/system/chassis/motherboard/vdd_vrm1"
[
{
"/system/chassis/motherboard/vdd_vrm1": {
"CC": "ABCD",
"DR": "CABCDARD ",
"FN": "1234",
"LocationCode": "U7123.ABC.12342-P0-C23",
"PN": "02CW34F",
"Present": "true",
"SN": "YH30W3R8X12D",
"TYPE": "FRU",
"type": "xyz.openbmc_project.Inventory.Item.Vrm"
}
}
]
3.
root@rain148bmc:/tmp# ./vpd-tool -o -O /system
[
{
"/system": {
"LocationCode": "U9105.42B.13BE920",
"Model": "9105-42B",
"Present": "true",
"SerialNumber": "13BE920",
"SubModel": "S0",
"TYPE": "FRU",
"type": "xyz.openbmc_project.Inventory.Item.System"
}
}
]
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: Ic2ff978a499f13b21e34fe37aa7ebd067ffcd34e
diff --git a/vpd_tool_impl.hpp b/vpd_tool_impl.hpp
index ac0b2f5..5ae9284 100644
--- a/vpd_tool_impl.hpp
+++ b/vpd_tool_impl.hpp
@@ -123,6 +123,15 @@
*/
openpower::vpd::Binary toBinary(const std::string& value);
+ /**
+ * @brief Get the json which has Present property value of the given fru.
+ * @param[in] invPath - inventory path of the fru.
+ * @param[out] parentPresence - Update the parent fru's present property.
+ * @return output json which has the Present property value.
+ */
+ json getPresentPropJson(const std::string& invPath,
+ std::string& parentPresence);
+
public:
/**
* @brief Dump the complete inventory in JSON format