// Queue type was mandatory.
"queue-type": "kea-ring4"
}
+ // Missing: calculate-tee-times, t1-percent, t2-percent
},
// Logging configuration begins here.
-// 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
#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>
}
}
+// 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";
-// 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
#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>
}
}
+// 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
///
/// @{
+/// @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
-// 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
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;
///
/// @{
+/// @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
-// 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
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;