aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vsperf.py10
-rw-r--r--yardstick/benchmark/scenarios/networking/vsperf.py67
2 files changed, 48 insertions, 29 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_vsperf.py b/tests/unit/benchmark/scenarios/networking/test_vsperf.py
index cb5c09ab3..25d52212b 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vsperf.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vsperf.py
@@ -39,17 +39,17 @@ class VsperfTestCase(unittest.TestCase):
}
self.args = {
'options': {
- 'testname': 'rfc2544_p2p_continuous',
+ 'testname': 'p2p_rfc2544_continuous',
'traffic_type': 'continuous',
- 'pkt_sizes': '64',
+ 'frame_size': '64',
'bidirectional': 'True',
'iload': 100,
- 'duration': 29,
'trafficgen_port1': 'eth1',
'trafficgen_port2': 'eth3',
'external_bridge': 'br-ex',
- 'conf-file': 'vsperf-yardstick.conf',
- 'setup-script': 'setup_yardstick.sh',
+ 'conf_file': 'vsperf-yardstick.conf',
+ 'setup_script': 'setup_yardstick.sh',
+ 'test_params': 'TRAFFICGEN_DURATION=30;',
},
'sla': {
'metrics': 'throughput_rx_fps',
diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py
index 82db1e254..39912a95a 100644
--- a/yardstick/benchmark/scenarios/networking/vsperf.py
+++ b/yardstick/benchmark/scenarios/networking/vsperf.py
@@ -32,14 +32,11 @@ class Vsperf(base.Scenario):
the valid values are "rfc2544", "continuous", "back2back"
type: string
default: "rfc2544"
- pkt_sizes - a packet size for which test should be executed;
- Multiple packet sizes can be tested by modification of Sequence runner
+ frame_size - a frame size for which test should be executed;
+ Multiple frame sizes can be tested by modification of sequence runner
section inside TC YAML definition.
type: string
default: "64"
- duration - sets duration for which traffic will be generated
- type: int
- default: 30
bidirectional - speficies if traffic will be uni (False) or bi-directional
(True)
type: string
@@ -47,9 +44,6 @@ class Vsperf(base.Scenario):
iload - specifies frame rate
type: string
default: 100
- rfc2544_trials - the number of trials performed for each packet size
- type: string
- default: NA
multistream - the number of simulated streams
type: string
default: 0 (disabled)
@@ -57,11 +51,24 @@ class Vsperf(base.Scenario):
the valid values are "L4", "L3" and "L2"
type: string
default: "L4"
- conf-file - path to the vsperf configuration file, which will be uploaded
- to the VM
+ test_params - specifies a string with a list of vsperf configuration
+ parameters, which will be passed to the '--test-params' CLI argument;
+ Parameters should be stated in the form of 'param=value' and separated
+ by a semicolon. Please check VSPERF documentation for details about
+ available configuration parameters and their data types.
+ In case that both 'test_params' and 'conf_file' are specified,
+ then values from 'test_params' will override values defined
+ in the configuration file.
+ type: string
+ default: NA
+ conf_file - path to the vsperf configuration file, which will be uploaded
+ to the VM;
+ In case that both 'test_params' and 'conf_file' are specified,
+ then values from 'test_params' will override values defined
+ in configuration file.
type: string
default: NA
- setup-script - path to the setup script, which will be executed during
+ setup_script - path to the setup script, which will be executed during
setup and teardown phases
type: string
default: NA
@@ -80,8 +87,6 @@ class Vsperf(base.Scenario):
"""
__scenario_type__ = "Vsperf"
- VSPERF_CONF = '~/vsperf-yardstick.conf'
-
def __init__(self, scenario_cfg, context_cfg):
self.scenario_cfg = scenario_cfg
self.context_cfg = context_cfg
@@ -93,13 +98,18 @@ class Vsperf(base.Scenario):
None)
self.br_ex = self.scenario_cfg['options'].get('external_bridge',
'br-ex')
- self.vsperf_conf = os.path.expanduser(
- self.scenario_cfg['options'].get('conf-file', Vsperf.VSPERF_CONF))
- self.setup_script = self.scenario_cfg['options'].get('setup-script',
+ self.vsperf_conf = self.scenario_cfg['options'].get('conf_file', None)
+ if self.vsperf_conf:
+ self.vsperf_conf = os.path.expanduser(self.vsperf_conf)
+
+ self.setup_script = self.scenario_cfg['options'].get('setup_script',
None)
if self.setup_script:
self.setup_script = os.path.expanduser(self.setup_script)
+ self.test_params = self.scenario_cfg['options'].get('test-params',
+ None)
+
def setup(self):
'''scenario setup'''
vsperf = self.context_cfg['host']
@@ -123,9 +133,10 @@ class Vsperf(base.Scenario):
# traffic generation could last long
self.client.wait(timeout=1800)
- # copy script to host
- self.client.run("cat > ~/vsperf.conf",
- stdin=open(self.vsperf_conf, "rb"))
+ # copy script to host if needed
+ if self.vsperf_conf:
+ self.client.run("cat > ~/vsperf.conf",
+ stdin=open(self.vsperf_conf, "rb"))
# execute external setup script
if self.setup_script:
@@ -166,18 +177,26 @@ class Vsperf(base.Scenario):
options = self.scenario_cfg['options']
test_params = []
test_params.append(add_test_params(options, "traffic_type", "rfc2544"))
- test_params.append(add_test_params(options, "pkt_sizes", "64"))
- test_params.append(add_test_params(options, "duration", None))
test_params.append(add_test_params(options, "bidirectional", "False"))
test_params.append(add_test_params(options, "iload", 100))
- test_params.append(add_test_params(options, "rfc2544_trials", None))
test_params.append(add_test_params(options, "multistream", None))
test_params.append(add_test_params(options, "stream_type", None))
+ if 'frame_size' in options:
+ test_params.append("%s=(%s,)" % ('TRAFFICGEN_PKT_SIZES',
+ options['frame_size']))
+ if 'test_params' in options:
+ test_params.append(options['test_params'])
+
+ # filter empty parameters and escape quotes and double quotes
+ test_params = [tp.replace('"', '\\"').replace("'", "\\'")
+ for tp in test_params if tp]
# execute vsperf
cmd = "source ~/vsperfenv/bin/activate ; cd vswitchperf ; "
- cmd += "./vsperf --mode trafficgen --conf-file ~/vsperf.conf "
- cmd += "--test-params=\"%s\"" % (';'.join(filter(None, test_params)))
+ cmd += "./vsperf --mode trafficgen "
+ if self.vsperf_conf:
+ cmd += "--conf-file ~/vsperf.conf "
+ cmd += "--test-params=\"%s\"" % (';'.join(test_params))
LOG.debug("Executing command: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)