Add support for batch shutdown of OVS switches.

This saves about 10 seconds for a 200 switch network.
This commit is contained in:
Bob Lantz
2014-02-06 17:56:32 -08:00
parent 9cf9b7b223
commit 06115a0456
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -408,6 +408,9 @@ class Mininet( object ):
info( '*** Stopping %i terms\n' % len( self.terms ) )
self.stopXterms()
info( '*** Stopping %i switches\n' % len( self.switches ) )
swclass = type( self.switches[ 0 ] )
if False and self.switches and hasattr( swclass, 'batchShutdown' ):
swclass.batchShutdown( self.switches )
for switch in self.switches:
info( switch.name + ' ' )
switch.stop()
+7
View File
@@ -985,6 +985,13 @@ class OVSSwitch( Switch ):
'"service openvswitch-switch start".\n' )
exit( 1 )
@classmethod
def batchShutdown( cls, switches ):
"Call ovs-vsctl del-br on all OVSSwitches in a list"
quietRun( 'ovs-vsctl ' +
' -- '.join( '--if-exists del-br %s' % s
for s in switches if type(s) == cls ) )
def dpctl( self, *args ):
"Run ovs-ofctl command"
return self.cmd( 'ovs-ofctl', args[ 0 ], self, *args[ 1: ] )