Make some tuples explicit to pass parsing in py3
This commit is contained in:
@@ -32,8 +32,8 @@ def multiControllerNet():
|
|||||||
s2 = net.addSwitch( 's2' )
|
s2 = net.addSwitch( 's2' )
|
||||||
|
|
||||||
print( "*** Creating hosts" )
|
print( "*** Creating hosts" )
|
||||||
hosts1 = [ net.addHost( 'h%d' % n ) for n in 3, 4 ]
|
hosts1 = [ net.addHost( 'h%d' % n ) for n in ( 3, 4 ) ]
|
||||||
hosts2 = [ net.addHost( 'h%d' % n ) for n in 5, 6 ]
|
hosts2 = [ net.addHost( 'h%d' % n ) for n in ( 5, 6 ) ]
|
||||||
|
|
||||||
print( "*** Creating links" )
|
print( "*** Creating links" )
|
||||||
for h in hosts1:
|
for h in hosts1:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class NetworkTopo( Topo ):
|
|||||||
defaultIP = '192.168.1.1/24' # IP address for r0-eth1
|
defaultIP = '192.168.1.1/24' # IP address for r0-eth1
|
||||||
router = self.addNode( 'r0', cls=LinuxRouter, ip=defaultIP )
|
router = self.addNode( 'r0', cls=LinuxRouter, ip=defaultIP )
|
||||||
|
|
||||||
s1, s2, s3 = [ self.addSwitch( s ) for s in 's1', 's2', 's3' ]
|
s1, s2, s3 = [ self.addSwitch( s ) for s in ( 's1', 's2', 's3' ) ]
|
||||||
|
|
||||||
self.addLink( s1, router, intfName2='r0-eth1',
|
self.addLink( s1, router, intfName2='r0-eth1',
|
||||||
params2={ 'ip' : defaultIP } ) # for clarity
|
params2={ 'ip' : defaultIP } ) # for clarity
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ def scratchNetUser( cname='controller', cargs='ptcp:' ):
|
|||||||
info( '*** Starting controller and user datapath\n' )
|
info( '*** Starting controller and user datapath\n' )
|
||||||
controller.cmd( cname + ' ' + cargs + '&' )
|
controller.cmd( cname + ' ' + cargs + '&' )
|
||||||
switch.cmd( 'ifconfig lo 127.0.0.1' )
|
switch.cmd( 'ifconfig lo 127.0.0.1' )
|
||||||
intfs = [ str( i ) for i in sintf1, sintf2 ]
|
intfs = str( sintf1 ), str( sintf2 )
|
||||||
switch.cmd( 'ofdatapath -i ' + ','.join( intfs ) + ' ptcp: &' )
|
switch.cmd( 'ofdatapath -i ' + ','.join( intfs ) + ' ptcp: &' )
|
||||||
switch.cmd( 'ofprotocol tcp:' + controller.IP() + ' tcp:localhost &' )
|
switch.cmd( 'ofprotocol tcp:' + controller.IP() + ' tcp:localhost &' )
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -160,7 +160,7 @@ def makeListCompatible( fn ):
|
|||||||
"Generated function. Closure-ish."
|
"Generated function. Closure-ish."
|
||||||
if len( args ) == 1:
|
if len( args ) == 1:
|
||||||
return fn( *args )
|
return fn( *args )
|
||||||
args = ' '.join( [ str( arg ) for arg in args ] )
|
args = ' '.join( map( str, args ) )
|
||||||
return fn( args )
|
return fn( args )
|
||||||
|
|
||||||
# Fix newfn's name and docstring
|
# Fix newfn's name and docstring
|
||||||
@@ -168,9 +168,9 @@ def makeListCompatible( fn ):
|
|||||||
setattr( newfn, '__doc__', fn.__doc__ )
|
setattr( newfn, '__doc__', fn.__doc__ )
|
||||||
return newfn
|
return newfn
|
||||||
|
|
||||||
info, output, warn, error, debug = (
|
_loggers = lg.info, lg.output, lg.warn, lg.error, lg.debug
|
||||||
lg.info, lg.output, lg.warn, lg.error, lg.debug ) = [
|
_loggers = tuple( map( makeListCompatible, _loggers ) )
|
||||||
makeListCompatible( f ) for f in
|
lg.info, lg.output, lg.warn, lg.error, lg.debug = _loggers
|
||||||
lg.info, lg.output, lg.warn, lg.error, lg.debug ]
|
info, output, warn, error, debug = _loggers
|
||||||
|
|
||||||
setLogLevel = lg.setLogLevel
|
setLogLevel = lg.setLogLevel
|
||||||
|
|||||||
Reference in New Issue
Block a user