Merge "Add VLAN Encapsulation test for point to point intents to FUNCintent"
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 5ed20ef..306680e 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1156,7 +1156,7 @@
main.cleanup()
main.exit()
- def addHostIntent( self, hostIdOne, hostIdTwo, vlanId="", setVlan="" ):
+ def addHostIntent( self, hostIdOne, hostIdTwo, vlanId="", setVlan="", encap="" ):
"""
Required:
* hostIdOne: ONOS host id for host1
@@ -1164,6 +1164,7 @@
Optional:
* vlanId: specify a VLAN id for the intent
* setVlan: specify a VLAN id treatment
+ * encap: specify an encapsulation type
Description:
Adds a host-to-host intent ( bidirectional ) by
specifying the two hosts.
@@ -1176,6 +1177,8 @@
cmdStr += "-v " + str( vlanId ) + " "
if setVlan:
cmdStr += "--setVlan " + str( vlanId ) + " "
+ if encap:
+ cmdStr += "--encapsulation " + str( encap ) + " "
cmdStr += str( hostIdOne ) + " " + str( hostIdTwo )
handle = self.sendline( cmdStr )
assert "Command not found:" not in handle, handle
@@ -1274,7 +1277,8 @@
tcpSrc="",
tcpDst="",
vlanId="",
- setVlan="" ):
+ setVlan="",
+ encap="" ):
"""
Required:
* ingressDevice: device id of ingress device
@@ -1293,6 +1297,7 @@
* tcpDst: specify tcp destination port
* vlanId: specify vlan ID
* setVlan: specify a VLAN id treatment
+ * encap: specify an Encapsulation type to use
Description:
Adds a point-to-point intent ( uni-directional ) by
specifying device id's and optional fields
@@ -1330,6 +1335,8 @@
cmd += " -v " + str( vlanId )
if setVlan:
cmd += " --setVlan " + str( setVlan )
+ if encap:
+ cmd += " --encapsulation " + str( encap )
# Check whether the user appended the port
# or provided it as an input
@@ -1411,7 +1418,8 @@
setEthDst="",
vlanId="",
setVlan="",
- partial=False ):
+ partial=False,
+ encap="" ):
"""
Note:
This function assumes the format of all ingress devices
@@ -1438,6 +1446,7 @@
* setEthDst: action to Rewrite Destination MAC Address
* vlanId: specify vlan Id
* setVlan: specify VLAN Id treatment
+ * encap: specify a type of encapsulation
Description:
Adds a multipoint-to-singlepoint intent ( uni-directional ) by
specifying device id's and optional fields
@@ -1481,6 +1490,8 @@
cmd += " --setVlan " + str( setVlan )
if partial:
cmd += " --partial"
+ if encap:
+ cmd += " --encapsulation " + str( encap )
# Check whether the user appended the port
# or provided it as an input
@@ -1566,7 +1577,8 @@
setEthDst="",
vlanId="",
setVlan="",
- partial=False ):
+ partial=False,
+ encap="" ):
"""
Note:
This function assumes the format of all egress devices
@@ -1593,6 +1605,7 @@
* setEthDst: action to Rewrite Destination MAC Address
* vlanId: specify vlan Id
* setVlan: specify VLAN ID treatment
+ * encap: specify an encapsulation type
Description:
Adds a singlepoint-to-multipoint intent ( uni-directional ) by
specifying device id's and optional fields
@@ -1636,6 +1649,8 @@
cmd += " --setVlan " + str( setVlan )
if partial:
cmd += " --partial"
+ if encap:
+ cmd += " --encapsulation " + str( encap )
# 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 5bcfe62..5ee3f70 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -929,6 +929,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,
@@ -1317,6 +1347,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 ):
@@ -1582,6 +1647,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 ):
@@ -1848,6 +1955,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 0164c68..89695a2 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:
@@ -306,7 +308,8 @@
ipDst="",
tcpSrc="",
tcpDst="",
- setVlan=""):
+ setVlan="",
+ encap="" ):
"""
Installs a Single to Single Point Intent
@@ -395,7 +398,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:
@@ -714,7 +718,8 @@
sw1="",
sw2="",
setVlan="",
- partial=False ):
+ partial=False,
+ encap="" ):
"""
Installs a Single to Multi Point Intent
@@ -803,7 +808,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:
@@ -839,7 +845,8 @@
sw1="",
sw2="",
setVlan="",
- partial=False ):
+ partial=False,
+ encap="" ):
"""
Installs a Multi to Single Point Intent
@@ -927,7 +934,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:
@@ -1107,7 +1115,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'