Merge "rstp-stp: Add basic functions for stp/rstp enable on ovs"
[vswitchperf.git] / tools / pkt_gen / ixia / ixia.py
index 3a4f844..ae5da6d 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2016 Intel Corporation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -211,12 +211,12 @@ class Ixia(trafficgen.ITrafficGenerator):
 
         return result
 
-    def send_burst_traffic(self, traffic=None, numpkts=100, time=20):
+    def send_burst_traffic(self, traffic=None, numpkts=100, duration=20):
         """See ITrafficGenerator for description
         """
         flow = {
             'numpkts': numpkts,
-            'time': time,
+            'duration': duration,
             'type': 'stopStream',
             'framerate': traffic['frame_rate'],
         }
@@ -227,12 +227,12 @@ class Ixia(trafficgen.ITrafficGenerator):
 
         #TODO - implement Burst results setting via TrafficgenResults.
 
-    def send_cont_traffic(self, traffic=None, time=20, multistream=False):
+    def send_cont_traffic(self, traffic=None, duration=30):
         """See ITrafficGenerator for description
         """
         flow = {
             'numpkts': 100,
-            'time': time,
+            'duration': duration,
             'type': 'contPacket',
             'framerate': traffic['frame_rate'],
             'multipleStreams': traffic['multistream'],
@@ -242,7 +242,7 @@ class Ixia(trafficgen.ITrafficGenerator):
 
         return Ixia._create_result(result)
 
-    def start_cont_traffic(self, traffic=None, time=20):
+    def start_cont_traffic(self, traffic=None, duration=30):
         """See ITrafficGenerator for description
         """
         return self.send_cont_traffic(traffic, 0)
@@ -252,8 +252,7 @@ class Ixia(trafficgen.ITrafficGenerator):
         """
         return self.run_tcl('stopTraffic')
 
-    def send_rfc2544_throughput(self, traffic=None, trials=3, duration=20,
-                                lossrate=0.0, multistream=False):
+    def send_rfc2544_throughput(self, traffic=None, trials=3, duration=20, lossrate=0.0):
         """See ITrafficGenerator for description
         """
         params = {}
@@ -289,15 +288,20 @@ class Ixia(trafficgen.ITrafficGenerator):
         """
         assert len(result) == 8  # fail-fast if underlying Tcl code changes
 
+        if float(result[0]) == 0:
+            loss_rate = 100
+        else:
+            loss_rate = (float(result[0]) - float(result[1])) / float(result[0]) * 100
         result_dict = OrderedDict()
         # drop the first 4 elements as we don't use/need them. In
         # addition, IxExplorer does not support latency or % line rate
         # metrics so we have to return dummy values for these metrics
         result_dict[ResultsConstants.THROUGHPUT_RX_FPS] = result[4]
-        result_dict[ResultsConstants.THROUGHPUT_TX_FPS] = result[5]
+        result_dict[ResultsConstants.TX_RATE_FPS] = result[5]
         result_dict[ResultsConstants.THROUGHPUT_RX_MBPS] = result[6]
-        result_dict[ResultsConstants.THROUGHPUT_TX_MBPS] = result[7]
-        result_dict[ResultsConstants.THROUGHPUT_TX_PERCENT] = \
+        result_dict[ResultsConstants.TX_RATE_MBPS] = result[7]
+        result_dict[ResultsConstants.FRAME_LOSS_PERCENT] = loss_rate
+        result_dict[ResultsConstants.TX_RATE_PERCENT] = \
                                             ResultsConstants.UNKNOWN_VALUE
         result_dict[ResultsConstants.THROUGHPUT_RX_PERCENT] = \
                                             ResultsConstants.UNKNOWN_VALUE