BIND 10 trac3153, updated. f42fbaf960614930dc0c23591e430411a9417624 [3153] PD renew and release unit-tests are now passing.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 8 10:24:10 UTC 2013


The branch, trac3153 has been updated
       via  f42fbaf960614930dc0c23591e430411a9417624 (commit)
      from  4da14c5ca0e659263f2abd8bcee8a79ad79e3722 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f42fbaf960614930dc0c23591e430411a9417624
Author: Tomek Mrugalski <tomasz at isc.org>
Date:   Tue Oct 8 12:23:54 2013 +0200

    [3153] PD renew and release unit-tests are now passing.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/dhcp6/tests/dhcp6_srv_unittest.cc |    8 ++++----
 src/bin/dhcp6/tests/dhcp6_test_utils.cc   |   14 ++++++++------
 src/bin/dhcp6/tests/dhcp6_test_utils.h    |    3 ++-
 3 files changed, 14 insertions(+), 11 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
index 5279f81..324d2a9 100644
--- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
@@ -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::"));
 }
 
diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.cc b/src/bin/dhcp6/tests/dhcp6_test_utils.cc
index bf10a8e..7646ca3 100644
--- a/src/bin/dhcp6/tests/dhcp6_test_utils.cc
+++ b/src/bin/dhcp6/tests/dhcp6_test_utils.cc
@@ -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);
 
diff --git a/src/bin/dhcp6/tests/dhcp6_test_utils.h b/src/bin/dhcp6/tests/dhcp6_test_utils.h
index 539d368..6f2e03f 100644
--- a/src/bin/dhcp6/tests/dhcp6_test_utils.h
+++ b/src/bin/dhcp6/tests/dhcp6_test_utils.h
@@ -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
     ///



More information about the bind10-changes mailing list