diff options
Diffstat (limited to 'conf')
-rwxr-xr-x | conf/01_testcases.conf | 172 | ||||
-rw-r--r-- | conf/03_traffic.conf | 137 | ||||
-rw-r--r-- | conf/__init__.py | 67 | ||||
-rw-r--r-- | conf/integration/01_testcases.conf | 80 |
4 files changed, 326 insertions, 130 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/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 |