]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#916] Checkpoint: updated agents/servers
authorFrancis Dupont <fdupont@isc.org>
Fri, 29 May 2020 16:37:18 +0000 (18:37 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 8 Jul 2020 12:32:45 +0000 (14:32 +0200)
src/bin/agent/tests/ca_process_tests.sh.in
src/bin/agent/tests/parser_unittests.cc
src/bin/d2/tests/d2_process_tests.sh.in
src/bin/d2/tests/parser_unittest.cc
src/bin/netconf/tests/parser_unittests.cc
src/bin/netconf/tests/shtests/netconf_tests.sh.in

index c903b40a0053b3880aadd44d5d00a72e1f8cd9df..6173d3410dc25c95f084619b6859060ed44bcb59 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -16,10 +16,7 @@ EXPECTED_VERSION="@PACKAGE_VERSION@"
 CONFIG="{
     \"Control-agent\":
     {
-        \"http-host\": \"127.0.0.1\"
-    },
-    \"Logging\":
-    {
+        \"http-host\": \"127.0.0.1\",
         \"loggers\": [
         {
             \"name\": \"kea-ctrl-agent\",
index af6ef13b6ad20252bef4b8acbf0450bcf0fe78d5..d8cabd4e05f47b07604b8a5619610ef791c9e11a 100644 (file)
@@ -120,54 +120,6 @@ TEST(ParserTest, keywordJSON) {
     testParser(txt, ParserContext::PARSER_JSON);
 }
 
-// This test checks that the DhcpDdns configuration is accepted
-// by the parser.
-TEST(ParserTest, keywordDhcpDdns) {
-    string txt =
-        "{ \"DhcpDdns\" : \n"
-           "{ \n"
-            " \"ip-address\": \"192.168.77.1\", \n"
-            " \"port\": 777 , \n "
-            " \"ncr-protocol\": \"UDP\", \n"
-            "\"tsig-keys\": [], \n"
-            "\"forward-ddns\" : {}, \n"
-            "\"reverse-ddns\" : {} \n"
-            "} \n"
-         "} \n";
-     testParser(txt, ParserContext::PARSER_AGENT);
-}
-
-// This test checks that the Dhcp6 configuration is accepted
-// by the parser.
-TEST(ParserTest, keywordDhcp6) {
-     string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
-                  " \"interfaces\": [ \"type\", \"htype\" ] },\n"
-                  "\"preferred-lifetime\": 3000,\n"
-                  "\"rebind-timer\": 2000, \n"
-                  "\"renew-timer\": 1000, \n"
-                  "\"subnet6\": [ { "
-                  "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                  "    \"subnet\": \"2001:db8:1::/48\", "
-                  "    \"interface\": \"test\" } ],\n"
-                   "\"valid-lifetime\": 4000 } }";
-     testParser(txt, ParserContext::PARSER_AGENT);
-}
-
-// This test checks that the Dhcp4 configuration is accepted
-// by the parser.
-TEST(ParserTest, keywordDhcp4) {
-    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
-                  " \"interfaces\": [ \"type\", \"htype\" ] },\n"
-                  "\"rebind-timer\": 2000, \n"
-                  "\"renew-timer\": 1000, \n"
-                  "\"subnet4\": [ { "
-                  "  \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                  "  \"subnet\": \"192.0.2.0/24\", "
-                  "  \"interface\": \"test\" } ],\n"
-                   "\"valid-lifetime\": 4000 } }";
-     testParser(txt, ParserContext::PARSER_AGENT);
-}
-
 // This test checks if full config (with top level and Control-agent objects) can
 // be parsed with syntactic checking (and as pure JSON).
 TEST(ParserTest, keywordAgent) {
@@ -562,18 +514,24 @@ TEST(ParserTest, errors) {
               "expecting }");
     testError("{ 123 }\n",
               ParserContext::PARSER_AGENT,
-              "<string>:1.3-5: syntax error, unexpected integer");
+              "<string>:1.3-5: syntax error, unexpected integer, "
+              "expecting Control-agent");
     testError("{ \"foo\" }\n",
               ParserContext::PARSER_JSON,
               "<string>:1.9: syntax error, unexpected }, "
               "expecting :");
     testError("{ \"foo\" }\n",
               ParserContext::PARSER_AGENT,
-              "<string>:1.9: syntax error, unexpected }, expecting :");
+              "<string>:1.3-7: syntax error, unexpected constant string, "
+              "expecting Control-agent");
     testError("{ \"foo\":null }\n",
               ParserContext::PARSER_AGENT,
-              "<string>:1.3-7: got unexpected keyword "
-              "\"foo\" in toplevel map.");
+              "<string>:1.3-7: syntax error, unexpected constant string, "
+              "expecting Control-agent");
+    testError("{ \"Logging\":null }\n",
+              ParserContext::PARSER_AGENT,
+              "<string>:1.3-11: syntax error, unexpected constant string, "
+              "expecting Control-agent");
     testError("{ \"Control-agent\" }\n",
               ParserContext::PARSER_AGENT,
               "<string>:1.19: syntax error, unexpected }, "
@@ -696,6 +654,6 @@ TEST(ParserTest, unicodeSlash) {
     EXPECT_EQ("////", result->stringValue());
 }
 
-};
-};
-};
+}
+}
+}
index 959b63c76f9d4338db25cc8778cf901f1fa9866c..ebdd01e0a658cbb7b49ed05859959382d21df2c5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -18,10 +18,7 @@ CONFIG="{
         \"port\": 53001,
         \"tsig-keys\": [],
         \"forward-ddns\" : {},
