Pass codecheck.
This commit is contained in:
+4
-4
@@ -486,9 +486,9 @@ class Mininet( object ):
|
|||||||
"Run iperf UDP test."
|
"Run iperf UDP test."
|
||||||
return self.iperf( l4Type='UDP', udpBw=udpBw )
|
return self.iperf( l4Type='UDP', udpBw=udpBw )
|
||||||
|
|
||||||
def link( self, type, src, dst ):
|
def link( self, status, src, dst ):
|
||||||
"""Change link status.
|
"""Change link status.
|
||||||
type: string {up, down}
|
status: string {up, down}
|
||||||
src: string
|
src: string
|
||||||
dst: string"""
|
dst: string"""
|
||||||
if src not in self.nameToNode:
|
if src not in self.nameToNode:
|
||||||
@@ -506,10 +506,10 @@ class Mininet( object ):
|
|||||||
srcPort, dstPort = self.topo.port( srcID, dstID )
|
srcPort, dstPort = self.topo.port( srcID, dstID )
|
||||||
srcIntf = srcNode.intfs[ srcPort ]
|
srcIntf = srcNode.intfs[ srcPort ]
|
||||||
dstIntf = dstNode.intfs[ dstPort ]
|
dstIntf = dstNode.intfs[ dstPort ]
|
||||||
result = srcNode.cmd( [ 'ifconfig', srcIntf, type ] )
|
result = srcNode.cmd( [ 'ifconfig', srcIntf, status ] )
|
||||||
if result:
|
if result:
|
||||||
error( 'link src status change failed: %s\n' % result )
|
error( 'link src status change failed: %s\n' % result )
|
||||||
result = dstNode.cmd( [ 'ifconfig', dstIntf, type ] )
|
result = dstNode.cmd( [ 'ifconfig', dstIntf, status ] )
|
||||||
if result:
|
if result:
|
||||||
error( 'link dst status change failed: %s\n' % result )
|
error( 'link dst status change failed: %s\n' % result )
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -341,7 +341,7 @@ class Node( object ):
|
|||||||
"""Bring all interfaces up or down.
|
"""Bring all interfaces up or down.
|
||||||
action: string to pass to ifconfig"""
|
action: string to pass to ifconfig"""
|
||||||
for intf in self.intfs.values():
|
for intf in self.intfs.values():
|
||||||
result = self.cmd( [ 'ifconfig', intf, action ] )
|
self.cmd( [ 'ifconfig', intf, action ] )
|
||||||
|
|
||||||
# Other methods
|
# Other methods
|
||||||
def __str__( self ):
|
def __str__( self ):
|
||||||
@@ -355,11 +355,11 @@ class Node( object ):
|
|||||||
|
|
||||||
class Host( Node ):
|
class Host( Node ):
|
||||||
"A host is simply a Node."
|
"A host is simply a Node."
|
||||||
pass
|
|
||||||
|
|
||||||
# Ideally, pausing a host would pause the process. However, when one
|
# Ideally, pausing a host would pause the process. However, when one
|
||||||
# tries to run a command on a paused host, it leads to an exception later.
|
# tries to run a command on a paused host, it leads to an exception later.
|
||||||
# For now, disable interfaces to "pause" the host.
|
# For now, disable interfaces to "pause" the host.
|
||||||
|
|
||||||
def pause( self ):
|
def pause( self ):
|
||||||
"Disable interfaces."
|
"Disable interfaces."
|
||||||
self.modIntfs('down')
|
self.modIntfs('down')
|
||||||
@@ -481,6 +481,7 @@ class KernelSwitch( Switch ):
|
|||||||
|
|
||||||
# Since kernel threads cannot receive signals like user-space processes,
|
# Since kernel threads cannot receive signals like user-space processes,
|
||||||
# disabling the interfaces and ofdatapath is our workaround.
|
# disabling the interfaces and ofdatapath is our workaround.
|
||||||
|
|
||||||
def pause( self ):
|
def pause( self ):
|
||||||
"Disable interfaces and pause ofprotocol."
|
"Disable interfaces and pause ofprotocol."
|
||||||
self.cmd( 'kill -STOP %ofprotocol' )
|
self.cmd( 'kill -STOP %ofprotocol' )
|
||||||
@@ -541,6 +542,7 @@ class OVSKernelSwitch( Switch ):
|
|||||||
|
|
||||||
# Since kernel threads cannot receive signals like user-space processes,
|
# Since kernel threads cannot receive signals like user-space processes,
|
||||||
# disabling the interfaces and ofdatapath is our workaround.
|
# disabling the interfaces and ofdatapath is our workaround.
|
||||||
|
|
||||||
def pause( self ):
|
def pause( self ):
|
||||||
"Disable interfaces and pause ovs-openflowd."
|
"Disable interfaces and pause ovs-openflowd."
|
||||||
self.cmd( 'kill -STOP %ovs-openflowd' )
|
self.cmd( 'kill -STOP %ovs-openflowd' )
|
||||||
|
|||||||
Reference in New Issue
Block a user