diff --git a/examples/tree1024.py b/examples/tree1024.py index 42318cc..2fb001d 100755 --- a/examples/tree1024.py +++ b/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() diff --git a/examples/treeping64.py b/examples/treeping64.py index 96edba3..ceb0a80 100755 --- a/examples/treeping64.py +++ b/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() \ No newline at end of file + setLogLevel( 'info' ) + init() + treePing64() diff --git a/mininet/log.py b/mininet/log.py index f999714..a16505f 100644 --- a/mininet/log.py +++ b/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