add testcase for copying karaf logs to preserve them between
instalations of ONOS

Change-Id: If8e5c91c4a5dafde275b3241cab1a0c0477fb220
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index ddd1cd8..6e4ae5a 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -55,6 +55,7 @@
             main.configName = main.params[ 'CONFIGURE' ][ 'cfgName' ]
             main.configPass = main.params[ 'CONFIGURE' ][ 'cfgPass' ]
             main.configPort = main.params[ 'CONFIGURE' ][ 'cfgAppPort' ]
+            main.cycle = 0 # How many times FUNCintent has run through its tests
 
             gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.cellData = {} # for creating cell file
@@ -139,6 +140,8 @@
         - Connect to cli
         """
 
+        main.cycle += 1
+
         # main.scale[ 0 ] determines the current number of ONOS controller
         main.numCtrls = int( main.scale[ 0 ] )
 
@@ -254,6 +257,28 @@
         # Remove the first element in main.scale list
         main.scale.remove( main.scale[ 0 ] )
 
+    def CASE19( self, main ):
+        """
+            Copy the karaf.log files after each testcase cycle
+        """
+        main.log.report( "Copy karaf logs" )
+        main.case( "Copy karaf logs" )
+        main.caseExplanation = "Copying the karaf logs to preserve them through" +\
+                               "reinstalling ONOS"
+        main.step( "Copying karaf logs" )
+        i = 0
+        for cli in main.CLIs:
+            main.node = cli
+            ip = main.ONOSip[ i ]
+            main.node.ip_address = ip
+            main.ONOSbench.scp( main.node ,
+                                "/opt/onos/log/karaf.log",
+                                "/tmp/karaf.log",
+                                direction="from" )
+            main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
+                                        copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
+            i += 1
+
     def CASE100( self, main ):
         """
             Start NETCONF app and OFC-Server or make sure that they are already running