mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 05:55:28 +00:00
[4321] Added unit test for Solicit after lease acquisition.
The new test uses swapped addresses as hints after acquiring these addresses in a 4-way exchange. The server ignores hints.
This commit is contained in:
@@ -58,7 +58,7 @@ const char* CONFIGS[] = {
|
||||
" \"ip-addresses\": [ \"2001:db8:1:1::babf\" ]"
|
||||
" } ]"
|
||||
" } ]"
|
||||
"}",
|
||||
"}",
|
||||
|
||||
// Configuration 1:
|
||||
"{ "
|
||||
@@ -1028,6 +1028,57 @@ TEST_F(HostTest, multipleIAsRenew) {
|
||||
EXPECT_TRUE(client_.hasLeaseForPrefix(IOAddress("3000:1:3::"), 64));
|
||||
}
|
||||
|
||||
// In this test, the client performs 4-way exchange and includes 3 IA_NAs
|
||||
// and IA_PDs. The server has 3 address and 3 prefix reservations for the
|
||||
// client and allocates them all. Once the 4-way exchange is complete,
|
||||
// the client sends Solicit in which it specifies hints for all IAs. The
|
||||
// hints are for the reserved addresses but some of them are included in
|
||||
// different IAs than they are assigned to. The server should ignore hints
|
||||
// and respond with currently assigned leases.
|
||||
TEST_F(HostTest, multipleIAsSolicitAfterAcquisition) {
|
||||
// 4-way exchange
|
||||
testMultipleIAs(do_solicit_request_,
|
||||
Reservation("2001:db8:1:1::1"),
|
||||
Reservation("2001:db8:1:1::2"),
|
||||
Reservation("2001:db8:1:1::3"),
|
||||
Reservation("3000:1:1::/64"),
|
||||
Reservation("3000:1:2::/64"),
|
||||
Reservation("3000:1:3::/64"));
|
||||
|
||||
client_.clearRequestedIAs();
|
||||
|
||||
// Specify hints.
|
||||
|
||||
// "2001:db8:1:1::1" is allocated for IAID = 1 but we specify it as
|
||||
// a hint for IAID = 3 and so on.
|
||||
requestIA(client_, Hint(IAID(3), "2001:db8:1:1::1"));
|
||||
requestIA(client_, Hint(IAID(2), "2001:db8:1:1::2"));
|
||||
requestIA(client_, Hint(IAID(1), "2001:db8:1:1::3"));
|
||||
requestIA(client_, Hint(IAID(6), "3000:1:1::/64"));
|
||||
requestIA(client_, Hint(IAID(5), "3000:1:2::/64"));
|
||||
requestIA(client_, Hint(IAID(4), "3000:1:3::/64"));
|
||||
|
||||
// Send Solicit with hints as specified above.
|
||||
ASSERT_NO_THROW(do_solicit_());
|
||||
|
||||
// Make sure that the client still has the same leases and the leases
|
||||
// should be assigned to the same IAs.
|
||||
ASSERT_EQ(6, client_.getLeaseNum());
|
||||
|
||||
EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::1"),
|
||||
IAID(1)));
|
||||
EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::2"),
|
||||
IAID(2)));
|
||||
EXPECT_TRUE(client_.hasLeaseForAddress(IOAddress("2001:db8:1:1::3"),
|
||||
IAID(3)));
|
||||
EXPECT_TRUE(client_.hasLeaseForPrefix(IOAddress("3000:1:1::"), 64,
|
||||
IAID(4)));
|
||||
EXPECT_TRUE(client_.hasLeaseForPrefix(IOAddress("3000:1:2::"), 64,
|
||||
IAID(5)));
|
||||
EXPECT_TRUE(client_.hasLeaseForPrefix(IOAddress("3000:1:3::"), 64,
|
||||
IAID(6)));
|
||||
}
|
||||
|
||||
// In this test, the client performs 4-way exchange and includes 3 IA_NAs and
|
||||
// 3 IA_PDs and includes no hints. The server has reservations for 2 addresses
|
||||
// and 2 prefixes for this client. The server allocates reserved leases and
|
||||
|
Reference in New Issue
Block a user