From ed1df5da8e6468ec7a0e25a853fe803bfc0af3f6 Mon Sep 17 00:00:00 2001 From: ahothan Date: Fri, 7 Dec 2018 15:05:06 -0800 Subject: NFVBENCH-118 VxLAN fixed rate: Trex far end port Rx counters are incorrect Change-Id: If3d0b199f4b97f8610dea360cb9e70fabec06601 Signed-off-by: ahothan --- nfvbench/chaining.py | 1 - nfvbench/packet_stats.py | 18 ++++++++++++++++-- nfvbench/summarizer.py | 6 +++++- nfvbench/traffic_client.py | 25 +++++++++++++++++++++++-- 4 files changed, 44 insertions(+), 6 deletions(-) (limited to 'nfvbench') 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): -- cgit 1.2.3-korg