Add tshark interface name to params

Change-Id: I03c87873abfc0da6b04be96cd1502e94a6110c8e
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.params b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.params
index 041ec60..6f72901 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.params
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.params
@@ -35,6 +35,7 @@
     </SLEEP>
 
     <TSHARK>
+        <tsharkInterface>lo</tsharkInterface>
         <tsharkPath>/tmp/hostLatTshark</tsharkPath>
         <tsharkPacketIn>OpenFlow 150 Type: OFPT_PACKET_IN</tsharkPacketIn>
     </TSHARK>
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
index 1124066..0cb5d2d 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
@@ -62,6 +62,7 @@
             # Tshark params
             main.tsharkResultPath = main.params[ 'TSHARK' ][ 'tsharkPath' ]
             main.tsharkPacketIn = main.params[ 'TSHARK' ][ 'tsharkPacketIn' ]
+            main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ]
 
             main.numlter = main.params[ 'TEST' ][ 'numIter' ]
             main.iterIgnore = int( main.params[ 'TEST' ][ 'iterIgnore' ] )
@@ -189,7 +190,7 @@
                 dbFile.write( "" )
 
             main.log.info( 'Starting tshark capture' )
-            main.ONOSbench.tsharkGrep( main.tsharkPacketIn, main.tsharkResultPath )
+            main.ONOSbench.tsharkGrep( main.tsharkPacketIn, main.tsharkResultPath, interface=main.tsharkInterface )
             time.sleep( main.measurementSleep )
 
             main.log.info( 'host 1 arping...' )
diff --git a/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.params b/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.params
index 2a95f8d..9311d91 100644
--- a/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.params
+++ b/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.params
@@ -24,6 +24,7 @@
     </GIT>
 
     <TSHARK>
+        <tsharkInterface>lo</tsharkInterface>
         <tsharkResultPath>/tmp/tshark_mastership_failover</tsharkResultPath>
         <ofpRoleRequest>OpenFlow 90 Type: OFPT_ROLE_REQUEST</ofpRoleRequest>
     </TSHARK>
diff --git a/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py b/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py
index e89cbb0..ae64588 100644
--- a/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py
+++ b/TestON/tests/SCPF/SCPFmastershipFailoverLat/SCPFmastershipFailoverLat.py
@@ -50,6 +50,7 @@
             main.scale = ( main.params[ 'SCALE' ] ).split( "," )
             main.ofpRoleRequest = main.params[ 'TSHARK' ][ 'ofpRoleRequest' ]
             main.tsharkResultPath = main.params[ 'TSHARK' ][ 'tsharkResultPath' ]
+            main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ]
             main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
             main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] )
             main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ]
@@ -153,7 +154,7 @@
             with open( main.tsharkResultPath, "w" ) as tshark:
                 tshark.write( "" )
             main.log.info( "Starting tshark capture." )
-            main.ONOSbench.tsharkGrep( main.ofpRoleRequest, main.tsharkResultPath )
+            main.ONOSbench.tsharkGrep( main.ofpRoleRequest, main.tsharkResultPath, interface=main.tsharkInterface )
             time1 = time.time() * 1000.0
 
             # Kill an ONOS node
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params
index 6d7de4f..473e6c2 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.params
@@ -32,6 +32,7 @@
         <defaultTopo>org.onosproject.net.topology.impl.DefaultTopologyProvider</defaultTopo>
     </CFG>
     <TSHARK>
+        <tsharkInterface>lo</tsharkInterface>
         <tsharkReusltPath>/tmp/tshark_portStatus</tsharkReusltPath>
         <ofpPortStatus>OpenFlow 146 Type: OFPT_PORT_STATUS</ofpPortStatus>
     </TSHARK>
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
index 2e972e8..33840f6 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
@@ -62,6 +62,7 @@
             main.scale = ( main.params[ 'SCALE' ] ).split( "," )
             main.ofportStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ]
             main.tsharkResultPath = main.params[ 'TSHARK' ][ 'tsharkReusltPath' ]
+            main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ]
             main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
             main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] )
             main.maxProcessTime = int( main.params[ 'TEST' ][ 'maxProcessTime' ] )
@@ -160,7 +161,8 @@
                                                      main.interface,
                                                      "down",
                                                      resultDict,
-                                                     False )
+                                                     False,
+                                                     main.tsharkInterface )
                 time.sleep( 2 )
                 # PortUp iteration
                 main.portFunc.capturePortStatusPack( main,
@@ -168,7 +170,8 @@
                                                      main.interface,
                                                      "up",
                                                      resultDict,
-                                                     False )
+                                                     False,
+                                                     main.tsharkInterface )
             else:
                 # if warm up, keep old result dictionary
                 main.portFunc.capturePortStatusPack( main,
@@ -176,13 +179,15 @@
                                                      main.interface,
                                                      "down",
                                                      resultDict,
-                                                     True )
+                                                     True,
+                                                     main.tsharkInterface )
                 main.portFunc.capturePortStatusPack( main,
                                                      main.device,
                                                      main.interface,
                                                      "up",
                                                      resultDict,
-                                                     True )
+                                                     True,
+                                                     main.tsharkInterface )
 
         # Dictionary for result
         maxDict = {}
