pkt_gen: Reporting FPS and MBPS from Spirent Testcenter 37/13637/2
authorsridharkn <sridhar.rao@spirent.com>
Wed, 4 May 2016 07:41:58 +0000 (13:11 +0530)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Wed, 4 May 2016 14:51:23 +0000 (14:51 +0000)
Support for reporting FPS and MBPS (TX and RX) is added.

JIRA: VSPERF-285

Change-Id: Ic4b6ca02368b1808f0f985e90099cdb0b41c2afa
Signed-off-by: sridharkn <sridhar.rao@spirent.com>
tools/pkt_gen/testcenter/testcenter.py

index b135115..2adf6c9 100644 (file)
@@ -149,10 +149,20 @@ class TestCenter(trafficgen.ITrafficGenerator):
             csvreader = csv.DictReader(csvfile)
             for row in csvreader:
                 self._logger.info("Row: %s", row)
-                result[ResultsConstants.TX_RATE_FPS] = 0.0
-                result[ResultsConstants.THROUGHPUT_RX_FPS] = 0.0
-                result[ResultsConstants.TX_RATE_MBPS] = 0.0
-                result[ResultsConstants.THROUGHPUT_RX_MBPS] = 0.0
+                tx_fps = ((float(row["TxFrameCount"])) /
+                          (float(row["Duration(sec)"])))
+                rx_fps = ((float(row["RxFrameCount"])) /
+                          (float(row["Duration(sec)"])))
+                tx_mbps = ((float(row["TxFrameCount"]) *
+                            float(row["ConfiguredFrameSize"])) /
+                           (float(row["Duration(sec)"]) * 1000000.0))
+                rx_mbps = ((float(row["RxFrameCount"]) *
+                            float(row["ConfiguredFrameSize"])) /
+                           (float(row["Duration(sec)"]) * 1000000.0))
+                result[ResultsConstants.TX_RATE_FPS] = tx_fps
+                result[ResultsConstants.THROUGHPUT_RX_FPS] = rx_fps
+                result[ResultsConstants.TX_RATE_MBPS] = tx_mbps
+                result[ResultsConstants.THROUGHPUT_RX_MBPS] = rx_mbps
                 result[ResultsConstants.TX_RATE_PERCENT] = float(
                     row["OfferedLoad(%)"])
                 result[ResultsConstants.THROUGHPUT_RX_PERCENT] = float(
@@ -260,10 +270,20 @@ class TestCenter(trafficgen.ITrafficGenerator):
             csvreader = csv.DictReader(csvfile)
             for row in csvreader:
                 self._logger.info("Row: %s", row)
-                result[ResultsConstants.TX_RATE_FPS] = 0.0
-                result[ResultsConstants.THROUGHPUT_RX_FPS] = 0.0
-                result[ResultsConstants.TX_RATE_MBPS] = 0.0
-                result[ResultsConstants.THROUGHPUT_RX_MBPS] = 0.0
+                tx_fps = ((float(row["TxFrameCount"])) /
+                          (float(row["Duration(sec)"])))
+                rx_fps = ((float(row["RxFrameCount"])) /
+                          (float(row["Duration(sec)"])))
+                tx_mbps = ((float(row["TxFrameCount"]) *
+                            float(row["ConfiguredFrameSize"])) /
+                           (float(row["Duration(sec)"]) * 1000000.0))
+                rx_mbps = ((float(row["RxFrameCount"]) *
+                            float(row["ConfiguredFrameSize"])) /
+                           (float(row["Duration(sec)"]) * 1000000.0))
+                result[ResultsConstants.TX_RATE_FPS] = tx_fps
+                result[ResultsConstants.THROUGHPUT_RX_FPS] = rx_fps
+                result[ResultsConstants.TX_RATE_MBPS] = tx_mbps
+                result[ResultsConstants.THROUGHPUT_RX_MBPS] = rx_mbps
                 result[ResultsConstants.TX_RATE_PERCENT] = float(
                     row["OfferedLoad(%)"])
                 result[ResultsConstants.THROUGHPUT_RX_PERCENT] = float(