mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 13:07:50 +00:00
[2280] Avoid overlapping pools in the alloc engine unit tests.
This commit is contained in:
parent
44d863b33a
commit
466d355fe3
@ -143,9 +143,9 @@ TEST_F(AllocEngine6Test, allocWithUsedHint6) {
|
|||||||
// in pool, but is currently used, can succeed
|
// in pool, but is currently used, can succeed
|
||||||
TEST_F(AllocEngine6Test, pdAllocWithUsedHint6) {
|
TEST_F(AllocEngine6Test, pdAllocWithUsedHint6) {
|
||||||
allocWithUsedHintTest(Lease::TYPE_PD,
|
allocWithUsedHintTest(Lease::TYPE_PD,
|
||||||
IOAddress("2001:db8:1::"), // allocate this prefix as used
|
IOAddress("2001:db8:1:2::"), // allocate this prefix as used
|
||||||
IOAddress("2001:db8:1::"), // request this prefix
|
IOAddress("2001:db8:1:2::"), // request this prefix
|
||||||
64);
|
80);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test checks if the allocation with a hint that is out the blue
|
// This test checks if the allocation with a hint that is out the blue
|
||||||
@ -159,7 +159,7 @@ TEST_F(AllocEngine6Test, allocBogusHint6) {
|
|||||||
// can succeed. The invalid hint should be ignored completely.
|
// can succeed. The invalid hint should be ignored completely.
|
||||||
TEST_F(AllocEngine6Test, pdAllocBogusHint6) {
|
TEST_F(AllocEngine6Test, pdAllocBogusHint6) {
|
||||||
|
|
||||||
allocBogusHint6(Lease::TYPE_PD, IOAddress("3000::abc"), 64);
|
allocBogusHint6(Lease::TYPE_PD, IOAddress("3000::abc"), 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test checks that NULL values are handled properly
|
// This test checks that NULL values are handled properly
|
||||||
@ -1612,7 +1612,7 @@ TEST_F(AllocEngine6Test, largePDPool) {
|
|||||||
|
|
||||||
// Configure the PD pool with the prefix length of /64 and the delegated
|
// Configure the PD pool with the prefix length of /64 and the delegated
|
||||||
// length /96.
|
// length /96.
|
||||||
Pool6Ptr pool(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 64, 96));
|
Pool6Ptr pool(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1:2::"), 80, 96));
|
||||||
subnet_->addPool(pool);
|
subnet_->addPool(pool);
|
||||||
|
|
||||||
// We should have got exactly one lease.
|
// We should have got exactly one lease.
|
||||||
@ -1649,6 +1649,7 @@ TEST_F(AllocEngine6Test, largePoolOver32bits) {
|
|||||||
TEST_F(AllocEngine6Test, largeAllocationAttemptsOverride) {
|
TEST_F(AllocEngine6Test, largeAllocationAttemptsOverride) {
|
||||||
// Remove the default NA pools.
|
// Remove the default NA pools.
|
||||||
subnet_->delPools(Lease::TYPE_NA);
|
subnet_->delPools(Lease::TYPE_NA);
|
||||||
|
subnet_->delPools(Lease::TYPE_PD);
|
||||||
|
|
||||||
// Add exactly one pool with many addresses.
|
// Add exactly one pool with many addresses.
|
||||||
Pool6Ptr pool(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::"), 56));
|
Pool6Ptr pool(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::"), 56));
|
||||||
|
@ -140,7 +140,9 @@ AllocEngine6Test::AllocEngine6Test() {
|
|||||||
// Initialize a subnet and short address pool.
|
// Initialize a subnet and short address pool.
|
||||||
initSubnet(IOAddress("2001:db8:1::"),
|
initSubnet(IOAddress("2001:db8:1::"),
|
||||||
IOAddress("2001:db8:1::10"),
|
IOAddress("2001:db8:1::10"),
|
||||||
IOAddress("2001:db8:1::20"));
|
IOAddress("2001:db8:1::20"),
|
||||||
|
IOAddress("2001:db8:1:2::"),
|
||||||
|
64, 80);
|
||||||
|
|
||||||
initFqdn("", false, false);
|
initFqdn("", false, false);
|
||||||
|
|
||||||
@ -149,7 +151,10 @@ AllocEngine6Test::AllocEngine6Test() {
|
|||||||
void
|
void
|
||||||
AllocEngine6Test::initSubnet(const asiolink::IOAddress& subnet,
|
AllocEngine6Test::initSubnet(const asiolink::IOAddress& subnet,
|
||||||
const asiolink::IOAddress& pool_start,
|
const asiolink::IOAddress& pool_start,
|
||||||
const asiolink::IOAddress& pool_end) {
|
const asiolink::IOAddress& pool_end,
|
||||||
|
const asiolink::IOAddress& pd_pool_prefix,
|
||||||
|
const uint8_t pd_pool_length,
|
||||||
|
const uint8_t pd_delegated_length) {
|
||||||
CfgMgr& cfg_mgr = CfgMgr::instance();
|
CfgMgr& cfg_mgr = CfgMgr::instance();
|
||||||
|
|
||||||
subnet_ = Subnet6Ptr(new Subnet6(subnet, 56, 100, 200, 300, 400));
|
subnet_ = Subnet6Ptr(new Subnet6(subnet, 56, 100, 200, 300, 400));
|
||||||
@ -157,7 +162,10 @@ AllocEngine6Test::initSubnet(const asiolink::IOAddress& subnet,
|
|||||||
|
|
||||||
subnet_->addPool(pool_);
|
subnet_->addPool(pool_);
|
||||||
|
|
||||||
pd_pool_ = Pool6Ptr(new Pool6(Lease::TYPE_PD, subnet, 56, 64));
|
if (!pd_pool_prefix.isV6Zero()) {
|
||||||
|
pd_pool_ = Pool6Ptr(new Pool6(Lease::TYPE_PD, pd_pool_prefix,
|
||||||
|
pd_pool_length, pd_delegated_length));
|
||||||
|
}
|
||||||
subnet_->addPool(pd_pool_);
|
subnet_->addPool(pd_pool_);
|
||||||
|
|
||||||
cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
|
cfg_mgr.getStagingCfg()->getCfgSubnets6()->add(subnet_);
|
||||||
|
@ -101,9 +101,18 @@ public:
|
|||||||
/// @param subnet Address of a subnet to be configured.
|
/// @param subnet Address of a subnet to be configured.
|
||||||
/// @param pool_start First address in the address pool.
|
/// @param pool_start First address in the address pool.
|
||||||
/// @param pool_end Last address in the address pool.
|
/// @param pool_end Last address in the address pool.
|
||||||
|
/// @param pd_pool_prefix Prefix for the prefix delegation pool. It
|
||||||
|
/// defaults to 0 which means that PD pool is not specified.
|
||||||
|
/// @param pd_pool_length Length of the PD pool prefix.
|
||||||
|
/// @param pd_delegated_length Delegated prefix length.
|
||||||
void initSubnet(const asiolink::IOAddress& subnet,
|
void initSubnet(const asiolink::IOAddress& subnet,
|
||||||
const asiolink::IOAddress& pool_start,
|
const asiolink::IOAddress& pool_start,
|
||||||
const asiolink::IOAddress& pool_end);
|
const asiolink::IOAddress& pool_end,
|
||||||
|
const asiolink::IOAddress& pd_pool_prefix =
|
||||||
|
asiolink::IOAddress::IPV6_ZERO_ADDRESS(),
|
||||||
|
const uint8_t pd_pool_length = 0,
|
||||||
|
const uint8_t pd_delegated_length = 0);
|
||||||
|
|
||||||
|
|
||||||
/// @brief Initializes FQDN data for a test.
|
/// @brief Initializes FQDN data for a test.
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user