API to check powerVS configuration
The commit implements change to check for powerVS configuration.
It is a combination of system series and driver running on the system.
Once that is established, only after that VPD vpdate will take place
w.r.t powerVS system.
Change-Id: I93fefcb79ced4f89bd6f5143666b4cd487897ac8
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/include/utility/vpd_specific_utility.hpp b/vpd-manager/include/utility/vpd_specific_utility.hpp
index 83db199..4fc553d 100644
--- a/vpd-manager/include/utility/vpd_specific_utility.hpp
+++ b/vpd-manager/include/utility/vpd_specific_utility.hpp
@@ -687,5 +687,45 @@
return l_rc;
}
+
+/**
+ * @brief API to detect if system configuration is that of PowerVS system.
+ *
+ * @param[in] i_imValue - IM value of the system.
+ * @return true if it is PowerVS configuration, false otherwise.
+ */
+inline bool isPowerVsConfiguration(const types::BinaryVector& i_imValue)
+{
+ if (i_imValue.empty() || i_imValue.size() != constants::VALUE_4)
+ {
+ return false;
+ }
+
+ // Should be a 0x5000XX series system.
+ if (i_imValue.at(0) == constants::HEX_VALUE_50 &&
+ i_imValue.at(1) == constants::HEX_VALUE_00)
+ {
+ std::string l_imagePrefix = dbusUtility::getImagePrefix();
+
+ // Check image for 0x500030XX series.
+ if ((i_imValue.at(2) == constants::HEX_VALUE_30) &&
+ ((l_imagePrefix == constants::powerVsImagePrefix_MY) ||
+ (l_imagePrefix == constants::powerVsImagePrefix_NY)))
+ {
+ logging::logMessage("PowerVS configuration");
+ return true;
+ }
+
+ // Check image for 0X500010XX series.
+ if ((i_imValue.at(2) == constants::HEX_VALUE_10) &&
+ ((l_imagePrefix == constants::powerVsImagePrefix_MZ) ||
+ (l_imagePrefix == constants::powerVsImagePrefix_NZ)))
+ {
+ logging::logMessage("PowerVS configuration");
+ return true;
+ }
+ }
+ return false;
+}
} // namespace vpdSpecificUtility
} // namespace vpd