Update all HA tests with some of the recent changes
Change-Id: I63ad789df1b1ebb8686c690c05949fd3e1f1ac41
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index 6ceaead..e136d5e 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.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
@@ -515,11 +518,6 @@
utilities.assert_equals( expect=main.TRUE, actual=uninstallResult,
onpass="Uninstall fwd successful",
onfail="Uninstall fwd failed" )
- '''
- main.Mininet1.handle.sendline( "py [ h.cmd( \"arping -c 1 10.1.1.1 \" ) for h in net.hosts ] ")
- import time
- time.sleep(60)
- '''
main.step( "Check app ids" )
threads = []
@@ -2048,10 +2046,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
@@ -2059,6 +2053,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 = []
@@ -2601,49 +2599,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()
@@ -2653,9 +2638,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 )
+ 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')