[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/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index ab6a7bc..d5e114a 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -135,12 +135,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def setInterfaceUp( self, intfs ):
         """
@@ -159,12 +157,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def startSwitch( self, swId ):
         """
@@ -179,12 +175,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def stopSwitch( self, swId ):
         """
@@ -199,12 +193,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def getDatapathId( self, swId ):
         """
@@ -220,12 +212,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def attachLincOESession( self ):
         """
@@ -260,12 +250,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def portUp( self, swId, ptId ):
         """
@@ -281,12 +269,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def portDown( self, swId, ptId ):
         """
@@ -302,12 +288,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
     def stopLincOEConsole( self ):
         """
@@ -351,12 +335,10 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception" )
             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()
 
 if __name__ != "__main__":
     import sys
diff --git a/TestON/drivers/common/cli/emulator/lincoemininetdriver.py b/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
index 2b3b721..bfa466f 100644
--- a/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
@@ -86,7 +86,7 @@
             return main.FALSE
         except Exception:
             main.log.exception(self.name + ": Uncaught exception!")
-            main.cleanup()
+            main.cleanAndExit()
             return main.FALSE
 
     def pingHostOptical( self, **pingParams ):
@@ -118,12 +118,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.log.info( self.name + ": Ping Response: " + response )
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": no packets lost, host is reachable" )
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 7645921..531e5ca 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -116,12 +116,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()
 
     def startNet( self, topoFile='', args='', mnCmd='', timeout=120 ):
         """
@@ -248,12 +246,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()
 
     def numSwitchesNlinks( self, topoType, depth, fanout ):
         try:
@@ -293,8 +289,7 @@
             return topoDict
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def calculateSwAndLinks( self ):
         """
@@ -310,8 +305,7 @@
             return topoDict
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def pingall( self, protocol="IPv4", timeout=300, shortCircuit=False, acceptableFailed=0 ):
         """
@@ -374,8 +368,7 @@
                                         ": EOF exception found" )
                         main.log.error( self.name + ":     " +
                                         self.handle.before )
-                        main.cleanup()
-                        main.exit()
+                        main.cleanAndExit()
                     elif i == 3:
                         response += self.handle.before
                         main.log.error( self.name +
@@ -402,8 +395,7 @@
                     return main.FALSE
             else:
                 main.log.error( self.name + ": Connection failed to the host" )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
         except pexpect.TIMEOUT:
             if response:
                 main.log.info( "Pingall output: " + str( response ) )
@@ -412,8 +404,7 @@
         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()
 
     def fpingHost( self, **pingParams ):
         """
@@ -439,8 +430,7 @@
             return main.FALSE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
 
     def pingallHosts( self, hostList, wait=1 ):
@@ -494,12 +484,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()
 
     def pingIpv6Hosts( self, hostList, prefix='1000::', wait=1 ):
         """
@@ -548,12 +536,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()
 
     def pingHost( self, **pingParams ):
         """
@@ -593,12 +579,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()
 
     def ping6pair( self, **pingParams ):
         """
@@ -642,12 +626,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()
 
     def pingHostSetAlternative( self, dstIPList, wait=1, IPv6=False ):
         """
@@ -681,8 +663,7 @@
                         isReachable = main.FALSE
                 elif i == 1:
                     main.log.error( self.name + ": function should be called from host CLI instead of Mininet CLI" )
-                    main.cleanup()
-                    main.exit()
+                    main.cleanAndExit()
                 elif i == 2:
                     main.log.error( self.name + ": timeout when waiting for response" )
                     isReachable = main.FALSE
@@ -695,12 +676,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()
         return isReachable
 
     def checkIP( self, host ):
@@ -717,8 +696,7 @@
                 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()
 
                 pattern = "inet\s(addr|Mask):([0-1]{1}[0-9]{1,2}|" +\
                     "2[0-4][0-9]|25[0-5]|[0-9]{1,2}).([0-1]{1}" +\
@@ -737,8 +715,7 @@
                 main.log.error( self.name + ": Connection failed to the host" )
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def verifySSH( self, **connectargs ):
         # FIXME: Who uses this and what is the purpose? seems very specific
@@ -760,8 +737,7 @@
         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()
         import time
         time.sleep( 20 )
         if self.flag == 0:
@@ -862,8 +838,7 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
@@ -977,8 +952,7 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
@@ -1008,16 +982,14 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
             except Exception:
                 main.log.exception( self.name + ": Uncaught exception!" )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
     def changeDefaultGateway( self, host, newGW ):
         """
@@ -1039,16 +1011,14 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
             except Exception:
                 main.log.exception( self.name + ": Uncaught exception!" )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
     def addStaticMACAddress( self, host, GW, macaddr ):
         """
