Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
8ed4c169
Commit
8ed4c169
authored
Sep 20, 2013
by
Tomek Mrugalski
🛰
Browse files
[3171] All dhcpsrv unit-tests now pass.
parent
3e08c03f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcpsrv/subnet.cc
View file @
8ed4c169
...
...
@@ -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 */
)
{
...
...
src/lib/dhcpsrv/tests/subnet_unittest.cc
View file @
8ed4c169
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment