summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2018-04-23 10:27:13 -0700
committerahothan <ahothan@cisco.com>2018-04-23 10:29:08 -0700
commit3918ebaca624bf6d58559d602eed8e33881e7ce0 (patch)
tree02c5ffa3fd6561bdf0531bc053eab3a3f81d0550
parente456fff7801702f1cf672d9ebda54eabd5100ece (diff)
[NFVBENCH-87] In case of asymmetric actual Tx rate, total drops is calculated incorrectly
Use far end TX counter to calculate dropped packets at given RX port. Change-Id: Icfffb390e2e557f0bad2e9ddf685510decc25b27 Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r--nfvbench/traffic_gen/trex.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py
index 1d0dab3..c468802 100644
--- a/nfvbench/traffic_gen/trex.py
+++ b/nfvbench/traffic_gen/trex.py
@@ -73,12 +73,19 @@ class TRex(AbstractTrafficGenerator):
return self.client.get_server_version()
def extract_stats(self, in_stats):
+ """Extract stats from dict returned by Trex API.
+
+ :param in_stats: dict as returned by TRex api
+ """
utils.nan_replace(in_stats)
LOG.debug(in_stats)
result = {}
+ # port_handles should have only 2 elements: [0, 1]
+ # so (1 - ph) will be the index for the far end port
for ph in self.port_handle:
stats = in_stats[ph]
+ far_end_stats = in_stats[1 - ph]
result[ph] = {
'tx': {
'total_pkts': cast_integer(stats['opackets']),
@@ -91,8 +98,10 @@ class TRex(AbstractTrafficGenerator):
'total_pkt_bytes': cast_integer(stats['ibytes']),
'pkt_rate': cast_integer(stats['rx_pps']),
'pkt_bit_rate': cast_integer(stats['rx_bps']),
+ # how many pkts were dropped in RX direction
+ # need to take the tx counter on the far end port
'dropped_pkts': cast_integer(
- stats['opackets'] - stats['ipackets'])
+ far_end_stats['opackets'] - stats['ipackets'])
}
}