psu-ng: Validate configuration during power on

Create a function to validate the power supply configuration. Initially,
check that all power supplies are of the same model, and if not, create
an error log. This function will later add checks for total number of
power supplies and expected input voltage.

The validation is run on every power on. To cover the case where entity
manager has not run yet on power, trigger the validation on interfaces
added signal. Use a boolean flag to determine if the validation needs to
be run to avoid running it multiple times.

Tested: Verified the validation was successful on Rainier.
        Verified the error log data:
$ curl -k -H "X-Auth-Token: $token" \
  https://${bmc}/xyz/openbmc_project/logging/entry/2
{
  "data": {
    "AdditionalData": [
      "ACTUAL_MODEL=51E8",
      "CALLOUT_INVENTORY_PATH=/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1",
      "EXPECTED_MODEL=51E9"
    ],
    "Associations": [],
    "Id": 2,
    "Message":
"xyz.openbmc_project.Power.PowerSupply.Error.NotSupported",
    "Path":
"/var/lib/phosphor-logging/extensions/pels/logs/2021040718580625_50000002",

Change-Id: Ib8dd23465bfd36b510197a88d41fc8419862f33b
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index a59b2fc..f1f1220 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -84,16 +84,19 @@
             if (state)
             {
                 powerOn = true;
+                validateConfig();
             }
             else
             {
                 powerOn = false;
+                runValidateConfig = true;
             }
         }
         catch (std::exception& e)
         {
             log<level::INFO>("Failed to get power state. Assuming it is off.");
             powerOn = false;
+            runValidateConfig = true;
         }
 
         onOffConfig(phosphor::pmbus::ON_OFF_CONFIG_CONTROL_PIN_ONLY);
@@ -222,6 +225,21 @@
     void populateSysProperties(const util::DbusPropertyMap& properties);
 
     /**
+     * @brief Perform power supply configuration validation.
+     * @details Validates if the existing power supply properties are a
+     * supported configuration, and acts on its findings such as logging errors.
+     */
+    void validateConfig();
+
+    /**
+     * @brief Flag to indicate if the validateConfig() function should be run.
+     * Set to false once the configuration has been validated to avoid running
+     * multiple times due to interfaces added signal. Set to true during power
+     * off to trigger the validation on power on.
+     */
+    bool runValidateConfig = true;
+
+    /**
      * @brief Map of supported PSU configurations that include the model name
      * and their properties.
      */