Skip to content
Snippets Groups Projects
Commit e282b6e2 authored by Brandon Heller's avatar Brandon Heller Committed by Bob Lantz
Browse files

Fix --mac breakage

The OVS interface for this moved to ovs-openflowd.

This functionality was never there for the user-space switch.  Now it's
in.
parent 7abca147
No related branches found
No related tags found
No related merge requests found
...@@ -433,11 +433,15 @@ def start( self, controllers ): ...@@ -433,11 +433,15 @@ def start( self, controllers ):
ofdlog = '/tmp/' + self.name + '-ofd.log' ofdlog = '/tmp/' + self.name + '-ofd.log'
ofplog = '/tmp/' + self.name + '-ofp.log' ofplog = '/tmp/' + self.name + '-ofp.log'
self.cmd( 'ifconfig lo up' ) self.cmd( 'ifconfig lo up' )
mac_str = ''
if self.defaultMAC:
# ofdatapath expects a string of hex digits with no colons.
mac_str = ' -d ' + ''.join( self.defaultMAC.split( ':' ) )
intfs = sorted( self.intfs.values() ) intfs = sorted( self.intfs.values() )
if self.inNamespace: if self.inNamespace:
intfs = intfs[ :-1 ] intfs = intfs[ :-1 ]
self.cmd( 'ofdatapath -i ' + ','.join( intfs ) + self.cmd( 'ofdatapath -i ' + ','.join( intfs ) +
' punix:/tmp/' + self.name + ' punix:/tmp/' + self.name + mac_str +
' 1> ' + ofdlog + ' 2> ' + ofdlog + ' &' ) ' 1> ' + ofdlog + ' 2> ' + ofdlog + ' &' )
self.cmd( 'ofprotocol unix:/tmp/' + self.name + self.cmd( 'ofprotocol unix:/tmp/' + self.name +
' tcp:%s:%d' % ( controller.IP(), controller.port ) + ' tcp:%s:%d' % ( controller.IP(), controller.port ) +
...@@ -533,9 +537,12 @@ def start( self, controllers ): ...@@ -533,9 +537,12 @@ def start( self, controllers ):
# then create a new one monitoring the given interfaces # then create a new one monitoring the given interfaces
quietRun( 'ovs-dpctl del-dp ' + self.dp ) quietRun( 'ovs-dpctl del-dp ' + self.dp )
self.cmd( 'ovs-dpctl add-dp ' + self.dp ) self.cmd( 'ovs-dpctl add-dp ' + self.dp )
mac_str = ''
if self.defaultMAC: if self.defaultMAC:
mac = self.defaultMAC # ovs-openflowd expects a string of exactly 16 hex digits with no
self.cmd( 'ifconfig', self.intf, 'hw', 'ether', mac ) # colons.
mac_str = ' --datapath-id=0000' + \
''.join( self.defaultMAC.split( ':' ) ) + ' '
ports = sorted( self.ports.values() ) ports = sorted( self.ports.values() )
if len( ports ) != ports[ -1 ] + 1: if len( ports ) != ports[ -1 ] + 1:
raise Exception( 'only contiguous, zero-indexed port ranges' raise Exception( 'only contiguous, zero-indexed port ranges'
...@@ -546,7 +553,7 @@ def start( self, controllers ): ...@@ -546,7 +553,7 @@ def start( self, controllers ):
controller = controllers[ 0 ] controller = controllers[ 0 ]
self.cmd( 'ovs-openflowd ' + self.dp + self.cmd( 'ovs-openflowd ' + self.dp +
' tcp:%s:%d' % ( controller.IP(), controller.port ) + ' tcp:%s:%d' % ( controller.IP(), controller.port ) +
' --fail=closed ' + self.opts + ' --fail=closed ' + self.opts + mac_str +
' 1>' + ofplog + ' 2>' + ofplog + '&' ) ' 1>' + ofplog + ' 2>' + ofplog + '&' )
self.execed = False self.execed = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment