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
9fab3d3a
Commit
9fab3d3a
authored
Aug 21, 2013
by
Marcin Siodelski
Browse files
[3083] Unit test setting FQDN lease parameters.
parent
18dc9853
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/dhcp4_srv.cc
View file @
9fab3d3a
...
...
@@ -614,9 +614,13 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
// will try to honour the hint, but it is just a hint - some other address
// may be used instead. If fake_allocation is set to false, the lease will
// be inserted into the LeaseMgr as well.
// @todo pass the actual FQDN data.
Lease4Ptr
old_lease
;
Lease4Ptr
lease
=
alloc_engine_
->
allocateAddress4
(
subnet
,
client_id
,
hwaddr
,
hint
,
fake_allocation
,
callout_handle
);
hint
,
false
,
false
,
""
,
fake_allocation
,
callout_handle
,
old_lease
);
if
(
lease
)
{
// We have a lease! Let's set it in the packet and send it back to
...
...
src/lib/dhcpsrv/alloc_engine.cc
View file @
9fab3d3a
...
...
@@ -820,8 +820,6 @@ Lease4Ptr AllocEngine::createLease4(const SubnetPtr& subnet,
callout_handle
->
getArgument
(
"lease4"
,
lease
);
}
if
(
!
fake_allocation
)
{
// That is a real (REQUEST) allocation
bool
status
=
LeaseMgrFactory
::
instance
().
addLease
(
lease
);
...
...
src/lib/dhcpsrv/tests/alloc_engine_unittest.cc
View file @
9fab3d3a
...
...
@@ -164,8 +164,6 @@ public:
EXPECT_EQ
(
subnet_
->
getValid
(),
lease
->
valid_lft_
);
EXPECT_EQ
(
subnet_
->
getT1
(),
lease
->
t1_
);
EXPECT_EQ
(
subnet_
->
getT2
(),
lease
->
t2_
);
EXPECT_TRUE
(
false
==
lease
->
fqdn_fwd_
);
EXPECT_TRUE
(
false
==
lease
->
fqdn_rev_
);
if
(
lease
->
client_id_
&&
!
clientid_
)
{
ADD_FAILURE
()
<<
"Lease4 has a client-id, while it should have none."
;
}
else
...
...
@@ -614,7 +612,8 @@ TEST_F(AllocEngine4Test, simpleAlloc4) {
Lease4Ptr
lease
=
engine
->
allocateAddress4
(
subnet_
,
clientid_
,
hwaddr_
,
IOAddress
(
"0.0.0.0"
),
false
,
false
,
""
,
false
,
true
,
"somehost.example.com."
,
false
,
CalloutHandlePtr
(),
old_lease_
);
// The new lease has been allocated, so the old lease should not exist.
...
...
@@ -642,7 +641,7 @@ TEST_F(AllocEngine4Test, fakeAlloc4) {
Lease4Ptr
lease
=
engine
->
allocateAddress4
(
subnet_
,
clientid_
,
hwaddr_
,
IOAddress
(
"0.0.0.0"
),
false
,
false
,
"
"
,
false
,
true
,
"host.example.com.
"
,
true
,
CalloutHandlePtr
(),
old_lease_
);
...
...
@@ -670,7 +669,7 @@ TEST_F(AllocEngine4Test, allocWithValidHint4) {
Lease4Ptr
lease
=
engine
->
allocateAddress4
(
subnet_
,
clientid_
,
hwaddr_
,
IOAddress
(
"192.0.2.105"
),
false
,
false
,
"
"
,
true
,
true
,
"host.example.com.
"
,
false
,
CalloutHandlePtr
(),
old_lease_
);
// Check that we got a lease
...
...
@@ -805,7 +804,7 @@ TEST_F(AllocEngine4Test, allocateAddress4Nulls) {
clientid_
=
ClientIdPtr
();
lease
=
engine
->
allocateAddress4
(
subnet_
,
ClientIdPtr
(),
hwaddr_
,
IOAddress
(
"0.0.0.0"
),
false
,
false
,
"
"
,
true
,
true
,
"myhost.example.com.
"
,
false
,
CalloutHandlePtr
(),
old_lease_
);
// Check that we got a lease
...
...
@@ -914,7 +913,7 @@ TEST_F(AllocEngine4Test, smallPool4) {
Lease4Ptr
lease
=
engine
->
allocateAddress4
(
subnet_
,
clientid_
,
hwaddr_
,
IOAddress
(
"0.0.0.0"
),
false
,
false
,
"
"
,
true
,
true
,
"host.example.com.
"
,
false
,
CalloutHandlePtr
(),
old_lease_
);
...
...
@@ -1070,7 +1069,7 @@ TEST_F(AllocEngine4Test, requestReuseExpiredLease4) {
// A client comes along, asking specifically for this address
lease
=
engine
->
allocateAddress4
(
subnet_
,
clientid_
,
hwaddr_
,
IOAddress
(
addr
.
toText
()),
false
,
false
,
"
"
,
false
,
true
,
"host.example.com.
"
,
false
,
CalloutHandlePtr
(),
old_lease_
);
...
...
@@ -1117,8 +1116,8 @@ TEST_F(AllocEngine4Test, renewLease4) {
// Lease was assigned 45 seconds ago and is valid for 100 seconds. Let's
// renew it.
ASSERT_FALSE
(
lease
->
expired
());
lease
=
engine
->
renewLease4
(
subnet_
,
clientid_
,
hwaddr_
,
fals
e
,
false
,
"
"
,
lease
,
false
);
lease
=
engine
->
renewLease4
(
subnet_
,
clientid_
,
hwaddr_
,
tru
e
,
true
,
"host.example.com.
"
,
lease
,
false
);
// Check that he got that single lease
ASSERT_TRUE
(
lease
);
EXPECT_EQ
(
addr
.
toText
(),
lease
->
addr_
.
toText
());
...
...
src/lib/dhcpsrv/tests/test_utils.cc
View file @
9fab3d3a
...
...
@@ -47,6 +47,9 @@ detailCompareLease(const Lease4Ptr& first, const Lease4Ptr& second) {
EXPECT_EQ
(
first
->
valid_lft_
,
second
->
valid_lft_
);
EXPECT_EQ
(
first
->
cltt_
,
second
->
cltt_
);
EXPECT_EQ
(
first
->
subnet_id_
,
second
->
subnet_id_
);
EXPECT_EQ
(
first
->
fqdn_fwd_
,
second
->
fqdn_fwd_
);
EXPECT_EQ
(
first
->
fqdn_rev_
,
second
->
fqdn_rev_
);
EXPECT_EQ
(
first
->
hostname_
,
second
->
hostname_
);
}
void
...
...
@@ -67,6 +70,9 @@ detailCompareLease(const Lease6Ptr& first, const Lease6Ptr& second) {
EXPECT_EQ
(
first
->
valid_lft_
,
second
->
valid_lft_
);
EXPECT_EQ
(
first
->
cltt_
,
second
->
cltt_
);
EXPECT_EQ
(
first
->
subnet_id_
,
second
->
subnet_id_
);
EXPECT_EQ
(
first
->
fqdn_fwd_
,
second
->
fqdn_fwd_
);
EXPECT_EQ
(
first
->
fqdn_rev_
,
second
->
fqdn_rev_
);
EXPECT_EQ
(
first
->
hostname_
,
second
->
hostname_
);
}
};
...
...
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