Skip to content
Snippets Groups Projects
Commit ad2fda25 authored by Bob Lantz's avatar Bob Lantz
Browse files

Attempt to make iperf test more robust.

parent 1dcc0476
No related branches found
No related tags found
No related merge requests found
...@@ -473,17 +473,22 @@ def _parseIperf( iperfOutput ): ...@@ -473,17 +473,22 @@ def _parseIperf( iperfOutput ):
iperfOutput: string iperfOutput: string
returns: result string""" returns: result string"""
r = r'([\d\.]+ \w+/sec)' r = r'([\d\.]+ \w+/sec)'
m = re.search( r, iperfOutput ) m = re.findall( r, iperfOutput )
if m: if m:
return m.group( 1 ) return m[-1]
else: else:
raise Exception( 'could not parse iperf output: ' + iperfOutput ) # was: raise Exception(...)
error( 'could not parse iperf output: ' + iperfOutput )
return ''
def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ): def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
"""Run iperf between two hosts. """Run iperf between two hosts.
hosts: list of hosts; if None, uses opposite hosts hosts: list of hosts; if None, uses opposite hosts
l4Type: string, one of [ TCP, UDP ] l4Type: string, one of [ TCP, UDP ]
returns: results two-element array of server and client speeds""" returns: results two-element array of server and client speeds"""
if not quietRun( 'which telnet' ):
error( 'Cannot find telnet in $PATH - required for iperf test' )
return
if not hosts: if not hosts:
hosts = [ self.hosts[ 0 ], self.hosts[ -1 ] ] hosts = [ self.hosts[ 0 ], self.hosts[ -1 ] ]
else: else:
...@@ -503,6 +508,10 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ): ...@@ -503,6 +508,10 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
servout = '' servout = ''
while server.lastPid is None: while server.lastPid is None:
servout += server.monitor() servout += server.monitor()
while 'Connected' not in client.cmd(
'sh -c "echo A | telnet -e A %s 5001"' % server.IP()):
output('waiting for iperf to start up')
sleep(.5)
cliout = client.cmd( iperfArgs + '-t 5 -c ' + server.IP() + ' ' + cliout = client.cmd( iperfArgs + '-t 5 -c ' + server.IP() + ' ' +
bwArgs ) bwArgs )
debug( 'Client output: %s\n' % cliout ) debug( 'Client output: %s\n' % cliout )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment