summaryrefslogtreecommitdiffstats
path: root/tools/pkt_gen/xena/xena.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-01-24 08:12:40 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-01-24 08:12:40 +0000
commit196f6f0a4d59bed049e2d03da6259e9ed6d44fb0 (patch)
tree7b3c0a9d0484f6d6f60e8d6f63cd46622eede101 /tools/pkt_gen/xena/xena.py
parent14c3ad198f680fb1477f59af79fccc72e1ad8389 (diff)
parent69751e8b32691c4e82cb83c98130b0d8e1934d75 (diff)
Merge "xena_cont_accuracy_fix: Xena continuous traffic accuracy fixes"
Diffstat (limited to 'tools/pkt_gen/xena/xena.py')
-rwxr-xr-xtools/pkt_gen/xena/xena.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py
index f5415d52..e251c1d6 100755
--- a/tools/pkt_gen/xena/xena.py
+++ b/tools/pkt_gen/xena/xena.py
@@ -188,9 +188,10 @@ class Xena(ITrafficGenerator):
result_dict[ResultsConstants.TX_FRAMES] = self.tx_stats.data[
self.tx_stats.pt_stream_keys[0]]['packets']
result_dict[ResultsConstants.TX_RATE_FPS] = self.tx_stats.data[
- self.tx_stats.pt_stream_keys[0]]['pps']
- result_dict[ResultsConstants.TX_RATE_MBPS] = self.tx_stats.data[
- self.tx_stats.pt_stream_keys[0]]['bps'] / 1000000
+ self.tx_stats.pt_stream_keys[0]]['packets'] / self._duration
+ result_dict[ResultsConstants.TX_RATE_MBPS] = ((
+ self.tx_stats.data[self.tx_stats.pt_stream_keys[0]]['bytes']
+ * 8) / 1000000) / self._duration
result_dict[ResultsConstants.TX_BYTES] = self.tx_stats.data[
self.tx_stats.pt_stream_keys[0]]['bytes']
# tx rate percent may need to be halved if bi directional
@@ -214,10 +215,11 @@ class Xena(ITrafficGenerator):
'pr_tpldstraffic']['0']['packets']
result_dict[
ResultsConstants.THROUGHPUT_RX_FPS] = self.rx_stats.data[
- 'pr_tpldstraffic']['0']['pps']
+ 'pr_tpldstraffic']['0']['packets'] / self._duration
result_dict[
- ResultsConstants.THROUGHPUT_RX_MBPS] = self.rx_stats.data[
- 'pr_tpldstraffic']['0']['bps'] / 1000000
+ ResultsConstants.THROUGHPUT_RX_MBPS] = ((
+ self.rx_stats.data['pr_tpldstraffic']['0']['bytes']
+ *8) / 1000000) / self._duration
result_dict[ResultsConstants.RX_BYTES] = self.rx_stats.data[
'pr_tpldstraffic']['0']['bytes']
# throughput percent may need to be halved if bi directional
@@ -404,6 +406,8 @@ class Xena(ITrafficGenerator):
settings.getValue('TRAFFICGEN_XENA_PORT1_IP'),
settings.getValue('TRAFFICGEN_XENA_PORT1_CIDR'),
settings.getValue('TRAFFICGEN_XENA_PORT1_GATEWAY'))
+ self.xmanager.ports[0].set_port_time_limit(self._duration)
+ self.xmanager.ports[1].set_port_time_limit(self._duration)
def setup_stream(stream, port, payload_id, flip_addr=False):
"""
@@ -468,7 +472,7 @@ class Xena(ITrafficGenerator):
if not self.xmanager.ports[1].traffic_on():
self._logger.error(
"Failure to start port 1. Check settings and retry.")
- sleep(self._duration + 1)
+ sleep(self._duration + 5) # the extra 5 seconds is to allow packets in flight to complete
# getting results
if self._params['traffic']['bidir'] == 'True':
# need to aggregate out both ports stats and assign that data