From 220376b6e214e11ef8aa2cd98e9f4ebf22057ebc Mon Sep 17 00:00:00 2001
From: Brian O'Connor <bocon13@gmail.com>
Date: Mon, 9 Sep 2013 19:23:14 -0700
Subject: [PATCH] hwintf.py: allow intf to be specified in cmd line

---
 examples/hwintf.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/hwintf.py b/examples/hwintf.py
index e5960d96..1e010fd3 100755
--- a/examples/hwintf.py
+++ b/examples/hwintf.py
@@ -5,7 +5,7 @@
 hardware interface) to a network after the network is created.
 """
 
-import re
+import re, sys
 
 from mininet.cli import CLI
 from mininet.log import setLogLevel, info, error
@@ -28,7 +28,10 @@ def checkIntf( intf ):
 if __name__ == '__main__':
     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' )
     checkIntf( intfName )
 
-- 
GitLab