Changes to enable debug logs for the controller restart test case
Change-Id: I24fa972bdc56fccb65a9f39e4236d12d85c9459d
diff --git a/src/test/cli/onosclidriver.py b/src/test/cli/onosclidriver.py
index d9c6011..eb64194 100644
--- a/src/test/cli/onosclidriver.py
+++ b/src/test/cli/onosclidriver.py
@@ -328,6 +328,37 @@
main.cleanup()
main.exit()
+ def logSet( self, level="INFO", app="org.onosproject" ):
+ """
+ Set the logging level to lvl for a specific app
+ returns main.TRUE on success
+ returns main.FALSE if Error occurred
+ if noExit is True, TestON will not exit, but clean up
+ Available level: DEBUG, TRACE, INFO, WARN, ERROR
+ Level defaults to INFO
+ """
+ try:
+ self.handle.sendline( "log:set %s %s" %( level, app ) )
+ self.handle.expect( "onos>" )
+
+ response = self.handle.before
+ if re.search( "Error", response ):
+ return main.FALSE
+ return main.TRUE
+ except pexpect.TIMEOUT:
+ main.log.exception( self.name + ": TIMEOUT exception found" )
+ main.cleanup()
+ main.exit()
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
def log( self, cmdStr, level="" ):
"""
log the commands in the onos CLI.
diff --git a/src/test/cluster/clusterTest.py b/src/test/cluster/clusterTest.py
index d5ad5fb..5099900 100644
--- a/src/test/cluster/clusterTest.py
+++ b/src/test/cluster/clusterTest.py
@@ -108,6 +108,13 @@
self.cliExit()
return result
+ def log_set(self, level = "INFO", app = "org.onosproject", controller = None):
+ self.cliEnter(controller = controller)
+ try:
+ self.cli.logSet(level = level, app = app)
+ except: pass
+ self.cliExit()
+
def get_leaders(self, controller = None):
result_map = {}
if controller is None:
@@ -374,7 +381,16 @@
controller = onos_map[controller_name]
log.info('ITERATION: %d. Restarting Controller %s' %(num + 1, controller_name))
try:
+ #enable debug log for the other controllers before restarting this controller
+ for ctlr in controllers:
+ if ctlr == controller:
+ continue
+ log.info('Enabling DEBUG log for controller: %s' %ctlr)
+ self.log_set(level="DEBUG", controller = ctlr)
+ self.log_set(level="DEBUG", app = "io.atomix", controller = ctlr)
cord_test_onos_restart(node = controller_name, timeout = 0)
+ self.log_set(level="DEBUG", controller = controller)
+ self.log_set(level="DEBUG", app = "io.atomix", controller = controller)
time.sleep(60)
except:
time.sleep(5)