Merge "Allow to specify iperf bandwidth 0"

This commit is contained in:
Jenkins
2016-01-12 13:51:03 +00:00
committed by Gerrit Code Review
3 changed files with 11 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ class CommandLine(object):
def add(self, param_name, param_value=None):
self.tokens.append('%s' % param_name)
if param_value:
if param_value is not None:
self.tokens.append(str(param_value))
def make(self):

View File

@@ -30,7 +30,7 @@ def add_common_iperf_params(cmd, executor):
cmd.add('--len', executor.test_definition.get('buffer_size'))
if executor.test_definition.get('udp'):
cmd.add('--udp')
if executor.test_definition.get('bandwidth'):
if executor.test_definition.get('bandwidth') is not None:
cmd.add('--bandwidth', executor.test_definition.get('bandwidth'))
if executor.test_definition.get('datagram_size'):
cmd.add('--len', executor.test_definition.get('datagram_size'))

View File

@@ -144,6 +144,15 @@ class TestIperf3Executor(testtools.TestCase):
'type': 'program'}
self.assertEqual(expected, executor.get_command())
def test_get_command_udp_bandwidth_0(self):
executor = iperf.Iperf3Executor({'udp': True, 'bandwidth': 0}, AGENT)
expected = {'data': ('iperf3 --client %s --format m '
'--udp --bandwidth 0 --time 60 '
'--parallel 1 --interval 1 --json') % IP,
'type': 'program'}
self.assertEqual(expected, executor.get_command())
def test_process_reply_tcp(self):
executor = iperf.Iperf3Executor({}, AGENT)
message = {