diff --git a/bin/mn b/bin/mn index 69ebc87..685b2a4 100755 --- a/bin/mn +++ b/bin/mn @@ -145,7 +145,7 @@ class MininetRunner( object ): else: # Accept a comma-separated list of filenames files += value.split(',') - + for fileName in files: customs = {} if os.path.isfile( fileName ): @@ -289,7 +289,7 @@ class MininetRunner( object ): else: raise Exception( "Could not find a default controller for switch %s" % self.options.switch ) - + topo = buildTopo( TOPOS, self.options.topo ) switch = customConstructor( SWITCHES, self.options.switch ) host = customConstructor( HOSTS, self.options.host ) diff --git a/examples/bind.py b/examples/bind.py index b5fecf3..dd96297 100755 --- a/examples/bind.py +++ b/examples/bind.py @@ -22,7 +22,7 @@ to temporary private directories. To do this, simply create a list of directories to be made private. A tmpfs will then be mounted on them. You may use both temporary and persistent directories at the same -time. In the following privateDirs string, each host will have a +time. In the following privateDirs string, each host will have a persistent directory in the root filesystem at "/tmp/(hostname)/var/run" mounted on "/var/run". Each host will also have a temporary private directory mounted on "/var/log". @@ -48,8 +48,8 @@ from functools import partial def testHostWithPrivateDirs(): "Test bind mounts" topo = SingleSwitchTopo( 10 ) - privateDirs = [ ( '/var/log', '/tmp/%(name)s/var/log' ), - ( '/var/run', '/tmp/%(name)s/var/run' ), + privateDirs = [ ( '/var/log', '/tmp/%(name)s/var/log' ), + ( '/var/run', '/tmp/%(name)s/var/run' ), '/var/mn' ] host = partial( Host, privateDirs=privateDirs ) @@ -65,5 +65,3 @@ if __name__ == '__main__': setLogLevel( 'info' ) testHostWithPrivateDirs() info( 'Done.\n') - - diff --git a/examples/cluster.py b/examples/cluster.py index 68ab10b..e16170d 100755 --- a/examples/cluster.py +++ b/examples/cluster.py @@ -346,7 +346,7 @@ class RemoteLink( Link ): ' not successfully moved to ' + node.name + '\n' ) return False return True - + def makeTunnel( self, node1, node2, intfname1, intfname2, addr1=None, addr2=None ): "Make a tunnel across switches on different servers" @@ -380,7 +380,7 @@ class RemoteLink( Link ): if ch != '@': error( 'makeTunnel:\n', 'Tunnel setup failed for', - '%s:%s' % ( node1, node1.dest ), 'to', + '%s:%s' % ( node1, node1.dest ), 'to', '%s:%s\n' % ( node2, node2.dest ), 'command was:', cmd, '\n' ) tunnel.terminate() @@ -421,7 +421,7 @@ class RemoteLink( Link ): class Placer( object ): "Node placement algorithm for MininetCluster" - + def __init__( self, servers=None, nodes=None, hosts=None, switches=None, controllers=None, links=None ): """Initialize placement object @@ -459,7 +459,7 @@ class RoundRobinPlacer( Placer ): """Round-robin placement Note this will usually result in cross-server links between hosts and switches""" - + def __init__( self, *args, **kwargs ): Placer.__init__( self, *args, **kwargs ) self.next = 0 @@ -560,7 +560,7 @@ class HostSwitchBinPlacer( Placer ): self.sset = frozenset( self.switches ) self.cset = frozenset( self.controllers ) self.hind, self.sind, self.cind = 0, 0, 0 - + def place( self, nodename ): """Simple placement algorithm: place nodes into evenly sized bins""" diff --git a/examples/clusterSanity.py b/examples/clusterSanity.py index 5383b25..9b6832b 100755 --- a/examples/clusterSanity.py +++ b/examples/clusterSanity.py @@ -12,7 +12,7 @@ from mininet.topo import SingleSwitchTopo def clusterSanity(): "Sanity check for cluster mode" topo = SingleSwitchTopo() - net = MininetCluster( topo=topo ) + net = MininetCluster( topo=topo ) net.start() CLI( net ) net.stop() diff --git a/examples/clustercli.py b/examples/clustercli.py index c753ccf..bf6d423 100644 --- a/examples/clustercli.py +++ b/examples/clustercli.py @@ -22,7 +22,7 @@ class ClusterCLI( CLI ): colors = colors * reps colors = colors[ 0 : slen ] return colors - + def do_plot( self, line ): "Plot topology colored by node placement" # Import networkx if needed diff --git a/examples/controlnet.py b/examples/controlnet.py index d5a8781..9397188 100755 --- a/examples/controlnet.py +++ b/examples/controlnet.py @@ -35,7 +35,7 @@ class DataController( Controller ): class MininetFacade( object ): """Mininet object facade that allows a single CLI to talk to one or more networks""" - + def __init__( self, net, *args, **kwargs ): """Create MininetFacade object. net: Primary Mininet object @@ -114,7 +114,7 @@ class ControlNetwork( Topo ): def run(): "Create control and data networks, and invoke the CLI" - + info( '* Creating Control Network\n' ) ctopo = ControlNetwork( n=4, dataController=DataController ) cnet = Mininet( topo=ctopo, ipBase='192.168.123.0/24', controller=None ) diff --git a/examples/intfoptions.py b/examples/intfoptions.py index e6d7804..41bd84c 100755 --- a/examples/intfoptions.py +++ b/examples/intfoptions.py @@ -21,7 +21,7 @@ def intfOptions(): link1 = net.addLink( h1, s1, cls=TCLink ) net.addLink( h2, s1 ) net.start() - + # flush out latency from reactive forwarding delay net.pingAll() @@ -34,12 +34,12 @@ def intfOptions(): link1.intf1.config( loss=50 ) info( '\n' ) net.iperf( ( h1, h2 ), l4Type='UDP' ) - + info( '\n*** Configuring one intf with delay of 15ms\n' ) link1.intf1.config( delay='15ms' ) info( '\n*** Run a ping to confirm delay\n' ) net.pingPairFull() - + info( '\n*** Done testing\n' ) net.stop() diff --git a/examples/linuxrouter.py b/examples/linuxrouter.py index 329538a..8d0de5b 100755 --- a/examples/linuxrouter.py +++ b/examples/linuxrouter.py @@ -2,7 +2,7 @@ """ linuxrouter.py: Example network with Linux IP router - + This example converts a Node into a router using IP forwarding already built into Linux. @@ -16,7 +16,7 @@ The topology contains a router with three IP subnets: - h2 (IP: 172.16.0.100) - h3 (IP: 10.0.0.100) - Routing entries can be added to the routing tables of the + Routing entries can be added to the routing tables of the hosts or router using the "ip route add" or "route add" command. See the man pages for more details. diff --git a/examples/miniedit.py b/examples/miniedit.py index b55ed8e..9ba6a8b 100755 --- a/examples/miniedit.py +++ b/examples/miniedit.py @@ -750,7 +750,7 @@ class SwitchDialog(CustomDialog): 'please either specify a DPID or use a ' 'canonical switch name such as s23.' ) - + results = {'externalInterfaces':externalInterfaces, 'hostname':self.hostnameEntry.get(), 'dpid':dpid, @@ -784,10 +784,10 @@ class VerticalScrolledTable(LabelFrame): * Use the 'interior' attribute to place widgets inside the scrollable frame * Construct and pack/place/grid normally * This frame only allows vertical scrolling - + """ def __init__(self, parent, rows=2, columns=2, title=None, *args, **kw): - LabelFrame.__init__(self, parent, text=title, padx=5, pady=5, *args, **kw) + LabelFrame.__init__(self, parent, text=title, padx=5, pady=5, *args, **kw) # create a canvas object and a vertical scrollbar for scrolling it vscrollbar = Scrollbar(self, orient=VERTICAL) @@ -1709,7 +1709,7 @@ class MiniEdit( Frame ): for widget in self.widgetToItem: name = widget[ 'text' ] tags = self.canvas.gettags( self.widgetToItem[ widget ] ) - + if 'Controller' in tags: opts = self.controllers[name] controllerType = opts['controllerType'] @@ -1720,9 +1720,9 @@ class MiniEdit( Frame ): controllerIP = opts['remoteIP'] controllerPort = opts['remotePort'] - + f.write(" "+name+"=net.addController(name='"+name+"',\n") - + if controllerType == 'remote': f.write(" controller=RemoteController,\n") f.write(" ip='"+controllerIP+"',\n") @@ -1733,7 +1733,7 @@ class MiniEdit( Frame ): f.write(" controller=OVSController,\n") else: f.write(" controller=Controller,\n") - + f.write(" protocol='"+controllerProtocol+"',\n") f.write(" port="+str(controllerPort)+")\n") f.write("\n") @@ -1943,7 +1943,7 @@ class MiniEdit( Frame ): for widget in self.widgetToItem: name = widget[ 'text' ] tags = self.canvas.gettags( self.widgetToItem[ widget ] ) - + if 'Switch' in tags: opts = self.switchOpts[name] if 'netflow' in opts: @@ -1967,7 +1967,7 @@ class MiniEdit( Frame ): for widget in self.widgetToItem: name = widget[ 'text' ] tags = self.canvas.gettags( self.widgetToItem[ widget ] ) - + if 'Switch' in tags: opts = self.switchOpts[name] if 'sflow' in opts: @@ -2641,7 +2641,7 @@ class MiniEdit( Frame ): else: controllerName = dest[ 'text' ] switchName = source[ 'text' ] - + if controllerName in self.switchOpts[switchName]['controllers']: self.switchOpts[switchName]['controllers'].remove(controllerName) @@ -2662,7 +2662,7 @@ class MiniEdit( Frame ): if 'Switch' in tags: if widget['text'] in self.switchOpts[name]['controllers']: self.switchOpts[name]['controllers'].remove(widget['text']) - + for link in widget.links.values(): # Delete from view and model self.deleteItem( link ) @@ -2917,7 +2917,7 @@ class MiniEdit( Frame ): for widget in self.widgetToItem: name = widget[ 'text' ] tags = self.canvas.gettags( self.widgetToItem[ widget ] ) - + if 'Switch' in tags: opts = self.switchOpts[name] if 'netflow' in opts: @@ -2947,7 +2947,7 @@ class MiniEdit( Frame ): for widget in self.widgetToItem: name = widget[ 'text' ] tags = self.canvas.gettags( self.widgetToItem[ widget ] ) - + if 'Switch' in tags: opts = self.switchOpts[name] if 'sflow' in opts: diff --git a/examples/multilink.py b/examples/multilink.py index 632ed79..90d070a 100755 --- a/examples/multilink.py +++ b/examples/multilink.py @@ -9,9 +9,9 @@ from mininet.cli import CLI from mininet.log import setLogLevel from mininet.net import Mininet from mininet.topo import Topo - + def runMultiLink(): - + topo = simpleMultiLinkTopo( n=2 ) net = Mininet( topo=topo ) net.start() @@ -25,7 +25,7 @@ class simpleMultiLinkTopo( Topo ): h1, h2 = self.addHost( 'h1' ), self.addHost( 'h2' ) s1 = self.addSwitch( 's1' ) - + for _ in range( n ): self.addLink( s1, h1 ) self.addLink( s1, h2 ) diff --git a/examples/natnet.py b/examples/natnet.py index 4305d1f..ece1de4 100755 --- a/examples/natnet.py +++ b/examples/natnet.py @@ -14,7 +14,7 @@ natnet.py: Example network with NATs | | s1 s2 | | - h1 h2 + h1 h2 """ @@ -44,15 +44,15 @@ class InternetTopo(Topo): localSubnet = '192.168.%d.0/24' % i natParams = { 'ip' : '%s/24' % localIP } # add NAT to topology - nat = self.addNode('nat%d' % i, cls=NAT, subnet=localSubnet, + nat = self.addNode('nat%d' % i, cls=NAT, subnet=localSubnet, inetIntf=inetIntf, localIntf=localIntf) switch = self.addSwitch('s%d' % i) # connect NAT to inet and local switches self.addLink(nat, inetSwitch, intfName1=inetIntf) self.addLink(nat, switch, intfName1=localIntf, params1=natParams) # add host and connect to local switch - host = self.addHost('h%d' % i, - ip='192.168.%d.100/24' % i, + host = self.addHost('h%d' % i, + ip='192.168.%d.100/24' % i, defaultRoute='via %s' % localIP) self.addLink(host, switch) @@ -67,4 +67,4 @@ def run(): if __name__ == '__main__': setLogLevel('info') run() - \ No newline at end of file + diff --git a/examples/numberedports.py b/examples/numberedports.py index 5784e2e..2d4a231 100755 --- a/examples/numberedports.py +++ b/examples/numberedports.py @@ -1,7 +1,7 @@ #!/usr/bin/python """ -Create a network with 5 hosts, numbered 1-4 and 9. +Create a network with 5 hosts, numbered 1-4 and 9. Validate that the port numbers match to the interface name, and that the ovs ports match the mininet ports. """ @@ -54,13 +54,13 @@ def net(): info( '\n*** printing and validating the ports running on each interface\n' ) for intfs in s1.intfList(): if not intfs.name == "lo": - info( intfs, ': ', s1.ports[intfs], + info( intfs, ': ', s1.ports[intfs], '\n' ) info ( 'Validating that', intfs, 'is actually on port', s1.ports[intfs], '... ' ) if validatePort( s1, intfs ): info( 'Validated.\n' ) print '\n' - + # test the network with pingall net.pingAll() print '\n' diff --git a/examples/test/test_baresshd.py b/examples/test/test_baresshd.py index 22cc84c..3d5df93 100755 --- a/examples/test/test_baresshd.py +++ b/examples/test/test_baresshd.py @@ -36,7 +36,7 @@ class testBareSSHD( unittest.TestCase ): '-o StrictModes=no' ) p = pexpect.spawn( cmd ) runOpts = [ 'You may now ssh into h1 at 10.0.0.1', - 'after 5 seconds, h1 is not listening on port 22', + 'after 5 seconds, h1 is not listening on port 22', pexpect.EOF, pexpect.TIMEOUT ] while True: index = p.expect( runOpts ) diff --git a/examples/test/test_cpu.py b/examples/test/test_cpu.py index 2b91a08..d8f421d 100755 --- a/examples/test/test_cpu.py +++ b/examples/test/test_cpu.py @@ -6,7 +6,7 @@ Test for cpu.py results format: sched cpu client MB/s - + cfs 45.00% 13254.669841 cfs 40.00% 11822.441399 cfs 30.00% 5112.963009 @@ -28,13 +28,13 @@ class testCPU( unittest.TestCase ): "Verify that CPU utilization is monotonically decreasing for each scheduler" p = pexpect.spawn( 'python -m mininet.examples.cpu' ) # matches each line from results( shown above ) - opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)', + opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)', pexpect.EOF ] scheds = [] while True: index = p.expect( opts, timeout=600 ) if index == 0: - sched = p.match.group( 1 ) + sched = p.match.group( 1 ) cpu = float( p.match.group( 2 ) ) bw = float( p.match.group( 3 ) ) if sched not in scheds: diff --git a/examples/test/test_emptynet.py b/examples/test/test_emptynet.py index 0d4d01d..f8e7c4a 100755 --- a/examples/test/test_emptynet.py +++ b/examples/test/test_emptynet.py @@ -19,7 +19,7 @@ class testEmptyNet( unittest.TestCase ): p.sendline( 'pingall' ) p.expect ( '(\d+)% dropped' ) percent = int( p.match.group( 1 ) ) if p.match else -1 - self.assertEqual( percent, 0 ) + self.assertEqual( percent, 0 ) p.expect( self.prompt ) # iperf test p.sendline( 'iperf' ) diff --git a/examples/test/test_limit.py b/examples/test/test_limit.py index db9eb33..2052e7e 100755 --- a/examples/test/test_limit.py +++ b/examples/test/test_limit.py @@ -14,8 +14,8 @@ class testLimit( unittest.TestCase ): def testLimit( self ): "Verify that CPU limits are within a 2% tolerance of limit for each scheduler" p = pexpect.spawn( 'python -m mininet.examples.limit' ) - opts = [ '\*\*\* Testing network ([\d\.]+) Mbps', - '\*\*\* Results: \[([\d\., ]+)\]', + opts = [ '\*\*\* Testing network ([\d\.]+) Mbps', + '\*\*\* Results: \[([\d\., ]+)\]', pexpect.EOF ] count = 0 bw = 0 diff --git a/examples/test/test_linearbandwidth.py b/examples/test/test_linearbandwidth.py index b431d7b..d93ce0b 100755 --- a/examples/test/test_linearbandwidth.py +++ b/examples/test/test_linearbandwidth.py @@ -15,8 +15,8 @@ class testLinearBandwidth( unittest.TestCase ): "Verify that bandwidth is monotonically decreasing as # of hops increases" p = pexpect.spawn( 'python -m mininet.examples.linearbandwidth' ) count = 0 - opts = [ '\*\*\* Linear network results', - '(\d+)\s+([\d\.]+) (.bits)', + opts = [ '\*\*\* Linear network results', + '(\d+)\s+([\d\.]+) (.bits)', pexpect.EOF ] while True: index = p.expect( opts, timeout=600 ) diff --git a/examples/test/test_multilink.py b/examples/test/test_multilink.py index 332a509..4bea8b0 100755 --- a/examples/test/test_multilink.py +++ b/examples/test/test_multilink.py @@ -22,14 +22,14 @@ class testMultiLink( unittest.TestCase ): hostToIntfs = intfsOutput.split( '\r\n' )[ 1:3 ] intfList = [] for hostToIntf in hostToIntfs: - intfList += [ intf for intf in + intfList += [ intf for intf in hostToIntf.split()[1].split(',') ] # get interfaces from system by running ifconfig on every host sysIntfList = [] opts = [ 'h(\d)-eth(\d)', self.prompt ] p.expect( self.prompt ) - + p.sendline( 'h1 ifconfig' ) while True: p.expect( opts ) diff --git a/examples/test/test_multiping.py b/examples/test/test_multiping.py index ff0571c..4649b3b 100755 --- a/examples/test/test_multiping.py +++ b/examples/test/test_multiping.py @@ -11,7 +11,7 @@ from collections import defaultdict class testMultiPing( unittest.TestCase ): def testMultiPing( self ): - """Verify that each target is pinged at least once, and + """Verify that each target is pinged at least once, and that pings to 'real' targets are successful and unknown targets fail""" p = pexpect.spawn( 'python -m mininet.examples.multiping' ) opts = [ "Host (h\d+) \(([\d.]+)\) will be pinging ips: ([\d\. ]+)", diff --git a/examples/test/test_nat.py b/examples/test/test_nat.py index 8e49ed6..c4bb096 100755 --- a/examples/test/test_nat.py +++ b/examples/test/test_nat.py @@ -14,7 +14,7 @@ class testNAT( unittest.TestCase ): prompt = 'mininet>' - @unittest.skipIf( '0 received' in quietRun( 'ping -c 1 %s' % destIP ), + @unittest.skipIf( '0 received' in quietRun( 'ping -c 1 %s' % destIP ), 'Destination IP is not reachable' ) def testNAT( self ): "Attempt to ping an IP on the Internet and verify 0% packet loss" diff --git a/examples/test/test_numberedports.py b/examples/test/test_numberedports.py index b565d3e..81ee187 100755 --- a/examples/test/test_numberedports.py +++ b/examples/test/test_numberedports.py @@ -15,8 +15,8 @@ class testNumberedports( unittest.TestCase ): def testConsistency( self ): """verify consistency between mininet and ovs ports""" p = pexpect.spawn( 'python -m mininet.examples.numberedports' ) - opts = [ 'Validating that s1-eth\d is actually on port \d ... Validated.', - 'Validating that s1-eth\d is actually on port \d ... WARNING', + opts = [ 'Validating that s1-eth\d is actually on port \d ... Validated.', + 'Validating that s1-eth\d is actually on port \d ... WARNING', pexpect.EOF ] correct_ports = True count = 0 @@ -34,7 +34,7 @@ class testNumberedports( unittest.TestCase ): def testNumbering( self ): """verify that all of the port numbers are printed correctly and consistent with their interface""" p = pexpect.spawn( 'python -m mininet.examples.numberedports' ) - opts = [ 's1-eth(\d+) : (\d+)', + opts = [ 's1-eth(\d+) : (\d+)', pexpect.EOF ] count_intfs = 0 while True: diff --git a/examples/test/test_sshd.py b/examples/test/test_sshd.py index 9cfad6d..a341539 100755 --- a/examples/test/test_sshd.py +++ b/examples/test/test_sshd.py @@ -14,7 +14,7 @@ class testSSHD( unittest.TestCase ): def connected( self, ip ): "Log into ssh server, check banner, then exit" - # Note: this test will fail if "Welcome" is not in the sshd banner + # Note: this test will fail if "Welcome" is not in the sshd banner # and '#'' or '$'' are not in the prompt p = pexpect.spawn( 'ssh -i /tmp/ssh/test_rsa %s' % ip, timeout=10 ) while True: @@ -26,7 +26,7 @@ class testSSHD( unittest.TestCase ): return False elif index == 2: p.sendline( 'exit' ) - p.wait() + p.wait() return True else: return False diff --git a/examples/test/test_vlanhost.py b/examples/test/test_vlanhost.py index b57f0d0..d68448f 100644 --- a/examples/test/test_vlanhost.py +++ b/examples/test/test_vlanhost.py @@ -47,4 +47,4 @@ class testVLANHost( unittest.TestCase ): self.assertEqual( i, 0 ) # check vlan intf is present if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() diff --git a/examples/vlanhost.py b/examples/vlanhost.py index 97c6e8e..0ded83c 100755 --- a/examples/vlanhost.py +++ b/examples/vlanhost.py @@ -40,7 +40,7 @@ class VLANHost( Host ): intf = self.defaultIntf() # remove IP from default, "physical" interface self.cmd( 'ifconfig %s inet 0' % intf ) - # create VLAN interface + # create VLAN interface self.cmd( 'vconfig add %s %d' % ( intf, vlan ) ) # assign the host's IP to the VLAN interface self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) ) diff --git a/mininet/clean.py b/mininet/clean.py index 4cfc547..28c4fca 100755 --- a/mininet/clean.py +++ b/mininet/clean.py @@ -92,5 +92,5 @@ def cleanup(): killprocs( 'Tunnel=Ethernet' ) killprocs( '.ssh/mn') sh( 'rm -f ~/.ssh/mn/*' ) - + info( "*** Cleanup complete.\n" ) diff --git a/mininet/link.py b/mininet/link.py index 7d8b870..f71abf2 100644 --- a/mininet/link.py +++ b/mininet/link.py @@ -43,7 +43,7 @@ class Intf( object ): self.link = link self.mac = mac self.ip, self.prefixLen = None, None - + # if interface is lo, we know the ip is 127.0.0.1. # This saves an ifconfig command per node if self.name == 'lo': diff --git a/mininet/node.py b/mininet/node.py index 7fe4591..33eb052 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -692,7 +692,7 @@ class CPULimitedHost( Host ): retry( retries=3, delaySecs=1, fn=self.cgroupDel ) _rtGroupSched = False # internal class var: Is CONFIG_RT_GROUP_SCHED set? - + @classmethod def checkRtGroupSched( cls ): "Check (Ubuntu,Debian) kernel config for CONFIG_RT_GROUP_SCHED for RT" @@ -749,7 +749,7 @@ class CPULimitedHost( Host ): """Set overall CPU fraction for this host f: CPU bandwidth limit (positive fraction, or -1 for cfs unlimited) sched: 'rt' or 'cfs' - Note 'cfs' requires CONFIG_CFS_BANDWIDTH, + Note 'cfs' requires CONFIG_CFS_BANDWIDTH, and 'rt' requires CONFIG_RT_GROUP_SCHED""" if not sched: sched = self.sched @@ -1199,11 +1199,11 @@ OVSKernelSwitch = OVSSwitch class OVSBridge( OVSSwitch ): "OVSBridge is an OVSSwitch in standalone/bridge mode" - + def __init__( self, args, **kwargs ): kwargs.update( failMode='standalone' ) OVSSwitch.__init__( self, args, **kwargs ) - + def start( self, controllers ): OVSSwitch.start( self, controllers=[] ) diff --git a/mininet/nodelib.py b/mininet/nodelib.py index f89e20a..d8a3c4f 100644 --- a/mininet/nodelib.py +++ b/mininet/nodelib.py @@ -32,7 +32,7 @@ class LinuxBridge( Switch ): return 'forwarding' in self.cmd( 'brctl showstp', self ) else: return True - + def start( self, controllers ): "Start Linux bridge" self.cmd( 'ifconfig', self, 'down' ) diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index b3a467b..82d6da5 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -181,7 +181,7 @@ class testOptionsTopoCommon( object ): 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, msg ) diff --git a/mininet/test/test_switchdpidassignment.py b/mininet/test/test_switchdpidassignment.py index 9db98f7..6813a3c 100644 --- a/mininet/test/test_switchdpidassignment.py +++ b/mininet/test/test_switchdpidassignment.py @@ -27,14 +27,14 @@ class testSwitchDpidAssignmentCommon ( object ): self.assertEqual( switch.defaultDpid(), switch.dpid ) def testActualDpidAssignment( self ): - """Verify that Switch dpid is the actual dpid assigned if dpid is + """Verify that Switch dpid is the actual dpid assigned if dpid is passed in switch creation.""" switch = Mininet( Topo(), self.switchClass, Host, Controller ).addSwitch( 'A', dpid = '000000000000ABCD' ) self.assertEqual( switch.dpid, '000000000000ABCD' ) def testDefaultDpidAssignmentFailure( self ): - """Verify that Default dpid assignment raises an Exception if the - name of the switch does not contin a digit. Also verify the + """Verify that Default dpid assignment raises an Exception if the + name of the switch does not contin a digit. Also verify the exception message.""" with self.assertRaises( Exception ) as raises_cm: Mininet( Topo(), self.switchClass, Host, Controller ).addSwitch( 'A' ) @@ -58,7 +58,7 @@ class testSwitchDpidAssignmentCommon ( object ): except TypeError: # Switch is OVS User Switch self.assertEqual( switch.dpid, '0' * (16 - len(dpid)) + str(dpid) ) - + class testSwitchOVSKernel( testSwitchDpidAssignmentCommon, unittest.TestCase ): """Test dpid assignnment of OVS Kernel Switch.""" @@ -67,12 +67,12 @@ class testSwitchOVSKernel( testSwitchDpidAssignmentCommon, unittest.TestCase ): class testSwitchOVSUser( testSwitchDpidAssignmentCommon, unittest.TestCase ): """Test dpid assignnment of OVS User Switch.""" switchClass = partial(OVSSwitch, datapath = 'user') - + @unittest.skipUnless( quietRun( 'which ovs-openflowd' ), 'OVS Legacy Kernel switch is not installed' ) class testSwitchOVSLegacyKernel( testSwitchDpidAssignmentCommon, unittest.TestCase ): """Test dpid assignnment of OVS Legacy Kernel Switch.""" switchClass = OVSLegacyKernelSwitch - + @unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS switch is not installed' ) class testSwitchIVS( testSwitchDpidAssignmentCommon, unittest.TestCase ): """Test dpid assignment of IVS switch.""" diff --git a/mininet/topo.py b/mininet/topo.py index cfa581e..951770f 100644 --- a/mininet/topo.py +++ b/mininet/topo.py @@ -101,7 +101,7 @@ class Topo( object ): "Data center network representation for structured multi-trees." def __init__( self, *args, **params ): - """Topo object. + """Topo object. Optional named parameters: hinfo: default host options sopts: default switch options @@ -256,7 +256,7 @@ class Topo( object ): if key is None: key = min( entry ) return entry, key - + def linkInfo( self, src, dst, key=None ): "Return link metadata dict" entry, key = self._linkEntry( src, dst, key ) diff --git a/mininet/topolib.py b/mininet/topolib.py index 6ee6f0c..3a00ab4 100644 --- a/mininet/topolib.py +++ b/mininet/topolib.py @@ -41,7 +41,7 @@ class TorusTopo( Topo ): with the default controller or any Ethernet bridge without STP turned on! It can be used with STP, e.g.: # mn --topo torus,3,3 --switch lxbr,stp=1 --test pingall""" - + def build( self, x, y ): if x < 3 or y < 3: raise Exception( 'Please use 3x3 or greater for compatibility ' @@ -65,5 +65,5 @@ class TorusTopo( Topo ): self.addLink( sw1, sw2 ) self.addLink( sw1, sw3 ) - + diff --git a/util/doxify.py b/util/doxify.py index f9f60ad..c6a78ff 100755 --- a/util/doxify.py +++ b/util/doxify.py @@ -30,7 +30,7 @@ def fixParam( line ): def fixReturns( line ): "Change returns: foo to @return foo" return re.sub( 'returns:', r'@returns', line ) - + def fixLine( line ): global comment match = spaces.match( line ) @@ -69,7 +69,7 @@ def funTest(): ).splitlines( True ) fixLines( testFun ) - + def fixLines( lines, fid ): for line in lines: os.write( fid, fixLine( line ) ) @@ -86,4 +86,4 @@ if __name__ == '__main__': - + diff --git a/util/vm/build.py b/util/vm/build.py index 4b4bc0c..dc4c62c 100755 --- a/util/vm/build.py +++ b/util/vm/build.py @@ -881,7 +881,7 @@ def getMininetVersion( vm ): return version -def bootAndRun( image, prompt=Prompt, memory=1024, outputFile=None, +def bootAndRun( image, prompt=Prompt, memory=1024, outputFile=None, runFunction=None, **runArgs ): """Boot and test VM tests: list of tests to run