Merge "add new time variable to record the time from the last of switch connection to the end"
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.params b/TestON/tests/FUNC/FUNCintent/FUNCintent.params
index 7af98ee..88e8956 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.params
@@ -47,7 +47,7 @@
<startup>15</startup>
<reroute>5</reroute>
<removeintent>10</removeintent>
- <checkintent>5</checkintent>
+ <checkintent>10</checkintent>
<fwd>10</fwd>
<topoAttempts>3</topoAttempts>
<flowDuration>10</flowDuration>
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index 6b690d9..b7a4a65 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -6,7 +6,6 @@
self.default = ''
def CASE1( self, main ):
- import time
import imp
import re
@@ -133,7 +132,7 @@
- Install ONOS cluster
- Connect to cli
"""
-
+ import time
main.cycle += 1
# main.scale[ 0 ] determines the current number of ONOS controller
@@ -439,7 +438,6 @@
main.caseExplanation = "Assign OF " + main.OFProtocol +\
" switches to ONOS nodes"
- assignResult = main.TRUE
switchList = []
# Creates a list switch name, use getSwitch() function later...
@@ -452,7 +450,7 @@
assignResult = main.Mininet1.assignSwController( sw=switchList,
ip=tempONOSip,
- port='6653' )
+ port="6653" )
if not assignResult:
main.log.error( "Problem assigning mastership of switches" )
main.initialized = main.FALSE
@@ -484,7 +482,6 @@
main.skipCase()
main.case( "Create scapy components" )
main.step( "Create scapy components" )
- import json
scapyResult = main.TRUE
for hostName in main.scapyHostNames:
main.Scapy1.createHostComponent( hostName )
@@ -547,7 +544,6 @@
main.case( "Discover all hosts using scapy" )
main.step( "Send packets from each host to the first host and confirm onos discovery" )
- import collections
if len( main.scapyHosts ) < 1:
main.log.error( "No scapy hosts have been created" )
main.initialized = main.FALSE
@@ -588,7 +584,6 @@
main.case( "Balance mastership of switches" )
main.step( "Balancing mastership of switches" )
- balanceResult = main.FALSE
balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
utilities.assert_equals( expect=main.TRUE,
@@ -710,9 +705,6 @@
- Ping hosts
- Remove intents
"""
- import time
- import json
- import re
if main.initialized == main.FALSE:
main.log.error( "Test components did not start correctly, skipping further tests" )
main.skipCase()
@@ -758,21 +750,20 @@
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='IPV4',
- onosNode='0',
+ name="IPV4",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='IPV4',
+ name="IPV4",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -787,22 +778,21 @@
host1 = { "name":"h3","id":"00:00:00:00:00:03/-1" }
host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1 "}
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='DUALSTACK',
- onosNode='0',
+ name="DUALSTACK",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='DUALSTACK',
+ name="DUALSTACK",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
@@ -815,22 +805,21 @@
host1 = { "name":"h1" }
host2 = { "name":"h11" }
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='DUALSTACK2',
- onosNode='0',
+ name="DUALSTACK2",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='DUALSTACK2',
+ name="DUALSTACK2",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -845,22 +834,21 @@
host1 = { "name":"h1" }
host2 = { "name":"h3" }
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='1HOP',
- onosNode='0',
+ name="1HOP",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='1HOP',
+ name="1HOP",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -875,22 +863,21 @@
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,
- name='VLAN1',
- onosNode='0',
+ name="VLAN1",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='VLAN1',
+ name="VLAN1",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -905,22 +892,21 @@
host1 = { "name":"h5", "vlan":"200" }
host2 = { "name":"h12", "vlan":"100" }
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installHostIntent( main,
- name='VLAN2',
- onosNode='0',
+ name="VLAN2",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='VLAN2',
+ name="VLAN2",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -935,22 +921,21 @@
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',
+ name="ENCAPSULATION",
+ onosNode=0,
host1=host1,
host2=host2,
encap="VLAN" )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='ENCAPSULATION',
+ name="ENCAPSULATION",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
- sw1='s5',
- sw2='s2',
+ sw1="s5",
+ sw2="s2",
expectedLink=18 )
else:
main.CLIs[ 0 ].removeAllIntents( purge=True )
@@ -960,9 +945,39 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ # Testing MPLS would need to update kernel version (Right now is 3.16)
+ # main.step( "Encapsulation: Add host intents between h1 and h9" )
+ # main.assertReturnString = "Assertion Result for MPLS 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.intentFunction.installHostIntent( main,
+ # name="ENCAPSULATION",
+ # onosNode=0,
+ # host1=host1,
+ # host2=host2,
+ # encap="MPLS" )
+ # 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,
+ testResult = main.intentFunction.checkLeaderChange( intentLeadersOld,
intentLeadersNew )
utilities.assert_equals( expect=main.TRUE,
@@ -991,9 +1006,6 @@
- Ping hosts
- Remove intents
"""
- import time
- import json
- import re
if main.initialized == main.FALSE:
main.log.error( "Test components did not start correctly, skipping further tests" )
main.skipCase()
@@ -1042,7 +1054,6 @@
{ "name":"h9","device":"of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="NOOPTION",
@@ -1067,7 +1078,6 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- stepResult = main.TRUE
main.step( "IPV4: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for IPV4 point intent\n"
senders = [
@@ -1077,7 +1087,6 @@
{ "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="IPV4",
@@ -1111,7 +1120,6 @@
{ "name":"h9","device":"of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="IPV4_2",
@@ -1152,7 +1160,6 @@
tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="SDNIP-ICMP",
@@ -1222,7 +1229,6 @@
{ "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="DUALSTACK1",
@@ -1257,7 +1263,6 @@
{ "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="VLAN",
@@ -1289,7 +1294,6 @@
{ "name":"h21", "vlan":"200" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="VLAN2",
@@ -1322,7 +1326,6 @@
{ "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="1HOP IPV4",
@@ -1357,7 +1360,6 @@
{ "name":"h9","device":"of:0000000000000006/1" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installPointIntent(
main,
name="ENCAPSULATION",
@@ -1383,6 +1385,41 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ # Testing MPLS would need to update kernel version (Right now is 3.16)
+ # main.step( "Add point to point intents using MPLS Encapsulation" )
+ # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
+ # senders = [
+ # { "name": "h1", "device": "of:0000000000000005/1" }
+ # ]
+ # recipients = [
+ # { "name": "h9", "device": "of:0000000000000006/1" }
+ # ]
+ # testResult = main.FALSE
+ # installResult = main.intentFunction.installPointIntent(
+ # main,
+ # name="ENCAPSULATION",
+ # senders=senders,
+ # recipients=recipients,
+ # encap="MPLS" )
+ #
+ # 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 ):
@@ -1452,7 +1489,6 @@
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="NOOPTION",
@@ -1493,7 +1529,6 @@
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="IPV4",
@@ -1535,7 +1570,6 @@
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="IPV4_2",
@@ -1577,10 +1611,9 @@
badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installSingleToMultiIntent(
main,
- name="VLAN`",
+ name="VLAN",
senders=senders,
recipients=recipients,
sw1="s5",
@@ -1618,7 +1651,6 @@
badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installSingleToMultiIntent(
main,
name="VLAN2",
@@ -1648,47 +1680,47 @@
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 )
+ # Does not support Single point to multi point encapsulation
+ # 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.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 )
@@ -1759,7 +1791,6 @@
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="NOOPTION",
@@ -1800,7 +1831,6 @@
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="IPV4",
@@ -1842,7 +1872,6 @@
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="IPV4_2",
@@ -1884,7 +1913,6 @@
badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installMultiToSingleIntent(
main,
name="VLAN",
@@ -1926,7 +1954,6 @@
badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installMultiToSingleIntent(
main,
name="VLAN2",
@@ -1968,7 +1995,6 @@
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",
@@ -1998,6 +2024,48 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
+ # Testing MPLS would need to update kernel version (Right now is 3.16)
+ # main.step( "ENCAPSULATION: Add multi point to single point intents" )
+ # main.assertReturnString = "Assertion results for MPLS 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.intentFunction.installMultiToSingleIntent(
+ # main,
+ # name="ENCAPSULATION",
+ # senders=senders,
+ # recipients=recipients,
+ # sw1="s5",
+ # sw2="s2",
+ # encap="MPLS" )
+ #
+ # 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 ):
@@ -2028,9 +2096,9 @@
main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
- main.case( "Test host mobility with host intents " )
+ main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
+ " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
main.step( "Testing host mobility by moving h1 from s5 to s6" )
- h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
main.log.info( "Moving h1 from s5 to s6" )
main.Mininet1.moveHost( "h1","s5","s6" )
@@ -2061,17 +2129,16 @@
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='IPV4 Mobility IPV4',
- onosNode='0',
+ name="IPV4 Mobility IPV4",
+ onosNode=0,
host1=host1,
host2=host2 )
if installResult:
testResult = main.intentFunction.testHostIntent( main,
- name='Host Mobility IPV4',
+ name="Host Mobility IPV4",
intentId = installResult,
- onosNode='0',
+ onosNode=0,
host1=host1,
host2=host2,
sw1="s6",
@@ -2113,11 +2180,11 @@
try:
assert main.numSwitch
except AssertionError:
- main.log.error( "Place the total number of switch topology in "+\
- main.numSwitch )
+ main.log.error( "Place the total number of switch topology in " + main.numSwitch )
main.initialized = main.FALSE
main.skipCase()
- main.case( "Test Multi to Single End Point Failure" )
+ main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
+ " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
main.step( "Installing Multi to Single Point intents with no options set" )
main.assertReturnString = "Assertion results for IPV4 multi to single " +\
"point intent end point failure with no options set\n"
@@ -2129,11 +2196,10 @@
{ "name":"h8", "device":"of:0000000000000005/8" }
]
isolatedSenders = [
- { "name":"h24"}
+ { "name":"h24" }
]
isolatedRecipients = []
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installMultiToSingleIntent(
main,
name="NOOPTION",
@@ -2178,11 +2244,10 @@
{ "name":"h8", "device":"of:0000000000000005/8" }
]
isolatedSenders = [
- { "name":"h24"}
+ { "name":"h24" }
]
isolatedRecipients = []
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installMultiToSingleIntent(
main,
name="NOOPTION",
@@ -2229,10 +2294,9 @@
]
isolatedSenders = []
isolatedRecipients = [
- { "name":"h24"}
+ { "name":"h24" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installSingleToMultiIntent(
main,
name="NOOPTION",
@@ -2278,10 +2342,9 @@
]
isolatedSenders = []
isolatedRecipients = [
- { "name":"h24"}
+ { "name":"h24" }
]
testResult = main.FALSE
- installResult = main.FALSE
installResult = main.intentFunction.installSingleToMultiIntent(
main,
name="NOOPTION",
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 0e563be..1760324 100755
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -63,7 +63,6 @@
global itemName # The name of this run. Used for logs.
itemName = name
- onosNode = int( onosNode )
main.log.info( itemName + ": Adding single point to multi point intents" )
try:
@@ -92,14 +91,23 @@
# Check intents state
if utilities.retry( f=checkIntentState, retValue=main.FALSE,
- args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+ args=( main, [ intentId ] ), sleep=main.checkIntentSleep, attempts=5 ):
main.assertReturnString += 'Install Intent State Passed\n'
+
+ #Check VLAN if test encapsulation
+ if encap != "":
+ if EncapsulatedIntentCheck( main, tag=encap ):
+ main.assertReturnString += 'Encapsulation intents check Passed\n'
+ else:
+ main.assertReturnString += 'Encapsulation intents check failed\n'
+
if flowDuration( main ):
main.assertReturnString += 'Flow duration check Passed\n'
return intentId
else:
main.assertReturnString += 'Flow duration check failed\n'
return main.FALSE
+
else:
main.log.error( "Host Intent did not install correctly" )
main.assertReturnString += 'Install Intent State Failed\n'
@@ -165,8 +173,6 @@
global itemName
itemName = name
- tempHostsData = {}
- onosNode = int( onosNode )
main.log.info( itemName + ": Testing Host Intent" )
@@ -242,7 +248,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ), sleep=5, attempts=5 ):
main.assertReturnString += 'Link Down Pingall Passed\n'
else:
main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -353,7 +359,6 @@
global itemName # The name of this run. Used for logs.
itemName = name
- onosNode = int( onosNode )
main.log.info( itemName + ": Adding point to point intents" )
@@ -409,8 +414,15 @@
# Check intents state
if utilities.retry( f=checkIntentState, retValue=main.FALSE,
- args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
+ args=( main, [ intentId ] ), sleep=main.checkIntentSleep, attempts=5 ):
main.assertReturnString += 'Install Intent State Passed\n'
+
+ # Check VLAN if test encapsulation
+ if encap != "":
+ if EncapsulatedIntentCheck( main, tag=encap ):
+ main.assertReturnString += 'Encapsulation intents check Passed\n'
+ else:
+ main.assertReturnString += 'Encapsulation intents check failed\n'
if flowDuration( main ):
main.assertReturnString += 'Flow duration check Passed\n'
return intentId
@@ -502,17 +514,11 @@
itemName = name
host1 = host1
host2 = host2
- hostNames = [ host1, host2 ]
intentsId = []
iperfResult = main.TRUE
- intentResult = main.TRUE
- removeIntentResult = main.TRUE
- flowResult = main.TRUE
- topoResult = main.TRUE
linkDownResult = main.TRUE
linkUpResult = main.TRUE
- onosNode = int( onosNode )
# Adding bidirectional point intents
main.log.info( itemName + ": Adding point intents" )
@@ -650,7 +656,7 @@
# link up
linkUpResult = link( main, sw1, sw2, "up" )
- if linkUpTemp:
+ if linkUpResult:
main.assertReturnString += 'Link Up Passed\n'
else:
main.assertReturnString += 'Link Up Failed\n'
@@ -764,7 +770,6 @@
global itemName # The name of this run. Used for logs.
itemName = name
- onosNode = int( onosNode )
main.log.info( itemName + ": Adding single point to multi point intents" )
@@ -891,7 +896,6 @@
global itemName # The name of this run. Used for logs.
itemName = name
- onosNode = int( onosNode )
main.log.info( itemName + ": Adding mutli to single point intents" )
@@ -1031,8 +1035,6 @@
global itemName
itemName = name
- tempHostsData = {}
- onosNode = int( onosNode )
main.log.info( itemName + ": Testing Point Intent" )
@@ -1129,7 +1131,7 @@
testResult = main.FALSE
# Check Connection
- if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ), sleep=5, attempts=5 ):
main.assertReturnString += 'Link Down Pingall Passed\n'
else:
main.assertReturnString += 'Link Down Pingall Failed\n'
@@ -1215,8 +1217,6 @@
global itemName
itemName = name
- tempHostsData = {}
- onosNode = int( onosNode )
main.log.info( itemName + ": Testing Point Intent" )
@@ -1506,9 +1506,7 @@
"""
Use fwd app and pingall to discover all the hosts
"""
- activateResult = main.TRUE
appCheck = main.TRUE
- getDataResult = main.TRUE
main.log.info( "Activating reactive forwarding app " )
activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
@@ -1541,7 +1539,6 @@
Confirms that all ONOS nodes have discovered all scapy hosts
"""
import collections
- scapyHostCount = len( main.scapyHosts )
hosts = main.topo.getAllHosts( main ) # Get host data from each ONOS node
hostFails = [] # Reset for each failed attempt
@@ -1667,8 +1664,6 @@
tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
results.append( tempResult )
- expectedState = [ 'INSTALLED', 'INSTALLING' ]
-
if all( result == main.TRUE for result in results ):
main.log.info( itemName + ": Intents are installed correctly" )
else:
@@ -1699,7 +1694,7 @@
def link( main, sw1, sw2, option ):
# link down
- main.log.info( itemName + ": Bring link " + option + "between " +
+ main.log.info( itemName + ": Bring link " + option + " between " +
sw1 + " and " + sw2 )
linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
return linkResult
@@ -1776,6 +1771,7 @@
connectionsFunctional = main.FALSE
else:
main.log.info( "Packet from {0} successfully received by {1}".format( sender , recipient ) )
+ connectionsFunctional = main.TRUE
else:
recipientComp.killFilter()
if expectFailure:
@@ -1786,6 +1782,7 @@
return connectionsFunctional
+
def removeAllIntents( main, intentsId ):
"""
Remove all intents in the intentsId
@@ -1949,9 +1946,54 @@
waitFlowLife.append( device[ 'flows' ][ i ][ 'life' ] )
main.log.info( "Determining whether flows where overwritten" )
if len( flowLife ) == len( waitFlowLife ):
- for i in range( len( flowLife) ):
+ for i in range( len( flowLife ) ):
if waitFlowLife[ i ] - flowLife[ i ] < main.flowDurationSleep:
return main.FALSE
else:
return main.FALSE
return main.TRUE
+
+
+def EncapsulatedIntentCheck( main, tag="" ):
+ """
+ Check encapsulated intents
+ tag: encapsulation tag (e.g. VLAN, MPLS)
+
+ Getting added flows
+ Check tags on each flows
+ If each direction has push or pop, passed
+ else failed
+
+ """
+ import json
+ HostJson = []
+ Jflows = main.CLIs[ 0 ].flows( noCore=True )
+ try:
+ Jflows = json.loads( Jflows )
+ except ValueError:
+ main.log.error( "Unable to read flows" )
+ return main.FALSE
+
+ for flow in Jflows:
+ if len(flow[ "flows" ]) != 0:
+ HostJson.append( flow[ "flows" ] )
+
+ totalflows = len( HostJson[ 0 ])
+
+ pop = 0
+ push = 0
+
+ PopTag = tag + "_POP"
+ PushTag = tag + "_PUSH"
+
+ for EachHostJson in HostJson:
+ for i in range( totalflows ):
+ if EachHostJson[ i ][ "treatment" ][ "instructions" ][ 0 ][ "subtype" ] == PopTag:
+ pop += 1
+ elif EachHostJson[ i ][ "treatment" ][ "instructions" ][ 0 ][ "subtype" ] == PushTag:
+ push += 1
+
+ if pop == totalflows and push == totalflows:
+ return main.TRUE
+ else:
+ return main.FALSE
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/README.md b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/README.md
new file mode 100644
index 0000000..f057e2c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/README.md
@@ -0,0 +1,17 @@
+These tests are meant to test the high availability of ONOS and
+SR application.
+
+It consists of:
+1) Configure and install ONOS;
+2) Pingall between hosts;
+3) Kill one ONOS instance;
+4) Kill one spine;
+5) Repeat this test a number of time;
+
+Requirements:
+1) An updated version of the CPQD switch has to be running to make sure it supports group chaining.
+
+The test is executed using the netcfg subsystem:
+1) APPS=openflow-base,netcfghostprovider,netcfglinksprovider
+
+The topologies are 2x2 Leaf-Spine and 4x4 Leaf-Spine.
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
new file mode 100644
index 0000000..5f990fa
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.params
@@ -0,0 +1,53 @@
+<PARAMS>
+
+ <testcases>1,2,3,4,5,6,7,8</testcases>
+
+ <SCALE>
+ <size>3</size>
+ <max>3</max>
+ </SCALE>
+
+ <DEPENDENCY>
+ <wrapper1>startUp</wrapper1>
+ <topology>cord_fabric.py</topology>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers,segmentrouting</cellApps>
+ <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
+ <cellUser>sdn</cellUser>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <timers>
+ <LinkDiscovery>12</LinkDiscovery>
+ <SwitchDiscovery>12</SwitchDiscovery>
+ </timers>
+
+ <switches>
+ <spine1> spine101 </spine1>
+ <spine2> spine102 </spine2>
+ <spine3> spine103 </spine3>
+ <spine4> spine104 </spine4>
+ <spinedpid1> 000000000101 </spinedpid1>
+ <spinedpid2> 000000000102 </spinedpid2>
+ <spinedpid3> 000000000103 </spinedpid3>
+ <spinedpid4> 000000000104 </spinedpid4>
+ </switches>
+
+ <failures>3</failures>
+
+ <SLEEP>
+ <startup>10</startup>
+ </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.py b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.py
new file mode 100644
index 0000000..77f7d71
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.py
@@ -0,0 +1,318 @@
+# In this test we perform several failures and then test for connectivity
+# CASE1: 2x2 topo + 3 ONOS + | ONOS failure + IP connectivity test | x failures
+# CASE2: 2x2 topo + 3 ONOS + | ONOS (random instance) failure + IP connectivity test | x failures
+# CASE3: 4x4 topo + 3 ONOS + | ONOS failure + IP connectivity test | x failures
+# CASE4: 4x4 topo + 3 ONOS + | ONOS (random instance) failure + IP connectivity test | x failures
+# CASE5: 2x2 topo + 3 ONOS + | ONOS failure + Spine failure + IP connectivity test | x failures
+# CASE6: 2x2 topo + 3 ONOS + | ONOS (random instance) failure + Spine (random switch) failure + IP connectivity test | x failures
+# CASE7: 4x4 topo + 3 ONOS + | ONOS failure + Spine failure + IP connectivity test | x failures
+# CASE8: 4x4 topo + 3 ONOS + | ONOS (random instance) failure + Spine (random switch) failure + IP connectivity test | x failures
+
+
+
+class SRHighAvailability:
+
+ def __init__( self ):
+ self.default = ''
+
+ def CASE1( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 2x2 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause sequential ONOS failure
+ 5) Pingall
+ 6) Repeat 3), 4), 5) 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS failures with 2x2 Leaf-spine "
+ main.case( description )
+ run.config(main, '2x2', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ for i in range(0, main.failures):
+ toKill = i % main.numCtrls
+ run.killOnos( main, [ toKill ], '4', '8', '2' )
+ run.pingAll( main, 'CASE1_Failure%d' % (i+1) )
+ run.recoverOnos( main, [ toKill ], '4', '8', '3' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE1_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE2( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 2x2 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause random ONOS failure
+ 5) Pingall
+ 6) Repeat 3), 4), 5) 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ import random
+ from random import randint
+ from datetime import datetime
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS random failures with 2x2 Leaf-spine "
+ main.case( description )
+ run.config(main, '2x2', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ random.seed(datetime.now())
+ for i in range(0, main.failures):
+ toKill = randint(0, (main.numCtrls-1))
+ run.killOnos( main, [ toKill ], '4', '8', '2' )
+ run.pingAll( main, 'CASE2_Failure%d' % (i+1) )
+ run.recoverOnos( main, [ toKill ], '4', '8', '3' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE2_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE3( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 4x4 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause sequential ONOS failure
+ 5) Pingall
+ 6) Repeat 3), 4), 5) 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS failures with 4x4 Leaf-spine "
+ main.case( description )
+ run.config(main, '4x4', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ for i in range(0, main.failures):
+ toKill = i % main.numCtrls
+ run.killOnos( main, [ toKill ], '8', '32', '2' )
+ run.pingAll( main, 'CASE3_Failure%d' % (i+1) )
+ run.recoverOnos( main, [ toKill ], '8', '32', '3' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE3_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE4( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 4x4 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause random ONOS failure
+ 5) Pingall
+ 6) Repeat 3), 4), 5) 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ import random
+ from random import randint
+ from datetime import datetime
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS random failures with 4x4 Leaf-spine "
+ main.case( description )
+ run.config(main, '4x4', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ random.seed(datetime.now())
+ for i in range(0, main.failures):
+ toKill = randint(0, (main.numCtrls-1))
+ run.killOnos( main, [ toKill ], '8', '32', '2' )
+ run.pingAll( main, 'CASE4_Failure%d' % (i+1) )
+ run.recoverOnos( main, [ toKill ], '8', '32', '3' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE4_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE5( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 2x2 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause sequential ONOS failure
+ 5) Pingall
+ 6) Cause sequential Spine failure
+ 7) Pingall
+ 8) Repeat 3), 4), 5), 6), 7), 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ import time
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS failures and Switch failures with 2x2 Leaf-spine "
+ main.case( description )
+ run.config(main, '2x2', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ for i in range(0, main.failures):
+ onosToKill = i % main.numCtrls
+ switchToKill = i % len(main.spines)
+ run.killOnos( main, [ onosToKill ], '4', '8', '2' )
+ run.pingAll( main, 'CASE5_ONOS_Failure%d' % (i+1) )
+ run.killSwitch( main, main.spines[switchToKill]['name'], switches='3', links='4' )
+ time.sleep( main.switchSleep )
+ run.pingAll( main, "CASE5_SWITCH_Failure%d" % (i+1) )
+ run.recoverSwitch( main, main.spines[switchToKill]['name'], switches='4', links='8' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE5_SWITCH_Recovery%d" % (i+1) )
+ run.recoverOnos( main, [ onosToKill ], '4', '8', '3' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE5_ONOS_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE6( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 2x2 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause random ONOS failure
+ 5) Pingall
+ 6) Cause random Spine failure
+ 7) Pingall
+ 8) Repeat 3), 4), 5), 6), 7) 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ import time
+ import random
+ from random import randint
+ from datetime import datetime
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS random failures and Switch random failures with 2x2 Leaf-spine "
+ main.case( description )
+ run.config(main, '2x2', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py' )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main )
+ for i in range(0, main.failures):
+ onosToKill = randint(0, (main.numCtrls-1))
+ switchToKill = randint(0, 1)
+ run.killOnos( main, [ onosToKill ], '4', '8', '2' )
+ run.pingAll( main, 'CASE6_ONOS_Failure%d' % (i+1) )
+ run.killSwitch( main, main.spines[switchToKill]['name'], switches='3', links='4' )
+ time.sleep( main.switchSleep )
+ run.pingAll( main, "CASE6_SWITCH_Failure%d" % (i+1) )
+ run.recoverSwitch( main, main.spines[switchToKill]['name'], switches='4', links='8' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, "CASE6_SWITCH_Recovery%d" % (i+1) )
+ run.recoverOnos( main, [ onosToKill ], '4', '8', '3' )
+ run.checkFlows( main, minFlowCount=116 )
+ run.pingAll( main, 'CASE6_ONOS_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE7( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 4x4 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause sequential ONOS failure
+ 5) Pingall
+ 6) Cause sequential Spine failure
+ 7) Pingall
+ 8) Repeat 3), 4), 5), 6), 7), 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ import time
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS failures and Switch failures with 4x4 Leaf-spine "
+ main.case( description )
+ run.config(main, '4x4', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ for i in range(0, main.failures):
+ onosToKill = i % main.numCtrls
+ switchToKill = i % len(main.spines)
+ run.killOnos( main, [ onosToKill ], '8', '32', '2' )
+ run.pingAll( main, 'CASE7_ONOS_Failure%d' % (i+1) )
+ run.killSwitch( main, main.spines[switchToKill]['name'], switches='7', links='24' )
+ time.sleep( main.switchSleep )
+ run.pingAll( main, "CASE7_SWITCH_Failure%d" % (i+1) )
+ run.recoverSwitch( main, main.spines[switchToKill]['name'], switches='8', links='32' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, "CASE7_SWITCH_Recovery%d" % (i+1) )
+ run.recoverOnos( main, [ onosToKill ], '8', '32', '3' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE7_ONOS_Recovery%d' % (i+1) )
+ run.cleanup( main )
+
+ def CASE8( self, main ):
+ """
+ 1) Sets up 3-nodes Onos-cluster
+ 2) Start 4x4 Leaf-Spine topology
+ 3) Pingall
+ 4) Cause random ONOS failure
+ 5) Pingall
+ 6) Cause random Spine failure
+ 7) Pingall
+ 8) Repeat 3), 4), 5), 6), 7), 'failures' times
+ """
+ from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+ Testcaselib as run
+ import time
+ import random
+ from random import randint
+ from datetime import datetime
+ if not hasattr( main, 'apps' ):
+ run.initTest( main )
+
+ description = "High Availability tests - ONOS random failures and Switch random failures with 4x4 Leaf-spine "
+ main.case( description )
+ run.config(main, '4x4', 3)
+ run.installOnos( main )
+ run.startMininet( main, 'cord_fabric.py', args="--leaf=4 --spine=4" )
+ # pre-configured routing and bridging test
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main )
+ for i in range(0, main.failures):
+ onosToKill = randint(0, (main.numCtrls-1))
+ switchToKill = randint(0, 3)
+ run.killOnos( main, [ onosToKill ], '8', '32', '2' )
+ run.pingAll( main, 'CASE8_ONOS_Failure%d' % (i+1) )
+ run.killSwitch( main, main.spines[switchToKill]['name'], switches='7', links='24' )
+ time.sleep( main.switchSleep )
+ run.pingAll( main, "CASE8_SWITCH_Failure%d" % (i+1) )
+ run.recoverSwitch( main, main.spines[switchToKill]['name'], switches='8', links='32' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, "CASE8_SWITCH_Recovery%d" % (i+1) )
+ run.recoverOnos( main, [ onosToKill ], '8', '32', '3' )
+ run.checkFlows( main, minFlowCount=350 )
+ run.pingAll( main, 'CASE8_ONOS_Recovery%d' % (i+1) )
+ run.cleanup( main )
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.topo b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.topo
new file mode 100644
index 0000000..bf9b6be
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/SRHighAvailability.topo
@@ -0,0 +1,90 @@
+<TOPOLOGY>
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>localhost</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <nodes>1</nodes>
+ </COMPONENTS>
+ </ONOSbench>
+
+ <ONOScli1>
+ <host>OC1</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>OC2</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>OC3</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOScli3>
+
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+
+ <ONOSrest2>
+ <host>OC2</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest2>
+
+ <ONOSrest3>
+ <host>OC3</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest3>
+
+ <Mininet1>
+ <host>OCN</host>
+ <user>sdn</user>
+ <password>rocks</password>
+ <type>MininetCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS>
+ <home>~/mininet/custom/</home>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRHighAvailability/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 030ec9a..7ef28e6 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -218,6 +218,51 @@
main.exit( )
@staticmethod
+ def config(main, cfgName, numCtrls):
+ main.spines = []
+
+ main.failures = int(main.params[ 'failures' ])
+ main.cfgName = cfgName
+ main.numCtrls = numCtrls
+
+ if main.cfgName == '2x2' :
+ spine = {}
+ spine[ 'name' ] = main.params['switches'][ 'spine1' ]
+ spine[ 'dpid' ] = main.params['switches'][ 'spinedpid1' ]
+ main.spines.append(spine)
+
+ spine = {}
+ spine[ 'name' ] = main.params['switches'][ 'spine2' ]
+ spine[ 'dpid' ] = main.params['switches'][ 'spinedpid2' ]
+ main.spines.append(spine)
+
+ elif main.cfgName == '4x4' :
+ spine = {}
+ spine[ 'name' ] = main.params['switches'][ 'spine1' ]
+ spine[ 'dpid' ] = main.params['switches'][ 'spinedpid1' ]
+ main.spines.append(spine)
+
+ spine = {}
+ spine[ 'name' ] = main.params['switches'][ 'spine2' ]
+ spine[ 'dpid' ] = main.params['switches'][ 'spinedpid2' ]
+ main.spines.append(spine)
+
+ spine = {}
+ spine[ 'name' ] = main.params['switches'][ 'spine3' ]
+ spine[ 'dpid' ] = main.params['switches'][ 'spinedpid3' ]
+ main.spines.append(spine)
+
+ spine = {}
+ spine[ 'name' ] = main.params['switches'][ 'spine4' ]
+ spine[ 'dpid' ] = main.params['switches'][ 'spinedpid4' ]
+ main.spines.append(spine)
+
+ else :
+ main.log.error( "Configuration failed!" )
+ main.cleanup( )
+ main.exit( )
+
+ @staticmethod
def checkFlows( main, minFlowCount, dumpflows=True ):
main.step(
" Check whether the flow count is bigger than %s" % minFlowCount )