Changes to mininet.py:
- invoke ofdatapath with --fail=closed (no controller = no connectivity!) - stop hosts before switches before the controller - this seems slightly more sensible - it's the reverse of the startup order - fix retry() so it kind of works (it's actually helpful I think!)
This commit is contained in:
+14
-10
@@ -277,7 +277,7 @@ class Switch( Node ):
|
|||||||
self.cmdPrint( 'ofdatapath -i ' + ','.join( intfs ) +
|
self.cmdPrint( 'ofdatapath -i ' + ','.join( intfs ) +
|
||||||
' ptcp: 1> ' + ofdlog + ' 2> '+ ofdlog + ' &' )
|
' ptcp: 1> ' + ofdlog + ' 2> '+ ofdlog + ' &' )
|
||||||
self.cmdPrint( 'ofprotocol tcp:' + controller.IP() +
|
self.cmdPrint( 'ofprotocol tcp:' + controller.IP() +
|
||||||
' tcp:localhost 1> ' + ofplog + ' 2>' + ofplog + ' &' )
|
' tcp:localhost --fail=closed 1> ' + ofplog + ' 2>' + ofplog + ' &' )
|
||||||
def stopUserDatapath( self ):
|
def stopUserDatapath( self ):
|
||||||
"Stop OpenFlow reference user datapath."
|
"Stop OpenFlow reference user datapath."
|
||||||
self.cmd( "kill %ofdatapath" )
|
self.cmd( "kill %ofdatapath" )
|
||||||
@@ -291,9 +291,10 @@ class Switch( Node ):
|
|||||||
quietRun( 'dpctl deldp ' + self.dp )
|
quietRun( 'dpctl deldp ' + self.dp )
|
||||||
self.cmdPrint( 'dpctl adddp ' + self.dp )
|
self.cmdPrint( 'dpctl adddp ' + self.dp )
|
||||||
self.cmdPrint( 'dpctl addif ' + self.dp + ' ' + ' '.join( self.intfs ) )
|
self.cmdPrint( 'dpctl addif ' + self.dp + ' ' + ' '.join( self.intfs ) )
|
||||||
# Become protocol daemon
|
# Run protocol daemon
|
||||||
self.cmdPrint( 'ofprotocol' +
|
self.cmdPrint( 'ofprotocol' +
|
||||||
' ' + self.dp + ' tcp:127.0.0.1 1> ' + ofplog + ' 2>' + ofplog + ' &' )
|
' ' + self.dp + ' tcp:127.0.0.1 ' +
|
||||||
|
' --fail=closed 1> ' + ofplog + ' 2>' + ofplog + ' &' )
|
||||||
self.execed = False # XXX until I fix it
|
self.execed = False # XXX until I fix it
|
||||||
def stopKernelDatapath( self ):
|
def stopKernelDatapath( self ):
|
||||||
"Terminate a switch using OpenFlow reference kernel datapath."
|
"Terminate a switch using OpenFlow reference kernel datapath."
|
||||||
@@ -361,7 +362,9 @@ def retry( n, fn, *args):
|
|||||||
sleep( 1 )
|
sleep( 1 )
|
||||||
print "*** retrying..."; flush()
|
print "*** retrying..."; flush()
|
||||||
tries += 1
|
tries += 1
|
||||||
if tries >= n: exit( 1 )
|
if tries >= n:
|
||||||
|
print "*** giving up"
|
||||||
|
exit( 1 )
|
||||||
|
|
||||||
def createLink( node1, node2 ):
|
def createLink( node1, node2 ):
|
||||||
"Create a link node1-intf1 <---> node2-intf2."
|
"Create a link node1-intf1 <---> node2-intf2."
|
||||||
@@ -526,17 +529,18 @@ class Network( object ):
|
|||||||
switch.start( self.controllers[ 0 ] )
|
switch.start( self.controllers[ 0 ] )
|
||||||
def stop( self ):
|
def stop( self ):
|
||||||
"Stop the controller(s), switches and hosts"
|
"Stop the controller(s), switches and hosts"
|
||||||
print "*** Stopping controller"
|
print "*** Stopping hosts"
|
||||||
for controller in self.controllers:
|
for host in self.hosts:
|
||||||
controller.stop(); controller.terminate()
|
host.terminate()
|
||||||
print "*** Stopping switches"
|
print "*** Stopping switches"
|
||||||
for switch in self.switches:
|
for switch in self.switches:
|
||||||
print switch.name, ; flush()
|
print switch.name, ; flush()
|
||||||
switch.stop() ; switch.terminate()
|
switch.stop() ; switch.terminate()
|
||||||
print
|
print
|
||||||
print "*** Stopping hosts"
|
print "*** Stopping controller"
|
||||||
for host in self.hosts:
|
for controller in self.controllers:
|
||||||
host.terminate()
|
controller.stop(); controller.terminate()
|
||||||
|
print
|
||||||
print "*** Test complete"
|
print "*** Test complete"
|
||||||
def runTest( self, test ):
|
def runTest( self, test ):
|
||||||
"Run a given test, called as test( controllers, switches, hosts)"
|
"Run a given test, called as test( controllers, switches, hosts)"
|
||||||
|
|||||||
Reference in New Issue
Block a user