Add new a general dump command for ONOS driver;
Change-Id: I9bc61839864480e51567143608718de8f3cb0ffd
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index dfb85fb..2f38e29 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1624,19 +1624,20 @@
main.cleanup()
main.exit()
- def dumpFlows(self,ONOSIp, destDir, filename="flows" ):
+ def dumpONOSCmd(self, ONOSIp, CMD, destDir, filename, options=""):
"""
- Dump Flow Tables to a desired directory.
+ Dump Cmd to a desired directory.
For debugging purposes, you may want to use
- this function to capture flows at a given point in time.
+ this function to capture Cmd at a given point in time.
Localtime will be attached to the filename
Required:
* ONOSIp: the IP of the target ONOS instance
+ * CMD: the command to dump;
* destDir: specify directory to copy to.
ex ) /tmp/
- Optional:
* fileName: Name of the file
+ * options: Options for ONOS command
"""
localtime = time.strftime( '%x %X' )
@@ -1645,32 +1646,8 @@
localtime = localtime.replace( ":", "" )
if destDir[ -1: ] != "/":
destDir += "/"
- cmd="flows > "+ str( destDir ) + str( filename ) + localtime
- return self.onosCli(ONOSIp,cmd)
-
- def dumpGroups(self,ONOSIp, destDir, filename="groups" ):
- """
- Dump Group Tables to a desired directory.
- For debugging purposes, you may want to use
- this function to capture groups at a given point in time.
- Localtime will be attached to the filename
-
- Required:
- * ONOSIp: the IP of the target ONOS instance
- * destDir: specify directory to copy to.
- ex ) /tmp/
- Optional:
- * fileName: Name of the file
- """
-
- localtime = time.strftime( '%H %M' )
- localtime = localtime.replace( "/", "" )
- localtime = localtime.replace( " ", "_" )
- localtime = localtime.replace( ":", "" )
- if destDir[ -1: ] != "/":
- destDir += "/"
- cmd="groups > "+ str( destDir ) + str( filename ) + localtime
- return self.onosCli(ONOSIp,cmd)
+ cmd=CMD + " " + options + " > " + str( destDir ) + str( filename ) + localtime
+ return self.onosCli(ONOSIp, cmd)
def cpLogsToDir( self, logToCopy,
destDir, copyFileName="" ):
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index dcaddbf..61c12ad 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -240,12 +240,14 @@
onpass="Flow status is correct!",
onfail="Flow status is wrong!" )
if dumpflows:
- main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],
- main.logdir,
- "flowsBefore" + main.cfgName )
- main.ONOSbench.dumpGroups( main.ONOSip[ main.active ],
- main.logdir,
- "groupsBefore" + main.cfgName )
+ main.ONOSbench.dumpONOSCmd( main.ONOSip[ main.active ],
+ "flows",
+ main.logdir,
+ "flowsBefore" + main.cfgName )
+ main.ONOSbench.dumpONOSCmd( main.ONOSip[ main.active ],
+ "groups",
+ main.logdir,
+ "groupsBefore" + main.cfgName )
@staticmethod
def pingAll( main, tag="", dumpflows=True ):
@@ -261,10 +263,14 @@
onpass="IP connectivity successfully tested",
onfail="IP connectivity failed" )
if dumpflows:
- main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],
- main.logdir, "flowsOn" + tag )
- main.ONOSbench.dumpGroups( main.ONOSip[ main.active ],
- main.logdir, "groupsOn" + tag )
+ main.ONOSbench.dumpONOSCmd( main.ONOSip[ main.active ],
+ "flows",
+ main.logdir,
+ "flowsOn" + tag )
+ main.ONOSbench.dumpONOSCmd( main.ONOSip[ main.active ],
+ "groups",
+ main.logdir,
+ "groupsOn" + tag )
@staticmethod
def killLink( main, end1, end2, switches, links ):