Skip to content
Snippets Groups Projects
Commit b7268856 authored by Bob Lantz's avatar Bob Lantz
Browse files

Tolerate passing controller *objects* into Mininet()

parent b5962e8e
No related branches found
No related tags found
No related merge requests found
......@@ -246,7 +246,7 @@ def addController( self, name='c0', controller=None, **params ):
if not controller:
controller = self.controller
# Construct new controller if one is not given
if isinstance(name, Controller):
if issubclass( name.__class__, Controller ):
controller_new = name
# Pylint thinks controller is a str()
# pylint: disable=E1103
......@@ -357,7 +357,11 @@ def buildFromTopo( self, topo=None ):
if type( classes ) is not list:
classes = [ classes ]
for i, cls in enumerate( classes ):
self.addController( 'c%d' % i, cls )
# Allow Controller objects because nobody understands currying
if issubclass( cls.__class__, Controller ):
self.addController( cls )
else:
self.addController( 'c%d' % i, cls )
info( '*** Adding hosts:\n' )
for hostName in topo.hosts():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment