]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2866] Removed default id = 0
authorFrancis Dupont <fdupont@isc.org>
Wed, 7 Jun 2023 09:59:47 +0000 (11:59 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 26 Jun 2023 12:24:42 +0000 (14:24 +0200)
16 files changed:
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/dhcp4_test_utils.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_test_utils.cc
src/bin/dhcp6/tests/fqdn_unittest.cc
src/lib/dhcpsrv/subnet.h
src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
src/lib/dhcpsrv/tests/alloc_engine_utils.cc
src/lib/dhcpsrv/tests/cfg_subnets4_unittest.cc
src/lib/dhcpsrv/tests/cfg_subnets6_unittest.cc
src/lib/dhcpsrv/tests/iterative_allocation_state_unittest.cc
src/lib/dhcpsrv/tests/iterative_allocator_unittest.cc
src/lib/dhcpsrv/tests/ncr_generator_unittest.cc
src/lib/dhcpsrv/tests/srv_config_unittest.cc
src/lib/dhcpsrv/tests/subnet_unittest.cc

index c47c06f25095216e6f379f6c05020b33011aa50a..7a1c4604a2c97e622260b459264667ce051c1308 100644 (file)
@@ -1272,7 +1272,8 @@ TEST_F(Dhcpv4SrvTest, DiscoverValidLifetime) {
     subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24,
                               unspecified,
                               unspecified,
-                              valid_lft);
+                              valid_lft,
+                              subnet_->getID());
 
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.100"),
                                IOAddress("192.0.2.110")));
@@ -1352,7 +1353,8 @@ TEST_F(Dhcpv4SrvTest, DiscoverTimers) {
     subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24,
                               unspecified,
                               unspecified,
-                              valid_lft);
+                              valid_lft,
+                              subnet_->getID());
 
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.100"),
                                IOAddress("192.0.2.110")));
@@ -1503,7 +1505,8 @@ TEST_F(Dhcpv4SrvTest, calculateTeeTimers) {
     subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24,
                               unspecified,
                               unspecified,
-                              valid_lft);
+                              valid_lft,
+                              subnet_->getID());
 
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.100"),
                                IOAddress("192.0.2.110")));
@@ -1884,7 +1887,8 @@ TEST_F(Dhcpv4SrvTest, RequestNoTimers) {
     subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24,
                               Triplet<uint32_t>(),
                               Triplet<uint32_t>(),
-                              3000);
+                              3000,
+                              subnet_->getID());
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.100"),
                                IOAddress("192.0.2.110")));
     subnet_->addPool(pool_);
index b33c34f531f2afc82adb1b316b532563e0fb56b1..045fe6fb677b5c8ede40ebbe242671f637de1d31 100644 (file)
@@ -62,7 +62,8 @@ Dhcpv4SrvTest::Dhcpv4SrvTest()
     // Wipe any existing statistics
     isc::stats::StatsMgr::instance().removeAll();
 
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1000, 2000, 3000);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"),
+                              24, 1000, 2000, 3000, SubnetID(1));
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.100"), IOAddress("192.0.2.110")));
     subnet_->addPool(pool_);
 
index 5a618d1d1b1e08cab0cb3677c69a618454d4c1fd..2a282c2b49f987250d9af73ed28e1be54af94c0f 100644 (file)
@@ -2423,9 +2423,12 @@ TEST_F(Dhcpv6SrvTest, testUnicast) {
 TEST_F(Dhcpv6SrvTest, selectSubnetAddr) {
     NakedDhcpv6Srv srv(0);
 
-    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4);
-    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4);
-    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4);
+    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(10));
+    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(20));
+    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(30));
 
     // CASE 1: We have only one subnet defined and we received local traffic.
     // The only available subnet used to be picked, but not anymore
@@ -2495,9 +2498,12 @@ TEST_F(Dhcpv6SrvTest, selectSubnetAddr) {
 TEST_F(Dhcpv6SrvTest, selectSubnetIface) {
     NakedDhcpv6Srv srv(0);
 
-    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4);
-    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4);
-    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4);
+    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(10));
+    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(20));
+    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(30));
 
     subnet1->setIface("eth0");
     subnet3->setIface("wifi1");
@@ -2560,9 +2566,12 @@ TEST_F(Dhcpv6SrvTest, selectSubnetIface) {
 TEST_F(Dhcpv6SrvTest, selectSubnetRelayLinkaddr) {
     NakedDhcpv6Srv srv(0);
 
-    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4);
-    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4);
-    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4);
+    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(10));
+    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(20));
+    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(30));
 
     Pkt6::RelayInfo relay;
     relay.linkaddr_ = IOAddress("2001:db8:2::1234");
@@ -2683,9 +2692,12 @@ TEST_F(Dhcpv6SrvTest, selectSubnetRelayLinkaddr) {
 TEST_F(Dhcpv6SrvTest, selectSubnetRelayInterfaceId) {
     NakedDhcpv6Srv srv(0);
 
-    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4);
-    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4);
-    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4);
+    auto subnet1 = Subnet6::create(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(10));
+    auto subnet2 = Subnet6::create(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(20));
+    auto subnet3 = Subnet6::create(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(30));
 
     subnet1->setInterfaceId(generateInterfaceId("relay1"));
     subnet2->setInterfaceId(generateInterfaceId("relay2"));
index 68fd25c117cc0f012d43e7f33488a0fdf6b1ab1c..9075e41670acd0a76a07520df1ea7e8fd3ab5a40 100644 (file)
@@ -57,7 +57,7 @@ BaseServerTest::~BaseServerTest() {
 Dhcpv6SrvTest::Dhcpv6SrvTest()
     : NakedDhcpv6SrvTest(), srv_(0), multi_threading_(false) {
     subnet_ = Subnet6::create(isc::asiolink::IOAddress("2001:db8:1::"),
-                              48, 1000, 2000, 3000, 4000);
+                              48, 1000, 2000, 3000, 4000, SubnetID(1));
     subnet_->setIface("eth0");
 
     pool_ = isc::dhcp::Pool6Ptr(new isc::dhcp::Pool6(isc::dhcp::Lease::TYPE_NA,
@@ -272,8 +272,8 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type,
     // and then be reused.
     if (expire_before_renew) {
         CfgMgr::instance().clear();
-        subnet_ = Subnet6::create(IOAddress("2001:db8:1:1::"),
-                                  48, 1000, 2000, 3000, 4000);
+        subnet_ = Subnet6::create(IOAddress("2001:db8:1:1::"), 48,
+                                  1000, 2000, 3000, 4000, subnet_->getID());
         subnet_->setIface("eth0");
         pool_.reset(new Pool6(Lease::TYPE_NA, existing, existing));
         subnet_->addPool(pool_);
index 31d3d374697fe31b0237e5ee3dcb321606d03f2a..ecc77370511986fdd2cb72d6cb2fcc6223463179 100644 (file)
@@ -1371,7 +1371,8 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReuseExpiredLease) {
     // exactly one address. This address will be handed out to the
     // client, will get expired and then be reused.
     CfgMgr::instance().clear();
-    subnet_ = Subnet6::create(IOAddress("2001:db8:1:1::"), 56, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8:1:1::"),
+                              56, 1, 2, 3, 4, SubnetID(10));
     subnet_->setIface("eth0");
     subnet_->setDdnsSendUpdates(true);
 
index 723111d08ee02ee5c8f39a769d1f5520b2c523c1..54e18d3e586f4625ee70eb0ab73037216e20b40e 100644 (file)
@@ -514,13 +514,12 @@ public:
     /// @param t1 renewal timer (in seconds)
     /// @param t2 rebind timer (in seconds)
     /// @param valid_lifetime preferred lifetime of leases (in seconds)
-    /// @param id arbitrary subnet id, default value of 0 triggers
-    /// autogeneration of subnet id
+    /// @param id arbitrary subnet id, no default value
     Subnet4(const isc::asiolink::IOAddress& prefix, uint8_t length,
             const util::Triplet<uint32_t>& t1,
             const util::Triplet<uint32_t>& t2,
             const util::Triplet<uint32_t>& valid_lifetime,
-            const SubnetID id = 0);
+            const SubnetID id);
 
     /// @brief Factory function creating an instance of the @c Subnet4.
     ///
@@ -538,8 +537,7 @@ public:
     /// @param t1 renewal timer (in seconds)
     /// @param t2 rebind timer (in seconds)
     /// @param valid_lifetime preferred lifetime of leases (in seconds)
-    /// @param id arbitrary subnet id, default value of 0 triggers
-    /// autogeneration of subnet id
+    /// @param id arbitrary subnet id, no default value
     ///
     /// @return Pointer to the @c Subnet4 instance.
     static Subnet4Ptr
@@ -547,7 +545,7 @@ public:
            const util::Triplet<uint32_t>& t1,
            const util::Triplet<uint32_t>& t2,
            const util::Triplet<uint32_t>& valid_lifetime,
-           const SubnetID id = 0);
+           const SubnetID id);
 
     /// @brief Returns next subnet within shared network.
     ///
@@ -682,14 +680,14 @@ public:
     /// @param t2 rebind timer (in seconds)
     /// @param preferred_lifetime preferred lifetime of leases (in seconds)
     /// @param valid_lifetime preferred lifetime of leases (in seconds)
-    /// @param id arbitrary subnet id, default value of 0 triggers
+    /// @param id arbitrary subnet id, no default value
     /// autogeneration of subnet id
     Subnet6(const isc::asiolink::IOAddress& prefix, uint8_t length,
             const util::Triplet<uint32_t>& t1,
             const util::Triplet<uint32_t>& t2,
             const util::Triplet<uint32_t>& preferred_lifetime,
             const util::Triplet<uint32_t>& valid_lifetime,
-            const SubnetID id = 0);
+            const SubnetID id);
 
     /// @brief Factory function creating an instance of the @c Subnet4.
     ///
