diff options
-rw-r--r-- | docs/testing/user/userguide/examples.rst | 121 | ||||
-rw-r--r-- | nfvbench/traffic_client.py | 12 | ||||
-rw-r--r-- | nfvbench/traffic_gen/traffic_utils.py | 1 | ||||
-rw-r--r-- | nfvbench/traffic_gen/trex.py | 28 | ||||
-rw-r--r-- | nfvbench/utils.py | 5 |
5 files changed, 150 insertions, 17 deletions
diff --git a/docs/testing/user/userguide/examples.rst b/docs/testing/user/userguide/examples.rst index 4fc68b7..cd1f886 100644 --- a/docs/testing/user/userguide/examples.rst +++ b/docs/testing/user/userguide/examples.rst @@ -4,6 +4,127 @@ Example of Results ****************** +Example run for fixed rate +.. code-block:: bash + nfvbench -c /nfvbench/nfvbenchconfig.json --rate 1% +.. code-block:: bash + ========== NFVBench Summary ========== + Date: 2017-09-21 23:57:44 + NFVBench version 1.0.9 + Openstack Neutron: + vSwitch: BASIC + Encapsulation: BASIC + Benchmarks: + > Networks: + > Components: + > TOR: + Type: None + > Traffic Generator: + Profile: trex-local + Tool: TRex + > Versions: + > TOR: + > Traffic Generator: + build_date: Aug 30 2017 + version: v2.29 + built_by: hhaim + build_time: 16:43:55 + > Service chain: + > PVP: + > Traffic: + Profile: traffic_profile_64B + Bidirectional: True + Flow count: 10000 + Service chains count: 1 + Compute nodes: [] + Run Summary: + + +-----------------+-------------+----------------------+----------------------+----------------------+ + | L2 Frame Size | Drop Rate | Avg Latency (usec) | Min Latency (usec) | Max Latency (usec) | + +=================+=============+======================+======================+======================+ + | 64 | 0.0000% | 53 | 20 | 211 | + +-----------------+-------------+----------------------+----------------------+----------------------+ + + + L2 frame size: 64 + Chain analysis duration: 60.076 seconds + + Run Config: + + +-------------+---------------------------+------------------------+-----------------+---------------------------+------------------------+-----------------+ + | Direction | Requested TX Rate (bps) | Actual TX Rate (bps) | RX Rate (bps) | Requested TX Rate (pps) | Actual TX Rate (pps) | RX Rate (pps) | + +=============+===========================+========================+=================+===========================+========================+=================+ + | Forward | 100.0000 Mbps | 95.4546 Mbps | 95.4546 Mbps | 148,809 pps | 142,045 pps | 142,045 pps | + +-------------+---------------------------+------------------------+-----------------+---------------------------+------------------------+-----------------+ + | Reverse | 100.0000 Mbps | 95.4546 Mbps | 95.4546 Mbps | 148,809 pps | 142,045 pps | 142,045 pps | + +-------------+---------------------------+------------------------+-----------------+---------------------------+------------------------+-----------------+ + | Total | 200.0000 Mbps | 190.9091 Mbps | 190.9091 Mbps | 297,618 pps | 284,090 pps | 284,090 pps | + +-------------+---------------------------+------------------------+-----------------+---------------------------+------------------------+-----------------+ + + Chain Analysis: + + +-------------------+----------+-----------------+---------------+---------------+-----------------+---------------+---------------+ + | Interface | Device | Packets (fwd) | Drops (fwd) | Drop% (fwd) | Packets (rev) | Drops (rev) | Drop% (rev) | + +===================+==========+=================+===============+===============+=================+===============+===============+ + | traffic-generator | trex | 8,522,729 | | | 8,522,729 | 0 | 0.0000% | + +-------------------+----------+-----------------+---------------+---------------+-----------------+---------------+---------------+ + | traffic-generator | trex | 8,522,729 | 0 | 0.0000% | 8,522,729 | | | + +-------------------+----------+-----------------+---------------+---------------+-----------------+---------------+---------------+ + +Example run for NDR/PDR with package size 1518B + +.. code-block:: bash + nfvbench -c /nfvbench/nfvbenchconfig.json -fs 1518 + +.. code-block:: bash + ========== NFVBench Summary ========== + Date: 2017-09-22 00:02:07 + NFVBench version 1.0.9 + Openstack Neutron: + vSwitch: BASIC + Encapsulation: BASIC + Benchmarks: + > Networks: + > Components: + > TOR: + Type: None + > Traffic Generator: + Profile: trex-local + Tool: TRex + > Versions: + > TOR: + > Traffic Generator: + build_date: Aug 30 2017 + version: v2.29 + built_by: hhaim + build_time: 16:43:55 + > Measurement Parameters: + NDR: 0.001 + PDR: 0.1 + > Service chain: + > PVP: + > Traffic: + Profile: custom_traffic_profile + Bidirectional: True + Flow count: 10000 + Service chains count: 1 + Compute nodes: [] + + Run Summary: + + +-----+-----------------+------------------+------------------+-----------------+----------------------+----------------------+----------------------+ + | - | L2 Frame Size | Rate (fwd+rev) | Rate (fwd+rev) | Avg Drop Rate | Avg Latency (usec) | Min Latency (usec) | Max Latency (usec) | + +=====+=================+==================+==================+=================+======================+======================+======================+ + | NDR | 1518 | 19.9805 Gbps | 1,623,900 pps | 0.0001% | 342 | 30 | 704 | + +-----+-----------------+------------------+------------------+-----------------+----------------------+----------------------+----------------------+ + | PDR | 1518 | 20.0000 Gbps | 1,625,486 pps | 0.0022% | 469 | 40 | 1,266 | + +-----+-----------------+------------------+------------------+-----------------+----------------------+----------------------+----------------------+ + + + L2 frame size: 1518 + Chain analysis duration: 660.442 seconds + NDR search duration: 660 seconds + PDR search duration: 0 seconds diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py index 7542d0b..ec63944 100644 --- a/nfvbench/traffic_client.py +++ b/nfvbench/traffic_client.py @@ -25,6 +25,7 @@ from stats_collector import IterationCollector import struct import time import traffic_gen.traffic_utils as utils +from utils import cast_integer class TrafficClientException(Exception): @@ -538,9 +539,12 @@ class TrafficClient(object): retDict[port]['rx'][key] = int(stats[port]['rx'][key]) except ValueError: retDict[port]['rx'][key] = 0 - retDict[port]['rx']['avg_delay_usec'] = int(stats[port]['rx']['avg_delay_usec']) - retDict[port]['rx']['min_delay_usec'] = int(stats[port]['rx']['min_delay_usec']) - retDict[port]['rx']['max_delay_usec'] = int(stats[port]['rx']['max_delay_usec']) + retDict[port]['rx']['avg_delay_usec'] = cast_integer( + stats[port]['rx']['avg_delay_usec']) + retDict[port]['rx']['min_delay_usec'] = cast_integer( + stats[port]['rx']['min_delay_usec']) + retDict[port]['rx']['max_delay_usec'] = cast_integer( + stats[port]['rx']['max_delay_usec']) retDict[port]['drop_rate_percent'] = self.__get_dropped_rate(retDict[port]) ports = sorted(retDict.keys()) @@ -753,7 +757,7 @@ class TrafficClient(object): config['direction-total'] = dict(config['direction-forward']) config['direction-total'].update({ 'rate_percent': load_total, - 'rate_pps': pps_total, + 'rate_pps': cast_integer(pps_total), 'rate_bps': bps_total }) diff --git a/nfvbench/traffic_gen/traffic_utils.py b/nfvbench/traffic_gen/traffic_utils.py index d3def42..7cf44a8 100644 --- a/nfvbench/traffic_gen/traffic_utils.py +++ b/nfvbench/traffic_gen/traffic_utils.py @@ -17,6 +17,7 @@ import bitmath from traffic_base import AbstractTrafficGenerator + def convert_rates(l2frame_size, rate, intf_speed): avg_packet_size = get_average_packet_size(l2frame_size) if 'rate_pps' in rate: diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py index a9effab..498ff50 100644 --- a/nfvbench/traffic_gen/trex.py +++ b/nfvbench/traffic_gen/trex.py @@ -17,6 +17,7 @@ from itertools import count from nfvbench.log import LOG from nfvbench.specs import ChainType from nfvbench.traffic_server import TRexTrafficServer +from nfvbench.utils import cast_integer from nfvbench.utils import timeout from nfvbench.utils import TimeoutError import os @@ -73,30 +74,31 @@ class TRex(AbstractTrafficGenerator): stats = self.__combine_stats(in_stats, ph) result[ph] = { 'tx': { - 'total_pkts': int(stats['tx_pkts']['total']), - 'total_pkt_bytes': int(stats['tx_bytes']['total']), - 'pkt_rate': int(stats['tx_pps']['total']), - 'pkt_bit_rate': int(stats['tx_bps']['total']) + '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']) }, 'rx': { - 'total_pkts': int(stats['rx_pkts']['total']), - 'total_pkt_bytes': int(stats['rx_bytes']['total']), - 'pkt_rate': int(stats['rx_pps']['total']), - 'pkt_bit_rate': int(stats['rx_bps']['total']), - 'dropped_pkts': int(stats['tx_pkts']['total'] - stats['rx_pkts']['total']) + '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']), + 'dropped_pkts': cast_integer( + stats['tx_pkts']['total'] - stats['rx_pkts']['total']) } } lat = self.__combine_latencies(in_stats, ph) - result[ph]['rx']['max_delay_usec'] = int( + result[ph]['rx']['max_delay_usec'] = cast_integer( lat['total_max']) if 'total_max' in lat else float('nan') - result[ph]['rx']['min_delay_usec'] = int( + result[ph]['rx']['min_delay_usec'] = cast_integer( lat['total_min']) if 'total_min' in lat else float('nan') - result[ph]['rx']['avg_delay_usec'] = int( + result[ph]['rx']['avg_delay_usec'] = cast_integer( lat['average']) if 'average' in lat else float( 'nan') total_tx_pkts = result[0]['tx']['total_pkts'] + result[1]['tx']['total_pkts'] - result["total_tx_rate"] = int(total_tx_pkts / self.config.duration_sec) + result["total_tx_rate"] = cast_integer(total_tx_pkts / self.config.duration_sec) return result def __combine_stats(self, in_stats, port_handle): diff --git a/nfvbench/utils.py b/nfvbench/utils.py index 4d9749c..fc72517 100644 --- a/nfvbench/utils.py +++ b/nfvbench/utils.py @@ -17,6 +17,7 @@ import fcntl from functools import wraps import json from log import LOG +from math import isnan import os import re import signal @@ -141,6 +142,10 @@ def parse_flow_count(flow_count): return flow_count * multiplier +def cast_integer(value): + return int(value) if not isnan(value) else value + + class RunLock(object): """ Attempts to lock file and run current instance of NFVbench as the first, |