[ONOS-6901] Fix how the systemTest does not return any result when it forced to quit the test

Change-Id: If93c48d46e8dc2494046b42de21f732775d7f520
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index 0de4a84..bbed3ec 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -62,7 +62,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
 
         try:
@@ -100,8 +100,7 @@
         if not main.onoscell :
             main.log.error("Please provide onoscell option at TestON CLI to run CHO tests")
             main.log.error("Example: ~/TestON/bin/cli.py run CHOTestMonkey onoscell <cellName>")
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         setupResult = main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
                                                 newCell=False, cellName=main.onoscell )
@@ -304,8 +303,7 @@
 
         if not caseResult:
             main.log.info( "Topology does not match, exiting test..." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE3( self, main ):
         """
@@ -346,8 +344,7 @@
                                  onfail="Host discovery FAIL" )
         if not stepResult:
             main.log.debug( hosts )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Disable Reactive forwarding" )
         appResult = main.controllers[ 0 ].CLI.deactivateApp( "org.onosproject.fwd" )
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
index a401bb2..f89e57d 100644
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -65,7 +65,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             main.cellName = main.params['ENV']['cellName']
@@ -90,8 +90,7 @@
                                      onfail="Something is wrong with app Ids" )
         if cliResults == main.FALSE:
             main.log.error( "Failed to start ONOS,stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE2( self, main ):
         """
@@ -110,8 +109,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         bgplsConfig = BgpLs()
         Ne_id = bgplsConfig.Constants()
@@ -209,8 +207,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         bgplsConfig = BgpLs()
         Ne_id = bgplsConfig.Constants()
@@ -303,8 +300,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         bgplsConfig = BgpLs()
         app = bgplsConfig.apps()
@@ -375,8 +371,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         bgplsConfig = BgpLs()
         app = bgplsConfig.apps()
@@ -448,8 +443,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         bgplsConfig = BgpLs()
         app = bgplsConfig.apps()
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.py b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
index 0b02465..9b504ba 100644
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
@@ -31,7 +31,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "SetUp not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -72,7 +72,7 @@
             except ImportError as e:
                 print e
                 main.log.error("CheckingFlow not found exiting the test")
-                main.exit()
+                main.cleanAndExit()
             copyResult = main.ONOSbench.scp( main.Mininet1,
                                              main.dependencyPath + main.topology,
                                              main.Mininet1.home + '/custom/',
@@ -117,7 +117,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -619,8 +619,7 @@
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -1028,8 +1027,7 @@
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py b/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
index 0269f7e..4209947 100644
--- a/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
@@ -22,8 +22,7 @@
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
index 3e59ab7..de50155 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
@@ -41,7 +41,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
@@ -125,7 +125,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py b/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py
index b143fdb..7b8ded6 100644
--- a/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py
+++ b/TestON/tests/FUNC/FUNCgroup/dependencies/group-bucket.py
@@ -48,5 +48,4 @@
         return None
     except Exception:
         main.log.exception( self.name + ": Uncaught exception!" )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 9de5740..2b85fc2 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -45,7 +45,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
@@ -123,7 +123,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -387,7 +387,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -417,8 +417,7 @@
         mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not ( mininetResult and scapyResult ):
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE19( self, main ):
         """
@@ -428,7 +427,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 7418965..6299ac2 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -1936,7 +1936,7 @@
         from tests.dependencies.topology import Topology
     except Exception:
         main.log.error( "Topology not found exiting the test" )
-        main.exit()
+        main.cleanAndExit()
     try:
         main.topoRelated
     except Exception:
@@ -2279,8 +2279,8 @@
         return main.FALSE
     except Exception:
         main.log.exception( "checkLeaderChange: Uncaught exception!" )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
+
     main.log.info( "Checking Intent Paritions for Change in Leadership" )
     mismatch = False
     for dict1 in leaders1:
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index 03ab601..0f3fcf9 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -48,12 +48,13 @@
             - Install ONOS package
             - Build ONOS package
         """
+        main.cleanAndExit()
         try:
             from tests.dependencies.ONOSSetup import ONOSSetup
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
@@ -121,7 +122,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -401,7 +402,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -432,8 +433,7 @@
         mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not ( mininetResult and scapyResult ):
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE19( self, main ):
         """
@@ -443,7 +443,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 5f29037..f4743ee 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -1514,7 +1514,7 @@
         from tests.dependencies.topology import Topology
     except Exception:
         main.log.error( "Topology not found exiting the test" )
-        main.exit()
+        main.cleanAndExit()
     try:
         main.topoRelated
     except ( NameError, AttributeError ):
@@ -1697,8 +1697,7 @@
         return main.FALSE
     except Exception:
         main.log.exception( self.name + ": Uncaught exception!" )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
     main.log.info( "Checking Intent Paritions for Change in Leadership" )
     mismatch = False
     for dict1 in leaders1:
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
index 1f4d05d..912db21 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
@@ -44,7 +44,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         # Test variables
@@ -112,8 +112,8 @@
                                  onpass="ONOS summary command succeded",
                                  onfail="ONOS summary command failed" )
         if not ready:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
+            main.cleanAndExit()
 
         main.step( "setup the ipv6NeighbourDiscovery" )
         cfgResult1 = main.Cluster.active( 0 ).CLI.setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
@@ -148,8 +148,8 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
+            main.cleanAndExit()
 
     def CASE12( self, main ):
         """
@@ -177,8 +177,8 @@
                                                          ip=tempONOSip,
                                                          port='6633' )
         if not assignResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
+            main.cleanAndExit()
 
         for i in range( 1, ( main.numSwitch + 1 ) ):
             response = main.Mininet1.getSwController( "s" + str( i ) )
@@ -231,7 +231,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -240,8 +240,8 @@
         topoResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
+            main.cleanAndExit()
 
     def CASE1000( self, main ):
         """
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
index 6bd4c6c..d4594aa 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
@@ -2008,8 +2008,8 @@
         return main.FALSE
     except Exception:
         main.log.exception( self.name + ": Uncaught exception!" )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
+
     main.log.info( "Checking Intent Paritions for Change in Leadership" )
     mismatch = False
     for dict1 in leaders1:
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
index 2b44494..ef5eb99 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
@@ -42,7 +42,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
@@ -95,7 +95,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -136,8 +136,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE11( self, main ):
         """
@@ -163,8 +162,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         tempONOSip = main.Cluster.getIps()
 
@@ -173,8 +171,7 @@
                                                          ip=tempONOSip,
                                                          port='6653' )
         if not assignResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         assignResult = main.TRUE
         for sw in swList:
