Refactor VLAN intent tests to actually use VLAN selectors
Change-Id: I07b05cd211c0674a344082878178b2e5dacbe18b
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