BIND 10 trac3171, updated. 3e08c03f168623554f4dac564cbfd4bc5160bf76 [3171] First test implementing PD lease allocation passed!
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Sep 19 17:42:00 UTC 2013
The branch, trac3171 has been updated
via 3e08c03f168623554f4dac564cbfd4bc5160bf76 (commit)
via 4b7664ccfdf1640cbdd914ddd032989149a3f0ef (commit)
from e295438305b351d4959001113670c6455f4a0abb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3e08c03f168623554f4dac564cbfd4bc5160bf76
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Thu Sep 19 19:38:05 2013 +0200
[3171] First test implementing PD lease allocation passed!
commit 4b7664ccfdf1640cbdd914ddd032989149a3f0ef
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Thu Sep 19 18:35:32 2013 +0200
[3171] IterativeAllocator::pickAddress() now handles prefixes as well
- pickAddress() handles prefixes as well
- Subnet::delPools() implemented
- tests for iterating over address and prefix pools implemented.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcpsrv/alloc_engine.cc | 18 ++-
src/lib/dhcpsrv/subnet.cc | 78 ++++++-----
src/lib/dhcpsrv/subnet.h | 20 ++-
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc | 166 ++++++++++++++++++++++--
src/lib/dhcpsrv/tests/subnet_unittest.cc | 24 ++--
5 files changed, 248 insertions(+), 58 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc
index 5ad754f..1a1f7aa 100644
--- a/src/lib/dhcpsrv/alloc_engine.cc
+++ b/src/lib/dhcpsrv/alloc_engine.cc
@@ -137,6 +137,9 @@ AllocEngine::IterativeAllocator::pickAddress(const SubnetPtr& subnet,
const DuidPtr&,
const IOAddress&) {
+ // Is this prefix allocation?
+ bool prefix = pool_type_ == Lease::TYPE_PD;
+
// Let's get the last allocated address. It is usually set correctly,
// but there are times when it won't be (like after removing a pool or
// perhaps restarting the server).
@@ -169,7 +172,18 @@ AllocEngine::IterativeAllocator::pickAddress(const SubnetPtr& subnet,
// Ok, we have a pool that the last address belonged to, let's use it.
- IOAddress next = increaseAddress(last); // basically addr++
+ IOAddress next("::");
+ if (!prefix) {
+ next = increaseAddress(last); // basically addr++
+ } else {
+ Pool6Ptr pool6 = boost::dynamic_pointer_cast<Pool6>(*it);
+ if (!pool6) {
+ // Something is gravely wrong here
+ isc_throw(InvalidParameter, "Wrong type of pool");
+ }
+ // Get the next prefix
+ next = increasePrefix(last, (pool6)->getLength());
+ }
if ((*it)->inRange(next)) {
// the next one is in the pool as well, so we haven't hit pool boundary yet
subnet->setLastAllocated(pool_type_, next);
@@ -503,7 +517,7 @@ AllocEngine::allocateAddress4(const SubnetPtr& subnet,
}
// check if the hint is in pool and is available
- if (subnet->inPool(hint)) {
+ if (subnet->inPool(Lease::TYPE_V4, hint)) {
existing = LeaseMgrFactory::instance().getLease4(hint);
if (!existing) {
/// @todo: Check if the hint is reserved once we have host support
diff --git a/src/lib/dhcpsrv/subnet.cc b/src/lib/dhcpsrv/subnet.cc
index 442f418..44aafe7 100644
--- a/src/lib/dhcpsrv/subnet.cc
+++ b/src/lib/dhcpsrv/subnet.cc
@@ -168,32 +168,48 @@ const PoolCollection& Subnet::getPools(Lease::Type type) const {
}
}
-PoolPtr Subnet::getPool(Lease::Type type, isc::asiolink::IOAddress hint,
- bool anypool /* true */) {
- // check if the type is valid (and throw if it isn't)
- checkType(type);
-
- PoolCollection* pools = NULL;
+PoolCollection& Subnet::getPools(Lease::Type type) {
+ switch (type) {
+ case Lease::TYPE_V4:
+ case Lease::TYPE_NA:
+ return (pools_);
+ case Lease::TYPE_TA:
+ return (pools_);
+ case Lease::TYPE_PD:
+ return (pools_pd_);
+ default:
+ isc_throw(BadValue, "Invalid pool type specified: "
+ << static_cast<int>(type));
+ }
+}
+#if 0
+const PoolCollection& Subnet::getConstPools(Lease::Type type) const {
switch (type) {
case Lease::TYPE_V4:
case Lease::TYPE_NA:
- pools = &pools_;
- break;
+ return (pools_);
case Lease::TYPE_TA:
- pools = &pools_ta_;
- break;
+ return (pools_);
case Lease::TYPE_PD:
- pools = &pools_pd_;
- break;
+ return (pools_pd_);
default:
- isc_throw(BadValue, "Failed to select pools. Unknown pool type: "
- << type);
+ isc_throw(BadValue, "Invalid pool type specified: "
+ << static_cast<int>(type));
}
+}
+#endif
+
+PoolPtr Subnet::getPool(Lease::Type type, isc::asiolink::IOAddress hint,
+ bool anypool /* true */) {
+ // check if the type is valid (and throw if it isn't)
+ checkType(type);
+
+ const PoolCollection& pools = getPools(type);
PoolPtr candidate;
- for (PoolCollection::const_iterator pool = pools->begin();
- pool != pools->end(); ++pool) {
+ for (PoolCollection::const_iterator pool = pools.begin();
+ pool != pools.end(); ++pool) {
// if we won't find anything better, then let's just use the first pool
if (anypool && !candidate) {
@@ -226,21 +242,13 @@ Subnet::addPool(const PoolPtr& pool) {
// check if the type is valid (and throw if it isn't)
checkType(pool->getType());
- switch (pool->getType()) {
- case Lease::TYPE_V4:
- case Lease::TYPE_NA:
- pools_.push_back(pool);
- return;
- case Lease::TYPE_TA:
- pools_ta_.push_back(pool);
- return;
- case Lease::TYPE_PD:
- pools_pd_.push_back(pool);
- return;
- default:
- isc_throw(BadValue, "Invalid pool type specified: "
- << static_cast<int>(pool->getType()));
- }
+ // Add the pool to the appropriate pools collection
+ getPools(pool->getType()).push_back(pool);
+}
+
+void
+Subnet::delPools(Lease::Type type) {
+ getPools(type).clear();
}
void
@@ -265,15 +273,17 @@ Subnet4::validateOption(const OptionPtr& option) const {
}
bool
-Subnet::inPool(const isc::asiolink::IOAddress& addr) const {
+Subnet::inPool(Lease::Type type, const isc::asiolink::IOAddress& addr) const {
// Let's start with checking if it even belongs to that subnet.
if (!inRange(addr)) {
return (false);
}
- for (PoolCollection::const_iterator pool = pools_.begin();
- pool != pools_.end(); ++pool) {
+ const PoolCollection& pools = getPools(type);
+
+ for (PoolCollection::const_iterator pool = pools.begin();
+ pool != pools.end(); ++pool) {
if ((*pool)->inRange(addr)) {
return (true);
}
diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h
index b209c2d..ce9ba1f 100644
--- a/src/lib/dhcpsrv/subnet.h
+++ b/src/lib/dhcpsrv/subnet.h
@@ -192,10 +192,11 @@ public:
/// is not always true. For the given example, 2001::1234:abcd would return
/// true for inSubnet(), but false for inPool() check.
///
+ /// @param type pool types to iterate over
/// @param addr this address will be checked if it belongs to any pools in
/// that subnet
/// @return true if the address is in any of the pools
- bool inPool(const isc::asiolink::IOAddress& addr) const;
+ bool inPool(Lease::Type type, const isc::asiolink::IOAddress& addr) const;
/// @brief return valid-lifetime for addresses in that prefix
Triplet<uint32_t> getValid() const {
@@ -272,6 +273,13 @@ public:
/// @param pool pool to be added
void addPool(const PoolPtr& pool);
+
+ /// @brief Deletes all pools of specified type
+ ///
+ /// This method is used for testing purposes only
+ /// @param type type of pools to be deleted
+ void delPools(Lease::Type type);
+
/// @brief Returns a pool that specified address belongs to
///
/// If there is no pool that the address belongs to (hint is invalid), other
@@ -303,7 +311,7 @@ public:
/// and 0.0.0.0 for Subnet4)
virtual isc::asiolink::IOAddress default_pool() const = 0;
- /// @brief returns all pools
+ /// @brief returns all pools (const variant)
///
/// The reference is only valid as long as the object that returned it.
///
@@ -311,6 +319,14 @@ public:
/// @return a collection of all pools
const PoolCollection& getPools(Lease::Type type) const;
+ /// @brief returns all pools (variable variant)
+ ///
+ /// The reference is only valid as long as the object that returned it.
+ ///
+ /// @param type lease type to be set
+ /// @return a collection of all pools
+ PoolCollection& getPools(Lease::Type type);
+
/// @brief sets name of the network interface for directly attached networks
///
/// @param iface_name name of the interface
diff --git a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
index ecfe9d2..54f417b 100644
--- a/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
+++ b/src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
@@ -127,7 +127,7 @@ public:
// that is belongs to the right subnet
EXPECT_EQ(lease->subnet_id_, subnet_->getID());
EXPECT_TRUE(subnet_->inRange(lease->addr_));
- EXPECT_TRUE(subnet_->inPool(lease->addr_));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, lease->addr_));
// that it have proper parameters
EXPECT_EQ(iaid_, lease->iaid_);
@@ -142,6 +142,29 @@ public:
// @todo: check cltt
}
+ /// @brief checks if Lease6 PD matches expected configuration
+ ///
+ /// @param lease lease to be checked
+ void checkPDLease6(const Lease6Ptr& lease, uint8_t expected_pd_len) {
+ // that is belongs to the right subnet
+ EXPECT_EQ(lease->subnet_id_, subnet_->getID());
+ EXPECT_TRUE(subnet_->inRange(lease->addr_));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, lease->addr_));
+
+ // that it have proper parameters
+ EXPECT_EQ(iaid_, lease->iaid_);
+ EXPECT_EQ(subnet_->getValid(), lease->valid_lft_);
+ EXPECT_EQ(subnet_->getPreferred(), lease->preferred_lft_);
+ EXPECT_EQ(subnet_->getT1(), lease->t1_);
+ EXPECT_EQ(subnet_->getT2(), lease->t2_);
+
+ EXPECT_EQ(expected_pd_len, lease->prefixlen_); // IA_PD
+ EXPECT_TRUE(false == lease->fqdn_fwd_);
+ EXPECT_TRUE(false == lease->fqdn_rev_);
+ EXPECT_TRUE(*lease->duid_ == *duid_);
+ // @todo: check cltt
+ }
+
/// @brief checks if specified address is increased properly
/// @param alloc IterativeAllocator that is tested
/// @param input address to be increased
@@ -207,7 +230,7 @@ public:
// Check that is belongs to the right subnet
EXPECT_EQ(lease->subnet_id_, subnet_->getID());
EXPECT_TRUE(subnet_->inRange(lease->addr_));
- EXPECT_TRUE(subnet_->inPool(lease->addr_));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, lease->addr_));
// Check that it has proper parameters
EXPECT_EQ(subnet_->getValid(), lease->valid_lft_);
@@ -288,6 +311,40 @@ TEST_F(AllocEngine6Test, simpleAlloc6) {
detailCompareLease(lease, from_mgr);
}
+
+// This test checks if the simple PD allocation can succeed
+TEST_F(AllocEngine6Test, pdSimpleAlloc6) {
+ boost::scoped_ptr<AllocEngine> engine;
+ ASSERT_NO_THROW(engine.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100)));
+ ASSERT_TRUE(engine);
+
+ subnet_->delPools(Lease::TYPE_NA);
+
+ Pool6Ptr pd_pool(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:1::"), 56, 64));
+ subnet_->addPool(pd_pool);
+
+ Lease6Ptr lease;
+ EXPECT_NO_THROW(lease = expectOneLease(engine->allocateAddress6(subnet_,
+ duid_, iaid_, IOAddress("::"), Lease::TYPE_PD, false, false,
+ "", false, CalloutHandlePtr())));
+
+ // Check that we got a lease
+ ASSERT_TRUE(lease);
+
+ EXPECT_EQ(Lease::TYPE_PD, lease->type_);
+
+ // Do all checks on the PD lease
+ checkPDLease6(lease, pd_pool->getLength());
+
+ // Check that the lease is indeed in LeaseMgr
+ Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
+ lease->addr_);
+ ASSERT_TRUE(from_mgr);
+
+ // Now check that the lease in LeaseMgr has the same parameters
+ detailCompareLease(lease, from_mgr);
+}
+
// This test checks if the fake allocation (for SOLICIT) can succeed
TEST_F(AllocEngine6Test, fakeAlloc6) {
boost::scoped_ptr<AllocEngine> engine;
@@ -447,14 +504,104 @@ TEST_F(AllocEngine6Test, IterativeAllocator) {
for (int i = 0; i < 1000; ++i) {
IOAddress candidate = alloc->pickAddress(subnet_, duid_, IOAddress("::"));
- EXPECT_TRUE(subnet_->inPool(candidate));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate));
}
}
-// This test verifies that the allocator iterates over addresses properly
TEST_F(AllocEngine6Test, IterativeAllocatorAddrStep) {
NakedAllocEngine::NakedIterativeAllocator alloc(Lease::TYPE_NA);
+ subnet_->delPools(Lease::TYPE_NA); // Get rid of default pool
+
+ Pool6Ptr pool1(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::1"),
+ IOAddress("2001:db8:1::5")));
+ Pool6Ptr pool2(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::100"),
+ IOAddress("2001:db8:1::100")));
+ Pool6Ptr pool3(new Pool6(Lease::TYPE_NA, IOAddress("2001:db8:1::105"),
+ IOAddress("2001:db8:1::106")));
+ subnet_->addPool(pool1);
+ subnet_->addPool(pool2);
+ subnet_->addPool(pool3);
+
+ // Let's check the first pool (5 addresses here)
+ EXPECT_EQ("2001:db8:1::1", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:1::2", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:1::3", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:1::4", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:1::5", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ // The second pool is easy - only one address here
+ EXPECT_EQ("2001:db8:1::100", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ // This is the third and last pool, with 2 addresses in it
+ EXPECT_EQ("2001:db8:1::105", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:1::106", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ // We iterated over all addresses and reached to the end of the last pool.
+ // Let's wrap around and start from the beginning
+ EXPECT_EQ("2001:db8:1::1", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:1::2", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+}
+
+TEST_F(AllocEngine6Test, IterativeAllocatorPrefixStep) {
+ NakedAllocEngine::NakedIterativeAllocator alloc(Lease::TYPE_PD);
+
+ subnet_.reset(new Subnet6(IOAddress("2001:db8::"), 32, 1, 2, 3, 4));
+
+ 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));
+ Pool6Ptr pool3(new Pool6(Lease::TYPE_PD, IOAddress("2001:db8:2::"), 56, 64));
+ subnet_->addPool(pool1);
+ subnet_->addPool(pool2);
+ subnet_->addPool(pool3);
+
+ // We have a 2001:db8::/48 subnet that has 3 pools defined in it:
+ // 2001:db8::/56 split into /60 prefixes (16 leases) (or 2001:db8:0:X0::)
+ // 2001:db8:1::/48 split into a single /48 prefix (just 1 lease)
+ // 2001:db8:2::/56 split into /64 prefixes (256 leases) (or 2001:db8:2:XX::)
+
+ // First pool check (Let's check over all 16 leases)
+ EXPECT_EQ("2001:db8::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:10::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:20::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:30::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:40::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:50::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:60::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:70::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:80::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:90::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:a0::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:b0::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:c0::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:d0::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:e0::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:f0::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ // Second pool (just one lease here)
+ EXPECT_EQ("2001:db8:1::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ // Third pool (256 leases, let's check first and last explictly and the
+ // rest over in a pool
+ EXPECT_EQ("2001:db8:2::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ for (int i = 1; i < 255; i++) {
+ stringstream exp;
+ exp << "2001:db8:2:" << hex << i << dec << "::";
+ EXPECT_EQ(exp.str(), alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ }
+ EXPECT_EQ("2001:db8:2:ff::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+
+ // Ok, we've iterated over all prefixes in all pools. We now wrap around.
+ // We're looping over now (iterating over first pool again)
+ EXPECT_EQ("2001:db8::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+ EXPECT_EQ("2001:db8:0:10::", alloc.pickAddress(subnet_, duid_, IOAddress("::")).toText());
+}
+
+// This test verifies that the iterative allocator can step over addresses
+TEST_F(AllocEngine6Test, IterativeAllocatorAddressIncrease) {
+ NakedAllocEngine::NakedIterativeAllocator alloc(Lease::TYPE_NA);
+
// Let's pick the first address
IOAddress addr1 = alloc.pickAddress(subnet_, duid_, IOAddress("2001:db8:1::10"));
@@ -469,8 +616,11 @@ TEST_F(AllocEngine6Test, IterativeAllocatorAddrStep) {
checkAddrIncrease(alloc, "2001:db8::ffff", "2001:db8::1:0");
checkAddrIncrease(alloc, "::", "::1");
checkAddrIncrease(alloc, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "::");
+}
- // Check that prefixes can be increased properly
+// This test verifies that the allocator can step over prefixes
+TEST_F(AllocEngine6Test, IterativeAllocatorPrefixIncrease) {
+ NakedAllocEngine::NakedIterativeAllocator alloc(Lease::TYPE_PD);
// For /128 prefix, increasePrefix should work the same as addressIncrease
checkPrefixIncrease(alloc, "2001:db8::9", 128, "2001:db8::a");
@@ -543,7 +693,7 @@ TEST_F(AllocEngine6Test, IterativeAllocator_manyPools6) {
int cnt = 0;
while (++cnt) {
IOAddress candidate = alloc.pickAddress(subnet_, duid_, IOAddress("::"));
- EXPECT_TRUE(subnet_->inPool(candidate));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate));
// One way to easily verify that the iterative allocator really works is
// to uncomment the following line and observe its output that it
@@ -1000,7 +1150,7 @@ TEST_F(AllocEngine4Test, IterativeAllocator) {
for (int i = 0; i < 1000; ++i) {
IOAddress candidate = alloc->pickAddress(subnet_, clientid_,
IOAddress("0.0.0.0"));
- EXPECT_TRUE(subnet_->inPool(candidate));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate));
}
}
@@ -1032,7 +1182,7 @@ TEST_F(AllocEngine4Test, IterativeAllocator_manyPools4) {
int cnt = 0;
while (++cnt) {
IOAddress candidate = alloc.pickAddress(subnet_, clientid_, IOAddress("0.0.0.0"));
- EXPECT_TRUE(subnet_->inPool(candidate));
+ EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate));
// One way to easily verify that the iterative allocator really works is
// to uncomment the following line and observe its output that it
diff --git a/src/lib/dhcpsrv/tests/subnet_unittest.cc b/src/lib/dhcpsrv/tests/subnet_unittest.cc
index a3dcbdc..d8497d6 100644
--- a/src/lib/dhcpsrv/tests/subnet_unittest.cc
+++ b/src/lib/dhcpsrv/tests/subnet_unittest.cc
@@ -140,27 +140,27 @@ TEST(Subnet4Test, inRangeinPool) {
EXPECT_TRUE(subnet->inRange(IOAddress("192.1.1.1")));
// ... but it does not belong to any pool within
- EXPECT_FALSE(subnet->inPool(IOAddress("192.1.1.1")));
+ EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("192.1.1.1")));
// the last address that is in range, but out of pool
EXPECT_TRUE(subnet->inRange(IOAddress("192.1.255.255")));
- EXPECT_FALSE(subnet->inPool(IOAddress("192.1.255.255")));
+ EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("192.1.255.255")));
// the first address that is in range, in pool
EXPECT_TRUE(subnet->inRange(IOAddress("192.2.0.0")));
- EXPECT_TRUE (subnet->inPool(IOAddress("192.2.0.0")));
+ EXPECT_TRUE (subnet->inPool(Lease::TYPE_V4, IOAddress("192.2.0.0")));
// let's try something in the middle as well
EXPECT_TRUE(subnet->inRange(IOAddress("192.2.3.4")));
- EXPECT_TRUE (subnet->inPool(IOAddress("192.2.3.4")));
+ EXPECT_TRUE (subnet->inPool(Lease::TYPE_V4, IOAddress("192.2.3.4")));
// the last address that is in range, in pool
EXPECT_TRUE(subnet->inRange(IOAddress("192.2.255.255")));
- EXPECT_TRUE (subnet->inPool(IOAddress("192.2.255.255")));
+ EXPECT_TRUE (subnet->inPool(Lease::TYPE_V4, IOAddress("192.2.255.255")));
// the first address that is in range, but out of pool
EXPECT_TRUE(subnet->inRange(IOAddress("192.3.0.0")));
- EXPECT_FALSE(subnet->inPool(IOAddress("192.3.0.0")));
+ EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("192.3.0.0")));
}
// This test checks if the toText() method returns text representation
@@ -609,27 +609,27 @@ TEST(Subnet6Test, inRangeinPool) {
// 192.1.1.1 belongs to the subnet...
EXPECT_TRUE(subnet->inRange(IOAddress("2001:db8::1")));
// ... but it does not belong to any pool within
- EXPECT_FALSE(subnet->inPool(IOAddress("2001:db8::1")));
+ EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("2001:db8::1")));
// the last address that is in range, but out of pool
EXPECT_TRUE(subnet->inRange(IOAddress("2001:db8::f")));
- EXPECT_FALSE(subnet->inPool(IOAddress("2001:db8::f")));
+ EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("2001:db8::f")));
// the first address that is in range, in pool
EXPECT_TRUE(subnet->inRange(IOAddress("2001:db8::10")));
- EXPECT_TRUE (subnet->inPool(IOAddress("2001:db8::10")));
+ EXPECT_TRUE (subnet->inPool(Lease::TYPE_V4, IOAddress("2001:db8::10")));
// let's try something in the middle as well
EXPECT_TRUE(subnet->inRange(IOAddress("2001:db8::18")));
- EXPECT_TRUE (subnet->inPool(IOAddress("2001:db8::18")));
+ EXPECT_TRUE (subnet->inPool(Lease::TYPE_V4, IOAddress("2001:db8::18")));
// the last address that is in range, in pool
EXPECT_TRUE(subnet->inRange(IOAddress("2001:db8::20")));
- EXPECT_TRUE (subnet->inPool(IOAddress("2001:db8::20")));
+ EXPECT_TRUE (subnet->inPool(Lease::TYPE_V4, IOAddress("2001:db8::20")));
// the first address that is in range, but out of pool
EXPECT_TRUE(subnet->inRange(IOAddress("2001:db8::21")));
- EXPECT_FALSE(subnet->inPool(IOAddress("2001:db8::21")));
+ EXPECT_FALSE(subnet->inPool(Lease::TYPE_V4, IOAddress("2001:db8::21")));
}
// This test checks if the toText() method returns text representation
More information about the bind10-changes
mailing list