Update all HA tests with some of the recent changes
Change-Id: I63ad789df1b1ebb8686c690c05949fd3e1f1ac41
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.py b/TestON/tests/HAminorityRestart/HAminorityRestart.py
index 855f380..69c0645 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.py
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.py
@@ -494,19 +494,22 @@
# FIXME: Once we have a host discovery mechanism, use that instead
# REACTIVE FWD test
pingResult = main.FALSE
- for i in range(2): # Retry if pingall fails first time
- time1 = time.time()
+ passMsg = "Reactive Pingall test passed"
+ time1 = time.time()
+ pingResult = main.Mininet1.pingall()
+ time2 = time.time()
+ if not pingResult:
+ main.log.warn("First pingall failed. Trying again...")
pingResult = main.Mininet1.pingall()
- if i == 0:
- utilities.assert_equals(
- expect=main.TRUE,
- actual=pingResult,
- onpass="Reactive Pingall test passed",
- onfail="Reactive Pingall failed, " +
- "one or more ping pairs failed" )
- time2 = time.time()
- main.log.info( "Time for pingall: %2f seconds" %
- ( time2 - time1 ) )
+ passMsg += " on the second try"
+ utilities.assert_equals(
+ expect=main.TRUE,
+ actual=pingResult,
+ onpass= passMsg,
+ onfail="Reactive Pingall failed, " +
+ "one or more ping pairs failed" )
+ main.log.info( "Time for pingall: %2f seconds" %
+ ( time2 - time1 ) )
# timeout for fwd flows
time.sleep( 11 )
# uninstall onos-app-fwd
@@ -1671,6 +1674,12 @@
assert main.CLIs, "main.CLIs not defined"
assert main.nodes, "main.nodes not defined"
main.case( "Restart minority of ONOS nodes" )
+
+ main.step( "Checking ONOS Logs for errors" )
+ for node in main.nodes:
+ main.log.debug( "Checking logs for errors on " + node.name + ":" )
+ main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
+
main.step( "Killing 3 ONOS nodes" )
killTime = time.time()
# TODO: Randomize these nodes or base this on partitions
@@ -2095,10 +2104,6 @@
" and ONOS"
main.step( "Comparing ONOS topology to MN" )
- devicesResults = main.TRUE
- linksResults = main.TRUE
- hostsResults = main.TRUE
- hostAttachmentResults = True
topoResult = main.FALSE
elapsed = 0
count = 0
@@ -2106,6 +2111,10 @@
startTime = time.time()
# Give time for Gossip to work
while topoResult == main.FALSE and elapsed < 60:
+ devicesResults = main.TRUE
+ linksResults = main.TRUE
+ hostsResults = main.TRUE
+ hostAttachmentResults = True
count += 1
cliStart = time.time()
devices = []
@@ -2638,49 +2647,36 @@
main.Mininet2.stopTcpdump()
testname = main.TEST
- if main.params[ 'BACKUP' ] == "True":
+ if main.params[ 'BACKUP' ][ 'ENABLED' ] == "True":
main.step( "Copying MN pcap and ONOS log files to test station" )
teststationUser = main.params[ 'BACKUP' ][ 'TESTONUSER' ]
teststationIP = main.params[ 'BACKUP' ][ 'TESTONIP' ]
- # NOTE: MN Pcap file is being saved to ~/packet_captures
- # scp this file as MN and TestON aren't necessarily the same vm
- # FIXME: scp
- # mn files
+ # NOTE: MN Pcap file is being saved to logdir.
+ # We scp this file as MN and TestON aren't necessarily the same vm
+
+ # FIXME: To be replaced with a Jenkin's post script
# TODO: Load these from params
# NOTE: must end in /
logFolder = "/opt/onos/log/"
logFiles = [ "karaf.log", "karaf.log.1" ]
# NOTE: must end in /
- dstDir = "~/packet_captures/"
for f in logFiles:
for node in main.nodes:
- main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
- ":" + logFolder + f + " " +
- teststationUser + "@" +
- teststationIP + ":" +
- dstDir + str( testname ) +
- "-" + node.name + "-" + f )
- main.ONOSbench.handle.expect( "\$" )
-
+ dstName = main.logdir + "/" + node.name + "-" + f
+ main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+ logFolder + f, dstName )
# std*.log's
# NOTE: must end in /
logFolder = "/opt/onos/var/"
logFiles = [ "stderr.log", "stdout.log" ]
# NOTE: must end in /
- dstDir = "~/packet_captures/"
for f in logFiles:
for node in main.nodes:
- main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
- ":" + logFolder + f + " " +
- teststationUser + "@" +
- teststationIP + ":" +
- dstDir + str( testname ) +
- "-" + node.name + "-" + f )
- main.ONOSbench.handle.expect( "\$" )
- # sleep so scp can finish
- time.sleep( 10 )
- main.step( "Packing and rotating pcap archives" )
- os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+ dstName = main.logdir + "/" + node.name + "-" + f
+ main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+ logFolder + f, dstName )
+ else:
+ main.log.debug( "skipping saving log files" )
main.step( "Stopping Mininet" )
mnResult = main.Mininet1.stopNet()
@@ -2690,9 +2686,8 @@
main.step( "Checking ONOS Logs for errors" )
for node in main.nodes:
- print colors[ 'purple' ] + "Checking logs for errors on " + \
- node.name + ":" + colors[ 'end' ]
- print main.ONOSbench.checkLogs( node.ip_address, restart=True )
+ main.log.debug( "Checking logs for errors on " + node.name + ":" )
+ main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
try:
timerLog = open( main.logdir + "/Timers.csv", 'w')