@@ -708,8 +706,7 @@ public:
     /// @param t2 rebind timer (in seconds)
     /// @param preferred_lifetime preferred lifetime of leases (in seconds)
     /// @param valid_lifetime preferred lifetime of leases (in seconds)
-    /// @param id arbitrary subnet id, default value of 0 triggers
-    /// autogeneration of subnet id
+    /// @param id arbitrary subnet id, no default value
     ///
     /// @return Pointer to the @c Subnet6 instance.
     static Subnet6Ptr
@@ -718,7 +715,7 @@ public:
            const util::Triplet<uint32_t>& t2,
            const util::Triplet<uint32_t>& preferred_lifetime,
            const util::Triplet<uint32_t>& valid_lifetime,
-           const SubnetID id = 0);
+           const SubnetID id);
 
     /// @brief Returns next subnet within shared network.
     ///
index 700960731550ad0df4f72bda8036e01972f8ef1b..6b1789cf38a565f663ac3b4c731a6ec0df9f6217 100644 (file)
@@ -502,11 +502,11 @@ TEST_F(AllocEngine4Test, allocateLease4Nulls) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Allocations without HW address are not allowed
     AllocEngine::ClientContext4 ctx2(subnet_, clientid_, HWAddrPtr(),
@@ -523,11 +523,11 @@ TEST_F(AllocEngine4Test, allocateLease4Nulls) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Allocations without client-id are allowed
     clientid_.reset();
@@ -835,7 +835,7 @@ TEST_F(AllocEngine4Test, smallPool4) {
     cfg_mgr.clear();
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -878,7 +878,7 @@ TEST_F(AllocEngine4Test, outOfAddresses4) {
     cfg_mgr.clear();
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -911,11 +911,11 @@ TEST_F(AllocEngine4Test, outOfAddresses4) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(1, getStatistics("v4-allocation-fail", 2));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 2));
-    EXPECT_EQ(1, getStatistics("v4-allocation-fail-subnet", 2));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 2));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 2));
+    EXPECT_EQ(1, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(1, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 }
 
 /// @brief This test class is dedicated to testing shared networks
@@ -933,8 +933,8 @@ public:
         // Create two subnets, each with a single address pool. The first subnet
         // has only one address in its address pool to make it easier to simulate
         // address exhaustion.
-        subnet1_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(1));
-        subnet2_ = Subnet4::create(IOAddress("10.1.2.0"), 24, 1, 2, 3, SubnetID(2));
+        subnet1_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
+        subnet2_ = Subnet4::create(IOAddress("10.1.2.0"), 24, 1, 2, 3, SubnetID(20));
         pool1_.reset(new Pool4(IOAddress("192.0.2.17"), IOAddress("192.0.2.17")));
         pool2_.reset(new Pool4(IOAddress("10.1.2.5"), IOAddress("10.1.2.100")));
 
