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:
Bob Lantz
2012-07-01 20:31:30 -07:00
parent cb859243a5
commit ec969b7f99
3 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ HOSTS = { 'proc': Host,
'rt': custom( CPULimitedHost, sched='rt' ), 'rt': custom( CPULimitedHost, sched='rt' ),
'cfs': custom( CPULimitedHost, sched='cfs' ) } 'cfs': custom( CPULimitedHost, sched='cfs' ) }
CONTROLLERDEF = 'ref' CONTROLLERDEF = 'ovsc'
CONTROLLERS = { 'ref': Controller, CONTROLLERS = { 'ref': Controller,
'ovsc': OVSController, 'ovsc': OVSController,
'nox': NOX, 'nox': NOX,
+2
View File
@@ -13,6 +13,8 @@ Package: mininet
Architecture: any Architecture: any
Depends: Depends:
openvswitch-switch, openvswitch-switch,
openvswitch-controller,
telnet,
${misc:Depends}, ${misc:Depends},
${python:Depends}, ${python:Depends},
${shlibs:Depends} ${shlibs:Depends}
+14
View File
@@ -975,6 +975,20 @@ class Controller( Node ):
self.port = port self.port = port
Node.__init__( self, name, inNamespace=inNamespace, Node.__init__( self, name, inNamespace=inNamespace,
ip=ip, **params ) 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 ): def start( self ):
"""Start <controller> <args> on controller. """Start <controller> <args> on controller.