diff --git a/mininet/net.py b/mininet/net.py index 42cc505..a06727c 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -486,9 +486,9 @@ class Mininet( object ): "Run iperf UDP test." return self.iperf( l4Type='UDP', udpBw=udpBw ) - def link( self, type, src, dst ): + def link( self, status, src, dst ): """Change link status. - type: string {up, down} + status: string {up, down} src: string dst: string""" if src not in self.nameToNode: @@ -506,10 +506,10 @@ class Mininet( object ): srcPort, dstPort = self.topo.port( srcID, dstID ) srcIntf = srcNode.intfs[ srcPort ] dstIntf = dstNode.intfs[ dstPort ] - result = srcNode.cmd( [ 'ifconfig', srcIntf, type ] ) + result = srcNode.cmd( [ 'ifconfig', srcIntf, status ] ) if result: error( 'link src status change failed: %s\n' % result ) - result = dstNode.cmd( [ 'ifconfig', dstIntf, type ] ) + result = dstNode.cmd( [ 'ifconfig', dstIntf, status ] ) if result: error( 'link dst status change failed: %s\n' % result ) diff --git a/mininet/node.py b/mininet/node.py index 06dd07d..d204000 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -341,7 +341,7 @@ class Node( object ): """Bring all interfaces up or down. action: string to pass to ifconfig""" for intf in self.intfs.values(): - result = self.cmd( [ 'ifconfig', intf, action ] ) + self.cmd( [ 'ifconfig', intf, action ] ) # Other methods def __str__( self ): @@ -355,11 +355,11 @@ class Node( object ): class Host( Node ): "A host is simply a Node." - pass # 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. # For now, disable interfaces to "pause" the host. + def pause( self ): "Disable interfaces." self.modIntfs('down') @@ -481,6 +481,7 @@ class KernelSwitch( Switch ): # Since kernel threads cannot receive signals like user-space processes, # disabling the interfaces and ofdatapath is our workaround. + def pause( self ): "Disable interfaces and pause ofprotocol." self.cmd( 'kill -STOP %ofprotocol' ) @@ -541,6 +542,7 @@ class OVSKernelSwitch( Switch ): # Since kernel threads cannot receive signals like user-space processes, # disabling the interfaces and ofdatapath is our workaround. + def pause( self ): "Disable interfaces and pause ovs-openflowd." self.cmd( 'kill -STOP %ovs-openflowd' )