From 4e76439c796cb74efa8559c084dec32cfbec5ad9 Mon Sep 17 00:00:00 2001 From: Cody Burkard Date: Mon, 16 Jun 2014 23:33:38 -0700 Subject: [PATCH 1/6] added support in iperf for different result formats. also added upper bounds for hifi tests --- mininet/net.py | 4 +++- mininet/test/test_hifi.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index 1c932f9..4e98c60 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -617,7 +617,7 @@ class Mininet( object ): # 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. hosts: list of hosts; if None, uses opposite hosts l4Type: string, one of [ TCP, UDP ] @@ -640,6 +640,8 @@ class Mininet( object ): bwArgs = '-b ' + udpBw + ' ' elif l4Type != 'TCP': raise Exception( 'Unexpected l4 type: %s' % l4Type ) + if not format == 'M': + iperfArgs += '-f %s ' %format server.sendCmd( iperfArgs + '-s', printPid=True ) servout = '' while server.lastPid is None: diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index 20ee031..1ded385 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -55,6 +55,8 @@ class testOptionsTopoCommon( object ): """ self.assertGreaterEqual( float(measured), float(expected) * tolerance_frac ) + self.assertLess( float( measured ), + float(expected) + (1-tolerance_frac) * float( expected ) ) def testCPULimits( self ): "Verify topology creation with CPU limits set for both schedulers." @@ -69,18 +71,19 @@ class testOptionsTopoCommon( object ): results = mn.runCpuLimitTest( cpu=CPU_FRACTION ) mn.stop() 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 ): "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 # Verify ability to create limited-link topo first; lopts = { 'bw': BW, 'use_htb': True } # Also verify correctness of limit limitng within a bound. mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ), 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: bw = float( bw_str.split(' ')[0] ) self.assertWithinTolerance( bw, BW, BW_TOLERANCE ) @@ -101,10 +104,11 @@ class testOptionsTopoCommon( object ): self.assertEqual( sent, received ) # pylint: enable-msg=W0612 for rttval in [rttmin, rttavg, rttmax]: - # Multiply delay by 4 to cover there & back on two links - self.assertWithinTolerance( rttval, DELAY_MS * 4.0, + # 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 * 8.0, DELAY_TOLERANCE) + def testLinkLoss( self ): "Verify that we see packet drops with a high configured loss rate." LOSS_PERCENT = 99 From 342b743b136ab0918f5764b45a2a4137e18621df Mon Sep 17 00:00:00 2001 From: Cody Burkard Date: Tue, 1 Jul 2014 17:07:14 -0700 Subject: [PATCH 2/6] set staticArp in testLinkDelay --- mininet/test/test_hifi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index 1ded385..107138f 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -94,7 +94,7 @@ class testOptionsTopoCommon( object ): DELAY_TOLERANCE = 0.8 # Delay fraction below which test should fail lopts = { 'delay': '%sms' % DELAY_MS, 'use_htb': True } mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ), - link=TCLink, switch=self.switchClass ) + link=TCLink, switch=self.switchClass, autoStaticArp=True ) ping_delays = mn.run( mn.pingFull ) test_outputs = ping_delays[0] # Ignore unused variables below @@ -104,8 +104,8 @@ class testOptionsTopoCommon( object ): self.assertEqual( sent, received ) # pylint: enable-msg=W0612 for rttval in [rttmin, rttavg, rttmax]: - # 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 * 8.0, + # Multiply delay by 4 to cover there & back on two links + self.assertWithinTolerance( rttval, DELAY_MS * 4.0, DELAY_TOLERANCE) From 0e733c77543b16a67d77465b416fdd77cb509807 Mon Sep 17 00:00:00 2001 From: Cody Burkard Date: Wed, 2 Jul 2014 13:07:57 -0700 Subject: [PATCH 3/6] fixed default iperf formatting behavior --- mininet/net.py | 6 +++--- mininet/test/test_hifi.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index 4e98c60..3b3b1ff 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -617,7 +617,7 @@ class Mininet( object ): # XXX This should be cleaned up - def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format='M' ): + def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format=None ): """Run iperf between two hosts. hosts: list of hosts; if None, uses opposite hosts l4Type: string, one of [ TCP, UDP ] @@ -640,8 +640,8 @@ class Mininet( object ): bwArgs = '-b ' + udpBw + ' ' elif l4Type != 'TCP': raise Exception( 'Unexpected l4 type: %s' % l4Type ) - if not format == 'M': - iperfArgs += '-f %s ' %format + if format: + iperfArgs += '-f %s ' % format server.sendCmd( iperfArgs + '-s', printPid=True ) servout = '' while server.lastPid is None: diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index 107138f..3f89b87 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -105,7 +105,7 @@ class testOptionsTopoCommon( object ): # pylint: enable-msg=W0612 for rttval in [rttmin, rttavg, rttmax]: # Multiply delay by 4 to cover there & back on two links - self.assertWithinTolerance( rttval, DELAY_MS * 4.0, + self.assertWithinTolerance( rttval, DELAY_MS * 4.0, DELAY_TOLERANCE) From 3131c90344766c30d2516ebab5792785296a7104 Mon Sep 17 00:00:00 2001 From: Cody Burkard Date: Tue, 8 Jul 2014 16:53:45 -0700 Subject: [PATCH 4/6] rolled back to iperf format option, and changed 'cpu' variable to 'pct' --- mininet/test/test_hifi.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index 3f89b87..8f8a1ce 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -55,8 +55,9 @@ class testOptionsTopoCommon( object ): """ self.assertGreaterEqual( float(measured), float(expected) * tolerance_frac ) - self.assertLess( float( measured ), - float(expected) + (1-tolerance_frac) * float( expected ) ) + self.assertLessEqual( float( measured ), + float(expected) + (1-tolerance_frac) + * float( expected ) ) def testCPULimits( self ): "Verify topology creation with CPU limits set for both schedulers." @@ -70,9 +71,9 @@ class testOptionsTopoCommon( object ): mn.start() results = mn.runCpuLimitTest( cpu=CPU_FRACTION ) mn.stop() - for cpu in results: + for pct in results: #divide cpu by 100 to convert from percentage to fraction - self.assertWithinTolerance( cpu/100, CPU_FRACTION, CPU_TOLERANCE ) + self.assertWithinTolerance( pct/100, CPU_FRACTION, CPU_TOLERANCE ) def testLinkBandwidth( self ): "Verify that link bandwidths are accurate within a bound." From 93ddd926621f1ced84299bdf763471af71761f6a Mon Sep 17 00:00:00 2001 From: Cody Burkard Date: Tue, 8 Jul 2014 16:55:50 -0700 Subject: [PATCH 5/6] Revert "fixed default iperf formatting behavior" This reverts commit 0e733c77543b16a67d77465b416fdd77cb509807. --- mininet/net.py | 6 +++--- mininet/test/test_hifi.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index 3b3b1ff..4e98c60 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -617,7 +617,7 @@ class Mininet( object ): # XXX This should be cleaned up - def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format=None ): + def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format='M' ): """Run iperf between two hosts. hosts: list of hosts; if None, uses opposite hosts l4Type: string, one of [ TCP, UDP ] @@ -640,8 +640,8 @@ class Mininet( object ): bwArgs = '-b ' + udpBw + ' ' elif l4Type != 'TCP': raise Exception( 'Unexpected l4 type: %s' % l4Type ) - if format: - iperfArgs += '-f %s ' % format + if not format == 'M': + iperfArgs += '-f %s ' %format server.sendCmd( iperfArgs + '-s', printPid=True ) servout = '' while server.lastPid is None: diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index 8f8a1ce..c888e29 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -106,7 +106,7 @@ class testOptionsTopoCommon( object ): # pylint: enable-msg=W0612 for rttval in [rttmin, rttavg, rttmax]: # Multiply delay by 4 to cover there & back on two links - self.assertWithinTolerance( rttval, DELAY_MS * 4.0, + self.assertWithinTolerance( rttval, DELAY_MS * 4.0, DELAY_TOLERANCE) From a1acfa89c2cc90c0125d18374c8779edd6af2311 Mon Sep 17 00:00:00 2001 From: Cody Burkard Date: Tue, 8 Jul 2014 17:23:35 -0700 Subject: [PATCH 6/6] set default iperf formatting to none --- mininet/net.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index 4e98c60..744d4c9 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -617,7 +617,7 @@ class Mininet( object ): # XXX This should be cleaned up - def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format='M' ): + def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format=None ): """Run iperf between two hosts. hosts: list of hosts; if None, uses opposite hosts l4Type: string, one of [ TCP, UDP ] @@ -640,7 +640,7 @@ class Mininet( object ): bwArgs = '-b ' + udpBw + ' ' elif l4Type != 'TCP': raise Exception( 'Unexpected l4 type: %s' % l4Type ) - if not format == 'M': + if format: iperfArgs += '-f %s ' %format server.sendCmd( iperfArgs + '-s', printPid=True ) servout = ''