diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2017-11-09 13:09:25 +0000 |
---|---|---|
committer | Martin Klozik <martinx.klozik@intel.com> | 2017-11-09 13:25:25 +0000 |
commit | bee2d008c4f708895ef93a7918c20d546091ac29 (patch) | |
tree | 7ed345d225596138621080a9338f8fd137cf1476 | |
parent | 1653f5d6a12febed50f138076dcf8c191d9f24e6 (diff) |
paths: Modify algorithm for PATHS verification
VSPERF verifies if PATHS to the tools (vSwitch, VNF, etc.)
are valid. This check was modified to take into the account
tools required by selected testcase. It will help to avoid
runtime errors triggered by missing tools, which
are not essential for testcase execution.
Change-Id: Ifcfea983cad1bdbc8c1f08c7a0281001005410df
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: Sridhar Rao <sridhar.rao@spirent.com>
Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
-rw-r--r-- | conf/03_traffic.conf | 2 | ||||
-rw-r--r-- | tools/functions.py | 24 | ||||
-rw-r--r-- | tools/pkt_gen/trex/trex.py | 19 | ||||
-rwxr-xr-x | vsperf | 4 |
4 files changed, 33 insertions, 16 deletions
diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index b5533833..c16b0d6a 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -444,7 +444,7 @@ TRAFFICGEN_TREX_LINE_SPEED_GBPS = '10' # FOR SR-IOV or multistream layer 2 tests to work with T-Rex enable Promiscuous mode TRAFFICGEN_TREX_PROMISCUOUS=False PATHS['trafficgen'] = { - 'trex': { + 'Trex': { 'type' : 'src', 'src': { 'path': os.path.join(ROOT_DIR, 'src/trex/trex/scripts/automation/trex_control_plane/stl') diff --git a/tools/functions.py b/tools/functions.py index e8bc31da..aeaa2ed8 100644 --- a/tools/functions.py +++ b/tools/functions.py @@ -65,15 +65,23 @@ def settings_update_paths(): but testpmd can't be used as a guest loopback. This is useful in case, that other guest loopback applications (e.g. buildin) are used by CI jobs, etc. """ - # set dpdk and ovs paths accorfing to VNF and VSWITCH + # set dpdk and ovs paths according to VNF, VSWITCH and TRAFFICGEN selection paths = {} - vswitch_type = S.getValue('PATHS')['vswitch'][S.getValue('VSWITCH')]['type'] - paths['vswitch'] = S.getValue('PATHS')['vswitch'][S.getValue('VSWITCH')][vswitch_type] - paths['dpdk'] = S.getValue('PATHS')['dpdk'][S.getValue('PATHS')['dpdk']['type']] - paths['qemu'] = S.getValue('PATHS')['qemu'][S.getValue('PATHS')['qemu']['type']] - paths['paths'] = {} - paths['paths']['ovs_var_tmp'] = S.getValue('PATHS')['vswitch']['ovs_var_tmp'] - paths['paths']['ovs_etc_tmp'] = S.getValue('PATHS')['vswitch']['ovs_etc_tmp'] + if S.getValue("mode") != 'trafficgen': + # VSWITCH & (probably) VNF are needed + vswitch_type = S.getValue('PATHS')['vswitch'][S.getValue('VSWITCH')]['type'] + paths['vswitch'] = S.getValue('PATHS')['vswitch'][S.getValue('VSWITCH')][vswitch_type] + paths['dpdk'] = S.getValue('PATHS')['dpdk'][S.getValue('PATHS')['dpdk']['type']] + paths['qemu'] = S.getValue('PATHS')['qemu'][S.getValue('PATHS')['qemu']['type']] + paths['paths'] = {} + paths['paths']['ovs_var_tmp'] = S.getValue('PATHS')['vswitch']['ovs_var_tmp'] + paths['paths']['ovs_etc_tmp'] = S.getValue('PATHS')['vswitch']['ovs_etc_tmp'] + + if S.getValue("mode") != 'trafficgen-off': + # TRAFFCIGEN is required + if S.getValue('TRAFFICGEN') in S.getValue('PATHS')['trafficgen']: + tmp_trafficgen = S.getValue('PATHS')['trafficgen'][S.getValue('TRAFFICGEN')] + paths['trafficgen'] = tmp_trafficgen[tmp_trafficgen['type']] tools = {} # pylint: disable=too-many-nested-blocks diff --git a/tools/pkt_gen/trex/trex.py b/tools/pkt_gen/trex/trex.py index abae35dc..70864a53 100644 --- a/tools/pkt_gen/trex/trex.py +++ b/tools/pkt_gen/trex/trex.py @@ -27,9 +27,18 @@ from conf import settings from conf import merge_spec from core.results.results_constants import ResultsConstants from tools.pkt_gen.trafficgen.trafficgen import ITrafficGenerator -# pylint: disable=wrong-import-position, import-error -sys.path.append(settings.getValue('PATHS')['trafficgen']['trex']['src']['path']) -from trex_stl_lib.api import * +try: + # pylint: disable=wrong-import-position, import-error + sys.path.append(settings.getValue('PATHS')['trafficgen']['Trex']['src']['path']) + from trex_stl_lib.api import * +except ImportError: + # VSPERF performs detection of T-Rex api during testcase initialization. So if + # T-Rex is requsted and API is not available it will fail before this code + # is reached. + # This code can be reached in case that --list-trafficgens is called, but T-Rex + # api is not installed. In this case we can ignore an exception, becuase T-Rex + # import won't be used. + pass _EMPTY_STATS = { 'global': {'bw_per_core': 0.0, @@ -337,8 +346,8 @@ class Trex(ITrafficGenerator): raise NotImplementedError( 'Trex stop_cont_traffic method not implemented') - def send_rfc2544_throughput(self, traffic=None, duration=60, - lossrate=0.0, tests=10): + def send_rfc2544_throughput(self, traffic=None, tests=1, duration=60, + lossrate=0.0): """See ITrafficGenerator for description """ self._logger.info("In Trex send_rfc2544_throughput method") @@ -546,8 +546,8 @@ def main(): settings.setValue('mode', args['mode']) - # set dpdk and ovs paths according to VNF and VSWITCH - if settings.getValue('mode') != 'trafficgen': + # update paths to trafficgens if required + if settings.getValue('mode') == 'trafficgen': functions.settings_update_paths() # if required, handle list-* operations |