Skip to content
Snippets Groups Projects
Commit 271013e0 authored by Bob Lantz's avatar Bob Lantz
Browse files

Minor cleanup.

parent 6c5cc2bf
No related branches found
No related tags found
No related merge requests found
...@@ -383,12 +383,9 @@ def intfIsUp( self, intf ): ...@@ -383,12 +383,9 @@ def intfIsUp( self, intf ):
# Other methods # Other methods
def __str__( self ): def __str__( self ):
result = self.name + ':' intfs = sorted( self.intfs.values() )
result += ' IP=' + str( self.IP() ) return '%s: IP=%s intfs=%s pid=%s' % (
result += ' intfs=' + ','.join( sorted( self.intfs.values() ) ) self.name, self.IP(), ','.join( intfs ), self.pid )
result += ' waiting=' + str( self.waiting )
result += ' pid=' + str( self.pid )
return result
class Host( Node ): class Host( Node ):
...@@ -490,10 +487,11 @@ def start( self, controllers ): ...@@ -490,10 +487,11 @@ def start( self, controllers ):
self.cmd( 'dpctl adddp ' + self.dp ) self.cmd( 'dpctl adddp ' + self.dp )
if self.defaultMAC: if self.defaultMAC:
self.cmd( 'ifconfig', self.intf, 'hw', 'ether', self.defaultMAC ) self.cmd( 'ifconfig', self.intf, 'hw', 'ether', self.defaultMAC )
if len( self.intfs ) != max( self.intfs ) + 1: ports = sorted( self.ports.values() )
if len( ports ) != ports[ -1 ] + 1:
raise Exception( 'only contiguous, zero-indexed port ranges' raise Exception( 'only contiguous, zero-indexed port ranges'
'supported: %s' % self.intfs ) 'supported: %s' % ports )
intfs = [ self.intfs[ port ] for port in sorted( self.intfs.keys() ) ] intfs = [ self.intfs[ port ] for port in ports ]
self.cmd( 'dpctl', 'addif', self.dp, ' '.join( intfs ) ) self.cmd( 'dpctl', 'addif', self.dp, ' '.join( intfs ) )
# Run protocol daemon # Run protocol daemon
controller = controllers[ 0 ] controller = controllers[ 0 ]
...@@ -543,10 +541,11 @@ def start( self, controllers ): ...@@ -543,10 +541,11 @@ def start( self, controllers ):
if self.defaultMAC: if self.defaultMAC:
mac = self.defaultMAC mac = self.defaultMAC
self.cmd( 'ifconfig', self.intf, 'hw', 'ether', mac ) self.cmd( 'ifconfig', self.intf, 'hw', 'ether', mac )
if len( self.intfs ) != max( self.intfs ) + 1: ports = sorted( self.ports.values() )
if len( ports ) != ports[ -1 ] + 1:
raise Exception( 'only contiguous, zero-indexed port ranges' raise Exception( 'only contiguous, zero-indexed port ranges'
'supported: %s' % self.intfs ) 'supported: %s' % self.intfs )
intfs = [ self.intfs[ port ] for port in sorted( self.intfs.keys() ) ] intfs = [ self.intfs[ port ] for port in ports ]
self.cmd( 'ovs-dpctl', 'add-if', self.dp, ' '.join( intfs ) ) self.cmd( 'ovs-dpctl', 'add-if', self.dp, ' '.join( intfs ) )
# Run protocol daemon # Run protocol daemon
controller = controllers[ 0 ] controller = controllers[ 0 ]
......
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