config: error on invalid configuration

Since the default led priority is no longer 'Blink', the priority now
has to be explicitly defined when using either group priority or led
priority.

If a configuration does not define the priority, the configuration is
invalid and in the yaml case, phosphor-led-manager should fail to build,
in the json case, the process should exit due to the configuration
error.

The config validation has been extracted into it's own file and made
separate from json config parsing.

So every config will go through the same validation even if its been
created via yaml.

Change-Id: Ifda65942b0768d6c0d3b25076f7a1236b46b3d9f
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/utest-led-yaml-group-priority.cpp b/test/utest-led-yaml-group-priority.cpp
index e48a199..b257c17 100644
--- a/test/utest-led-yaml-group-priority.cpp
+++ b/test/utest-led-yaml-group-priority.cpp
@@ -26,13 +26,14 @@
 
     phosphor::led::Layout::GroupLayout group = systemLedMap.at(groupPath);
 
-    EXPECT_EQ(group.priority, 0);
+    EXPECT_EQ(group.priority, 1);
     EXPECT_EQ(group.actionSet.size(), 1);
 
     for (auto& led : group.actionSet)
     {
         EXPECT_EQ(led.name, "led1");
         EXPECT_EQ(led.action, Action::On);
+        EXPECT_EQ(led.priority, std::nullopt);
     }
 }
 
@@ -43,13 +44,14 @@
 
     phosphor::led::Layout::GroupLayout group = systemLedMap.at(groupPath);
 
-    EXPECT_EQ(group.priority, 0);
+    EXPECT_EQ(group.priority, 2);
     EXPECT_EQ(group.actionSet.size(), 1);
 
     for (auto& led : group.actionSet)
     {
         EXPECT_EQ(led.name, "led1");
         EXPECT_EQ(led.action, Action::Off);
+        EXPECT_EQ(led.priority, std::nullopt);
     }
 }
 
@@ -60,7 +62,7 @@
 
     phosphor::led::Layout::GroupLayout group = systemLedMap.at(groupPath);
 
-    EXPECT_EQ(group.priority, 0);
+    EXPECT_EQ(group.priority, 3);
     EXPECT_EQ(group.actionSet.size(), 1);
 
     for (auto& led : group.actionSet)
@@ -69,6 +71,7 @@
         EXPECT_EQ(led.action, Action::Blink);
         EXPECT_EQ(led.dutyOn, 50);
         EXPECT_EQ(led.period, 1000);
+        EXPECT_EQ(led.priority, std::nullopt);
     }
 }
 
@@ -88,11 +91,13 @@
         if (led.name == "led1")
         {
             EXPECT_EQ(led.action, Action::On);
+            EXPECT_EQ(led.priority, std::nullopt);
             found++;
         }
         if (led.name == "led2")
         {
             EXPECT_EQ(led.action, Action::Off);
+            EXPECT_EQ(led.priority, std::nullopt);
             found++;
         }
     }