added support in iperf for different result formats. also added upper bounds for hifi tests
This commit is contained in:
+3
-1
@@ -617,7 +617,7 @@ class Mininet( object ):
|
|||||||
|
|
||||||
# XXX This should be cleaned up
|
# XXX This should be cleaned up
|
||||||
|
|
||||||
def iperf( self, hosts=None, l4Type='TCP', udpBw='10M' ):
|
def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format='M' ):
|
||||||
"""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 ]
|
||||||
@@ -640,6 +640,8 @@ class Mininet( object ):
|
|||||||
bwArgs = '-b ' + udpBw + ' '
|
bwArgs = '-b ' + udpBw + ' '
|
||||||
elif l4Type != 'TCP':
|
elif l4Type != 'TCP':
|
||||||
raise Exception( 'Unexpected l4 type: %s' % l4Type )
|
raise Exception( 'Unexpected l4 type: %s' % l4Type )
|
||||||
|
if not format == 'M':
|
||||||
|
iperfArgs += '-f %s ' %format
|
||||||
server.sendCmd( iperfArgs + '-s', printPid=True )
|
server.sendCmd( iperfArgs + '-s', printPid=True )
|
||||||
servout = ''
|
servout = ''
|
||||||
while server.lastPid is None:
|
while server.lastPid is None:
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ class testOptionsTopoCommon( object ):
|
|||||||
"""
|
"""
|
||||||
self.assertGreaterEqual( float(measured),
|
self.assertGreaterEqual( float(measured),
|
||||||
float(expected) * tolerance_frac )
|
float(expected) * tolerance_frac )
|
||||||
|
self.assertLess( float( measured ),
|
||||||
|
float(expected) + (1-tolerance_frac) * float( expected ) )
|
||||||
|
|
||||||
def testCPULimits( self ):
|
def testCPULimits( self ):
|
||||||
"Verify topology creation with CPU limits set for both schedulers."
|
"Verify topology creation with CPU limits set for both schedulers."
|
||||||
@@ -69,18 +71,19 @@ class testOptionsTopoCommon( object ):
|
|||||||
results = mn.runCpuLimitTest( cpu=CPU_FRACTION )
|
results = mn.runCpuLimitTest( cpu=CPU_FRACTION )
|
||||||
mn.stop()
|
mn.stop()
|
||||||
for cpu in results:
|
for cpu in results:
|
||||||
self.assertWithinTolerance( cpu, CPU_FRACTION, CPU_TOLERANCE )
|
#divide cpu by 100 to convert from percentage to fraction
|
||||||
|
self.assertWithinTolerance( cpu/100, CPU_FRACTION, CPU_TOLERANCE )
|
||||||
|
|
||||||
def testLinkBandwidth( self ):
|
def testLinkBandwidth( self ):
|
||||||
"Verify that link bandwidths are accurate within a bound."
|
"Verify that link bandwidths are accurate within a bound."
|
||||||
BW = 5 # Mbps
|
BW = .5 # Mbps
|
||||||
BW_TOLERANCE = 0.8 # BW fraction below which test should fail
|
BW_TOLERANCE = 0.8 # BW fraction below which test should fail
|
||||||
# Verify ability to create limited-link topo first;
|
# Verify ability to create limited-link topo first;
|
||||||
lopts = { 'bw': BW, 'use_htb': True }
|
lopts = { 'bw': BW, 'use_htb': True }
|
||||||
# Also verify correctness of limit limitng within a bound.
|
# Also verify correctness of limit limitng within a bound.
|
||||||
mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
|
mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
|
||||||
link=TCLink, switch=self.switchClass )
|
link=TCLink, switch=self.switchClass )
|
||||||
bw_strs = mn.run( mn.iperf )
|
bw_strs = mn.run( mn.iperf, format='m' )
|
||||||
for bw_str in bw_strs:
|
for bw_str in bw_strs:
|
||||||
bw = float( bw_str.split(' ')[0] )
|
bw = float( bw_str.split(' ')[0] )
|
||||||
self.assertWithinTolerance( bw, BW, BW_TOLERANCE )
|
self.assertWithinTolerance( bw, BW, BW_TOLERANCE )
|
||||||
@@ -101,10 +104,11 @@ class testOptionsTopoCommon( object ):
|
|||||||
self.assertEqual( sent, received )
|
self.assertEqual( sent, received )
|
||||||
# pylint: enable-msg=W0612
|
# pylint: enable-msg=W0612
|
||||||
for rttval in [rttmin, rttavg, rttmax]:
|
for rttval in [rttmin, rttavg, rttmax]:
|
||||||
# Multiply delay by 4 to cover there & back on two links
|
# Multiply delay by 8 to cover there & back on two links, for both the icmp packets and the arp packets
|
||||||
self.assertWithinTolerance( rttval, DELAY_MS * 4.0,
|
self.assertWithinTolerance( rttval, DELAY_MS * 8.0,
|
||||||
DELAY_TOLERANCE)
|
DELAY_TOLERANCE)
|
||||||
|
|
||||||
|
|
||||||
def testLinkLoss( self ):
|
def testLinkLoss( self ):
|
||||||
"Verify that we see packet drops with a high configured loss rate."
|
"Verify that we see packet drops with a high configured loss rate."
|
||||||
LOSS_PERCENT = 99
|
LOSS_PERCENT = 99
|
||||||
|
|||||||
Reference in New Issue
Block a user