of free address leases for the given subnet. It can take a considerable amount
of time, depending on the size of the address pools.
-% DHCPSRV_CFGMGR_FLQ_POPULATE_FREE_ADDRESS_LEASES_DONE populating free address leases for the FLQ allocator in subnet %1 completed in %2
+% DHCPSRV_CFGMGR_FLQ_POPULATE_FREE_ADDRESS_LEASES_DONE populated %1 free address leases for the FLQ allocator in subnet %2 in %3
This informational message is issued when the server ends building a queue
-of free address leases for a given subnet. The second argument logs the
-duration.
+of free address leases for a given subnet. The first argument logs the
+number of free leases, the second argument logs the subnet, and the third
+argument logs a duration.
% DHCPSRV_CFGMGR_FLQ_POPULATE_FREE_PREFIX_LEASES populating free prefix leases for the FLQ allocator in subnet %1; it can take a while!
This informational message is issued when the server begins building a queue
of free leases for the given subnet. It can take a considerable amount of
time, depending on the size of the delegated prefix pools.
-% DHCPSRV_CFGMGR_FLQ_POPULATE_FREE_PREFIX_LEASES_DONE populating free prefix leases for the FLQ allocator in subnet %1 completed in %2
+% DHCPSRV_CFGMGR_FLQ_POPULATE_FREE_PREFIX_LEASES_DONE populated %1 free prefix leases for the FLQ allocator in subnet %2 completed in %3
This informational message is issued when the server ends building a queue
-of free prefix leases for a given subnet. The second argument logs the
-duration.
+of free prefix leases for a given subnet. The first argument logs the
+number of free leases, the second argument logs the subnet, and the third
+argument logs a duration.
% DHCPSRV_CFGMGR_IPV4_RESERVATIONS_NON_UNIQUE_IGNORED ignoring "ip-reservations-unique" setting because at least one of the host database backends does not support non-unique IP reservations in a subnet
This warning message is issued when the server failed to use the new setting
auto pool = boost::make_shared<Pool4>(IOAddress("192.0.2.1"), IOAddress("192.0.2.10"));
auto state = PoolFreeLeaseQueueAllocationState::create(pool);
ASSERT_TRUE(state);
+ EXPECT_EQ(0, state->getFreeLeaseCount());
state->addFreeLease(IOAddress("192.0.2.1"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("192.0.2.1", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
- state->deleteFreeLease(IOAddress("192.0.2.2"));
+ state->addFreeLease(IOAddress("192.0.2.3"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("192.0.2.1", state->offerFreeLease().toText());
+ EXPECT_EQ(2, state->getFreeLeaseCount());
+
+ state->deleteFreeLease(IOAddress("192.0.2.2"));
+ EXPECT_FALSE(state->exhausted());
+ EXPECT_EQ("192.0.2.3", state->offerFreeLease().toText());
+ EXPECT_EQ(2, state->getFreeLeaseCount());
state->deleteFreeLease(IOAddress("192.0.2.1"));
+ state->deleteFreeLease(IOAddress("192.0.2.3"));
EXPECT_TRUE(state->exhausted());
EXPECT_TRUE(state->offerFreeLease().isV4Zero());
}
auto pool = boost::make_shared<Pool4>(IOAddress("192.0.2.1"), IOAddress("192.0.2.10"));
auto state = PoolFreeLeaseQueueAllocationState::create(pool);
ASSERT_TRUE(state);
+ EXPECT_EQ(0, state->getFreeLeaseCount());
// Add the free lease for the first time.
state->addFreeLease(IOAddress("192.0.2.1"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("192.0.2.1", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
// Add the same lease the second time. The second lease instance should
// not be inserted.
state->addFreeLease(IOAddress("192.0.2.1"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("192.0.2.1", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
// Delete the sole lease and ensure there are no more leases.
state->deleteFreeLease(IOAddress("192.0.2.1"));
EXPECT_TRUE(state->exhausted());
+ EXPECT_EQ(0, state->getFreeLeaseCount());
}
IOAddress("2001:db8:1::10"));
auto state = PoolFreeLeaseQueueAllocationState::create(pool);
ASSERT_TRUE(state);
+ EXPECT_EQ(0, state->getFreeLeaseCount());
state->addFreeLease(IOAddress("2001:db8:1::1"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("2001:db8:1::1", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
- state->deleteFreeLease(IOAddress("2001:db8:1::2"));
+ state->addFreeLease(IOAddress("2001:db8:1::3"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("2001:db8:1::1", state->offerFreeLease().toText());
+ EXPECT_EQ(2, state->getFreeLeaseCount());
+
+ state->deleteFreeLease(IOAddress("2001:db8:1::2"));
+ EXPECT_FALSE(state->exhausted());
+ EXPECT_EQ("2001:db8:1::3", state->offerFreeLease().toText());
+ EXPECT_EQ(2, state->getFreeLeaseCount());
state->deleteFreeLease(IOAddress("2001:db8:1::1"));
+ state->deleteFreeLease(IOAddress("2001:db8:1::3"));
EXPECT_TRUE(state->exhausted());
EXPECT_TRUE(state->offerFreeLease().isV6Zero());
}
IOAddress("2001:db8:1::10"));
auto state = PoolFreeLeaseQueueAllocationState::create(pool);
ASSERT_TRUE(state);
+ EXPECT_EQ(0, state->getFreeLeaseCount());
// Add the free lease for the first time.
state->addFreeLease(IOAddress("2001:db8:1::5"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("2001:db8:1::5", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
// Add the same lease the second time. The second lease instance should
// not be inserted.
state->addFreeLease(IOAddress("2001:db8:1::5"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("2001:db8:1::5", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
// Delete the sole lease and ensure there are no more leases.
state->deleteFreeLease(IOAddress("2001:db8:1::5"));
// Test creating a new free lease queue allocation state for a
// delegated prefix pool.
-TEST(PoolFreeLeaseAllocationState, createPD) {
+TEST(PoolFreeLeaseAllocationState, addDeleteFreeLeasePD) {
auto pool = boost::make_shared<Pool6>(Lease::TYPE_PD, IOAddress("3000::"), 112, 120);
auto state = PoolFreeLeaseQueueAllocationState::create(pool);
ASSERT_TRUE(state);
EXPECT_TRUE(state->exhausted());
+ EXPECT_EQ(0, state->getFreeLeaseCount());
state->addFreeLease(IOAddress("3000::5600"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("3000::5600", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
- state->deleteFreeLease(IOAddress("3000::6400"));
+ state->addFreeLease(IOAddress("3000::7800"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("3000::5600", state->offerFreeLease().toText());
+ EXPECT_EQ(2, state->getFreeLeaseCount());
+
+ state->deleteFreeLease(IOAddress("3000::6400"));
+ EXPECT_FALSE(state->exhausted());
+ EXPECT_EQ("3000::7800", state->offerFreeLease().toText());
+ EXPECT_EQ(2, state->getFreeLeaseCount());
state->deleteFreeLease(IOAddress("3000::5600"));
+ state->deleteFreeLease(IOAddress("3000::7800"));
EXPECT_TRUE(state->exhausted());
EXPECT_TRUE(state->offerFreeLease().isV6Zero());
}
auto pool = boost::make_shared<Pool6>(Lease::TYPE_PD, IOAddress("3000::"), 112, 120);
auto state = PoolFreeLeaseQueueAllocationState::create(pool);
ASSERT_TRUE(state);
+ EXPECT_EQ(0, state->getFreeLeaseCount());
// Add the free lease for the first time.
state->addFreeLease(IOAddress("3000::5600"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("3000::5600", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
// Add the same lease the second time. The second lease instance should
// not be inserted.
state->addFreeLease(IOAddress("3000::5600"));
EXPECT_FALSE(state->exhausted());
EXPECT_EQ("3000::5600", state->offerFreeLease().toText());
+ EXPECT_EQ(1, state->getFreeLeaseCount());
// Delete the sole lease and ensure there are no more leases.
state->deleteFreeLease(IOAddress("3000::5600"));