[ONOS-7781] Migrate SRRouting test case 1 to POD
Change-Id: I66dac9e1c1652ac16022892a08afa6f359362029
diff --git a/TestON/drivers/common/cli/hostdriver.py b/TestON/drivers/common/cli/hostdriver.py
index 86c0c38..d8cc74d 100644
--- a/TestON/drivers/common/cli/hostdriver.py
+++ b/TestON/drivers/common/cli/hostdriver.py
@@ -235,6 +235,53 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
+ def pingHostSetAlternative( self, dstIPList, wait=1, IPv6=False ):
+ """
+ Description:
+ Ping a set of destination host.
+ Params:
+ dstIPList is a list of destination ip addresses
+ Returns:
+ main.TRUE if the destination host is reachable
+ main.FALSE otherwise
+ """
+ isReachable = main.TRUE
+ wait = int( wait )
+ cmd = "ping"
+ if IPv6:
+ cmd = cmd + "6"
+ cmd = cmd + " -c 1 -i 1 -W " + str( wait )
+ try:
+ for dstIP in dstIPList:
+ pingCmd = cmd + " " + dstIP
+ self.handle.sendline( pingCmd )
+ i = self.handle.expect( [ self.prompt,
+ pexpect.TIMEOUT ],
+ timeout=wait + 5 )
+ if i == 0:
+ response = self.handle.before
+ if not re.search( ',\s0\%\spacket\sloss', response ):
+ main.log.debug( "Ping failed between %s and %s" % ( self.name, dstIP ) )
+ isReachable = main.FALSE
+ elif i == 1:
+ main.log.error( self.name + ": timeout when waiting for response" )
+ isReachable = main.FALSE
+ else:
+ main.log.error( self.name + ": unknown response: " + self.handle.before )
+ isReachable = main.FALSE
+ except pexpect.TIMEOUT:
+ main.log.exception( self.name + ": TIMEOUT exception" )
+ self.exitFromCmd( [ self.prompt ] )
+ isReachable = main.FALSE
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanAndExit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanAndExit()
+ return isReachable
+
def ifconfig( self, wait=3 ):
"""
Run ifconfig command on host and return output