summaryrefslogtreecommitdiffstats
path: root/testcases/testcase.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2016-01-13 14:57:07 +0000
committerMaryam Tahhan <maryam.tahhan@intel.com>2016-01-22 10:03:52 +0000
commit864832fd348efa21155b24a314dab22fe967c8c3 (patch)
tree04c918abbbf7b81672a9ddac19b6ebcc3df1e224 /testcases/testcase.py
parent2a2baf3f5f348539b50194a456b49b4ccb32b775 (diff)
pkt_gen: support of standalone execution of traffic generator
Support for multiple modes of VSPERF operation has been added. These modes can be used for standalone execution of traffic generator or for manual testing or for execution of unsupported traffic generator. Supported modes are: "normal" - execute vSwitch, VNF and traffic generator; "trafficgen" - execute only traffic generator; "trafficgen-off" - execute vSwitch and VNF. Normal mode is selected by default. In case that trafficgen mode is selected, then various --test-params could be specified to affect traffic generator configuration. These parameters include traffic type, frame rate, bidirectional and scalability settings. Selection of transport protocol is not supported by IxNet yet (UDP is enforced), thus modification of transport protocol from command line is not supported too. Fixes of testpmd and qemu warning patches are inclduded. Change-Id: Idac10fe03e724075268a01ec3eb0817fba830aec JIRA: VSPERF-173 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Al Morton <acmorton@att.com>
Diffstat (limited to 'testcases/testcase.py')
-rw-r--r--testcases/testcase.py56
1 files changed, 36 insertions, 20 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 7d5162e6..9c755ea7 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -19,6 +19,7 @@ import os
import logging
import subprocess
import copy
+import time
from collections import OrderedDict
from core.results.results_constants import ResultsConstants
@@ -45,14 +46,23 @@ class TestCase(object):
:param results_dir: Where the csv formatted results are written.
"""
self._hugepages_mounted = False
+
+ # set test parameters; CLI options take precedence to testcase settings
self._logger = logging.getLogger(__name__)
self.name = cfg['Name']
self.desc = cfg.get('Description', 'No description given.')
+
+ bidirectional = cfg.get('biDirectional', False)
+ bidirectional = get_test_param('bidirectional', bidirectional)
+
+ traffic_type = cfg.get('Traffic Type', 'rfc2544')
+ traffic_type = get_test_param('traffic_type', traffic_type)
+
+ framerate = cfg.get('iLoad', 100)
+ framerate = get_test_param('iload', framerate)
+
self.deployment = cfg['Deployment']
self._frame_mod = cfg.get('Frame Modification', None)
- framerate = get_test_param('iload', None)
- if framerate == None:
- framerate = cfg.get('iLoad', 100)
# identify guest loopback method, so it can be added into reports
self.guest_loopback = []
@@ -75,7 +85,6 @@ class TestCase(object):
pre_installed_flows = cfg.get('Pre-installed Flows', 'No')
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:
@@ -90,9 +99,9 @@ class TestCase(object):
# set traffic details, so they can be passed to vswitch and traffic ctls
self._traffic = copy.deepcopy(TRAFFIC_DEFAULTS)
- self._traffic.update({'traffic_type': cfg['Traffic Type'],
+ self._traffic.update({'traffic_type': traffic_type,
'flow_type': cfg.get('Flow Type', 'port'),
- 'bidir': cfg['biDirectional'],
+ 'bidir': bidirectional,
'multistream': int(multistream),
'stream_type': stream_type,
'pre_installed_flows' : pre_installed_flows,
@@ -152,29 +161,36 @@ class TestCase(object):
if not self._vswitch_none:
self._add_flows(vswitch_ctl)
- with traffic_ctl:
- traffic_ctl.send_traffic(self._traffic)
+ # run traffic generator if requested, otherwise wait for manual termination
+ if S.getValue('mode') == 'trafficgen-off':
+ time.sleep(2)
+ self._logger.debug("All is set. Please run traffic generator manually.")
+ input(os.linesep + "Press Enter to terminate vswitchperf..." + os.linesep + os.linesep)
+ else:
+ with traffic_ctl:
+ traffic_ctl.send_traffic(self._traffic)
- # dump vswitch flows before they are affected by VNF termination
- if not self._vswitch_none:
- vswitch_ctl.dump_vswitch_flows()
+ # dump vswitch flows before they are affected by VNF termination
+ if not self._vswitch_none:
+ vswitch_ctl.dump_vswitch_flows()
# umount hugepages if mounted
self._umount_hugepages()
- self._logger.debug("Traffic Results:")
- traffic_ctl.print_results()
-
self._logger.debug("Collector Results:")
collector.print_results()
- output_file = os.path.join(self._results_dir, "result_" + self.name +
- "_" + self.deployment + ".csv")
+ if S.getValue('mode') != 'trafficgen-off':
+ self._logger.debug("Traffic Results:")
+ traffic_ctl.print_results()
+
+ output_file = os.path.join(self._results_dir, "result_" + self.name +
+ "_" + self.deployment + ".csv")
- tc_results = self._append_results(traffic_ctl.get_results())
- TestCase._write_result_to_file(tc_results, output_file)
+ tc_results = self._append_results(traffic_ctl.get_results())
+ TestCase._write_result_to_file(tc_results, output_file)
- report.generate(output_file, tc_results, collector.get_results())
+ report.generate(output_file, tc_results, collector.get_results())
def _append_results(self, results):
"""
@@ -287,7 +303,7 @@ class TestCase(object):
return list(result.keys())
- def _add_flows(vswitch_ctl):
+ def _add_flows(self, vswitch_ctl):
"""Add flows to the vswitch
:param vswitch_ctl vswitch controller