]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3003] disabled ddns config in yang ut and fixed indentation
authorRazvan Becheriu <razvan@isc.org>
Tue, 8 Aug 2023 06:39:24 +0000 (09:39 +0300)
committerRazvan Becheriu <razvan@isc.org>
Tue, 8 Aug 2023 06:39:24 +0000 (09:39 +0300)
src/bin/agent/tests/parser_unittests.cc
src/bin/d2/tests/parser_unittest.cc
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/tests/parser_unittest.cc
src/bin/netconf/tests/parser_unittests.cc
src/lib/yang/tests/config_unittests.cc

index a9eecc7890a13375c7332d7b1d967378c8078998..56a5338cf325f9cd230013a34f3dd0a9b82c6716 100644 (file)
@@ -89,7 +89,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -105,13 +105,13 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                    "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
     string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 " { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -199,7 +199,6 @@ TEST(ParserTest, keywordSubAgent) {
         "    }"
         "   ]"
         "}";
-
     // This is only a subset of full config, so we'll parse with PARSER_SUB_AGENT.
     testParser(txt, ParserContext::PARSER_SUB_AGENT);
     testParser(txt, ParserContext::PARSER_JSON);
@@ -208,33 +207,32 @@ TEST(ParserTest, keywordSubAgent) {
 // Tests if bash (#) comments are supported. That's the only comment type that
 // was supported by the old parser.
 TEST(ParserTest, bashComments) {
-    string txt= "{ \"Control-agent\": {"
-                "  \"http-host\": \"localhost\","
-                "  \"http-port\": 9000,\n"
-                "  \"control-sockets\": {\n"
-                "    \"d2\": {\n"
-                "# this is a comment\n"
-                "\"socket-type\": \"unix\", \n"
-                "# This socket is mine. I can name it whatever\n"
-                "# I like, ok?\n"
-                "\"socket-name\": \"Hector\" \n"
-                "} } } }";
+    string txt = "{ \"Control-agent\": {"
+                 "  \"http-host\": \"localhost\","
+                 "  \"http-port\": 9000,\n"
+                 "  \"control-sockets\": {\n"
+                 "    \"d2\": {\n"
+                 "# this is a comment\n"
+                 "        \"socket-type\": \"unix\", \n"
+                 "# This socket is mine. I can name it whatever\n"
+                 "# I like, ok?\n"
+                 "        \"socket-name\": \"Hector\" \n"
+                 "} } } }";
     testParser(txt, ParserContext::PARSER_AGENT);
 }
 
 // Tests if C++ (//) comments can start anywhere, not just in the first line.
 TEST(ParserTest, cppComments) {
-    string txt= "{ \"Control-agent\": {"
-                "  \"http-host\": \"localhost\","
-                "  \"http-port\": 9001, // the level is over 9000!\n"
-                "  \"control-sockets\": {\n"
-                "    // Let's try talking to D2. Sadly, it never talks"
-                "    // to us back :( Maybe he doesn't like his name?\n"
-                "    \"d2\": {"
-                "\"socket-type\": \"unix\", \n"
-                "\"socket-name\": \"Hector\" \n"
-                "} } } }";
-
+    string txt = "{ \"Control-agent\": {"
+                 "  \"http-host\": \"localhost\","
+                 "  \"http-port\": 9001, // the level is over 9000!\n"
+                 "  \"control-sockets\": {\n"
+                 "    // Let's try talking to D2. Sadly, it never talks"
+                 "    // to us back :( Maybe he doesn't like his name?\n"
+                 "    \"d2\": {"
+                 "        \"socket-type\": \"unix\", \n"
+                 "        \"socket-name\": \"Hector\" \n"
+                 "} } } }";
     testParser(txt, ParserContext::PARSER_AGENT, false);
 }
 
@@ -245,8 +243,8 @@ TEST(ParserTest, bashCommentsInline) {
                 "  \"http-port\": 9000,\n"
                 "  \"control-sockets\": {\n"
                 "    \"d2\": {"
-                "\"socket-type\": \"unix\", # Maybe Hector is not really a \n"
-                "\"socket-name\": \"Hector\" # Unix process?\n"
+                "        \"socket-type\": \"unix\", # Maybe Hector is not really a \n"
+                "        \"socket-name\": \"Hector\" # Unix process?\n"
                 "# Oh no! He's a windows one and just pretending!\n"
                 "} } } }";
     testParser(txt, ParserContext::PARSER_AGENT, false);
@@ -254,46 +252,46 @@ TEST(ParserTest, bashCommentsInline) {
 
 // Tests if multi-line C style comments are handled correctly.
 TEST(ParserTest, multilineComments) {
-    string txt= "{ \"Control-agent\": {"
-                "  \"http-host\": \"localhost\","
-                "  \"http-port\": 9000,\n"
-                "  \"control-sockets\": {\n"
-                "    \"dhcp4\": {\n"
-                "        \"socket-type\": \"unix\"\n"
-                "    }\n"
-                "  /* Ok, forget about it. If Hector doesn't want to talk,\n"
-                "     we won't talk to him either. We now have quiet days. */\n"
-                "  /* \"d2\": {"
-                "  \"socket-type\": \"unix\",\n"
-                "\"socket-name\": \"Hector\"\n"
-                "}*/ } } }";
+    string txt = "{ \"Control-agent\": {"
+                 "  \"http-host\": \"localhost\","
+                 "  \"http-port\": 9000,\n"
+                 "  \"control-sockets\": {\n"
+                 "    \"dhcp4\": {\n"
+                 "        \"socket-type\": \"unix\"\n"
+                 "    }\n"
+                 "  /* Ok, forget about it. If Hector doesn't want to talk,\n"
+                 "     we won't talk to him either. We now have quiet days. */\n"
+                 "  /* \"d2\": {"
+                 "         \"socket-type\": \"unix\",\n"
+                 "         \"socket-name\": \"Hector\"\n"
+                 "}*/ } } }";
     testParser(txt, ParserContext::PARSER_AGENT, false);
 }
 
 // Tests if embedded comments are handled correctly.
 TEST(ParserTest, embbededComments) {
-    string txt= "{ \"Control-agent\": {"
-                "  \"comment\": \"a comment\","
-                "  \"http-host\": \"localhost\","
-                "  \"http-port\": 9000,\n"
-                "  \"control-sockets\": {\n"
-                "    \"dhcp4\": {\n"
-                "        \"user-context\": { \"comment\": \"indirect\" },\n"
-                "        \"socket-type\": \"unix\"\n"
-                "    } },\n"
-                "  \"user-context\": { \"compatible\": true }\n"
-                "} }";
+    string txt = "{ \"Control-agent\": {"
+                 "  \"comment\": \"a comment\","
+                 "  \"http-host\": \"localhost\","
+                 "  \"http-port\": 9000,\n"
+                 "  \"control-sockets\": {\n"
+                 "    \"dhcp4\": {\n"
+                 "        \"user-context\": { \"comment\": \"indirect\" },\n"
+                 "        \"socket-type\": \"unix\"\n"
+                 "    } },\n"
+                 "  \"user-context\": { \"compatible\": true }\n"
+                 "} }";
     testParser(txt, ParserContext::PARSER_AGENT, false);
 }
 
 // Test that output-options is an alias of output_options.
 TEST(ParserTest, outputDashOptions) {
-    string txt= "{ \"Control-agent\": {"
-                " \"loggers\": [ { "
-                "     \"name\": \"kea-ctrl-agent\","
-                "     \"output-options\": [ { \"output\": \"stdout\" } ],"
-                "     \"severity\": \"INFO\" } ]"
-                "} }";
+    string txt = "{ \"Control-agent\": {"
+                 " \"loggers\": [ { "
+                 "     \"name\": \"kea-ctrl-agent\","
+                 "     \"output-options\": [ { \"output\": \"stdout\" } ],"
+                 "     \"severity\": \"INFO\" } ]"
+                 "} }";
     testParser(txt, ParserContext::PARSER_AGENT, false);
 }
 
index 5d4068918c273f1f86861c333830e2e5242170fc..214738f6f0eef7475e5f6fc57f16c726a341c145 100644 (file)
@@ -91,7 +91,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
@@ -107,13 +107,13 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                    "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
     string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 " { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, D2ParserContext::PARSER_JSON);
 }
 
@@ -163,9 +163,9 @@ TEST(ParserTest, bashComments) {
             " \"ncr-protocol\": \"UDP\", \n"
             "# lots of comments here\n"
             "# and here\n"
-            "\"tsig-keys\": [], \n"
-            "\"forward-ddns\" : {}, \n"
-            "\"reverse-ddns\" : {} \n"
+            " \"tsig-keys\": [], \n"
+            " \"forward-ddns\" : {}, \n"
+            " \"reverse-ddns\" : {} \n"
             "} \n"
          "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
@@ -179,9 +179,9 @@ TEST(ParserTest, cppComments) {
             " \"ip-address\": \"192.168.77.1\", \n"
             " \"port\": 777, // this is a comment \n"
             " \"ncr-protocol\": \"UDP\", // everything after // is ignored\n"
-            "\"tsig-keys\": [], // this will be ignored, too\n"
-            "\"forward-ddns\" : {}, \n"
-            "\"reverse-ddns\" : {} \n"
+            " \"tsig-keys\": [], // this will be ignored, too\n"
+            " \"forward-ddns\" : {}, \n"
+            " \"reverse-ddns\" : {} \n"
             "} \n"
          "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
@@ -195,9 +195,9 @@ TEST(ParserTest, bashCommentsInline) {
             " \"ip-address\": \"192.168.77.1\", \n"
             " \"port\": 777, # this is a comment \n"
             " \"ncr-protocol\": \"UDP\", # everything after # is ignored\n"
-            "\"tsig-keys\": [], # this will be ignored, too\n"
-            "\"forward-ddns\" : {}, \n"
-            "\"reverse-ddns\" : {} \n"
+            " \"tsig-keys\": [], # this will be ignored, too\n"
+            " \"forward-ddns\" : {}, \n"
+            " \"reverse-ddns\" : {} \n"
             "} \n"
          "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
@@ -212,9 +212,9 @@ TEST(ParserTest, multilineComments) {
             " \"port\": 777, /* this is a C style comment\n"
             "that\n can \n span \n multiple \n lines */ \n"
             " \"ncr-protocol\": \"UDP\", \n"
-            "\"tsig-keys\": [], \n"
-            "\"forward-ddns\" : {}, \n"
-            "\"reverse-ddns\" : {} \n"
+            " \"tsig-keys\": [], \n"
+            " \"forward-ddns\" : {}, \n"
+            " \"reverse-ddns\" : {} \n"
             "} \n"
          "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
@@ -225,16 +225,16 @@ TEST(ParserTest, embbededComments) {
     string txt =
         "{ \"DhcpDdns\" : \n"
            "{ \n"
-            "\"comment\": \"a comment\",\n"
+            " \"comment\": \"a comment\",\n"
             " \"ip-address\": \"192.168.77.1\", \n"
             " \"port\": 777, \n "
             " \"ncr-protocol\": \"UDP\", \n"
-            "\"tsig-keys\" : [ { \n"
-            "    \"name\" : \"d2.md5.key\", \n"
-            "    \"user-context\" : { \"comment\" : \"indirect\" } } ], \n"
-            "\"forward-ddns\" : {}, \n"
-            "\"reverse-ddns\" : {}, \n"
-            "\"user-context\": { \"compatible\": true }"
+            " \"tsig-keys\" : [ { \n"
+            "     \"name\" : \"d2.md5.key\", \n"
+            "     \"user-context\" : { \"comment\" : \"indirect\" } } ], \n"
+            " \"forward-ddns\" : {}, \n"
+            " \"reverse-ddns\" : {}, \n"
+            " \"user-context\": { \"compatible\": true }"
             "} \n"
          "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
@@ -242,14 +242,14 @@ TEST(ParserTest, embbededComments) {
 
 // Test that output-options is an alias of output_options.
 TEST(ParserTest, outputDashOptions) {
-    string txt=
+    string txt =
         "{ \"DhcpDdns\" : \n"
             "{ \n"
-            "\"loggers\": [ {\n"
-            "    \"name\": \"kea-dhcp-ddns\",\n"
-            "    \"output-options\": [ { \"output\": \"stdout\" } ],\n"
-            "    \"severity\": \"INFO\" } ]\n"
-            "} \n"
+             " \"loggers\": [ {\n"
+             "     \"name\": \"kea-dhcp-ddns\",\n"
+             "     \"output-options\": [ { \"output\": \"stdout\" } ],\n"
+             "     \"severity\": \"INFO\" } ]\n"
+             "} \n"
         "} \n";
     testParser(txt, D2ParserContext::PARSER_DHCPDDNS, false);
 }
index 96ef8b2d54aa7808b9a7f653db1d184561ebf5d8..a226106faf7633045b81380b90819174099c1424 100644 (file)
@@ -89,7 +89,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
@@ -105,13 +105,13 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                    "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
     string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 " { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, Parser4Context::PARSER_JSON);
 }
 
@@ -135,7 +135,7 @@ TEST(ParserTest, keywordJSON) {
 
 TEST(ParserTest, keywordDhcp4) {
      string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
-                  " \"interfaces\": [ \"type\", \"htype\" ] },\n"
+                  "  \"interfaces\": [ \"type\", \"htype\" ] },\n"
                   "\"rebind-timer\": 2000, \n"
                   "\"renew-timer\": 1000, \n"
                   "\"subnet4\": [ { "
@@ -143,117 +143,117 @@ TEST(ParserTest, keywordDhcp4) {
                   "  \"id\": 1, "
                   "  \"subnet\": \"192.0.2.0/24\", "
                   "  \"interface\": \"test\" } ],\n"
-                   "\"valid-lifetime\": 4000 } }";
+                  "\"valid-lifetime\": 4000 } }";
      testParser(txt, Parser4Context::PARSER_DHCP4);
 }
 
 // Tests if bash (#) comments are supported. That's the only comment type that
 // was supported by the old parser.
 TEST(ParserTest, bashComments) {
-    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "# this is a comment\n"
-                "\"rebind-timer\": 2000, \n"
-                "# lots of comments here\n"
-                "# and here\n"
-                "\"renew-timer\": 1000, \n"
-                "\"subnet4\": [ { "
-                "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                "    \"id\": 1, "
-                "    \"subnet\": \"192.0.2.0/24\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "# this is a comment\n"
+                 "\"rebind-timer\": 2000, \n"
+                 "# lots of comments here\n"
+                 "# and here\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"subnet4\": [ { "
+                 "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
+                 "    \"id\": 1, "
+                 "    \"subnet\": \"192.0.2.0/24\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
 // Tests if C++ (//) comments can start anywhere, not just in the first line.
 TEST(ParserTest, cppComments) {
-    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"rebind-timer\": 2000, // everything after // is ignored\n"
-                "\"renew-timer\": 1000, // this will be ignored, too\n"
-                "\"subnet4\": [ { "
-                "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                "    \"id\": 1, "
-                "    \"subnet\": \"192.0.2.0/24\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"rebind-timer\": 2000, // everything after // is ignored\n"
+                 "\"renew-timer\": 1000, // this will be ignored, too\n"
+                 "\"subnet4\": [ { "
+                 "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
+                 "    \"id\": 1, "
+                 "    \"subnet\": \"192.0.2.0/24\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
 // Tests if bash (#) comments can start anywhere, not just in the first line.
 TEST(ParserTest, bashCommentsInline) {
-    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"rebind-timer\": 2000, # everything after # is ignored\n"
-                "\"renew-timer\": 1000, # this will be ignored, too\n"
-                "\"subnet4\": [ { "
-                "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                "    \"id\": 1, "
-                "    \"subnet\": \"192.0.2.0/24\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"rebind-timer\": 2000, # everything after # is ignored\n"
+                 "\"renew-timer\": 1000, # this will be ignored, too\n"
+                 "\"subnet4\": [ { "
+                 "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
+                 "    \"id\": 1, "
+                 "    \"subnet\": \"192.0.2.0/24\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
 // Tests if multi-line C style comments are handled correctly.
 TEST(ParserTest, multilineComments) {
-    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "   /* this is a C style comment\n"
-                "that\n can \n span \n multiple \n lines */ \n"
-                "\"rebind-timer\": 2000,\n"
-                "\"renew-timer\": 1000, \n"
-                "\"subnet4\": [ { "
-                "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                "    \"id\": 1, "
-                "    \"subnet\": \"192.0.2.0/24\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "   /* this is a C style comment\n"
+                 "that\n can \n span \n multiple \n lines */ \n"
+                 "\"rebind-timer\": 2000,\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"subnet4\": [ { "
+                 "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
+                 "    \"id\": 1, "
+                 "    \"subnet\": \"192.0.2.0/24\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
 // Tests if embedded comments are handled correctly.
 TEST(ParserTest, embbededComments) {
-    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"comment\": \"a comment\",\n"
-                "\"rebind-timer\": 2000,\n"
-                "\"renew-timer\": 1000, \n"
-                "\"subnet4\": [ { "
-                "    \"user-context\": { \"comment\": \"indirect\" },"
-                "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                "    \"id\": 1, "
-                "    \"subnet\": \"192.0.2.0/24\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"user-context\": { \"compatible\": true },"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"comment\": \"a comment\",\n"
+                 "\"rebind-timer\": 2000,\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"subnet4\": [ { "
+                 "    \"user-context\": { \"comment\": \"indirect\" },"
+                 "    \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
+                 "    \"id\": 1, "
+                 "    \"subnet\": \"192.0.2.0/24\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"user-context\": { \"compatible\": true },"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
 // Test that output-options is an alias of output_options.
 TEST(ParserTest, outputDashOptions) {
-    string txt= "{ \"Dhcp4\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"rebind-timer\": 2000,\n"
-                "\"renew-timer\": 1000, \n"
-                "\"valid-lifetime\": 4000,\n"
-                "\"loggers\": [ { "
-                "    \"name\": \"kea-dhcp4\","
-                "    \"output-options\": [ { \"output\": \"stdout\" } ],"
-                "    \"severity\": \"INFO\" } ]\n"
-                "} }";
+    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"rebind-timer\": 2000,\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"valid-lifetime\": 4000,\n"
+                 "\"loggers\": [ { "
+                 "    \"name\": \"kea-dhcp4\","
+                 "    \"output-options\": [ { \"output\": \"stdout\" } ],"
+                 "    \"severity\": \"INFO\" } ]\n"
+                 "} }";
     testParser(txt, Parser4Context::PARSER_DHCP4, false);
 }
 
index 68be5cf8705f5a884f8e9f26d2313c45f3891ca5..bdcf4163440c6c89c841093195ad75e139f69eab 100644 (file)
@@ -89,7 +89,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
@@ -105,13 +105,13 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                    "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
     string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 " { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, Parser6Context::PARSER_JSON);
 }
 
@@ -135,7 +135,7 @@ TEST(ParserTest, keywordJSON) {
 
 TEST(ParserTest, keywordDhcp6) {
      string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
-                  " \"interfaces\": [ \"type\", \"htype\" ] },\n"
+                  "  \"interfaces\": [ \"type\", \"htype\" ] },\n"
                   "\"preferred-lifetime\": 3000,\n"
                   "\"rebind-timer\": 2000, \n"
                   "\"renew-timer\": 1000, \n"
@@ -144,122 +144,122 @@ TEST(ParserTest, keywordDhcp6) {
                   "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
                   "    \"subnet\": \"2001:db8:1::/48\", "
                   "    \"interface\": \"test\" } ],\n"
-                   "\"valid-lifetime\": 4000 } }";
+                  "\"valid-lifetime\": 4000 } }";
      testParser(txt, Parser6Context::PARSER_DHCP6);
 }
 
 // Tests if bash (#) comments are supported. That's the only comment type that
 // was supported by the old parser.
 TEST(ParserTest, bashComments) {
-    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"preferred-lifetime\": 3000,\n"
-                "# this is a comment\n"
-                "\"rebind-timer\": 2000, \n"
-                "# lots of comments here\n"
-                "# and here\n"
-                "\"renew-timer\": 1000, \n"
-                "\"subnet6\": [ { "
-                "    \"id\": 1, "
-                "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                "    \"subnet\": \"2001:db8:1::/48\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"preferred-lifetime\": 3000,\n"
+                 "# this is a comment\n"
+                 "\"rebind-timer\": 2000, \n"
+                 "# lots of comments here\n"
+                 "# and here\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"subnet6\": [ { "
+                 "    \"id\": 1, "
+                 "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
+                 "    \"subnet\": \"2001:db8:1::/48\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser6Context::PARSER_DHCP6);
 }
 
 // Tests if C++ (//) comments can start anywhere, not just in the first line.
 TEST(ParserTest, cppComments) {
-    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"preferred-lifetime\": 3000, // this is a comment \n"
-                "\"rebind-timer\": 2000, // everything after // is ignored\n"
-                "\"renew-timer\": 1000, // this will be ignored, too\n"
-                "\"subnet6\": [ { "
-                "    \"id\": 1, "
-                "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                "    \"subnet\": \"2001:db8:1::/48\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"preferred-lifetime\": 3000, // this is a comment \n"
+                 "\"rebind-timer\": 2000, // everything after // is ignored\n"
+                 "\"renew-timer\": 1000, // this will be ignored, too\n"
+                 "\"subnet6\": [ { "
+                 "    \"id\": 1, "
+                 "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
+                 "    \"subnet\": \"2001:db8:1::/48\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser6Context::PARSER_DHCP6, false);
 }
 
 // Tests if bash (#) comments can start anywhere, not just in the first line.
 TEST(ParserTest, bashCommentsInline) {
-    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"preferred-lifetime\": 3000, # this is a comment \n"
-                "\"rebind-timer\": 2000, # everything after # is ignored\n"
-                "\"renew-timer\": 1000, # this will be ignored, too\n"
-                "\"subnet6\": [ { "
-                "    \"id\": 1, "
-                "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                "    \"subnet\": \"2001:db8:1::/48\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"preferred-lifetime\": 3000, # this is a comment \n"
+                 "\"rebind-timer\": 2000, # everything after # is ignored\n"
+                 "\"renew-timer\": 1000, # this will be ignored, too\n"
+                 "\"subnet6\": [ { "
+                 "    \"id\": 1, "
+                 "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
+                 "    \"subnet\": \"2001:db8:1::/48\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser6Context::PARSER_DHCP6, false);
 }
 
 // Tests if multi-line C style comments are handled correctly.
 TEST(ParserTest, multilineComments) {
-    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"preferred-lifetime\": 3000, /* this is a C style comment\n"
-                "that\n can \n span \n multiple \n lines */ \n"
-                "\"rebind-timer\": 2000,\n"
-                "\"renew-timer\": 1000, \n"
-                "\"subnet6\": [ { "
-                "    \"id\": 1, "
-                "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                "    \"subnet\": \"2001:db8:1::/48\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"preferred-lifetime\": 3000, /* this is a C style comment\n"
+                 "that\n can \n span \n multiple \n lines */ \n"
+                 "\"rebind-timer\": 2000,\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"subnet6\": [ { "
+                 "    \"id\": 1, "
+                 "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
+                 "    \"subnet\": \"2001:db8:1::/48\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser6Context::PARSER_DHCP6, false);
 }
 
 // Tests if embedded comments are handled correctly.
 TEST(ParserTest, embbededComments) {
-    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"comment\": \"a comment\",\n"
-                "\"preferred-lifetime\": 3000,\n"
-                "\"rebind-timer\": 2000,\n"
-                "\"renew-timer\": 1000, \n"
-                "\"subnet6\": [ { "
-                "    \"id\": 1, "
-                "    \"user-context\": { \"comment\": \"indirect\" },"
-                "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                "    \"subnet\": \"2001:db8:1::/48\", "
-                "    \"interface\": \"eth0\""
-                " } ],"
-                "\"user-context\": { \"compatible\": true },"
-                "\"valid-lifetime\": 4000 } }";
+    string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"comment\": \"a comment\",\n"
+                 "\"preferred-lifetime\": 3000,\n"
+                 "\"rebind-timer\": 2000,\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"subnet6\": [ { "
+                 "    \"id\": 1, "
+                 "    \"user-context\": { \"comment\": \"indirect\" },"
+                 "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
+                 "    \"subnet\": \"2001:db8:1::/48\", "
+                 "    \"interface\": \"eth0\""
+                 " } ],"
+                 "\"user-context\": { \"compatible\": true },"
+                 "\"valid-lifetime\": 4000 } }";
     testParser(txt, Parser6Context::PARSER_DHCP6, false);
 }
 
 // Test that output-options is an alias of output_options.
 TEST(ParserTest, outputDashOptions) {
-    string txt= "{ \"Dhcp6\": { \"interfaces-config\": {"
-                "  \"interfaces\": [ \"*\" ]"
-                "},\n"
-                "\"preferred-lifetime\": 3000,\n"
-                "\"rebind-timer\": 2000,\n"
-                "\"renew-timer\": 1000, \n"
-                "\"valid-lifetime\": 4000,\n"
-                "\"loggers\": [ { "
-                "    \"name\": \"kea-dhcp6\","
-                "    \"output-options\": [ { \"output\": \"stdout\" } ],"
-                "    \"severity\": \"INFO\" } ]\n"
-                "} }";
+    string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
+                 "  \"interfaces\": [ \"*\" ]"
+                 "},\n"
+                 "\"preferred-lifetime\": 3000,\n"
+                 "\"rebind-timer\": 2000,\n"
+                 "\"renew-timer\": 1000, \n"
+                 "\"valid-lifetime\": 4000,\n"
+                 "\"loggers\": [ { "
+                 "    \"name\": \"kea-dhcp6\","
+                 "    \"output-options\": [ { \"output\": \"stdout\" } ],"
+                 "    \"severity\": \"INFO\" } ]\n"
+                 "} }";
     testParser(txt, Parser6Context::PARSER_DHCP6, false);
 }
 
index 7cc5eaf2941bf843678b21b75609936d2036c936..5c8cd87c6028d2590e825bd749b459922c2cd67c 100644 (file)
@@ -91,7 +91,7 @@ TEST(ParserTest, mapInMap) {
 
 TEST(ParserTest, listInList) {
     string txt = "[ [ \"Britain\", \"Wales\", \"Scotland\" ], "
-                 "[ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
+                 "  [ \"Pomorze\", \"Wielkopolska\", \"Tatry\"] ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -107,13 +107,13 @@ TEST(ParserTest, nestedLists) {
 
 TEST(ParserTest, listsInMaps) {
     string txt = "{ \"constellations\": { \"orion\": [ \"rigel\", \"betelgeuse\" ], "
-                    "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
+                   "\"cygnus\": [ \"deneb\", \"albireo\"] } }";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
 TEST(ParserTest, mapsInLists) {
     string txt = "[ { \"body\": \"earth\", \"gravity\": 1.0 },"
-                 " { \"body\": \"mars\", \"gravity\": 0.376 } ]";
+                 "  { \"body\": \"mars\", \"gravity\": 0.376 } ]";
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
@@ -257,7 +257,6 @@ TEST(ParserTest, keywordSubNetconf) {
         "    }"
         "   ]"
         "}";
-
     // This is only a subset of full config, so we'll parse with PARSER_SUB_NETCONF.
     testParser(txt, ParserContext::PARSER_SUB_NETCONF);
     testParser(txt, ParserContext::PARSER_JSON);
@@ -269,13 +268,13 @@ TEST(ParserTest, bashComments) {
     string txt= "{ \"Netconf\": {"
                 "  \"managed-servers\": {\n"
                 "    \"d2\": {\n"
-                "      \"model\": \"foo\",\n"
-                "      \"control-socket\": {\n"
+                "        \"model\": \"foo\",\n"
+                "        \"control-socket\": {\n"
                 "# this is a comment\n"
-                "\"socket-type\": \"unix\", \n"
+                "            \"socket-type\": \"unix\", \n"
                 "# This socket is mine. I can name it whatever\n"
                 "# I like, ok?\n"
-                "\"socket-name\": \"Hector\" \n"
+                "            \"socket-name\": \"Hector\" \n"
                 "} } } } }";
     testParser(txt, ParserContext::PARSER_NETCONF);
 }
@@ -287,12 +286,11 @@ TEST(ParserTest, cppComments) {
                 "    // Let's try talking to D2. Sadly, it never talks"
                 "    // to us back :( Maybe he doesn't like his name?\n"
                 "    \"d2\": {\n"
-                "      \"model\": \"foo\",\n"
-                "      \"control-socket\": {\n"
-                "\"socket-type\": \"unix\", \n"
-                "\"socket-name\": \"Hector\" \n"
+                "        \"model\": \"foo\",\n"
+                "        \"control-socket\": {\n"
+                "            \"socket-type\": \"unix\", \n"
+                "            \"socket-name\": \"Hector\" \n"
                 "} } } } }";
-
     testParser(txt, ParserContext::PARSER_NETCONF, false);
 }
 
@@ -301,10 +299,10 @@ TEST(ParserTest, bashCommentsInline) {
     string txt= "{ \"Netconf\": {"
                 "  \"managed-servers\": {\n"
                 "    \"d2\": {\n"
-                "      \"model\": \"foo\",\n"
-                "      \"control-socket\": {\n"
-                "\"socket-type\": \"unix\", # Maybe Hector is not really a \n"
-                "\"socket-name\": \"Hector\" # Unix process?\n"
+                "        \"model\": \"foo\",\n"
+                "        \"control-socket\": {\n"
+                "            \"socket-type\": \"unix\", # Maybe Hector is not really a \n"
+                "            \"socket-name\": \"Hector\" # Unix process?\n"
                 "# Oh no! He's a windows one and just pretending!\n"
                 "} } } } }";
     testParser(txt, ParserContext::PARSER_NETCONF, false);
@@ -323,10 +321,10 @@ TEST(ParserTest, multilineComments) {
                 "  /* Ok, forget about it. If Hector doesn't want to talk,\n"
                 "     we won't talk to him either. We now have quiet days. */\n"
                 "  /* \"d2\": {"
-                "  \"model\": \"bar\",\n"
-                "  \"control-socket\": {\n"
-                "  \"socket-type\": \"unix\",\n"
-                "\"socket-name\": \"Hector\"\n"
+                "         \"model\": \"bar\",\n"
+                "         \"control-socket\": {\n"
+                "             \"socket-type\": \"unix\",\n"
+                "             \"socket-name\": \"Hector\"\n"
                 "} }*/ } } }";
     testParser(txt, ParserContext::PARSER_NETCONF, false);
 }
@@ -337,9 +335,9 @@ TEST(ParserTest, embbededComments) {
                 "  \"comment\": \"a comment\","
                 "  \"managed-servers\": {\n"
                 "    \"dhcp4\": {\n"
-                "      \"control-socket\": {\n"
-                "        \"user-context\": { \"comment\": \"indirect\" },\n"
-                "        \"socket-type\": \"stdout\"\n"
+                "        \"control-socket\": {\n"
+                "            \"user-context\": { \"comment\": \"indirect\" },\n"
+                "            \"socket-type\": \"stdout\"\n"
                 "    } } },\n"
                 "  \"user-context\": { \"compatible\": true }\n"
                 "} }";
index 46b591d0dd4b2d067a5a5c3e9c6949279de6bf60..6ffe0afa2f092b44afa66b7d66354b92e6420a9d 100644 (file)
@@ -322,7 +322,7 @@ TEST_F(ConfigTestKeaV4, examples4) {
         "single-subnet.json",
         "vendor-specific.json",
         "vivso.json",
-        "with-ddns.json",
+        //"with-ddns.json",
     };
     for (string file : examples) {
         resetSession();
@@ -365,7 +365,7 @@ TEST_F(ConfigTestKeaV6, examples6) {
         "softwire46.json",
         "stateless.json",
         "tee-times.json",
-        "with-ddns.json",
+        //"with-ddns.json",
     };
     for (string file : examples) {
         resetSession();