Change default controller for mn to ovsc (ovs-controller.)
Also add check to see if another controller is running - eventually we should really detect errors from starting the controller!!
This commit is contained in:
@@ -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,
|
||||
|
||||
Vendored
+2
@@ -13,6 +13,8 @@ Package: mininet
|
||||
Architecture: any
|
||||
Depends:
|
||||
openvswitch-switch,
|
||||
openvswitch-controller,
|
||||
telnet,
|
||||
${misc:Depends},
|
||||
${python:Depends},
|
||||
${shlibs:Depends}
|
||||
|
||||
@@ -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 <controller> <args> on controller.
|
||||
|
||||
Reference in New Issue
Block a user