diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2016-11-11 08:04:54 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-11-11 08:04:54 +0000 |
commit | 9f3fce18b414e10724549dbee8113c6bdfa2f5db (patch) | |
tree | ca0cef2a6ec1ee810332dbba7121e4bb006a20a7 /conf | |
parent | 131fd1cccc824371fa3b1e7a8477818a03fa1d35 (diff) | |
parent | eabc66eef336b3c47c366027b205d26db10a3c21 (diff) |
Merge "cli: Modify configuration via CLI"
Diffstat (limited to 'conf')
-rwxr-xr-x | conf/01_testcases.conf | 13 | ||||
-rw-r--r-- | conf/03_traffic.conf | 19 | ||||
-rw-r--r-- | conf/04_vnf.conf | 2 | ||||
-rw-r--r-- | conf/10_custom.conf | 2 | ||||
-rw-r--r-- | conf/__init__.py | 78 | ||||
-rw-r--r-- | conf/integration/01_testcases.conf | 19 | ||||
-rw-r--r-- | conf/integration/03_traffic.conf | 3 |
7 files changed, 108 insertions, 28 deletions
diff --git a/conf/01_testcases.conf b/conf/01_testcases.conf index 55cce1cf..f30c1912 100755 --- a/conf/01_testcases.conf +++ b/conf/01_testcases.conf @@ -115,11 +115,14 @@ # # stated in configuration files or value # # specified on command line through --trafficgen # # parameter. -# "Parameters" : "pkt_sizes=512" # Defines list of test parameters used for test -# # execution. It will override any values defined -# # by TEST_PARAMS option stated in configuration -# # files or values specified on command line through -# # --test-params parameter. +# "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 +# # be restored after TC finishes. This dictionary will +# # override any values defined by TEST_PARAMS option +# # stated in configuration files or values specified +# # on command line through --test-params parameter. # "Test Modifier": [FrameMod|Other], # "Dependency": [Test_Case_Name |None], diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 8efd5aab..d7327629 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -34,6 +34,15 @@ TRAFFICGEN = 'Dummy' # Expand like this: (64, 128, 256, 512, 1024) TRAFFICGEN_PKT_SIZES = (64,) +TRAFFICGEN_DURATION = 30 + +TRAFFICGEN_RFC2544_TESTS = 1 +TRAFFICGEN_RFC2889_TRIALS = 1 +TRAFFICGEN_LOSSRATE = 0.0 + +############################# +# IXIA Configuration -- BEGIN + # path to 'ixos' install path TRAFFICGEN_IXIA_ROOT_DIR = '/opt/ixos' @@ -67,6 +76,10 @@ TRAFFICGEN_IXIA_3RD_PARTY = os.path.join(ROOT_DIR, '3rd_party/ixia') # default TCL script, which will be used for IXNETWORK configuration TRAFFICGEN_IXNET_TCL_SCRIPT = 'ixnetrfc2544.tcl' +# IXIA Configuration -- END +########################### + + ########################################### # Spirent TestCenter Configuration -- BEGIN @@ -172,6 +185,9 @@ TRAFFICGEN_STC_VERBOSE = "True" # Spirent TestCenter Configuration -- END ######################################### +############################# +# Xena Configuration -- BEGIN + # Xena traffic generator connection info TRAFFICGEN_XENA_IP = '' TRAFFICGEN_XENA_PORT1 = '' @@ -198,6 +214,9 @@ TRAFFICGEN_XENA_2544_TPUT_VALUE_RESOLUTION = '0.5' TRAFFICGEN_XENA_2544_TPUT_USEPASS_THRESHHOLD = 'false' TRAFFICGEN_XENA_2544_TPUT_PASS_THRESHHOLD = '0.0' +# Xena Configuration -- END +########################### + ################################################### # MoonGen Configuration and Connection Info-- BEGIN diff --git a/conf/04_vnf.conf b/conf/04_vnf.conf index d3b4be4d..75f107e8 100644 --- a/conf/04_vnf.conf +++ b/conf/04_vnf.conf @@ -96,8 +96,6 @@ GUEST_SHARED_DRIVE_TYPE = ['scsi'] # 'linux_bridge' - linux bridge will be configured # 'buildin' - nothing will be configured by vsperf; VM image must # ensure traffic forwarding between its interfaces -# This configuration option can be overridden by CLI SCALAR option -# guest_loopback, e.g. --test-params "guest_loopback=l2fwd" # For 2 VNFs you may use ['testpmd', 'l2fwd'] GUEST_LOOPBACK = ['testpmd'] diff --git a/conf/10_custom.conf b/conf/10_custom.conf index 25e3478e..929d2679 100644 --- a/conf/10_custom.conf +++ b/conf/10_custom.conf @@ -103,7 +103,7 @@ TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS = '10' # MoonGen Configuration and Connection Info-- END ################################################### -#TEST_PARAMS = {'pkt_sizes':'64'} +#TEST_PARAMS = {'TRAFFICGEN_PKT_SIZES':(64,)} OPNFV_INSTALLER = "Fuel" OPNFV_URL = "http://testresults.opnfv.org/testapi" PACKAGE_LIST = "src/package-list.mk" diff --git a/conf/__init__.py b/conf/__init__.py index 4d6f57fe..2448d390 100644 --- a/conf/__init__.py +++ b/conf/__init__.py @@ -29,6 +29,10 @@ 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'] + # regex to parse configuration macros from 04_vnf.conf # it will select all patterns starting with # sign # and returns macro parameters and step @@ -49,7 +53,13 @@ class Settings(object): """Return a settings item value """ if attr in self.__dict__: - return getattr(self, attr) + if attr == 'TEST_PARAMS': + return getattr(self, attr) + else: + master_value = getattr(self, attr) + # Check if parameter value was overridden by CLI option + cli_value = get_test_param(attr, None) + return cli_value if cli_value else master_value else: raise AttributeError("%r object has no attribute %r" % (self.__class__, attr)) @@ -136,6 +146,24 @@ class Settings(object): for key in os.environ: setattr(self, key, os.environ[key]) + def check_test_params(self): + """ + Check all parameters defined inside TEST_PARAMS for their + existence. In case that non existing vsperf parmeter name + is detected, then VSPER will raise a runtime error. + """ + unknown_keys = [] + for key in settings.getValue('TEST_PARAMS'): + if key == 'TEST_PARAMS': + raise RuntimeError('It is not allowed to define TEST_PARAMS ' + 'as a test parameter') + if key not in self.__dict__ and key not in _EXTRA_TEST_PARAMS: + unknown_keys.append(key) + + if len(unknown_keys): + raise RuntimeError('Test parameters contain unknown configuration ' + 'parameter(s): {}'.format(', '.join(unknown_keys))) + def check_vm_settings(self, vm_number): """ Check all VM related settings starting with GUEST_ prefix. @@ -145,15 +173,12 @@ class Settings(object): """ for key in self.__dict__: if key.startswith('GUEST_'): - if (isinstance(self.__dict__[key], str) and - self.__dict__[key].find('#') >= 0): - self.__dict__[key] = [self.__dict__[key]] + value = self.getValue(key) + if isinstance(value, str) and value.find('#') >= 0: self._expand_vm_settings(key, 1) - self.__dict__[key] = self.__dict__[key][0] - if isinstance(self.__dict__[key], list): - if (len(self.__dict__[key]) < vm_number or - str(self.__dict__[key][0]).find('#') >= 0): + if isinstance(value, list): + if len(value) < vm_number or str(value[0]).find('#') >= 0: # expand configuration for all VMs self._expand_vm_settings(key, vm_number) @@ -161,7 +186,15 @@ class Settings(object): """ Expand VM option with given key for given number of VMs """ - master_value = self.__dict__[key][0] + tmp_value = self.getValue(key) + if isinstance(tmp_value, str): + scalar = True + master_value = tmp_value + tmp_value = [tmp_value] + else: + scalar = False + master_value = tmp_value[0] + master_value_str = str(master_value) if master_value_str.find('#') >= 0: self.__dict__[key] = [] @@ -190,9 +223,12 @@ class Settings(object): value = ast.literal_eval(value) self.__dict__[key].append(value) else: - for vmindex in range(len(self.__dict__[key]), vm_number): + for vmindex in range(len(tmp_value), vm_number): self.__dict__[key].append(master_value) + if scalar: + self.__dict__[key] = self.__dict__[key][0] + _LOGGER.debug("Expanding option: %s = %s", key, self.__dict__[key]) def __str__(self): @@ -203,7 +239,11 @@ class Settings(object): Returns: A human-readable string. """ - return pprint.pformat(self.__dict__) + tmp_dict = {} + for key in self.__dict__: + tmp_dict[key] = self.getValue(key) + + return pprint.pformat(tmp_dict) # # validation methods used by step driven testcases @@ -222,7 +262,6 @@ class Settings(object): settings = Settings() - def get_test_param(key, default=None): """Retrieve value for test param ``key`` if available. @@ -232,4 +271,17 @@ def get_test_param(key, default=None): :returns: Value for ``key`` if found, else ``default``. """ test_params = settings.getValue('TEST_PARAMS') - return test_params.get(key, default) if test_params else default + if key in test_params: + if not isinstance(test_params.get(key), str): + return test_params.get(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 diff --git a/conf/integration/01_testcases.conf b/conf/integration/01_testcases.conf index 83d420bf..a584845a 100644 --- a/conf/integration/01_testcases.conf +++ b/conf/integration/01_testcases.conf @@ -328,6 +328,7 @@ INTEGRATION_TESTS = [ "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'}, }, { "Name": "overlay_p2p_tput", @@ -337,6 +338,7 @@ INTEGRATION_TESTS = [ "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "encapsulation", "Description": "Overlay Encapsulation Throughput RFC2544 Test", + "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, }, { "Name": "overlay_p2p_cont", @@ -346,6 +348,7 @@ INTEGRATION_TESTS = [ "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "encapsulation", "Description": "Overlay Encapsulation Continuous Stream", + "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, }, { "Name": "overlay_p2p_decap_tput", @@ -355,6 +358,7 @@ INTEGRATION_TESTS = [ "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "decapsulation", "Description": "Overlay Decapsulation Throughput RFC2544 Test", + "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, }, { "Name": "overlay_p2p_decap_cont", @@ -364,6 +368,7 @@ INTEGRATION_TESTS = [ "Tunnel Type": SUPPORTED_TUNNELING_PROTO[0], "Tunnel Operation": "decapsulation", "Description": "Overlay Decapsulation Continuous Stream", + "Parameters": {'TRAFFICGEN_IXNET_TCL_SCRIPT' : 'ixnetrfc2544v2.tcl'}, }, { "Name": "vswitch_add_del_bridge", @@ -747,7 +752,9 @@ INTEGRATION_TESTS = [ { # Topology: 2 Parallel PVP connections # To run a Linux bridge as a loopback in the Guest use: - # --test-params "guest_loopback=linux_bridge" --integration 2pvp_udp_dest_flows + # --test-params "GUEST_LOOPBACK=['linux_bridge']" --integration 2pvp_udp_dest_flows + # or add "Parameters" option to the test definition: + # "Parameters" : {'GUEST_LOOPBACK' : ['linux_bridge'],}, "Name": "2pvp_udp_dest_flows", "Description": "Continuous TC with 2 Parallel VMs, flows on UDP Dest Port", "Deployment": "clean", @@ -768,7 +775,9 @@ INTEGRATION_TESTS = [ { # Topology: 4 Parallel PVP connections # To run a Linux bridge as a loopback in the Guest use: - # --test-params "guest_loopback=linux_bridge" --integration 4pvp_udp_dest_flows + # --test-params "GUEST_LOOPBACK=['linux_bridge']" --integration 4pvp_udp_dest_flows + # or add "Parameters" option to the test definition: + # "Parameters" : {'GUEST_LOOPBACK' : ['linux_bridge'],}, "Name": "4pvp_udp_dest_flows", "Description": "Continuous TC with 4 Parallel VMs, flows on UDP Dest Port", "Deployment": "clean", @@ -793,7 +802,9 @@ INTEGRATION_TESTS = [ { # Topology: 6 Parallel PVP connections # To run a Linux bridge as a loopback in the Guest use: - # --test-params "guest_loopback=linux_bridge" --integration 6pvp_udp_dest_flows + # --test-params "GUEST_LOOPBACK=['linux_bridge']" --integration 6pvp_udp_dest_flows + # or add "Parameters" option to the test definition: + # "Parameters" : {'GUEST_LOOPBACK' : ['linux_bridge'],}, "Name": "6pvp_udp_dest_flows", "Description": "Continuous TC with 6 Parallel VMs, flows on UDP Dest Port", "Deployment": "clean", @@ -901,7 +912,7 @@ INTEGRATION_TESTS = [ # "vSwitch" : "OvsVanilla", # "VNF" : "QemuVirtioNet", # "Trafficgen": "IxNet", -# "Parameters": {"guest_loopback" : "linux_bridge"}, +# "Parameters": {"GUEST_LOOPBACK" : ["linux_bridge"],}, # "TestSteps": STEP_VSWITCH_PVP_FLOWS_INIT + # [ # ['vnf', 'start'], diff --git a/conf/integration/03_traffic.conf b/conf/integration/03_traffic.conf index 0b46cea0..e78e2668 100644 --- a/conf/integration/03_traffic.conf +++ b/conf/integration/03_traffic.conf @@ -18,9 +18,6 @@ TRAFFICGEN_PORT2_MAC = '02:00:00:00:00:02' TRAFFICGEN_PORT1_IP = '1.1.1.1' TRAFFICGEN_PORT2_IP = '90.90.90.90' -# To test VXLAN set the ff to ixnetrfc2544v2.tcl -TRAFFICGEN_IXNET_TCL_SCRIPT = 'ixnetrfc2544v2.tcl' - # VXLAN traffic item VXLAN_VNI = '99' |