changes for the static tests in SRRouting
Change-Id: I4d47d03ef80f1b2712d8df9c2e141fdb4a67bc07
diff --git a/TestON/drivers/common/cli/hostdriver.py b/TestON/drivers/common/cli/hostdriver.py
index c2d80ed..d1c17fa 100644
--- a/TestON/drivers/common/cli/hostdriver.py
+++ b/TestON/drivers/common/cli/hostdriver.py
@@ -171,10 +171,10 @@
self.handle.expect( self.prompt )
self.handle.sendline( "ssh {}@{}".format( self.options[ 'username' ],
self.options[ 'ip' ] ) )
- i = self.handle.expect( [ "password:|Password:", self.prompt, pexpect.TIMEOUT ], timeout=30 )
+ i = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ], timeout=30 )
if i == 0:
- self.handle.sendline( self.options[ 'password' ] )
- j = self.handle.expect( [ "password:|Password:", self.prompt, pexpect.TIMEOUT ], timeout=10 )
+ self.handle.sendline( self.pwd )
+ j = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ], timeout=10 )
if j != 1:
main.log.error( "Incorrect password" )
return main.FALSE
@@ -539,14 +539,21 @@
try:
main.log.info( self.name + ": Sending: " + cmd )
self.handle.sendline( cmd )
- i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ],
+ i = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ],
timeout=wait + 5 )
response = self.handle.before
if debug:
main.log.debug( response )
- if i == 1:
+ if i == 0:
+ self.handle.sendline( self.pwd )
+ j = self.handle.expect( [ "password|Password", self.prompt, pexpect.TIMEOUT ], timeout=10 )
+ if j != 1:
+ main.log.error( "Incorrect password" )
+ return main.FALSE
+ if i == 2:
main.log.error( self.name + ": timeout when waiting for response" )
main.log.error( self.name + ": response: " + str( response ) )
+ main.log.debug( self.prompt )
return response
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
@@ -555,3 +562,4 @@
except Exception:
main.log.exception( self.name + ": uncaught exception!" )
main.cleanAndExit()
+ self.clearBuffer()
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index 678bc50..daa30e8 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -1074,10 +1074,10 @@
intf = hosts[host]['interfaces'][0].get( 'name' )
hostIp = self.getIPAddress( host, iface=intf ) or hosts[host]['interfaces'][0].get( 'ips', False )
if hostIp:
- flushCmd = "sudo ip neigh flush all"
+ flushCmd = "sudo /sbin/ip neigh flush all"
intfStr = "-i {}".format( intf ) if intf else ""
srcIp = "-S {}".format( hostIp if isinstance( hostIp, types.StringType ) else hostIp[0] ) if intf else ""
- cmd = "sudo arping -c 1 -w {} {} {} {}".format( wait, intfStr, srcIp, dstIp )
+ cmd = "sudo /usr/sbin/arping -c 1 -w {} {} {} {}".format( wait, intfStr, srcIp, dstIp )
main.log.debug( "Sending IPv4 arping from host {}".format( host ) )
elif self.getIPAddress( host, proto='IPV6' ):
flushCmd = "sudo ip -6 neigh flush all"