Dumping Flows on each test now
Change-Id: I4445a58735f97dfda4b0c5345ff6a9c56a3544c5
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
old mode 100644
new mode 100755
index 1aed954..028ec91
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -25,7 +25,6 @@
from requests.models import Response
from drivers.common.clidriver import CLI
-
class OnosDriver( CLI ):
def __init__( self ):
@@ -1547,6 +1546,30 @@
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( '%x %X' )
+ 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)
+
def cpLogsToDir( self, logToCopy,
destDir, copyFileName="" ):
"""
diff --git a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
old mode 100644
new mode 100755
index bfdff59..9d96a43
--- a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
+++ b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
@@ -287,6 +287,8 @@
onfail="Flow status is wrong!" )
main.ONOSbench.dumpFlows( main.ONOSip[0],
main.logdir, "flowsBefore" + main.jsonFile)
+ main.ONOSbench.dumpGroups( main.ONOSip[0],
+ main.logdir, "groupsBefore" + main.jsonFile)
#time.sleep( 3*main.startUpSleep)
def CASE4( self, main ):
@@ -301,7 +303,8 @@
# cleanup mininet
main.ONOSbench.dumpFlows( main.ONOSip[0],
main.logdir, "flowsAfter" + main.jsonFile)
-
+ main.ONOSbench.dumpGroups( main.ONOSip[0],
+ main.logdir, "groupsAfter" + main.jsonFile)
main.step("2nd Check full connectivity")
pa = main.Mininet1.pingall()
utilities.assert_equals( expect=main.TRUE, actual=pa,
@@ -311,6 +314,9 @@
main.ONOSbench.dumpFlows( main.ONOSip[0],
main.logdir, "flowsAfter2nd" + main.jsonFile)
+ main.ONOSbench.dumpGroups( main.ONOSip[0],
+ main.logdir, "groupsAfter2nd" + main.jsonFile)
+
main.ONOSbench.onosStop( main.ONOSip[0] )
main.Mininet1.stopNet()