regulators: Allow empty expected VPD value

Modify the compare_vpd action to support specifying an empty string or
empty byte vector as the expected keyword value.

The VPD service was modified in a previous commit to return an empty
keyword value if the VPD interface or keyword does not exist on the
specified D-Bus object path.  Thus, the actual keyword value may be
empty.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: If48ab6423c40e5b24d6cff72264dc2efe750c85f
diff --git a/phosphor-regulators/test/validate-regulators-config_tests.cpp b/phosphor-regulators/test/validate-regulators-config_tests.cpp
index f6033d5..2763cc9 100644
--- a/phosphor-regulators/test/validate-regulators-config_tests.cpp
+++ b/phosphor-regulators/test/validate-regulators-config_tests.cpp
@@ -702,12 +702,20 @@
     compareVpdFile["rules"][0]["actions"][1]["compare_vpd"]["keyword"] = "CCIN";
     compareVpdFile["rules"][0]["actions"][1]["compare_vpd"]["value"] = "2D35";
 
-    // Valid.
+    // Valid: value property: not empty.
     {
         json configFile = compareVpdFile;
         EXPECT_JSON_VALID(configFile);
     }
-    // Valid, using byte_values.
+
+    // Valid: value property: empty.
+    {
+        json configFile = compareVpdFile;
+        configFile["rules"][0]["actions"][1]["compare_vpd"]["value"] = "";
+        EXPECT_JSON_VALID(configFile);
+    }
+
+    // Valid: byte_values property: not empty.
     {
         json configFile = compareVpdFile;
         configFile["rules"][0]["actions"][1]["compare_vpd"].erase("value");
@@ -716,6 +724,15 @@
         EXPECT_JSON_VALID(configFile);
     }
 
+    // Valid: byte_values property: empty.
+    {
+        json configFile = compareVpdFile;
+        configFile["rules"][0]["actions"][1]["compare_vpd"].erase("value");
+        configFile["rules"][0]["actions"][1]["compare_vpd"]["byte_values"] =
+            json::array();
+        EXPECT_JSON_VALID(configFile);
+    }
+
     // Invalid: no FRU property.
     {
         json configFile = compareVpdFile;
@@ -785,16 +802,6 @@
                             "'0x50' is not of type 'array'");
     }
 
-    // Invalid: property byte_values is empty
-    {
-        json configFile = compareVpdFile;
-        configFile["rules"][0]["actions"][1]["compare_vpd"].erase("value");
-        configFile["rules"][0]["actions"][1]["compare_vpd"]["byte_values"] =
-            json::array();
-        EXPECT_JSON_INVALID(configFile, "Validation failed.",
-                            "[] is too short");
-    }
-
     // Invalid: properties byte_values and value both exist
     {
         json configFile = compareVpdFile;