summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2015-07-19 10:06:07 +0200
committerMarcin Siodelski <marcin@isc.org>2015-07-19 10:06:07 +0200
commit22071c71555959f58dee3ddca099cebb313e9d92 (patch)
tree7b795b4014165c0028533da04c3ee8552c920d56 /src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
parent[master] Added ChangeLog entry 984 for #3954 (diff)
downloadkea-22071c71555959f58dee3ddca099cebb313e9d92.tar.xz
kea-22071c71555959f58dee3ddca099cebb313e9d92.zip
[3958] Fixed the allocation from the large PD pool.
Diffstat (limited to 'src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc')
-rw-r--r--src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
index b4251a8deb..cf10138f4e 100644
--- a/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
+++ b/src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
@@ -476,6 +476,7 @@ TEST_F(AllocEngine6Test, outOfAddresses6) {
}
+
// This test checks if an expired lease can be reused in SOLICIT (fake allocation)
TEST_F(AllocEngine6Test, solicitReuseExpiredLease6) {
boost::scoped_ptr<AllocEngine> engine;
@@ -1563,6 +1564,28 @@ TEST_F(AllocEngine6Test, reservedAddressByMacInPoolRequestValidHint) {
EXPECT_EQ("2001:db8:1::1c", lease->addr_.toText());
}
+// This test checks that the allocation engine can delegate the long prefix.
+// The pool with prefix of 64 and with long delegated prefix has a very
+// high capacity. The number of attempts that the allocation engine makes
+// to allocate the prefix for high capacity pools is equal to the capacity
+// value. This test verifies that the prefix can be allocated in that
+// case.
+TEST_F(AllocEngine6Test, largePDPool) {
+ AllocEngine engine(AllocEngine::ALLOC_ITERATIVE, 100);
+
+ // Remove the default PD pool.
+ subnet_->delPools(Lease::TYPE_PD);
+
+ // Configure the PD pool with the prefix length of /64 and the delegated
+ // length /96.
+ Pool6Ptr pool(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 64, 96));
+ subnet_->addPool(pool);
+
+ // We should have got exactly one lease.
+ Lease6Collection leases = allocateTest(engine, pool, IOAddress("::"),
+ false, true);
+ ASSERT_EQ(1, leases.size());
+}
}; // namespace test
}; // namespace dhcp