pseq: Add presence checking

As a circumvention for hardware problems, it can be necessary to check
for device presence in order to prevent calling out not present
components. Add the ability to configure presence checking in the PSEQ
configuration files and use presence, when configured, in problem
determination.

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: Ia9d8ee57f2d643f61ece45d9c03d523b891e98b8
diff --git a/phosphor-power-sequencer/src/ucd90320_monitor.hpp b/phosphor-power-sequencer/src/ucd90320_monitor.hpp
index 7f1d137..59e784c 100644
--- a/phosphor-power-sequencer/src/ucd90320_monitor.hpp
+++ b/phosphor-power-sequencer/src/ucd90320_monitor.hpp
@@ -17,6 +17,13 @@
 {
     std::string name;
     unsigned int line;
+    std::string presence;
+};
+
+struct Rail
+{
+    std::string name;
+    std::string presence;
 };
 
 /**
@@ -69,9 +76,9 @@
     pmbus::PMBus pmbusInterface;
 
     /**
-     * List of rail names
+     * List of rails
      */
-    std::vector<std::string> rails;
+    std::vector<Rail> rails;
 
     /**
      * Finds the list of compatible system types using D-Bus methods.
@@ -91,6 +98,17 @@
     void findConfigFile(const std::vector<std::string>& compatibleSystemTypes);
 
     /**
+     * Returns whether the hardware with the specified inventory path is
+     * present.
+     * If an error occurs while obtaining the presence value, presence is
+     * assumed to be false. An empty string path indicates no presence check is
+     * needed.
+     * @param inventoryPath D-Bus inventory path of the hardware
+     * @return true if hardware is present, false otherwise
+     */
+    bool isPresent(const std::string& inventoryPath);
+
+    /**
      * Analyzes the device pins for errors when the device is known to be in an
      * error state.
      * @param message Message property of the error log entry