regulators: Add VPD service
The regulators application needs to obtain VPD (Vital Product Data)
keyword values.
Sometimes regulator configuration and monitoring varies depending on
hardware type or version. VPD keyword values can provide this
information about the hardware.
Add a new class to obtain hardware VPD from the D-Bus
xyz.openbmc_project.Inventory.Decorator.Asset interface.
Also define an abstract base class and a mock implementation to
enable use of gmock in test cases related to VPD.
Tested:
* Verified VPD values were successfully obtained from D-Bus.
* Verified VPD values were cached.
* Tested where object path was invalid.
* Tested where keyword was invalid.
* Verified cached VPD values were cleared when machine powered on.
* For the complete test plan, see
https://gist.github.com/smccarney/519a54353361e28b1d25f5783c15f471
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Id08e8bca8db6421d46669c495e8a9432e45a1fd6
diff --git a/phosphor-regulators/src/services.hpp b/phosphor-regulators/src/services.hpp
index 8d6fc0d..44d438e 100644
--- a/phosphor-regulators/src/services.hpp
+++ b/phosphor-regulators/src/services.hpp
@@ -18,6 +18,7 @@
#include "error_logging.hpp"
#include "journal.hpp"
#include "presence_service.hpp"
+#include "vpd.hpp"
#include <sdbusplus/bus.hpp>
@@ -71,6 +72,13 @@
* @return hardware presence interface
*/
virtual PresenceService& getPresenceService() = 0;
+
+ /**
+ * Returns the interface to hardware VPD (Vital Product Data).
+ *
+ * @return hardware VPD interface
+ */
+ virtual VPD& getVPD() = 0;
};
/**
@@ -95,7 +103,7 @@
* @param bus D-Bus bus object
*/
explicit BMCServices(sdbusplus::bus::bus& bus) :
- bus{bus}, errorLogging{bus}, presenceService{bus}
+ bus{bus}, errorLogging{bus}, presenceService{bus}, vpd{bus}
{
}
@@ -123,6 +131,12 @@
return presenceService;
}
+ /** @copydoc Services::getVPD() */
+ virtual VPD& getVPD() override
+ {
+ return vpd;
+ }
+
private:
/**
* D-Bus bus object.
@@ -144,6 +158,11 @@
* Implementation of the PresenceService interface using D-Bus method calls.
*/
DBusPresenceService presenceService;
+
+ /**
+ * Implementation of the VPD interface using D-Bus method calls.
+ */
+ DBusVPD vpd;
};
} // namespace phosphor::power::regulators