Minor cleanup.
This commit is contained in:
+10
-11
@@ -383,12 +383,9 @@ class Node( object ):
|
|||||||
|
|
||||||
# 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 @@ class KernelSwitch( Switch ):
|
|||||||
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 @@ class OVSKernelSwitch( Switch ):
|
|||||||
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 ]
|
||||||
|
|||||||
Reference in New Issue
Block a user