Add more NOX options

This commit is contained in:
Brandon Heller
2010-01-02 10:58:28 -08:00
parent eeb9cb3c2b
commit 4804237fa7
3 changed files with 12 additions and 10 deletions
+3 -3
View File
@@ -11,8 +11,7 @@ from ripcord.topo import FatTreeTopo
from mininet.logging_mod import lg, set_loglevel, LEVELS from mininet.logging_mod import lg, set_loglevel, LEVELS
from mininet.net import Mininet, init from mininet.net import Mininet, init
from mininet.node import Switch, Host, Controller, ControllerParams from mininet.node import Switch, Host, Controller, ControllerParams, NOX
from mininet.node import NOXController
from mininet.topo import TreeTopo from mininet.topo import TreeTopo
# built in topologies, created only when run # built in topologies, created only when run
@@ -32,7 +31,8 @@ HOSTS = {'process' : Host}
CONTROLLER_DEF = 'ref' CONTROLLER_DEF = 'ref'
CONTROLLERS = {'ref' : Controller, 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 # optional tests to run
TESTS = ['cli', 'build', 'ping_all', 'ping_pair', 'iperf', 'all'] TESTS = ['cli', 'build', 'ping_all', 'ping_pair', 'iperf', 'all']
+1 -1
View File
@@ -160,7 +160,7 @@ class Mininet(object):
@param controller Controller class @param controller Controller class
''' '''
controller = self.controller('c0', kernel = self.kernel) controller = self.controller('c0', not self.kernel)
self.controllers['c0'] = controller self.controllers['c0'] = controller
# Control network support: # Control network support:
+8 -6
View File
@@ -215,12 +215,12 @@ class Controller(Node):
'''A Controller is a Node that is running (or has execed) an '''A Controller is a Node that is running (or has execed) an
OpenFlow controller.''' OpenFlow controller.'''
def __init__(self, name, kernel=True, controller='controller', def __init__(self, name, inNamespace = False, controller = 'controller',
cargs='-v ptcp:', cdir=None): cargs = '-v ptcp:', cdir = None):
self.controller = controller self.controller = controller
self.cargs = cargs self.cargs = cargs
self.cdir = cdir self.cdir = cdir
Node.__init__(self, name, inNamespace=(not kernel)) Node.__init__(self, name, inNamespace = inNamespace)
def start(self): def start(self):
'''Start <controller> <args> on controller. '''Start <controller> <args> on controller.
@@ -338,14 +338,16 @@ class Switch(Node):
return True, '' return True, ''
class NOXController(Controller): class NOX(Controller):
'''Controller to run a NOX application.''' '''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. '''Init.
@param name name to give controller @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: if not nox_args:
nox_args = ['packetdump'] nox_args = ['packetdump']
nox_core_dir = os.environ['NOX_CORE_DIR'] nox_core_dir = os.environ['NOX_CORE_DIR']