-        \"reverse-ddns\" : {}
-    },
-    \"Logging\":
-    {
+        \"reverse-ddns\" : {},
         \"loggers\": [
         {
             \"name\": \"kea-dhcp-ddns\",
@@ -44,10 +41,7 @@ CONFIG_BAD_SYNTAX="{
         \"port\": BOGUS,
         \"tsig-keys\": [],
         \"forward-ddns\" : {},
-        \"reverse-ddns\" : {}
-    },
-    \"Logging\":
-    {
+        \"reverse-ddns\" : {},
         \"loggers\": [
         {
             \"name\": \"kea-dhcp-ddns\",
@@ -70,10 +64,7 @@ CONFIG_BAD_VALUE="{
         \"port\": 80000,
         \"tsig-keys\": [],
         \"forward-ddns\" : {},
-        \"reverse-ddns\" : {}
-    },
-    \"Logging\":
-    {
+        \"reverse-ddns\" : {},
         \"loggers\": [
         {
             \"name\": \"kea-dhcp-ddns\",
@@ -97,10 +88,7 @@ CONFIG_INVALID="{
         \"port\": BOGUS,
         \"tsig-keys\": [],
         \"forward-ddns\" : {},
-        \"reverse-ddns\" : {}
-    },
-    \"Logging\":
-    {
+        \"reverse-ddns\" : {},
         \"loggers\": [
         {
             \"name\": \"kea-dhcp-ddns\",
index 88d1f1dd6953ce1d559ad0bb875a06ad1d28aa4e..7fa44c7aa4824272670860a561721d7e575bd36f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -136,57 +136,6 @@ TEST(ParserTest, keywordDhcpDdns) {
      testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
 }
 
-TEST(ParserTest, keywordDhcp6) {
-     string txt = "{ \"Dhcp6\": { \"interfaces-config\": {"
-                  " \"interfaces\": [ \"type\", \"htype\" ] },\n"
-                  "\"preferred-lifetime\": 3000,\n"
-                  "\"rebind-timer\": 2000, \n"
-                  "\"renew-timer\": 1000, \n"
-                  "\"subnet6\": [ { "
-                  "    \"pools\": [ { \"pool\": \"2001:db8:1::/64\" } ],"
-                  "    \"subnet\": \"2001:db8:1::/48\", "
-                  "    \"interface\": \"test\" } ],\n"
-                   "\"valid-lifetime\": 4000 } }";
-     testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
-}
-
-TEST(ParserTest, keywordDhcp4) {
-    string txt = "{ \"Dhcp4\": { \"interfaces-config\": {"
-                  " \"interfaces\": [ \"type\", \"htype\" ] },\n"
-                  "\"rebind-timer\": 2000, \n"
-                  "\"renew-timer\": 1000, \n"
-                  "\"subnet4\": [ { "
-                  "  \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
-                  "  \"subnet\": \"192.0.2.0/24\", "
-                  "  \"interface\": \"test\" } ],\n"
-                   "\"valid-lifetime\": 4000 } }";
-     testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
-}
-
-TEST(ParserTest, keywordControlAgent) {
-    string txt = "{ \"Control-agent\": { } }";
-    testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
-}
-
-TEST(ParserTest, Logging) {
-    string txt = "{ \"Logging\": { \n"
-                 "    \"loggers\": [ \n"
-                 "        { \n"
-                 "            \"name\": \"kea-dhcp6\", \n"
-                 "            \"output_options\": [ \n"
-                 "                { \n"
-                 "                    \"output\": \"stdout\" \n"
-                 "                } \n"
-                 "            ], \n"
-                 "            \"debuglevel\": 0, \n"
-                 "            \"severity\": \"INFO\" \n"
-                 "        } \n"
-                 "    ] }\n"
-                 "} \n";
-     testParser(txt, D2ParserContext::PARSER_DHCPDDNS);
-}
-
-
 // Tests if bash (#) comments are supported. That's the only comment type that
 // was supported by the old parser.
 TEST(ParserTest, bashComments) {
@@ -517,26 +466,24 @@ TEST(ParserTest, errors) {
               "expecting }");
     testError("{ 123 }\n",
               D2ParserContext::PARSER_DHCPDDNS,
-              "<string>:1.3-5: syntax error, unexpected integer");
+              "<string>:1.3-5: syntax error, unexpected integer, "
+              "expecting DhcpDdns");
     testError("{ \"foo\" }\n",
               D2ParserContext::PARSER_JSON,
               "<string>:1.9: syntax error, unexpected }, "
               "expecting :");
     testError("{ \"foo\" }\n",
               D2ParserContext::PARSER_DHCPDDNS,
-              "<string>:1.9: syntax error, unexpected }, expecting :");
+              "<string>:1.3-7: syntax error, unexpected constant string, "
+              "expecting DhcpDdns");
     testError("{ \"foo\":null }\n",
               D2ParserContext::PARSER_DHCPDDNS,
-              "<string>:1.3-7: got unexpected keyword "
-              "\"foo\" in toplevel map.");
-    testError("{ \"Dhcp6\" }\n",
-              D2ParserContext::PARSER_DHCPDDNS,
-              "<string>:1.11: syntax error, unexpected }, "
-              "expecting :");
-    testError("{ \"Dhcp4\":[]\n",
+              "<string>:1.3-7: syntax error, unexpected constant string, "
+              "expecting DhcpDdns");
+    testError("{ \"Logging\":null }\n",
               D2ParserContext::PARSER_DHCPDDNS,
-              "<string>:2.1: syntax error, unexpected end of file, "
-              "expecting \",\" or }");
+              "<string>:1.3-11: syntax error, unexpected constant string, "
+              "expecting DhcpDdns");
     testError("{}{}\n",
               D2ParserContext::PARSER_JSON,
               "<string>:1.3: syntax error, unexpected {, "
@@ -651,6 +598,6 @@ TEST(ParserTest, unicodeSlash) {
     EXPECT_EQ("////", result->stringValue());
 }
 
-};
-};
-};
+}
+}
+}
index ed9dba969822d2bd1aa59a490ded1244f25a7e4b..959fe31e90e975fadc602cae6b36d716393151a2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -574,7 +574,7 @@ TEST(ParserTest, errors) {
     testError("{ 123 }\n",
               ParserContext::PARSER_NETCONF,
               "<string>:1.3-5: syntax error, unexpected integer, "
-              "expecting Netconf or Logging");
+              "expecting Netconf");
     testError("{ \"foo\" }\n",
               ParserContext::PARSER_JSON,
               "<string>:1.9: syntax error, unexpected }, "
@@ -582,11 +582,15 @@ TEST(ParserTest, errors) {
     testError("{ \"foo\" }\n",
               ParserContext::PARSER_NETCONF,
               "<string>:1.3-7: syntax error, unexpected constant string, "
-              "expecting Netconf or Logging");
+              "expecting Netconf");
     testError("{ \"foo\":null }\n",
               ParserContext::PARSER_NETCONF,
               "<string>:1.3-7: syntax error, unexpected constant string, "
-              "expecting Netconf or Logging");
+              "expecting Netconf");
+    testError("{ \"Logging\":null }\n",
+              ParserContext::PARSER_NETCONF,
+              "<string>:1.3-11: syntax error, unexpected constant string, "
+              "expecting Netconf");
     testError("{ \"Netconf\" }\n",
               ParserContext::PARSER_NETCONF,
               "<string>:1.13: syntax error, unexpected }, "
@@ -661,6 +665,15 @@ TEST(ParserTest, errors) {
               ParserContext::PARSER_NETCONF,
               "<string>:3.3-11: duplicate user-context/comment entries "
               "(previous at <string>:2:19)");
+
+    // duplicate Netconf entries
+    testError("{ \"Netconf\":{\n"
+              "  \"comment\": \"first\" },\n"
+              "  \"Netconf\":{\n"
+              "  \"comment\": \"second\" }}\n",
+              ParserContext::PARSER_NETCONF,
+              "<string>:3:3: duplicate Netconf entries in toplevel map "
+              "(previous at <string>:1:3)");
 }
 
 // Check unicode escapes
@@ -704,6 +717,6 @@ TEST(ParserTest, unicodeSlash) {
     EXPECT_EQ("////", result->stringValue());
 }
 
-};
-};
-};
+}
+}
+}
index abc6203643b839b98ed299b6683f4f0585038e83..3f631de731e93222910399da7f054c1b1b147ca4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -21,11 +21,7 @@ CONFIG="{
             {
                 \"comment\": \"simply use defaults...\"
             }
-        }
-    },
-
-    \"Logging\":
-    {
+        },
         \"loggers\": [
         {
             \"name\": \"kea-netconf\",