test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework: enable RFC2544 support
@ 2015-12-11  3:24 Ding Heng
  2015-12-11  9:07 ` Liu, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Ding Heng @ 2015-12-11  3:24 UTC (permalink / raw)
  To: dts; +Cc: Ding Heng

Enable RFC2544 support for dts framework, add "delay" parameter for some
of the functions in file etgen.py and tester.py to make sure that test
cases could control the time to run. Affected case vmdq has been changed
to adapt the added return value.

Signed-off-by: Ding Heng <hengx.ding@intel.com>

diff --git a/framework/etgen.py b/framework/etgen.py
index 508439b..364499c 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -476,18 +476,18 @@ class IxiaPacketGenerator(SSHConnection):
 
         return {'card': int(m.group(1)), 'port': int(m.group(2))}
 
-    def loss(self, portList, ratePercent):
+    def loss(self, portList, ratePercent, delay=5):
         """
         Run loss performance test and return loss rate.
         """
         rxPortlist, txPortlist = self._configure_everything(portList, ratePercent)
-        return self.get_loss_packet_rate(rxPortlist, txPortlist)
+        return self.get_loss_packet_rate(rxPortlist, txPortlist, delay)
 
-    def get_loss_packet_rate(self, rxPortlist, txPortlist):
+    def get_loss_packet_rate(self, rxPortlist, txPortlist, delay=5):
         """
         Get RX/TX packet statistics and calculate loss rate.
         """
-        time.sleep(3)
+        time.sleep(delay)
 
         self.send_expect("ixStopTransmit portList", "%", 10)
         time.sleep(2)
@@ -507,7 +507,7 @@ class IxiaPacketGenerator(SSHConnection):
             revNumber += self.get_frames_received()
         self.logger.info("rev  :%f" % revNumber)
 
-        return float(sendNumber - revNumber) / sendNumber
+        return float(sendNumber - revNumber) / sendNumber, sendNumber, revNumber
 
     def latency(self, portList, ratePercent, delay=5):
         """
@@ -801,7 +801,12 @@ class IxiaPacketGenerator(SSHConnection):
         Returns the number of packets captured by IXIA on a previously set
         port. Call self.stat_get_stat_all_stats(port) before.
         """
-        return self._stat_cget_value('framesReceived')
+        if self._stat_cget_value('framesReceived') !=0:
+            return self._stat_cget_value('framesReceived')
+        else:
+        #if the packet size is large than 1518, this line will avoid return
+        #a wrong number
+            return self._stat_cget_value('oversize')
 
     def get_flow_control_frames(self):
         """
diff --git a/framework/tester.py b/framework/tester.py
index b102065..e47160f 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -414,7 +414,33 @@ class Tester(Crb):
             return None
         return self.packet_gen.throughput(portList, rate_percent)
 
-    def traffic_generator_loss(self, portList, ratePercent):
+    def run_rfc2544(self, portlist, delay=120):
+        """
+        zero_rate: dpdk will not lost packet in this line rate.
+        loss_rate: dpdk will loss packet in this line rate.
+        test_rate: the line rate we are going to test.
+        """
+        zero_rate = 0.0
+        loss_rate = 100.0
+        test_rate = 100.0
+
+        while (loss_rate - zero_rate) > 0.002:
+                self.logger.info("test rate: %f " % test_rate)
+                if test_rate == 100:
+                        lost, tx_num, rx_num = self.traffic_generator_loss(portlist, test_rate, delay)
+                else:
+                        lost, _, _ = self.traffic_generator_loss(portlist, test_rate, delay)
+                if lost != 0:
+                        loss_rate = test_rate
+                        test_rate = (test_rate + zero_rate)/2
+                else:
+                        zero_rate = test_rate
+                        test_rate = (test_rate + loss_rate)/2
+
+        self.logger.info("zero loss rate is %s" % test_rate)
+        return test_rate, tx_num, rx_num
+
+    def traffic_generator_loss(self, portList, ratePercent, delay=60):
         """
         Run loss performance test on specified ports.
         """
@@ -423,7 +449,7 @@ class Tester(Crb):
         elif not self.check_port_list(portList):
             self.logger.warning("exception by mixed port types")
             return None
-        return self.packet_gen.loss(portList, ratePercent)
+        return self.packet_gen.loss(portList, ratePercenti, delay)
 
     def traffic_generator_latency(self, portList, ratePercent=100, delay=5):
         """
diff --git a/tests/TestSuite_vmdq.py b/tests/TestSuite_vmdq.py
index de5a86f..429870a 100644
--- a/tests/TestSuite_vmdq.py
+++ b/tests/TestSuite_vmdq.py
@@ -115,7 +115,7 @@ class TestVmdq(TestCase, IxiaPacketGenerator):
             self.tester.scapy_execute()
             tgen_input.append((tx_port, rx_port, "test%d.pcap" %p))
 
-        loss = self.tester.traffic_generator_loss(tgen_input, 10)
+        loss, _, _ = self.tester.traffic_generator_loss(tgen_input, 10)
         print "loss is %s !" % loss
 
         # Verify the accurate
-- 
1.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [dts] [PATCH] framework: enable RFC2544 support
@ 2015-12-10  6:10 Ding Heng
  2015-12-11  0:58 ` Liu, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Ding Heng @ 2015-12-10  6:10 UTC (permalink / raw)
  To: dts; +Cc: Ding Heng