@@ -1070,16 +1040,14 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
             except Exception:
                 main.log.exception( self.name + ": Uncaught exception!" )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
     def verifyStaticGWandMAC( self, host ):
         """
@@ -1096,16 +1064,14 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
             except Exception:
                 main.log.exception( self.name + ": Uncaught exception!" )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
     def getMacAddress( self, host ):
         """
@@ -1120,12 +1086,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()
 
             pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
             macAddressSearch = re.search( pattern, response, re.I )
@@ -1150,12 +1114,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()
 
             pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
             macAddressSearch = re.search( pattern, response, re.I )
@@ -1187,12 +1149,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()
 
             pattern = ''
             if proto == 'IPV4':
@@ -1223,12 +1183,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()
             pattern = r'^(?P<dpid>\w)+'
             result = re.search( pattern, response, re.MULTILINE )
             if result is None:
@@ -1256,17 +1214,14 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             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()
 
     def getInterfaces( self, node ):
         """
@@ -1283,12 +1238,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()
             return response
         else:
             main.log.error( "Connection failed to the node" )
@@ -1303,12 +1256,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()
         return response
 
     def intfs( self ):
@@ -1321,12 +1272,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()
         return response
 
     def net( self ):
@@ -1336,12 +1285,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()
         return response
 
     def links( self, timeout=20 ):
@@ -1352,12 +1299,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()
         return response
 
     def iperftcpAll(self, hosts, timeout=6):
@@ -1376,8 +1321,7 @@
                             main.log.error(self.name + ": iperftcp test failed for " + host1 + " and " + host2)
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def iperftcp(self, host1="h1", host2="h2", timeout=6):
         '''
@@ -1434,12 +1378,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()
 
     def iperftcpipv6(self, host1="h1", host2="h2", timeout=50):
         main.log.info( self.name + ": Simple iperf TCP test between two hosts" )
@@ -1471,12 +1413,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()
 
     def iperfudpAll(self, hosts, bandwidth="10M"):
         '''
@@ -1497,8 +1437,7 @@
             return main.FALSE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def iperfudp( self, bandwidth="10M", host1="h1", host2="h2"):
 
@@ -1550,17 +1489,14 @@
         except pexpect.TIMEOUT:
             main.log.error(self.name + ": TIMEOUT exception found")
             main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
 
     def nodes( self ):
         main.log.info( self.name + ": List all nodes." )
@@ -1572,12 +1508,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()
         return response
 
     def pingpair( self ):
@@ -1590,12 +1524,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()
 
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": Ping between two hosts SUCCESSFUL" )
@@ -1627,12 +1559,10 @@
             return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def switch( self, **switchargs ):
         """
@@ -1649,13 +1579,11 @@
         except pexpect.TIMEOUT:
             main.log.error(self.name + ": TIMEOUT exception found")
             main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
         return main.TRUE
 
     def node( self, nodeName, commandStr ):
@@ -1680,8 +1608,7 @@
         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()
         main.log.info( " response is :" )
         main.log.info( response )
         return response
@@ -1702,12 +1629,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()
         return main.TRUE
 
     def plug( self, **plugargs ):
@@ -1726,12 +1651,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()
         return main.TRUE
 
     def dpctl( self, **dpctlargs ):
@@ -1750,12 +1673,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()
         return main.TRUE
 
     def getVersion( self ):
@@ -1772,8 +1693,7 @@
             return version
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def getSwController( self, sw ):
         """
@@ -1795,12 +1715,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()
 
     def assignSwController( self, sw, ip, port="6653", ptcp="" ):
         """
@@ -1926,18 +1844,15 @@
                 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()
             return main.TRUE
         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()
 
     def deleteSwController( self, sw ):
         """
@@ -1951,12 +1866,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:
             main.log.info( response )
 
@@ -1993,12 +1906,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()
 
     def delSwitch( self, sw ):
         """
@@ -2028,12 +1939,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()
 
     def getSwitchRandom( self, timeout=60, nonCut=True ):
         """
@@ -2131,12 +2040,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()
 
     def delLink( self, node1, node2 ):
         """
@@ -2168,12 +2075,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()
 
     def getLinkRandom( self, timeout=60, nonCut=True ):
         """
@@ -2280,12 +2185,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()
 
     def delHost( self, hostname ):
         """
@@ -2316,12 +2219,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()
 
     def disconnect( self ):
         """
@@ -2348,12 +2249,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()
 
     def stopNet( self, fileName="", timeout=5 ):
         """
