summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nfvbench/chaining.py1
-rw-r--r--nfvbench/packet_stats.py18
-rw-r--r--nfvbench/summarizer.py6
-rwxr-xr-xnfvbench/traffic_client.py25
-rw-r--r--test/test_chains.py11
5 files changed, 53 insertions, 8 deletions
diff --git a/nfvbench/chaining.py b/nfvbench/chaining.py
index ce1b5ce..ed379bc 100644
--- a/nfvbench/chaining.py
+++ b/nfvbench/chaining.py
@@ -291,7 +291,6 @@ class ChainNetwork(object):
body['network']['provider:segmentation_id'] = self.segmentation_id
if self.physical_network:
body['network']['provider:physical_network'] = self.physical_network
-
self.network = self.manager.neutron_client.create_network(body)['network']
body = {
'subnet': {'name': network_config.subnet,
diff --git a/nfvbench/packet_stats.py b/nfvbench/packet_stats.py
index 16dc965..4b9eac5 100644
--- a/nfvbench/packet_stats.py
+++ b/nfvbench/packet_stats.py
@@ -47,8 +47,13 @@ class InterfaceStats(object):
self.device = device
self.shared = shared
# RX and TX counters for this interface
+ # A None value can be set to mean that the data is not available
self.tx = 0
self.rx = 0
+ # This is a special field to hold an optional total rx count that is only
+ # used for column aggregation to compute a total intertface stats
+ # Set to non zero to be picked by the add interface stats method for rx total
+ self.rx_total = None
def get_packet_count(self, direction):
"""Get packet count for given direction.
@@ -79,8 +84,17 @@ class InterfaceStats(object):
def add_if_stats(self, if_stats):
"""Add another ifstats to this instance."""
- self.tx += if_stats.tx
- self.rx += if_stats.rx
+ def added_counter(old_value, new_value_to_add):
+ if new_value_to_add:
+ if old_value is None:
+ return new_value_to_add
+ return old_value + new_value_to_add
+ return old_value
+
+ self.tx = added_counter(self.tx, if_stats.tx)
+ self.rx = added_counter(self.rx, if_stats.rx)
+ # Add special rx total value if set
+ self.rx = added_counter(self.rx, if_stats.rx_total)
def update_stats(self, tx, rx, diff):
"""Update stats for this interface.
diff --git a/nfvbench/summarizer.py b/nfvbench/summarizer.py
index f03d3bc..7520076 100644
--- a/nfvbench/summarizer.py
+++ b/nfvbench/summarizer.py
@@ -44,7 +44,8 @@ def _annotate_chain_stats(chain_stats, nodrop_marker='=>'):
'total': {...}
}
- In the case of shared net, some columns in packets array can have ''
+ In the case of shared net, some columns in packets array can have ''.
+ Some columns cab also be None which means the data is not available.
"""
for stats in chain_stats.values():
packets = stats['packets']
@@ -60,6 +61,9 @@ def _annotate_chain_stats(chain_stats, nodrop_marker='=>'):
# an empty string indicates an unknown counter for a shared interface
# do not annotate those
annotated_value = ''
+ elif cur_count is None:
+ # Not available
+ annotated_value = 'n/a'
else:
drop = cur_count - prev_count
if drop:
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index 093a02d..dbb8206 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -360,7 +360,6 @@ class GeneratorConfig(object):
self.udp_src_port = gen_config.udp_src_port
self.udp_dst_port = gen_config.udp_dst_port
self.vteps = gen_config.get('vteps')
- self.vnis = gen_config.get('vnis')
self.devices = [Device(port, self) for port in [0, 1]]
# This should normally always be [0, 1]
self.ports = [device.port for device in self.devices]
@@ -1027,7 +1026,29 @@ class TrafficClient(object):
# interface stats for the pps because it could have been modified to contain
# additional interface stats
self.gen.get_stream_stats(stats, ifs, self.pps_list[chain_idx].latencies, chain_idx)
-
+ # special handling for vxlan
+ # in case of vxlan, flow stats are not available so all rx counters will be
+ # zeros when the total rx port counter is non zero.
+ # in that case,
+ for port in range(2):
+ total_rx = 0
+ for ifs in self.ifstats:
+ total_rx += ifs[port].rx
+ if total_rx == 0:
+ # check if the total port rx from Trex is also zero
+ port_rx = stats[port]['rx']['total_pkts']
+ if port_rx:
+ # the total rx for all chains from port level stats is non zero
+ # which means that the per-chain stats are not available
+ if len(self.ifstats) == 1:
+ # only one chain, simply report the port level rx to the chain rx stats
+ self.ifstats[0][port].rx = port_rx
+ else:
+ for ifs in self.ifstats:
+ # mark this data as unavailable
+ ifs[port].rx = None
+ # pitch in the total rx only in the last chain pps
+ self.ifstats[-1][port].rx_total = port_rx
@staticmethod
def compare_tx_rates(required, actual):
diff --git a/test/test_chains.py b/test/test_chains.py
index 17c5b94..ebc606e 100644
--- a/test/test_chains.py
+++ b/test/test_chains.py
@@ -356,7 +356,11 @@ CHAIN_STATS = [{0: {'packets': [2000054, 1999996, 1999996]}},
'total': {'packets': [30000004, 30000004, 30000004, 30000004, 30000004, 30000004]}},
{0: {'packets': [15000002, '', 14000002, 14000002, '', 13000002]},
1: {'packets': [15000002, '', 15000002, 15000002, '', 15000002]},
- 'total': {'packets': [30000004, 29000004, 29000004, 29000004, 29000004, 28000004]}}]
+ 'total': {'packets': [30000004, 29000004, 29000004, 29000004, 29000004, 28000004]}},
+ # example with non-available rx count in last position
+ {0: {'packets': [2000054, 1999996, None]},
+ 1: {'packets': [2000054, 2000054, None]},
+ 'total': {'packets': [4000108, 4000050, 4000050]}}]
XP_CHAIN_STATS = [{0: {'packets': [2000054, '-58 (-0.0029%)', 1999996]}},
{0: {'packets': [2000054, '-58 (-0.0029%)', 1999996]},
1: {'packets': [2000054, '=>', 2000054]},
@@ -371,7 +375,10 @@ XP_CHAIN_STATS = [{0: {'packets': [2000054, '-58 (-0.0029%)', 1999996]}},
'-1,000,000 (-7.1429%)']},
1: {'packets': [15000002, '', '=>', '=>', '', 15000002]},
'total': {'packets': [30000004, '-1,000,000 (-3.3333%)', '=>', '=>', '=>',
- '-1,000,000 (-3.4483%)']}}]
+ '-1,000,000 (-3.4483%)']}},
+ {0: {'packets': [2000054, '-58 (-0.0029%)', 'n/a']},
+ 1: {'packets': [2000054, '=>', 'n/a']},
+ 'total': {'packets': [4000108, '-58 (-0.0014%)', 4000050]}}]
def test_summarizer():