[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
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index f0d7f8b..828187c 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -207,9 +207,9 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
- def createComponent( self, name ):
+ def createHostComponent( self, name ):
"""
- Creates switch/host component with the same parameters as the one copied to local.
+ Creates host component with the same parameters as the one copied to local.
Arguments:
name - The string of the name of this component. The new component
will be assigned to main.<name> .
@@ -563,3 +563,24 @@
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
+
+ def getIPAddress( self, host, proto='IPV4' ):
+ """
+ Returns IP address of the host
+ """
+ response = self.runCmdOnHost( host, "ifconfig" )
+ pattern = ''
+ if proto == 'IPV4':
+ pattern = "inet\s(\d+\.\d+\.\d+\.\d+)\s\snetmask"
+ else:
+ pattern = "inet6\s([\w,:]*)/\d+\s\sprefixlen"
+ ipAddressSearch = re.search( pattern, response )
+ if not ipAddressSearch:
+ return None
+ main.log.info(
+ self.name +
+ ": IP-Address of Host " +
+ host +
+ " is " +
+ ipAddressSearch.group( 1 ) )
+ return ipAddressSearch.group( 1 )