Browse Source

Pass code check.

Bob Lantz 16 years ago
parent
commit
41badb9686
  1. 2
      examples/tree1024.py
  2. 17
      examples/treeping64.py
  3. 6
      mininet/log.py

2
examples/tree1024.py

@ -17,7 +17,7 @@ def TreeNet( depth=1, fanout=2, **kwargs ):
"Convenience function for creating tree networks."
topo = TreeTopo( depth, fanout )
return Mininet( topo, **kwargs )
if __name__ == '__main__':
setLogLevel( 'info' )
init()

17
examples/treeping64.py

@ -1,8 +1,7 @@
#!/usr/bin/python
"Create a 64-node tree network, and test connectivity using ping."
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.net import init, Mininet
from mininet.node import KernelSwitch, UserSwitch, OVSKernelSwitch
@ -12,8 +11,10 @@ def TreeNet( depth=1, fanout=2, **kwargs ):
"Convenience function for creating tree networks."
topo = TreeTopo( depth, fanout )
return Mininet( topo, **kwargs )
def treePing64():
"Run ping test on 64-node tree networks."
results = {}
switches = { 'reference kernel': KernelSwitch,
'reference user': UserSwitch,
@ -26,13 +27,13 @@ def treePing64():
result = network.run( network.pingAll )
results[ name ] = result
print
print
print "*** Tree network ping results:"
for name in switches.keys():
print "%s: %d%% packet loss" % ( name, results[ name ] )
print
if __name__ == '__main__':
setLogLevel( 'info' )
init()
treePing64()
setLogLevel( 'info' )
init()
treePing64()

6
mininet/log.py

@ -170,9 +170,9 @@ def makeListCompatible( fn ):
setattr( newfn, '__doc__', fn.__doc__ )
return newfn
info, output, warn, error, debug = (
lg.info, lg.output, lg.warn, lg.error, lg.debug ) = [
makeListCompatible( f ) for f in
info, output, warn, error, debug = (
lg.info, lg.output, lg.warn, lg.error, lg.debug ) = [
makeListCompatible( f ) for f in
lg.info, lg.output, lg.warn, lg.error, lg.debug ]
setLogLevel = lg.setLogLevel

Loading…
Cancel
Save