@@ -2402,17 +2301,14 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             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:
             main.log.error( self.name + ": Connection failed to the host" )
             response = main.FALSE
@@ -2455,12 +2351,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()
 
     def decToHex( self, num ):
         return hex( num ).split( 'x' )[ 1 ]
@@ -2478,12 +2372,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()
             pattern = "flow_count=(\d+)"
             result = re.search( pattern, response, re.MULTILINE )
             if result is None:
@@ -2510,12 +2402,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()
 
     def flowTableComp( self, flowTable1, flowTable2 ):
         # This function compares the selctors and treatments of each flow
@@ -2549,8 +2439,7 @@
             return main.FALSE
         except Exception:
             main.log.exception( "Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def parseFlowTable( self, flowTable, version="", debug=True ):
         '''
@@ -2638,12 +2527,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()
 
     def getFlowTable( self, sw, version="", debug=False):
         '''
@@ -2690,12 +2577,10 @@
 
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def checkFlowId( self, sw, flowId, version="1.3", debug=True ):
         '''
@@ -2746,12 +2631,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()
 
 
     def startTcpdump( self, filename, intf="eth0", port="port 6653" ):
@@ -2804,12 +2687,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()
 
     def stopTcpdump( self ):
         """
@@ -2822,17 +2703,14 @@
         except pexpect.TIMEOUT:
             main.log.error(self.name + ": TIMEOUT exception found")
             main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
 
     def getPorts( self, nodeName, verbose=False ):
         """
@@ -2882,12 +2760,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()
 
     def getOVSPorts( self, nodeName ):
         """
@@ -2924,12 +2800,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()
 
     def getSwitches( self, verbose=False ):
         """
@@ -2979,12 +2853,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()
 
     def getHosts( self, verbose=False ):
         """
@@ -3050,12 +2922,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()
 
     def getLinks( self, timeout=20 ):
         """
@@ -3099,12 +2969,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()
 
     def compareSwitches( self, switches, switchesJson, portsJson ):
         """
@@ -3223,12 +3091,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()
 
     def compareLinks( self, switches, links, linksJson ):
         """
@@ -3346,12 +3212,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()
 
     def compareHosts( self, hosts, hostsJson ):
         """
@@ -3406,12 +3270,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()
 
     def getHostsOld( self ):
         """
@@ -3441,17 +3303,14 @@
         except pexpect.TIMEOUT:
             main.log.error(self.name + ": TIMEOUT exception found")
             main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
 
     def getSwitch( self ):
         """
@@ -3497,17 +3356,14 @@
         except pexpect.TIMEOUT:
             main.log.error(self.name + ": TIMEOUT exception found")
             main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
 
     def getGraphDict( self, timeout=60, useId=True, includeHost=False ):
         """
@@ -3602,8 +3458,7 @@
         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" )
             return None
@@ -3629,17 +3484,14 @@
         except pexpect.TIMEOUT:
             main.log.error(self.name + ": TIMEOUT exception found")
             main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
 
     def assignVLAN( self, host, intf, vlan ):
         """
@@ -3693,8 +3545,7 @@
             except pexpect.TIMEOUT:
                 main.log.error(self.name + ": TIMEOUT exception found")
                 main.log.error(self.name + ":     " + self.handle.before)
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
@@ -3725,18 +3576,15 @@
         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:
             # namespace is not clear!
             main.log.error( name + " component already exists!" )
             # FIXME: Should we exit here?
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def removeHostComponent( self, name ):
         """
@@ -3760,12 +3608,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()
 
     def startHostCli( self, host=None ):
         """
@@ -3788,12 +3634,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def changeInterfaceStatus( self, devicename, intf, status ):
         '''
@@ -3817,16 +3661,13 @@
                 return main.FALSE
             except pexpect.EOF:
                 main.log.exception(self.name + ": connection closed.")
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except TypeError:
                 main.log.exception(self.name + ": TypeError")
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
             except Exception:
                 main.log.exception(self.name + ": Uncaught exception!")
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
         else:
             main.log.warn("Interface status should be up or down!")
             return main.FALSE
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 7566a85..71de94c 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -92,8 +92,7 @@
                 return main.FALSE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def checkForLoss( self, pingList ):
         """
@@ -126,12 +125,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()
 
     def pingLong( self, **pingParams ):
         """
@@ -164,12 +161,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()
 
 
     def pingstatus( self, **pingParams ):
@@ -206,12 +201,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()
 
     def pingKill( self, testONUser, testONIP ):
         """
@@ -245,17 +238,14 @@
         except pexpect.TIMEOUT:
             main.log.error( self.name + ": TIMEOUT exception found in pingKill" )
             main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         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()
 
     def pingLongKill( self ):
         try:
@@ -274,12 +264,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()
 
     def pingHostOptical( self, **pingParams ):
         """
@@ -310,8 +298,7 @@
         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()
         main.log.info( self.name + ": Ping Response: " + response )
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": no packets lost, host is reachable" )
@@ -351,12 +338,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()
 
     def checknum( self, num ):
         """
@@ -392,12 +377,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()
 
     def startTcpdump(
             self,
@@ -446,12 +429,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()
 
     def stopTcpdump( self ):
         """
@@ -463,12 +444,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()
 
     def runOpticalMnScript( self, name='onos', ctrllerIP=None ):
         import time
@@ -571,12 +550,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()
 
     def setIpTablesOUTPUT( self, dstIp, dstPort, action='add',
                            packetType='tcp', rule='DROP' ):
@@ -718,8 +695,7 @@
                     except Exception:
                         main.log.exception( self.name +
                                             ": Uncaught exception!" )
-                        main.cleanup()
-                        main.exit()
+                        main.cleanAndExit()
                 else:
                     main.log.error(
                         "Given rule already exists, but attempted to add it" )
@@ -762,8 +738,7 @@
                     except Exception:
                         main.log.exception( self.name +
                                             ": Uncaught exception!" )
-                        main.cleanup()
-                        main.exit()
+                        main.cleanAndExit()
                 else:
                     main.log.error(
                         "Given rule does not exist,\
@@ -772,8 +747,7 @@
                 # NOTE: If a bad usage of this function occurs, exit the entire
                 # test
                 main.log.error( "Bad rule given for iptables. Exiting..." )
-                main.cleanup()
-                main.exit()
+                main.cleanAndExit()
 
 
 if __name__ != "__main__":
diff --git a/TestON/drivers/common/cli/emulator/scapyclidriver.py b/TestON/drivers/common/cli/emulator/scapyclidriver.py
index 59f5a48..74905f8 100644
--- a/TestON/drivers/common/cli/emulator/scapyclidriver.py
+++ b/TestON/drivers/common/cli/emulator/scapyclidriver.py
@@ -104,12 +104,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()
 
     def disconnect( self ):
         """
@@ -179,8 +177,7 @@
             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()
         else:
             main.log.error( self.name + ": Connection failed to the host" )
             response = main.FALSE
@@ -207,13 +204,11 @@
             main.componentInit( name )
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         else:
             # namespace is not clear!
             main.log.error( name + " component already exists!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def removeHostComponent( self, name ):
         """
@@ -237,8 +232,7 @@
             return main.TRUE
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def startHostCli( self, host=None ):
         """
@@ -261,12 +255,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def startScapy( self, mplsPath="" ):
         """
@@ -300,12 +292,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def stopScapy( self ):
         """
@@ -320,12 +310,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def buildEther( self, **kwargs ):
         """
@@ -370,12 +358,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def buildIP( self, **kwargs ):
         """
@@ -430,12 +416,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def buildIPv6( self, **kwargs ):
         """
@@ -485,12 +469,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def buildTCP( self, ipVersion=4, **kwargs ):
         """
@@ -556,12 +538,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def buildUDP( self, ipVersion=4, **kwargs ):
         """
@@ -620,12 +600,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def buildSCTP( self, ipVersion=4, **kwargs ):
         """
@@ -684,12 +662,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
     def buildARP( self, **kwargs ):
         """
@@ -745,12 +721,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
     def buildICMP( self, ipVersion=4, **kwargs ):
         """
@@ -816,12 +790,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup( )
-            main.exit( )
+            main.cleanAndExit()
 
     def sendPacket( self, iface=None, packet=None, timeout=1 ):
         """
@@ -864,12 +836,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def startFilter( self, ifaceName=None, sniffCount=1, pktFilter="ip" ):
         """
@@ -902,12 +872,10 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def checkFilter( self, timeout=10 ):
         """
@@ -921,12 +889,10 @@
                 return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def killFilter( self ):
         """
@@ -941,12 +907,10 @@
             return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def readPackets( self ):
         """
@@ -961,12 +925,10 @@
             return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         return self.handle.before
 
     def updateSelf( self, IPv6=False ):
@@ -1000,12 +962,10 @@
             return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def getIp( self, ifaceName=None, IPv6=False ):
         """
@@ -1076,12 +1036,10 @@
             return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
     def getIfList( self ):
         """
@@ -1099,12 +1057,10 @@
             return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanAndExit()
 
 if __name__ != "__main__":
     sys.modules[ __name__ ] = ScapyCliDriver()