@@ -1369,11 +1369,11 @@ TEST_F(SharedNetworkAlloc4Test, runningOut) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(1, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(1, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(1, getStatistics("v4-allocation-fail", subnet1_->getID()));
+    EXPECT_EQ(1, getStatistics("v4-allocation-fail-shared-network", subnet1_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet1_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet1_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet1_->getID()));
 }
 
 // This test verifies that the server can offer an address from a
@@ -1668,7 +1668,7 @@ TEST_F(AllocEngine4Test, discoverReuseExpiredLease4) {
     cfg_mgr.clear();
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -1803,7 +1803,7 @@ TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4) {
     IOAddress addr("192.0.2.15");
     CfgMgr& cfg_mgr = CfgMgr::instance();
     cfg_mgr.clear();
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -1840,7 +1840,7 @@ TEST_F(AllocEngine4Test, discoverReuseDeclinedLease4Stats) {
     IOAddress addr("192.0.2.15");
     CfgMgr& cfg_mgr = CfgMgr::instance();
     cfg_mgr.clear();
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -1880,7 +1880,7 @@ TEST_F(AllocEngine4Test, requestReuseDeclinedLease4) {
     IOAddress addr("192.0.2.15");
     CfgMgr& cfg_mgr = CfgMgr::instance();
     cfg_mgr.clear();
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -1915,7 +1915,7 @@ TEST_F(AllocEngine4Test, requestReuseDeclinedLease4Stats) {
     IOAddress addr("192.0.2.15");
     CfgMgr& cfg_mgr = CfgMgr::instance();
     cfg_mgr.clear();
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -2053,11 +2053,11 @@ TEST_F(AllocEngine4Test, requestOtherClientLease) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Now simulate the DHCPDISCOVER case when the provided address is
     // treated as a hint. The engine should return a lease for a
@@ -2188,11 +2188,11 @@ TEST_F(AllocEngine4Test, reservedAddressHint) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Now, request a correct address. The client should obtain it.
     AllocEngine::ClientContext4 ctx2(subnet_, clientid_, hwaddr_,
@@ -2345,11 +2345,11 @@ TEST_F(AllocEngine4Test, reservedAddressHijacked) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Make sure that the allocation engine didn't modify the lease of the
     // client A.
@@ -2374,11 +2374,11 @@ TEST_F(AllocEngine4Test, reservedAddressHijacked) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     from_mgr = LeaseMgrFactory::instance().getLease4(lease->addr_);
     ASSERT_TRUE(from_mgr);
@@ -2484,11 +2484,11 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseInvalidHint) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Repeat the test, but this time ask for the address that the client
     // has allocated.
@@ -2514,11 +2514,11 @@ TEST_F(AllocEngine4Test, reservedAddressExistingLeaseInvalidHint) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 }
 
 // This test checks that the behavior of the allocation engine in the following
@@ -2743,11 +2743,11 @@ TEST_F(AllocEngine4Test, reservedAddressConflictResolution) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Client A tries to renew the lease. The renewal should fail because
     // server detects that Client A doesn't have reservation for this
@@ -2766,11 +2766,11 @@ TEST_F(AllocEngine4Test, reservedAddressConflictResolution) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Client A returns to DHCPDISCOVER and should be offered a lease.
     // The offered lease address must be different than the one the
@@ -2881,11 +2881,11 @@ TEST_F(AllocEngine4Test, reservedAddressHintUsedByOtherClient) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // The same client should get a different lease than requested if
     // if is sending a DHCPDISCOVER (fake allocation is true).
@@ -2933,11 +2933,11 @@ TEST_F(AllocEngine4Test, reservedAddressShortPool) {
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes"));
 
-    EXPECT_EQ(1, getStatistics("v4-allocation-fail", 2));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", 2));
-    EXPECT_EQ(1, getStatistics("v4-allocation-fail-subnet", 2));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", 2));
-    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", 2));
+    EXPECT_EQ(1, getStatistics("v4-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(1, getStatistics("v4-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v4-allocation-fail-classes", subnet_->getID()));
 
     // Now, let's remove the reservation.
     initSubnet(IOAddress("192.0.2.100"), IOAddress("192.0.2.100"));
@@ -4894,7 +4894,7 @@ TEST_F(AllocEngine4Test, fullPool) {
     cfg_mgr.clear();
 
     // Configure a larger subnet with a /24 pool.
-    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("10.0.1.0"), IOAddress("10.0.1.255")));
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -4948,7 +4948,7 @@ TEST_F(AllocEngine4Test, fullSubnet24) {
     cfg_mgr.clear();
 
     // Configure a larger subnet with a /24 pool.
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.0"),
                                IOAddress("192.0.2.255")));
     subnet_->addPool(pool_);
@@ -5004,7 +5004,7 @@ TEST_F(AllocEngine4Test, excludeFirstLast) {
     cfg_mgr.clear();
 
     // Configure a larger subnet with a /24 pool.
-    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("10.0.1.0"), IOAddress("10.0.1.255")));
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -5062,7 +5062,7 @@ TEST_F(AllocEngine4Test, excludeFirstLast24) {
     cfg_mgr.clear();
 
     // Configure a larger subnet with a /24 pool.
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.0"),
                                IOAddress("192.0.2.255")));
     subnet_->addPool(pool_);
@@ -5121,7 +5121,7 @@ TEST_F(AllocEngine4Test, excludeFirst25) {
     cfg_mgr.clear();
 
     // Configure a smaller subnet with a /25 pool.
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 25, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 25, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.0"),
                                IOAddress("192.0.2.127")));
     subnet_->addPool(pool_);
@@ -5178,7 +5178,7 @@ TEST_F(AllocEngine4Test, excludeLast25) {
     cfg_mgr.clear();
 
     // Configure a smaller subnet with a /25 pool.
-    subnet_ = Subnet4::create(IOAddress("192.0.2.128"), 25, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.128"), 25, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("192.0.2.128"),
                                IOAddress("192.0.2.255")));
     subnet_->addPool(pool_);
@@ -5235,7 +5235,7 @@ TEST_F(AllocEngine4Test, excludeFirstLastRequested) {
     cfg_mgr.clear();
 
     // Configure a larger subnet with a /24 pool.
-    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("10.0.1.0"), IOAddress("10.0.1.255")));
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -5275,7 +5275,7 @@ TEST_F(AllocEngine4Test, excludeFirstLastReserver) {
     cfg_mgr.clear();
 
     // Configure a larger subnet with a /24 pool.
-    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("10.0.0.0"), 8, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(IOAddress("10.0.1.0"), IOAddress("10.0.1.255")));
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets4()->add(subnet_);
@@ -5666,7 +5666,7 @@ TEST_F(AllocEngine4Test, discoverOfferLft) {
     cfg_mgr.clear();
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
 
@@ -5740,7 +5740,7 @@ TEST_F(AllocEngine4Test, discoverOfferLftUseExistingLease4) {
     cfg_mgr.clear();
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 300);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 300, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
 
@@ -5801,7 +5801,7 @@ TEST_F(AllocEngine4Test, discoverOfferLftReuseExpiredLease4) {
     cfg_mgr.clear();
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(10));
     pool_ = Pool4Ptr(new Pool4(addr, addr)); // just a single address
     subnet_->addPool(pool_);
 
index 918ca7fd159242f87cce7c0183192dd5b4846e7c..23bd77d08780c530ec33398bb9cfff8d4a5b6317 100644 (file)
@@ -263,11 +263,11 @@ TEST_F(AllocEngine6Test, allocateAddress6Nulls) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
 
     // Allocations without DUID are not allowed either
     AllocEngine::ClientContext6 ctx2(subnet_, DuidPtr(), false, false, "", false,
@@ -282,11 +282,11 @@ TEST_F(AllocEngine6Test, allocateAddress6Nulls) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
 }
 
 // This test checks if really small pools are working
@@ -343,7 +343,7 @@ TEST_F(AllocEngine6Test, outOfAddresses6) {
     cfg_mgr.clear(); // Get rid of the default test configuration
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4, SubnetID(10));
     pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
@@ -374,11 +374,11 @@ TEST_F(AllocEngine6Test, outOfAddresses6) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(1, getStatistics("v6-allocation-fail", 2));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 2));
-    EXPECT_EQ(1, getStatistics("v6-allocation-fail-subnet", 2));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 2));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 2));
+    EXPECT_EQ(1, getStatistics("v6-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(1, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
 }
 
 // This test checks if an expired lease can be reused in SOLICIT (fake allocation)
@@ -707,7 +707,7 @@ TEST_F(AllocEngine6Test, requestReuseExpiredLease6) {
     cfg_mgr.clear(); // Get rid of the default test configuration
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4, SubnetID(10));
     pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
@@ -1743,11 +1743,11 @@ TEST_F(AllocEngine6Test, reservedAddress) {
             EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
             EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-            EXPECT_EQ(failure, getStatistics("v6-allocation-fail", 1));
-            EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 1));
-            EXPECT_EQ(failure, getStatistics("v6-allocation-fail-subnet", 1));
-            EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 1));
-            EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 1));
+            EXPECT_EQ(failure, getStatistics("v6-allocation-fail", subnet_->getID()));
+            EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+            EXPECT_EQ(failure, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+            EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+            EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
         } else {
             success++;
             std::cout << "Alloc for client " << (int)i << " succeeded:"
@@ -1798,11 +1798,11 @@ TEST_F(AllocEngine6Test, allocateLeasesInvalidData) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
 
     // Let's fix this and break it in a different way.
     ctx.subnet_ = subnet_;
@@ -1818,11 +1818,11 @@ TEST_F(AllocEngine6Test, allocateLeasesInvalidData) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 1));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
 }
 
 // Checks whether an address can be renewed (simple case, no reservation tricks)
@@ -2395,7 +2395,7 @@ TEST_F(AllocEngine6Test, largePoolOver32bits) {
     AllocEngine engine(0);
 
     // Configure 2001:db8::/32 subnet
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(10));
 
     // Configure the NA pool of /48. So there are 2^80 addresses there. Make
     // sure that we still can handle cases where number of available addresses
@@ -2454,11 +2454,11 @@ TEST_F(AllocEngine6Test, largeAllocationAttemptsOverride) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(1, getStatistics("v6-allocation-fail", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", 1));
-    EXPECT_EQ(1, getStatistics("v6-allocation-fail-subnet", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 1));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 1));
+    EXPECT_EQ(1, getStatistics("v6-allocation-fail", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-shared-network", subnet_->getID()));
+    EXPECT_EQ(1, getStatistics("v6-allocation-fail-subnet", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet_->getID()));
 
     // This time, lets allow more attempts, and expect that the allocation will
     // be successful.
@@ -2645,7 +2645,7 @@ TEST_F(AllocEngine6Test, reuseReclaimedExpiredViaRequest) {
     cfg_mgr.clear(); // Get rid of the default test configuration
 
     // Create configuration similar to other tests, but with a single address pool
-    subnet_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4, SubnetID(10));
     pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, addr, addr)); // just a single address
     subnet_->addPool(pool_);
     cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
