Worker changes for VPD collection mode
This commit updates worker class to handle VPD collection mode. In PST
systems which are in non field mode, VPD collection can be from
hardware, file or in mixed mode. Hence, worker needs to have a parameter
to specify VPD collection mode, so that system VPD, FRUs VPD collection
flow can be redirected accordingly.
Change-Id: I18fa27c5839e1fba639265392c9c305a0e0f0142
Signed-off-by: Souvik Roy <souvikroyofficial10@gmail.com>
diff --git a/vpd-manager/include/types.hpp b/vpd-manager/include/types.hpp
index 169e128..cdc053f 100644
--- a/vpd-manager/include/types.hpp
+++ b/vpd-manager/include/types.hpp
@@ -192,6 +192,17 @@
VpdParseError /* Should be used in case of any generic VPD parsing error. */
};
+/**
+ * @brief Enum which defines VPD collection modes
+ */
+enum class VpdCollectionMode : uint8_t
+{
+ HARDWARE_MODE,
+ MIXED_MODE,
+ FILE_MODE,
+ DEFAULT_MODE = HARDWARE_MODE
+};
+
using InventoryCalloutData = std::tuple<std::string, CalloutPriority>;
using DeviceCalloutData = std::tuple<std::string, std::string>;
using I2cBusCalloutData = std::tuple<std::string, std::string, std::string>;
diff --git a/vpd-manager/include/worker.hpp b/vpd-manager/include/worker.hpp
index 38d108d..25f692e 100644
--- a/vpd-manager/include/worker.hpp
+++ b/vpd-manager/include/worker.hpp
@@ -43,12 +43,16 @@
*
* @param[in] pathToConfigJSON - Path to the config JSON, if applicable.
* @param[in] i_maxThreadCount - Maximum thread while collecting FRUs VPD.
+ * @param[in] i_vpdCollectionMode - Mode in which VPD collection should take
+ * place.
*
* Note: Throws std::exception in case of construction failure. Caller needs
* to handle to detect successful object creation.
*/
Worker(std::string pathToConfigJson = std::string(),
- uint8_t i_maxThreadCount = constants::MAX_THREADS);
+ uint8_t i_maxThreadCount = constants::MAX_THREADS,
+ types::VpdCollectionMode i_vpdCollectionMode =
+ types::VpdCollectionMode::DEFAULT_MODE);
/**
* @brief Destructor
@@ -153,6 +157,16 @@
}
/**
+ * @brief API to get VPD collection mode
+ *
+ * @return VPD collection mode enum value
+ */
+ inline types::VpdCollectionMode getVpdCollectionMode() const
+ {
+ return m_vpdCollectionMode;
+ }
+
+ /**
* @brief Collect single FRU VPD
* API can be used to perform VPD collection for the given FRU, only if the
* current state of the system matches with the state at which the FRU is
@@ -565,5 +579,9 @@
// List of EEPROM paths for which VPD collection thread creation has failed.
std::forward_list<std::string> m_failedEepromPaths;
+
+ // VPD collection mode
+ types::VpdCollectionMode m_vpdCollectionMode{
+ types::VpdCollectionMode::DEFAULT_MODE};
};
} // namespace vpd