pexpect changes to logout function
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index e2e08bd..b7242eb 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -71,9 +71,9 @@
main.cleanup()
main.exit()
except:
- main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+ main.log.info(self.name + ":::::::::::::::::::::::")
main.log.error( traceback.print_exc() )
- main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+ main.log.info(":::::::::::::::::::::::")
main.cleanup()
main.exit()
@@ -108,12 +108,20 @@
Sends 'logout' command to ONOS cli
'''
try:
- self.handle.sendline("logout")
- self.handle.expect("\$")
-
+ self.handle.sendline("")
+ i = self.handle.expect([
+ "onos>",
+ "\$"], timeout=10)
+ if i == 0:
+ self.handle.sendline("logout")
+ self.handle.expect("\$")
+ elif i == 1:
+ return main.TRUE
+
except pexpect.EOF:
main.log.error(self.name + ": eof exception found")
- main.log.error(self.name + ": " + self.handle.before)
+ main.log.error(self.name + ": " +
+ self.handle.before)
main.cleanup()
main.exit()
except: