aboutsummaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_gen
diff options
context:
space:
mode:
authorKerim Gokarslan <kgokarsl@cisco.com>2017-09-13 20:26:01 -0700
committerahothan <ahothan@cisco.com>2017-10-20 00:37:13 -0700
commitf6a699e63dae2bb5779bd757dc62217193139ad9 (patch)
tree3073883ca7a8a771daeebbfef7f89dcc9f6f2753 /nfvbench/traffic_gen
parentd6d77669fcb13c779d869929a95ec9e9474b3fcf (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')
-rw-r--r--nfvbench/traffic_gen/traffic_utils.py4
-rw-r--r--nfvbench/traffic_gen/trex.py33
2 files changed, 19 insertions, 18 deletions
diff --git a/nfvbench/traffic_gen/traffic_utils.py b/nfvbench/traffic_gen/traffic_utils.py
index e5dc463..d3def42 100644
--- a/nfvbench/traffic_gen/traffic_utils.py
+++ b/nfvbench/traffic_gen/traffic_utils.py
@@ -39,9 +39,9 @@ def convert_rates(l2frame_size, rate, intf_speed):
return {
'initial_rate_type': initial_rate_type,
- 'rate_pps': pps,
+ 'rate_pps': int(pps),
'rate_percent': load,
- 'rate_bps': bps
+ 'rate_bps': int(bps)
}
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):