Pass code check.

This commit is contained in:
Bob Lantz
2012-03-23 18:38:49 -07:00
parent 8139695d46
commit 612b21cbe7
5 changed files with 13 additions and 14 deletions
+2 -2
View File
@@ -20,8 +20,8 @@ from mininet.clean import cleanup
from mininet.cli import CLI from mininet.cli import CLI
from mininet.log import lg, LEVELS, info, warn from mininet.log import lg, LEVELS, info, warn
from mininet.net import Mininet, MininetWithControlNet from mininet.net import Mininet, MininetWithControlNet
from mininet.node import ( Host, CPULimitedHost, Controller, OVSController, NOX, from mininet.node import ( Host, CPULimitedHost, Controller, OVSController,
RemoteController, UserSwitch, OVSKernelSwitch, NOX, RemoteController, UserSwitch, OVSKernelSwitch,
OVSLegacyKernelSwitch ) OVSLegacyKernelSwitch )
from mininet.link import Link, TCLink from mininet.link import Link, TCLink
from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo from mininet.topo import SingleSwitchTopo, LinearTopo, SingleSwitchReversedTopo
+5 -5
View File
@@ -60,10 +60,10 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
def dump( results ): def dump( results ):
"Dump results" "Dump results"
format = '%s\t%s\t%s' fmt = '%s\t%s\t%s'
print print
print format % ( 'sched', 'cpu', 'client MB/s' ) print fmt % ( 'sched', 'cpu', 'client MB/s' )
print print
for sched in sorted( results.keys() ): for sched in sorted( results.keys() ):
@@ -71,11 +71,11 @@ def dump( results ):
for cpu, bps in entries: for cpu, bps in entries:
pct = '%.2f%%' % ( cpu * 100 ) pct = '%.2f%%' % ( cpu * 100 )
mbps = bps / 1e6 mbps = bps / 1e6
print format % ( sched, pct, mbps ) print fmt % ( sched, pct, mbps )
if __name__ == '__main__': if __name__ == '__main__':
setLogLevel( 'info' ) setLogLevel( 'info' )
limits = [ .45, .4, .3, .2, .1 ] limits = [ .45, .4, .3, .2, .1 ]
results = bwtest( limits ) out = bwtest( limits )
dump( results ) dump( out )
+1
View File
@@ -50,6 +50,7 @@ def limit( bw=10, cpu=.4 ):
net.stop() net.stop()
def verySimpleLimit( bw=150 ): def verySimpleLimit( bw=150 ):
"Absurdly simple limiting test"
intf = custom( TCIntf, bw=bw ) intf = custom( TCIntf, bw=bw )
net = Mininet( intf=intf ) net = Mininet( intf=intf )
h1, h2 = net.addHost( 'h1' ), net.addHost( 'h2' ) h1, h2 = net.addHost( 'h1' ), net.addHost( 'h2' )
-1
View File
@@ -109,7 +109,6 @@ class CLI( Cmd ):
nodes = ' '.join( [ node.name for node in sorted( self.nodelist ) ] ) nodes = ' '.join( [ node.name for node in sorted( self.nodelist ) ] )
output( 'available nodes are: \n%s\n' % nodes ) output( 'available nodes are: \n%s\n' % nodes )
def do_net( self, _line ): def do_net( self, _line ):
"List network connections." "List network connections."
dumpNodeConnections( self.nodelist ) dumpNodeConnections( self.nodelist )
+3 -4
View File
@@ -220,7 +220,7 @@ class Node( object ):
cmd += '; printf "\\177"' cmd += '; printf "\\177"'
if printPid and not isShellBuiltin( cmd ): if printPid and not isShellBuiltin( cmd ):
cmd = 'mnexec -p ' + cmd cmd = 'mnexec -p ' + cmd
self.write( cmd + '\n' ) self.write( cmd + '\n' )
self.lastPid = None self.lastPid = None
self.waiting = True self.waiting = True
@@ -545,7 +545,7 @@ class CPULimitedHost( Host ):
def cgroupDel( self ): def cgroupDel( self ):
"Clean up our cgroup" "Clean up our cgroup"
# info( '*** deleting cgroup', self.cgroup, '\n' ) # 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 return exitcode != 0
def cleanup( self ): def cleanup( self ):
@@ -753,7 +753,7 @@ class OVSLegacyKernelSwitch( Switch ):
dp: netlink id (0, 1, 2, ...) dp: netlink id (0, 1, 2, ...)
defaultMAC: default MAC as unsigned int; random value if None""" defaultMAC: default MAC as unsigned int; random value if None"""
Switch.__init__( self, name, **kwargs ) Switch.__init__( self, name, **kwargs )
self.dp = self.name self.dp = dp if dp else self.name
self.intf = self.dp self.intf = self.dp
if self.inNamespace: if self.inNamespace:
error( "OVSKernelSwitch currently only works" error( "OVSKernelSwitch currently only works"
@@ -767,7 +767,6 @@ class OVSLegacyKernelSwitch( Switch ):
moduleName='Open vSwitch (openvswitch.org)') moduleName='Open vSwitch (openvswitch.org)')
moduleDeps( subtract=OF_KMOD, add=OVS_KMOD ) moduleDeps( subtract=OF_KMOD, add=OVS_KMOD )
def start( self, controllers ): def start( self, controllers ):
"Start up kernel datapath." "Start up kernel datapath."
ofplog = '/tmp/' + self.name + '-ofp.log' ofplog = '/tmp/' + self.name + '-ofp.log'