diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2016-12-14 14:02:43 +0000 |
---|---|---|
committer | Martin Klozik <martinx.klozik@intel.com> | 2017-01-16 08:50:02 +0000 |
commit | 4481df385ac03ece015ccb429201f96189dc5ae2 (patch) | |
tree | a959a804e7b1efd663dbb24a447609421e339211 /vsperf | |
parent | cafcb9f24b422a4b3a0b19ba00c83fe2819dcbaa (diff) |
traffic: Configurable traffic details
Traffic generated by traffic generator is based on default
values and their modifications specific to particular testing
scenario. Traffic default values were defined inside VSPERF
code and it was not possible to change them. This patch introduces
new TRAFFIC dictionary inside 03_traffic.conf. Thus user can
modify any of TRAFFIC values either in configuration file
or by CLI or by 'Parameters' section of testcase definition.
Following CLI options were obsoleted by this patch:
'bidirectional', 'traffic_type', 'iload', 'multistream',
'stream_type' and 'pre-installed_flows'
Following CLI option was renamed to be consistent with other options:
'tunnel_type' => 'TUNNEL_TYPE'
Following sections of testcase definition were obsoleted:
"Traffic Type", "biDirectional", "MultiStream", "Stream Type",
"Pre-installed Flows", "Flow Type" and "iLoad"
New TRAFFIC dictionary should be used instead of old CLI options
and old testcase definition sections. Testcase definitons,
yardstick sample testcases and documentation were updated to reflect
configuration changes.
JIRA: VSPERF-433
Change-Id: I03a388c766491d5688e715f6d7b51e8e0377ec27
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Bill Michalowski <bmichalo@redhat.com>
Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com>
Reviewed-by: <sridhar.rao@spirent.com>
Diffstat (limited to 'vsperf')
-rwxr-xr-x | vsperf | 38 |
1 files changed, 17 insertions, 21 deletions
@@ -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() - |