]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[499-global-keywords-entries] Added global parameter lists 499-global-keywords-entries 494-dhcp4configparser-sharednetworkssanitychecks-is-buggy_base 498-pkg-config-usage-in-kea-libs-is-wrong_base 509-improve-disabling-client-id-lookup_base 519-dhcp-server-response-an-empty-rai-field_base
authorFrancis Dupont <fdupont@isc.org>
Sat, 2 Mar 2019 02:12:59 +0000 (03:12 +0100)
committerFrancis Dupont <fdupont@isc.org>
Thu, 7 Mar 2019 15:50:34 +0000 (10:50 -0500)
doc/examples/kea4/all-keys.json
src/bin/dhcp4/tests/parser_unittest.cc
src/bin/dhcp6/tests/parser_unittest.cc
src/lib/dhcpsrv/parsers/simple_parser4.cc
src/lib/dhcpsrv/parsers/simple_parser4.h
src/lib/dhcpsrv/parsers/simple_parser6.cc
src/lib/dhcpsrv/parsers/simple_parser6.h

index f0997ba52e8a4656634c71cd2086ecbe6efe9e2e..6c889c924cce07d895c3d290ee1634811e43509d 100644 (file)
             // Queue type was mandatory.
             "queue-type": "kea-ring4"
         }
+       // Missing: calculate-tee-times, t1-percent, t2-percent
     },
 
     // Logging configuration begins here.
index e8598d009db79a43574126263531207e8bbf152d..61ff0b11736e92521a1187ad17995dadc4c8096c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 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
@@ -7,8 +7,8 @@
 #include <config.h>
 
 #include <gtest/gtest.h>
-#include <cc/data.h>
 #include <dhcp4/parser_context.h>
+#include <dhcpsrv/parsers/simple_parser4.h>
 #include <testutils/io_utils.h>
 #include <testutils/user_context_utils.h>
 
@@ -288,6 +288,17 @@ TEST(ParserTest, file) {
     }
 }
 
+// This test loads the all-keys.json file and check global parameters.
+TEST(ParserTest, globalParameters) {
+    ConstElementPtr json;
+    Parser4Context ctx;
+    string fname = string(CFG_EXAMPLES) + "/" + "all-keys.json";
+    EXPECT_NO_THROW(json = ctx.parseFile(fname, Parser4Context::PARSER_DHCP4));
+    EXPECT_NO_THROW(json = json->get("Dhcp4"));
+    SimpleParser4 parser;
+    EXPECT_NO_THROW(parser.checkKeywords(parser.GLOBAL4_PARAMETERS, json));
+}
+
 // Basic test that checks if it's possible to specify outbound-interface.
 TEST(ParserTest, outboundIface) {
     std::string fname = string(CFG_EXAMPLES) + "/" + "advanced.json";
index 16b22a9e7a397ac1bbeef9e161ac178029c47110..84ab706ec466beec8d2e5ec2c6e04aafef1fa744 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 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
@@ -7,8 +7,8 @@
 #include <config.h>
 
 #include <gtest/gtest.h>
-#include <cc/data.h>
 #include <dhcp6/parser_context.h>
+#include <dhcpsrv/parsers/simple_parser6.h>
 #include <testutils/io_utils.h>
 #include <testutils/user_context_utils.h>
 
@@ -298,6 +298,17 @@ TEST(ParserTest, file) {
     }
 }
 
+// This test loads the all-keys.json file and check global parameters.
+TEST(ParserTest, globalParameters) {
+    ConstElementPtr json;
+    Parser6Context ctx;
+    string fname = string(CFG_EXAMPLES) + "/" + "all-keys.json";
+    EXPECT_NO_THROW(json = ctx.parseFile(fname, Parser6Context::PARSER_DHCP6));
+    EXPECT_NO_THROW(json = json->get("Dhcp6"));
+    SimpleParser6 parser;
+    EXPECT_NO_THROW(parser.checkKeywords(parser.GLOBAL6_PARAMETERS, json));
+}
+
 /// @brief Tests error conditions in Dhcp6Parser
 ///
 /// @param txt text to be parsed
