changes in static tests after the initial code pushed
Change-Id: I7e11ea8ec818b952aca824ae84069f99aa794fd0
diff --git a/TestON/drivers/common/cli/networkdriver.py b/TestON/drivers/common/cli/networkdriver.py
index daa30e8..89edfb3 100755
--- a/TestON/drivers/common/cli/networkdriver.py
+++ b/TestON/drivers/common/cli/networkdriver.py
@@ -358,7 +358,7 @@
except Exception:
main.log.error( self.name + ": failed to get host MAC address" )
- def runCmdOnHost( self, hostName, cmd ):
+ def runCmdOnHost( self, hostName, cmd, debug=False ):
"""
Run shell command on specified host and return output
Required:
@@ -367,7 +367,7 @@
"""
hostComponent = self.hosts[ hostName ]
if hostComponent:
- return hostComponent.command( cmd )
+ return hostComponent.command( cmd, debug )
return None
def assignSwController( self, sw, ip, port="6653", ptcp="" ):
@@ -1080,7 +1080,7 @@
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"
+ flushCmd = "sudo /sbin/ip -6 neigh flush all"
intf = hosts[host]['interfaces'][0]['name']
cmd = "ndisc6 -r 1 -w {} {} {}".format( wait, dstIp6, intf )
main.log.debug( "Sending IPv6 ND from host {}".format( host ) )
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index bafa284..2447717 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -36,6 +36,7 @@
shreya@onlab.us
jeremyr@opennetworking.org
"""
+import ipaddress
import pexpect
import re
import json
@@ -1350,7 +1351,7 @@
main.log.exception( self.name + ": Uncaught exception" )
return None
- def verifyHostIp( self, hostList=[], prefix="" ):
+ def verifyHostIp( self, hostList=[], prefix="", prefixLength=24 ):
"""
Description:
Verify that all hosts have IP address assigned to them
@@ -1365,19 +1366,28 @@
"""
try:
hosts = self.hosts()
- hosts = json.loads( hosts )
+ hosts = json.loads( hosts, "utf-8" )
if not hostList:
hostList = [ host[ "id" ] for host in hosts ]
+ hostList = [ str( h.lower() ) for h in hostList ]
for host in hosts:
hostId = host[ "id" ]
- if hostId not in hostList:
+ hostId = str( hostId.lower() )
+ match = False
+ for onosHostId in hostList:
+ if onosHostId == hostId:
+ match = True
+ if not match:
continue
ipList = host[ "ipAddresses" ]
main.log.debug( self.name + ": IP list on host " + str( hostId ) + ": " + str( ipList ) )
if not ipList:
main.log.warn( self.name + ": Failed to discover any IP addresses on host " + str( hostId ) )
else:
- if not any( ip.startswith( str( prefix ) ) for ip in ipList ):
+ # if no hostIp in subnet: Get warning otherwise remove hostId from hostList
+ subnetString = u"%s/%s" % (prefix, prefixLength)
+ subnet = ipaddress.ip_network( subnetString, strict=False )
+ if not any( ipaddress.ip_address( ip ) in subnet for ip in ipList ):
main.log.warn( self.name + ": None of the IPs on host " + str( hostId ) + " has prefix " + str( prefix ) )
else:
main.log.debug( self.name + ": Found matching IP on host " + str( hostId ) )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
index fd6f018..bcf9728 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/SRRoutingTest.py
@@ -80,6 +80,7 @@
# if static route flag add routes
# these routes are topology specific
+ # these should be in the params file
if static:
if ipv4:
lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
@@ -105,7 +106,7 @@
# Run the test with physical devices
lib.connectToPhysicalNetwork( main )
- lib.saveOnosDiagnostics( main )
+ # lib.saveOnosDiagnostics( main )
# wait some time for onos to install the rules!
main.log.info( "Waiting %i seconds for ONOS to program the dataplane" % float( main.params[ "timers" ][ "dhcpSleep" ] ))
time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host
index df2d48b..db6e183 100644
--- a/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host
+++ b/TestON/tests/USECASE/SegmentRouting/SRRouting/dependencies/host/tucson.host
@@ -1,16 +1,16 @@
{
"onos":
{
- "a4:23:05:01:a2:f2/None": "10.32.11.2",
- "a4:23:05:01:a2:f3/None": "10.32.11.3",
- "3c:ec:ef:47:b6:09/None": "10.32.11.254",
- "66:72:77:60:68:a2/None": "10.32.11.126"
+ "A4:23:05:01:A2:F2/None": "10.32.11.2",
+ "A4:23:05:01:A2:F3/None": "10.32.11.3",
+ "3C:EC:EF:47:B6:09/None": "10.32.11.194",
+ "66:72:77:60:68:A2/None": "10.32.11.1"
},
"network":
{
"h1": "10.32.11.2",
"h2": "10.32.11.3",
- "h3": "10.32.11.254",
- "mgmt": "10.32.11.126"
+ "h3": "10.32.11.194",
+ "mgmt": "10.32.11.1"
}
}