Add some more checks to driver functions
- Better checking for incorrect password in connect
- Add check for no buck in path for buck build
Change-Id: Ide5c0bd6d74a1a475a75886d5514a8e722436154
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index ffcd080..6058cbd 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -365,6 +365,7 @@
i = self.handle.expect( [ "This does not appear to be the root of a Buck project.",
"\n",
"BUILD FAILED",
+ "no buck in",
self.prompt ],
timeout=timeout )
output += str( self.handle.before + self.handle.after )
@@ -379,6 +380,9 @@
main.log.error( "Build failed" )
ret = main.FALSE
elif i == 3:
+ main.log.error( "Could not find buck in your PATH." )
+ ret = main.FALSE
+ elif i == 4:
# Prompt returned
break
main.log.debug( output )
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 10b5152..43352c5 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -88,6 +88,7 @@
pexpect.TIMEOUT,
refused,
'teston>',
+ 'Permission denied, please try again.',
self.prompt ],
120 )
if i == 0: # Accept key, then expect either a password prompt or access
@@ -106,12 +107,13 @@
self.pwd = ""
self.handle.sendline( self.pwd )
j = self.handle.expect( [
- self.prompt,
'password:|Password:',
+ 'Permission denied, please try again.',
+ self.prompt,
pexpect.EOF,
pexpect.TIMEOUT ],
120 )
- if j != 0:
+ if j != 2:
main.log.error( "Incorrect Password" )
return main.FALSE
elif i == 2:
@@ -130,7 +132,10 @@
self.ip_address +
" port 22: Connection refused" )
return main.FALSE
- elif i == 6:
+ elif i == 6: # Incorrect Password
+ main.log.error( "Incorrect Password" )
+ return main.FALSE
+ elif i == 7: # Prompt
main.log.info( "Password not required logged in" )
self.handle.sendline( "" )