[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/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()