@@ -201,7 +198,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -210,8 +207,7 @@
         topoResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE20( self, main ):
         """
@@ -236,8 +232,7 @@
                 s1Json = json.load( s1Jsondata )
         except IOError:
             main.log.exception( "s1Json File not found." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.log.info( "s1Json:" + str( s1Json ) )
 
         main.s1Json = s1Json
@@ -281,8 +276,7 @@
                 s3Json = json.load( s3Jsondata )
         except IOError:
             main.log.exception( "s3Json File not found" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.log.info( "s3Json:" + str( s3Json ) )
 
         main.s3Json = s3Json
@@ -329,8 +323,7 @@
             assert main.s1Json, "s1Json not defined"
         except AssertionError:
             main.log.exception( "Case Prerequisites not set: " )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.case( "Check Devices After they initially connect to ONOS" )
 
         main.netCfg.compareCfg( main )
@@ -395,8 +388,7 @@
                 s2Json = json.load( s2Jsondata )
         except IOError:
             main.log.exception( "s2Json File not found" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.log.info( "s2Json:" + str( s2Json ) )
         main.s2Json = s2Json
         setS2Allow = main.Cluster.active( 1 ).REST.setNetCfg( s2Json,
@@ -436,8 +428,7 @@
                 s4Json = json.load( s4Jsondata )
         except IOError:
             main.log.exception( "s4Json File not found" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.log.info( "s4Json:" + str( s4Json ) )
         main.s4Json = s4Json
         setS4Disallow = main.Cluster.active( 2 ).REST.setNetCfg( s4Json,
@@ -485,8 +476,7 @@
             assert main.s2Json, "s2Json not defined"
         except AssertionError:
             main.log.exception( "Case Prerequisites not set: " )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.case( "Check Devices after all configurations are set" )
 
         main.netCfg.compareCfg( main )
@@ -535,8 +525,7 @@
             assert main.s4Json, "s4Json not defined"
         except AssertionError:
             main.log.exception( "Case Prerequisites not set: " )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.case( "Testing removal of configurations" )
         main.step( "Remove 'allowed' configuration from all devices" )
 
@@ -684,8 +673,7 @@
                 main.s5Json = json.load( s5Jsondata )
         except IOError:
             main.log.exception( "s5Json File not found" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.log.info( "s5Json:" + str( main.s5Json ) )
 
         try:
@@ -693,8 +681,7 @@
                 main.s6Json = json.load( s6Jsondata )
         except IOError:
             main.log.exception( "s6Json File not found" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.log.info( "s6Json:" + str( main.s6Json ) )
 
         s5Json = main.s5Json
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index 798c800..d518c5a 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -45,7 +45,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
@@ -117,7 +117,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
index bed1670..ce8620a 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
@@ -64,9 +64,7 @@
     except pexpect.ExceptionPexpect as e:
         main.log.exception( self.name + ": Pexpect exception found: " )
         main.log.error( self.name + ":    " + self.handle.before )
-        main.cleanup()
-        main.exit()
-
+        main.cleanAndExit()
 
 def createConfig( main ):
     """
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
index 12b3c8c..00d5cab 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
@@ -45,7 +45,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         # Test variables
@@ -101,8 +101,7 @@
                                                    fileName="TopoDDriver.json")
         #Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.caseExplanation = "Start opticalTest.py topology included with ONOS"
         main.step( "Starting mininet and LINC-OE" )
