Revision 16c57ddb

View differences:

bin/mn_run.py
30 30
HOSTS = {'process' : Host}
31 31

  
32 32
CONTROLLER_DEF = 'ref'
33
# a and b are the name and inNamespace params.
33 34
CONTROLLERS = {'ref' : Controller,
34 35
               'nox_dump' : lambda a, b: NOX(a, b, 'packetdump'),
35
               'nox_pysw' : lambda a, b: NOX(a, b, 'pyswitch')}
36
               'nox_pysw' : lambda a, b: NOX(a, b, 'pyswitch'),
37
               'none' :     lambda a, b: None}
36 38

  
37 39
# optional tests to run
38 40
TESTS = ['cli', 'build', 'ping_all', 'ping_pair', 'iperf', 'all']
mininet/net.py
161 161
        @param controller Controller class
162 162
        '''
163 163
        controller = self.controller('c0', not self.kernel)
164
        self.controllers['c0'] = controller
164
        if controller: # allow controller-less setups
165
            self.controllers['c0'] = controller
165 166

  
166 167
    # Control network support:
167 168
    #
......
290 291
    def start(self):
291 292
        '''Start controller and switches\n'''
292 293
        lg.info('*** Starting controller\n')
293
        self.controllers['c0'].start()
294
        #for controller in self.controllers:
295
        #    controller.start()
294
        for cname, cnode in self.controllers.iteritems():
295
            cnode.start()
296 296
        lg.info('*** Starting %s switches\n' % len(self.topo.switches()))
297 297
        for switch_dpid in self.topo.switches():
298 298
            switch = self.nodes[switch_dpid]
299 299
            #lg.info('switch = %s' % switch)
300 300
            lg.info('0x%x ' % switch_dpid)
301
            switch.start(self.controllers['c0'])
301
            switch.start(self.controllers)
302 302
        lg.info('\n')
303 303

  
304 304
    def stop(self):
......
316 316
            switch.stop()
317 317
        lg.info('\n')
318 318
        lg.info('*** Stopping controller\n')
319
        #for controller in self.controllers.iteriterms():
320
        self.controllers['c0'].stop()
319
        for cname, cnode in self.controllers.iteritems():
320
            cnode.stop()
321 321
        lg.info('*** Test complete\n')
322 322

  
323 323
    def run(self, test, **params):
......
448 448
        self.nodemap = {} # map names to Node objects
449 449
        for node in self.mn.nodes.values():
450 450
            self.nodemap[node.name] = node
451
        self.nodemap['c0'] = self.mn.controllers['c0']
451
        for cname, cnode in self.mn.controllers.iteritems():
452
            self.nodemap[cname] = cnode
452 453
        self.nodelist = self.nodemap.values()
453 454
        self.run()
454 455

  
mininet/node.py
253 253
        self.dp = datapath
254 254
        Node.__init__(self, name, inNamespace = (datapath == None))
255 255

  
256
    def _startUserDatapath(self, controller):
256
    def _startUserDatapath(self, controllers):
257 257
        '''Start OpenFlow reference user datapath.
258 258

  
259 259
        Log to /tmp/sN-{ofd,ofp}.log.
260 260

  
261
        @param controller Controller object.
261
        @param controllers dict of controller names to objects
262 262
        '''
263
        if 'c0' not in controller:
264
            raise Exception('User datapath start() requires controller c0')
265
        controller = controllers['c0']
263 266
        ofdlog = '/tmp/' + self.name + '-ofd.log'
264 267
        ofplog = '/tmp/' + self.name + '-ofp.log'
265 268
        self.cmd('ifconfig lo up')
......
302 305
            quietRun('ip link del ' + intf)
303 306
            lg.info('.')
304 307

  
305
    def start(self, controller):
308
    def start(self, controllers):
306 309
        '''Start datapath.
307 310

  
308
        @param controller Controller object
311
        @param controllers dict of controller names to objects
309 312
        '''
310 313
        if self.dp is None:
311
            self._startUserDatapath(controller)
314
            self._startUserDatapath(controllers)
312 315
        else:
313 316
            self._startKernelDatapath()
314 317

  

Also available in: Unified diff