Support to archive also partition data along with logs for ONOS.
Used by clusterTest based on a new ARCHIVE_PARTITION config in clusterTest.json.
After every test iteration, the partition data would also be archived in setup/test_logs if set to true.
It defaults to false and can be enabled if required.

Change-Id: Iaeddea30e6a6ad8dacce134228959e2b4ded4ef1
diff --git a/src/test/utils/CordLogger.py b/src/test/utils/CordLogger.py
index 1efe086..54d8b11 100644
--- a/src/test/utils/CordLogger.py
+++ b/src/test/utils/CordLogger.py
@@ -84,7 +84,7 @@
         except: pass
 
     @classmethod
-    def archive_results(cls, testName, controllers = None, iteration = None):
+    def archive_results(cls, testName, controllers = None, iteration = None, archive_partition = False):
         if not os.path.exists(cls.onos_data_dir):
             return cls.archive_results_unshared(testName, controllers = controllers, iteration = iteration)
         if not os.path.exists(cls.archive_dir):
@@ -96,11 +96,18 @@
             controller_map = get_controller_map(controllers)
 
         iteration_str = '' if iteration is None else '_{}'.format(iteration)
+        if archive_partition is False:
+            archive_target = 'log'
+            tar_options = ''
+        else:
+            archive_target = ''
+            tar_options = '--exclude=cache --exclude=tmp'
+
         for c in controller_map.keys():
             archive_file = os.path.join(cls.archive_dir,
                                         'logs_{}_{}{}.tar.gz'.format(controller_map[c], testName, iteration_str))
-            archive_path = os.path.join(cls.setup_dir, '{}-data'.format(c), 'log')
-            cmd = 'cd {} && tar cvzf {} .'.format(archive_path, archive_file)
+            archive_path = os.path.join(cls.setup_dir, '{}-data'.format(c), archive_target)
+            cmd = 'cd {} && tar cvzf {} . {}'.format(archive_path, archive_file, tar_options)
             try:
                 os.system(cmd)
             except: pass