Add VLAN Encapsulation test for point to point intents to FUNCintent
Change-Id: Ia8b7195022502a0c6e2cd6e30d729dba533e999c
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 167a847..22fcf3c 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -928,6 +928,36 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString)
+ main.step( "Encapsulation: Add host intents between h1 and h9" )
+ main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
+ host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
+ host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
+ testResult = main.FALSE
+ installResult = main.FALSE
+ installResult = main.intentFunction.installHostIntent( main,
+ name='ENCAPSULATION',
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ encap="VLAN" )
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='ENCAPSULATION',
+ 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,
@@ -1316,6 +1346,41 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ main.step( "Add point to point intents using VLAN Encapsulation" )
+ main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
+ senders = [
+ { "name":"h1","device":"of:0000000000000005/1" }
+ ]
+ recipients = [
+ { "name":"h9","device":"of:0000000000000006/1" }
+ ]
+ testResult = main.FALSE
+ installResult = main.FALSE
+ installResult = main.intentFunction.installPointIntent(
+ main,
+ name="ENCAPSULATION",
+ senders=senders,
+ recipients=recipients,
+ encap="VLAN" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="ENCAPSULATION",
+ senders=senders,
+ recipients=recipients,
+ 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.intentFunction.report( main )
def CASE3000( self, main ):
@@ -1581,6 +1646,48 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
+ main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
+ senders = [
+ { "name":"h8", "device":"of:0000000000000005/8" }
+ ]
+ recipients = [
+ { "name":"h16", "device":"of:0000000000000006/8" },
+ { "name":"h24", "device":"of:0000000000000007/8" }
+ ]
+ badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
+ badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
+ testResult = main.FALSE
+ installResult = main.FALSE
+ installResult = main.intentFunction.installSingleToMultiIntent(
+ main,
+ name="ENCAPSULATION",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ encap="VLAN" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="ENCAPSULATION",
+ senders=senders,
+ recipients=recipients,
+ badSenders=badSenders,
+ badRecipients=badRecipients,
+ 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.intentFunction.report( main )
def CASE4000( self, main ):
@@ -1847,6 +1954,48 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ main.step( "ENCAPSULATION: Add multi point to single point intents" )
+ main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
+ senders = [
+ { "name":"h16", "device":"of:0000000000000006/8" },
+ { "name":"h24", "device":"of:0000000000000007/8" }
+ ]
+ recipients = [
+ { "name":"h8", "device":"of:0000000000000005/8" }
+ ]
+ badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
+ badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
+ testResult = main.FALSE
+ installResult = main.FALSE
+ installResult = main.intentFunction.installMultiToSingleIntent(
+ main,
+ name="ENCAPSULATION",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ encap="VLAN" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="ENCAPSULATION",
+ senders=senders,
+ recipients=recipients,
+ badSenders=badSenders,
+ badRecipients=badRecipients,
+ 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.intentFunction.report( main )
def CASE5000( self, main ):
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 5b4bee1..cbf783f 100755
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -23,7 +23,8 @@
tcp="",
sw1="",
sw2="",
- setVlan="" ):
+ setVlan="",
+ encap="" ):
"""
Installs a Host Intent
@@ -80,7 +81,8 @@
intentId = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
hostIdTwo=host2.get( "id" ),
vlanId=vlanId,
- setVlan=setVlan )
+ setVlan=setVlan,
+ encap=encap )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -299,7 +301,8 @@
ipDst="",
tcpSrc="",
tcpDst="",
- setVlan=""):
+ setVlan="",
+ encap="" ):
"""
Installs a Single to Single Point Intent
@@ -388,7 +391,8 @@
tcpSrc=tcpSrc,
tcpDst=tcpDst,
vlanId=vlanId,
- setVlan=setVlan )
+ setVlan=setVlan,
+ encap=encap )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -700,7 +704,8 @@
sw1="",
sw2="",
setVlan="",
- partial=False ):
+ partial=False,
+ encap="" ):
"""
Installs a Single to Multi Point Intent
@@ -789,7 +794,8 @@
tcpDst="",
vlanId=vlanId,
setVlan=setVlan,
- partial=partial )
+ partial=partial,
+ encap=encap )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -818,7 +824,8 @@
sw1="",
sw2="",
setVlan="",
- partial=False ):
+ partial=False,
+ encap="" ):
"""
Installs a Multi to Single Point Intent
@@ -906,7 +913,8 @@
tcpDst="",
vlanId=vlanId,
setVlan=setVlan,
- partial=partial )
+ partial=partial,
+ encap=encap )
except (KeyError, TypeError):
errorMsg = "There was a problem loading the hosts data."
if intentId:
@@ -1079,7 +1087,7 @@
testResult = main.FALSE
# Check flows count in each node
- if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ):
+ if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=5 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=5 ):
main.assertReturnString += 'Link Down Flow State Passed\n'
else:
main.assertReturnString += 'Link Down Flow State Failed\n'