MCPcopy Create free account
hub / github.com/mininet/mininet / checkIntf

Function checkIntf

examples/hwintf.py:21–31  ·  view source on GitHub ↗

Make sure intf exists and is not configured.

( intf )

Source from the content-addressed store, hash-verified

19
20
21def checkIntf( intf ):
22 "Make sure intf exists and is not configured."
23 config = quietRun( 'ifconfig %s 2>/dev/null' % intf, shell=True )
24 if not config:
25 error( 'Error:', intf, 'does not exist!\n' )
26 exit( 1 )
27 ips = re.findall( r'\d+\.\d+\.\d+\.\d+', config )
28 if ips:
29 error( 'Error:', intf, 'has an IP address,'
30 'and is probably in use!\n' )
31 exit( 1 )
32
33
34if __name__ == '__main__':

Callers 1

hwintf.pyFile · 0.85

Calls 1

quietRunFunction · 0.90

Tested by

no test coverage detected