diff --git a/mininet/net.py b/mininet/net.py index 01e19360bbeeb7d9ae288b7c427f23dc1c167172..d59a089727376ff8dd7ce5f1525b071a924c70b0 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -495,20 +495,25 @@ def stop( self ): if self.terms: info( '*** Stopping %i terms\n' % len( self.terms ) ) self.stopXterms() + info( '*** Stopping %i links\n' % len( self.links ) ) + for link in self.links: + info( '.' ) + link.stop() + info( '\n' ) info( '*** Stopping %i switches\n' % len( self.switches ) ) + stopped = {} for swclass, switches in groupby( sorted( self.switches, key=type ), type ): + switches = tuple( switches ) if hasattr( swclass, 'batchShutdown' ): swclass.batchShutdown( switches ) + stopped.update( { s: s for s in switches } ) for switch in self.switches: info( switch.name + ' ' ) - switch.stop() + if switch not in stopped: + switch.stop() switch.terminate() info( '\n' ) - info( '*** Stopping %i links\n' % len( self.links ) ) - for link in self.links: - link.stop() - info( '\n' ) info( '*** Stopping %i hosts\n' % len( self.hosts ) ) for host in self.hosts: info( host.name + ' ' )