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
Adam Osuchowski
Kea
Commits
f42fbaf9
Commit
f42fbaf9
authored
Oct 08, 2013
by
Tomek Mrugalski
🛰
Browse files
[3153] PD renew and release unit-tests are now passing.
parent
4da14c5c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
View file @
f42fbaf9
...
...
@@ -1115,7 +1115,7 @@ TEST_F(Dhcpv6SrvTest, ManyRequests) {
// - lease is actually renewed in LeaseMgr
TEST_F
(
Dhcpv6SrvTest
,
renewBasic
)
{
testRenewBasic
(
Lease
::
TYPE_NA
,
"2001:db8:1:1::cafe:babe"
,
"2001:db8:1:1::cafe:babe"
);
"2001:db8:1:1::cafe:babe"
,
128
);
}
// This test verifies that incoming (positive) PD RENEW can be handled properly,
...
...
@@ -1128,8 +1128,8 @@ TEST_F(Dhcpv6SrvTest, renewBasic) {
// - returned REPLY message has IA_PD that includes IAPREFIX
// - lease is actually renewed in LeaseMgr
TEST_F
(
Dhcpv6SrvTest
,
pdRenewBasic
)
{
testRenewBasic
(
Lease
::
TYPE_PD
,
"2001:db8:1:
1
::
cafe:babe
"
,
"2001:db8:1:
1
::
cafe:babe"
);
testRenewBasic
(
Lease
::
TYPE_PD
,
"2001:db8:1:
2
::"
,
"2001:db8:1:
2
::
"
,
pd_pool_
->
getLength
()
);
}
// This test verifies that incoming (invalid) RENEW with an address
...
...
@@ -1190,7 +1190,7 @@ TEST_F(Dhcpv6SrvTest, ReleaseBasic) {
// - returned REPLY message has IA_PD that does not include an IAPREFIX
// - lease is actually removed from LeaseMgr
TEST_F
(
Dhcpv6SrvTest
,
pdReleaseBasic
)
{
testReleaseBasic
(
Lease
::
TYPE_
NA
,
IOAddress
(
"2001:db8:1:2::"
),
testReleaseBasic
(
Lease
::
TYPE_
PD
,
IOAddress
(
"2001:db8:1:2::"
),
IOAddress
(
"2001:db8:1:2::"
));
}
...
...
src/bin/dhcp6/tests/dhcp6_test_utils.cc
View file @
f42fbaf9
...
...
@@ -134,6 +134,7 @@ Dhcpv6SrvTest::createMessage(uint8_t message_type, Lease::Type lease_type,
code
=
D6O_IA_PD
;
subopt
.
reset
(
new
Option6IAPrefix
(
D6O_IAPREFIX
,
addr
,
prefix_len
,
300
,
500
));
break
;
default:
isc_throw
(
BadValue
,
"Invalid lease type specified"
);
}
...
...
@@ -148,7 +149,8 @@ Dhcpv6SrvTest::createMessage(uint8_t message_type, Lease::Type lease_type,
void
Dhcpv6SrvTest
::
testRenewBasic
(
Lease
::
Type
type
,
const
std
::
string
&
existing_addr
,
const
std
::
string
&
renew_addr
)
{
const
std
::
string
&
renew_addr
,
const
uint8_t
prefix_len
)
{
NakedDhcpv6Srv
srv
(
0
);
const
IOAddress
existing
(
existing_addr
);
...
...
@@ -163,8 +165,8 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type, const std::string& existing_addr
// Note that preferred, valid, T1 and T2 timers and CLTT are set to invalid
// value on purpose. They should be updated during RENEW.
Lease6Ptr
lease
(
new
Lease6
(
type
,
existing
,
duid_
,
iaid
,
501
,
502
,
503
,
504
,
subnet_
->
getID
(),
128
));
Lease6Ptr
lease
(
new
Lease6
(
type
,
existing
,
duid_
,
iaid
,
501
,
502
,
503
,
504
,
subnet_
->
getID
(),
prefix_len
));
lease
->
cltt_
=
1234
;
ASSERT_TRUE
(
LeaseMgrFactory
::
instance
().
addLease
(
lease
));
...
...
@@ -181,7 +183,7 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type, const std::string& existing_addr
EXPECT_NE
(
l
->
cltt_
,
time
(
NULL
));
Pkt6Ptr
req
=
createMessage
(
DHCPV6_RENEW
,
type
,
IOAddress
(
renew_addr
),
128
,
iaid
);
prefix_len
,
iaid
);
req
->
addOption
(
clientid
);
req
->
addOption
(
srv
.
getServerID
());
...
...
@@ -198,8 +200,8 @@ Dhcpv6SrvTest::testRenewBasic(Lease::Type type, const std::string& existing_addr
switch
(
type
)
{
case
Lease
::
TYPE_NA
:
{
// Check that IA_NA was returned and that there's an address included
boost
::
shared_ptr
<
Option6IAAddr
>
addr_opt
=
checkIA_NA
(
reply
,
234
,
subnet_
->
getT1
(),
subnet_
->
getT2
());
boost
::
shared_ptr
<
Option6IAAddr
>
addr_opt
=
checkIA_NA
(
reply
,
234
,
subnet_
->
getT1
(),
subnet_
->
getT2
());
ASSERT_TRUE
(
addr_opt
);
...
...
src/bin/dhcp6/tests/dhcp6_test_utils.h
View file @
f42fbaf9
...
...
@@ -413,9 +413,10 @@ public:
/// @param type type (TYPE_NA or TYPE_PD)
/// @param existing_addr address to be preinserted into the database
/// @param renew_addr address being sent in RENEW
/// @param prefix_len length of the prefix (128 for addresses)
void
testRenewBasic
(
Lease
::
Type
type
,
const
std
::
string
&
existing_addr
,
const
std
::
string
&
renew_addr
);
const
std
::
string
&
renew_addr
,
const
uint8_t
prefix_len
);
/// @brief Performs negative RENEW test
///
...
...
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