Enable running tests on a persistant network setup
- Doesn't setup or teardown the control or data planes
- Increase timeout for reading scapy packets
TODO:
- Add to all params files for qa pod
- Update tofino switch driver
- Test on other test suites
Change-Id: I8de8e10205b508fd7cd7fb49fc7715369dab5fb0
(cherry picked from commit bb1e6baec7126ca99240bab1e45622eec037021b)
diff --git a/TestON/drivers/common/cli/emulator/scapyclidriver.py b/TestON/drivers/common/cli/emulator/scapyclidriver.py
index bcaebfb..d340d5c 100644
--- a/TestON/drivers/common/cli/emulator/scapyclidriver.py
+++ b/TestON/drivers/common/cli/emulator/scapyclidriver.py
@@ -727,7 +727,7 @@
# clear buffer
if debug:
main.log.warn( "%s expect loop iteration" % i )
- self.handle.expect( self.scapyPrompt, timeout=1 )
+ self.handle.expect( self.scapyPrompt, timeout=5 )
response += self.cleanOutput( self.handle.before, debug )
except pexpect.TIMEOUT:
return response
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index c151aab..0f7b699 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -532,12 +532,12 @@
# Use scapy to send and recieve packets
hostPair[ 1 ].startScapy( ifaceName=dstIface )
hostPair[ 1 ].addRoutes()
- hostPair[ 1 ].startFilter( ifaceName=dstIface, pktFilter="ether host %s and ip host %s" % ( srcMac, srcIPs[0] ) )
+ hostPair[ 1 ].startFilter( ifaceName=dstIface, pktFilter="ether src host %s and ip src host %s" % ( srcMac, srcIPs[0] ) )
hostPair[ 0 ].startScapy( ifaceName=srcIface )
hostPair[ 0 ].addRoutes()
- hostPair[ 0 ].buildEther( dst=dstMac )
- hostPair[ 0 ].buildIP( src=srcIPs, dst=dstIPs )
+ hostPair[ 0 ].buildEther( src=srcMac, dst=dstMac )
+ hostPair[ 0 ].buildIP( src=srcIPs[0], dst=dstIPs[0] )
hostPair[ 0 ].buildICMP( )
hostPair[ 0 ].sendPacket( iface=srcIface )
@@ -545,7 +545,7 @@
if not waiting:
pingResult = main.FALSE
packets = hostPair[ 1 ].readPackets()
- main.log.warn( packets )
+ main.log.warn( repr( packets ) )
for packet in packets.splitlines():
main.log.debug( packet )
if srcIPs[0] in packet:
@@ -625,7 +625,7 @@
main.log.debug( "Pinging from " + str( srcHost.shortName ) + " to " + str( dstHost.shortName ) )
# Use scapy to send and recieve packets
dstHost.startFilter()
- srcHost.buildEther( dst=srcHost.interfaces[0].get( 'mac') )
+ srcHost.buildEther( src=srcHost.interfaces[0].get( 'mac'), dst=dstHost.interfaces[0].get( 'mac') )
srcHost.sendPacket()
output = dstHost.checkFilter()
main.log.debug( output )
@@ -781,11 +781,12 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanAndExit()
- def getIPAddress( self, host, proto='IPV4' ):
+ def getIPAddress( self, host, iface=None, proto='IPV4' ):
"""
Returns IP address of the host
"""
- response = self.runCmdOnHost( host, "ifconfig" )
+ 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"
@@ -1049,11 +1050,13 @@
for host in hostList:
flushCmd = ""
cmd = ""
- if self.getIPAddress( host ) or hosts[host]['interfaces'][0].get( 'ips', False ) :
+ 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"
- intf = hosts[host]['interfaces'][0].get( 'name' )
intfStr = "-i {}".format( intf ) if intf else ""
- cmd = "sudo arping -c 1 -w {} {} {}".format( wait, intfStr, dstIp )
+ 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 )
main.log.debug( "Sending IPv4 arping from host {}".format( host ) )
elif self.getIPAddress( host, proto='IPV6' ):
flushCmd = "sudo ip -6 neigh flush all"
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index ef69aec..b0bf7cb 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -3318,7 +3318,7 @@
result = main.TRUE
else:
output = output + \
- "The number of links, switches, nodes, and SCCs does not match " + \
+ "The number of links, switches, nodes, and SCCs does not match " + \
"what was expected"
result = main.FALSE
output = output + "\n ONOS sees %i devices " % int( devices )
@@ -6774,7 +6774,7 @@
output = ""
for cmdStr in cmdList:
self.handle.sendline( cmdStr )
- self.handle.expect( self.dockerPrompt, timeout=120 )
+ self.handle.expect( self.dockerPrompt, timeout=420 )
self.handle.sendline( "" )
self.handle.expect( self.dockerPrompt )
handle = self.handle.before
diff --git a/TestON/drivers/common/cli/stratumosswitchdriver.py b/TestON/drivers/common/cli/stratumosswitchdriver.py
index 3eae155..1490079 100644
--- a/TestON/drivers/common/cli/stratumosswitchdriver.py
+++ b/TestON/drivers/common/cli/stratumosswitchdriver.py
@@ -106,8 +106,9 @@
try:
if self.handle:
# Stop the agent
- self.stopSwitchAgent()
- main.log.debug( self.name + ": Disconnected" )
+ if not main.persistentSetup:
+ self.stopSwitchAgent()
+ main.log.debug( self.name + ": Disconnected" )
# Disconnect from the device
self.handle.sendline( "" )
self.handle.expect( self.prompt )