@@ -127,7 +126,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -136,8 +135,7 @@
         topoResult = main.Utils.mininetCleanup( main.LincOE, timeout=180 )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE16( self, main ):
         """
@@ -186,7 +184,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -241,7 +239,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
index f16adb8..ad55a9a 100644
--- a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
+++ b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
@@ -63,7 +63,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
@@ -85,8 +85,7 @@
 
         if cliResults == main.FALSE:
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "App Ids check" )
         appCheck = main.Cluster.active( 0 ).CLI.appToIDCheck()
@@ -426,8 +425,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "Configure Network Subnet Port Start" )
         main.case( "Configure Network Subnet Port" )
diff --git a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
index 7893972..5d471ad 100644
--- a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
@@ -74,7 +74,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -92,8 +92,7 @@
                                                cellName=cellName, removeLog=True )
         if cliResults == main.FALSE:
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "App Ids check" )
         appCheck = main.Cluster.active( 0 ).CLI.appToIDCheck()
@@ -123,8 +122,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Network Post test Start" )
         main.case( "Virtual Network NBI Test - Network" )
@@ -196,8 +194,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Network Update test Start" )
         main.case( "Virtual Network NBI Test - Network" )
@@ -282,8 +279,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Network Delete test Start" )
         main.case( "Virtual Network NBI Test - Network" )
@@ -342,8 +338,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Subnet Post test Start" )
         main.case( "Virtual Network NBI Test - Subnet" )
@@ -430,8 +425,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Subnet Update test Start" )
         main.case( "Virtual Network NBI Test - Subnet" )
@@ -535,8 +529,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Subnet Delete test Start" )
         main.case( "Virtual Network NBI Test - Subnet" )
@@ -611,8 +604,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Port Post test Start" )
         main.case( "Virtual Network NBI Test - Port" )
@@ -718,8 +710,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Port Update test Start" )
         main.case( "Virtual Network NBI Test - Port" )
@@ -840,8 +831,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Port Delete test Start" )
         main.case( "Virtual Network NBI Test - Port" )
@@ -938,8 +928,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Post Error Json Create Network test Start" )
         main.case( "Virtual Network NBI Test - Network" )
@@ -984,8 +973,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Post Error Json Create Subnet test Start" )
         main.case( "Virtual Network NBI Test - Subnet" )
@@ -1043,8 +1031,7 @@
         except ImportError:
             main.log.exception( "Something wrong with import file or code error." )
             main.log.info( "Import Error, please check!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.log.info( "ONOS Post Error Json Create Subnet test Start" )
         main.case( "Virtual Network NBI Test - Port" )
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index da20e97..08e437b 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -80,7 +80,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -174,8 +174,7 @@
                                  onpass="ONOS summary command succeded",
                                  onfail="ONOS summary command failed" )
         if not ready:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         # Grab the time of restart so we chan check how long the gossip
         # protocol has had time to work
diff --git a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
index 1f9f32d..026be2d 100644
--- a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
+++ b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
@@ -82,7 +82,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -189,8 +189,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.killCount += 1
 
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index 475759f..c3a2038 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -82,7 +82,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -176,12 +176,10 @@
                     except pexpect.EOF:
                         main.log.error( self.name + ": EOF exception found" )
                         main.log.error( self.name + ":    " + self.handle.before )
-                        main.cleanup()
-                        main.exit()
+                        main.cleanAndExit()
                     except Exception:
                         main.log.exception( self.name + ": Uncaught exception!" )
-                        main.cleanup()
-                        main.exit()
+                        main.cleanAndExit()
             else:
                 for j in range( 0, n ):
                     if j not in main.partition:
@@ -196,12 +194,10 @@
                         except pexpect.EOF:
                             main.log.error( self.name + ": EOF exception found" )
                             main.log.error( self.name + ":    " + self.handle.before )
-                            main.cleanup()
-                            main.exit()
+                            main.cleanAndExit()
                         except Exception:
                             main.log.exception( self.name + ": Uncaught exception!" )
-                            main.cleanup()
-                            main.exit()
+                            main.cleanAndExit()
                 main.Cluster.runningNodes[ i ].active = False
             iCtrl.Bench.exitFromSsh( this, iCtrl.ipAddress )
         # NOTE: When dynamic clustering is finished, we need to start checking
@@ -247,8 +243,7 @@
                    "List of active nodes has duplicates, this likely indicates something was run out of order"
         except AssertionError:
             main.log.exception( "" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         '''
 
         main.step( "Checking ONOS nodes" )
@@ -268,8 +263,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE7( self, main ):
         """
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index e81dda9..63e34cb 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -77,7 +77,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -177,8 +177,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE62( self, main ):
         """
diff --git a/TestON/tests/HA/HAsanity/HAsanity.py b/TestON/tests/HA/HAsanity/HAsanity.py
index 8332a2b..82eeac5 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.py
+++ b/TestON/tests/HA/HAsanity/HAsanity.py
@@ -76,7 +76,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index 6a0abd4..cecd09e 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -80,7 +80,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
 
         main.testSetUp.envSetupDescription()
         try:
@@ -184,8 +184,7 @@
                                      onfail="Failled to generate new metadata file" )
             time.sleep( 5 )  # Give time for nodes to read new file
         except IndexError:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         activeNodes = [ i for i in range( 0, main.Cluster.numCtrls ) ]
         newNodes = [ x for x in activeNodes if x not in prevNodes ]
@@ -226,8 +225,7 @@
                                  onpass="ONOS summary command succeded",
                                  onfail="ONOS summary command failed" )
         if not ready:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         # Rerun for election on new nodes
         runResults = main.TRUE
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index f8d5a49..13a4913 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -85,7 +85,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -779,8 +779,7 @@
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
 
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE9( self, main ):
         """
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index 8e6bd6f..2c4f059 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -77,7 +77,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -174,8 +174,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE62( self, main ):
         """
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index 923f67c..2de9f87 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -80,7 +80,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             from tests.HA.dependencies.HA import HA
@@ -219,8 +219,7 @@
                                  onpass="ONOS summary command succeded",
                                  onfail="ONOS summary command failed" )
         if not ready:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         # Rerun for election on new nodes
         runResults = main.TRUE
diff --git a/TestON/tests/HA/dependencies/HA.py b/TestON/tests/HA/dependencies/HA.py
index 11bc039..4a22dc4 100644
--- a/TestON/tests/HA/dependencies/HA.py
+++ b/TestON/tests/HA/dependencies/HA.py
@@ -52,8 +52,7 @@
         except ( pexpect.TIMEOUT, pexpect.EOF ):
             main.log.exception( "ONOSbench: pexpect exception found:" +
                                 main.ONOSbench.handle.before )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def startingMininet( self ):
         main.step( "Starting Mininet" )
@@ -214,8 +213,7 @@
             return ( onosCounters, consistent )
         except Exception:
             main.log.exception( "" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def counterCheck( self, counterName, counterValue ):
         """
