Browse Source

[4254] Fixed exchange name for the DHCPv4 renewals in StatsMgr.

Marcin Siodelski 9 years ago
parent
commit
585bfc578f

+ 3 - 0
src/bin/perfdhcp/stats_mgr.h

@@ -114,6 +114,7 @@ public:
     enum ExchangeType {
     enum ExchangeType {
         XCHG_DO,  ///< DHCPv4 DISCOVER-OFFER
         XCHG_DO,  ///< DHCPv4 DISCOVER-OFFER
         XCHG_RA,  ///< DHCPv4 REQUEST-ACK
         XCHG_RA,  ///< DHCPv4 REQUEST-ACK
+        XCHG_RNA, ///< DHCPv4 REQUEST-ACK (renewal)
         XCHG_SA,  ///< DHCPv6 SOLICIT-ADVERTISE
         XCHG_SA,  ///< DHCPv6 SOLICIT-ADVERTISE
         XCHG_RR,  ///< DHCPv6 REQUEST-REPLY
         XCHG_RR,  ///< DHCPv6 REQUEST-REPLY
         XCHG_RN,  ///< DHCPv6 RENEW-REPLY
         XCHG_RN,  ///< DHCPv6 RENEW-REPLY
@@ -1179,6 +1180,8 @@ public:
             return("DISCOVER-OFFER");
             return("DISCOVER-OFFER");
         case XCHG_RA:
         case XCHG_RA:
             return("REQUEST-ACK");
             return("REQUEST-ACK");
+        case XCHG_RNA:
+            return("REQUEST-ACK (renewal)");
         case XCHG_SA:
         case XCHG_SA:
             return("SOLICIT-ADVERTISE");
             return("SOLICIT-ADVERTISE");
         case XCHG_RR:
         case XCHG_RR:

+ 5 - 5
src/bin/perfdhcp/test_control.cc

@@ -689,7 +689,7 @@ TestControl::initializeStatsMgr() {
                                           options.getDropTime()[1]);
                                           options.getDropTime()[1]);
         }
         }
         if (options.getRenewRate() != 0) {
         if (options.getRenewRate() != 0) {
-            stats_mgr4_->addExchangeStats(StatsMgr4::XCHG_RN);
+            stats_mgr4_->addExchangeStats(StatsMgr4::XCHG_RNA);
         }
         }
 
 
     } else if (options.getIpVersion() == 6) {
     } else if (options.getIpVersion() == 6) {
@@ -1119,7 +1119,7 @@ TestControl::processReceivedPacket4(const TestControlSocket& socket,
             // may need to keep this DHCPACK in the storage if renews. Note that,
             // may need to keep this DHCPACK in the storage if renews. Note that,
             // DHCPACK messages hold the information about leases assigned.
             // DHCPACK messages hold the information about leases assigned.
             // We use this information to renew.
             // We use this information to renew.
-            if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RN)) {
+            if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RNA)) {
                 // Renew messages are sent, because StatsMgr has the
                 // Renew messages are sent, because StatsMgr has the
                 // specific exchange type specified. Let's append the DHCPACK.
                 // specific exchange type specified. Let's append the DHCPACK.
                 // message to a storage
                 // message to a storage
@@ -1130,8 +1130,8 @@ TestControl::processReceivedPacket4(const TestControlSocket& socket,
         // renewal. In this case we first check if StatsMgr has exchange type
         // renewal. In this case we first check if StatsMgr has exchange type
         // for renew specified, and if it has, if there is a corresponding
         // for renew specified, and if it has, if there is a corresponding
         // renew message for the received DHCPACK.
         // renew message for the received DHCPACK.
-        } else if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RN)) {
-            stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RN, pkt4);
+        } else if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RNA)) {
+            stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RNA, pkt4);
         }
         }
     }
     }
 }
 }
@@ -1657,7 +1657,7 @@ TestControl::sendRequestFromAck(const TestControlSocket& socket) {
         isc_throw(Unexpected, "Statistics Manager for DHCPv4 "
         isc_throw(Unexpected, "Statistics Manager for DHCPv4 "
                   "hasn't been initialized");
                   "hasn't been initialized");
     }
     }
-    stats_mgr4_->passSentPacket(StatsMgr4::XCHG_RN, msg);
+    stats_mgr4_->passSentPacket(StatsMgr4::XCHG_RNA, msg);
     return (true);
     return (true);
 }
 }
 
 

+ 3 - 0
src/bin/perfdhcp/tests/stats_mgr_unittest.cc

@@ -265,6 +265,9 @@ TEST_F(StatsMgrTest, ExchangeToString) {
     EXPECT_EQ("DISCOVER-OFFER",
     EXPECT_EQ("DISCOVER-OFFER",
               StatsMgr4::exchangeToString(StatsMgr4::XCHG_DO));
               StatsMgr4::exchangeToString(StatsMgr4::XCHG_DO));
     EXPECT_EQ("REQUEST-ACK", StatsMgr4::exchangeToString(StatsMgr4::XCHG_RA));
     EXPECT_EQ("REQUEST-ACK", StatsMgr4::exchangeToString(StatsMgr4::XCHG_RA));
+    EXPECT_EQ("REQUEST-ACK (renewal)",
+              StatsMgr4::exchangeToString(StatsMgr4::XCHG_RNA));
+
 
 
     // Test DHCPv6 specific exchange names.
     // Test DHCPv6 specific exchange names.
     EXPECT_EQ("SOLICIT-ADVERTISE",
     EXPECT_EQ("SOLICIT-ADVERTISE",