|
@@ -1166,83 +1166,32 @@ TEST_F(Dhcpv6SrvTest, pdRenewReject) {
|
|
|
testRenewReject(Lease::TYPE_PD, IOAddress("2001:db8:1:2::"));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// This test verifies that incoming (positive) RELEASE can be handled properly,
|
|
|
-// that a REPLY is generated, that the response has status code and that the
|
|
|
-// lease is indeed removed from the database.
|
|
|
+// This test verifies that incoming (positive) RELEASE with address can be
|
|
|
+// handled properly, that a REPLY is generated, that the response has status
|
|
|
+// code and that the lease is indeed removed from the database.
|
|
|
//
|
|
|
// expected:
|
|
|
// - returned REPLY message has copy of client-id
|
|
|
// - returned REPLY message has server-id
|
|
|
-// - returned REPLY message has IA that does not include an IAADDR
|
|
|
+// - returned REPLY message has IA_NA that does not include an IAADDR
|
|
|
// - lease is actually removed from LeaseMgr
|
|
|
TEST_F(Dhcpv6SrvTest, ReleaseBasic) {
|
|
|
- NakedDhcpv6Srv srv(0);
|
|
|
-
|
|
|
- const IOAddress addr("2001:db8:1:1::cafe:babe");
|
|
|
- const uint32_t iaid = 234;
|
|
|
-
|
|
|
- // Generate client-id also duid_
|
|
|
- OptionPtr clientid = generateClientId();
|
|
|
-
|
|
|
- // Check that the address we are about to use is indeed in pool
|
|
|
- ASSERT_TRUE(subnet_->inPool(Lease::TYPE_NA, 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(Lease::TYPE_NA, addr, duid_, iaid,
|
|
|
- 501, 502, 503, 504, subnet_->getID(), 0));
|
|
|
- lease->cltt_ = 1234;
|
|
|
- ASSERT_TRUE(LeaseMgrFactory::instance().addLease(lease));
|
|
|
-
|
|
|
- // Check that the lease is really in the database
|
|
|
- Lease6Ptr l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA,
|
|
|
- addr);
|
|
|
- ASSERT_TRUE(l);
|
|
|
-
|
|
|
- // Let's create a RELEASE
|
|
|
- Pkt6Ptr req = Pkt6Ptr(new Pkt6(DHCPV6_RELEASE, 1234));
|
|
|
- req->setRemoteAddr(IOAddress("fe80::abcd"));
|
|
|
- boost::shared_ptr<Option6IA> ia = generateIA(D6O_IA_NA, iaid, 1500, 3000);
|
|
|
-
|
|
|
- OptionPtr released_addr_opt(new Option6IAAddr(D6O_IAADDR, addr, 300, 500));
|
|
|
- ia->addOption(released_addr_opt);
|
|
|
- req->addOption(ia);
|
|
|
- req->addOption(clientid);
|
|
|
-
|
|
|
- // Server-id is mandatory in RELEASE
|
|
|
- req->addOption(srv.getServerID());
|
|
|
-
|
|
|
- // Pass it to the server and hope for a REPLY
|
|
|
- Pkt6Ptr reply = srv.processRelease(req);
|
|
|
-
|
|
|
- // Check if we get response at all
|
|
|
- checkResponse(reply, DHCPV6_REPLY, 1234);
|
|
|
-
|
|
|
- OptionPtr tmp = reply->getOption(D6O_IA_NA);
|
|
|
- ASSERT_TRUE(tmp);
|
|
|
-
|
|
|
- // Check that IA_NA was returned and that there's an address included
|
|
|
- ia = boost::dynamic_pointer_cast<Option6IA>(tmp);
|
|
|
- checkIA_NAStatusCode(ia, STATUS_Success);
|
|
|
- checkMsgStatusCode(reply, STATUS_Success);
|
|
|
-
|
|
|
- // There should be no address returned in RELEASE (see RFC3315, 18.2.6)
|
|
|
- EXPECT_FALSE(tmp->getOption(D6O_IAADDR));
|
|
|
-
|
|
|
- // Check DUIDs
|
|
|
- checkServerId(reply, srv.getServerID());
|
|
|
- checkClientId(reply, clientid);
|
|
|
-
|
|
|
- // Check that the lease is really gone in the database
|
|
|
- // get lease by address
|
|
|
- l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, addr);
|
|
|
- ASSERT_FALSE(l);
|
|
|
+ testReleaseBasic(Lease::TYPE_NA, IOAddress("2001:db8:1:1::cafe:babe"),
|
|
|
+ IOAddress("2001:db8:1:1::cafe:babe"));
|
|
|
+}
|
|
|
|
|
|
- // get lease by subnetid/duid/iaid combination
|
|
|
- l = LeaseMgrFactory::instance().getLease6(Lease::TYPE_NA, *duid_, iaid,
|
|
|
- subnet_->getID());
|
|
|
- ASSERT_FALSE(l);
|
|
|
+// This test verifies that incoming (positive) RELEASE with prefix can be
|
|
|
+// handled properly, that a REPLY is generated, that the response has
|
|
|
+// status code and that the lease is indeed removed from the database.
|
|
|
+//
|
|
|
+// expected:
|
|
|
+// - returned REPLY message has copy of client-id
|
|
|
+// - returned REPLY message has server-id
|
|
|
+// - 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::"),
|
|
|
+ IOAddress("2001:db8:1:2::"));
|
|
|
}
|
|
|
|
|
|
// This test verifies that incoming (invalid) RELEASE can be handled properly.
|