Browse Source

[3604] Going over the unit test to use the new iface config structure.

Marcin Siodelski 10 years ago
parent
commit
f783c80336

+ 4 - 3
src/bin/dhcp4/json_config_parser.cc

@@ -1,4 +1,4 @@
-// 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
@@ -24,6 +24,7 @@
 #include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <dhcpsrv/parsers/host_reservation_parser.h>
 #include <dhcpsrv/parsers/host_reservations_list_parser.h>
+#include <dhcpsrv/parsers/ifaces_config_parser.h>
 #include <util/encode/hex.h>
 #include <util/strutil.h>
 
@@ -370,7 +371,7 @@ namespace dhcp {
         parser = new Uint32Parser(config_id,
                                  globalContext()->uint32_values_);
     } else if (config_id.compare("interfaces") == 0) {
-        parser = new InterfaceListConfigParser(config_id, globalContext());
+        parser = new IfacesConfigParser4();
     } else if (config_id.compare("subnet4") == 0) {
         parser = new Subnets4ListConfigParser(config_id);
     } else if (config_id.compare("option-data") == 0) {
@@ -475,7 +476,7 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
                 subnet_parser = parser;
             } else if (config_pair.first == "option-data") {
                 option_parser = parser;
-            } else if (config_pair.first == "interfaces") {
+            } else if (config_pair.first == "interface-config") {
                 // The interface parser is independent from any other
                 // parser and can be run here before any other parsers.
                 iface_parser = parser;

+ 5 - 4
src/bin/dhcp6/json_config_parser.cc

@@ -1,4 +1,4 @@
-// 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
@@ -29,6 +29,7 @@
 #include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <dhcpsrv/parsers/host_reservation_parser.h>
 #include <dhcpsrv/parsers/host_reservations_list_parser.h>
+#include <dhcpsrv/parsers/ifaces_config_parser.h>
 #include <log/logger_support.h>
 #include <util/encode/hex.h>
 #include <util/strutil.h>
@@ -596,8 +597,8 @@ namespace dhcp {
         (config_id.compare("rebind-timer") == 0))  {
         parser = new Uint32Parser(config_id,
                                  globalContext()->uint32_values_);
-    } else if (config_id.compare("interfaces") == 0) {
-        parser = new InterfaceListConfigParser(config_id, globalContext());
+    } else if (config_id.compare("interface-config") == 0) {
+        parser = new IfacesConfigParser6();
     } else if (config_id.compare("subnet6") == 0) {
         parser = new Subnets6ListConfigParser(config_id);
     } else if (config_id.compare("option-data") == 0) {
@@ -696,7 +697,7 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
                 // committed.
                 hooks_parser = parser;
                 hooks_parser->build(config_pair.second);
-            } else if (config_pair.first == "interfaces") {
+            } else if (config_pair.first == "interface-config") {
                 // The interface parser is independent from any other parser and
                 // can be run here before other parsers.
                 parser->build(config_pair.second);

+ 61 - 49
src/bin/dhcp6/tests/config_parser_unittest.cc

@@ -126,6 +126,14 @@ public:
         EXPECT_EQ(expected_code, rcode_);
     }
 
+    /// @brief Returns an interface configuration used by the most of the
+    /// unit tests.
+    std::string genIfaceConfig() const {
+        return ("\"interface-config\": {"
+                "  \"interfaces\": [ \"*\" ]"
+                "}");
+    }
+
     /// @brief Create the simple configuration with single option.
     ///
     /// This function allows to set one of the parameters that configure
@@ -185,7 +193,7 @@ public:
                                        std::string>& params)
     {
         std::ostringstream stream;
-        stream << "{ \"interfaces\": [ \"*\" ],"
+        stream << "{ " << genIfaceConfig() << ","
             "\"preferred-lifetime\": 3000,"
             "\"rebind-timer\": 2000, "
             "\"renew-timer\": 1000, "
@@ -346,7 +354,7 @@ public:
     /// test to make sure that contents of the database do not affect the
     /// results of subsequent tests.
     void resetConfiguration() {
-        string config = "{ \"interfaces\": [ \"*\" ],"
+        string config = "{ " + genIfaceConfig() + ","
             "\"hooks-libraries\": [ ],"
             "\"preferred-lifetime\": 3000,"
             "\"rebind-timer\": 2000, "
@@ -526,7 +534,7 @@ TEST_F(Dhcp6ParserTest, emptySubnet) {
     ConstElementPtr status;
 
     EXPECT_NO_THROW(status = configureDhcp6Server(srv_,
-                    Element::fromJSON("{ \"interfaces\": [ \"*\" ],"
+                    Element::fromJSON("{ " + genIfaceConfig() + ","
                                       "\"preferred-lifetime\": 3000,"
                                       "\"rebind-timer\": 2000, "
                                       "\"renew-timer\": 1000, "
@@ -543,7 +551,7 @@ TEST_F(Dhcp6ParserTest, subnetGlobalDefaults) {
 
     ConstElementPtr status;
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -578,7 +586,7 @@ TEST_F(Dhcp6ParserTest, multipleSubnets) {
     ConstElementPtr x;
     // Collection of four subnets for which ids should be autogenerated
     // - ids are unspecified or set to 0.
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -633,7 +641,7 @@ TEST_F(Dhcp6ParserTest, multipleSubnets) {
 TEST_F(Dhcp6ParserTest, multipleSubnetsExplicitIDs) {
     ConstElementPtr x;
     // Four subnets with arbitrary subnet ids.
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -689,7 +697,7 @@ TEST_F(Dhcp6ParserTest, multipleSubnetsExplicitIDs) {
 TEST_F(Dhcp6ParserTest, multipleSubnetsOverlapingIDs) {
     ConstElementPtr x;
     // Four subnets, two of them have the same id.
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -729,7 +737,7 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
     ConstElementPtr x;
 
     // All four subnets
-    string config4 = "{ \"interfaces\": [ \"*\" ],"
+    string config4 = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -756,7 +764,7 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
         "\"valid-lifetime\": 4000 }";
 
     // Three subnets (the last one removed)
-    string config_first3 = "{ \"interfaces\": [ \"*\" ],"
+    string config_first3 = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -778,7 +786,7 @@ TEST_F(Dhcp6ParserTest, reconfigureRemoveSubnet) {
         "\"valid-lifetime\": 4000 }";
 
     // Second subnet removed
-    string config_second_removed = "{ \"interfaces\": [ \"*\" ],"
+    string config_second_removed = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -862,7 +870,7 @@ TEST_F(Dhcp6ParserTest, subnetLocal) {
 
     ConstElementPtr status;
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -899,7 +907,7 @@ TEST_F(Dhcp6ParserTest, subnetInterface) {
 
     // There should be at least one interface
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -931,7 +939,7 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceBogus) {
 
     // There should be at least one interface
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -962,7 +970,7 @@ TEST_F(Dhcp6ParserTest, interfaceGlobal) {
 
     ConstElementPtr status;
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1033,7 +1041,7 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceId) {
 // parameter.
 TEST_F(Dhcp6ParserTest, interfaceIdGlobal) {
 
-    const string config = "{ \"interfaces\": [ \"*\" ],"
+    const string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1081,7 +1089,7 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceAndInterfaceId) {
 // The test defines 2 subnets, each with 2 pools.
 TEST_F(Dhcp6ParserTest, multiplePools) {
     // Collection with two subnets, each with 2 pools.
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1142,7 +1150,7 @@ TEST_F(Dhcp6ParserTest, poolOutOfSubnet) {
 
     ConstElementPtr status;
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1171,7 +1179,7 @@ TEST_F(Dhcp6ParserTest, poolPrefixLen) {
 
     ConstElementPtr x;
 
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1204,7 +1212,7 @@ TEST_F(Dhcp6ParserTest, pdPoolBasics) {
 
     // Define a single valid pd pool.
     string config =
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1269,7 +1277,7 @@ TEST_F(Dhcp6ParserTest, pdPoolList) {
     };
 
     string config =
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1335,7 +1343,7 @@ TEST_F(Dhcp6ParserTest, subnetAndPrefixDelegated) {
 
     // Define a single valid pd pool.
     string config =
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1394,7 +1402,7 @@ TEST_F(Dhcp6ParserTest, invalidPdPools) {
 
     const char *config[] =  {
         // No prefix.
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ \"interface-config\": { },"
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1408,7 +1416,7 @@ TEST_F(Dhcp6ParserTest, invalidPdPools) {
         "\"valid-lifetime\": 4000 }"
         "] }",
         // No prefix-len.
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ \"interface-config\": { },"
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1421,7 +1429,7 @@ TEST_F(Dhcp6ParserTest, invalidPdPools) {
         "\"valid-lifetime\": 4000 }"
         "] }",
         // No delegated-len.
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ \"interface-config\": { },"
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -1434,7 +1442,7 @@ TEST_F(Dhcp6ParserTest, invalidPdPools) {
         "\"valid-lifetime\": 4000 }"
         "] }",
         // Delegated length is too short.
-        "{ \"interfaces\": [ \"*\" ],"
+        "{ \"interface-config\": { },"
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -2011,7 +2019,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
 // configuration does not include options configuration.
 TEST_F(Dhcp6ParserTest, optionDataDefaults) {
     ConstElementPtr x;
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000,"
         "\"renew-timer\": 1000,"
@@ -2092,7 +2100,7 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) {
     // The definition is not required for the option that
     // belongs to the 'dhcp6' option space as it is the
     // standard option.
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
@@ -2173,7 +2181,7 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
     // 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() + ","
         "\"preferred-lifetime\": 3000,"
         "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
@@ -2226,7 +2234,7 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
     // 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\": [ {"
@@ -2321,7 +2329,7 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
 // for multiple subnets.
 TEST_F(Dhcp6ParserTest, optionDataInMultipleSubnets) {
     ConstElementPtr x;
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -2636,7 +2644,7 @@ TEST_F(Dhcp6ParserTest, vendorOptionsHex) {
     // 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() + ","
         "\"preferred-lifetime\": 3000,"
         "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
@@ -2696,7 +2704,7 @@ TEST_F(Dhcp6ParserTest, vendorOptionsCsv) {
     // 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() + ","
         "\"preferred-lifetime\": 3000,"
         "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
@@ -2762,7 +2770,7 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
     // In the first stahe 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() + ","
         "\"preferred-lifetime\": 3000,"
         "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
@@ -2819,7 +2827,7 @@ TEST_F(Dhcp6ParserTest, DISABLED_stdOptionDataEncapsulate) {
     // 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\": [ {"
@@ -2931,8 +2939,8 @@ buildHooksLibrariesConfig(const std::vector<std::string>& libraries) {
 
     // Create the first part of the configuration string.
     string config =
-        "{ \"interfaces\": [ \"*\" ],"
-            "\"hooks-libraries\": [";
+        "{ \"interface-config\": { },"
+           "\"hooks-libraries\": [";
 
     // Append the libraries (separated by commas if needed)
     for (int i = 0; i < libraries.size(); ++i) {
@@ -3079,7 +3087,9 @@ TEST_F(Dhcp6ParserTest, selectedInterfaces) {
 
     ConstElementPtr status;
 
-    string config = "{ \"interfaces\": [ \"eth0\" ],"
+    string config = "{ \"interface-config\": {"
+        "  \"interfaces\": [ \"eth0\" ]"
+        "},"
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -3116,7 +3126,9 @@ TEST_F(Dhcp6ParserTest, allInterfaces) {
     // 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 = "{ \"interfaces\": [ \"eth0\", \"eth1\", \"*\" ],"
+    string config = "{ \"interface-config\": {"
+        "  \"interfaces\": [ \"eth0\", \"eth1\", \"*\" ]"
+        "},"
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -3143,7 +3155,7 @@ TEST_F(Dhcp6ParserTest, subnetRelayInfo) {
     ConstElementPtr status;
 
     // A config with relay information.
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet6\": [ { "
@@ -3172,7 +3184,7 @@ TEST_F(Dhcp6ParserTest, subnetRelayInfo) {
 // with defined client classes.
 TEST_F(Dhcp6ParserTest, classifySubnets) {
     ConstElementPtr x;
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
@@ -3267,7 +3279,7 @@ TEST_F(Dhcp6ParserTest, d2ClientConfig) {
     // Verify that the convenience method agrees.
     ASSERT_FALSE(CfgMgr::instance().ddnsEnabled());
 
-    string config_str = "{ \"interfaces\": [ \"*\" ],"
+    string config_str = "{ " + genIfaceConfig() + ","
         "\"preferred-lifetime\": 3000,"
         "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000, "
@@ -3334,7 +3346,7 @@ TEST_F(Dhcp6ParserTest, invalidD2ClientConfig) {
 
     // 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, "
         "\"subnet6\": [ { "
@@ -3393,7 +3405,7 @@ bool reservationExists(const IPv6Resrv& resrv, const IPv6ResrvRange& range) {
 // respective IPv6 subnets.
 TEST_F(Dhcp6ParserTest, reservations) {
     ConstElementPtr x;
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet6\": [ "
@@ -3532,7 +3544,7 @@ TEST_F(Dhcp6ParserTest, reservations) {
 TEST_F(Dhcp6ParserTest, reservationBogus) {
     // Case 1: misspelled "duid" parameter.
     ConstElementPtr x;
-    string config = "{ \"interfaces\": [ \"*\" ],"
+    string config = "{ " + genIfaceConfig() + ","
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet6\": [ "
@@ -3558,7 +3570,7 @@ TEST_F(Dhcp6ParserTest, reservationBogus) {
     checkResult(x, 1);
 
     // Case 2: DUID and HW Address both specified.
-    config = "{ \"interfaces\": [ \"*\" ],"
+    config = "{ " + genIfaceConfig() + ","
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet6\": [ "
@@ -3588,7 +3600,7 @@ TEST_F(Dhcp6ParserTest, reservationBogus) {
     checkResult(x, 1);
 
     // Case 3: Neither ip address nor hostname specified.
-    config = "{ \"interfaces\": [ \"*\" ],"
+    config = "{ " + genIfaceConfig() + ","
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet6\": [ "
@@ -3625,7 +3637,7 @@ TEST_F(Dhcp6ParserTest, macSources) {
     ConstElementPtr status;
 
     EXPECT_NO_THROW(status = configureDhcp6Server(srv_,
-        Element::fromJSON("{ \"interfaces\": [ \"*\" ],"
+        Element::fromJSON("{ " + genIfaceConfig() + ","
                           "\"mac-sources\": [ \"rfc6939\", \"rfc4649\", \"rfc4580\","
                           "\"client-link-addr-option\", \"remote-id\", \"subscriber-id\"],"
                           "\"preferred-lifetime\": 3000,"
@@ -3657,7 +3669,7 @@ TEST_F(Dhcp6ParserTest, macSourcesEmpty) {
     ConstElementPtr status;
 
     EXPECT_NO_THROW(status = configureDhcp6Server(srv_,
-                    Element::fromJSON("{ \"interfaces\": [ \"*\" ],"
+                    Element::fromJSON("{ " + genIfaceConfig() + ","
                                       "\"mac-sources\": [ ],"
                                       "\"preferred-lifetime\": 3000,"
                                       "\"rebind-timer\": 2000, "
@@ -3679,7 +3691,7 @@ TEST_F(Dhcp6ParserTest, macSourcesBogus) {
     ConstElementPtr status;
 
     EXPECT_NO_THROW(status = configureDhcp6Server(srv_,
-                    Element::fromJSON("{ \"interfaces\": [ \"*\" ],"
+                    Element::fromJSON("{ " + genIfaceConfig() + ","
                                       "\"mac-sources\": [ \"from-wire\" ],"
                                       "\"preferred-lifetime\": 3000,"
                                       "\"rebind-timer\": 2000, "