diff options
32 files changed, 885 insertions, 493 deletions
diff --git a/conf/01_testcases.conf b/conf/01_testcases.conf index a8d7a136..bdaeb4da 100755 --- a/conf/01_testcases.conf +++ b/conf/01_testcases.conf @@ -19,60 +19,12 @@ # # "Name": "phy2phy_burst", # A human-readable string identifying the # # test. -# "Traffic Type": "rfc2544_throughput", -# # One of the supported traffic types. -# # It can be overridden by cli option traffic_type. # "Deployment": "p2p", # One of the supported deployment scenarios. # "Description": "Lorem ipsum..." # Optional. A human-readable string # # describing the test. # "Frame Modification": "vlan" # One of the supported frame modifications: # # vlan, mpls, mac, dscp, ttl, ip_addr, # # ip_port. -# "biDirectional": ["True"|"False"] -# # Specifies if generated traffic will be -# # full-duplex (True) or half-duplex (False) -# # It can be overridden by cli option bidirectional. -# # Default value is "False". Must be of type -# # string. -# "MultiStream": 0-65535 # Optional. Defines number of flows simulated -# # by traffic generator. Value 0 disables -# # MultiStream feature -# # It can be overridden by cli option multistream. -# "Stream Type": ["L2"|"L3"|"L4"] # Optional. Stream Type is an extension -# # of the "MultiStream" feature. If MultiStream -# # is disabled, then Stream Type will be ignored. -# # Stream Type defines ISO OSI network layer -# # used for simulation of multiple streams. -# # It can be overridden by cli option stream_type. -# # Values: -# # "L2" - iteration of destination MAC address -# # "L3" - iteration of destination IP address -# # "L4" - iteration of destination port -# # of selected transport protocol -# # Default value is "L4". -# "Pre-installed Flows": ["Yes"|"No"] -# # Optional. Pre-installed Flows is an extension -# # of the "MultiStream" feature. If MultiStream -# # is disabled, then Pre-installed Flows will be -# # ignored. It defines if stream specific flows -# # will be inserted into OVS or not. -# # It can be overridden by cli option -# # pre-installed_flows -# # Values: -# # "Yes" - flows will be inserted into OVS -# # "No" - flows won't be inserted into OVS -# # Default value is "No". -# "Flow Type": ["port"|"IP"] # Optional. Defines flows complexity. In case -# # it isn't specified, then "port" will be used. -# # Values: -# # "port" - flow is defined by ingress ports -# # "IP" - flow is defined by ingress ports -# # and src and dst IP addresses -# "iLoad": 0-100 # Optional. Defines desired percentage -# # of frame rate used during continuous stream -# # tests. Can be overridden by cli option -# # iload. -# # Default value is 100. # "Load": dictionary # Optional. Configures background load # # during testcase execution. # Description of "Load" dictionary keys, their meanings and available values: @@ -115,7 +67,7 @@ # # stated in configuration files or value # # specified on command line through --trafficgen # # parameter. -# "Parameters" : {'TRAFFICGEN_PKT_SIZES' : (512,)} +# "Parameters" : {'TRAFFICGEN_PKT_SIZES' : (512,)}, # # Dictionary with testcase specific configuration # # environment. Specified parameters will be modified # # before the test execution and their original values will @@ -129,128 +81,172 @@ PERFORMANCE_TESTS = [ { "Name": "phy2phy_tput", - "Traffic Type": "rfc2544_throughput", "Deployment": "p2p", - "biDirectional": "True", "Description": "LTD.Throughput.RFC2544.PacketLossRatio", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + }, + }, }, { "Name": "phy2phy_forwarding", - "Traffic Type": "rfc2889", "Deployment": "p2p", - "biDirectional": "True", "Description": "LTD.Forwarding.RFC2889.MaxForwardingRate", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2889", + }, + }, }, { "Name": "back2back", - "Traffic Type": "rfc2544_back2back", "Deployment": "p2p", - "biDirectional": "True", "Description": "LTD.Throughput.RFC2544.BackToBackFrames", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_back2back", + }, + }, }, { "Name": "phy2phy_tput_mod_vlan", - "Traffic Type": "rfc2544_throughput", "Deployment": "p2p", "Frame Modification": "vlan", - "biDirectional": "False", - "Description": "LTD.Throughput.RFC2544.PacketLossRatioFrameModification" + "Description": "LTD.Throughput.RFC2544.PacketLossRatioFrameModification", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + }, + }, }, { "Name": "phy2phy_cont", - "Traffic Type": "rfc2544_continuous", "Deployment": "p2p", "Description": "Phy2Phy Continuous Stream", - "biDirectional": "True", - "iLoad": "100", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "frame_rate" : 100, + }, + }, }, { "Name": "pvp_cont", - "Traffic Type": "rfc2544_continuous", "Deployment": "pvp", "Description": "PVP Continuous Stream", - "biDirectional": "True", - "iLoad": "100", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "frame_rate" : 100, + }, + }, }, { "Name": "pvvp_cont", - "Traffic Type": "rfc2544_continuous", "Deployment": "pvvp", "Description": "PVVP Continuous Stream", - "biDirectional": "True", - "iLoad": "100", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "frame_rate" : 100, + }, + }, }, { "Name": "pvpv_cont", - "Traffic Type": "rfc2544_continuous", "Deployment": "pvpv", "Description": "Two VMs in parallel with Continuous Stream", - "biDirectional": "True", - "iLoad": "100", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "frame_rate" : 100, + }, + }, }, { "Name": "phy2phy_scalability", - "Traffic Type": "rfc2544_throughput", "Deployment": "p2p", - "biDirectional": "True", "Description": "LTD.Scalability.Flows.RFC2544.0PacketLoss", - "MultiStream": "8000", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + "multistream" : "8000", + }, + }, }, { "Name": "pvp_tput", - "Traffic Type": "rfc2544_throughput", "Deployment": "pvp", "Description": "LTD.Throughput.RFC2544.PacketLossRatio", - "biDirectional": "True", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + }, + }, }, { "Name": "pvp_back2back", - "Traffic Type": "rfc2544_back2back", "Deployment": "pvp", "Description": "LTD.Throughput.RFC2544.BackToBackFrames", - "biDirectional": "True", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_back2back", + }, + }, }, { "Name": "pvvp_tput", - "Traffic Type": "rfc2544_throughput", "Collector": "cpu", "Deployment": "pvvp", "Description": "LTD.Throughput.RFC2544.PacketLossRatio", - "biDirectional": "True", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + }, + }, }, { "Name": "pvvp_back2back", - "Traffic Type": "rfc2544_back2back", "Collector": "cpu", "Deployment": "pvvp", "Description": "LTD.Throughput.RFC2544.BackToBackFrames", - "biDirectional": "True", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_back2back", + }, + }, }, { "Name": "phy2phy_cpu_load", - "Traffic Type": "rfc2544_throughput", "Deployment": "p2p", - "biDirectional": "True", "Description": "LTD.CPU.RFC2544.0PacketLoss", "Load" : { "tool" : "stress-ng", "load" : 100, "reserved" : 4, "pattern" : "c", - } + }, + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + }, + }, }, { "Name": "phy2phy_mem_load", - "Traffic Type": "rfc2544_throughput", "Deployment": "p2p", - "biDirectional": "True", "Description": "LTD.Memory.RFC2544.0PacketLoss", "Load" : { "tool" : "stress-ng", "load" : 50, "pattern" : "m", "load_memory" : 80, - } + }, + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + }, + }, }, - ] diff --git a/conf/02_vswitch.conf b/conf/02_vswitch.conf index 2b74dae9..2ca7591c 100644 --- a/conf/02_vswitch.conf +++ b/conf/02_vswitch.conf @@ -119,6 +119,7 @@ PATHS['vswitch']['OvsVanilla']['bin']['modules'] = ['openvswitch'] # # parameters used for legacy DPDK configuration through '--dpdk' option of ovs-vswitchd # e.g. ovs-vswitchd --dpdk --socket-mem 1024,0 +# This config line is also used for pkt_fwd option (TestPMD phy2phy and pvp tests) VSWITCHD_DPDK_ARGS = ['-c', '0x4', '-n', '4', '--socket-mem 1024,0'] # options used for new type of OVS configuration via calls to ovs-vsctl diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 87210b8d..72324660 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -19,6 +19,143 @@ # log file for all traffic generator related commands LOG_FILE_TRAFFIC_GEN = 'traffic-gen.log' +# TRAFFIC dictionary defines traffic parameters used by all traffic generators. +# Detailed description of TRAFFIC dictionary items follows: +# +# 'traffic_type' - One of the supported traffic types. +# E.g. rfc2544_throughput, rfc2544_back2back +# or rfc2544_continuous +# Data type: str +# Default value: "rfc2544_throughput". +# 'bidir' - Specifies if generated traffic will be full-duplex (True) +# or half-duplex (False) +# Data type: str +# Supported values: "True", "False" +# Default value: "False". +# 'frame_rate' - Defines desired percentage of frame rate used during +# continuous stream tests. +# Data type: int +# Default value: 100. +# 'multistream' - Defines number of flows simulated by traffic generator. +# Value 0 disables multistream feature +# Data type: int +# Supported values: 0-65535 +# Default value: 0. +# 'stream_type' - Stream type is an extension of the "multistream" feature. +# If multistream is disabled, then stream type will be +# ignored. Stream type defines ISO OSI network layer used +# for simulation of multiple streams. +# Data type: str +# Supported values: +# "L2" - iteration of destination MAC address +# "L3" - iteration of destination IP address +# "L4" - iteration of destination port +# of selected transport protocol +# Default value: "L4". +# 'pre_installed_flows' +# - Pre-installed flows is an extension of the multistream" +# feature. If multistream is disabled, then pre-installed +# flows will be ignored. It defines if stream specific flows +# will be inserted into OVS or not. +# Data type: str +# Supported values: +# "Yes" - flows will be inserted into OVS +# "No" - flows won't be inserted into OVS +# Default value: "No". +# 'flow_type' - Defines flows complexity. +# Data type: str +# Supported values: +# "port" - flow is defined by ingress ports +# "IP" - flow is defined by ingress ports +# and src and dst IP addresses +# Default value: "port" +# 'l2' - A dictionary with l2 network layer details. Supported +# values are: +# 'srcmac' - Specifies source MAC address filled by traffic generator. +# NOTE: It can be modified by vsperf in some scenarios. +# Data type: str +# Default value: "00:00:00:00:00:00". +# 'dstmac' - Specifies destination MAC address filled by traffic generator. +# NOTE: It can be modified by vsperf in some scenarios. +# Data type: str +# Default value: "00:00:00:00:00:00". +# 'framesize' - Specifies default frame size. This value should not be +# changed directly. It will be overridden during testcase +# execution by values specified by list TRAFFICGEN_PKT_SIZES. +# Data type: int +# Default value: 64 +# 'l3' - A dictionary with l3 network layer details. Supported +# values are: +# 'srcip' - Specifies source MAC address filled by traffic generator. +# NOTE: It can be modified by vsperf in some scenarios. +# Data type: str +# Default value: "1.1.1.1". +# 'dstip' - Specifies destination MAC address filled by traffic generator. +# NOTE: It can be modified by vsperf in some scenarios. +# Data type: str +# Default value: "90.90.90.90". +# 'proto' - Specifies deflaut protocol type. +# Please check particular traffic generator implementation +# for supported protocol types. +# Data type: str +# Default value: "udp". +# 'l4' - A dictionary with l4 network layer details. Supported +# values are: +# 'srcport' - Specifies source port of selected transport protocol. +# NOTE: It can be modified by vsperf in some scenarios. +# Data type: int +# Default value: 3000 +# 'dstport' - Specifies destination port of selected transport protocol. +# NOTE: It can be modified by vsperf in some scenarios. +# Data type: int +# Default value: 3001 +# 'vlan' - A dictionary with vlan encapsulation details. Supported +# values are: +# 'enabled' - Specifies if vlan encapsulation should be enabled or +# disabled. +# Data type: bool +# Default value: False +# 'id' - Specifies vlan id. +# Data type: int (NOTE: must fit to 12 bits) +# Default value: 0 +# 'priority' - Specifies a vlan priority (PCP header field). +# Data type: int (NOTE: must fit to 3 bits) +# Default value: 0 +# 'cfi' - Specifies if frames can or cannot be dropped during +# congestion (DEI header field). +# Data type: int (NOTE: must fit to 1 bit) +# Default value: 0 +TRAFFIC = { + 'traffic_type' : 'rfc2544_throughput', + 'frame_rate' : 100, + 'bidir' : 'True', # will be passed as string in title format to tgen + 'multistream' : 0, + 'stream_type' : 'L4', + 'pre_installed_flows' : 'No', # used by vswitch implementation + 'flow_type' : 'port', # used by vswitch implementation + + 'l2': { + 'framesize': 64, + 'srcmac': '00:00:00:00:00:00', + 'dstmac': '00:00:00:00:00:00', + }, + 'l3': { + 'proto': 'udp', + 'srcip': '1.1.1.1', + 'dstip': '90.90.90.90', + }, + 'l4': { + 'srcport': 3000, + 'dstport': 3001, + }, + 'vlan': { + 'enabled': False, + 'id': 0, + 'priority': 0, + 'cfi': 0, + }, +} + #path to traffic generators directory. TRAFFICGEN_DIR = os.path.join(ROOT_DIR, 'tools/pkt_gen') diff --git a/conf/__init__.py b/conf/__init__.py index 2448d390..2a2586ff 100644 --- a/conf/__init__.py +++ b/conf/__init__.py @@ -20,6 +20,7 @@ and any user provided settings file. # pylint: disable=invalid-name +import copy import os import re import logging @@ -30,8 +31,7 @@ import netaddr _LOGGER = logging.getLogger(__name__) # Special test parameters which are not part of standard VSPERF configuration -_EXTRA_TEST_PARAMS = ['bidirectional', 'traffic_type', 'iload', 'tunnel_type', - 'multistream', 'stream_type', 'pre-installed_flows'] +_EXTRA_TEST_PARAMS = ['TUNNEL_TYPE'] # regex to parse configuration macros from 04_vnf.conf # it will select all patterns starting with # sign @@ -57,9 +57,19 @@ class Settings(object): return getattr(self, attr) else: master_value = getattr(self, attr) - # Check if parameter value was overridden by CLI option + # Check if parameter value was modified by CLI option cli_value = get_test_param(attr, None) - return cli_value if cli_value else master_value + if cli_value: + # TRAFFIC dictionary is not overridden by CLI option + # but only updated by specified values + if attr == 'TRAFFIC': + tmp_value = copy.deepcopy(master_value) + tmp_value = merge_spec(tmp_value, cli_value) + return tmp_value + else: + return cli_value + else: + return master_value else: raise AttributeError("%r object has no attribute %r" % (self.__class__, attr)) @@ -137,7 +147,12 @@ class Settings(object): """ for key in conf: if conf[key] is not None: - setattr(self, key.upper(), conf[key]) + if isinstance(conf[key], dict): + # recursively update dict items, e.g. TEST_PARAMS + setattr(self, key.upper(), + merge_spec(getattr(self, key.upper()), conf[key])) + else: + setattr(self, key.upper(), conf[key]) def load_from_env(self): """ @@ -271,17 +286,33 @@ def get_test_param(key, default=None): :returns: Value for ``key`` if found, else ``default``. """ test_params = settings.getValue('TEST_PARAMS') - if key in test_params: - if not isinstance(test_params.get(key), str): - return test_params.get(key) + return test_params.get(key, default) if test_params else default + +def merge_spec(orig, new): + """Merges ``new`` dict with ``orig`` dict, and returns orig. + + This takes into account nested dictionaries. Example: + + >>> old = {'foo': 1, 'bar': {'foo': 2, 'bar': 3}} + >>> new = {'foo': 6, 'bar': {'foo': 7}} + >>> merge_spec(old, new) + {'foo': 6, 'bar': {'foo': 7, 'bar': 3}} + + You'll notice that ``bar.bar`` is not removed. This is the desired result. + """ + for key in orig: + if key not in new: + continue + + # Not allowing derived dictionary types for now + # pylint: disable=unidiomatic-typecheck + if type(orig[key]) == dict: + orig[key] = merge_spec(orig[key], new[key]) else: - # values are passed inside string from CLI, so we must retype them accordingly - try: - return ast.literal_eval(test_params.get(key)) - except ValueError: - # for backward compatibility, we have to accept strings without quotes - _LOGGER.warning("Adding missing quotes around string value: %s = %s", - key, str(test_params.get(key))) - return str(test_params.get(key)) - else: - return default + orig[key] = new[key] + + for key in new: + if key not in orig: + orig[key] = new[key] + + return orig diff --git a/conf/integration/01_testcases.conf b/conf/integration/01_testcases.conf index ff05186b..504b4458 100644 --- a/conf/integration/01_testcases.conf +++ b/conf/integration/01_testcases.conf @@ -25,15 +25,15 @@ SUPPORTED_TUNNELING_PROTO = ['vxlan', 'gre', 'geneve'] # # Required for OP2P tests # "Tunnel Type": ["vxlan"|"gre"|"geneve"] # Tunnel Type defines tunneling protocol to use. -# # It can be overridden by cli option tunnel_type. +# # It can be overridden by cli option TUNNEL_TYPE. # # Values: # # "vxlan" - iteration of destination MAC address # # "gre" - iteration of destination IP address # # "geneve" - iteration of destination UDP port # # Default value is "vxlan". # -# biDirectional testing for OP2P is not yet supported. -# biDirectional must be set to False. +# bidirectional testing for OP2P is not yet supported. +# TRAFFIC['bidir'] must be set to 'False'. # # "TestSteps": [] # Definition of integration test steps. # # In case that this list is defined, then @@ -320,55 +320,75 @@ STEP_VSWITCH_2PHY_6VM_FINIT = [ INTEGRATION_TESTS = [ { "Name": "overlay_p2p_mod_tput", - "Traffic Type": "rfc2544_throughput", "Deployment": "ptunp", - "biDirectional": 'True', "Tunnel Type": "vxlan", "Description": ("Tunneling Throughput RFC2544 Test." "The encap and decap are performed inside the " "virtual switch itself in each direction to avoid " "the need of ingress overlay traffic."), - "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, + "Parameters": { + "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544v2.tcl", + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + "bidir" : "False", + }, + }, }, { "Name": "overlay_p2p_tput", - "Traffic Type": "rfc2544_throughput", "Deployment": "op2p", - "biDirectional": 'False', "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "encapsulation", "Description": "Overlay Encapsulation Throughput RFC2544 Test", - "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, + "Parameters": { + "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544v2.tcl", + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + "bidir" : "False", + }, + }, }, { "Name": "overlay_p2p_cont", - "Traffic Type": "rfc2544_continuous", "Deployment": "op2p", - "biDirectional": 'False', "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "encapsulation", "Description": "Overlay Encapsulation RFC2544 Continuous Stream", - "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, + "Parameters": { + "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544v2.tcl", + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "bidir" : "False", + }, + }, }, { "Name": "overlay_p2p_decap_tput", - "Traffic Type": "rfc2544_throughput", "Deployment": "op2p", - "biDirectional": 'False', "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "decapsulation", "Description": "Overlay Decapsulation Throughput RFC2544 Test", - "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, + "Parameters": { + "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544v2.tcl", + "TRAFFIC" : { + "traffic_type" : "rfc2544_throughput", + "bidir" : "False", + }, + }, }, { "Name": "overlay_p2p_decap_cont", - "Traffic Type": "rfc2544_continuous", "Deployment": "op2p", - "biDirectional": 'False', "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "decapsulation", "Description": "Overlay Decapsulation RFC2544 Continuous Stream", - "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, + "Parameters": { + "TRAFFICGEN_IXNET_TCL_SCRIPT" : "ixnetrfc2544v2.tcl", + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "bidir" : "False", + }, + }, }, { "Name": "vswitch_add_del_bridge", @@ -758,8 +778,12 @@ INTEGRATION_TESTS = [ "Name": "2pvp_udp_dest_flows", "Description": "RFC2544 Continuous TC with 2 Parallel VMs, flows on UDP Dest Port", "Deployment": "clean", - "Stream Type": "L4", - "MultiStream": 2, + "Parameters" : { + "TRAFFIC" : { + "multistream" : 2, + "stream_type" : "L4", + }, + }, "TestSteps": STEP_VSWITCH_2PHY_2VM_INIT + STEP_VSWITCH_2_PARALLEL_VM_FLOWS_INIT + [ # Start 2 VMs @@ -781,8 +805,12 @@ INTEGRATION_TESTS = [ "Name": "4pvp_udp_dest_flows", "Description": "RFC2544 Continuous TC with 4 Parallel VMs, flows on UDP Dest Port", "Deployment": "clean", - "Stream Type": "L4", - "MultiStream": 4, + "Parameters" : { + "TRAFFIC" : { + "multistream" : 4, + "stream_type" : "L4", + }, + }, "TestSteps": STEP_VSWITCH_2PHY_4VM_INIT + STEP_VSWITCH_4_PARALLEL_VM_FLOWS_INIT + [ # Start 4 VMs @@ -808,8 +836,12 @@ INTEGRATION_TESTS = [ "Name": "6pvp_udp_dest_flows", "Description": "RFC2544 Continuous TC with 6 Parallel VMs, flows on UDP Dest Port", "Deployment": "clean", - "Stream Type": "L4", - "MultiStream": 6, + "Parameters" : { + "TRAFFIC" : { + "multistream" : 6, + "stream_type" : "L4", + }, + }, "TestSteps": STEP_VSWITCH_2PHY_6VM_INIT + STEP_VSWITCH_6_PARALLEL_VM_FLOWS_INIT + [ # Start VMs diff --git a/core/pktfwd_controller.py b/core/pktfwd_controller.py index b1e37f2e..a0e14d19 100644 --- a/core/pktfwd_controller.py +++ b/core/pktfwd_controller.py @@ -32,7 +32,7 @@ class PktFwdController(object): self._deployment = deployment self._logger = logging.getLogger(__name__) self._pktfwd_class = pktfwd_class - self._pktfwd = pktfwd_class() + self._pktfwd = pktfwd_class(guest=True if deployment == "pvp" else False) self._logger.debug('Creation using ' + str(self._pktfwd_class)) def setup(self): @@ -46,6 +46,17 @@ class PktFwdController(object): self._pktfwd.stop() raise + def setup_for_guest(self): + """Sets up the packet forwarder for pvp. + """ + self._logger.debug('Setup using ' + str(self._pktfwd_class)) + + try: + self._pktfwd.start_for_guest() + except: + self._pktfwd.stop() + raise + def stop(self): """Tears down the packet forwarder created in setup(). """ @@ -55,10 +66,14 @@ class PktFwdController(object): def __enter__(self): if self._deployment.find("p2p") == 0: self.setup() + elif self._deployment == "pvp": + self.setup_for_guest() def __exit__(self, type_, value, traceback): if self._deployment.find("p2p") == 0: self.stop() + elif self._deployment == "pvp": + self.stop() def get_pktfwd(self): """Get the controlled packet forwarder diff --git a/docs/configguide/trafficgen.rst b/docs/configguide/trafficgen.rst index 6d75a56f..5190bc8e 100644 --- a/docs/configguide/trafficgen.rst +++ b/docs/configguide/trafficgen.rst @@ -7,15 +7,15 @@ =========================== Overview ---------------------- +-------- + VSPERF supports the following traffic generators: - * Dummy (DEFAULT): Allows you to use your own external - traffic generator. - * IXIA (IxNet and IxOS) - * Spirent TestCenter - * Xena Networks - * MoonGen + * Dummy_ (DEFAULT) + * Ixia_ + * `Spirent TestCenter`_ + * `Xena Networks`_ + * MoonGen_ To see the list of traffic gens from the cli: @@ -28,20 +28,27 @@ and configure the various traffic generators. Background Information ---------------------- -The traffic default configuration can be found in -tools/pkt_gen/trafficgen/trafficgenhelper.py, and is configured as -follows: +The traffic default configuration can be found in **conf/03_traffic.conf**, +and is configured as follows: .. code-block:: console - TRAFFIC_DEFAULTS = { + TRAFFIC = { + 'traffic_type' : 'rfc2544_throughput', + 'frame_rate' : 100, + 'bidir' : 'True', # will be passed as string in title format to tgen + 'multistream' : 0, + 'stream_type' : 'L4', + 'pre_installed_flows' : 'No', # used by vswitch implementation + 'flow_type' : 'port', # used by vswitch implementation + 'l2': { 'framesize': 64, 'srcmac': '00:00:00:00:00:00', 'dstmac': '00:00:00:00:00:00', }, 'l3': { - 'proto': 'tcp', + 'proto': 'udp', 'srcip': '1.1.1.1', 'dstip': '90.90.90.90', }, @@ -80,12 +87,25 @@ commandline above to: $ ./vsperf --test-params "TRAFFICGEN_PKT_SIZES=(x,y);TRAFFICGEN_DURATION=10;" \ "TRAFFICGEN_RFC2544_TESTS=1" $TESTNAME -Dummy Setup ------------- +Dummy +----- + +The Dummy traffic generator can be used to test VSPERF installation or +to demonstrate VSPERF functionality at DUT without connection +to a real traffic generator. + +You could also use the Dummy generator in case, that your external +traffic generator is not supported by VSPERF. In such case you could +use VSPERF to setup your test scenario and then transmit the traffic. +After the transmission is completed you could specify values for all +collected metrics and VSPERF will use them to generate final reports. + +Setup +~~~~~ + To select the Dummy generator please add the following to your custom configuration file ``10_custom.conf``. - .. code-block:: console TRAFFICGEN = 'Dummy' @@ -133,8 +153,8 @@ when the setup is complete. } What was the result for 'frames tx'? -When your traffic gen has completed traffic transmission and provided -the results please input these at the vsperf prompt. vsperf will try +When your traffic generator has completed traffic transmission and provided +the results please input these at the VSPERF prompt. VSPERF will try to verify the input: .. code-block:: console @@ -143,72 +163,134 @@ to verify the input: Please answer with y OR n. -VPSERF will ask you for: - * Result for 'frames tx' - * Result for 'frames rx' - * Result for 'min latency' - * Result for 'max latency' - * Result for 'avg latency' - +VSPERF will ask you to provide a value for every of collected metrics. The list +of metrics can be found at traffic-type-metrics_. Finally vsperf will print out the results for your test and generate the -appropriate logs and csv files. +appropriate logs and report files. +.. _traffic-type-metrics: -IXIA Setup ----------- +Metrics collected for supported traffic types +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -On the CentOS 7 system -~~~~~~~~~~~~~~~~~~~~~~ +Below you could find a list of metrics collected by VSPERF for each of supported +traffic types. + +RFC2544 Throughput and Continuous: + + * frames tx + * frames rx + * min latency + * max latency + * avg latency + * frameloss + +RFC2544 Back2back: + + * b2b frames + * b2b frame loss % + +Dummy result pre-configuration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In case of a Dummy traffic generator it is possible to pre-configure the test +results. This is useful for creation of demo testcases, which do not require +a real traffic generator. Such testcase can be run by any user and it will still +generate all reports and result files. + +Result values can be specified within ``TRAFFICGEN_DUMMY_RESULTS`` dictionary, +where every of collected metrics must be properly defined. Please check the list +of traffic-type-metrics_. + +Dictionary with dummy results can be passed by CLI argument ``--test-params`` +or specified in ``Parameters`` section of testcase definition. -You need to install IxNetworkTclClient$(VER\_NUM)Linux.bin.tgz. +Example of testcase execution with dummy results defined by CLI argument: -On the IXIA client software system -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. code-block:: console + + $ ./vsperf back2back --trafficgen Dummy --test-params \ + "TRAFFICGEN_DUMMY_RESULTS={'b2b frames':'3000','b2b frame loss %':'0.0'}" + +Example of testcase definition with pre-configured dummy results: -Find the IxNetwork TCL server app (start -> All Programs -> IXIA -> -IxNetwork -> IxNetwork\_$(VER\_NUM) -> IxNetwork TCL Server) +.. code-block:: python -Right click on IxNetwork TCL Server, select properties - Under shortcut tab in -the Target dialogue box make sure there is the argument "-tclport xxxx" -where xxxx is your port number (take note of this port number as you will -need it for the 10\_custom.conf file). + { + "Name": "back2back", + "Traffic Type": "rfc2544_back2back", + "Deployment": "p2p", + "biDirectional": "True", + "Description": "LTD.Throughput.RFC2544.BackToBackFrames", + "Parameters" : { + 'TRAFFICGEN_DUMMY_RESULTS' : {'b2b frames':'3000','b2b frame loss %':'0.0'} + }, + }, -.. image:: TCLServerProperties.png +**NOTE:** Pre-configured results for the Dummy traffic generator will be used only +in case, that the Dummy traffic generator is used. Otherwise the option +``TRAFFICGEN_DUMMY_RESULTS`` will be ignored. -Hit Ok and start the TCL server application +.. _Ixia: + +Ixia +---- + +VSPERF can use both IxNetwork and IxExplorer TCL servers to control Ixia chassis. +However usage of IxNetwork TCL server is a preferred option. Following sections +will describe installation and configuration of IxNetwork components used by VSPERF. + +Installation +~~~~~~~~~~~~ + +On the system under the test you need to install IxNetworkTclClient$(VER\_NUM)Linux.bin.tgz. + +On the IXIA client software system you need to install IxNetwork TCL server. After its +installation you should configure it as follows: + + 1. Find the IxNetwork TCL server app (start -> All Programs -> IXIA -> + IxNetwork -> IxNetwork\_$(VER\_NUM) -> IxNetwork TCL Server) + 2. Right click on IxNetwork TCL Server, select properties - Under shortcut tab in + the Target dialogue box make sure there is the argument "-tclport xxxx" + where xxxx is your port number (take note of this port number as you will + need it for the 10\_custom.conf file). + + .. image:: TCLServerProperties.png + + 3. Hit Ok and start the TCL server application VSPERF configuration ~~~~~~~~~~~~~~~~~~~~ -There are several configuration options specific to the IxNetworks traffic generator +There are several configuration options specific to the IxNetwork traffic generator from IXIA. It is essential to set them correctly, before the VSPERF is executed for the first time. Detailed description of options follows: - * TRAFFICGEN_IXNET_MACHINE - IP address of server, where IxNetwork TCL Server is running - * TRAFFICGEN_IXNET_PORT - PORT, where IxNetwork TCL Server is accepting connections from + * ``TRAFFICGEN_IXNET_MACHINE`` - IP address of server, where IxNetwork TCL Server is running + * ``TRAFFICGEN_IXNET_PORT`` - PORT, where IxNetwork TCL Server is accepting connections from TCL clients - * TRAFFICGEN_IXNET_USER - username, which will be used during communication with IxNetwork + * ``TRAFFICGEN_IXNET_USER`` - username, which will be used during communication with IxNetwork TCL Server and IXIA chassis - * TRAFFICGEN_IXIA_HOST - IP address of IXIA traffic generator chassis - * TRAFFICGEN_IXIA_CARD - identification of card with dedicated ports at IXIA chassis - * TRAFFICGEN_IXIA_PORT1 - identification of the first dedicated port at TRAFFICGEN_IXIA_CARD + * ``TRAFFICGEN_IXIA_HOST`` - IP address of IXIA traffic generator chassis + * ``TRAFFICGEN_IXIA_CARD`` - identification of card with dedicated ports at IXIA chassis + * ``TRAFFICGEN_IXIA_PORT1`` - identification of the first dedicated port at ``TRAFFICGEN_IXIA_CARD`` at IXIA chassis; VSPERF uses two separated ports for traffic generation. In case of unidirectional traffic, it is essential to correctly connect 1st IXIA port to the 1st NIC - at DUT, i.e. to the first PCI handle from WHITELIST_NICS list. Otherwise traffic may not + at DUT, i.e. to the first PCI handle from ``WHITELIST_NICS`` list. Otherwise traffic may not be able to pass through the vSwitch. - * TRAFFICGEN_IXIA_PORT2 - identification of the second dedicated port at TRAFFICGEN_IXIA_CARD + * ``TRAFFICGEN_IXIA_PORT2`` - identification of the second dedicated port at ``TRAFFICGEN_IXIA_CARD`` at IXIA chassis; VSPERF uses two separated ports for traffic generation. In case of unidirectional traffic, it is essential to correctly connect 2nd IXIA port to the 2nd NIC - at DUT, i.e. to the second PCI handle from WHITELIST_NICS list. Otherwise traffic may not + at DUT, i.e. to the second PCI handle from ``WHITELIST_NICS`` list. Otherwise traffic may not be able to pass through the vSwitch. - * TRAFFICGEN_IXNET_LIB_PATH - path to the DUT specific installation of IxNetwork TCL API - * TRAFFICGEN_IXNET_TCL_SCRIPT - name of the TCL script, which VSPERF will use for + * ``TRAFFICGEN_IXNET_LIB_PATH`` - path to the DUT specific installation of IxNetwork TCL API + * ``TRAFFICGEN_IXNET_TCL_SCRIPT`` - name of the TCL script, which VSPERF will use for communication with IXIA TCL server - * TRAFFICGEN_IXNET_TESTER_RESULT_DIR - folder accessible from IxNetwork TCL server, + * ``TRAFFICGEN_IXNET_TESTER_RESULT_DIR`` - folder accessible from IxNetwork TCL server, where test results are stored, e.g. ``c:/ixia_results``; see test-results-share_ - * TRAFFICGEN_IXNET_DUT_RESULT_DIR - directory accessible from the DUT, where test + * ``TRAFFICGEN_IXNET_DUT_RESULT_DIR`` - directory accessible from the DUT, where test results from IxNetwork TCL server are stored, e.g. ``/mnt/ixia_results``; see test-results-share_ @@ -237,7 +319,7 @@ Example of sharing configuration: TRAFFICGEN_IXNET_TESTER_RESULT_DIR = 'c:/ixia_results' TRAFFICGEN_IXNET_DUT_RESULT_DIR = '/mnt/ixia_results' - Note: It is essential to use slashes '/' also in path + **NOTE:** It is essential to use slashes '/' also in path configured by ``TRAFFICGEN_IXNET_TESTER_RESULT_DIR`` parameter. * Install cifs-utils package. @@ -259,6 +341,8 @@ Example of sharing configuration: It is recommended to verify, that any new file inserted into ``c:/ixia_results`` folder is visible at DUT inside ``/mnt/ixia_results`` directory. +.. _`Spirent TestCenter`: + Spirent Setup ------------- @@ -360,6 +444,8 @@ The mandatory configurations are enlisted below. TRAFFICGEN_STC_RFC2889_TEST_FILE_NAME = " " TRAFFICGEN_STC_RFC2889_LOCATIONS= " " +.. _`Xena Networks`: + Xena Networks ------------- diff --git a/docs/design/trafficgen_integration_guide.rst b/docs/design/trafficgen_integration_guide.rst index 9bb0e825..1457052b 100644 --- a/docs/design/trafficgen_integration_guide.rst +++ b/docs/design/trafficgen_integration_guide.rst @@ -81,29 +81,28 @@ Step 3 - configuration All configuration values, required for correct traffic generator function, are passed from VSPERF to the traffic generator in a dictionary. Default values shared among -all traffic generators are defined in **tools/pkt_gen/trafficgen/trafficgenhelper.py** -as **TRAFFIC_DEFAULTS** dictionary. Default values are loaded by **ITrafficGenerator** -interface class automatically, so it is not needed to load them explicitly. In case -that there are any traffic generator specific default values, then they should -be set within class specific **__init__** function. +all traffic generators are defined in **conf/03_traffic.conf** within **TRAFFIC** +dictionary. Default values are loaded by **ITrafficGenerator** interface class +automatically, so it is not needed to load them explicitly. In case that there are +any traffic generator specific default values, then they should be set within class +specific **__init__** function. VSPERF passes test specific configuration within **traffic** dictionary to every start and send function. So implementation of these functions must ensure, that default values are updated with the testcase specific values. Proper merge -of values is assured by call of **merge_spec** function from **trafficgenhelper** -module. +of values is assured by call of **merge_spec** function from **conf** module. Example of **merge_spec** usage in **tools/pkt_gen/sample_tg/sample_tg.py** module: .. code-block:: python - from tools.pkt_gen.trafficgen.trafficgenhelper import merge_spec + from conf import merge_spec def start_rfc2544_throughput(self, traffic=None, duration=30): self._params = {} self._params['traffic'] = self.traffic_defaults.copy() if traffic: - self._params['traffic'] = trafficgen.merge_spec( + self._params['traffic'] = merge_spec( self._params['traffic'], traffic) @@ -199,8 +198,7 @@ functions: e.g. **rfc2544_throughput**, **rfc2544_continuous** or **rfc2544_back2back**. * param **frame_rate**: Defines desired percentage of frame - rate used during continuous stream tests. It can be set by test - parameter iLoad or by CLI parameter iload. + rate used during continuous stream tests. * param **bidir**: Specifies if generated traffic will be full-duplex (true) or half-duplex (false). * param **multistream**: Defines number of flows simulated by traffic diff --git a/docs/design/vswitchperf_design.rst b/docs/design/vswitchperf_design.rst index 4f33a99f..96b97631 100755 --- a/docs/design/vswitchperf_design.rst +++ b/docs/design/vswitchperf_design.rst @@ -263,6 +263,130 @@ a section in the ``conf\10_custom.conf`` file that can be used. .. _VSPERF installation scripts: http://artifacts.opnfv.org/vswitchperf/docs/configguide/installation.html#other-requirements +Configuration of TRAFFIC dictionary +----------------------------------- + +TRAFFIC dictionary is used for configuration of traffic generator. Default values +can be found in configuration file ``conf/03_traffic.conf``. These default values +can be modified by (first option has the highest priorty): + + 1. ``Parameters`` section of testcase defintion + 2. command line options specified by ``--test-params`` argument + 3. custom configuration file + +It is to note, that in case of option 1 and 2, it is possible to specify only +values, which should be changed. In case of custom configuration file, it is +required to specify whole ``TRAFFIC`` dictionary with its all values or explicitly +call and update() method of ``TRAFFIC`` dictionary. + +Detailed description of ``TRAFFIC`` dictionary items follows: + +.. code-block:: console + + 'traffic_type' - One of the supported traffic types. + E.g. rfc2544_throughput, rfc2544_back2back + or rfc2544_continuous + Data type: str + Default value: "rfc2544_throughput". + 'bidir' - Specifies if generated traffic will be full-duplex (True) + or half-duplex (False) + Data type: str + Supported values: "True", "False" + Default value: "False". + 'frame_rate' - Defines desired percentage of frame rate used during + continuous stream tests. + Data type: int + Default value: 100. + 'multistream' - Defines number of flows simulated by traffic generator. + Value 0 disables multistream feature + Data type: int + Supported values: 0-65535 + Default value: 0. + 'stream_type' - Stream type is an extension of the "multistream" feature. + If multistream is disabled, then stream type will be + ignored. Stream type defines ISO OSI network layer used + for simulation of multiple streams. + Data type: str + Supported values: + "L2" - iteration of destination MAC address + "L3" - iteration of destination IP address + "L4" - iteration of destination port + of selected transport protocol + Default value: "L4". + 'pre_installed_flows' + - Pre-installed flows is an extension of the multistream" + feature. If multistream is disabled, then pre-installed + flows will be ignored. It defines if stream specific flows + will be inserted into OVS or not. + Data type: str + Supported values: + "Yes" - flows will be inserted into OVS + "No" - flows won't be inserted into OVS + Default value: "No". + 'flow_type' - Defines flows complexity. + Data type: str + Supported values: + "port" - flow is defined by ingress ports + "IP" - flow is defined by ingress ports + and src and dst IP addresses + Default value: "port" + 'l2' - A dictionary with l2 network layer details. Supported + values are: + 'srcmac' - Specifies source MAC address filled by traffic generator. + NOTE: It can be modified by vsperf in some scenarios. + Data type: str + Default value: "00:00:00:00:00:00". + 'dstmac' - Specifies destination MAC address filled by traffic generator. + NOTE: It can be modified by vsperf in some scenarios. + Data type: str + Default value: "00:00:00:00:00:00". + 'framesize' - Specifies default frame size. This value should not be + changed directly. It will be overridden during testcase + execution by values specified by list TRAFFICGEN_PKT_SIZES. + Data type: int + Default value: 64 + 'l3' - A dictionary with l3 network layer details. Supported + values are: + 'srcip' - Specifies source MAC address filled by traffic generator. + NOTE: It can be modified by vsperf in some scenarios. + Data type: str + Default value: "1.1.1.1". + 'dstip' - Specifies destination MAC address filled by traffic generator. + NOTE: It can be modified by vsperf in some scenarios. + Data type: str + Default value: "90.90.90.90". + 'proto' - Specifies deflaut protocol type. + Please check particular traffic generator implementation + for supported protocol types. + Data type: str + Default value: "udp". + 'l4' - A dictionary with l4 network layer details. Supported + values are: + 'srcport' - Specifies source port of selected transport protocol. + NOTE: It can be modified by vsperf in some scenarios. + Data type: int + Default value: 3000 + 'dstport' - Specifies destination port of selected transport protocol. + NOTE: It can be modified by vsperf in some scenarios. + Data type: int + Default value: 3001 + 'vlan' - A dictionary with vlan encapsulation details. Supported + values are: + 'enabled' - Specifies if vlan encapsulation should be enabled or + disabled. + Data type: bool + Default value: False + 'id' - Specifies vlan id. + Data type: int (NOTE: must fit to 12 bits) + Default value: 0 + 'priority' - Specifies a vlan priority (PCP header field). + Data type: int (NOTE: must fit to 3 bits) + Default value: 0 + 'cfi' - Specifies if frames can or cannot be dropped during + congestion (DEI header field). + Data type: int (NOTE: must fit to 1 bit) + Default value: 0 + Configuration of GUEST options ------------------------------ diff --git a/docs/release/NEWS.rst b/docs/release/NEWS.rst index e1a9fa3b..a31e2738 100644 --- a/docs/release/NEWS.rst +++ b/docs/release/NEWS.rst @@ -2,14 +2,56 @@ .. http://creativecommons.org/licenses/by/4.0 .. (c) OPNFV, Intel Corporation, AT&T and others. -OPNFV D Release -=============== -* Remove support for vhost cuse -* Add Vanilla OVS Multi-queue with non testpmd options -* Add support for Multi-queue with OVS 2.5.0 or less +OPNFV Danube Release +==================== + +* Support for testpmd as a vswitch for PVP scenario with vHost User +* Traffic type naming harmonized with RFC2544 +* Support for step driven performance testcases +* Scripts with licenses not compatible with Apache 2.0 were isolated + in 3rd_party directory +* Several bugfixes, CI script and documentation updates +* Installation scripts: + + * Support for Ubuntu 16.04 LTS and 16.10 + * Support for RHEL7.3 + * Support for CentOS7.3 + +* Traffic Generators: + + * Spirent Testcenter: Support for RFC2889 tests + * Xena: bugfixes and improvements of RFC2544 continuous accuracy + * MoonGen: bugfixes, code clean up and update of usage instructions + * Dummy: Support for preconfigured test results + * Ixia: bugfixes + +* Integration tests: + + * New tests for multi VM scenarios + * New test for numa vHost awareness feature + +* Configuration changes: + + * Support for OVS, DPDK or QEMU installed from binary packages + * Support for modification of any configuration parameter or traffic + detail via CLI option --test-params or via "Parameters" section + of testcase definition + +* Guest specific: + + * Support for multi VM scenarios with VM connected in serial or in parallel + * Support for VM with 1, 2, 4, 6... network interfaces + * Support for driver binding option + * Support for flexible testpmd configuration + * Support for configurable merge-buffers + * Support for configurable drive options + * Support for multi-queue with non testpmd options by Vanilla OVS + * Support for multi-queue with OVS 2.5.0 or less + * Remove support for vHost Cuse OPNFV Colorado Release ====================== + * Support for DPDK v16.07 * Support for yardstick testing framework * Support for stp/rstp configuration @@ -23,10 +65,12 @@ OPNFV Colorado Release * Support for Red Hat Enterprise Linux * Support for mode of operation (trafficgen, trafficgen-off) * Support for Integration tests for OVS with DPDK including: + * Physical ports. * Virtual ports (vhost user and vhost cuse). * Flow addition and removal tests. * Overlay (VXLAN, GRE and NVGRE) encapsulation and decapsulation tests. + * Supporting configuration of OVS with DPDK through the OVS DB as well as the legacy commandline arguments. * Support for VM loopback (SR-IOV) benchmarking. @@ -35,6 +79,7 @@ OPNFV Colorado Release OPNFV Brahmaputra Release ========================= + Supports both OVS and OVS with DPDK. Available tests: diff --git a/docs/requirements/vswitchperf_ltd.rst b/docs/requirements/vswitchperf_ltd.rst index 0d297880..69497c5c 100644 --- a/docs/requirements/vswitchperf_ltd.rst +++ b/docs/requirements/vswitchperf_ltd.rst @@ -145,8 +145,8 @@ Test ID: LTD.Throughput.RFC2544.PacketLossRatio Note: Other values can be tested if required by the user. The selected frame sizes are those previously defined under `Default - Test Parameters <#DefaultParams>`__. The test can also be used to - determine the average latency of the traffic. + Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. + The test can also be used to determine the average latency of the traffic. Under the `RFC2544 <https://www.rfc-editor.org/rfc/rfc2544.txt>`__ test methodology, the test duration will @@ -197,8 +197,8 @@ Test ID: LTD.Throughput.RFC2544.PacketLossRatioFrameModification Note: Other values can be tested if required by the user. The selected frame sizes are those previously defined under `Default - Test Parameters <#DefaultParams>`__. The test can also be used to - determine the average latency of the traffic. + Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. + The test can also be used to determine the average latency of the traffic. Under the `RFC2544 <https://www.rfc-editor.org/rfc/rfc2544.txt>`__ test methodology, the test duration will @@ -268,7 +268,7 @@ Test ID: LTD.Throughput.RFC2544.Profile and severe. The selected frame sizes are those previously defined under `Default - Test Parameters <#DefaultParams>`__. + Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. The offered traffic rate is described as a percentage delta with respect to the DUT's RFC 2544 Throughput as determined by @@ -319,7 +319,8 @@ Test ID: LTD.Throughput.RFC2544.SystemRecoveryTime The aim of this test is to determine the length of time it takes the DUT to recover from an overload condition for a constant load (fixed length frames at a fixed interval time). The selected frame sizes are those - previously defined under `Default Test Parameters <#DefaultParams>`__, + previously defined under `Default Test Parameters + <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__, traffic should be sent to the DUT under normal conditions. During the duration of the test and while the traffic flows are passing though the DUT, at least one situation leading to an overload condition for the DUT @@ -371,7 +372,9 @@ Test ID: LTD.Throughput.RFC2544.BackToBackFrames The aim of this test is to characterize the ability of the DUT to process back-to-back frames. For each frame size previously defined - under `Default Test Parameters <#DefaultParams>`__, a burst of traffic + under `Default Test Parameters + <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__, + a burst of traffic is sent to the DUT with the minimum inter-frame gap between each frame. If the number of received frames equals the number of frames that were transmitted, the burst size should be increased and traffic is sent to @@ -525,7 +528,8 @@ Test ID: LTD.Throughput.RFC6201.ResetTime Both reset methods SHOULD be exercised. For each frame size previously defined under `Default Test - Parameters <#DefaultParams>`__, traffic should be sent to the DUT under + Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__, + traffic should be sent to the DUT under normal conditions. During the duration of the test and while the traffic flows are passing through the DUT, the DUT should be reset and the Reset time measured. The Reset time is the total time that a device is @@ -610,7 +614,8 @@ Test ID: LTD.Throughput.RFC2889.MaxForwardingRate is varied between the throughput and the Maximum Offered Load for fixed length frames at a fixed time interval. The selected frame sizes are those previously defined under `Default Test - Parameters <#DefaultParams>`__. The throughput is the maximum offered + Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. + The throughput is the maximum offered load with 0% frame loss (measured by the prerequisite test), and the Maximum Offered Load (as defined by `RFC2285 <https://www.rfc-editor.org/rfc/rfc2285.txt>`__) is *"the highest @@ -744,7 +749,8 @@ Test ID: LTD.Throughput.RFC2889.BroadcastFrameForwarding The aim of this test is to determine the maximum forwarding rate of the DUT when forwarding broadcast traffic. For each frame previously defined - under `Default Test Parameters <#DefaultParams>`__, the traffic should + under `Default Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__, + the traffic should be set up as broadcast traffic. The traffic throughput of the DUT should be measured. @@ -912,7 +918,7 @@ Test ID: LTD.Throughput.Overlay.Network.<tech>.RFC2544.PacketLossRatio - Switch the packet to the correct port The selected frame sizes are those previously defined under `Default - Test Parameters <#DefaultParams>`__. + Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. Thus, each test comprises an overlay technology, a network function, and a packet size *with* overlay network overhead included @@ -1035,8 +1041,8 @@ Test ID: LTD.Throughput.RFC2544.MatchAction.PacketLossRatio The default loss percentages to be tested are: - X = 0% - X = 10^-7% Other values can be tested if required by the user. The selected - frame sizes are those previously defined under Default Test - Parameters. + frame sizes are those previously defined under `Default Test Parameters + <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. The test can also be used to determine the average latency of the traffic when a match action is applied to packets in a flow. Under @@ -1202,8 +1208,8 @@ Test ID: LTD.Scalability.Flows.RFC2544.0PacketLoss before passing traffic. For each frame size previously defined under `Default Test - Parameters <#DefaultParams>`__ and for each of the following number of - flows: + Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__ + and for each of the following number of flows: - 1,000 - 2,000 @@ -1331,8 +1337,8 @@ Test ID: LTD.Scalability.VNF.RFC2544.PacketLossRatio approach used needs to be documented as part of the test report. The selected frame sizes are those previously defined under `Default - Test Parameters <#DefaultParams>`__. The test can also be used to - determine the average latency of the traffic. + Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. + The test can also be used to determine the average latency of the traffic. Under the `RFC2544 <https://www.rfc-editor.org/rfc/rfc2544.txt>`__ test methodology, the test duration will @@ -1392,7 +1398,7 @@ Test ID: LTD.Scalability.VNF.RFC2544.PacketLossProfile be tested is 3. The selected frame sizes are those previously defined under `Default - Test Parameters <#DefaultParams>`__. + Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. The offered traffic rate is described as a percentage delta with respect to the DUT's RFC 2544 Throughput as determined by @@ -1473,7 +1479,8 @@ Test ID: LTD.Activation.RFC2889.AddressCachingCapacity MAC learning. The aim of this test is to determine the address caching capacity of the DUT for a constant load (fixed length frames at a fixed interval time). The selected frame sizes are those previously defined - under `Default Test Parameters <#DefaultParams>`__. + under `Default Test Parameters + <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__. In order to run this test the aging time, that is the maximum time the DUT will keep a learned address in its flow table, and a set of initial @@ -1526,7 +1533,8 @@ Test ID: LTD.Activation.RFC2889.AddressLearningRate MAC learning. The aim of this test is to determine the rate of address learning of the DUT for a constant load (fixed length frames at a fixed interval time). The selected frame sizes are those previously defined - under `Default Test Parameters <#DefaultParams>`__, traffic should be + under `Default Test Parameters <http://artifacts.opnfv.org/vswitchperf/docs/index.html#default-test-parameters>`__, + traffic should be sent with each IPv4/IPv6 address incremented by one. The rate at which the DUT learns a new address should be measured. The maximum caching capacity from LTD.Memory.RFC2889.AddressCachingCapacity should be taken diff --git a/docs/userguide/integration.rst b/docs/userguide/integration.rst index 003e8adb..60ed9245 100755 --- a/docs/userguide/integration.rst +++ b/docs/userguide/integration.rst @@ -82,21 +82,21 @@ To run VXLAN encapsulation tests: .. code-block:: console ./vsperf --conf-file user_settings.py --integration \ - --test-params 'tunnel_type=vxlan' overlay_p2p_tput + --test-params 'TUNNEL_TYPE=vxlan' overlay_p2p_tput To run GRE encapsulation tests: .. code-block:: console ./vsperf --conf-file user_settings.py --integration \ - --test-params 'tunnel_type=gre' overlay_p2p_tput + --test-params 'TUNNEL_TYPE=gre' overlay_p2p_tput To run GENEVE encapsulation tests: .. code-block:: console ./vsperf --conf-file user_settings.py --integration \ - --test-params 'tunnel_type=geneve' overlay_p2p_tput + --test-params 'TUNNEL_TYPE=geneve' overlay_p2p_tput To run OVS NATIVE tunnel tests (VXLAN/GRE/GENEVE): @@ -128,7 +128,7 @@ To run OVS NATIVE tunnel tests (VXLAN/GRE/GENEVE): .. code-block:: console ./vsperf --conf-file user_settings.py --integration \ - --test-params 'tunnel_type=vxlan' overlay_p2p_tput + --test-params 'TUNNEL_TYPE=vxlan' overlay_p2p_tput Executing VXLAN decapsulation tests @@ -189,7 +189,7 @@ To run GRE decapsulation tests: .. code-block:: console - ./vsperf --conf-file user_settings.py --test-params 'tunnel_type=gre' \ + ./vsperf --conf-file user_settings.py --test-params 'TUNNEL_TYPE=gre' \ --integration overlay_p2p_decap_cont diff --git a/docs/userguide/teststeps.rst b/docs/userguide/teststeps.rst index 5e2d9570..5029f538 100644 --- a/docs/userguide/teststeps.rst +++ b/docs/userguide/teststeps.rst @@ -374,8 +374,12 @@ That is accomplished by using "Stream Type" and "MultiStream" keywords. "Name": "multistream_l4", "Description": "Multistream on UDP ports", "Deployment": "clean", - "Stream Type": "L4", - "MultiStream": 4, + "Parameters": { + 'TRAFFIC' : { + "multistream": 4, + "stream_type": "L4", + }, + }, "TestSteps": [ ['vswitch', 'add_switch', 'int_br0'], # STEP 0 ['vswitch', 'add_phy_port', 'int_br0'], # STEP 1 @@ -542,8 +546,12 @@ destination UDP port. "Name": "ex_2pvp_rule_l4dp", "Description": "2 PVP with flows on L4 Dest Port", "Deployment": "clean", - "Stream Type": "L4", # loop UDP ports - "MultiStream": 2, + "Parameters": { + 'TRAFFIC' : { + "multistream": 2, + "stream_type": "L4", + }, + }, "TestSteps": [ ['vswitch', 'add_switch', 'int_br0'], # STEP 0 ['vswitch', 'add_phy_port', 'int_br0'], # STEP 1 @@ -622,12 +630,14 @@ and available in both csv and rst report files. { "Name": "pvvp_pvp_cont", - "Traffic Type": "continuous", "Deployment": "pvvp", "Description": "PVVP and PVP in parallel with Continuous Stream", - "biDirectional": "True", - "iLoad": "100", - "MultiStream": "2", + "Parameters" : { + "TRAFFIC" : { + "traffic_type" : "rfc2544_continuous", + "multistream": 2, + }, + }, "TestSteps": [ ['vswitch', 'add_vport', 'br0'], ['vswitch', 'add_vport', 'br0'], diff --git a/docs/userguide/testusage.rst b/docs/userguide/testusage.rst index adbe603b..721fd635 100755 --- a/docs/userguide/testusage.rst +++ b/docs/userguide/testusage.rst @@ -638,7 +638,7 @@ or use ``--vswitch`` and ``--fwdapp`` CLI arguments: .. code-block:: console - $ ./vsperf --conf-file user_settings.py \ + $ ./vsperf phy2phy_cont --conf-file user_settings.py \ --vswitch none \ --fwdapp TestPMD @@ -672,7 +672,57 @@ Supported Packet Forwarding applications are: .. code-block:: console - $ ./vsperf --conf-file <path_to_settings_py> + $ ./vsperf phy2phy_tput --conf-file <path_to_settings_py> + +Executing Packet Forwarding tests with one guest +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +TestPMD with DPDK 16.11 or greater can be used to forward packets as a switch to a single guest using TestPMD vdev +option. To set this configuration the following parameters should be used. + + .. code-block:: python + + VSWITCH = 'none' + PKTFWD = 'TestPMD' + +or use ``--vswitch`` and ``--fwdapp`` CLI arguments: + + .. code-block:: console + + $ ./vsperf pvp_tput --conf-file user_settings.py \ + --vswitch none \ + --fwdapp TestPMD + +Guest forwarding application only supports TestPMD in this configuration. + + .. code-block:: python + + GUEST_LOOPBACK = ['testpmd'] + +For optimal performance one cpu per port +1 should be used for TestPMD. Also set additional params for packet forwarding +application to use the correct number of nb-cores. + + .. code-block:: python + + VSWITCHD_DPDK_ARGS = ['-l', '46,44,42,40,38', '-n', '4', '--socket-mem 1024,0'] + TESTPMD_ARGS = ['--nb-cores=4', '--txq=1', '--rxq=1'] + +For guest TestPMD 3 VCpus should be assigned with the following TestPMD params. + + .. code-block:: python + + GUEST_TESTPMD_PARAMS = ['-l 0,1,2 -n 4 --socket-mem 1024 -- ' + '--burst=64 -i --txqflags=0xf00 ' + '--disable-hw-vlan --nb-cores=2 --txq=1 --rxq=1'] + +Execution of TestPMD can be run with the following command line + + .. code-block:: console + + ./vsperf pvp_tput --vswitch=none --fwdapp=TestPMD --conf-file <path_to_settings_py> + +**NOTE:** To achieve the best 0% loss numbers with rfc2544 throughput testing, other tunings should be applied to host +and guest such as tuned profiles and CPU tunings to prevent possible interrupts to worker threads. VSPERF modes of operation ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -694,36 +744,19 @@ Mode of operation is driven by configuration parameter -m or --mode "trafficgen-pause" - execute vSwitch and VNF but wait before traffic transmission In case, that VSPERF is executed in "trafficgen" mode, then configuration -of traffic generator should be configured through ``--test-params`` option. -Supported CLI options useful for traffic generator configuration are: - -.. code-block:: console - - 'traffic_type' - One of the supported traffic types. E.g. - rfc2544_throughput, - rfc2544_back2back or rfc2544_continuous - Default value is "rfc2544_throughput". - 'bidirectional' - Specifies if generated traffic will be full-duplex (true) - or half-duplex (false) - Default value is "false". - 'iload' - Defines desired percentage of frame rate used during - continuous stream tests. - Default value is 100. - 'multistream' - Defines number of flows simulated by traffic generator. - Value 0 disables MultiStream feature - Default value is 0. - 'stream_type' - Stream Type is an extension of the "MultiStream" feature. - If MultiStream is disabled, then Stream Type will be - ignored. Stream Type defines ISO OSI network layer used - for simulation of multiple streams. - Default value is "L4". +of traffic generator can be modified through ``TRAFFIC`` dictionary passed to the +``--test-params`` option. It is not needed to specify all values of ``TRAFFIC`` +dictionary. It is sufficient to specify only values, which should be changed. +Detailed description of ``TRAFFIC`` dictionary can be found at +`Configuration of TRAFFIC dictionary +<http://artifacts.opnfv.org/vswitchperf/docs/index.html#configuration-of-traffic-dictionary>`__ Example of execution of VSPERF in "trafficgen" mode: .. code-block:: console $ ./vsperf -m trafficgen --trafficgen IxNet --conf-file vsperf.conf \ - --test-params "traffic_type=rfc2544_continuous;bidirectional=True;iload=60" + --test-params "TRAFFIC={'traffic_type':'rfc2544_continuous','bidir':'False','framerate':60}" Code change verification by pylint ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/userguide/yardstick.rst b/docs/userguide/yardstick.rst index 985a25ad..c906df8e 100755 --- a/docs/userguide/yardstick.rst +++ b/docs/userguide/yardstick.rst @@ -146,14 +146,10 @@ Example of yaml file: type: Vsperf options: testname: 'p2p_rfc2544_throughput' - traffic_type: 'rfc2544_throughput' - frame_size '64' - bidirectional: 'True' - iload: 100 trafficgen_port1: 'eth1' trafficgen_port2: 'eth3' external_bridge: 'br-ex' - test_params: 'TRAFFICGEN_DURATION=30;' + test_params: 'TRAFFICGEN_DURATION=30;TRAFFIC={'traffic_type':'rfc2544_throughput}' conf_file: '~/vsperf-yardstick.conf' host: vsperf.demo @@ -182,19 +178,9 @@ Section **option** defines details of vswitchperf test scenario. Lot of options are identical to the vswitchperf parameters passed through ``--test-params`` argument. Following options are supported: -- **traffic_type** - specifies the type of traffic executed by traffic generator; - Valid values are ``rfc2544_throughput``, ``rfc2544_continuous`` and ``rfc2544_back2back``. - Default: ``rfc2544_throughput`` - **frame_size** - a packet size for which test should be executed; Multiple packet sizes can be tested by modification of Sequence runner section inside YAML definition. Default: '64' -- **bidirectional** - specifies if traffic will be uni (False) or bi-directional - (True); Default: False -- **iload** - specifies frame rate; Default: 100 -- **multistream** - specifies the number of simulated streams; Default: 0 (i.e. - multistream feature is disabled) -- **stream_type** - specifies network layer used for multistream simulation - the valid values are "L4", "L3" and "L2"; Default: 'L4' - **conf_file** - sets path to the vswitchperf configuration file, which will be uploaded to VM; Default: '~/vsperf-yardstick.conf' - **setup_script** - sets path to the setup script, which will be executed @@ -208,8 +194,10 @@ argument. Following options are supported: - **test_params** - specifies a string with a list of vsperf configuration parameters, which will be passed to the ``--test-params`` CLI argument; Parameters should be stated in the form of ``param=value`` and separated - by a semicolon. Please check VSPERF documentation for details about - available configuration parameters and their data types. + by a semicolon. Configuration of traffic generator is driven by ``TRAFFIC`` + dictionary, which can be also updated by values defined by ``test_params``. + Please check VSPERF documentation for details about available configuration + parameters and their data types. In case that both **test_params** and **conf_file** are specified, then values from **test_params** will override values defined in the configuration file. @@ -220,7 +208,7 @@ expected, that OVS runs at the same node, where the testcase is executed. In cas of more complex OpenStack installation or a need of additional OVS configuration, **setup_script** can be used. -Note: It is essential to specify a configuration for selected traffic generator. +**NOTE** It is essential to specify a configuration for selected traffic generator. In case, that standalone testcase is created, then traffic generator can be selected and configured directly in YAML file by **test_params**. On the other hand, if multiple testcases should be executed with the same traffic generator @@ -259,3 +247,8 @@ In case that any of defined metrics will be lower than defined value, then testcase will be marked as failed. Based on ``action`` policy, yardstick will either stop test execution (value ``assert``) or it will run next test (value ``monitor``). + +**NOTE** The throughput SLA (or any other SLA) cannot be set to a meaningful +value without knowledge of the server and networking environment, possibly +including prior testing in that environment to establish a baseline SLA level +under well-understood circumstances. diff --git a/testcases/testcase.py b/testcases/testcase.py index 55c940a4..425581b7 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -25,7 +25,7 @@ import time import subprocess from conf import settings as S -from conf import get_test_param +from conf import get_test_param, merge_spec import core.component_factory as component_factory from core.loader import Loader from core.results.results_constants import ResultsConstants @@ -35,7 +35,6 @@ from tools import functions from tools import namespace from tools import veth from tools.teststepstools import TestStepsTools -from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS CHECK_PREFIX = 'validate_' @@ -81,7 +80,7 @@ class TestCase(object): self._update_settings('TRAFFICGEN', cfg.get('Trafficgen', S.getValue('TRAFFICGEN'))) test_params = copy.deepcopy(S.getValue('TEST_PARAMS')) tc_test_params = cfg.get('Parameters', S.getValue('TEST_PARAMS')) - test_params.update(tc_test_params) + test_params = merge_spec(test_params, tc_test_params) self._update_settings('TEST_PARAMS', test_params) S.check_test_params() @@ -101,19 +100,12 @@ class TestCase(object): self.desc = cfg.get('Description', 'No description given.') self.test = cfg.get('TestSteps', None) - bidirectional = cfg.get('biDirectional', TRAFFIC_DEFAULTS['bidir']) - bidirectional = get_test_param('bidirectional', bidirectional) - if not isinstance(bidirectional, str): + bidirectional = S.getValue('TRAFFIC')['bidir'] + if not isinstance(S.getValue('TRAFFIC')['bidir'], str): raise TypeError( - 'Bi-dir value must be of type string in testcase configuration') + 'Bi-dir value must be of type string') bidirectional = bidirectional.title() # Keep things consistent - traffic_type = cfg.get('Traffic Type', TRAFFIC_DEFAULTS['traffic_type']) - traffic_type = get_test_param('traffic_type', traffic_type) - - framerate = cfg.get('iLoad', TRAFFIC_DEFAULTS['frame_rate']) - framerate = get_test_param('iload', framerate) - self.deployment = cfg['Deployment'] self._frame_mod = cfg.get('Frame Modification', None) @@ -125,18 +117,9 @@ class TestCase(object): if 'Tunnel Type' in cfg: self._tunnel_type = cfg['Tunnel Type'] - self._tunnel_type = get_test_param('tunnel_type', + self._tunnel_type = get_test_param('TUNNEL_TYPE', self._tunnel_type) - # read configuration of streams; CLI parameter takes precedence to - # testcase definition - multistream = cfg.get('MultiStream', TRAFFIC_DEFAULTS['multistream']) - multistream = get_test_param('multistream', multistream) - stream_type = cfg.get('Stream Type', TRAFFIC_DEFAULTS['stream_type']) - stream_type = get_test_param('stream_type', stream_type) - pre_installed_flows = cfg.get('Pre-installed Flows', TRAFFIC_DEFAULTS['pre_installed_flows']) - pre_installed_flows = get_test_param('pre-installed_flows', pre_installed_flows) - # check if test requires background load and which generator it uses self._load_cfg = cfg.get('Load', None) if self._load_cfg and 'tool' in self._load_cfg: @@ -150,15 +133,9 @@ class TestCase(object): self._results_dir = S.getValue('RESULTS_PATH') # set traffic details, so they can be passed to vswitch and traffic ctls - self._traffic = copy.deepcopy(TRAFFIC_DEFAULTS) - self._traffic.update({'traffic_type': traffic_type, - 'flow_type': cfg.get('Flow Type', TRAFFIC_DEFAULTS['flow_type']), - 'bidir': bidirectional, - 'tunnel_type': self._tunnel_type, - 'multistream': int(multistream), - 'stream_type': stream_type, - 'pre_installed_flows' : pre_installed_flows, - 'frame_rate': int(framerate)}) + self._traffic = copy.deepcopy(S.getValue('TRAFFIC')) + self._traffic.update({'bidir': bidirectional, + 'tunnel_type': self._tunnel_type,}) # Packet Forwarding mode self._vswitch_none = 'none' == S.getValue('VSWITCH').strip().lower() diff --git a/tools/pkt_fwd/pkt_fwd.py b/tools/pkt_fwd/pkt_fwd.py index 2580ee1f..a080b5a2 100644 --- a/tools/pkt_fwd/pkt_fwd.py +++ b/tools/pkt_fwd/pkt_fwd.py @@ -44,6 +44,12 @@ class IPktFwd(object): """ raise NotImplementedError('Please call an implementation.') + def start_for_guest(self): + """Start the packet forward for guest config + + :returns: None + """ + def stop(self): """Stop the packet forwarder. diff --git a/tools/pkt_fwd/testpmd.py b/tools/pkt_fwd/testpmd.py index e1b987bc..30e80386 100644 --- a/tools/pkt_fwd/testpmd.py +++ b/tools/pkt_fwd/testpmd.py @@ -24,6 +24,8 @@ from tools.pkt_fwd.pkt_fwd import IPktFwd _LOGGER = logging.getLogger(__name__) _VSWITCHD_CONST_ARGS = ['--', '-i'] +_TESTPMD_PVP_CONST_ARGS = ['--vdev', 'net_vhost0,iface=/tmp/dpdkvhostuser0', + '--vdev', 'net_vhost1,iface=/tmp/dpdkvhostuser1',] class TestPMD(IPktFwd): """TestPMD implementation (only phy2phy deployment is supported) @@ -37,8 +39,10 @@ class TestPMD(IPktFwd): _logger = logging.getLogger() - def __init__(self): + def __init__(self, guest=False): vswitchd_args = settings.getValue('VSWITCHD_DPDK_ARGS') + if guest: + vswitchd_args += _TESTPMD_PVP_CONST_ARGS vswitchd_args += _VSWITCHD_CONST_ARGS vswitchd_args += settings.getValue('TESTPMD_ARGS') @@ -70,6 +74,19 @@ class TestPMD(IPktFwd): self._testpmd.send('start', 1) + def start_for_guest(self): + """See IPktFwd for general description + + Activates testpmd for guest config + """ + self._logger.info("Starting TestPMD for one guest...") + dpdk.init() + self._testpmd.start() + self._logger.info("TestPMD...Started.") + self._testpmd.send('set portlist 0,2,1,3') + + self._testpmd.send('start', 1) + def stop(self): """See IPktFwd for general description diff --git a/tools/pkt_gen/dummy/dummy.py b/tools/pkt_gen/dummy/dummy.py index 528b5902..7a4daab6 100755 --- a/tools/pkt_gen/dummy/dummy.py +++ b/tools/pkt_gen/dummy/dummy.py @@ -26,6 +26,7 @@ own. import json from conf import settings +from conf import merge_spec from tools.pkt_gen import trafficgen from core.results.results_constants import ResultsConstants @@ -116,7 +117,7 @@ class Dummy(trafficgen.ITrafficGenerator): result = {} if traffic: - traffic_ = trafficgen.merge_spec(traffic_, traffic) + traffic_ = merge_spec(traffic_, traffic) results = get_user_traffic( 'burst', @@ -135,7 +136,7 @@ class Dummy(trafficgen.ITrafficGenerator): result[ResultsConstants.PAYLOAD_ERR] = results[1] result[ResultsConstants.SEQ_ERR] = results[2] - return trafficgen.BurstResult(*results) + return results def send_cont_traffic(self, traffic=None, duration=30): """ @@ -145,7 +146,7 @@ class Dummy(trafficgen.ITrafficGenerator): result = {} if traffic: - traffic_ = trafficgen.merge_spec(traffic_, traffic) + traffic_ = merge_spec(traffic_, traffic) results = get_user_traffic( 'continuous', @@ -182,7 +183,7 @@ class Dummy(trafficgen.ITrafficGenerator): result = {} if traffic: - traffic_ = trafficgen.merge_spec(traffic_, traffic) + traffic_ = merge_spec(traffic_, traffic) results = get_user_traffic( 'throughput', @@ -219,7 +220,7 @@ class Dummy(trafficgen.ITrafficGenerator): result = {} if traffic: - traffic_ = trafficgen.merge_spec(traffic_, traffic) + traffic_ = merge_spec(traffic_, traffic) results = get_user_traffic( 'back2back', diff --git a/tools/pkt_gen/ixia/ixia.py b/tools/pkt_gen/ixia/ixia.py index 5c5fb3df..ed947e70 100755 --- a/tools/pkt_gen/ixia/ixia.py +++ b/tools/pkt_gen/ixia/ixia.py @@ -42,6 +42,7 @@ from collections import OrderedDict from tools import systeminfo from tools.pkt_gen import trafficgen from conf import settings +from conf import merge_spec from core.results.results_constants import ResultsConstants _ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) @@ -203,7 +204,7 @@ class Ixia(trafficgen.ITrafficGenerator): params['traffic'] = self.traffic_defaults.copy() if traffic: - params['traffic'] = trafficgen.merge_spec( + params['traffic'] = merge_spec( params['traffic'], traffic) for cmd in _build_set_cmds(params): @@ -268,7 +269,7 @@ class Ixia(trafficgen.ITrafficGenerator): params['traffic'] = self.traffic_defaults.copy() if traffic: - params['traffic'] = trafficgen.merge_spec( + params['traffic'] = merge_spec( params['traffic'], traffic) for cmd in _build_set_cmds(params): diff --git a/tools/pkt_gen/ixnet/ixnet.py b/tools/pkt_gen/ixnet/ixnet.py index 6262a10a..f84ab668 100755 --- a/tools/pkt_gen/ixnet/ixnet.py +++ b/tools/pkt_gen/ixnet/ixnet.py @@ -88,6 +88,7 @@ import csv from collections import OrderedDict from tools.pkt_gen import trafficgen from conf import settings +from conf import merge_spec from core.results.results_constants import ResultsConstants _ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) @@ -155,6 +156,7 @@ class IxNet(trafficgen.ITrafficGenerator): def __init__(self): """Initialize IXNET members """ + super().__init__() self._script = os.path.join(settings.getValue('TRAFFICGEN_IXIA_3RD_PARTY'), settings.getValue('TRAFFICGEN_IXNET_TCL_SCRIPT')) self._tclsh = tkinter.Tcl() @@ -227,7 +229,7 @@ class IxNet(trafficgen.ITrafficGenerator): self._params['traffic'] = self.traffic_defaults.copy() if traffic: - self._params['traffic'] = trafficgen.merge_spec( + self._params['traffic'] = merge_spec( self._params['traffic'], traffic) self._cfg['bidir'] = self._bidir @@ -281,7 +283,7 @@ class IxNet(trafficgen.ITrafficGenerator): self._params['traffic'] = self.traffic_defaults.copy() if traffic: - self._params['traffic'] = trafficgen.merge_spec( + self._params['traffic'] = merge_spec( self._params['traffic'], traffic) self._cfg['bidir'] = self._bidir @@ -418,7 +420,7 @@ class IxNet(trafficgen.ITrafficGenerator): self._params['traffic'] = self.traffic_defaults.copy() if traffic: - self._params['traffic'] = trafficgen.merge_spec( + self._params['traffic'] = merge_spec( self._params['traffic'], traffic) self._cfg['bidir'] = self._bidir diff --git a/tools/pkt_gen/moongen/moongen.py b/tools/pkt_gen/moongen/moongen.py index 7fd67661..9d604db2 100644 --- a/tools/pkt_gen/moongen/moongen.py +++ b/tools/pkt_gen/moongen/moongen.py @@ -28,19 +28,17 @@ import subprocess # VSPerf imports from conf import settings +from conf import merge_spec from core.results.results_constants import ResultsConstants -from tools.pkt_gen.trafficgen.trafficgenhelper import ( - TRAFFIC_DEFAULTS, - merge_spec) from tools.pkt_gen.trafficgen.trafficgen import ITrafficGenerator class Moongen(ITrafficGenerator): """Moongen Traffic generator wrapper.""" - _traffic_defaults = TRAFFIC_DEFAULTS.copy() _logger = logging.getLogger(__name__) def __init__(self): """Moongen class constructor.""" + super().__init__() self._logger.info("In moongen __init__ method") self._params = {} self._moongen_host_ip_addr = ( @@ -57,18 +55,6 @@ class Moongen(ITrafficGenerator): 'MOONGEN: Invalid line speed in configuration ' + \ 'file (today 10Gbps supported)') - @property - def traffic_defaults(self): - """Default traffic values. - - These can be expected to be constant across traffic generators, - so no setter is provided. Changes to the structure or contents - will likely break traffic generator implementations or tests - respectively. - """ - self._logger.info("In Moongen traffic_defaults method") - return self._traffic_defaults - def create_moongen_cfg_file(self, traffic, duration=60, acceptable_loss_pct=1, one_shot=0): """Create the Moongen configuration file from VSPERF's traffic profile diff --git a/tools/pkt_gen/trafficgen/__init__.py b/tools/pkt_gen/trafficgen/__init__.py index 2a3b9bd3..34d8ebe1 100755 --- a/tools/pkt_gen/trafficgen/__init__.py +++ b/tools/pkt_gen/trafficgen/__init__.py @@ -16,4 +16,3 @@ """ from tools.pkt_gen.trafficgen.trafficgen import * -from tools.pkt_gen.trafficgen.trafficgenhelper import * diff --git a/tools/pkt_gen/trafficgen/trafficgen.py b/tools/pkt_gen/trafficgen/trafficgen.py index fb40cd92..262df71d 100755 --- a/tools/pkt_gen/trafficgen/trafficgen.py +++ b/tools/pkt_gen/trafficgen/trafficgen.py @@ -15,16 +15,18 @@ This is an abstract class for traffic generators. """ +import copy +from conf import settings -#TODO update Back2Back method description when Result implementation will -#be ready. - -from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS +CMD_PREFIX = 'gencmd : ' class ITrafficGenerator(object): """Model of a traffic generator device. """ - _traffic_defaults = TRAFFIC_DEFAULTS.copy() + def __init__(self): + """Initialization of interface + """ + self._default_traffic = copy.deepcopy(settings.getValue('TRAFFIC')) @property def traffic_defaults(self): @@ -35,7 +37,7 @@ class ITrafficGenerator(object): will likely break traffic generator implementations or tests respectively. """ - return self._traffic_defaults + return self._default_traffic def __enter__(self): """Connect to the traffic generator. diff --git a/tools/pkt_gen/trafficgen/trafficgenhelper.py b/tools/pkt_gen/trafficgen/trafficgenhelper.py deleted file mode 100644 index 47f8b262..00000000 --- a/tools/pkt_gen/trafficgen/trafficgenhelper.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 2015-2016 Intel Corporation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Helper methods collection. - -Collection of helper methods used by traffic generators -implementation. -""" - -from collections import namedtuple - -CMD_PREFIX = 'gencmd : ' -TRAFFIC_DEFAULTS = { - 'traffic_type' : 'rfc2544_throughput', - 'frame_rate' : 100, - 'bidir' : 'False', # will be passed as string in title format to tgen - 'multistream' : 0, - 'stream_type' : 'L4', - 'pre_installed_flows' : 'No', # used by vswitch implementation - 'flow_type' : 'port', # used by vswitch implementation - - 'l2': { - 'framesize': 64, - 'srcmac': '00:00:00:00:00:00', - 'dstmac': '00:00:00:00:00:00', - }, - 'l3': { - 'proto': 'udp', - 'srcip': '1.1.1.1', - 'dstip': '90.90.90.90', - }, - 'l4': { - 'srcport': 3000, - 'dstport': 3001, - }, - 'vlan': { - 'enabled': False, - 'id': 0, - 'priority': 0, - 'cfi': 0, - }, -} - -#TODO remove namedtuples and implement results through IResult interface found -#in core/results - -BurstResult = namedtuple( - 'BurstResult', - 'frames_tx frames_rx bytes_tx bytes_rx payload_err seq_err') -Back2BackResult = namedtuple( - 'Back2BackResult', - 'rx_fps rx_mbps tx_percent rx_percent tx_count b2b_frames ' - 'frame_loss_frames frame_loss_percent') - - -def merge_spec(orig, new): - """Merges ``new`` dict with ``orig`` dict, and return orig. - - This takes into account nested dictionaries. Example: - - >>> old = {'foo': 1, 'bar': {'foo': 2, 'bar': 3}} - >>> new = {'foo': 6, 'bar': {'foo': 7}} - >>> merge_spec(old, new) - {'foo': 6, 'bar': {'foo': 7, 'bar': 3}} - - You'll notice that ``bar.bar`` is not removed. This is the desired result. - """ - for key in orig: - if key not in new: - continue - - # Not allowing derived dictionary types for now - # pylint: disable=unidiomatic-typecheck - if type(orig[key]) == dict: - orig[key] = merge_spec(orig[key], new[key]) - else: - orig[key] = new[key] - - for key in new: - if key not in orig: - orig[key] = new[key] - - return orig - diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py index 798bb832..20577e8d 100755 --- a/tools/pkt_gen/xena/xena.py +++ b/tools/pkt_gen/xena/xena.py @@ -36,10 +36,8 @@ import scapy.layers.inet as inet # VSPerf imports from conf import settings +from conf import merge_spec from core.results.results_constants import ResultsConstants -from tools.pkt_gen.trafficgen.trafficgenhelper import ( - TRAFFIC_DEFAULTS, - merge_spec) from tools.pkt_gen.trafficgen.trafficgen import ITrafficGenerator # Xena module imports @@ -56,10 +54,10 @@ class Xena(ITrafficGenerator): """ Xena Traffic generator wrapper class """ - _traffic_defaults = TRAFFIC_DEFAULTS.copy() _logger = logging.getLogger(__name__) def __init__(self): + super().__init__() self.mono_pipe = None self.xmanager = None self._params = {} @@ -71,7 +69,7 @@ class Xena(ITrafficGenerator): user_home = os.path.expanduser('~') self._log_path = '{}/Xena/Xena2544-2G/Logs/xena2544.log'.format( - user_home) + user_home) # make the folder and log file if they doesn't exist if not os.path.exists(self._log_path): @@ -80,18 +78,6 @@ class Xena(ITrafficGenerator): # empty the file contents open(self._log_path, 'w').close() - - @property - def traffic_defaults(self): - """Default traffic values. - - These can be expected to be constant across traffic generators, - so no setter is provided. Changes to the structure or contents - will likely break traffic generator implementations or tests - respectively. - """ - return self._traffic_defaults - @staticmethod def _create_throughput_result(root): """ @@ -703,4 +689,3 @@ class Xena(ITrafficGenerator): if __name__ == "__main__": pass - diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py index 51c10242..f09ded13 100644 --- a/vnfs/qemu/qemu_dpdk_vhost_user.py +++ b/vnfs/qemu/qemu_dpdk_vhost_user.py @@ -56,9 +56,16 @@ class QemuDpdkVhostUser(IVnfQemu): ifi = str(index) net = 'net' + str(index + 1) + # In case of testpmd as switch, path to vhost netdev folder will be set + # to tmp location instead of default ovs_var_tmp folder. + if S.getValue('VSWITCH') == 'none': + vhost_folder = '/tmp/' + else: + vhost_folder = S.getValue('TOOLS')['ovs_var_tmp'] + self._cmd += ['-chardev', 'socket,id=char' + ifi + - ',path=' + S.getValue('TOOLS')['ovs_var_tmp'] + + ',path=' + vhost_folder + 'dpdkvhostuser' + ifi, '-netdev', 'type=vhost-user,id=' + net + @@ -26,16 +26,14 @@ import time import datetime import shutil import unittest -import xmlrunner import locale import copy import glob import subprocess - -sys.dont_write_bytecode = True - +import ast +import xmlrunner from conf import settings -from conf import get_test_param +import core.component_factory as component_factory from core.loader import Loader from testcases import PerformanceTestCase from testcases import IntegrationTestCase @@ -44,8 +42,8 @@ from tools import networkcard from tools import functions from tools.pkt_gen import trafficgen from tools.opnfvdashboard import opnfvdashboard -from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS -import core.component_factory as component_factory + +sys.dont_write_bytecode = True VERBOSITY_LEVELS = { 'debug': logging.DEBUG, @@ -86,7 +84,14 @@ def parse_arguments(): value = value.strip() if len(param): if len(value): - results[param] = value + # values are passed inside string from CLI, so we must retype them accordingly + try: + results[param] = ast.literal_eval(value) + except ValueError: + # for backward compatibility, we have to accept strings without quotes + _LOGGER.warning("Adding missing quotes around string value: %s = %s", + param, str(value)) + results[param] = str(value) else: results[param] = True @@ -345,8 +350,7 @@ def enable_sriov(nic_list): or networkcard.get_sriov_numvfs(nic) <= sriov_nic[nic]: # if not, enable and set appropriate number of VFs if not networkcard.set_sriov_numvfs(nic, sriov_nic[nic] + 1): - _LOGGER.error("SRIOV cannot be enabled for NIC %s", nic) - raise + raise RuntimeError('SRIOV cannot be enabled for NIC {}'.format(nic)) else: _LOGGER.debug("SRIOV enabled for NIC %s", nic) @@ -375,8 +379,7 @@ def disable_sriov(nic_list): for nic in nic_list: if networkcard.is_sriov_nic(nic): if not networkcard.set_sriov_numvfs(nic.split('|')[0], 0): - _LOGGER.error("SRIOV cannot be disabled for NIC %s", nic) - raise + raise RuntimeError('SRIOV cannot be disabled for NIC {}'.format(nic)) else: _LOGGER.debug("SRIOV disabled for NIC %s", nic.split('|')[0]) @@ -579,9 +582,8 @@ def main(): 'driver' : networkcard.get_driver(tmp_nic), 'device' : networkcard.get_device_name(tmp_nic)}) else: - _LOGGER.error("Invalid network card PCI ID: '%s'", nic) vsperf_finalize() - raise + raise RuntimeError("Invalid network card PCI ID: '{}'".format(nic)) settings.setValue('NICS', nic_list) # for backward compatibility @@ -603,12 +605,7 @@ def main(): _LOGGER.debug("Executing traffic generator:") loader = Loader() # set traffic details, so they can be passed to traffic ctl - traffic = copy.deepcopy(TRAFFIC_DEFAULTS) - traffic.update({'traffic_type': get_test_param('traffic_type', TRAFFIC_DEFAULTS['traffic_type']), - 'bidir': get_test_param('bidirectional', TRAFFIC_DEFAULTS['bidir']), - 'multistream': int(get_test_param('multistream', TRAFFIC_DEFAULTS['multistream'])), - 'stream_type': get_test_param('stream_type', TRAFFIC_DEFAULTS['stream_type']), - 'frame_rate': int(get_test_param('iload', TRAFFIC_DEFAULTS['frame_rate']))}) + traffic = copy.deepcopy(settings.getValue('TRAFFIC')) traffic_ctl = component_factory.create_traffic( traffic['traffic_type'], @@ -689,4 +686,3 @@ def main(): if __name__ == "__main__": main() - diff --git a/yardstick/tests/p2p_rfc2544_throughput_sample.yaml b/yardstick/tests/p2p_rfc2544_throughput_sample.yaml index 91aa5d00..32b42187 100644 --- a/yardstick/tests/p2p_rfc2544_throughput_sample.yaml +++ b/yardstick/tests/p2p_rfc2544_throughput_sample.yaml @@ -28,11 +28,8 @@ scenarios: type: Vsperf options: testname: 'p2p_rfc2544_throughput' - traffic_type: 'rfc2544_throughput' frame_size: '64' - bidirectional: 'True' - iload: 100 - test_params: 'TRAFFICGEN_DURATION=30;' + test_params: 'TRAFFICGEN_DURATION=30;TRAFFIC={"traffic_type":"rfc2544_throughput"}' trafficgen_port1: 'eth1' trafficgen_port2: 'eth3' external_bridge: 'br-ex' diff --git a/yardstick/tests/rfc2544_back2back_dummy.yaml b/yardstick/tests/rfc2544_back2back_dummy.yaml index 9fe834c5..a45c4f61 100644 --- a/yardstick/tests/rfc2544_back2back_dummy.yaml +++ b/yardstick/tests/rfc2544_back2back_dummy.yaml @@ -30,14 +30,15 @@ scenarios: type: Vsperf options: testname: 'rfc2544_back2back' - traffic_type: 'rfc2544_back2back' frame_size: '64' - bidirectional: 'True' - iload: 100 test_params: 'TRAFFICGEN="Dummy"; + TRAFFIC={ + "traffic_type":"rfc2544_back2back" + }; TRAFFICGEN_DUMMY_RESULTS={ "b2b frames":"10000", - "b2b frame loss %":"0.0"}' + "b2b frame loss %":"0.0", + }' host: vsperf.demo diff --git a/yardstick/tests/rfc2544_continuous_dummy.yaml b/yardstick/tests/rfc2544_continuous_dummy.yaml index 9d189c80..2d02fce2 100644 --- a/yardstick/tests/rfc2544_continuous_dummy.yaml +++ b/yardstick/tests/rfc2544_continuous_dummy.yaml @@ -30,12 +30,12 @@ scenarios: type: Vsperf options: testname: 'rfc2544_continuous' - traffic_type: 'rfc2544_continuous' frame_size: '64' - bidirectional: 'True' - iload: 100 test_params: 'TRAFFICGEN_DURATION=30; TRAFFICGEN="Dummy"; + TRAFFIC={ + "traffic_type":"rfc2544_continuous" + }; TRAFFICGEN_DUMMY_RESULTS={ "frames tx":15000000, "frames rx":15000000, diff --git a/yardstick/tests/rfc2544_throughput_dummy.yaml b/yardstick/tests/rfc2544_throughput_dummy.yaml index 9ebf28c4..1abbea63 100644 --- a/yardstick/tests/rfc2544_throughput_dummy.yaml +++ b/yardstick/tests/rfc2544_throughput_dummy.yaml @@ -30,12 +30,12 @@ scenarios: type: Vsperf options: testname: 'rfc2544_throughput' - traffic_type: 'rfc2544_throughput' frame_size: '64' - bidirectional: 'True' - iload: 100 test_params: 'TRAFFICGEN_DURATION=30; TRAFFICGEN="Dummy"; + TRAFFIC={ + "traffic_type":"rfc2544_throughput" + }; TRAFFICGEN_DUMMY_RESULTS={ "frames tx":15000000, "frames rx":15000000, |