@@ -2720,8 +2720,8 @@ public:
     SharedNetworkAlloc6Test()
         :engine_(0) {
 
-        subnet1_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
-        subnet2_ = Subnet6::create(IOAddress("2001:db8:2::"), 56, 1, 2, 3, 4);
+        subnet1_ = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4, SubnetID(10));
+        subnet2_ = Subnet6::create(IOAddress("2001:db8:2::"), 56, 1, 2, 3, 4, SubnetID(20));
         pool1_.reset(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::1"),
                                IOAddress("2001:db8:1::1")));
         pool2_.reset(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:2::"),
@@ -3194,11 +3194,11 @@ TEST_F(SharedNetworkAlloc6Test, requestRunningOut) {
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools"));
     EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes"));
 
-    EXPECT_EQ(1, getStatistics("v6-allocation-fail", 3));
-    EXPECT_EQ(1, getStatistics("v6-allocation-fail-shared-network", 3));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", 3));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", 3));
-    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", 3));
+    EXPECT_EQ(1, getStatistics("v6-allocation-fail", subnet2_->getID()));
+    EXPECT_EQ(1, getStatistics("v6-allocation-fail-shared-network", subnet2_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-subnet", subnet2_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-no-pools", subnet2_->getID()));
+    EXPECT_EQ(0, getStatistics("v6-allocation-fail-classes", subnet2_->getID()));
 }
 
 // Verifies that client with a hostname reservation can
index fd927c3b89e4e6b8974b563369a34fa766c2e14d..0823bb34518fa8c888624aadb6781712d306db95 100644 (file)
@@ -171,7 +171,9 @@ AllocEngine4Test::generateDeclinedLease(const std::string& addr,
 }
 
 AllocEngine6Test::AllocEngine6Test() {
-    Subnet::resetSubnetID();
+    // No longer used but this means too that tests relied far too much on it.
+    //Subnet::resetSubnetID();
+
     CfgMgr::instance().clear();
 
     // This lease mgr needs to exist to before configuration commits.
@@ -208,7 +210,8 @@ AllocEngine6Test::initSubnet(const asiolink::IOAddress& subnet,
                              const uint8_t pd_delegated_length) {
     CfgMgr& cfg_mgr = CfgMgr::instance();
 
-    subnet_ = Subnet6::create(subnet, 56, 100, 200, 300, 400);
+    static SubnetID id(1);
+    subnet_ = Subnet6::create(subnet, 56, 100, 200, 300, 400, id++);
     pool_ = Pool6Ptr(new Pool6(Lease::TYPE_NA, pool_start, pool_end));
 
     subnet_->addPool(pool_);
@@ -637,7 +640,8 @@ AllocEngine4Test::initSubnet(const asiolink::IOAddress& pool_start,
                              const asiolink::IOAddress& pool_end) {
     CfgMgr& cfg_mgr = CfgMgr::instance();
 
-    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    static SubnetID id(1);
+    subnet_ = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3, id++);
     pool_ = Pool4Ptr(new Pool4(pool_start, pool_end));
     subnet_->addPool(pool_);
 
@@ -645,7 +649,9 @@ AllocEngine4Test::initSubnet(const asiolink::IOAddress& pool_start,
 }
 
 AllocEngine4Test::AllocEngine4Test() {
-    Subnet::resetSubnetID();
+    // No longer used but this means too that tests relied far too much on it.
+    //Subnet::resetSubnetID();
+
     CfgMgr::instance().clear();
 
     // This lease mgr needs to exist to before configuration commits.
index 104420261df4038d27c710e5fccde4ddaeb1f566..73c36a7260d1a83dec086b9239b3229a03287217 100644 (file)
@@ -421,9 +421,12 @@ TEST(CfgSubnets4Test, selectSubnetByCiaddr) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Make sure that initially the subnets don't exist.
     SubnetSelector selector;
@@ -466,9 +469,12 @@ TEST(CfgSubnets4Test, selectSubnetByIface) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
     // No interface defined for subnet1
     subnet2->setIface("lo");
     subnet3->setIface("eth1");
@@ -571,9 +577,12 @@ TEST(CfgSubnets4Test, selectSubnetByClasses) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Add them to the configuration.
     cfg.add(subnet1);
@@ -647,9 +656,12 @@ TEST(CfgSubnets4Test, selectSharedNetworkByClasses) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Add them to the configuration.
     cfg.add(subnet1);
@@ -702,9 +714,12 @@ TEST(CfgSubnets4Test, selectSubnetByOptionSelect) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Add them to the configuration.
     cfg.add(subnet1);
@@ -739,9 +754,12 @@ TEST(CfgSubnets4Test, selectSubnetByRelayAddress) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Add them to the configuration.
     cfg.add(subnet1);
@@ -778,9 +796,12 @@ TEST(CfgSubnets4Test, selectSharedNetworkByRelayAddressNetworkLevel) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Add them to the configuration.
     cfg.add(subnet1);
@@ -814,9 +835,12 @@ TEST(CfgSubnets4Test, selectSharedNetworkByRelayAddressSubnetLevel) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Add them to the configuration.
     cfg.add(subnet1);
@@ -852,9 +876,12 @@ TEST(CfgSubnets4Test, selectSubnetNoCiaddr) {
     CfgSubnets4 cfg;
 
     // Create 3 subnets.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"), 26, 1, 2, 3));
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"), 26, 1, 2, 3));
-    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"), 26, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("192.0.2.0"),
+                                   26, 1, 2, 3, SubnetID(1)));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.64"),
+                                   26, 1, 2, 3, SubnetID(2)));
+    Subnet4Ptr subnet3(new Subnet4(IOAddress("192.0.2.128"),
+                                   26, 1, 2, 3, SubnetID(3)));
 
     // Make sure that initially the subnets don't exist.
     SubnetSelector selector;
