regulators: Treat missing VPD keyword as empty

Modify the VPD service to return an empty value if the specified VPD
interface or keyword does not exist on the specified object path.

This condition can occur when the system is operating normally and
should not result in an error being logged.

Tested:
* Verified an empty value is returned if the VPD interface does not
  exist on the object path.
* Verified an empty value is returned if the VPD keyword does not exist
  on the object path.
* Verified correct value is returned if the VPD interface and keyword
  exist
* See complete test plan at
  https://gist.github.com/smccarney/47b167706da49c7d78c4df818040ae72

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Iaa7c24f4e00ee17506fd5acfd0145c733fa0d57b
diff --git a/phosphor-regulators/src/vpd.hpp b/phosphor-regulators/src/vpd.hpp
index 4af3fa7..f2741d1 100644
--- a/phosphor-regulators/src/vpd.hpp
+++ b/phosphor-regulators/src/vpd.hpp
@@ -16,6 +16,7 @@
 #pragma once
 
 #include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
 
 #include <cstdint>
 #include <map>
@@ -102,6 +103,32 @@
 
   private:
     /**
+     * Gets the value of the specified VPD keyword from a D-Bus interface and
+     * property.
+     *
+     * Throws an exception if an error occurs while obtaining the VPD
+     * value.
+     *
+     * @param inventoryPath D-Bus inventory path of the hardware
+     * @param keyword VPD keyword
+     * @param value the resulting keyword value
+     */
+    void getDBusProperty(const std::string& inventoryPath,
+                         const std::string& keyword,
+                         std::vector<uint8_t>& value);
+
+    /**
+     * Returns whether the specified D-Bus exception indicates the VPD interface
+     * or property does not exist for the specified inventory path.
+     *
+     * This is treated as an "empty" keyword value rather than an error
+     * condition.
+     *
+     * @return true if exception indicates interface/property does not exist
+     */
+    bool isUnknownPropertyException(const sdbusplus::exception_t& e);
+
+    /**
      * Type alias for map from keyword names to values.
      */
     using KeywordMap = std::map<std::string, std::vector<uint8_t>>;