diff --git a/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py b/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
index 10dc7ce..2e5eb76 100644
--- a/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
+++ b/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
@@ -23,7 +23,7 @@
 """
     Warp function for SCPFportLat test
 """
-def capturePortStatusPack( main, deviceName, interface, portStatus, resultDict, warmup ):
+def capturePortStatusPack( main, deviceName, interface, portStatus, resultDict, warmup, tsharkInterface ):
     """
     Change device port status and use tshark to capture openflow port package
     Args:
@@ -33,13 +33,14 @@
         portStatus: up or down
         resultDict: put result to dictionary
         warmup: if warmup, ignore results
+        tsharkInterface: name of interface which tshark listens to
 
     """
     main.log.info( "Clean up tshark" )
     with open( main.tsharkResultPath, "w" ) as tshark:
         tshark.write( "" )
     main.log.info( "Starting tshark capture" )
-    main.ONOSbench.tsharkGrep( main.ofportStatus, main.tsharkResultPath )
+    main.ONOSbench.tsharkGrep( main.ofportStatus, main.tsharkResultPath, interface=tsharkInterface )
     time.sleep( main.measurementSleep )
     main.log.info( "{} port {} {}".format( deviceName, interface, portStatus ) )
     main.Mininet1.changeInterfaceStatus( deviceName, interface, portStatus )
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index 0c34b5c..7aaf8c7 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -51,6 +51,10 @@
         <numCtrls>3</numCtrls>
     </CTRL>
 
+    <TSHARK>
+        <tsharkInterface>lo</tsharkInterface>
+    </TSHARK>
+
     <SLEEP>
         <startup>15</startup>
         <balance>10</balance>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 66c1394..b5a46f7 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -80,6 +80,7 @@
             main.MNupdateTime = int( main.params[ 'TIMEOUT' ][ 'update' ] )
             main.MNLinksTime = int( main.params[ 'TIMEOUT' ][ 'links' ] )
             main.getTopoTime = int( main.params[ 'TIMEOUT' ][ 'getTopo' ] )
+            main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ]
             main.currScale = None
             main.maxScale = 1
             main.threadID = 0
@@ -190,7 +191,7 @@
         with open( main.tsharkResultPath, "w" ) as tshark:
             tshark.write( "" )
         main.log.info( "Starting Tshark capture" )
-        main.ONOSbench.tsharkGrep( main.roleRequest, main.tsharkResultPath, grepOptions='-E' )
+        main.ONOSbench.tsharkGrep( main.roleRequest, main.tsharkResultPath, interface=main.tsharkInterface, grepOptions='-E' )
         main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.openflow" )
         time.sleep( main.MNSleep )
         main.log.info( "Stop Tshark" )
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params
index 00b9959..c7cc4a2 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.params
@@ -49,6 +49,7 @@
     </BENCH>
 
     <TSHARK>
+        <tsharkInterface>lo</tsharkInterface>
         <up>
             <TCP>6653\ \[SYN\]</TCP> #1
             <RQ>OpenFlow 90 Type: OFPT_ROLE_REQUEST</RQ> #2
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 21f9186..822274a 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -70,6 +70,7 @@
             main.scale = ( main.params[ 'SCALE' ] ).split( "," )
 
             main.ofPackage = main.params[ 'TSHARK' ]
+            main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ]
             main.defaultTopoCfg = main.params[ 'CFG' ][ 'defaultTopo' ]
             main.tsharkResultPath = main.params[ 'TEST' ][ 'tsharkResultPath' ]
             main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
@@ -165,9 +166,9 @@
             main.log.info( "************************ Iteration: {} **********************" .format( str( i + 1 ) ) )
             if i < main.warmUp:
                 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
-                                               "up", resultDict, True )
+                                               "up", resultDict, True, main.tsharkInterface )
                 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
-                                               "down", resultDict, True )
+                                               "down", resultDict, True, main.tsharkInterface )
                 main.log.debug( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
                 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
                 main.log.debug( "After devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
@@ -176,9 +177,9 @@
                     main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
             else:
                 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
-                                               "up", resultDict, False )
+                                               "up", resultDict, False, main.tsharkInterface )
                 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
-                                                "down", resultDict, False )
+                                                "down", resultDict, False, main.tsharkInterface )
                 main.log.debug( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
                 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
                 main.log.debug("After devices : " + str(main.Cluster.active(0).CLI.devices()))
diff --git a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
index 4c26b59..2b847a5 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
@@ -151,7 +151,7 @@
         main.cleanAndExit()
 
 
-def captureOfPack( main, deviceName, ofPack, switchStatus, resultDict, warmup ):
+def captureOfPack( main, deviceName, ofPack, switchStatus, resultDict, warmup, tsharkInterface ):
     """
     Args:
         main: TestON class
@@ -180,7 +180,7 @@
     grepString = grepString[ :-1 ]
     # open tshark
     main.log.info( "starting tshark capture" )
-    main.ONOSbench.tsharkGrep( grepString, main.tsharkResultPath[ switchStatus ][ 'ALL' ], grepOptions='-E' )
+    main.ONOSbench.tsharkGrep( grepString, main.tsharkResultPath[ switchStatus ][ 'ALL' ], interface=tsharkInterface, grepOptions='-E' )
     if switchStatus == 'up':
         # if up, assign switch to controller
         time.sleep( main.measurementSleep )