diff --git a/examples/linearbandwidth.py b/examples/linearbandwidth.py index dee5490cf28a34376a7cc93bb8a92be181badc36..18ccf90d1b9dad6fa89417bfe439e3e7caa96459 100755 --- a/examples/linearbandwidth.py +++ b/examples/linearbandwidth.py @@ -28,6 +28,8 @@ from mininet.topo import Topo from mininet.log import lg from mininet.util import irange +from mininet.link import TCLink +from functools import partial import sys flush = sys.stdout.flush @@ -70,13 +72,20 @@ def linearBandwidthTest( lengths ): switches = { 'reference user': UserSwitch, 'Open vSwitch kernel': OVSKernelSwitch } + # UserSwitch is horribly slow with recent kernels. + # We can reinstate it once its performance is fixed + del switches[ 'reference user' ] + topo = LinearTestTopo( hostCount ) for datapath in switches.keys(): print "*** testing", datapath, "datapath" Switch = switches[ datapath ] results[ datapath ] = [] - net = Mininet( topo=topo, switch=Switch, controller=Controller, waitConnected=True ) + link = partial( TCLink, delay='1ms' ) + net = Mininet( topo=topo, switch=Switch, + controller=Controller, waitConnected=True, + link=link ) net.start() print "*** testing basic connectivity" for n in lengths: diff --git a/examples/test/test_linearbandwidth.py b/examples/test/test_linearbandwidth.py index d3c11441a45c630f2d0d7c310abf19ffd22edf2c..95a18acb30ec93dab2cf56b0277427e95b74ac5d 100755 --- a/examples/test/test_linearbandwidth.py +++ b/examples/test/test_linearbandwidth.py @@ -21,7 +21,6 @@ def testLinearBandwidth( self ): while True: index = p.expect( opts, timeout=600 ) if index == 0: - previous_bw = 10 ** 10 # 10 Gbits count += 1 elif index == 1: n = int( p.match.group( 1 ) ) @@ -32,12 +31,15 @@ def testLinearBandwidth( self ): elif unit[ 0 ] == 'M': bw *= 10 ** 6 elif unit[ 0 ] == 'G': - bw *= 10 ** 9 - self.assertTrue( bw < previous_bw ) + bw *= 10 ** 9a + # check that we have a previous result to compare to + if n != 1: + self.assertTrue( bw < previous_bw ) previous_bw = bw else: break + # verify that we received results from at least one switch self.assertTrue( count > 0 ) if __name__ == '__main__':