Add Basic Connectivity tests for paire leaf pod
Change-Id: Ie2c7529629893462e9567700354368380188ef8b
diff --git a/TestON/drivers/common/cli/hostdriver.py b/TestON/drivers/common/cli/hostdriver.py
index e51c5d6..d0cf559 100644
--- a/TestON/drivers/common/cli/hostdriver.py
+++ b/TestON/drivers/common/cli/hostdriver.py
@@ -224,11 +224,21 @@
"""
cmd = "ifconfig %s" % iface if iface else ""
response = self.command( cmd )
- pattern = ''
- if proto == 'IPV4':
- pattern = "inet\s(\d+\.\d+\.\d+\.\d+)\s\snetmask"
+ if "Command 'ifconfig' not found" in response:
+ # ip a show dev
+ cmd = "ip addr show %s" % iface if iface else ""
+ response = self.command( cmd )
+ pattern = ''
+ if proto == 'IPV4':
+ pattern = "inet\s(\d+\.\d+\.\d+\.\d+)/\d+"
+ else:
+ pattern = "inet6\s([\w,:]*)/\d+"
else:
- pattern = "inet6\s([\w,:]*)/\d+\s\sprefixlen"
+ 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
@@ -335,9 +345,15 @@
command = "ifconfig"
main.log.info( self.name + ": Sending: " + command )
self.handle.sendline( command )
- i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ],
+ i = self.handle.expect( [ "Command 'ifconfig' not found", self.prompt, pexpect.TIMEOUT ],
timeout=wait + 5 )
- if i == 1:
+ if i == 0:
+ response = self.handle.before
+ self.handle.expect( [ self.prompt, pexpect.TIMEOUT ] )
+ response += str( self.handle.before )
+ main.log.error( self.name + ": Error running ifconfig: %s " % response )
+ return response
+ if i == 2:
main.log.error(
self.name +
": timeout when waiting for response" )
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index 6d46c1e..6b02e09 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -786,23 +786,12 @@
"""
Returns IP address of the host
"""
- cmd = "ifconfig %s" % iface if iface else ""
- response = self.runCmdOnHost( host, cmd )
- pattern = ''
- if proto == 'IPV4':
- pattern = "inet\s(\d+\.\d+\.\d+\.\d+)\s\snetmask"
+ hostComponent = self.hosts[ host ]
+ if hostComponent:
+ return hostComponent.getIPAddress( iface=iface, proto=proto )
else:
- pattern = "inet6\s([\w,:]*)/\d+\s\sprefixlen"
- ipAddressSearch = re.search( pattern, response )
- if not ipAddressSearch:
+ main.log.warn( self.name + ": Could not find host with short name '%s'" % host )
return None
- main.log.info(
- self.name +
- ": IP-Address of Host " +
- host +
- " is " +
- ipAddressSearch.group( 1 ) )
- return ipAddressSearch.group( 1 )
def getLinkRandom( self, timeout=60, nonCut=True, excludeNodes=[], skipLinks=[] ):
"""