Also, renamed interface-config to interfaces-config (plural form).
{
# Kea is told to listen on ethX interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{ "Dhcp4":
{
-# Kea is told to listen on eth0 interface only.
- "interfaces": [ "eth0" ],
+# Kea is told to listen on ethX interface only.
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
# Kea is told to listen on ethX interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
# Kea is told to listen on ethX interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
# Kea is told to listen on ethX network interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
# Kea is told to listen on ethX interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
# Kea is told to listen on ethX interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
# Kea is told to listen on ethX interface only.
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# We need to specify lease type. As of May 2014, three backends are supported:
# memfile, mysql and pgsql. We'll just use memfile, because it doesn't require
{
"Dhcp6": {
- "interfaces": [ "ethX" ],
+ "interfaces-config:" {
+ "interfaces": [ "ethX" ]
+ },
# This is the list of options that will be granted to all clients that ask.
"option-data": [ {
(config_id.compare("rebind-timer") == 0)) {
parser = new Uint32Parser(config_id,
globalContext()->uint32_values_);
- } else if (config_id.compare("interfaces") == 0) {
+ } else if (config_id.compare("interfaces-config") == 0) {
parser = new IfacesConfigParser4();
} else if (config_id.compare("subnet4") == 0) {
parser = new Subnets4ListConfigParser(config_id);
subnet_parser = parser;
} else if (config_pair.first == "option-data") {
option_parser = parser;
- } else if (config_pair.first == "interface-config") {
+ } else if (config_pair.first == "interfaces-config") {
// The interface parser is independent from any other
// parser and can be run here before any other parsers.
iface_parser = parser;
-// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
unlink(UNLOAD_MARKER_FILE);
};
+ /// @brief Returns an interface configuration used by the most of the
+ /// unit tests.
+ std::string genIfaceConfig() const {
+ return ("\"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "}");
+ }
+
/// @brief Create the simple configuration with single option.
///
/// This function allows to set one of the parameters that configure
/// describing an option.
std::string createConfigWithOption(const std::map<std::string, std::string>& params) {
std::ostringstream stream;
- stream << "{ \"interfaces\": [ \"*\" ],"
+ stream << "{ " << genIfaceConfig() << "," <<
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
/// contents of the database do not affect result of
/// subsequent tests.
void resetConfiguration() {
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"hooks-libraries\": [ ], "
"\"valid-lifetime\": 4000, "
"\"subnet4\": [ ], "
ConstElementPtr status;
EXPECT_NO_THROW(status = configureDhcp4Server(*srv_,
- Element::fromJSON("{ \"interfaces\": [ \"*\" ],"
+ Element::fromJSON("{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ ], "
TEST_F(Dhcp4ParserTest, unspecifiedRenewTimer) {
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
TEST_F(Dhcp4ParserTest, unspecifiedRebindTimer) {
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr x;
// Collection of four subnets for which subnet ids should be
// autogenerated - ids are unspecified or set to 0.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
TEST_F(Dhcp4ParserTest, multipleSubnetsExplicitIDs) {
ConstElementPtr x;
// Four subnets with arbitrary subnet ids.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
TEST_F(Dhcp4ParserTest, multipleSubnetsOverlapingIDs) {
ConstElementPtr x;
// Four subnets, two of them having the same id.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr x;
// All four subnets
- string config4 = "{ \"interfaces\": [ \"*\" ],"
+ string config4 = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
"\"valid-lifetime\": 4000 }";
// Three subnets (the last one removed)
- string config_first3 = "{ \"interfaces\": [ \"*\" ],"
+ string config_first3 = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
"\"valid-lifetime\": 4000 }";
// Second subnet removed
- string config_second_removed = "{ \"interfaces\": [ \"*\" ],"
+ string config_second_removed = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"next-server\": \"1.2.3.4\", "
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr status;
// Config with junk instead of next-server address
- string config_bogus1 = "{ \"interfaces\": [ \"*\" ],"
+ string config_bogus1 = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
"\"valid-lifetime\": 4000 }";
// Config with IPv6 next server address
- string config_bogus2 = "{ \"interfaces\": [ \"*\" ],"
+ string config_bogus2 = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
"\"valid-lifetime\": 4000 }";
// Config with empty next server address
- string config_bogus3 = "{ \"interfaces\": [ \"*\" ],"
+ string config_bogus3 = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"next-server\": \"192.0.0.1\", "
ConstElementPtr status;
- string config_false = "{ \"interfaces\": [ \"*\" ],"
+ string config_false = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"echo-client-id\": false,"
" \"subnet\": \"192.0.2.0/24\" } ],"
"\"valid-lifetime\": 4000 }";
- string config_true = "{ \"interfaces\": [ \"*\" ],"
+ string config_true = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"echo-client-id\": true,"
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
TEST_F(Dhcp4ParserTest, multiplePools) {
// Collection with two subnets, each with 2 pools.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
// configuration does not include options configuration.
TEST_F(Dhcp4ParserTest, optionDataDefaults) {
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
// The definition is not required for the option that
// belongs to the 'dhcp4' option space as it is the
// standard option.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
// at the very end (when all other parameters are configured).
// Starting stage 1. Configure sub-options and their definitions.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
// the configuration from the stage 2 is repeated because BIND
// configuration manager sends whole configuration for the lists
// where at least one element is being modified or added.
- config = "{ \"interfaces\": [ \"*\" ],"
+ config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
// option setting.
TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"option-data\": [ {"
// for multiple subnets.
TEST_F(Dhcp4ParserTest, optionDataInMultipleSubnets) {
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
// In the first stage we create definitions of suboptions
// that we will add to the base option.
// Let's create some dummy options: foo and foo2.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
// We add our dummy options to this option space and thus
// they should be included as sub-options in the 'vendor-opts'
// option.
- config = "{ \"interfaces\": [ \"*\" ],"
+ config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
// This configuration string is to configure two options
// sharing the code 1 and belonging to the different vendor spaces.
// (different vendor-id values).
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
// This configuration string is to configure two options
// sharing the code 1 and belonging to the different vendor spaces.
// (different vendor-id values).
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000,"
"\"renew-timer\": 1000,"
// Create the first part of the configuration string.
string config =
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"hooks-libraries\": [";
// Append the libraries (separated by commas if needed)
IfaceMgrTestConfig test_config(true);
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"eth0\", \"eth1\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"eth0\", \"eth1\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }";
// but it also includes asterisk. The asterisk switches server into the
// mode when it listens on all interfaces regardless of what interface names
// were specified in the "interfaces" parameter.
- string config = "{ \"interfaces\": [ \"eth0\", \"*\", \"eth1\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"eth0\", \"*\", \"eth1\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }";
IfaceMgrTestConfig test_config(true);
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"eth0/10.0.0.1\", \"eth1/192.0.2.3\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"eth0/10.0.0.1\", \"eth1/192.0.2.3\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }";
// Verify that the convenience method agrees.
ASSERT_FALSE(CfgMgr::instance().ddnsEnabled());
- string config_str = "{ \"interfaces\": [ \"*\" ],"
+ string config_str = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
// Configuration string with an invalid D2 client config,
// "server-ip" is invalid.
- string config_str = "{ \"interfaces\": [ \"*\" ],"
+ string config_str = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
ConstElementPtr status;
// A config with relay information.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
// with defined client classes.
TEST_F(Dhcp4ParserTest, classifySubnets) {
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
// respective IPv4 subnets.
TEST_F(Dhcp4ParserTest, reservations) {
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
TEST_F(Dhcp4ParserTest, reservationBogus) {
// Case 1: misspelled hw-address parameter.
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
checkResult(x, 1);
// Case 2: DUID and HW Address both specified.
- config = "{ \"interfaces\": [ \"*\" ],"
+ config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
checkResult(x, 1);
// Case 3: Neither ip address nor hostname specified.
- config = "{ \"interfaces\": [ \"*\" ],"
+ config = "{ " + genIfaceConfig() + "," +
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
void
Dhcp4SrvD2Test::reset() {
- std::string config = "{ \"interfaces\": [ \"*\" ],"
+ std::string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"hooks-libraries\": [ ], "
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
const size_t max_queue_size) {
std::ostringstream config;
config <<
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
-# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
CONFIG="{
\"Dhcp4\":
{
- \"interfaces\": [ ],
+ \"interfaces-config\": {
+ \"interfaces\": [ ]
+ },
\"valid-lifetime\": 4000,
\"renew-timer\": 1000,
\"rebind-timer\": 2000,
CONFIG_INVALID="{
\"Dhcp4\":
{
- \"interfaces\": [ ],
+ \"interfaces-config\": {
+ \"interfaces\": [ ]
+ },
\"valid-lifetime\": -3,
\"renew-timer\": 1000,
\"rebind-timer\": 2000,
-// Copyright (C) 2011-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// subnet 10.254.226.0/24 is in use, because this packet
// contains the giaddr which belongs to this subnet and
// this giaddr is used to select the subnet
- std::string config = "{ \"interfaces\": [ \"*\" ],"
+ std::string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
NakedDhcpv4Srv srv(0);
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
" \"option-data\": [ {"
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"next-server\": \"192.0.0.1\", "
ConstElementPtr status;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"next-server\": \"192.0.0.1\", "
// Configure 2 subnets, both directly reachable over local interface
// (let's not complicate the matter with relays)
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
// Configure 2 subnets, both directly reachable over local interface
// (let's not complicate the matter with relays)
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
NakedDhcpv4Srv srv(0);
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
" \"option-data\": [ {"
// src/lib/dhcp/docsis3_option_defs.h.
TEST_F(Dhcpv4SrvTest, vendorOptionsDocsisDefinitions) {
ConstElementPtr x;
- string config_prefix = "{ \"interfaces\": [ \"*\" ],"
+ string config_prefix = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
" \"option-data\": [ {"
// The second subnet does not play any role here. The client's
// IP address belongs to the first subnet, so only that first
// subnet it being tested.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
// defined. Both are not belonging to the subnets. That is
// important, because if the relay belongs to the subnet, there's
// no need to specify relay override.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
// This test configures 2 subnets. They both are on the same link, so they
// have the same relay-ip address. Furthermore, the first subnet is
// reserved for clients that belong to class "foo".
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ "
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
void
DirectClientTest::configureSubnet(const std::string& prefix) {
std::ostringstream config;
- config << "{ \"interfaces\": [ \"*\" ],"
+ config << "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"option-data\": [ ],"
DirectClientTest::configureTwoSubnets(const std::string& prefix1,
const std::string& prefix2) {
std::ostringstream config;
- config << "{ \"interfaces\": [ \"*\" ],"
+ config << "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"option-data\": [ ],"
/// aa:bb:cc:dd:ee:ff, reserved address 10.0.0.7
const char* DORA_CONFIGS[] = {
// Configuration 0
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"valid-lifetime\": 600,"
"\"subnet4\": [ { "
" \"subnet\": \"10.0.0.0/24\", "
"}",
// Configuration 1
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
+
"\"valid-lifetime\": 600,"
"\"subnet4\": [ { "
" \"subnet\": \"192.0.2.0/24\", "
"}",
// Configuration 2
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"valid-lifetime\": 600,"
"\"subnet4\": [ { "
" \"subnet\": \"10.0.0.0/24\", "
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
/// - Quotes Servers option present: 192.0.2.202, 192.0.2.203.
const char* INFORM_CONFIGS[] = {
// Configuration 0
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"valid-lifetime\": 600,"
"\"subnet4\": [ { "
" \"subnet\": \"10.0.0.0/24\", "
"}",
// Configuration 1
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"valid-lifetime\": 600,"
"\"subnet4\": [ { "
" \"subnet\": \"192.0.2.0/24\", "
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
TEST_F(JSONFileBackendTest, jsonFile) {
// Prepare configuration file.
- string config = "{ \"Dhcp4\": { \"interfaces\": [ \"*\" ],"
+ string config = "{ \"Dhcp4\": {"
+ "\"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet4\": [ { "
string config_hash_comments = "# This is a comment. It should be \n"
"#ignored. Real config starts in line below\n"
- "{ \"Dhcp4\": { \"interfaces\": [ \"*\" ],"
+ "{ \"Dhcp4\": {"
+ "\"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, \n"
"# comments in the middle should be ignored, too\n"
(config_id.compare("rebind-timer") == 0)) {
parser = new Uint32Parser(config_id,
globalContext()->uint32_values_);
- } else if (config_id.compare("interface-config") == 0) {
+ } else if (config_id.compare("interfaces-config") == 0) {
parser = new IfacesConfigParser6();
} else if (config_id.compare("subnet6") == 0) {
parser = new Subnets6ListConfigParser(config_id);
// committed.
hooks_parser = parser;
hooks_parser->build(config_pair.second);
- } else if (config_pair.first == "interface-config") {
+ } else if (config_pair.first == "interfaces-config") {
// The interface parser is independent from any other parser and
// can be run here before other parsers.
parser->build(config_pair.second);
/// @brief Returns an interface configuration used by the most of the
/// unit tests.
std::string genIfaceConfig() const {
- return ("\"interface-config\": {"
+ return ("\"interfaces-config\": {"
" \"interfaces\": [ \"*\" ]"
"}");
}
const char *config[] = {
// No prefix.
- "{ \"interface-config\": { },"
+ "{ \"interfaces-config\": { },"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }"
"] }",
// No prefix-len.
- "{ \"interface-config\": { },"
+ "{ \"interfaces-config\": { },"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }"
"] }",
// No delegated-len.
- "{ \"interface-config\": { },"
+ "{ \"interfaces-config\": { },"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }"
"] }",
// Delegated length is too short.
- "{ \"interface-config\": { },"
+ "{ \"interfaces-config\": { },"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// Create the first part of the configuration string.
string config =
- "{ \"interface-config\": { },"
+ "{ \"interfaces-config\": { },"
"\"hooks-libraries\": [";
// Append the libraries (separated by commas if needed)
ConstElementPtr status;
- string config = "{ \"interface-config\": {"
+ string config = "{ \"interfaces-config\": {"
" \"interfaces\": [ \"eth0\" ]"
"},"
"\"preferred-lifetime\": 3000,"
// but also includes '*'. This keyword switches server into the
// mode when it listens on all interfaces regardless of what interface names
// were specified in the "interfaces" parameter.
- string config = "{ \"interface-config\": {"
+ string config = "{ \"interfaces-config\": {"
" \"interfaces\": [ \"eth0\", \"eth1\", \"*\" ]"
"},"
"\"preferred-lifetime\": 3000,"
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
///
const char* CONFIRM_CONFIGS[] = {
// Configuration 0
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 1
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
-// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2013,2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// Use empty parameters list
// Prepare configuration file.
- string config_txt = "{ \"interfaces\": [ \"*\" ],"
+ string config_txt = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
void
Dhcp6SrvD2Test::reset() {
- std::string config = "{ \"interfaces\": [ \"*\" ],"
+ std::string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"hooks-libraries\": [ ],"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
const size_t max_queue_size) {
std::ostringstream config;
config <<
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"hooks-libraries\": [ ],"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
-# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# Kea configuration to be stored in the configuration file.
CONFIG="{
\"Dhcp6\":
- {
- \"interfaces\": [ ],
+ { \"interfaces-config\": {
+ \"interfaces\": [ ]
+ },
\"preferred-lifetime\": 3000,
\"valid-lifetime\": 4000,
\"renew-timer\": 1000,
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
IfaceMgrTestConfig test_config(true);
ConstElementPtr x;
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
IfaceMgrTestConfig test_config(true);
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// src/lib/dhcp/docsis3_option_defs.h.
TEST_F(Dhcpv6SrvTest, vendorOptionsDocsisDefinitions) {
ConstElementPtr x;
- string config_prefix = "{ \"interfaces\": [ \"*\" ],"
+ string config_prefix = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// The second subnet does not play any role here. The client's
// IP address belongs to the first subnet, so only that first
// subnet it being tested.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// defined. Both are not belonging to the subnets. That is
// important, because if the relay belongs to the subnet, there's
// no need to specify relay override.
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// This test configures 2 subnets. They both are on the same link, so they
// have the same relay-ip address. Furthermore, the first subnet is
// reserved for clients that belong to class "foo".
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// Configure 2 subnets, both directly reachable over local interface
// (let's not complicate the matter with relays)
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
// Configure 2 subnets, both directly reachable over local interface
// (let's not complicate the matter with relays)
- string config = "{ \"interfaces\": [ \"*\" ],"
+ string config = "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
/// - no subnets defined
const char* CONFIGS[] = {
// Configuration 0
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 1
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 2
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 3
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"option-data\": [ {"
" \"name\": \"nis-servers\","
" \"data\": \"2001:db8::1, 2001:db8::2\""
-// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
TEST_F(JSONFileBackendTest, jsonFile) {
// Prepare configuration file.
- string config = "{ \"Dhcp6\": { \"interfaces\": [ \"*\" ],"
+ string config = "{ \"Dhcp6\": {"
+ "\"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
string config_hash_comments = "# This is a comment. It should be \n"
"#ignored. Real config starts in line below\n"
- "{ \"Dhcp6\": { \"interfaces\": [ \"*\" ],"
+ "{ \"Dhcp6\": {"
+ "\"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, \n"
/// - this specific configuration is used by tests which don't use relays
const char* REBIND_CONFIGS[] = {
// Configuration 0
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 1
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 2
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 3
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 4
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000 }",
// Configuration 5
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
/// match the subnet prefix
const char* CONFIGS[] = {
// Configuration 0
- "{ \"interfaces\": [ \"*\" ],"
+ "{ \"interfaces-config\": {"
+ " \"interfaces\": [ \"*\" ]"
+ "},"
"\"preferred-lifetime\": 3000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"Dhcp4":
{
# Add names of interfaces to listen on.
- "interfaces": [ ],
+ "interfaces-config:" {
+ "interfaces": [ ]
+ },
# Use Memfile lease database backend to store leases in a CSV file.
"lease-database": {
"Dhcp6":
{
# Add names of interfaces to listen on.
- "interfaces": [ ],
+ "interfaces-config:" {
+ "interfaces": [ ]
+ },
# Use Memfile lease database backend to store leases in a CSV file.
"lease-database": {
config="{
\"Dhcp4\":
{
- \"interfaces\": [ ],
+ \"interfaces-config\": {
+ \"interfaces\": [ ]
+ },
\"valid-lifetime\": 4000,
\"renew-timer\": 1000,
\"rebind-timer\": 2000,
},
\"Dhcp6\":
{
- \"interfaces\": [ ],
+ \"interfaces-config\": {
+ \"interfaces\": [ ]
+ },
\"preferred-lifetime\": 3000,
\"valid-lifetime\": 4000,
\"renew-timer\": 1000,
/// @brief Parser for interface list definition.
///
-/// This parser handles Dhcp4/interface-config/interfaces and
-/// Dhcp6/interface-config/interfaces entries.
+/// This parser handles Dhcp4/interfaces-config/interfaces and
+/// Dhcp6/interfaces-config/interfaces entries.
/// It contains a list of network interfaces that the server listens on.
/// In particular, it can contain an "*" that designates all interfaces.
class InterfaceListConfigParser : public DhcpConfigParser {
/// @brief Parser for the configuration of interfaces.
///
-/// This parser parses the "interface-config" parameter which holds the
+/// This parser parses the "interfaces-config" parameter which holds the
/// full configuration of the DHCP server with respect to the use of
/// interfaces, sockets and alike.
///
/// @param protocol AF_INET for DHCPv4 and AF_INET6 for DHCPv6.
IfacesConfigParser(const int protocol);
- /// @brief Parses generic parameters in "interface-config".
+ /// @brief Parses generic parameters in "interfaces-config".
///
- /// The generic parameters in the "interface-config" map are
+ /// The generic parameters in the "interfaces-config" map are
/// the ones that are common for DHCPv4 and DHCPv6.
///
/// @param ifaces_config A data element holding configuration of
};
-/// @brief Parser for the "interface-config" parameter of the DHCPv4 server.
+/// @brief Parser for the "interfaces-config" parameter of the DHCPv4 server.
class IfacesConfigParser4 : public IfacesConfigParser {
public:
};
-/// @brief Parser for the "interface-config" parameter of the DHCPv4 server.
+/// @brief Parser for the "interfaces-config" parameter of the DHCPv4 server.
class IfacesConfigParser6 : public IfacesConfigParser {
public: