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 ):
# Other methods
def __str__( self ):
result = self.name + ':'
result += ' IP=' + str( self.IP() )
result += ' intfs=' + ','.join( sorted( self.intfs.values() ) )
result += ' waiting=' + str( self.waiting )
result += ' pid=' + str( self.pid )
return result
intfs = sorted( self.intfs.values() )
return '%s: IP=%s intfs=%s pid=%s' % (
self.name, self.IP(), ','.join( intfs ), self.pid )
class Host( Node ):
......@@ -490,10 +487,11 @@ def start( self, controllers ):
self.cmd( 'dpctl adddp ' + self.dp )
if 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'
'supported: %s' % self.intfs )
intfs = [ self.intfs[ port ] for port in sorted( self.intfs.keys() ) ]
'supported: %s' % ports )
intfs = [ self.intfs[ port ] for port in ports ]
self.cmd( 'dpctl', 'addif', self.dp, ' '.join( intfs ) )
# Run protocol daemon
controller = controllers[ 0 ]
......@@ -543,10 +541,11 @@ def start( self, controllers ):
if self.defaultMAC:
mac = self.defaultMAC
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'
'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 ) )
# Run protocol daemon
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