@@ -248,8 +246,7 @@
             return consistent and correctResults
         except Exception:
             main.log.exception( "" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def consistentLeaderboards( self, nodes ):
         TOPIC = 'org.onosproject.election'
@@ -359,8 +356,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Activate apps defined in the params file" )
         # get data from the params
@@ -640,8 +636,7 @@
         main.log.info( "Time for pingall: %2f seconds" %
                        ( time2 - time1 ) )
         if not pingResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         # timeout for fwd flows
         time.sleep( 11 )
         # uninstall onos-app-fwd
@@ -1063,8 +1058,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -2770,8 +2764,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         self.commonChecks()
 
@@ -2838,8 +2831,7 @@
                                     "ONOSMastership[0] or mastershipState" )
                 main.log.debug( "ONOSMastership[0]: " + repr( ONOSMastership[ 0 ] ) )
                 main.log.debug( "mastershipState" + repr( mastershipState ) )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             mastershipCheck = main.TRUE
             for i in range( 1, 29 ):
                 switchDPID = str(
@@ -3042,8 +3034,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -3388,8 +3379,7 @@
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
 
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def linkDown( self, main, fromS="s3", toS="s28" ):
         """
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index da99bd2..c27bd47 100644
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -45,7 +45,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -272,8 +272,7 @@
         tLastPostEnd = time.time()
         if main.postFailed:
             main.log.error( "Flow batch posting failed, exit test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check to ensure all flows are in added state." )
         #pprint( main.addedBatchList )
diff --git a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
index f61c305..a64ad3a 100755
--- a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
+++ b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
@@ -106,12 +106,10 @@
                                     onfail = "docker is not running")
         if stepResult == main.FALSE:
             main.log.warn("docker is not running - exiting test")
-            main.exit()
-            main.cleanup()
+            main.cleanAndExit()
         if imageTagCounter > len( imageTagList ):
             main.log.info("All images have been tested")
-            main.exit()
-            main.cleanup()
+            main.cleanAndExit()
 
     def CASE5(self, main):
         """
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 79c1c18..7da7e54 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -39,7 +39,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -56,7 +56,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -103,7 +103,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -173,8 +173,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Assign switches to controllers.")
         assignResult = main.TRUE
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index a276634..553fa8e 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -39,7 +39,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -58,7 +58,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -103,7 +103,7 @@
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.testSetUp
         except ( NameError, AttributeError ):
@@ -176,8 +176,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Assign switches to controllers.")
         assignResult = main.TRUE
diff --git a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
index d87bc7e..0bafefb 100644
--- a/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPF/SCPFcbench/SCPFcbench.py
@@ -35,7 +35,7 @@
                 main.testSetUp = ONOSSetup()
             except ImportError:
                 main.log.error( "ONOSSetup not found. exiting the test" )
-                main.exit()
+                main.cleanAndExit()
             main.testSetUp.envSetupDescription()
             stepResult = main.FALSE
             try:
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index bfc0301..4244d79 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -41,7 +41,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error("ONOSSetup not found. exiting the test")
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         try:
             #Load values from params file
diff --git a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
index fb6dec8..4298c3d 100644
--- a/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
+++ b/TestON/tests/SCPF/SCPFhostLat/SCPFhostLat.py
@@ -44,7 +44,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -167,7 +167,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index a781698..97f6039 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -50,7 +50,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index f58e715..78a2b34 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -49,7 +49,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index df3bfc7..285e12d 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -57,7 +57,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
index f5edd3e..0c18564 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
@@ -48,7 +48,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -118,7 +118,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 71758f6..0ecee0b 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -44,7 +44,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -137,7 +137,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
@@ -197,7 +197,7 @@
             from tests.dependencies.topology import Topology
         except ImportError:
             main.log.error( "Topology not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.topoRelated
         except ( NameError, AttributeError ):
@@ -280,8 +280,7 @@
             main.log.info( "Finished this iteration, continue to scale next topology." )
         else:
             main.log.info( "Clean up and exit TestON. Finished this test." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE100( self, main ):
         '''
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
index 6f2647d..ae30723 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
@@ -247,7 +247,7 @@
         from tests.dependencies.topology import Topology
     except ImportError:
         main.log.error( "Topology not found exiting the test" )
-        main.exit()
+        main.cleanAndExit()
     try:
         main.topoRelated
     except ( NameError, AttributeError ):
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index 6eb1c00..9ee512c 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -47,7 +47,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -284,7 +284,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 66aa0bf..66b3dc0 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -51,7 +51,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -105,7 +105,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Utils
         except ( NameError, AttributeError ):
diff --git a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
index b81a674..cde275e 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
@@ -139,8 +139,7 @@
     # if there are too many wrongs in this test, then exit
     if main.wrong['totalWrong'] > main.maxWrong:
         main.log.error( "The total wrong number exceeds %d, test terminated" % main.maxWrong )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
 def captureOfPack( main, deviceName, ofPack, switchStatus, resultDict, warmup ):
     '''
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 9c73c0c..d83585a 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -47,7 +47,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
@@ -146,8 +146,7 @@
             main.pingChart = json.load( chart )
         if not ready:
             main.log.error( "ONOS startup failed!" )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
         for ctrl in main.Cluster.active():
             ctrl.CLI.logSet( "DEBUG", "org.onosproject.segmentrouting" )
@@ -169,8 +168,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
     @staticmethod
     def config( main, cfgName ):
@@ -213,8 +211,7 @@
 
         else :
             main.log.error( "Configuration failed!" )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
     @staticmethod
     def checkFlows( main, minFlowCount, dumpflows=True ):
@@ -396,7 +393,7 @@
             from tests.dependencies.utils import Utils
         except ImportError:
             main.log.error( "Utils not found exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.utils
         except ( NameError, AttributeError ):
@@ -444,8 +441,7 @@
                         ctrl.name,
                         ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
                 main.log.error( "Failed to kill ONOS, stopping test" )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
             topology = utilities.retry( main.Cluster.active( 0 ).checkStatus,
                                         main.FALSE,
@@ -502,8 +498,7 @@
                     ctrl.name,
                     ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         topology = utilities.retry( main.Cluster.active( 0 ).CLI.checkStatus,
                                     main.FALSE,
@@ -526,8 +521,7 @@
                                  onfail="ONOS summary command failed" )
         if not ready:
             main.log.error( "ONOS startup failed!" )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
     @staticmethod
     def addHostCfg( main ):
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index 48b0a66..93f0735 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -45,8 +45,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.step( "Connect switches to controller" )
 
         # connect all switches to controller
@@ -60,8 +59,7 @@
                                  onpass="Successfully connect all switches to ONOS",
                                  onfail="Failed to connect all switches to ONOS" )
         if not swResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Set up tunnel from Mininet node to onos node" )
         forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', main.Cluster.active( 0 ).ipAddress )
@@ -76,8 +74,7 @@
                                  onpass="Created tunnel succeeded",
                                  onfail="Create tunnel failed" )
         if ("PasswordAuthentication" not in tunnelResult) :
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE101( self, main ):
         """
@@ -95,7 +92,7 @@
             from tests.USECASE.dependencies.sdnipBaseFunction import SdnBase
         except ImportError:
             main.log.error( "sdnBase not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.sdnBase
         except ( NameError, AttributeError ):
@@ -121,8 +118,7 @@
             time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
             listResult = main.Cluster.active( 0 ).CLI.links( jsonFormat=False )
             main.log.info( listResult )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Activate sdn-ip application" )
         activeSDNIPresult = main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.sdnip" )
@@ -132,8 +128,7 @@
                                  onfail="Activate SDN-IP failed" )
         if not activeSDNIPresult:
             main.log.info( "Activate SDN-IP failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
 
         main.log.info( "Wait SDN-IP to finish installing connectivity intents \
@@ -260,8 +255,7 @@
             main.Functions.checkP2PintentNum( main, 36 ) #6 intents from sw to speakers x 6 intents to sw x 2 intents between them
         else:
             main.log.error( "Stopping switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check ping between hosts behind BGP peers" )
         result1 = main.Mininet.pingHost( src="h64514", target="h64515" )
@@ -275,8 +269,7 @@
                                  onfail="Ping test result is wrong" )
 
         if pingResult1 == False:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check ping between BGP peers and speakers" )
         result4 = main.Mininet.pingHost( src="spk1", target="p64514" )
@@ -290,8 +283,7 @@
                                  onfail="Speaker1 ping peers NOT successful" )
 
         if pingResult2 == False:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -334,8 +326,7 @@
             main.Functions.checkP2PintentNum( main, 42 )
         else:
             main.log.error( "Starting switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -386,8 +377,7 @@
             main.Functions.checkP2PintentNum( main, 42 )
         else:
             main.log.error( "Stopping switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -442,8 +432,7 @@
             main.log.debug( main.Mininet.checkFlows( "sw7" ) )
         else:
             main.log.error( "Starting switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py
index 85b732d..a284213 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/dependencies/Functions.py
@@ -121,12 +121,10 @@
     """
     if len( speakers ) == 0:
         main.log.error( "Parameter speakers can not be empty." )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
     if len( peers ) == 0:
         main.log.error( "Parameter speakers can not be empty." )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
     if expectAllSuccess:
         main.step( "BGP speakers ping peers, expect all tests to succeed" )
@@ -151,8 +149,7 @@
                              onfail = "Ping test results are Not expected" )
 
     if result == False:
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
 
 def pingHostToHost( main,
@@ -169,8 +166,7 @@
                str( expectAllSuccess ) )
     if len( hosts ) == 0:
         main.log.error( "Parameter hosts can not be empty." )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
     result = True
     if expectAllSuccess:
@@ -194,7 +190,6 @@
 
     '''
     if result == False:
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
     '''
 
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
index 63940cb..d058a85 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -45,8 +45,7 @@
                                  onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         main.step( "Connect switches to controllers" )
 
         # connect all switches to controllers
@@ -60,8 +59,7 @@
                                  onpass="Successfully connect all switches to ONOS",
                                  onfail="Failed to connect all switches to ONOS" )
         if not swResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
 
     def CASE101( self, main ):
@@ -89,7 +87,7 @@
             from tests.USECASE.dependencies.sdnipBaseFunction import SdnBase
         except ImportError:
             main.log.error( "sdnBase not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.sdnBase
         except ( NameError, AttributeError ):
@@ -117,8 +115,7 @@
                                  onpass="ONOS correctly discovered all links",
                                  onfail="ONOS Failed to discover all links" )
         if linkNum < 100:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Activate sdn-ip application" )
         activeSDNIPresult = main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.sdnip" )
@@ -128,8 +125,7 @@
                                  onfail="Activate SDN-IP failed" )
         if not activeSDNIPresult:
             main.log.info( "Activate SDN-IP failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def CASE102( self, main ):
         '''
@@ -259,8 +255,7 @@
             main.Functions.checkP2PintentNum( main, 48 ) #14 * 2
         else:
             main.log.error( "Stopping switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check ping between hosts behind BGP peers" )
         result1 = main.Mininet.pingHost( src="h64514", target="h64515" )
@@ -274,8 +269,7 @@
                                  onfail="Ping test result is wrong" )
 
         if pingResult1 == False:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check ping between BGP peers and spk1" )
         result4 = main.Mininet.pingHost( src="spk1", target="p64514" )
@@ -289,8 +283,7 @@
                                  onfail="Speaker1 ping peers NOT successful" )
 
         if pingResult2 == False:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check ping between BGP peers and spk2" )
         # TODO
@@ -305,8 +298,7 @@
                                  onfail="Speaker2 ping peers NOT successful" )
 
         if pingResult3 == False:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -345,8 +337,7 @@
             main.Functions.checkP2PintentNum( main, 30 * 2 ) # 18*2
         else:
             main.log.error( "Starting switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -400,8 +391,7 @@
             main.Functions.checkP2PintentNum( main, 30 * 2 ) #18 * 2
         else:
             main.log.error( "Stopping switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -458,8 +448,7 @@
             main.log.debug( main.Mininet.checkFlows( "sw7" ) )
         else:
             main.log.error( "Starting switch failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
@@ -532,8 +521,7 @@
                                  onfail="Kill spk1 failed" )
         if ( "4" not in result3 ) :
             main.log.info( result3 )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
         main.Functions.checkRouteNum( main, 7 )
@@ -588,8 +576,7 @@
                                  onpass="Uninstall ONOS leader succeeded",
                                  onfail="Uninstall ONOS leader failed" )
         if uninstallResult != main.TRUE:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
 
         if leaderIP == main.Cluster.active( 0 ).ipAddress:
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py
index 3a042a5..36f1eb4 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/dependencies/Functions.py
@@ -115,12 +115,10 @@
     """
     if len( speakers ) == 0:
         main.log.error( "Parameter speakers can not be empty." )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
     if len( peers ) == 0:
         main.log.error( "Parameter speakers can not be empty." )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
     if expectAllSuccess:
         main.step( "BGP speakers ping peers, expect all tests to succeed" )
@@ -145,8 +143,7 @@
                              onfail = "Ping test results are Not expected" )
 
     if result == False:
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
 
 def pingHostToHost( main, hosts = ["h64514", "h64515", "h64516"],
@@ -162,8 +159,7 @@
                str( expectAllSuccess ) )
     if len( hosts ) == 0:
         main.log.error( "Parameter hosts can not be empty." )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
     result = True
     if expectAllSuccess:
@@ -187,8 +183,7 @@
 
     '''
     if result == False:
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
     '''
 
 
@@ -211,6 +206,5 @@
                              onpass = "Created tunnel succeeded",
                              onfail = "Create tunnel failed" )
     if ( "PasswordAuthentication" not in tunnelResult ) :
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
index 0b8c85d..d0f4ed7 100644
--- a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
@@ -56,7 +56,7 @@
             main.testSetUp = ONOSSetup()
         except ImportError:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
diff --git a/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py b/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py
index e51318c..1d913cc 100644
--- a/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py
+++ b/TestON/tests/USECASE/dependencies/sdnipBaseFunction.py
@@ -11,7 +11,7 @@
             main.testSetUp = ONOSSetup()
         except Exception:
             main.log.error( "ONOSSetup not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         main.testSetUp.envSetupDescription()
         main.testSetUp.envSetup()
         main.apps = main.params[ 'ENV' ][ 'appString' ]
@@ -41,8 +41,7 @@
 
         if not ready:
             main.log.error( "ONOS startup failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def pToPIntentTest( self, intentExpectedNum ):
         '''
@@ -155,8 +154,7 @@
             main.Functions.checkM2SintentNum( main, link1IntentNum )
         else:
             main.log.error( "Bring " + upOrDown + " link failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Bring " + upOrDown + " the link between sw8 and " + link2Peer )
         linkResult2 = main.Mininet.link( END1="sw8", END2=link2Peer,
@@ -171,8 +169,7 @@
             main.Functions.checkM2SintentNum( main, link2IntentNum )
         else:
             main.log.error( "Bring " + upOrDown + " link failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Bring " + upOrDown + " the link between sw28 and "+ link3Peer )
         linkResult3 = main.Mininet.link( END1="sw28", END2=link3Peer,
@@ -187,8 +184,7 @@
             main.Functions.checkM2SintentNum( main, link3IntentNum )
         else:
             main.log.error( "Bring " + upOrDown + " link failed!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
         main.step( "Check whether all flow status are ADDED" )
         flowCheck = utilities.retry( main.Cluster.active( 0 ).CLI.checkFlowsState,
diff --git a/TestON/tests/dependencies/Cluster.py b/TestON/tests/dependencies/Cluster.py
index 6b18b8b..36811ba 100644
--- a/TestON/tests/dependencies/Cluster.py
+++ b/TestON/tests/dependencies/Cluster.py
@@ -405,8 +405,7 @@
                              getattr( ctrl, drivers[ specificDriver ] ) ), function )
             except AttributeError:
                 main.log.error( "Function " + function + " not found. Exiting the Test." )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
             t = main.Thread( target=f,
                              name=function + "-" + ctrl.name,
diff --git a/TestON/tests/dependencies/ONOSSetup.py b/TestON/tests/dependencies/ONOSSetup.py
index ddf0570..81a1b25 100644
--- a/TestON/tests/dependencies/ONOSSetup.py
+++ b/TestON/tests/dependencies/ONOSSetup.py
@@ -38,7 +38,7 @@
             from tests.dependencies.Cluster import Cluster
         except ImportError:
             main.log.error( "Cluster not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Cluster
         except ( NameError, AttributeError ):
@@ -60,7 +60,7 @@
                                      actual=stepResult,
                                      onpass="Successfully checkout onos branch.",
                                      onfail="Failed to checkout onos branch. Exiting test..." )
-            if not stepResult: main.exit()
+            if not stepResult: main.cleanAndExit()
 
             main.step( "Git Pull on ONOS branch:" + gitBranch )
             stepResult = main.ONOSbench.gitPull()
@@ -68,7 +68,7 @@
                                      actual=stepResult,
                                      onpass="Successfully pull onos. ",
                                      onfail="Failed to pull onos. Exiting test ..." )
-            if not stepResult: main.exit()
+            if not stepResult: main.cleanAndExit()
 
         else:
             main.log.info( "Skipped git checkout and pull as they are disabled in params file" )
@@ -89,7 +89,7 @@
             from tests.dependencies.Cluster import Cluster
         except ImportError:
             main.log.error( "Cluster not found. exiting the test" )
-            main.exit()
+            main.cleanAndExit()
         try:
             main.Cluster
         except ( NameError, AttributeError ):
@@ -107,8 +107,7 @@
             * includeGitPull - exceeption code e.
         """
         main.log.exception( e )
-        main.cleanup()
-        main.exit()
+        main.cleanAndExit()
 
     def evnSetupConclusion( self, stepResult ):
         """
@@ -242,8 +241,7 @@
                                  onpass="Successfully installed ONOS package",
                                  onfail="Failed to install ONOS package" )
         if not onosInstallResult:
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         return onosInstallResult
 
     def setupSsh( self, cluster ):
@@ -295,8 +293,7 @@
         startCliResult = cluster.startCLIs()
         if not startCliResult:
             main.log.info( "ONOS CLI did not start up properly" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         else:
             main.log.info( "Successful CLI startup" )
         utilities.assert_equals( expect=main.TRUE,