Restore user-space switch option
Switches and controller in root namespace only, for now.
This commit is contained in:
+4
-11
@@ -92,7 +92,7 @@ class Mininet(object):
|
||||
@param now build now?
|
||||
@param xterms if build now, spawn xterms?
|
||||
@param cleanup if build now, cleanup before creating?
|
||||
@param in_namespace spawn switches and hosts in their own namespace?
|
||||
@param in_namespace spawn switches and controller in net namespaces?
|
||||
@param auto_set_macs set MAC addrs to DPIDs?
|
||||
@param auto_static_arp set all-pairs static MAC addrs?
|
||||
'''
|
||||
@@ -112,8 +112,6 @@ class Mininet(object):
|
||||
|
||||
self.terms = [] # list of spawned xterm processes
|
||||
|
||||
self.kernel = True #temporary!
|
||||
|
||||
if build:
|
||||
self.build()
|
||||
|
||||
@@ -178,7 +176,7 @@ class Mininet(object):
|
||||
|
||||
@param controller Controller class
|
||||
'''
|
||||
controller = self.controller('c0', not self.kernel)
|
||||
controller = self.controller('c0', self.in_namespace)
|
||||
if controller: # allow controller-less setups
|
||||
self.controllers['c0'] = controller
|
||||
|
||||
@@ -271,11 +269,6 @@ class Mininet(object):
|
||||
if self.cleanup:
|
||||
pass # cleanup
|
||||
# validate topo?
|
||||
kernel = self.kernel
|
||||
if kernel:
|
||||
lg.info('*** Using kernel datapath\n')
|
||||
else:
|
||||
lg.info('*** Using user datapath\n')
|
||||
lg.info('*** Adding controller\n')
|
||||
self._add_controller(self.controller)
|
||||
lg.info('*** Creating network\n')
|
||||
@@ -287,13 +280,13 @@ class Mininet(object):
|
||||
for switch in sorted(self.topo.switches()):
|
||||
self._add_switch(switch)
|
||||
lg.info('0x%x ' % switch)
|
||||
lg.info('\n*** Adding edges: ')
|
||||
lg.info('\n*** Adding edges:\n')
|
||||
for src, dst in sorted(self.topo.edges()):
|
||||
self._add_link(src, dst)
|
||||
lg.info('(0x%x, 0x%x) ' % (src, dst))
|
||||
lg.info('\n')
|
||||
|
||||
if not kernel:
|
||||
if self.in_namespace:
|
||||
lg.info('*** Configuring control network\n')
|
||||
self._configureControlNetwork()
|
||||
|
||||
|
||||
+11
-7
@@ -259,13 +259,17 @@ class Switch(Node):
|
||||
return True, ''
|
||||
|
||||
class UserSwitch(Switch):
|
||||
'''User-space switch.
|
||||
|
||||
Currently only works in the root namespace.
|
||||
'''
|
||||
|
||||
def __init__(self, name):
|
||||
'''Init.
|
||||
|
||||
@param name
|
||||
'''
|
||||
Node.__init__(self, name, inNamespace = True)
|
||||
Node.__init__(self, name, inNamespace = False)
|
||||
|
||||
def start(self, controllers):
|
||||
'''Start OpenFlow reference user datapath.
|
||||
@@ -274,17 +278,17 @@ class UserSwitch(Switch):
|
||||
|
||||
@param controllers dict of controller names to objects
|
||||
'''
|
||||
if 'c0' not in controller:
|
||||
if 'c0' not in controllers:
|
||||
raise Exception('User datapath start() requires controller c0')
|
||||
controller = controllers['c0']
|
||||
ofdlog = '/tmp/' + self.name + '-ofd.log'
|
||||
ofplog = '/tmp/' + self.name + '-ofp.log'
|
||||
self.cmd('ifconfig lo up')
|
||||
intfs = self.intfs[1:] # 0 is mgmt interface
|
||||
self.cmdPrint('ofdatapath -i ' + ','.join(intfs) +
|
||||
' ptcp: 1> ' + ofdlog + ' 2> ' + ofdlog + ' &')
|
||||
self.cmdPrint('ofprotocol tcp:' + controller.IP() +
|
||||
' tcp:localhost --fail=closed 1> ' + ofplog + ' 2>' +
|
||||
intfs = self.intfs
|
||||
self.cmdPrint('ofdatapath -i ' + ','.join(intfs) + ' punix:/tmp/' +
|
||||
self.name + ' 1> ' + ofdlog + ' 2> ' + ofdlog + ' &')
|
||||
self.cmdPrint('ofprotocol unix:/tmp/' + self.name + ' tcp:' +
|
||||
controller.IP() + ' --fail=closed 1> ' + ofplog + ' 2>' +
|
||||
ofplog + ' &')
|
||||
|
||||
def stop(self):
|
||||
|
||||
Reference in New Issue
Block a user