hwintf.py: allow intf to be specified in cmd line

This commit is contained in:
Brian O'Connor
2013-09-11 14:45:46 -07:00
parent cfb6bf95a3
commit 220376b6e2
+5 -2
View File
@@ -5,7 +5,7 @@ This example shows how to add an interface (for example a real
hardware interface) to a network after the network is created. hardware interface) to a network after the network is created.
""" """
import re import re, sys
from mininet.cli import CLI from mininet.cli import CLI
from mininet.log import setLogLevel, info, error from mininet.log import setLogLevel, info, error
@@ -28,7 +28,10 @@ def checkIntf( intf ):
if __name__ == '__main__': if __name__ == '__main__':
setLogLevel( 'info' ) setLogLevel( 'info' )
intfName = 'eth1' # try to get hw intf from the command line; by default, use eth1
intfName = sys.argv[ 1 ] if len( sys.argv ) > 1 else 'eth1'
info( '*** Connecting to hw intf: %s' % intfName )
info( '*** Checking', intfName, '\n' ) info( '*** Checking', intfName, '\n' )
checkIntf( intfName ) checkIntf( intfName )