index d73bb9a006fc15af5672dbb6e559aecfa56ad9a1..f2b19f43d51ce3a826d50a166cc83f4d938a9fe2 100644 (file)
@@ -30,6 +30,50 @@ namespace dhcp {
 ///
 /// @{
 
+/// @brief This table defines all global parameters in DHCPv4.
+///
+/// Boolean, integer, real and string types are for scalar parameters,
+/// list and map types for entries.
+/// Order follows global_param rule in bison grammar.
+const SimpleKeywords SimpleParser4::GLOBAL4_PARAMETERS = {
+    { "valid-lifetime",               Element::integer },
+    { "renew-timer",                  Element::integer },
+    { "rebind-timer",                 Element::integer },
+    { "decline-probation-period",     Element::integer },
+    { "subnet4",                      Element::list },
+    { "shared-networks",              Element::list },
+    { "interfaces-config",            Element::map },
+    { "lease-database",               Element::map },
+    { "hosts-database",               Element::map },
+    { "hosts-databases",              Element::list },
+    { "host-reservation-identifiers", Element::list },
+    { "client-classes",               Element::list },
+    { "option-def",                   Element::list },
+    { "option-data",                  Element::list },
+    { "hooks-libraries",              Element::list },
+    { "expired-leases-processing",    Element::map },
+    { "dhcp4o6-port",                 Element::integer },
+    { "control-socket",               Element::map },
+    { "dhcp-queue-control",           Element::map },
+    { "dhcp-ddns",                    Element::map },
+    { "echo-client-id",               Element::boolean },
+    { "match-client-id",              Element::boolean },
+    { "authoritative",                Element::boolean },
+    { "next-server",                  Element::string },
+    { "server-hostname",              Element::string },
+    { "boot-file-name",               Element::string },
+    { "user-context",                 Element::map },
+    { "comment",                      Element::string },
+    { "sanity-checks",                Element::map },
+    { "reservations",                 Element::list },
+    { "config-control",               Element::map },
+    { "server-tag",                   Element::string },
+    { "reservation-mode",             Element::string },
+    { "calculate-tee-times",          Element::boolean },
+    { "t1-percent",                   Element::real },
+    { "t2-percent",                   Element::real }
+};
+
 /// @brief This table defines default values for option definitions in DHCPv4.
 ///
 /// Dhcp4 may contain an array called option-def that enumerates new option
index ef7657eff0b98bd5e2cac16d858a7b825274d775..069deb27ef8be951ed45f5731fe3cd074264a4b4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 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
@@ -37,6 +37,7 @@ public:
     static size_t deriveParameters(isc::data::ElementPtr global);
 
     // see simple_parser4.cc for comments for those parameters
+    static const isc::data::SimpleKeywords GLOBAL4_PARAMETERS;
     static const isc::data::SimpleDefaults OPTION4_DEF_DEFAULTS;
     static const isc::data::SimpleDefaults OPTION4_DEFAULTS;
     static const isc::data::SimpleDefaults GLOBAL4_DEFAULTS;
index df07d0d4274060f1185c80ce32bdd9d14e61f983..37fd49d240fc14d42d15373860171c3ba117de38 100644 (file)
@@ -29,6 +29,45 @@ namespace dhcp {
 ///
 /// @{
 
+/// @brief This table defines all global parameters in DHCPv6.
+///
+/// Boolean, integer, real and string types are for scalar parameters,
+/// list and map types for entries.
+/// Order follows global_param rule in bison grammar.
+const SimpleKeywords SimpleParser6::GLOBAL6_PARAMETERS = {
+    { "preferred-lifetime",           Element::integer },
+    { "valid-lifetime",               Element::integer },
+    { "renew-timer",                  Element::integer },
+    { "rebind-timer",                 Element::integer },
+    { "decline-probation-period",     Element::integer },
+    { "subnet6",                      Element::list },
+    { "shared-networks",              Element::list },
+    { "interfaces-config",            Element::map },
+    { "lease-database",               Element::map },
+    { "hosts-database",               Element::map },
+    { "hosts-databases",              Element::list },
+    { "mac-sources",                  Element::list },
+    { "relay-supplied-options",       Element::list },
+    { "host-reservation-identifiers", Element::list },
+    { "client-classes",               Element::list },
+    { "option-def",                   Element::list },
+    { "option-data",                  Element::list },
+    { "hooks-libraries",              Element::list },
+    { "expired-leases-processing",    Element::map },
+    { "server-id",                    Element::map },
+    { "dhcp4o6-port",                 Element::integer },
+    { "control-socket",               Element::map },
+    { "dhcp-queue-control",           Element::map },
+    { "dhcp-ddns",                    Element::map },
+    { "user-context",                 Element::map },
+    { "comment",                      Element::string },
+    { "sanity-checks",                Element::map },
+    { "reservations",                 Element::list },
+    { "config-control",               Element::map },
+    { "server-tag",                   Element::string },
+    { "reservation-mode",             Element::string }
+};
+
 /// @brief This table defines default values for option definitions in DHCPv6.
 ///
 /// Dhcp6 may contain an array called option-def that enumerates new option
index 2c49bb5c5cff862c39f4e3bdcb075041886f2de7..0004811561b58adfbb2e0411217b2e5796619763 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 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
@@ -38,6 +38,7 @@ public:
     static size_t deriveParameters(isc::data::ElementPtr global);
 
     // see simple_parser6.cc for comments for those parameters
+    static const isc::data::SimpleKeywords GLOBAL6_PARAMETERS;
     static const isc::data::SimpleDefaults OPTION6_DEF_DEFAULTS;
     static const isc::data::SimpleDefaults OPTION6_DEFAULTS;
     static const isc::data::SimpleDefaults GLOBAL6_DEFAULTS;