Merge "Print clusters on failed assert"
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 50e4847..1b7c8fd 100644
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -75,7 +75,7 @@
main.log.exception( "Error parsing jsonObject" )
return None
- def send( self, url, base="/onos/v1", method="GET",
+ def send( self, url, ip = "DEFAULT", port = "DEFAULT", base="/onos/v1", method="GET",
query=None, data=None, debug=False ):
"""
Arguments:
@@ -94,8 +94,13 @@
# TODO: should we maybe just pass kwargs straight to response?
# TODO: Do we need to allow for other protocols besides http?
# ANSWER: Not yet, but potentially https with certificates
- ip = self.ip_address
- port = self.port
+ if ip == "DEFAULT":
+ main.log.warn( "No ip given, reverting to ip from topo file" )
+ ip = self.ip_address
+ if port == "DEFAULT":
+ main.log.warn( "No port given, reverting to port " +
+ "from topo file" )
+ port = self.port
try:
path = "http://" + str( ip ) + ":" + str( port ) + base + url
@@ -140,7 +145,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/intents" )
+ response = self.send( url="/intents", ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -188,7 +193,7 @@
port = self.port
# NOTE: REST url requires the intent id to be in decimal form
query = "/" + str( appId ) + "/" + str( intentId )
- response = self.send( url="/intents" + query )
+ response = self.send( url="/intents" + query, ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -251,7 +256,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/applications" )
+ response = self.send( url="/applications", ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -295,7 +300,8 @@
port = self.port
query = "/" + str( appName ) + "/active"
response = self.send( method="POST",
- url="/applications" + query )
+ url="/applications" + query,
+ ip = ip, port = port)
if response:
output = response[ 1 ]
app = json.loads( output )
@@ -351,7 +357,8 @@
port = self.port
query = "/" + str( appName ) + "/active"
response = self.send( method="DELETE",
- url="/applications" + query )
+ url="/applications" + query,
+ ip = ip, port = port )
if response:
output = response[ 1 ]
app = json.loads( output )
@@ -404,7 +411,8 @@
"from topo file" )
port = self.port
query = "/" + project + str( appName )
- response = self.send( url="/applications" + query )
+ response = self.send( url="/applications" + query,
+ ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -455,7 +463,7 @@
"from topo file" )
port = self.port
response = self.send( method="POST",
- url="/intents",
+ url="/intents", ip = ip, port = port,
data=json.dumps( intentJson ) )
if response:
if 201:
@@ -605,7 +613,7 @@
"from topo file" )
port = self.port
response = self.send( method="POST",
- url="/intents",
+ url="/intents", ip = ip, port = port,
data=json.dumps( intentJson ) )
if response:
if 201:
@@ -644,7 +652,7 @@
# NOTE: REST url requires the intent id to be in decimal form
query = "/" + str( appId ) + "/" + str( int( intentId, 16 ) )
response = self.send( method="DELETE",
- url="/intents" + query )
+ url="/intents" + query, ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
return main.TRUE
@@ -744,7 +752,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/hosts" )
+ response = self.send( url="/hosts", ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -790,7 +798,7 @@
"from topo file" )
port = self.port
query = "/" + mac + "/" + vlan
- response = self.send( url="/hosts" + query )
+ response = self.send( url="/hosts" + query, ip = ip, port = port )
if response:
# NOTE: What if the person wants other values? would it be better
# to have a function that gets a key and return a value instead?
@@ -829,7 +837,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/topology" )
+ response = self.send( url="/topology", ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -866,7 +874,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/devices" )
+ response = self.send( url="/devices", ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -1029,7 +1037,7 @@
main.log.warn( "No port given, reverting to port " +
"from topo file" )
port = self.port
- response = self.send( url="/flows" )
+ response = self.send( url="/flows", ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -1072,7 +1080,7 @@
if flowId:
url += "/" + str( int( flowId ) )
print url
- response = self.send( url=url )
+ response = self.send( url=url, ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -1121,7 +1129,7 @@
port = self.port
url = "/flows/" + deviceId
response = self.send( method="POST",
- url=url,
+ url=url, ip = ip, port = port,
data=json.dumps( flowJson ) )
if response:
if 201:
@@ -1288,7 +1296,7 @@
# NOTE: REST url requires the intent id to be in decimal form
query = "/" + str( deviceId ) + "/" + str( int( flowId ) )
response = self.send( method="DELETE",
- url="/flows" + query )
+ url="/flows" + query, ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
return main.TRUE
@@ -1358,7 +1366,7 @@
url += "/" + subjectKey
if configKey:
url += "/" + configKey
- response = self.send( url=url )
+ response = self.send( url=url, ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
output = response[ 1 ]
@@ -1409,7 +1417,7 @@
if configKey:
url += "/" + configKey
response = self.send( method="POST",
- url=url,
+ url=url, ip = ip, port = port,
data=json.dumps( cfgJson ) )
if response:
if 200 <= response[ 0 ] <= 299:
@@ -1455,7 +1463,7 @@
if configKey:
url += "/" + configKey
response = self.send( method="DELETE",
- url=url )
+ url=url, ip = ip, port = port )
if response:
if 200 <= response[ 0 ] <= 299:
main.log.info( self.name + ": Successfully delete cfg" )
@@ -1659,7 +1667,7 @@
port = self.port
url = "/flows/"
response = self.send( method="POST",
- url=url,
+ url=url, ip = ip, port = port,
data=json.dumps( batch ) )
#main.log.info("Post response is: ", str(response[0]))
if response[0] == 200:
@@ -1702,7 +1710,7 @@
# NOTE: REST url requires the intent id to be in decimal form
response = self.send( method="DELETE",
- url="/flows/",
+ url="/flows/", ip = ip, port = port,
data = json.dumps(batch) )
if response:
if 200 <= response[ 0 ] <= 299:
diff --git a/TestON/drivers/common/api/dockerapidriver.py b/TestON/drivers/common/api/dockerapidriver.py
index 2c1520d..4a874c6 100644
--- a/TestON/drivers/common/api/dockerapidriver.py
+++ b/TestON/drivers/common/api/dockerapidriver.py
@@ -251,7 +251,7 @@
command = "{}/onos-form-cluster -u {} -p {} {}".format( cmdPath,
user,
passwd,
- onosIps )
+ onosIPs )
result = subprocess.call( command, shell=True )
if result == 0:
return main.TRUE
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index d5777f9..7e5cb3c 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1115,11 +1115,13 @@
main.cleanup()
main.exit()
- def addHostIntent( self, hostIdOne, hostIdTwo ):
+ def addHostIntent( self, hostIdOne, hostIdTwo, vlanId="" ):
"""
Required:
* hostIdOne: ONOS host id for host1
* hostIdTwo: ONOS host id for host2
+ Optional:
+ * vlanId: specify a VLAN id for the intent
Description:
Adds a host-to-host intent ( bidirectional ) by
specifying the two hosts.
@@ -1127,8 +1129,10 @@
A string of the intent id or None on Error
"""
try:
- cmdStr = "add-host-intent " + str( hostIdOne ) +\
- " " + str( hostIdTwo )
+ cmdStr = "add-host-intent "
+ if vlanId:
+ cmdStr += "-v " + str( vlanId ) + " "
+ cmdStr += str( hostIdOne ) + " " + str( hostIdTwo )
handle = self.sendline( cmdStr )
assert "Command not found:" not in handle, handle
if re.search( "Error", handle ):
@@ -1224,7 +1228,8 @@
ipSrc="",
ipDst="",
tcpSrc="",
- tcpDst="" ):
+ tcpDst="",
+ vlanId="" ):
"""
Required:
* ingressDevice: device id of ingress device
@@ -1241,6 +1246,7 @@
* ipDst: specify ip destination address
* tcpSrc: specify tcp source port
* tcpDst: specify tcp destination port
+ * vlanId: specify vlan ID
Description:
Adds a point-to-point intent ( uni-directional ) by
specifying device id's and optional fields
@@ -1282,6 +1288,8 @@
cmd += " --tcpSrc " + str( tcpSrc )
if tcpDst:
cmd += " --tcpDst " + str( tcpDst )
+ if vlanId:
+ cmd += " -v " + str( vlanId )
# Check whether the user appended the port
# or provided it as an input
@@ -1360,7 +1368,8 @@
tcpSrc="",
tcpDst="",
setEthSrc="",
- setEthDst="" ):
+ setEthDst="",
+ vlanId="" ):
"""
Note:
This function assumes the format of all ingress devices
@@ -1385,6 +1394,7 @@
* tcpDst: specify tcp destination port
* setEthSrc: action to Rewrite Source MAC Address
* setEthDst: action to Rewrite Destination MAC Address
+ * vlanId: specify vlan Id
Description:
Adds a multipoint-to-singlepoint intent ( uni-directional ) by
specifying device id's and optional fields
@@ -1431,6 +1441,8 @@
cmd += " --setEthSrc " + str( setEthSrc )
if setEthDst:
cmd += " --setEthDst " + str( setEthDst )
+ if vlanId:
+ cmd += " -v " + str( vlanId )
# Check whether the user appended the port
# or provided it as an input
@@ -1513,7 +1525,8 @@
tcpSrc="",
tcpDst="",
setEthSrc="",
- setEthDst="" ):
+ setEthDst="",
+ vlanId="" ):
"""
Note:
This function assumes the format of all egress devices
@@ -1538,6 +1551,7 @@
* tcpDst: specify tcp destination port
* setEthSrc: action to Rewrite Source MAC Address
* setEthDst: action to Rewrite Destination MAC Address
+ * vlanId: specify vlan Id
Description:
Adds a singlepoint-to-multipoint intent ( uni-directional ) by
specifying device id's and optional fields
@@ -1584,6 +1598,8 @@
cmd += " --setEthSrc " + str( setEthSrc )
if setEthDst:
cmd += " --setEthDst " + str( setEthDst )
+ if vlanId:
+ cmd += " -v " + str( vlanId )
# Check whether the user appended the port
# or provided it as an input
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 080aa8f..1bff0f1 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -836,8 +836,8 @@
main.step( "VLAN1: Add vlan host intents between h4 and h12" )
main.assertReturnString = "Assertion Result vlan IPV4\n"
- host1 = { "name":"h4","id":"00:00:00:00:00:04/100" }
- host2 = { "name":"h12","id":"00:00:00:00:00:0C/100 "}
+ host1 = { "name":"h4","id":"00:00:00:00:00:04/100", "vlan":"100" }
+ host2 = { "name":"h12","id":"00:00:00:00:00:0C/100", "vlan":"100" }
testResult = main.FALSE
installResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
@@ -864,36 +864,6 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString)
- main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
- main.assertReturnString = "Assertion Result different VLAN negative test\n"
- host1 = { "name":"h13" }
- host2 = { "name":"h20" }
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installHostIntent( main,
- name='VLAN2',
- onosNode='0',
- host1=host1,
- host2=host2)
-
- if installResult:
- testResult = main.intentFunction.testHostIntent( main,
- name='VLAN2',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1='s5',
- sw2='s2',
- expectedLink = 18)
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString)
-
main.step( "Confirm that ONOS leadership is unchanged")
intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
main.intentFunction.checkLeaderChange( intentLeadersOld,
@@ -1184,25 +1154,24 @@
main.step( "VLAN: Add point intents between h5 and h21" )
main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
senders = [
- { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" }
+ { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05", "vlan":"200" }
]
recipients = [
- { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" }
+ { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15", "vlan":"200" }
]
testResult = main.FALSE
installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
- name="DUALSTACK1",
+ name="VLAN",
senders=senders,
- recipients=recipients,
- ethType="IPV4" )
+ recipients=recipients)
if installResult:
testResult = main.intentFunction.testPointIntent(
main,
intentId=installResult,
- name="DUALSTACK1",
+ name="VLAN",
senders=senders,
recipients=recipients,
sw1="s5",
@@ -1434,11 +1403,11 @@
main.step( "VLAN: Add single point to multi point intents" )
main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses in the same VLAN\n"
senders = [
- { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" }
+ { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04", "vlan":"100" }
]
recipients = [
- { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" },
- { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" }
+ { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" },
+ { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14", "vlan":"100" }
]
badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
@@ -1446,10 +1415,9 @@
installResult = main.FALSE
installResult = main.intentFunction.installSingleToMultiIntent(
main,
- name="IPV4",
+ name="VLAN`",
senders=senders,
recipients=recipients,
- ethType="IPV4",
sw1="s5",
sw2="s2")
@@ -1457,7 +1425,7 @@
testResult = main.intentFunction.testPointIntent(
main,
intentId=installResult,
- name="IPV4",
+ name="VLAN",
senders=senders,
recipients=recipients,
badSenders=badSenders,
@@ -1658,11 +1626,11 @@
main.step( "VLAN: Add multi point to single point intents" )
main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses in the same VLAN\n"
senders = [
- { "name":"h13", "device":"of:0000000000000006/5" },
- { "name":"h21", "device":"of:0000000000000007/5" }
+ { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" },
+ { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" }
]
recipients = [
- { "name":"h5", "device":"of:0000000000000005/5" }
+ { "name":"h5", "device":"of:0000000000000005/5", "vlan":"200" }
]
badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
@@ -1673,7 +1641,6 @@
name="VLAN",
senders=senders,
recipients=recipients,
- ethType="IPV4",
sw1="s5",
sw2="s2")
@@ -1863,156 +1830,8 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.step( "IPV4: Add multi point to single point intents" )
- main.assertReturnString = "Assertion results for IPV4 multi to single \
- point intent end point failure with IPV4 type and MAC addresses\n"
- senders = [
- { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
- { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
- ]
- recipients = [
- { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" }
- ]
- isolatedSenders = [
- { "name":"h24"}
- ]
- isolatedRecipients = []
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
- main,
- name="IPV4",
- senders=senders,
- recipients=recipients,
- ethType="IPV4",
- sw1="s5",
- sw2="s2")
-
- if installResult:
- testResult = main.intentFunction.testEndPointFail(
- main,
- intentId=installResult,
- name="IPV4",
- senders=senders,
- recipients=recipients,
- isolatedSenders=isolatedSenders,
- isolatedRecipients=isolatedRecipients,
- sw1="s6",
- sw2="s2",
- sw3="s4",
- sw4="s1",
- sw5="s3",
- expectedLink1=16,
- expectedLink2=14 )
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "IPV4_2: Add multi point to single point intents" )
- main.assertReturnString = "Assertion results for IPV4 multi to single \
- point intent end point failure with IPV4 type and no MAC addresses\n"
- senders = [
- { "name":"h16", "device":"of:0000000000000006/8" },
- { "name":"h24", "device":"of:0000000000000007/8" }
- ]
- recipients = [
- { "name":"h8", "device":"of:0000000000000005/8" }
- ]
- isolatedSenders = [
- { "name":"h24"}
- ]
- isolatedRecipients = []
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
- main,
- name="IPV4_2",
- senders=senders,
- recipients=recipients,
- ethType="IPV4",
- sw1="s5",
- sw2="s2")
-
- if installResult:
- testResult = main.intentFunction.testEndPointFail(
- main,
- intentId=installResult,
- name="IPV4_2",
- senders=senders,
- recipients=recipients,
- isolatedSenders=isolatedSenders,
- isolatedRecipients=isolatedRecipients,
- sw1="s6",
- sw2="s2",
- sw3="s4",
- sw4="s1",
- sw5="s3",
- expectedLink1=16,
- expectedLink2=14 )
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "VLAN: Add multi point to single point intents" )
- main.assertReturnString = "Assertion results for IPV4 multi to single \
- point intent end point failure with IPV4 type and no MAC addresses in the same VLAN\n"
- senders = [
- { "name":"h13", "device":"of:0000000000000006/5" },
- { "name":"h21", "device":"of:0000000000000007/5" }
- ]
- recipients = [
- { "name":"h5", "device":"of:0000000000000005/5" }
- ]
- isolatedSenders = [
- { "name":"h21"}
- ]
- isolatedRecipients = []
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installMultiToSingleIntent(
- main,
- name="VLAN",
- senders=senders,
- recipients=recipients,
- ethType="IPV4",
- sw1="s5",
- sw2="s2")
-
- if installResult:
- testResult = main.intentFunction.testEndPointFail(
- main,
- intentId=installResult,
- name="VLAN",
- senders=senders,
- recipients=recipients,
- isolatedSenders=isolatedSenders,
- isolatedRecipients=isolatedRecipients,
- sw1="s6",
- sw2="s2",
- sw3="s4",
- sw4="s1",
- sw5="s3",
- expectedLink1=16,
- expectedLink2=14 )
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
main.step( "NOOPTION: Install and test single point to multi point intents" )
- main.assertReturnString = "Assertion results for IPV4 single to multi \
- point intent end point failure with no options set\n"
+ main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
senders = [
{ "name":"h8", "device":"of:0000000000000005/8" }
]
@@ -2020,9 +1839,8 @@
{ "name":"h16", "device":"of:0000000000000006/8" },
{ "name":"h24", "device":"of:0000000000000007/8" }
]
- isolatedSenders = []
- isolatedRecipients = [
- { "name":"h24" }
+ isolatedSenders = [
+ { "name":"h24"}
]
testResult = main.FALSE
installResult = main.FALSE
@@ -2058,151 +1876,4 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.step( "IPV4: Install and test single point to multi point intents" )
- main.assertReturnString = "Assertion results for IPV4 single to multi \
- point intent end point failure with IPV4 type and no MAC addresses\n"
- senders = [
- { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
- ]
- recipients = [
- { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
- { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
- ]
- isolatedSenders = []
- isolatedRecipients = [
- { "name":"h24" }
- ]
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
- main,
- name="IPV4",
- senders=senders,
- recipients=recipients,
- ethType="IPV4",
- sw1="s5",
- sw2="s2")
-
- if installResult:
- testResult = main.intentFunction.testEndPointFail(
- main,
- intentId=installResult,
- name="IPV4",
- senders=senders,
- recipients=recipients,
- isolatedSenders=isolatedSenders,
- isolatedRecipients=isolatedRecipients,
- sw1="s6",
- sw2="s2",
- sw3="s4",
- sw4="s1",
- sw5="s3",
- expectedLink1=16,
- expectedLink2=14 )
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "IPV4_2: Add single point to multi point intents" )
- main.assertReturnString = "Assertion results for IPV4 single to multi\
- point intent endpoint failure with IPV4 type and no MAC addresses\n"
- senders = [
- { "name":"h8", "device":"of:0000000000000005/8" }
- ]
- recipients = [
- { "name":"h16", "device":"of:0000000000000006/8" },
- { "name":"h24", "device":"of:0000000000000007/8" }
- ]
- isolatedSenders = []
- isolatedRecipients = [
- { "name":"h24" }
- ]
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
- main,
- name="IPV4_2",
- senders=senders,
- recipients=recipients,
- ethType="IPV4",
- sw1="s5",
- sw2="s2")
-
- if installResult:
- testResult = main.intentFunction.testEndPointFail(
- main,
- intentId=installResult,
- name="IPV4_2",
- senders=senders,
- recipients=recipients,
- isolatedSenders=isolatedSenders,
- isolatedRecipients=isolatedRecipients,
- sw1="s6",
- sw2="s2",
- sw3="s4",
- sw4="s1",
- sw5="s3",
- expectedLink1=16,
- expectedLink2=14 )
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
- main.step( "VLAN: Add single point to multi point intents" )
- main.assertReturnString = "Assertion results for IPV4 single to multi point\
- intent endpoint failure with IPV4 type and MAC addresses in the same VLAN\n"
- senders = [
- { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" }
- ]
- recipients = [
- { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" },
- { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" }
- ]
- isolatedSenders = []
- isolatedRecipients = [
- { "name":"h20" }
- ]
- testResult = main.FALSE
- installResult = main.FALSE
- installResult = main.intentFunction.installSingleToMultiIntent(
- main,
- name="IPV4",
- senders=senders,
- recipients=recipients,
- ethType="IPV4",
- sw1="s5",
- sw2="s2")
-
- if installResult:
- testResult = main.intentFunction.testEndPointFail(
- main,
- intentId=installResult,
- name="IPV4",
- senders=senders,
- recipients=recipients,
- isolatedSenders=isolatedSenders,
- isolatedRecipients=isolatedRecipients,
- sw1="s6",
- sw2="s2",
- sw3="s4",
- sw4="s1",
- sw5="s3",
- expectedLink1=16,
- expectedLink2=14 )
- else:
- main.CLIs[ 0 ].removeAllIntents( purge=True )
-
- utilities.assert_equals( expect=main.TRUE,
- actual=testResult,
- onpass=main.assertReturnString,
- onfail=main.assertReturnString )
-
main.intentFunction.report( main )
\ No newline at end of file
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 88a0cad..dede2c8 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -22,7 +22,7 @@
ipAddresses="",
tcp="",
sw1="",
- sw2=""):
+ sw2="" ):
"""
Installs a Host Intent
@@ -75,8 +75,10 @@
host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "id" )
# Adding point intent
+ vlanId = host1.get( "vlan" )
intentId = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
- hostIdTwo=host2.get( "id" ) )
+ hostIdTwo=host2.get( "id" ),
+ vlanId=vlanId )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -168,6 +170,7 @@
senderNames = [ host1.get( "name" ), host2.get( "name" ) ]
recipientNames = [ host1.get( "name" ), host2.get( "name" ) ]
+ vlanId = host1.get( "vlan" )
testResult = main.TRUE
except (KeyError, TypeError):
@@ -191,7 +194,7 @@
testResult = main.FALSE
# Check Connectivity
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
main.assertReturnString += 'Initial Ping Passed\n'
else:
main.assertReturnString += 'Initial Ping Failed\n'
@@ -228,7 +231,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
main.assertReturnString += 'Link Down Pingall Passed\n'
else:
main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -266,7 +269,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
main.assertReturnString += 'Link Up Pingall Passed\n'
else:
main.assertReturnString += 'Link Up Pingall Failed\n'
@@ -364,6 +367,8 @@
ipSrc = senders[ 0 ].get( "ip" )
ipDst = recipients[ 0 ].get( "ip" )
+ vlanId = senders[ 0 ].get( "vlan" )
+
# Adding point intent
intentId = main.CLIs[ onosNode ].addPointIntent(
ingressDevice=ingressDevice,
@@ -378,7 +383,8 @@
ipSrc=ipSrc,
ipDst=ipDst,
tcpSrc=tcpSrc,
- tcpDst=tcpDst )
+ tcpDst=tcpDst,
+ vlanId=vlanId )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -758,6 +764,7 @@
portEgressList = None
srcMac = senders[ 0 ].get( "mac" )
+ vlanId = senders[ 0 ].get( "vlan" )
# Adding point intent
intentId = main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
@@ -773,7 +780,8 @@
ipSrc="",
ipDst="",
tcpSrc="",
- tcpDst="" )
+ tcpDst="",
+ vlanId=vlanId )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -869,6 +877,7 @@
portIngressList = None
dstMac = recipients[ 0 ].get( "mac" )
+ vlanId = senders[ 0 ].get( "vlan" )
# Adding point intent
intentId = main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
@@ -884,7 +893,8 @@
ipSrc="",
ipDst="",
tcpSrc="",
- tcpDst="" )
+ tcpDst="",
+ vlanId=vlanId )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -993,6 +1003,7 @@
if not recipient.get( "device" ):
main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+ vlanId = senders[ 0 ].get( "vlan" )
except (KeyError, TypeError):
main.log.error( "There was a problem loading the hosts data." )
return main.FALSE
@@ -1015,7 +1026,7 @@
testResult = main.FALSE
# Check Connectivity
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ), attempts=3, sleep=5 ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ), attempts=3, sleep=5 ):
main.assertReturnString += 'Initial Ping Passed\n'
else:
main.assertReturnString += 'Initial Ping Failed\n'
@@ -1069,7 +1080,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
main.assertReturnString += 'Link Down Pingall Passed\n'
else:
main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -1107,7 +1118,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
else:
main.assertReturnString += 'Link Up Scapy Packet Recieved Failed\n'
@@ -1292,7 +1303,7 @@
# Check Connectivity
# First check connectivity of any isolated senders to recipients
if isolatedSenderNames:
- if scapyCheckConnection( main, isolatedSenderNames, recipientNames, None, None, main.TRUE ):
+ if scapyCheckConnection( main, isolatedSenderNames, recipientNames, None, None, None, main.TRUE ):
main.assertReturnString += 'Isolation link Down Connectivity Check Passed\n'
else:
main.assertReturnString += 'Isolation link Down Connectivity Check Failed\n'
@@ -1300,7 +1311,7 @@
# Next check connectivity of senders to any isolated recipients
if isolatedRecipientNames:
- if scapyCheckConnection( main, senderNames, isolatedRecipientNames, None, None, main.TRUE ):
+ if scapyCheckConnection( main, senderNames, isolatedRecipientNames, None, None, None, main.TRUE ):
main.assertReturnString += 'Isolation link Down Connectivity Check Passed\n'
else:
main.assertReturnString += 'Isolation link Down Connectivity Check Failed\n'
@@ -1592,7 +1603,7 @@
linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
return linkResult
-def scapyCheckConnection( main, senders, recipients, packet=None, packetFilter=None, expectFailure=False ):
+def scapyCheckConnection( main, senders, recipients, vlanId=None, packet=None, packetFilter=None, expectFailure=False ):
"""
Checks the connectivity between all given sender hosts and all given recipient hosts
Packet may be specified. Defaults to Ether/IP packet
@@ -1631,17 +1642,31 @@
connectionsFunctional = main.FALSE
continue
- recipientComp.startFilter( pktFilter = packetFilter.format( senderComp.hostMac ) )
+ if vlanId:
+ recipientComp.startFilter( pktFilter = ( "vlan {}".format( vlanId ) + " && " + packetFilter.format( senderComp.hostMac ) ) )
+ else:
+ recipientComp.startFilter( pktFilter = packetFilter.format( senderComp.hostMac ) )
if not packet:
- pkt = 'Ether( src="{0}", dst="{2}" )/IP( src="{1}", dst="{3}" )'.format(
- senderComp.hostMac,
- senderComp.hostIp,
- recipientComp.hostMac,
- recipientComp.hostIp )
+ if vlanId:
+ pkt = 'Ether( src="{0}", dst="{2}" )/Dot1Q(vlan={4})/IP( src="{1}", dst="{3}" )'.format(
+ senderComp.hostMac,
+ senderComp.hostIp,
+ recipientComp.hostMac,
+ recipientComp.hostIp,
+ vlanId )
+ else:
+ pkt = 'Ether( src="{0}", dst="{2}" )/IP( src="{1}", dst="{3}" )'.format(
+ senderComp.hostMac,
+ senderComp.hostIp,
+ recipientComp.hostMac,
+ recipientComp.hostIp )
else:
pkt = packet
- senderComp.sendPacket( packet = pkt )
+ if vlanId:
+ senderComp.sendPacket( iface=( "{0}-eth0.{1}".format( sender, vlanId ) ), packet = pkt )
+ else:
+ senderComp.sendPacket( packet = pkt )
if recipientComp.checkFilter( timeout ):
if expectFailure:
diff --git a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
index 6e4acda..7133931 100755
--- a/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
+++ b/TestON/tests/PLAT/PLATdockertest/PLATdockertest.py
@@ -163,7 +163,7 @@
main.ONOSbenchDocker.onosFormCluster(cmdPath = clcmdpath, onosIPs=IPlist, user=dkruser, passwd = dkrpasswd)
main.log.info("Wait for cluster to form with sleep time of " + str(startupSleep))
time.sleep(startupSleep)
- status, response = main.ONOSbenchRest.send(ip=IPlist[0],port=8181, url="/cluster")
+ status, response = main.ONOSbenchRest.send(ip=IPlist[0], port=8181, url="/cluster")
main.log.debug("Rest call response: " + str(status) + " - " + response)
if status == 200:
jrsp = json.loads(response)