Revision 75d72d96
mininet/node.py | ||
---|---|---|
35 | 35 |
|
36 | 36 |
""" |
37 | 37 |
|
38 |
from subprocess import Popen, PIPE, STDOUT |
|
39 | 38 |
import os |
39 |
import re |
|
40 | 40 |
import signal |
41 | 41 |
import select |
42 |
from subprocess import Popen, PIPE, STDOUT |
|
42 | 43 |
from time import sleep |
43 | 44 |
|
44 | 45 |
from mininet.log import info, error, debug |
... | ... | |
227 | 228 |
# However, this takes time, so we're better off removing them |
228 | 229 |
# explicitly so that we won't get errors if we run before they |
229 | 230 |
# have been removed by the kernel. Unfortunately this is very slow. |
230 |
self.cmd( 'kill %ofprotocol' ) |
|
231 | 231 |
for intf in self.intfs.values(): |
232 | 232 |
quietRun( 'ip link del ' + intf ) |
233 | 233 |
info( '.' ) |
... | ... | |
275 | 275 |
"Return IP address of interface 0" |
276 | 276 |
return self.ips.get( self.intfs.get( 0 , None ), None ) |
277 | 277 |
|
278 |
def MAC( self ): |
|
279 |
"Return MAC address of interface 0" |
|
280 |
ifconfig = self.cmd( 'ifconfig ' + self.intfs[ 0 ] ) |
|
281 |
macs = re.findall( '..:..:..:..:..:..', ifconfig ) |
|
282 |
if len( macs ) > 0: |
|
283 |
return macs[ 0 ] |
|
284 |
else: |
|
285 |
return None |
|
286 |
|
|
278 | 287 |
def intfIsUp( self, port ): |
279 | 288 |
"""Check if interface for a given port number is up. |
280 | 289 |
port: port number""" |
... | ... | |
388 | 397 |
def stop( self ): |
389 | 398 |
"Terminate kernel datapath." |
390 | 399 |
quietRun( 'dpctl deldp nl:%i' % self.dp ) |
400 |
self.cmd( 'kill %ofprotocol' ) |
|
391 | 401 |
self.deleteIntfs() |
392 | 402 |
|
393 | 403 |
class OVSKernelSwitch( Switch ): |
... | ... | |
431 | 441 |
def stop( self ): |
432 | 442 |
"Terminate kernel datapath." |
433 | 443 |
quietRun( 'ovs-dpctl del-dp dp%i' % self.dp ) |
444 |
self.cmd( 'kill %ovs-openflowd' ) |
|
434 | 445 |
self.deleteIntfs() |
435 | 446 |
|
436 | 447 |
|
Also available in: Unified diff