Pass code check.

This commit is contained in:
Bob Lantz
2010-03-24 17:08:25 -07:00
parent 45e82d0952
commit 41badb9686
3 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ def TreeNet( depth=1, fanout=2, **kwargs ):
"Convenience function for creating tree networks." "Convenience function for creating tree networks."
topo = TreeTopo( depth, fanout ) topo = TreeTopo( depth, fanout )
return Mininet( topo, **kwargs ) return Mininet( topo, **kwargs )
if __name__ == '__main__': if __name__ == '__main__':
setLogLevel( 'info' ) setLogLevel( 'info' )
init() init()
+9 -8
View File
@@ -1,8 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
"Create a 64-node tree network, and test connectivity using ping." "Create a 64-node tree network, and test connectivity using ping."
from mininet.cli import CLI
from mininet.log import setLogLevel from mininet.log import setLogLevel
from mininet.net import init, Mininet from mininet.net import init, Mininet
from mininet.node import KernelSwitch, UserSwitch, OVSKernelSwitch from mininet.node import KernelSwitch, UserSwitch, OVSKernelSwitch
@@ -12,8 +11,10 @@ def TreeNet( depth=1, fanout=2, **kwargs ):
"Convenience function for creating tree networks." "Convenience function for creating tree networks."
topo = TreeTopo( depth, fanout ) topo = TreeTopo( depth, fanout )
return Mininet( topo, **kwargs ) return Mininet( topo, **kwargs )
def treePing64(): def treePing64():
"Run ping test on 64-node tree networks."
results = {} results = {}
switches = { 'reference kernel': KernelSwitch, switches = { 'reference kernel': KernelSwitch,
'reference user': UserSwitch, 'reference user': UserSwitch,
@@ -26,13 +27,13 @@ def treePing64():
result = network.run( network.pingAll ) result = network.run( network.pingAll )
results[ name ] = result results[ name ] = result
print print
print "*** Tree network ping results:" print "*** Tree network ping results:"
for name in switches.keys(): for name in switches.keys():
print "%s: %d%% packet loss" % ( name, results[ name ] ) print "%s: %d%% packet loss" % ( name, results[ name ] )
print print
if __name__ == '__main__': if __name__ == '__main__':
setLogLevel( 'info' ) setLogLevel( 'info' )
init() init()
treePing64() treePing64()
+3 -3
View File
@@ -170,9 +170,9 @@ def makeListCompatible( fn ):
setattr( newfn, '__doc__', fn.__doc__ ) setattr( newfn, '__doc__', fn.__doc__ )
return newfn return newfn
info, output, warn, error, debug = ( info, output, warn, error, debug = (
lg.info, lg.output, lg.warn, lg.error, lg.debug ) = [ lg.info, lg.output, lg.warn, lg.error, lg.debug ) = [
makeListCompatible( f ) for f in makeListCompatible( f ) for f in
lg.info, lg.output, lg.warn, lg.error, lg.debug ] lg.info, lg.output, lg.warn, lg.error, lg.debug ]
setLogLevel = lg.setLogLevel setLogLevel = lg.setLogLevel