@@ -906,7 +933,8 @@ TEST(CfgSubnets4Test, selectSubnetInterface) {
     EXPECT_FALSE(cfg.selectSubnet(selector));
 
     // Configure first subnet which address on eth0 corresponds to.
-    Subnet4Ptr subnet1(new Subnet4(IOAddress("10.0.0.1"), 24, 1, 2, 3));
+    Subnet4Ptr subnet1(new Subnet4(IOAddress("10.0.0.1"),
+                                   24, 1, 2, 3, SubnetID(1)));
     cfg.add(subnet1);
 
     // The address on eth0 should match the existing subnet.
@@ -919,7 +947,8 @@ TEST(CfgSubnets4Test, selectSubnetInterface) {
     EXPECT_FALSE(cfg.selectSubnet(selector));
 
     // Configure a second subnet.
-    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.1"), 24, 1, 2, 3));
+    Subnet4Ptr subnet2(new Subnet4(IOAddress("192.0.2.1"),
+                                   24, 1, 2, 3, SubnetID(2)));
     cfg.add(subnet2);
 
     // There should be match between eth0 and subnet1 and between eth1 and
index 309eb505f923384f1fa1580bccf40e15fef0c5eb..ece583fb0712f2a3fc6566654ce0f8bedb96dec2 100644 (file)
@@ -164,9 +164,12 @@ TEST(CfgSubnets6Test, deleteSubnet) {
     CfgSubnets6 cfg;
 
     // Create 3 subnets.
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
 
     ASSERT_NO_THROW(cfg.add(subnet1));
     ASSERT_NO_THROW(cfg.add(subnet2));
@@ -257,9 +260,12 @@ TEST(CfgSubnets6Test, selectSubnetByRelayAddress) {
     CfgSubnets6 cfg;
 
     // Let's configure 3 subnets
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
     cfg.add(subnet1);
     cfg.add(subnet2);
     cfg.add(subnet3);
@@ -297,9 +303,12 @@ TEST(CfgSubnets6Test, selectSubnetByNetworkRelayAddress) {
     SharedNetwork6Ptr network3(new SharedNetwork6("net3"));
 
     // Let's configure 3 subnets
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("2001:db8:3::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2001:db8:1::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("2001:db8:2::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("2001:db8:3::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
 
     // Allow subnet class of clients to use the subnets.
     subnet1->allowClientClass("subnet");
@@ -364,9 +373,12 @@ TEST(CfgSubnets6Test, selectSubnetByInterfaceName) {
     CfgSubnets6 cfg;
 
     // Let's create 3 subnets.
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
     subnet1->setIface("foo");
     subnet2->setIface("bar");
     subnet3->setIface("foobar");
@@ -411,9 +423,12 @@ TEST(CfgSubnets6Test, selectSubnetByInterfaceId) {
     CfgSubnets6 cfg;
 
     // Create 3 subnets.
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
 
     // Create Interface-id options used in subnets 1,2, and 3
     OptionPtr ifaceid1 = generateInterfaceId("relay1.eth0");
@@ -469,9 +484,12 @@ TEST(CfgSubnets6Test, selectSubnetByRelayAddressAndClassify) {
     CfgSubnets6 cfg;
 
     // Let's configure 3 subnets
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
     cfg.add(subnet1);
     cfg.add(subnet2);
     cfg.add(subnet3);
@@ -536,9 +554,12 @@ TEST(CfgSubnets6Test, selectSubnetByRelayAddressAndClassify) {
 TEST(CfgSubnets6Test, selectSubnetByInterfaceNameAndClassify) {
     CfgSubnets6 cfg;
 
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
     subnet1->setIface("foo");
     subnet2->setIface("bar");
     subnet3->setIface("foobar");
@@ -574,9 +595,12 @@ TEST(CfgSubnets6Test, selectSubnetByInterfaceNameAndClassify) {
 TEST(CfgSubnets6Test, selectSubnetByInterfaceIdAndClassify) {
     CfgSubnets6 cfg;
 
-    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"), 48, 1, 2, 3, 4));
-    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"), 48, 1, 2, 3, 4));
+    Subnet6Ptr subnet1(new Subnet6(IOAddress("2000::"),
+                                   48, 1, 2, 3, 4, SubnetID(1)));
+    Subnet6Ptr subnet2(new Subnet6(IOAddress("3000::"),
+                                   48, 1, 2, 3, 4, SubnetID(2)));
+    Subnet6Ptr subnet3(new Subnet6(IOAddress("4000::"),
+                                   48, 1, 2, 3, 4, SubnetID(3)));
 
     // interface-id options used in subnets 1,2, and 3
     OptionPtr ifaceid1 = generateInterfaceId("relay1.eth0");
index 8fdd01c262174e949a0f64c583b8947886ffde72..9c93bb94a4ed2cb6a7658ebb7565713095bbc4d9 100644 (file)
@@ -25,7 +25,8 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated4) {
 
     IOAddress last("192.0.2.255");
 
-    auto subnet(boost::make_shared<Subnet4>(IOAddress("192.0.2.0"), 24, 1, 2, 3));
+    auto subnet(boost::make_shared<Subnet4>(IOAddress("192.0.2.0"),
+                                            24, 1, 2, 3, SubnetID(1)));
     auto state = SubnetIterativeAllocationState::create(subnet);
 
     // Check initial conditions (all should be set to the last address in range)
@@ -44,7 +45,8 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated4MultiThreading) {
 
     IOAddress last("192.0.2.255");
 
-    auto subnet(boost::make_shared<Subnet4>(IOAddress("192.0.2.0"), 24, 1, 2, 3));
+    auto subnet(boost::make_shared<Subnet4>(IOAddress("192.0.2.0"),
+                                            24, 1, 2, 3, SubnetID(1)));
     auto state = SubnetIterativeAllocationState::create(subnet);
 
     // Check initial conditions (all should be set to the last address in range)
@@ -63,7 +65,8 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6) {
 
     IOAddress last("2001:db8:1::ffff:ffff:ffff:ffff");
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 64, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  64, 1, 2, 3, 4, SubnetID(1));
     auto state_na = boost::dynamic_pointer_cast<SubnetIterativeAllocationState>
         (subnet->getAllocationState(Lease::TYPE_NA));
     auto state_ta = boost::dynamic_pointer_cast<SubnetIterativeAllocationState>
@@ -103,7 +106,8 @@ TEST(IterativeAllocationStateTest, subnetLastAllocated6MultiThreading) {
 
     IOAddress last("2001:db8:1::ffff:ffff:ffff:ffff");
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 64, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  64, 1, 2, 3, 4, SubnetID(1));
     auto state_na = boost::dynamic_pointer_cast<SubnetIterativeAllocationState>
         (subnet->getAllocationState(Lease::TYPE_NA));
     auto state_ta = boost::dynamic_pointer_cast<SubnetIterativeAllocationState>
index bde1805a112eafe0a049e1f9c53869c88d4329f9..649a9994b4cfc95bcce45ca85caf3bb79864b176 100644 (file)
@@ -362,7 +362,7 @@ TEST_F(IterativeAllocatorTest6, addrStepOutClass) {
 // This test verifies that the allocator picks delegated prefixes from several
 // pools.
 TEST_F(IterativeAllocatorTest6, prefixStep) {
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+   subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
 
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"), 56, 60));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
@@ -443,7 +443,8 @@ TEST_F(IterativeAllocatorTest6, prefixStep) {
 // This test verifies that the allocator picks delegated prefixes from several
 // pools.
 TEST_F(IterativeAllocatorTest6, prefixStepPreferLower) {
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+   subnet_ = Subnet6::create(IOAddress("2001:db8::"),
+                             32, 1, 2, 3, 4, SubnetID(1));
 
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"), 56, 60));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
@@ -510,7 +511,7 @@ TEST_F(IterativeAllocatorTest6, prefixStepPreferLower) {
 // This test verifies that the allocator picks delegated prefixes from several
 // pools.
 TEST_F(IterativeAllocatorTest6, prefixStepPreferEqual) {
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
 
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"), 56, 60));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
@@ -541,7 +542,7 @@ TEST_F(IterativeAllocatorTest6, prefixStepPreferEqual) {
 // This test verifies that the allocator picks delegated prefixes from several
 // pools.
 TEST_F(IterativeAllocatorTest6, prefixStepPreferHigher) {
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
 
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"), 56, 60));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
@@ -582,7 +583,7 @@ TEST_F(IterativeAllocatorTest6, prefixStepPreferHigher) {
 // This test verifies that the allocator picks delegated prefixes from the pools
 // with class guards.
 TEST_F(IterativeAllocatorTest6, prefixStepInClass) {
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
 
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"), 56, 60));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
@@ -668,7 +669,7 @@ TEST_F(IterativeAllocatorTest6, prefixStepInClass) {
 
 // This test verifies that the allocator omits pools with non-matching client classes.
 TEST_F(IterativeAllocatorTest6, prefixStepOutClass) {
-    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    subnet_ = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
 
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"), 56, 60));
     Pool6Ptr pool2(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 48));
index 5c608aec4fc1e3d6973d49fe651ff78514eadb98..8b1d1228aa15131bc9a85b4a786e9c601a1f2b48 100644 (file)
@@ -271,7 +271,7 @@ public:
 
     /// @brief Implementation of the method creating DHCPv6 lease instance.
     virtual void initLease() {
-        Subnet6Ptr subnet(new Subnet6(IOAddress("2001:db8:1::"), 64, 100, 200, 300, 400));
+        Subnet6Ptr subnet(new Subnet6(IOAddress("2001:db8:1::"), 64, 100, 200, 300, 400, SubnetID(1)));
         // Normally, this would be set via defaults
         subnet->setDdnsUseConflictResolution(true);
 
@@ -481,7 +481,7 @@ public:
     /// @brief Implementation of the method creating DHCPv4 lease instance.
     virtual void initLease() {
 
-        Subnet4Ptr subnet(new Subnet4(IOAddress("192.0.2.0"), 24, 1, 2, 3));
+        Subnet4Ptr subnet(new Subnet4(IOAddress("192.0.2.0"), 24, 1, 2, 3, SubnetID(1)));
         // Normally, this would be set via defaults
         subnet->setDdnsUseConflictResolution(true);
 
@@ -734,5 +734,4 @@ TEST_F(NCRGenerator4Test, withTtlPercent) {
     }
 }
 
-
 } // end of anonymous namespace
index 4881e38a11ae63d81d399af06dd394491fec4511..9a54eb34cdab8524aec4dd23e34bebf7e8c81d0e 100644 (file)
@@ -61,7 +61,7 @@ public:
             // 0, 1, 2 etc.
             Subnet4Ptr subnet(new Subnet4(IOAddress(0xC0000000 | (i << 2)),
                                           24, def_triplet, def_triplet,
-                                          4000));
+                                          4000, SubnetID(100 + i)));
             test_subnets4_.insert(subnet);
         }
         // Create IPv6 subnets.
@@ -74,7 +74,8 @@ public:
             // 2001:db8:2::0 etc.
             ++prefix_bytes[5];
             prefix = IOAddress::fromBytes(prefix.getFamily(), &prefix_bytes[0]);
-            Subnet6Ptr subnet(new Subnet6(prefix, 64, 1000, 2000, 3000, 4000));
+            Subnet6Ptr subnet(new Subnet6(prefix, 64, 1000, 2000, 3000, 4000,
+                                          SubnetID(200 + i)));
             test_subnets6_.insert(subnet);
         }
 
index dfab6fceb0713a53db9512dea8924e0acfd4515f..ec8337b5d938d50d32b3f3ada385d318c2d0d826 100644 (file)
@@ -39,9 +39,11 @@ TEST(Subnet4Test, constructor) {
     EXPECT_NO_THROW(Subnet4 subnet1(IOAddress("192.0.2.2"), 16,
                                     1, 2, 3, 10));
 
-    EXPECT_THROW(Subnet4 subnet2(IOAddress("192.0.2.0"), 33, 1, 2, 3),
+    EXPECT_THROW(Subnet4 subnet2(IOAddress("192.0.2.0"),
+                                 33, 1, 2, 3, SubnetID(2)),
                 BadValue); // invalid prefix length
-    EXPECT_THROW(Subnet4 subnet3(IOAddress("2001:db8::1"), 24, 1, 2, 3),
+    EXPECT_THROW(Subnet4 subnet3(IOAddress("2001:db8::1"),
+                                 24, 1, 2, 3, SubnetID(3)),
                 BadValue); // IPv6 addresses are not allowed in Subnet4
 }
 
@@ -65,7 +67,8 @@ TEST(Subnet4Test, defaults) {
     Triplet<uint32_t> t1;
     Triplet<uint32_t> t2;
     Triplet<uint32_t> valid_lft;
-    Subnet4 subnet(IOAddress("192.0.2.0"), 24, t1, t2, valid_lft);
+    Subnet4 subnet(IOAddress("192.0.2.0"), 24,
+                   t1, t2, valid_lft, SubnetID(10));
 
     EXPECT_TRUE(subnet.getIface().unspecified());
     EXPECT_TRUE(subnet.getIface().empty());
@@ -155,33 +158,8 @@ TEST(Subnet4Test, defaults) {
     EXPECT_EQ(0, subnet.getOfferLft().get());
 }
 
-// Checks that the subnet id can be either autogenerated or set to an
-// arbitrary value through the constructor.
-TEST(Subnet4Test, subnetID) {
-    // Create subnet and don't specify id, so as it is autogenerated.
-    auto subnet = Subnet4::create(IOAddress("192.0.2.0"), 24, 1000, 2000,
-                                  3000);
-    SubnetID id0 = subnet->getID();
-
-    // Create another subnet and let id be autogenerated.
-    subnet.reset(new Subnet4(IOAddress("192.0.3.0"), 24, 1000, 2000,
-                             3000));
-    SubnetID id1 = subnet->getID();
-
-    // The autogenerated ids must not be equal.
-    EXPECT_NE(id0, id1);
-
-    // Create third subnet but this time select an arbitrary id. The id
-    // we use the one of the second subnet. That way we ensure that the
-    // subnet id we provide via constructor is used and it is not
-    // autogenerated - if it was autogenerated we would get id other
-    // than id1 because id1 has already been used.
-    subnet = Subnet4::create(IOAddress("192.0.4.0"), 24, 1000, 2000, 3000, id1);
-    EXPECT_EQ(id1, subnet->getID());
-}
-
 TEST(Subnet4Test, inRange) {
-    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+  Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000, SubnetID(1));
 
     EXPECT_EQ(1000, subnet.getT1().get());
     EXPECT_EQ(2000, subnet.getT2().get());
@@ -201,7 +179,7 @@ TEST(Subnet4Test, inRange) {
 // Checks whether the relay list is empty by default
 // and basic operations function
 TEST(Subnet4Test, relay) {
-    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000, SubnetID(1));
 
     // Should be empty.
     EXPECT_FALSE(subnet.hasRelays());
@@ -230,7 +208,7 @@ TEST(Subnet4Test, relay) {
 
 // Checks whether siaddr field can be set and retrieved correctly.
 TEST(Subnet4Test, siaddr) {
-    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000, SubnetID(1));
 
     // Check if the default is 0.0.0.0
     EXPECT_EQ("0.0.0.0", subnet.getSiaddr().get().toText());
@@ -248,7 +226,7 @@ TEST(Subnet4Test, siaddr) {
 
 // Checks whether server-hostname field can be set and retrieved correctly.
 TEST(Subnet4Test, serverHostname) {
-    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000, SubnetID(1));
 
     // Check if the default is empty
     EXPECT_TRUE(subnet.getSname().empty());
@@ -262,7 +240,7 @@ TEST(Subnet4Test, serverHostname) {
 
 // Checks whether boot-file-name field can be set and retrieved correctly.
 TEST(Subnet4Test, bootFileName) {
-    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000, SubnetID(1));
 
     // Check if the default is empty
     EXPECT_TRUE(subnet.getFilename().empty());
@@ -276,7 +254,7 @@ TEST(Subnet4Test, bootFileName) {
 
 // Checks if the match-client-id flag can be set and retrieved.
 TEST(Subnet4Test, matchClientId) {
-    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000);
+    Subnet4 subnet(IOAddress("192.0.2.1"), 24, 1000, 2000, 3000, SubnetID(1));
 
     // By default the flag should be set to true.
     EXPECT_TRUE(subnet.getMatchClientId());
@@ -293,7 +271,8 @@ TEST(Subnet4Test, matchClientId) {
 // Checks that it is possible to add and retrieve multiple pools.
 TEST(Subnet4Test, pool4InSubnet4) {
 
-    auto subnet = Subnet4::create(IOAddress("192.1.2.0"), 24, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.1.2.0"),
+                                  24, 1, 2, 3, SubnetID(1));
 
     PoolPtr pool1(new Pool4(IOAddress("192.1.2.0"), 25));
     PoolPtr pool2(new Pool4(IOAddress("192.1.2.128"), 26));
@@ -402,7 +381,8 @@ TEST(Subnet4Test, pool4InSubnet4) {
 TEST(Subnet4Test, getCapacity) {
 
     // There's one /24 pool.
-    auto subnet = Subnet4::create(IOAddress("192.1.2.0"), 24, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.1.2.0"),
+                                  24, 1, 2, 3, SubnetID(1));
 
     // There are no pools defined, so the total number of available addrs is 0.
     EXPECT_EQ(0, subnet->getPoolCapacity(Lease::TYPE_V4));
@@ -458,7 +438,8 @@ TEST(Subnet4Test, getCapacity) {
 // Checks that it is not allowed to add invalid pools.
 TEST(Subnet4Test, pool4Checks) {
 
-    auto subnet = Subnet4::create(IOAddress("192.0.2.0"), 8, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.0.2.0"),
+                                  8, 1, 2, 3, SubnetID(1));
 
     // this one is in subnet
     Pool4Ptr pool1(new Pool4(IOAddress("192.254.0.0"), 16));
@@ -524,7 +505,8 @@ TEST(Subnet4Test, pool4Checks) {
 // information about allowed client class (a single class).
 TEST(Subnet4Test, clientClass) {
     // Create the V4 subnet.
-    auto subnet = Subnet4::create(IOAddress("192.0.2.0"), 8, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.0.2.0"),
+                                  8, 1, 2, 3, SubnetID(1));
 
     // This client does not belong to any class.
     isc::dhcp::ClientClasses no_class;
@@ -583,7 +565,8 @@ TEST(Subnet4Test, clientClass) {
 
 TEST(Subnet4Test, addInvalidOption) {
     // Create the V4 subnet.
-    auto subnet = Subnet4::create(IOAddress("192.0.2.0"), 8, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.0.2.0"),
+                                  8, 1, 2, 3, SubnetID(1));
 
     // Create NULL pointer option. Attempt to add NULL option
     // should result in exception.
@@ -596,7 +579,8 @@ TEST(Subnet4Test, addInvalidOption) {
 
 // This test verifies that inRange() and inPool() methods work properly.
 TEST(Subnet4Test, inRangeinPool) {
-    auto subnet = Subnet4::create(IOAddress("192.0.0.0"), 8, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.0.0.0"),
+                                  8, 1, 2, 3, SubnetID(1));
 
     // this one is in subnet
     Pool4Ptr pool1(new Pool4(IOAddress("192.2.0.0"), 16));
@@ -656,7 +640,8 @@ TEST(Subnet4Test, inRangeinPool) {
 
 // This test checks if the toText() method returns text representation
 TEST(Subnet4Test, toText) {
-    auto subnet = Subnet4::create(IOAddress("192.0.2.0"), 24, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.0.2.0"),
+                                  24, 1, 2, 3, SubnetID(1));
     EXPECT_EQ("192.0.2.0/24", subnet->toText());
 }
 
@@ -691,7 +676,8 @@ TEST(Subnet4Test, parsePrefix) {
 
 // This test checks if the get() method returns proper parameters
 TEST(Subnet4Test, get) {
-    auto subnet = Subnet4::create(IOAddress("192.0.2.0"), 28, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.0.2.0"),
+                                  28, 1, 2, 3, SubnetID(1));
     EXPECT_EQ("192.0.2.0", subnet->get().first.toText());
     EXPECT_EQ(28, subnet->get().second);
 }
@@ -700,7 +686,8 @@ TEST(Subnet4Test, get) {
 // is working properly.
 TEST(Subnet4Test, PoolType) {
 
-    auto subnet = Subnet4::create(IOAddress("192.2.0.0"), 16, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.2.0.0"),
+                                  16, 1, 2, 3, SubnetID(1));
 
     PoolPtr pool1(new Pool4(IOAddress("192.2.1.0"), 24));
     PoolPtr pool2(new Pool4(IOAddress("192.2.2.0"), 24));
@@ -746,7 +733,7 @@ TEST(Subnet4Test, PoolType) {
 // called.
 TEST(Subnet4Test, getServerId) {
     // Initially, the subnet has no server identifier.
-    Subnet4 subnet(IOAddress("192.2.0.0"), 16, 1, 2, 3);
+    Subnet4 subnet(IOAddress("192.2.0.0"), 16, 1, 2, 3, SubnetID(1));
     EXPECT_TRUE(subnet.getServerId().isV4Zero());
 
     // Add server identifier.
@@ -768,7 +755,8 @@ TEST(Subnet4Test, getServerId) {
 // states are instantiated for a subnet.
 TEST(Subnet4Test, createAllocatorsIterative) {
     // Create a subnet.
-    auto subnet = Subnet4::create(IOAddress("192.2.0.0"), 16, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.2.0.0"),
+                                  16, 1, 2, 3, SubnetID(1));
     ASSERT_TRUE(subnet);
     // Create a pool.
     auto pool = boost::make_shared<Pool4>(IOAddress("192.2.0.0"), 16);
@@ -790,7 +778,8 @@ TEST(Subnet4Test, createAllocatorsIterative) {
 // states are instantiated for a subnet.
 TEST(Subnet4Test, createAllocatorsRandom) {
     // Create a subnet.
-    auto subnet = Subnet4::create(IOAddress("192.2.0.0"), 16, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.2.0.0"),
+                                  16, 1, 2, 3, SubnetID(1));
     ASSERT_TRUE(subnet);
     // Create a pool.
     auto pool = boost::make_shared<Pool4>(IOAddress("192.2.0.0"), 16);
@@ -813,7 +802,8 @@ TEST(Subnet4Test, createAllocatorsRandom) {
 // states are instantiated for a subnet.
 TEST(Subnet4Test, createAllocatorsFreeLeaseQueue) {
     // Create a subnet.
-    auto subnet = Subnet4::create(IOAddress("192.2.0.0"), 16, 1, 2, 3);
+    auto subnet = Subnet4::create(IOAddress("192.2.0.0"),
+                                  16, 1, 2, 3, SubnetID(1));
     ASSERT_TRUE(subnet);
     // Create a pool.
     auto pool = boost::make_shared<Pool4>(IOAddress("192.2.0.0"), 16);
@@ -837,11 +827,13 @@ TEST(Subnet4Test, createAllocatorsFreeLeaseQueue) {
 TEST(Subnet6Test, constructor) {
 
     EXPECT_NO_THROW(Subnet6 subnet1(IOAddress("2001:db8:1::"), 64,
-                                    1, 2, 3, 4));
+                                    1, 2, 3, 4, SubnetID(1)));
 
-    EXPECT_THROW(Subnet6 subnet2(IOAddress("2001:db8:1::"), 129, 1, 2, 3, 4),
+    EXPECT_THROW(Subnet6 subnet2(IOAddress("2001:db8:1::"),
+                                 129, 1, 2, 3, 4, SubnetID(2)),
                 BadValue); // invalid prefix length
-    EXPECT_THROW(Subnet6 subnet3(IOAddress("192.168.0.0"), 32, 1, 2, 3, 4),
+    EXPECT_THROW(Subnet6 subnet3(IOAddress("192.168.0.0"),
+                                 32, 1, 2, 3, 4, SubnetID(3)),
                 BadValue); // IPv4 addresses are not allowed in Subnet6
 }
 
@@ -868,7 +860,7 @@ TEST(SharedNetwork6Test, defaults) {
     Triplet<uint32_t> preferred_lft;
     Triplet<uint32_t> valid_lft;
     Subnet6 subnet(IOAddress("2001:db8:1::"), 64, t1, t2, preferred_lft,
-                   valid_lft);
+                   valid_lft, SubnetID(1));
 
     EXPECT_TRUE(subnet.getIface().unspecified());
     EXPECT_TRUE(subnet.getIface().empty());
@@ -937,34 +929,9 @@ TEST(SharedNetwork6Test, defaults) {
     EXPECT_FALSE(subnet.getDdnsUpdateOnRenew().get());
 }
 
-// Checks that the subnet id can be either autogenerated or set to an
-// arbitrary value through the constructor.
-TEST(Subnet6Test, subnetID) {
-    // Create subnet and don't specify id, so as it is autogenerated.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 64, 1000, 2000,
-                                  3000, 4000);
-    SubnetID id0 = subnet->getID();
-
-    // Create another subnet and let id be autogenerated.
-    subnet.reset(new Subnet6(IOAddress("2001:db8:2::"), 64, 1000, 2000,
-                             3000, 4000));
-    SubnetID id1 = subnet->getID();
-
-    // The autogenerated ids must not be equal.
-    EXPECT_NE(id0, id1);
-
-    // Create third subnet but this time select an arbitrary id. The id
-    // we use us the one of second subnet. That way we ensure that the
-    // subnet id we provide via constructor is used and it is not
-    // autogenerated - if it was autogenerated we would get id other
-    // than id1 because id1 has already been used.
-    subnet.reset(new Subnet6(IOAddress("2001:db8:3::"), 64, 1000, 2000,
-                             3000, 4000, id1));
-    EXPECT_EQ(id1, subnet->getID());
-}
-
 TEST(Subnet6Test, inRange) {
-    Subnet6 subnet(IOAddress("2001:db8:1::"), 64, 1000, 2000, 3000, 4000);
+    Subnet6 subnet(IOAddress("2001:db8:1::"),
+                   64, 1000, 2000, 3000, 4000, SubnetID(1));
 
     EXPECT_EQ(1000, subnet.getT1().get());
     EXPECT_EQ(2000, subnet.getT2().get());
@@ -982,7 +949,8 @@ TEST(Subnet6Test, inRange) {
 // Checks whether the relay list is empty by default
 // and basic operations function
 TEST(Subnet6Test, relay) {
-    Subnet6 subnet(IOAddress("2001:db8:1::"), 64, 1000, 2000, 3000, 4000);
+    Subnet6 subnet(IOAddress("2001:db8:1::"),
+                   64, 1000, 2000, 3000, 4000, SubnetID(1));
 
     // Should be empty.
     EXPECT_FALSE(subnet.hasRelays());
@@ -1013,7 +981,8 @@ TEST(Subnet6Test, relay) {
 // calculated properly.
 TEST(Subnet6Test, Pool6getCapacity) {
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // There's 2^16 = 65536 addresses in this one.
     PoolPtr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 112));
@@ -1072,7 +1041,8 @@ TEST(Subnet6Test, Pool6getCapacity) {
 // calculated properly.
 TEST(Subnet6Test, Pool6PdgetPoolCapacity) {
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8::"),
+                                  32, 1, 2, 3, 4, SubnetID(1));
 
     // There's 2^16 = 65536 addresses in this one.
     PoolPtr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 48, 64));
@@ -1109,7 +1079,8 @@ TEST(Subnet6Test, Pool6PdgetPoolCapacity) {
 
 TEST(Subnet6Test, Pool6InSubnet6) {
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     PoolPtr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 64));
     PoolPtr pool2(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:2::"), 64));
@@ -1174,7 +1145,8 @@ TEST(Subnet6Test, Pool6InSubnet6) {
 // Check if Subnet6 supports different types of pools properly.
 TEST(Subnet6Test, poolTypes) {
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     PoolPtr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 64));
     PoolPtr pool2(new Pool6(Lease::TYPE_TA, IOAddress("2001:db8:1:2::"), 64));
@@ -1246,7 +1218,8 @@ TEST(Subnet6Test, poolTypes) {
 // information about allowed client class (a single class).
 TEST(Subnet6Test, clientClass) {
     // Create the V6 subnet.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // This client does not belong to any class.
     isc::dhcp::ClientClasses no_class;
@@ -1306,7 +1279,8 @@ TEST(Subnet6Test, clientClass) {
 // Checks that it is not allowed to add invalid pools.
 TEST(Subnet6Test, pool6Checks) {
 
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // this one is in subnet
     Pool6Ptr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 64));
@@ -1379,7 +1353,8 @@ TEST(Subnet6Test, pool6Checks) {
 
 TEST(Subnet6Test, addOptions) {
     // Create as subnet to add options to it.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // Differentiate options by their codes (100-109)
     for (uint16_t code = 100; code < 110; ++code) {
@@ -1431,7 +1406,8 @@ TEST(Subnet6Test, addOptions) {
 
 TEST(Subnet6Test, addNonUniqueOptions) {
     // Create as subnet to add options to it.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // Create a set of options with non-unique codes.
     for (int i = 0;  i < 2; ++i) {
@@ -1473,7 +1449,8 @@ TEST(Subnet6Test, addNonUniqueOptions) {
 
 TEST(Subnet6Test, addPersistentOption) {
     // Create as subnet to add options to it.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // Add 10 options to the subnet with option codes 100 - 109.
     for (uint16_t code = 100; code < 110; ++code) {
@@ -1511,7 +1488,8 @@ TEST(Subnet6Test, addPersistentOption) {
 }
 
 TEST(Subnet6Test, getOptions) {
-    auto subnet = Subnet6::create(IOAddress("2001:db8::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // Add 10 options to a "dhcp6" option space in the subnet.
     for (uint16_t code = 100; code < 110; ++code) {
@@ -1539,7 +1517,8 @@ TEST(Subnet6Test, getOptions) {
 TEST(Subnet6Test, addVendorOption) {
 
     // Create as subnet to add options to it.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     // Differentiate options by their codes (100-109)
     for (uint16_t code = 100; code < 110; ++code) {
@@ -1591,7 +1570,8 @@ TEST(Subnet6Test, addVendorOption) {
 
 // This test verifies that inRange() and inPool() methods work properly.
 TEST(Subnet6Test, inRangeinPool) {
-    auto subnet = Subnet6::create(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8::"),
+                                  32, 1, 2, 3, 4, SubnetID(1));
 
     // this one is in subnet
     Pool6Ptr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8::10"),
@@ -1652,7 +1632,8 @@ TEST(Subnet6Test, inRangeinPool) {
 // This test verifies that inRange() and inPool() methods work properly
 // for prefixes too.
 TEST(Subnet6Test, PdinRangeinPool) {
-    auto subnet = Subnet6::create(IOAddress("2001:db8::"), 64, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8::"),
+                                  64, 1, 2, 3, 4, SubnetID(1));
 
     // this one is in subnet
     Pool6Ptr pool1(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8::"),
@@ -1685,7 +1666,7 @@ TEST(Subnet6Test, PdinRangeinPool) {
 
 // This test checks if the toText() method returns text representation
 TEST(Subnet6Test, toText) {
-    Subnet6 subnet(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    Subnet6 subnet(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
     EXPECT_EQ("2001:db8::/32", subnet.toText());
 }
 
@@ -1721,7 +1702,7 @@ TEST(Subnet6Test, parsePrefix) {
 
 // This test checks if the get() method returns proper parameters
 TEST(Subnet6Test, get) {
-    Subnet6 subnet(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    Subnet6 subnet(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
     EXPECT_EQ("2001:db8::", subnet.get().first.toText());
     EXPECT_EQ(32, subnet.get().second);
 }
@@ -1729,7 +1710,7 @@ TEST(Subnet6Test, get) {
 // This trivial test checks if interface name is stored properly
 // in Subnet6 objects.
 TEST(Subnet6Test, iface) {
-    Subnet6 subnet(IOAddress("2001:db8::"), 32, 1, 2, 3, 4);
+    Subnet6 subnet(IOAddress("2001:db8::"), 32, 1, 2, 3, 4, SubnetID(1));
 
     EXPECT_TRUE(subnet.getIface().empty());
 
@@ -1741,7 +1722,8 @@ TEST(Subnet6Test, iface) {
 // later retrieved for a subnet6 object.
 TEST(Subnet6Test, interfaceId) {
     // Create as subnet to add options to it.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
 
     EXPECT_FALSE(subnet->getInterfaceId());
 
@@ -1756,7 +1738,8 @@ TEST(Subnet6Test, interfaceId) {
 // disabled for a subnet. It also checks that the Rapid Commit
 // support is disabled by default.
 TEST(Subnet6Test, rapidCommit) {
-    Subnet6 subnet(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    Subnet6 subnet(IOAddress("2001:db8:1::"),
+                   56, 1, 2, 3, 4, SubnetID(1));
 
     // By default, the RC should be disabled.
     EXPECT_FALSE(subnet.getRapidCommit());
@@ -1774,7 +1757,8 @@ TEST(Subnet6Test, rapidCommit) {
 // states are instantiated for a subnet.
 TEST(Subnet6Test, createAllocatorsIterative) {
     // Create a subnet.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
     ASSERT_TRUE(subnet);
     // NA pool.
     auto pool = boost::make_shared<Pool6>(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 112);
@@ -1820,7 +1804,8 @@ TEST(Subnet6Test, createAllocatorsIterative) {
 // states are instantiated for a subnet.
 TEST(Subnet6Test, createAllocatorsRandom) {
     // Create a subnet.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
     ASSERT_TRUE(subnet);
     // NA pool.
     auto pool = boost::make_shared<Pool6>(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 112);
@@ -1866,7 +1851,8 @@ TEST(Subnet6Test, createAllocatorsRandom) {
 // states are instantiated for a subnet.
 TEST(Subnet6Test, createAllocatorsFreeLeaseQueue) {
     // Create a subnet.
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
     ASSERT_TRUE(subnet);
     // NA pool.
     auto pool = boost::make_shared<Pool6>(Lease::TYPE_NA, IOAddress("2001:db8:1:1::"), 112);
@@ -1911,7 +1897,8 @@ TEST(Subnet6Test, createAllocatorsFreeLeaseQueue) {
 
 // Test that it is not allowed to use the FLQ allocator for the address pools.
 TEST(Subnet6Test, createAllocatorsFreeLeaseQueueNotAllowed) {
-    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"), 56, 1, 2, 3, 4);
+    auto subnet = Subnet6::create(IOAddress("2001:db8:1::"),
+                                  56, 1, 2, 3, 4, SubnetID(1));
     ASSERT_TRUE(subnet);
 
     subnet->setAllocatorType("flq");
@@ -1970,4 +1957,4 @@ TEST(SubnetFetcherTest, getSubnet6ById) {
     EXPECT_EQ("2001:db8:2::/64", subnet->toText());
 }
 
-};
+}