ipmi_fru_info_area: Add support for chassis type
Change-Id: Ifd89fb37dc8515757d6014edeb028eb25e37bb95
Signed-off-by: Oskar Senft <osk@google.com>
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp
index 949d546..e10eee5 100644
--- a/ipmi_fru_info_area.cpp
+++ b/ipmi_fru_info_area.cpp
@@ -20,6 +20,7 @@
static constexpr auto model = "Model";
static constexpr auto prettyName = "PrettyName";
static constexpr auto version = "Version";
+static constexpr auto type = "Type";
// Board info areas
static constexpr auto board = "Board";
@@ -111,6 +112,25 @@
}
/**
+ * @brief Read chassis type property value from inventory and append to the FRU
+ * area data.
+ *
+ * @param[in] propMap map of property values
+ * @param[in,out] data FRU area data to be appended
+ */
+void appendChassisType(const PropertyMap& propMap, FruAreaData& data)
+{
+ uint8_t chassisType = 0; // Not specified
+ auto iter = propMap.find(type);
+ if (iter != propMap.end())
+ {
+ auto value = iter->second;
+ chassisType = std::stoi(value);
+ }
+ data.emplace_back(chassisType);
+}
+
+/**
* @brief Read property value from inventory and append to the FRU area data
*
* @param[in] key key to search for in the property inventory data
@@ -239,7 +259,7 @@
preFormatProcessing(false, fruAreaData);
// chassis type
- fruAreaData.emplace_back(0);
+ appendChassisType(propMap, fruAreaData);
// Chasiss part number, in config.yaml it is configured as model
appendData(model, propMap, fruAreaData);