Add APIs for parsing BIOS configuration JSON

1) Add API to get the BIOS strings from the JSON configuration files.
2) Add API to parse the config file and setup the lookup data structures
   for the BIOS attribute table and BIOS attribute value table.
3) Add API to get the possible values and the default values for the BIOS
   enumeration type.
4) Add API to get the current value of the BIOS enumeration attribute.
5) BIOS attributes can be configured by JSON configuration files which have
   information to build the BIOS string table, attribute table and attribute
   value table.

Change-Id: I747dd3cfc0801f8262ffafe2d516ae7f4ddeb7a2
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/test/libpldmresponder_bios_test.cpp b/test/libpldmresponder_bios_test.cpp
index bcd3e5c..6e404de 100644
--- a/test/libpldmresponder_bios_test.cpp
+++ b/test/libpldmresponder_bios_test.cpp
@@ -1,5 +1,5 @@
-
 #include "libpldmresponder/bios.hpp"
+#include "libpldmresponder/bios_parser.hpp"
 
 #include <string.h>
 
@@ -44,3 +44,53 @@
     ASSERT_EQ(0x4, month);
     ASSERT_EQ(0x2019, year);
 }
+
+TEST(GetBIOSStrings, allScenarios)
+{
+    using namespace bios_parser;
+    // All the BIOS Strings in the BIOS JSON config files.
+    Strings vec{"HMCManagedState",  "On",         "Off",
+                "FWBootSide",       "Perm",       "Temp",
+                "InbandCodeUpdate", "Allowed",    "NotAllowed",
+                "CodeUpdatePolicy", "Concurrent", "Disruptive"};
+
+    Strings nullVec{};
+
+    // Invalid directory
+    auto strings = bios_parser::getStrings("./bios_json");
+    ASSERT_EQ(strings == nullVec, true);
+
+    strings = bios_parser::getStrings("./bios_jsons");
+    ASSERT_EQ(strings == vec, true);
+}
+
+TEST(getAttrValue, allScenarios)
+{
+    using namespace bios_parser::bios_enum;
+
+    // Invalid directory
+    auto rc = setupValueLookup("./bios_json");
+    ASSERT_EQ(rc, -1);
+
+    // Initializes the lookup data structures
+    rc = setupValueLookup("./bios_jsons");
+    ASSERT_EQ(rc, 0);
+
+    // All the BIOS Strings in the BIOS JSON config files.
+    AttrValuesMap valueMap{
+        {"HMCManagedState", {false, {"On", "Off"}, {"On"}}},
+        {"FWBootSide", {false, {"Perm", "Temp"}, {"Perm"}}},
+        {"InbandCodeUpdate", {false, {"Allowed", "NotAllowed"}, {"Allowed"}}},
+        {"CodeUpdatePolicy",
+         {false, {"Concurrent", "Disruptive"}, {"Concurrent"}}}};
+
+    auto values = getValues();
+    ASSERT_EQ(valueMap == values, true);
+
+    CurrentValues cv{"Concurrent"};
+    auto value = getAttrValue("CodeUpdatePolicy");
+    ASSERT_EQ(value == cv, true);
+
+    // Invalid attribute name
+    ASSERT_THROW(getAttrValue("CodeUpdatePolic"), std::out_of_range);
+}