Revision 81d27b3c

View differences:

mininet/node.py
433 433
        ofdlog = '/tmp/' + self.name + '-ofd.log'
434 434
        ofplog = '/tmp/' + self.name + '-ofp.log'
435 435
        self.cmd( 'ifconfig lo up' )
436
        mac_str = ''
437
        if self.defaultMAC:
438
            # ofdatapath expects a string of hex digits with no colons.
439
            mac_str = ' -d ' + ''.join( self.defaultMAC.split( ':' ) )
436 440
        intfs = sorted( self.intfs.values() )
437 441
        if self.inNamespace:
438 442
            intfs = intfs[ :-1 ]
439 443
        self.cmd( 'ofdatapath -i ' + ','.join( intfs ) +
440
            ' punix:/tmp/' + self.name +
444
            ' punix:/tmp/' + self.name + mac_str +
441 445
            ' 1> ' + ofdlog + ' 2> ' + ofdlog + ' &' )
442 446
        self.cmd( 'ofprotocol unix:/tmp/' + self.name +
443 447
            ' tcp:%s:%d' % ( controller.IP(), controller.port ) +
......
533 537
        # then create a new one monitoring the given interfaces
534 538
        quietRun( 'ovs-dpctl del-dp ' + self.dp )
535 539
        self.cmd( 'ovs-dpctl add-dp ' + self.dp )
540
        mac_str = ''
536 541
        if self.defaultMAC:
537
            mac = self.defaultMAC
538
            self.cmd( 'ifconfig', self.intf, 'hw', 'ether', mac )
542
            # ovs-openflowd expects a string of exactly 16 hex digits with no
543
            # colons.
544
            mac_str = ' --datapath-id=0000' + \
545
                      ''.join( self.defaultMAC.split( ':' ) ) + ' '
539 546
        ports = sorted( self.ports.values() )
540 547
        if len( ports ) != ports[ -1 ] + 1:
541 548
            raise Exception( 'only contiguous, zero-indexed port ranges'
......
546 553
        controller = controllers[ 0 ]
547 554
        self.cmd( 'ovs-openflowd ' + self.dp +
548 555
            ' tcp:%s:%d' % ( controller.IP(), controller.port ) +
549
            ' --fail=closed ' + self.opts +
556
            ' --fail=closed ' + self.opts + mac_str +
550 557
            ' 1>' + ofplog + ' 2>' + ofplog + '&' )
551 558
        self.execed = False
552 559

  

Also available in: Unified diff