diff --git a/bin/mn b/bin/mn index 91a6369..f6b9e78 100755 --- a/bin/mn +++ b/bin/mn @@ -48,7 +48,7 @@ HOSTS = { 'proc': Host, 'rt': custom( CPULimitedHost, sched='rt' ), 'cfs': custom( CPULimitedHost, sched='cfs' ) } -CONTROLLERDEF = 'ref' +CONTROLLERDEF = 'ovsc' CONTROLLERS = { 'ref': Controller, 'ovsc': OVSController, 'nox': NOX, diff --git a/debian/control b/debian/control index 152d22a..649c234 100644 --- a/debian/control +++ b/debian/control @@ -13,6 +13,8 @@ Package: mininet Architecture: any Depends: openvswitch-switch, + openvswitch-controller, + telnet, ${misc:Depends}, ${python:Depends}, ${shlibs:Depends} diff --git a/mininet/node.py b/mininet/node.py index 6db75c6..8e4786d 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -975,6 +975,20 @@ class Controller( Node ): self.port = port Node.__init__( self, name, inNamespace=inNamespace, ip=ip, **params ) + self.cmd( 'ifconfig lo up' ) # Shouldn't be necessary + self.checkListening() + + def checkListening( self ): + "Make sure no controllers are running on our port" + listening = self.cmd( "echo A | telnet -e A %s %d" % + ( self.ip, self.port ) ) + if 'Unable' not in listening: + servers = self.cmd( 'netstat -atp' ).split( '\n' ) + pstr = ':%d ' % self.port + info = servers[ 0:1 ] + [ s for s in servers if pstr in s ] + raise Exception( "Please shut down the controller which is" + " running on port %d:\n" % self.port + + '\n'.join( info ) ) def start( self ): """Start on controller.