From e1711f357a90b9425ff5a62bc27317eb48b665e7 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Mon, 13 Oct 2014 17:52:47 -0700 Subject: [PATCH] Use server receive rate rather than client send()/buffering rate Fixes #412 --- mininet/net.py | 5 ++++- mininet/test/test_hifi.py | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index fd0719b..9ca2632 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -689,7 +689,10 @@ class Mininet( object ): """Run iperf between two hosts. hosts: list of hosts; if None, uses opposite hosts l4Type: string, one of [ TCP, UDP ] - returns: results two-element array of server and client speeds""" + returns: results two-element array of [ server, client ] speeds + note: send() is buffered, so client rate can be much higher than + the actual transmission rate; on an unloaded system, server + rate should be much closer to the actual receive rate""" if not quietRun( 'which telnet' ): error( 'Cannot find telnet in $PATH - required for iperf test' ) return diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index d83c5da..b3a467b 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -136,9 +136,14 @@ class testOptionsTopoCommon( object ): 'switch = %s\n' % ( BW, bw_strs, N, loptsStr, self.switchClass ) ) - for bw_str in bw_strs: - bw = float( bw_str.split(' ')[0] ) - self.assertWithinTolerance( bw, BW, BW_TOLERANCE, msg ) + # On the client side, iperf doesn't wait for ACKs - it simply + # reports how long it took to fill up the TCP send buffer. + # As long as the kernel doesn't wait a long time before + # delivering bytes to the iperf server, its reported data rate + # should be close to the actual receive rate. + serverRate, clientRate = bw_strs + bw = float( serverRate.split(' ')[0] ) + self.assertWithinTolerance( bw, BW, BW_TOLERANCE, msg ) def testLinkDelay( self ): "Verify that link delays are accurate within a bound."