Add function to check ONOS logs for exception and case66 to sanity test to call the function on the 4 nodes
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 412fb23..3c03714 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1043,3 +1043,39 @@
main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
main.cleanup()
main.exit()
+
+ def check_exceptions(self):
+ '''
+ Greps the logs for "xception"
+ '''
+ try:
+ output = ''
+ self.handle.sendline("")
+ self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+ self.handle.sendline("cd "+self.home+"/onos-logs")
+ self.handle.sendline("grep \"xception\" * -c")
+ self.handle.expect("\s-c")
+ self.handle.expect("\$")
+ response = self.handle.before
+ for line in response.splitlines():
+ if re.search("log:", line):
+ output +="Exceptions found in " + line + "\n"
+ elif re.search("std...:",line):
+ output+="Exceptions found in " + line + "\n"
+ else:
+ pass
+ #these should be the old logs
+ return output
+ except pexpect.TIMEOUT:
+ main.log.error(self.name + ": Timeout exception found in check_exceptions function")
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+ main.log.error( traceback.print_exc() )
+ main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+ main.cleanup()
+ main.exit()
diff --git a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py b/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py
index c1057d1..5ce459f 100644
--- a/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py
+++ b/TestON/tests/RCOnosSanity4nodesJ/RCOnosSanity4nodesJ.py
@@ -25,9 +25,13 @@
main.RamCloud4.stop_serv()
time.sleep(10)
main.ONOS1.handle.sendline("~/ONOS/onos.sh rc deldb")
+ main.ONOS1.handle.sendline("y")
main.ONOS2.handle.sendline("~/ONOS/onos.sh rc deldb")
+ main.ONOS2.handle.sendline("y")
main.ONOS3.handle.sendline("~/ONOS/onos.sh rc deldb")
+ main.ONOS3.handle.sendline("y")
main.ONOS4.handle.sendline("~/ONOS/onos.sh rc deldb")
+ main.ONOS4.handle.sendline("y")
time.sleep(10)
main.log.report("Pulling latest code from github to all nodes")
for i in range(2):
@@ -590,3 +594,11 @@
main.log.report("\tPING TEST FAIL")
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
+ def CASE66(self, main):
+ main.log.report("Checking ONOS logs for exceptions")
+ main.log.report("Exceptions in ONOS1 logs: \n" + main.ONOS1.check_exceptions())
+ main.log.report("Exceptions in ONOS2 logs: \n" + main.ONOS2.check_exceptions())
+ main.log.report("Exceptions in ONOS3 logs: \n" + main.ONOS3.check_exceptions())
+ main.log.report("Exceptions in ONOS4 logs: \n" + main.ONOS4.check_exceptions())
+ utilities.assert_equals(expect=main.TRUE,actual=main.TRUE,onpass="Exception check pass",onfail="Exception check fail")
+