Commit 8ed4c169 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[3171] All dhcpsrv unit-tests now pass.

parent 3e08c03f
......@@ -169,28 +169,15 @@ const PoolCollection& Subnet::getPools(Lease::Type type) const {
}
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));
}
}
// check if the type is valid (and throw if it isn't)
checkType(type);
#if 0
const PoolCollection& Subnet::getConstPools(Lease::Type type) const {
switch (type) {
case Lease::TYPE_V4:
case Lease::TYPE_NA:
return (pools_);
case Lease::TYPE_TA:
return (pools_);
return (pools_ta_);
case Lease::TYPE_PD:
return (pools_pd_);
default:
......@@ -198,7 +185,6 @@ const PoolCollection& Subnet::getConstPools(Lease::Type type) const {
<< static_cast<int>(type));
}
}
#endif
PoolPtr Subnet::getPool(Lease::Type type, isc::asiolink::IOAddress hint,
bool anypool /* true */) {
......
......@@ -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(Lease::TYPE_V4, IOAddress("2001:db8::1")));
EXPECT_FALSE(subnet->inPool(Lease::TYPE_NA, 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(Lease::TYPE_V4, IOAddress("2001:db8::f")));
EXPECT_FALSE(subnet->inPool(Lease::TYPE_NA, 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(Lease::TYPE_V4, IOAddress("2001:db8::10")));
EXPECT_TRUE (subnet->inPool(Lease::TYPE_NA, 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(Lease::TYPE_V4, IOAddress("2001:db8::18")));
EXPECT_TRUE (subnet->inPool(Lease::TYPE_NA, 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(Lease::TYPE_V4, IOAddress("2001:db8::20")));
EXPECT_TRUE (subnet->inPool(Lease::TYPE_NA, 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(Lease::TYPE_V4, IOAddress("2001:db8::21")));
EXPECT_FALSE(subnet->inPool(Lease::TYPE_NA, IOAddress("2001:db8::21")));
}
// This test checks if the toText() method returns text representation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment