Skip to content
Snippets Groups Projects
Commit f939eb56 authored by Bob Lantz's avatar Bob Lantz
Browse files

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!)
parent 0b4ae53a
No related branches found
No related tags found
No related merge requests found
...@@ -277,7 +277,7 @@ def startUserDatapath( self, controller ): ...@@ -277,7 +277,7 @@ def startUserDatapath( self, controller ):
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 @@ def startKernelDatapath( self, controller): ...@@ -291,9 +291,10 @@ def startKernelDatapath( self, controller):
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): ...@@ -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 @@ def start( self ): ...@@ -526,17 +529,18 @@ def start( self ):
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)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment