From 612b21cbe7c808648fce6d188fd80ee60e8a4cca Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Fri, 23 Mar 2012 18:38:49 -0700 Subject: [PATCH] Pass code check. --- bin/mn | 4 ++-- examples/cpu.py | 10 +++++----- examples/limit.py | 3 ++- mininet/cli.py | 1 - mininet/node.py | 9 ++++----- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/bin/mn b/bin/mn index 5b00148..e9d3fd5 100755 --- a/bin/mn +++ b/bin/mn @@ -20,8 +20,8 @@ from mininet.clean import cleanup from mininet.cli import CLI from mininet.log import lg, LEVELS, info, warn from mininet.net import Mininet, MininetWithControlNet -from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, NOX, - RemoteController, UserSwitch, OVSKernelSwitch, +from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, + NOX, RemoteController, UserSwitch, OVSKernelSwitch, OVSLegacyKernelSwitch ) from mininet.link import Link, TCLink from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo diff --git a/examples/cpu.py b/examples/cpu.py index c03aa2b..34426bc 100755 --- a/examples/cpu.py +++ b/examples/cpu.py @@ -60,10 +60,10 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ): def dump( results ): "Dump results" - format = '%s\t%s\t%s' + fmt = '%s\t%s\t%s' print - print format % ( 'sched', 'cpu', 'client MB/s' ) + print fmt % ( 'sched', 'cpu', 'client MB/s' ) print for sched in sorted( results.keys() ): @@ -71,11 +71,11 @@ def dump( results ): for cpu, bps in entries: pct = '%.2f%%' % ( cpu * 100 ) mbps = bps / 1e6 - print format % ( sched, pct, mbps ) + print fmt % ( sched, pct, mbps ) if __name__ == '__main__': setLogLevel( 'info' ) limits = [ .45, .4, .3, .2, .1 ] - results = bwtest( limits ) - dump( results ) + out = bwtest( limits ) + dump( out ) diff --git a/examples/limit.py b/examples/limit.py index 79e0178..736ab41 100755 --- a/examples/limit.py +++ b/examples/limit.py @@ -50,6 +50,7 @@ def limit( bw=10, cpu=.4 ): net.stop() def verySimpleLimit( bw=150 ): + "Absurdly simple limiting test" intf = custom( TCIntf, bw=bw ) net = Mininet( intf=intf ) h1, h2 = net.addHost( 'h1' ), net.addHost( 'h2' ) @@ -62,7 +63,7 @@ def verySimpleLimit( bw=150 ): h1.cmdPrint( 'tc -s qdisc ls dev', h1.defaultIntf() ) h2.cmdPrint( 'tc -d class show dev', h2.defaultIntf() ) net.stop() - + if __name__ == '__main__': setLogLevel( 'info' ) verySimpleLimit() diff --git a/mininet/cli.py b/mininet/cli.py index 6beb047..52a6760 100644 --- a/mininet/cli.py +++ b/mininet/cli.py @@ -109,7 +109,6 @@ class CLI( Cmd ): nodes = ' '.join( [ node.name for node in sorted( self.nodelist ) ] ) output( 'available nodes are: \n%s\n' % nodes ) - def do_net( self, _line ): "List network connections." dumpNodeConnections( self.nodelist ) diff --git a/mininet/node.py b/mininet/node.py index af5cb09..6eebc0d 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -219,8 +219,8 @@ class Node( object ): # print sentinel cmd += '; printf "\\177"' if printPid and not isShellBuiltin( cmd ): - cmd = 'mnexec -p ' + cmd - self.write( cmd + '\n' ) + cmd = 'mnexec -p ' + cmd + self.write( cmd + '\n' ) self.lastPid = None self.waiting = True @@ -545,7 +545,7 @@ class CPULimitedHost( Host ): def cgroupDel( self ): "Clean up our cgroup" # info( '*** deleting cgroup', self.cgroup, '\n' ) - out, err, exitcode = errRun( 'cgdelete -r ' + self.cgroup ) + _out, _err, exitcode = errRun( 'cgdelete -r ' + self.cgroup ) return exitcode != 0 def cleanup( self ): @@ -753,7 +753,7 @@ class OVSLegacyKernelSwitch( Switch ): dp: netlink id (0, 1, 2, ...) defaultMAC: default MAC as unsigned int; random value if None""" Switch.__init__( self, name, **kwargs ) - self.dp = self.name + self.dp = dp if dp else self.name self.intf = self.dp if self.inNamespace: error( "OVSKernelSwitch currently only works" @@ -767,7 +767,6 @@ class OVSLegacyKernelSwitch( Switch ): moduleName='Open vSwitch (openvswitch.org)') moduleDeps( subtract=OF_KMOD, add=OVS_KMOD ) - def start( self, controllers ): "Start up kernel datapath." ofplog = '/tmp/' + self.name + '-ofp.log'