diff --git a/bin/mn_run.py b/bin/mn_run.py index 333cf5e8c19177415c8c58e3e91a6d89b118dc7c..c3edfc6aac6f1f6165ea28e26bc7930b1c09e877 100755 --- a/bin/mn_run.py +++ b/bin/mn_run.py @@ -11,8 +11,7 @@ from mininet.logging_mod import lg, set_loglevel, LEVELS from mininet.net import Mininet, init -from mininet.node import Switch, Host, Controller, ControllerParams -from mininet.node import NOXController +from mininet.node import Switch, Host, Controller, ControllerParams, NOX from mininet.topo import TreeTopo # built in topologies, created only when run @@ -32,7 +31,8 @@ CONTROLLER_DEF = 'ref' CONTROLLERS = {'ref' : Controller, - 'nox' : NOXController} + 'nox_dump' : lambda a, b: NOX(a, b, 'packetdump'), + 'nox_pysw' : lambda a, b: NOX(a, b, 'pyswitch')} # optional tests to run TESTS = ['cli', 'build', 'ping_all', 'ping_pair', 'iperf', 'all'] diff --git a/mininet/net.py b/mininet/net.py index 27b21f67648bdb89c38ec0eba8d50d71cc35eeb2..67f7e48a86bbee26dd2e90a3bce72379e92d893e 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -160,7 +160,7 @@ def _add_controller(self, controller): @param controller Controller class ''' - controller = self.controller('c0', kernel = self.kernel) + controller = self.controller('c0', not self.kernel) self.controllers['c0'] = controller # Control network support: diff --git a/mininet/node.py b/mininet/node.py index d882f0613280f2fe7191a2a7e349dd0cd082ca17..9a30cf448f73f14b603448b4d6cf7faaad1fcc14 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -215,12 +215,12 @@ class Controller(Node): '''A Controller is a Node that is running (or has execed) an OpenFlow controller.''' - def __init__(self, name, kernel=True, controller='controller', - cargs='-v ptcp:', cdir=None): + def __init__(self, name, inNamespace = False, controller = 'controller', + cargs = '-v ptcp:', cdir = None): self.controller = controller self.cargs = cargs self.cdir = cdir - Node.__init__(self, name, inNamespace=(not kernel)) + Node.__init__(self, name, inNamespace = inNamespace) def start(self): '''Start <controller> <args> on controller. @@ -338,14 +338,16 @@ def monitor(self): return True, '' -class NOXController(Controller): +class NOX(Controller): '''Controller to run a NOX application.''' - def __init__(self, name, nox_args = None, **kwargs): + def __init__(self, name, inNamespace = False, nox_args = None, **kwargs): '''Init. @param name name to give controller - @param nox_args list of args to use with NOX + @param nox_args list of args, or single arg, to pass to NOX ''' + if type(nox_args) != list: + nox_args = [nox_args] if not nox_args: nox_args = ['packetdump'] nox_core_dir = os.environ['NOX_CORE_DIR']