diff options
author | ahothan <ahothan@cisco.com> | 2018-11-07 10:16:08 -0800 |
---|---|---|
committer | ahothan <ahothan@cisco.com> | 2018-11-07 10:16:08 -0800 |
commit | 3dfb5268ebfada08c1a2316708564e627f86da42 (patch) | |
tree | 4dc4eebd49101b0812cdb534ff925683146ec620 /nfvbench/traffic_gen | |
parent | 4e91afc87413eb4279fa9b6aeded584ce68f56bf (diff) |
NFVBENCH-107 NFVbench 2.0 ValueError at end of fixed rate run2.0.4stable/gambia
Change-Id: I16181a530d040f0ff9348a7b4c1764fec5f73d69
Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'nfvbench/traffic_gen')
-rw-r--r-- | nfvbench/traffic_gen/trex.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py index 4d7e175..6aec57d 100644 --- a/nfvbench/traffic_gen/trex.py +++ b/nfvbench/traffic_gen/trex.py @@ -197,6 +197,12 @@ class TRex(AbstractTrafficGenerator): If there are latency streams, those same counters need to be added in the same way """ + def get_latency(lval): + try: + return int(round(lval)) + except ValueError: + return 0 + for ifs in if_stats: ifs.tx = ifs.rx = 0 for port in range(2): @@ -211,9 +217,9 @@ class TRex(AbstractTrafficGenerator): try: lat = trex_stats['latency'][lat_pg_id]['latency'] # dropped_pkts += lat['err_cntrs']['dropped'] - latencies[port].max_usec = int(round(lat['total_max'])) - latencies[port].min_usec = int(round(lat['total_min'])) - latencies[port].avg_usec = int(round(lat['average'])) + latencies[port].max_usec = get_latency(lat['total_max']) + latencies[port].min_usec = get_latency(lat['total_min']) + latencies[port].avg_usec = get_latency(lat['average']) except KeyError: pass |