Adding grep option for tsharkGrep function
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index f96a60e..90255f8 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -685,6 +685,47 @@
main.cleanup()
main.exit()
+ def onosCfgSet( self, ONOSIp, configName, configParam ):
+ """
+ Uses 'onos <node-ip> cfg set' to change a parameter value of an
+ application.
+
+ ex)
+ onos 10.0.0.1 cfg set org.onosproject.myapp appSetting 1
+
+ ONOSIp = '10.0.0.1'
+ configName = 'org.onosproject.myapp'
+ configParam = 'appSetting 1'
+
+ """
+ try:
+ cfgStr = ( "onos "+str(ONOSIp)+" cfg set "+
+ str(configName) + " " +
+ str(configParam)
+ )
+
+ self.handle.sendline( "" )
+ self.handle.expect( "\$" )
+ self.handle.sendline( cfgStr )
+ self.handle.expect( "\$" )
+
+ # TODO: Add meaningful assertion
+
+ return main.TRUE
+
+ except pexpect.ExceptionPexpect as e:
+ main.log.error( self.name + ": Pexpect exception found of type " +
+ str( type( e ) ) )
+ main.log.error ( e.get_trace() )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
+
def onosCli( self, ONOSIp, cmdstr ):
"""
Uses 'onos' command to send various ONOS CLI arguments.
@@ -1294,13 +1335,14 @@
main.cleanup()
main.exit()
- def tsharkGrep( self, grep, directory, interface='eth0' ):
+ def tsharkGrep( self, grep, directory, interface='eth0', grepOptions='' ):
"""
Required:
* grep string
* directory to store results
Optional:
* interface - default: eth0
+ * grepOptions - options for grep
Description:
Uses tshark command to grep specific group of packets
and stores the results to specified directory.
@@ -1310,10 +1352,16 @@
self.handle.sendline( "" )
self.handle.expect( "\$" )
self.handle.sendline( "" )
+ if grepOptions:
+ grepStr = "grep "+str(grepOptions)
+ else:
+ grepStr = "grep"
+
self.handle.sendline(
"tshark -i " +
str( interface ) +
- " -t e | grep --line-buffered \"" +
+ " -t e | " +
+ grepStr + " --line-buffered \"" +
str(grep) +
"\" >" +
directory +