BIND 10 trac3183, updated. 4527401f4afbd8f7a9dafb7296863d01da0d8c09 [3183] Implemented -f command line parameter to control renew rate.

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Oct 7 13:31:15 UTC 2013


The branch, trac3183 has been updated
       via  4527401f4afbd8f7a9dafb7296863d01da0d8c09 (commit)
      from  2c20227ed4c9f1ccb5184e8c9698dcf7a7e79c4d (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 4527401f4afbd8f7a9dafb7296863d01da0d8c09
Author: Marcin Siodelski <marcin at isc.org>
Date:   Mon Oct 7 15:30:52 2013 +0200

    [3183] Implemented -f command line parameter to control renew rate.

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

Summary of changes:
 tests/tools/perfdhcp/command_options.cc            |   38 +++++++++++++++-----
 tests/tools/perfdhcp/command_options.h             |    7 ++++
 .../perfdhcp/tests/command_options_unittest.cc     |   27 ++++++++++++++
 3 files changed, 64 insertions(+), 8 deletions(-)

-----------------------------------------------------------------------
diff --git a/tests/tools/perfdhcp/command_options.cc b/tests/tools/perfdhcp/command_options.cc
index 7df1ea4..45c73e7 100644
--- a/tests/tools/perfdhcp/command_options.cc
+++ b/tests/tools/perfdhcp/command_options.cc
@@ -111,6 +111,7 @@ CommandOptions::reset() {
     exchange_mode_ = DORA_SARR;
     lease_type_.set(LeaseType::ADDRESS);
     rate_ = 0;
+    renew_rate_ = 0;
     report_delay_ = 0;
     clients_num_ = 0;
     mac_template_.assign(mac, mac + 6);
@@ -208,7 +209,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
     // In this section we collect argument values from command line
     // they will be tuned and validated elsewhere
     while((opt = getopt(argc, argv, "hv46r:t:R:b:n:p:d:D:l:P:a:L:"
-                        "s:iBc1T:X:O:E:S:I:x:w:e:")) != -1) {
+                        "s:iBc1T:X:O:E:S:I:x:w:e:f:")) != -1) {
         stream << " -" << static_cast<char>(opt);
         if (optarg) {
             stream << " " << optarg;
@@ -299,6 +300,11 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
                                              " must not be a negative integer");
             break;
 
+        case 'f':
+            renew_rate_ = positiveInteger("value of the renew rate: -f<renew-rate>"
+                                          " must be a positive integer");
+            break;
+
         case 'h':
             usage();
             return (true);
@@ -680,6 +686,8 @@ CommandOptions::validate() const {
           "-B is not compatible with IPv6 (-6)");
     check((getIpVersion() != 6) && (isRapidCommit() != 0),
           "-6 (IPv6) must be set to use -c");
+    check((getIpVersion() != 6) && (getRenewRate() !=0),
+          "-f<renew-rate> may be used with -6 (IPv6) only");
     check((getExchangeMode() == DO_SA) && (getNumRequests().size() > 1),
           "second -n<num-request> is not compatible with -i");
     check((getIpVersion() == 4) && !getLeaseType().is(LeaseType::ADDRESS),
@@ -718,6 +726,12 @@ CommandOptions::validate() const {
     check((getRate() == 0) &&
           ((getMaxDrop().size() > 0) || getMaxDropPercentage().size() > 0),
           "-r<rate> must be set to use -D<max-drop>\n");
+    check((getRate() != 0) && (getRenewRate() > getRate()),
+          "Renew rate specified as -f<renew-rate> must not be freater than"
+          " the rate specified as -r<rate>");
+    check((getRate() == 0) && (getRenewRate() != 0),
+          "Renew rate specified as -f<renew-rate> must not be specified"
+          " when -r<rate> parameter is not specified");
     check((getTemplateFiles().size() < getTransactionIdOffset().size()),
           "-T<template-file> must be set to use -X<xid-offset>\n");
     check((getTemplateFiles().size() < getRandomOffset().size()),
@@ -793,6 +807,9 @@ CommandOptions::printCommandLine() const {
     if (rate_ != 0) {
         std::cout << "rate[1/s]=" << rate_ <<  std::endl;
     }
+    if (getRenewRate() != 0) {
+        std::cout << "renew-rate[1/s]=" << getRenewRate() << std::endl;
+    }
     if (report_delay_ != 0) {
         std::cout << "report[s]=" << report_delay_ << std::endl;
     }
@@ -875,13 +892,14 @@ CommandOptions::printCommandLine() const {
 void
 CommandOptions::usage() const {
     std::cout <<
-        "perfdhcp [-hv] [-4|-6] [-e<lease-type>] [-r<rate>] [-t<report>]\n"
-        "    [-R<range>] [-b<base>] [-n<num-request>] [-p<test-period>]\n"
-        "    [-d<drop-time>] [-D<max-drop>] [-l<local-addr|interface>]\n"
-        "    [-P<preload>] [-a<aggressivity>] [-L<local-port>] [-s<seed>]\n"
-        "    [-i] [-B] [-c] [-1] [-T<template-file>] [-X<xid-offset>]\n"
-        "    [-O<random-offset] [-E<time-offset>] [-S<srvid-offset>]\n"
-        "    [-I<ip-offset>] [-x<diagnostic-selector>] [-w<wrapped>] [server]\n"
+        "perfdhcp [-hv] [-4|-6] [-e<lease-type>] [-r<rate>] [-f<renew-rate>]\n"
+        "         [-t<report>] [-R<range>] [-b<base>] [-n<num-request>]\n"
+        "         [-p<test-period>] [-d<drop-time>] [-D<max-drop>]\n"
+        "         [-l<local-addr|interface>] [-P<preload>] [-a<aggressivity>]\n"
+        "         [-L<local-port>] [-s<seed>] [-i] [-B] [-c] [-1]\n"
+        "         [-T<template-file>] [-X<xid-offset>] [-O<random-offset]\n"
+        "         [-E<time-offset>] [-S<srvid-offset>] [-I<ip-offset>]\n"
+        "         [-x<diagnostic-selector>] [-w<wrapped>] [server]\n"
         "\n"
         "The [server] argument is the name/address of the DHCP server to\n"
         "contact.  For DHCPv4 operation, exchanges are initiated by\n"
@@ -924,6 +942,10 @@ CommandOptions::usage() const {
         "-E<time-offset>: Offset of the (DHCPv4) secs field / (DHCPv6)\n"
         "    elapsed-time option in the (second/request) template.\n"
         "    The value 0 disables it.\n"
+        "-f<renew-rate>: A rate at which IPv6 Renew requests are sent to\n"
+        "    a server. This value must not be equal or lower than the rate\n"
+        "    specified as -r<rate>. If -r<rate> is not specified, this\n"
+        "    parameter must not be specified too.\n"
         "-h: Print this help.\n"
         "-i: Do only the initial part of an exchange: DO or SA, depending on\n"
         "    whether -6 is given.\n"
diff --git a/tests/tools/perfdhcp/command_options.h b/tests/tools/perfdhcp/command_options.h
index 7431057..4912fc8 100644
--- a/tests/tools/perfdhcp/command_options.h
+++ b/tests/tools/perfdhcp/command_options.h
@@ -155,6 +155,11 @@ public:
     /// \return exchange rate per second.
     int getRate() const { return rate_; }
 
+    /// \brief Returns a rate at which IPv6 Renew messages are sent.
+    ///
+    /// \return A rate at which IPv6 Renew messages are sent.
+    int getRenewRate() const { return (renew_rate_); }
+
     /// \brief Returns delay between two performance reports.
     ///
     /// \return delay between two consecutive performance reports.
@@ -461,6 +466,8 @@ private:
     LeaseType lease_type_;
     /// Rate in exchange per second
     int rate_;
+    /// A rate at which DHCPv6 Renew messages are sent.
+    int renew_rate_;
     /// Delay between generation of two consecutive
     /// performance reports
     int report_delay_;
diff --git a/tests/tools/perfdhcp/tests/command_options_unittest.cc b/tests/tools/perfdhcp/tests/command_options_unittest.cc
index d323782..d37c27d 100644
--- a/tests/tools/perfdhcp/tests/command_options_unittest.cc
+++ b/tests/tools/perfdhcp/tests/command_options_unittest.cc
@@ -334,6 +334,33 @@ TEST_F(CommandOptionsTest, Rate) {
                  isc::InvalidParameter);
 }
 
+TEST_F(CommandOptionsTest, RenewRate) {
+    CommandOptions& opt = CommandOptions::instance();
+    // If -f is specified together with -r the command line should
+    // be accepted and the renew rate should be set.
+    EXPECT_NO_THROW(process("perfdhcp -6 -r 10 -f 10 -l ethx all"));
+    EXPECT_EQ(10, opt.getRenewRate());
+    // Check that the release rate can be set to different value than
+    // rate specified as -r<rate>. Also, swap -f na d-r to make sure
+    // that order doesn't matter.
+    EXPECT_NO_THROW(process("perfdhcp -6 -f 5 -r 10 -l ethx all"));
+    EXPECT_EQ(5, opt.getRenewRate());
+    // The renew-rate of 0 is invalid.
+    EXPECT_THROW(process("perfdhcp -6 -r 10 -f 0 - l ethx all"),
+                 isc::InvalidParameter);
+    // If -r<rate> is not specified the -f<renew-rate> should not
+    // be accepted.
+    EXPECT_THROW(process("perfdhcp -6 -f 10 -l ethx all"),
+                 isc::InvalidParameter);
+    // Currently the -f<renew-rate> can be specified for IPv6 mode
+    // only.
+    EXPECT_THROW(process("perfdhcp -4 -r 10 -f 10 -l ethx all"),
+                 isc::InvalidParameter);
+    // Renew rate should be specified.
+    EXPECT_THROW(process("perfdhcp -6 -r 10 -f -l ethx all"),
+                 isc::InvalidParameter);
+}
+
 TEST_F(CommandOptionsTest, ReportDelay) {
     CommandOptions& opt = CommandOptions::instance();
     EXPECT_NO_THROW(process("perfdhcp -r 100 -t 17 -l ethx all"));



More information about the bind10-changes mailing list