diff --git a/mininet/net.py b/mininet/net.py index 91e3542..2b3ce04 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -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() diff --git a/mininet/node.py b/mininet/node.py index ffe38b6..46158a1 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -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: ] )