summaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_gen/trex.py
diff options
context:
space:
mode:
authorKerim Gokarslan <kgokarsl@cisco.com>2017-09-13 20:26:01 -0700
committerKerim Gokarslan <kgokarsl@cisco.com>2017-09-19 11:40:38 -0700
commit5bfd65ce5753b27c32afb9f84cf5b268f060cb03 (patch)
treec1d27b1b3f937d7deaf1421c8e60dd05c5ccb907 /nfvbench/traffic_gen/trex.py
parent4e74e931fb22017abffbe0c4dbed668d5be14e54 (diff)
NFVBENCH-25 Send run results to fluentd
Change-Id: I671a9297b90784bc30eee48ea9244a9c63a24e85 Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
Diffstat (limited to 'nfvbench/traffic_gen/trex.py')
-rw-r--r--nfvbench/traffic_gen/trex.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py
index 8aca290..a9effab 100644
--- a/nfvbench/traffic_gen/trex.py
+++ b/nfvbench/traffic_gen/trex.py
@@ -27,7 +27,6 @@ from traffic_base import AbstractTrafficGenerator
from traffic_base import TrafficGeneratorException
import traffic_utils as utils
-
from trex_stl_lib.api import CTRexVmInsFixHwCs
from trex_stl_lib.api import Dot1Q
from trex_stl_lib.api import Ether
@@ -49,7 +48,6 @@ from trex_stl_lib.services.trex_stl_service_arp import STLServiceARP
class TRex(AbstractTrafficGenerator):
-
LATENCY_PPS = 1000
def __init__(self, runner):
@@ -75,27 +73,30 @@ class TRex(AbstractTrafficGenerator):
stats = self.__combine_stats(in_stats, ph)
result[ph] = {
'tx': {
- 'total_pkts': stats['tx_pkts']['total'],
- 'total_pkt_bytes': stats['tx_bytes']['total'],
- 'pkt_rate': stats['tx_pps']['total'],
- 'pkt_bit_rate': stats['tx_bps']['total']
+ 'total_pkts': int(stats['tx_pkts']['total']),
+ 'total_pkt_bytes': int(stats['tx_bytes']['total']),
+ 'pkt_rate': int(stats['tx_pps']['total']),
+ 'pkt_bit_rate': int(stats['tx_bps']['total'])
},
'rx': {
- 'total_pkts': stats['rx_pkts']['total'],
- 'total_pkt_bytes': stats['rx_bytes']['total'],
- 'pkt_rate': stats['rx_pps']['total'],
- 'pkt_bit_rate': stats['rx_bps']['total'],
- 'dropped_pkts': stats['tx_pkts']['total'] - stats['rx_pkts']['total']
+ 'total_pkts': int(stats['rx_pkts']['total']),
+ 'total_pkt_bytes': int(stats['rx_bytes']['total']),
+ 'pkt_rate': int(stats['rx_pps']['total']),
+ 'pkt_bit_rate': int(stats['rx_bps']['total']),
+ 'dropped_pkts': int(stats['tx_pkts']['total'] - stats['rx_pkts']['total'])
}
}
lat = self.__combine_latencies(in_stats, ph)
- result[ph]['rx']['max_delay_usec'] = lat.get('total_max', float('nan'))
- result[ph]['rx']['min_delay_usec'] = lat.get('total_min', float('nan'))
- result[ph]['rx']['avg_delay_usec'] = lat.get('average', float('nan'))
-
+ result[ph]['rx']['max_delay_usec'] = int(
+ lat['total_max']) if 'total_max' in lat else float('nan')
+ result[ph]['rx']['min_delay_usec'] = int(
+ lat['total_min']) if 'total_min' in lat else float('nan')
+ result[ph]['rx']['avg_delay_usec'] = int(
+ lat['average']) if 'average' in lat else float(
+ 'nan')
total_tx_pkts = result[0]['tx']['total_pkts'] + result[1]['tx']['total_pkts']
- result["total_tx_rate"] = total_tx_pkts / self.config.duration_sec
+ result["total_tx_rate"] = int(total_tx_pkts / self.config.duration_sec)
return result
def __combine_stats(self, in_stats, port_handle):