Browse Source

[3336] Addressed review comments.

Marcin Siodelski 11 years ago
parent
commit
58e623537d

+ 5 - 0
doc/guide/bind10-guide.xml

@@ -2191,6 +2191,11 @@ Dhcp4/dhcp-ddns/qualifying-suffix	"example.com"	string
         and apply to all defined subnets, unless they are overridden on a
         per-subnet basis.
       </para>
+      <para>
+        The renew-timer and rebind-timer are optional. If they are not specified,
+        the DHCPv4 options 58 and 59 are not sent in the server's response to the
+        client.
+      </para>
 
       <section>
       <title>Default storage for leases</title>

+ 7 - 4
src/bin/dhcp4/tests/dhcp4_test_utils.cc

@@ -242,7 +242,7 @@ HWAddrPtr Dhcpv4SrvTest::generateHWAddr(size_t size /*= 6*/) {
 void Dhcpv4SrvTest::checkAddressParams(const Pkt4Ptr& rsp,
                                        const SubnetPtr subnet,
                                        bool t1_present,
-                                       bool t2_present /*= false*/) {
+                                       bool t2_present) {
 
     // Technically inPool implies inRange, but let's be on the safe
     // side and check both.
@@ -253,7 +253,8 @@ void Dhcpv4SrvTest::checkAddressParams(const Pkt4Ptr& rsp,
     OptionUint32Ptr opt = boost::dynamic_pointer_cast<
         OptionUint32>(rsp->getOption(DHO_DHCP_LEASE_TIME));
     if (!opt) {
-        ADD_FAILURE() << "Lease time option missing in response";
+        ADD_FAILURE() << "Lease time option missing in response or the"
+            " option has unexpected type";
     } else {
         EXPECT_EQ(opt->getValue(), subnet->getValid());
     }
@@ -262,7 +263,8 @@ void Dhcpv4SrvTest::checkAddressParams(const Pkt4Ptr& rsp,
     opt = boost::dynamic_pointer_cast<
         OptionUint32>(rsp->getOption(DHO_DHCP_RENEWAL_TIME));
     if (t1_present) {
-        ASSERT_TRUE(opt) << "Required T1 option missing";
+        ASSERT_TRUE(opt) << "Required T1 option missing or it has"
+            " an unexpected type";
         EXPECT_EQ(opt->getValue(), subnet->getT1());
     } else {
         EXPECT_FALSE(opt);
@@ -272,7 +274,8 @@ void Dhcpv4SrvTest::checkAddressParams(const Pkt4Ptr& rsp,
     opt = boost::dynamic_pointer_cast<
         OptionUint32>(rsp->getOption(DHO_DHCP_REBINDING_TIME));
     if (t2_present) {
-        ASSERT_TRUE(opt) << "Required T2 option missing";
+        ASSERT_TRUE(opt) << "Required T2 option missing or it has"
+            " an unexpected type";
         EXPECT_EQ(opt->getValue(), subnet->getT2());
     } else {
         EXPECT_FALSE(opt);

+ 14 - 0
src/bin/dhcp6/tests/config_parser_unittest.cc

@@ -358,6 +358,8 @@ public:
         // all interfaces before each test and later check that this setting
         // has been overriden by the configuration used in the test.
         CfgMgr::instance().deleteActiveIfaces();
+        // Create fresh context.
+        globalContext()->copyContext(ParserContext(Option::V6));
     }
 
     /// @brief Test invalid option parameter value.
@@ -2002,6 +2004,8 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) {
     // belongs to the 'dhcp6' option space as it is the
     // standard option.
     string config = "{ \"interfaces\": [ \"*\" ],"
+        "\"preferred-lifetime\": 3000,"
+        "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
         "\"renew-timer\": 1000,"
         "\"option-data\": [ {"
@@ -2081,6 +2085,8 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
 
     // Starting stage 1. Configure sub-options and their definitions.
     string config = "{ \"interfaces\": [ \"*\" ],"
+        "\"preferred-lifetime\": 3000,"
+        "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
         "\"renew-timer\": 1000,"
         "\"option-data\": [ {"
@@ -2540,6 +2546,8 @@ TEST_F(Dhcp6ParserTest, vendorOptionsHex) {
     // sharing the code 1 and belonging to the different vendor spaces.
     // (different vendor-id values).
     string config = "{ \"interfaces\": [ \"*\" ],"
+        "\"preferred-lifetime\": 3000,"
+        "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
         "\"renew-timer\": 1000,"
         "\"option-data\": [ {"
@@ -2598,6 +2606,8 @@ TEST_F(Dhcp6ParserTest, vendorOptionsCsv) {
     // sharing the code 1 and belonging to the different vendor spaces.
     // (different vendor-id values).
     string config = "{ \"interfaces\": [ \"*\" ],"
+        "\"preferred-lifetime\": 3000,"
+        "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
         "\"renew-timer\": 1000,"
         "\"option-data\": [ {"
@@ -2658,6 +2668,8 @@ TEST_F(Dhcp6ParserTest, stdOptionDataEncapsulate) {
     // that we will add to the base option.
     // Let's create some dummy options: foo and foo2.
     string config = "{ \"interfaces\": [ \"*\" ],"
+        "\"preferred-lifetime\": 3000,"
+        "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000,"
         "\"renew-timer\": 1000,"
         "\"option-data\": [ {"
@@ -3157,6 +3169,8 @@ TEST_F(Dhcp6ParserTest, d2ClientConfig) {
     ASSERT_FALSE(CfgMgr::instance().ddnsEnabled());
 
     string config_str = "{ \"interfaces\": [ \"*\" ],"
+        "\"preferred-lifetime\": 3000,"
+        "\"valid-lifetime\": 4000,"
         "\"rebind-timer\": 2000, "
         "\"renew-timer\": 1000, "
         "\"subnet6\": [ { "