Enable RFC2544 support for dts framework, add "delay" parameter for some of the
functions in file etgen.py and tester.py to make sure that test cases could
control the time to run.

Signed-off-by: Ding Heng <hengx.ding@intel.com>

diff --git a/framework/etgen.py b/framework/etgen.py
index 508439b..37c4ff3 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -476,18 +476,18 @@ class IxiaPacketGenerator(SSHConnection):
 
         return {'card': int(m.group(1)), 'port': int(m.group(2))}
 
-    def loss(self, portList, ratePercent):
+    def loss(self, portList, ratePercent, delay=5):
         """
         Run loss performance test and return loss rate.
         """
         rxPortlist, txPortlist = self._configure_everything(portList, ratePercent)
-        return self.get_loss_packet_rate(rxPortlist, txPortlist)
+        return self.get_loss_packet_rate(rxPortlist, txPortlist, delay)
 
-    def get_loss_packet_rate(self, rxPortlist, txPortlist):
+    def get_loss_packet_rate(self, rxPortlist, txPortlist, delay=5):
         """
         Get RX/TX packet statistics and calculate loss rate.
         """
-        time.sleep(3)
+        time.sleep(delay)
 
         self.send_expect("ixStopTransmit portList", "%", 10)
         time.sleep(2)
@@ -507,7 +507,7 @@ class IxiaPacketGenerator(SSHConnection):
             revNumber += self.get_frames_received()
         self.logger.info("rev  :%f" % revNumber)
 
-        return float(sendNumber - revNumber) / sendNumber
+        return float(sendNumber - revNumber) / sendNumber, sendNumber, revNumber
 
     def latency(self, portList, ratePercent, delay=5):
         """
@@ -801,7 +801,10 @@ class IxiaPacketGenerator(SSHConnection):
         Returns the number of packets captured by IXIA on a previously set
         port. Call self.stat_get_stat_all_stats(port) before.
         """
-        return self._stat_cget_value('framesReceived')
+        if self._stat_cget_value('framesReceived') !=0:
+            return self._stat_cget_value('framesReceived')
+        else:
+            return self._stat_cget_value('oversize')
 
     def get_flow_control_frames(self):
         """
diff --git a/framework/tester.py b/framework/tester.py
index b102065..9446854 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -413,8 +413,33 @@ class Tester(Crb):
             self.logger.warning("exception by mixed port types")
             return None
         return self.packet_gen.throughput(portList, rate_percent)
+    def run_rfc2544(self, portlist, delay=120):
+        """
+        zero_rate: dpdk will not lost packet in this line rate.
+        loss_rate: dpdk will loss packet in this line rate.
+        test_rate: the line rate we are going to test.
+        """
+        zero_rate = 0.0
+        loss_rate = 100.0
+        test_rate = 100.0
+
+        while (loss_rate - zero_rate) > 0.002:
+                self.logger.info("test rate: %f " % test_rate)
+                if test_rate == 100:
+                        lost, tx_num, rx_num = self.traffic_generator_loss(portlist, test_rate, delay)
+                else:
+                        lost, _, _ = self.traffic_generator_loss(portlist, test_rate, delay)
+                if lost != 0:
+                        loss_rate = test_rate
+                        test_rate = (test_rate + zero_rate)/2
+                else:
+                        zero_rate = test_rate
+                        test_rate = (test_rate + loss_rate)/2
+
+        self.logger.info("zero loss rate is %s" % test_rate)
+        return test_rate, tx_num, rx_num
 
-    def traffic_generator_loss(self, portList, ratePercent):
+    def traffic_generator_loss(self, portList, ratePercent, delay=60):
         """
         Run loss performance test on specified ports.
         """
@@ -423,7 +448,7 @@ class Tester(Crb):
         elif not self.check_port_list(portList):
             self.logger.warning("exception by mixed port types")
             return None
-        return self.packet_gen.loss(portList, ratePercent)
+        return self.packet_gen.loss(portList, ratePercenti, delay)
 
     def traffic_generator_latency(self, portList, ratePercent=100, delay=5):
         """
-- 
1.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-11  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11  3:24 [dts] [PATCH] framework: enable RFC2544 support Ding Heng
2015-12-11  9:07 ` Liu, Yong
  -- strict thread matches above, loose matches on Subject: below --
2015-12-10  6:10 Ding Heng
2015-12-11  0:58 ` Liu, Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).