summaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_gen/trex.py
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2018-04-04 00:56:04 -0700
committerahothan <ahothan@cisco.com>2018-04-04 00:56:04 -0700
commit90e69f01d75a76dbac971174db0e701ebd40f543 (patch)
tree3af12045bbdfd3b5e9aa72f1f10fbf157764938f /nfvbench/traffic_gen/trex.py
parent5d582aada32e1c5f43601015660b7936013f5b30 (diff)
[NFVBENCH-81]With some Intel X710 NIC cards, NFVbench reports erroneous RX counters
Work around this NIC FW issue by using port level stats for packets/bytes ALso fix mutliple calls to get_stats() Change-Id: Id19086d0db6bcc4417adff4ed4ce9606ffb30fe2 Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'nfvbench/traffic_gen/trex.py')
-rw-r--r--nfvbench/traffic_gen/trex.py36
1 files changed, 11 insertions, 25 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py
index 7d64f0f..683e97e 100644
--- a/nfvbench/traffic_gen/trex.py
+++ b/nfvbench/traffic_gen/trex.py
@@ -78,21 +78,21 @@ class TRex(AbstractTrafficGenerator):
result = {}
for ph in self.port_handle:
- stats = self.__combine_stats(in_stats, ph)
+ stats = in_stats[ph]
result[ph] = {
'tx': {
- 'total_pkts': cast_integer(stats['tx_pkts']['total']),
- 'total_pkt_bytes': cast_integer(stats['tx_bytes']['total']),
- 'pkt_rate': cast_integer(stats['tx_pps']['total']),
- 'pkt_bit_rate': cast_integer(stats['tx_bps']['total'])
+ 'total_pkts': cast_integer(stats['opackets']),
+ 'total_pkt_bytes': cast_integer(stats['obytes']),
+ 'pkt_rate': cast_integer(stats['tx_pps']),
+ 'pkt_bit_rate': cast_integer(stats['tx_bps'])
},
'rx': {
- 'total_pkts': cast_integer(stats['rx_pkts']['total']),
- 'total_pkt_bytes': cast_integer(stats['rx_bytes']['total']),
- 'pkt_rate': cast_integer(stats['rx_pps']['total']),
- 'pkt_bit_rate': cast_integer(stats['rx_bps']['total']),
+ 'total_pkts': cast_integer(stats['ipackets']),
+ 'total_pkt_bytes': cast_integer(stats['ibytes']),
+ 'pkt_rate': cast_integer(stats['rx_pps']),
+ 'pkt_bit_rate': cast_integer(stats['rx_bps']),
'dropped_pkts': cast_integer(
- stats['tx_pkts']['total'] - stats['rx_pkts']['total'])
+ stats['opackets'] - stats['ipackets'])
}
}
@@ -107,20 +107,6 @@ class TRex(AbstractTrafficGenerator):
result["total_tx_rate"] = cast_integer(total_tx_pkts / self.config.duration_sec)
return result
- def __combine_stats(self, in_stats, port_handle):
- """Traverses TRex result dictionary and combines stream stats. Used for combining latency
- and regular streams together.
- """
- result = defaultdict(lambda: defaultdict(float))
-
- for pg_id in [self.stream_ids[port_handle]] + self.latencies[port_handle]:
- record = in_stats['flow_stats'][pg_id]
- for stat_type, stat_type_values in record.iteritems():
- for ph, value in stat_type_values.iteritems():
- result[stat_type][ph] += value
-
- return result
-
def __combine_latencies(self, in_stats, port_handle):
"""Traverses TRex result dictionary and combines chosen latency stats."""
if not self.latencies[port_handle]:
@@ -441,7 +427,7 @@ class TRex(AbstractTrafficGenerator):
LOG.info('Cleared all existing streams.')
def get_stats(self):
- stats = self.client.get_pgid_stats()
+ stats = self.client.get_stats()
return self.extract_stats(stats)
def get_macs(self):