Merge "Case 6000"
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.params b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.params
index 58917ba..73a3599 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.params
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.params
@@ -2,15 +2,19 @@
# CASE - Description
# 1 - Variable initialization and optional pull and build ONOS package
# 2 - Install ONOS
- # 11 - Start Mininet with Openflow 1.3 (OpenvSwitch --version more than 2.3.1)
+ # 11 - Start Mininet with Openflow 1.3 (Use OpenvSwitch version more than 2.3.1)
# 12 - Assign switch to controller
+ # 13 - Discover hosts with Mininet Pingall(proto="IPV6")
# 14 - Stop Mininet
+ # 16 - Balance ownership of switches
+ # 1000 - Test host intents
# 2000 - Test Point Intent
# 3000 - Test Single To Multi Point Intent
# 4000 - Test multi to single point intents
# 5000 - Test host mobility
+ # 6000 - Test Multi Point intent End Point Failure
- <testcases>1,2,11,12,13,2000,3000,4000,5000,14</testcases>
+ <testcases>1,2,11,12,13,16,1000,2000,3000,4000,5000,6000,14</testcases>
<SCALE>
<size>1</size>
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
old mode 100644
new mode 100755
index 9c49283..450516a
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
@@ -346,6 +346,21 @@
onpass="Successfully discovered hosts",
onfail="Failed to discover hosts" )
+ def CASE16( self, main ):
+ """
+ Balance Masters
+ """
+ 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,
+ actual=balanceResult,
+ onpass="Successfully balanced mastership of switches",
+ onfail="Failed to balance mastership of switches" )
+
def CASE14( self, main ):
"""
Stop mininet
@@ -367,6 +382,130 @@
main.cleanup()
main.exit()
+ def CASE1000( self, main ):
+ """
+ Add host intents between 2 host:
+ - Discover hosts
+ - Add host intents
+ - Check intents
+ - Verify flows
+ - Ping hosts
+ - Reroute
+ - Link down
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Link up
+ - Verify flows
+ - Check topology
+ - Ping hosts
+ - Remove intents
+ """
+ import time
+ import json
+ import re
+
+ # Assert variables - These variable's name|format must be followed
+ # if you want to use the wrapper function
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+
+ intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
+
+ main.testName = "Host Intents"
+ main.case( main.testName + " Test - " + str( main.numCtrls ) +
+ " NODE(S) - OF " + main.OFProtocol )
+ main.caseExplanation = "This test case tests Host intents using " +\
+ str( main.numCtrls ) + " node(s) cluster;\n" +\
+ "Different type of hosts will be tested in " +\
+ "each step such as IPV6, Dual stack, VLAN " +\
+ "etc;\nThe test will use OF " + main.OFProtocol\
+ + " OVS running in Mininet"
+
+ main.step( "IPV6: Add host intents between h1 and h9" )
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.hostIntent( main,
+ name='IPV6',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="IPV6: Host intent test successful " +
+ "between two IPV6 hosts",
+ onfail="IPV6: Host intent test failed " +
+ "between two IPV6 hosts")
+
+ main.step( "DUALSTACK1: Add host intents between h3 and h11" )
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.hostIntent( main,
+ name='DUALSTACK',
+ host1='h3',
+ host2='h11',
+ host1Id='00:00:00:00:00:03/-1',
+ host2Id='00:00:00:00:00:0B/-1',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="DUALSTACK: Host intent test " +
+ "successful between two " +
+ "dual stack host using IPV6",
+ onfail="DUALSTACK: Host intent test " +
+ "failed between two" +
+ "dual stack host using IPV6" )
+
+ main.step( "1HOP: Add host intents between h1 and h3" )
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.hostIntent( main,
+ name='1HOP',
+ host1='h1',
+ host2='h9',
+ host1Id='00:00:00:00:00:01/-1',
+ host2Id='00:00:00:00:00:09/-1')
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="1HOP: Host intent test " +
+ "successful between two " +
+ "host using IPV6 in the same switch",
+ onfail="1HOP: Host intent test " +
+ "failed between two" +
+ "host using IPV6 in the same switch" )
+
+ main.step( "VLAN: Add vlan host intents between h5 and h24" )
+ stepResult = main.TRUE
+ stepResult = main.intentFunction.hostIntent( main,
+ name='VLAN1',
+ host1='h5',
+ host2='h24',
+ host1Id='00:00:00:00:00:05/100',
+ host2Id='00:00:00:00:00:18/100',
+ sw1='s5',
+ sw2='s2',
+ expectedLink=18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="VLAN: Host intent test " +
+ "successful between two " +
+ "host using IPV6 in the same VLAN",
+ onfail="VLAN1: Host intent test " +
+ "failed between two" +
+ "host using IPV6 in the same VLAN" )
+
+ main.intentFunction.report( main )
+
def CASE2000( self, main ):
"""
add point intents between 2 hosts:
@@ -586,12 +725,12 @@
onfail=main.assertReturnString )
main.step( "1HOP: Add point intents between h1 and h9" )
main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
- stepResult = main.intentFunction.hostIntent( main,
+ stepResult = main.intentFunction.pointIntent( main,
name='1HOP',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1')
+ host1="h1",
+ host2="h9",
+ deviceId1="of:0000000000000005/1",
+ deviceId2="of:0000000000000006/1")
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass=main.assertReturnString,
@@ -863,3 +1002,221 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
main.intentFunction.report( main )
+
+ def CASE6000( self, main ):
+ """
+ Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
+ """
+ assert main, "There is no main"
+ assert main.CLIs, "There is no main.CLIs"
+ assert main.Mininet1, "Mininet handle should be named Mininet1"
+ assert main.numSwitch, "Placed the total number of switch topology in \
+ main.numSwitch"
+ main.case( "Test Multi to Single End Point Failure" )
+ main.step( "NOOPTION: test end point failure for multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single \
+ point intent end point failure with no options set\n"
+ hostNames = [ 'h8', 'h17' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ name="NOOPTION",
+ test="MultipletoSingle",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "IPV6: test end point failure for multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single \
+ point intent end point failure with IPV6 type and MAC addresses\n"
+ hostNames = [ 'h8', 'h9', 'h17' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
+ macs = [ '00:00:00:00:00:08','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="MultipletoSingle",
+ name="IPV6",
+ hostNames=hostNames,
+ devices=devices,
+ macs=macs,
+ ethType="IPV6",
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "IPV6_2: test end point faliure for multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single \
+ point intent end point failure with IPV6 type and no MAC addresses\n"
+ hostNames = [ 'h8', 'h17' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="MultipletoSingle",
+ name="IPV6_2",
+ hostNames=hostNames,
+ devices=devices,
+ ethType="IPV6",
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "VLAN: test end point failure for multi point to single point intents" )
+ main.assertReturnString = "Assertion results for IPV6 multi to single \
+ point intent end point failure with IPV6 type and no MAC addresses in the same VLAN\n"
+ hostNames = [ 'h5', 'h24' ]
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
+ macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="MultipletoSingle",
+ name="VLAN",
+ hostNames=hostNames,
+ devices=devices,
+ ethType="IPV6",
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.case( "Test Single to Multiple End Point Failure" )
+ main.step( "NOOPTION: test end point failure for single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi \
+ point intent end point failure with no options set\n"
+ hostNames = [ 'h8', 'h17' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="SingletoMultiple",
+ name="NOOPTION",
+ hostNames=hostNames,
+ devices=devices,
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+ main.step( "IPV6: test end point failure for single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi \
+ point intent end point failure with IPV6 type and MAC addresses\n"
+ hostNames = [ 'h8', 'h9', 'h17' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
+ macs = [ '00:00:00:00:00:08','00:00:00:00:00:09' ,'00:00:00:00:00:11' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="SingletoMultiple",
+ name="IPV6",
+ hostNames=hostNames,
+ devices=devices,
+ ethType="IPV6",
+ macs=macs,
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "IPV6_2: test end point failure for single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi\
+ point intent endpoint failure with IPV6 type and no MAC addresses\n"
+ hostNames = [ 'h8', 'h17' ]
+ devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="SingletoMultiple",
+ name="IPV6_2",
+ hostNames=hostNames,
+ devices=devices,
+ ethType="IPV6",
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "VLAN: test end point failure for single point to multi point intents" )
+ main.assertReturnString = "Assertion results for IPV6 single to multi point\
+ intent endpoint failure with IPV6 type and MAC addresses in the same VLAN\n"
+ hostNames = [ 'h5', 'h24' ]
+ devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
+ macs = [ '00:00:00:00:00:05','00:00:00:00:00:18' ]
+ testResult = main.TRUE
+ testResult = main.intentFunction.testEndPointFail(
+ main,
+ test="SingletoMultiple",
+ name="IPV6",
+ hostNames=hostNames,
+ devices=devices,
+ macs=macs,
+ ethType="IPV6",
+ sw1="s6",
+ sw2="s2",
+ sw3="s4",
+ sw4="s1",
+ sw5="s3",
+ expectedLink1=16,
+ expectedLink2=14 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.intentFunction.report( main )
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo
index dd25a2e..3e9369f 100755
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.topo
@@ -78,4 +78,4 @@
</Mininet1>
</COMPONENT>
-</TOPOLOGY>
+</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
index b6d706e..d7b2d82 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
@@ -133,11 +133,23 @@
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ if intentResult:
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
# Check flows count in each node
- checkFlowsCount( main )
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Initial Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow Count Failed\n'
# Verify flows
- checkFlowsState( main )
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow State Failed\n'
# Ping hosts
firstPingResult = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ host2 ][ 'ipAddresses' ][ 0 ])
@@ -391,11 +403,23 @@
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ if intentResult:
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
# Check flows count in each node
- checkFlowsCount( main )
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Initial Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow Count Failed\n'
# Verify flows
- checkFlowsState( main )
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow State Failed\n'
# Ping hosts
pingTemp = ping6allHosts( main, hostNames )
@@ -671,14 +695,25 @@
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ if intentResult:
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
# Check flows count in each node
- checkFlowsCount( main )
-
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Initial Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow Count Failed\n'
# Verify flows
- checkFlowsState( main )
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow State Failed\n'
- # Run iperf to both host
+ # Run iperf to both host
iperfTemp = main.Mininet1.iperftcpipv6( host1,host2 )
iperfResult = iperfResult and iperfTemp
if iperfTemp:
@@ -893,7 +928,7 @@
main.hostsData.get( host ).get( 'mac' )
ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
main.hostsData.get( host ).get( 'ipAddresses' )
-
+
pingResult = main.TRUE
intentResult = main.TRUE
removeIntentResult = main.TRUE
@@ -946,7 +981,7 @@
tcpSrc="",
tcpDst="" ) )
-
+
# Check intents state
time.sleep( main.checkIntentSleep )
intentResult = checkIntentState( main, intentsId )
@@ -954,11 +989,23 @@
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ if intentResult:
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
# Check flows count in each node
- checkFlowsCount( main )
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Initial Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow Count Failed\n'
# Verify flows
- checkFlowsState( main )
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow State Failed\n'
firstPingResult = main.Mininet1.ping6pair(SRC=hostNames[0], TARGET=main.hostsData[ hostNames[1] ][ 'ipAddresses' ][0])
if not firstPingResult:
@@ -1140,6 +1187,7 @@
expectedLink - Expected link when the switches are down, it should
be two links lower than the links before the two
switches are down
+ Note - Don't use more than 2 hosts for MultiToSingle Intent with no mac address option.
"""
assert main, "There is no main variable"
@@ -1236,11 +1284,23 @@
# Check intents state again if first check fails...
if not intentResult:
intentResult = checkIntentState( main, intentsId )
+ if intentResult:
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
# Check flows count in each node
- checkFlowsCount( main )
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Initial Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow Count Failed\n'
# Verify flows
- checkFlowsState( main )
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow State Failed\n'
# Ping hosts...
pingTemp = ping6allHosts( main, hostNames )
@@ -1349,6 +1409,376 @@
return stepResult
+def testEndPointFail( main,
+ name,
+ test="",
+ hostNames="",
+ devices="",
+ macs="",
+ ports="",
+ onosNode=0,
+ ethType="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="",
+ sw2="",
+ sw3="",
+ sw4="",
+ sw5="",
+ expectedLink1=0,
+ expectedLink2=0 ):
+ """
+ Test Multipoint Topology for Endpoint failures
+ """
+
+ assert main, "There is no main variable"
+ assert hostNames, "You must specify hosts"
+ assert devices or main.hostsData, "You must specify devices"
+
+ global itemName
+ itemName = name
+ tempHostsData = {}
+ intentsId = []
+ onosNode = int( onosNode )
+
+ macsDict = {}
+ ipDict = {}
+ if hostNames and devices:
+ if len( hostNames ) != len( devices ):
+ main.log.debug( "hosts and devices does not have the same length" )
+ return main.FALSE
+ if ports:
+ if len( ports ) != len( devices ):
+ main.log.error( "Ports and devices does " +
+ "not have the same length" )
+ return main.FALSE
+ else:
+ main.log.info( "Device Ports are not specified" )
+ if macs:
+ for i in range( len( devices ) ):
+ macsDict[ devices[ i ] ] = macs[ i ]
+ elif hostNames and not devices and main.hostsData:
+ devices = []
+ main.log.info( "multiIntent function is using main.hostsData" )
+ for host in hostNames:
+ devices.append( main.hostsData.get( host ).get( 'location' ) )
+ macsDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'mac' )
+ ipDict[ main.hostsData.get( host ).get( 'location' ) ] = \
+ main.hostsData.get( host ).get( 'ipAddresses' )
+
+ pingResult = main.TRUE
+ intentResult = main.TRUE
+ removeIntentResult = main.TRUE
+ flowResult = main.TRUE
+ topoResult = main.TRUE
+ linkDownResult = main.TRUE
+ linkUpResult = main.TRUE
+
+ devicesCopy = copy.copy( devices )
+ if ports:
+ portsCopy = copy.copy( ports )
+ main.log.info( itemName + ": Adding intents" )
+
+ # Check flows count in each node
+ checkFlowsCount( main )
+
+ if test=="MultipletoSingle":
+ for i in range( len( devices ) ):
+ egressDevice = devicesCopy[ i ]
+ ingressDeviceList = copy.copy( devicesCopy )
+ ingressDeviceList.remove( egressDevice )
+ if ports:
+ portEgress = portsCopy[ i ]
+ portIngressList = copy.copy( portsCopy )
+ del portIngressList[ i ]
+ else:
+ portEgress = ""
+ portIngressList = None
+ if not macsDict:
+ dstMac = ""
+ else:
+ dstMac = macsDict[ egressDevice ]
+ if dstMac == None:
+ main.log.debug( "There is no MAC in device - " + egressDevice )
+ dstMac = ""
+
+ intentsId.append(
+ main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
+ ingressDeviceList=ingressDeviceList,
+ egressDevice=egressDevice,
+ portIngressList=portIngressList,
+ portEgress=portEgress,
+ ethType=ethType,
+ ethDst=dstMac,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc="",
+ ipDst="",
+ tcpSrc="",
+ tcpDst="" ) )
+
+
+ elif test=="SingletoMultiple":
+ for i in range( len( devices ) ):
+ ingressDevice = devicesCopy[ i ]
+ egressDeviceList = copy.copy( devicesCopy )
+ egressDeviceList.remove( ingressDevice )
+ if ports:
+ portIngress = portsCopy[ i ]
+ portEgressList = copy.copy( portsCopy )
+ del portEgressList[ i ]
+ else:
+ portIngress = ""
+ portEgressList = None
+ if not macsDict:
+ srcMac = ""
+ else:
+ srcMac = macsDict[ ingressDevice ]
+ if srcMac == None:
+ main.log.debug( "There is no MAC in device - " + ingressDevice )
+ srcMac = ""
+
+ intentsId.append(
+ main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
+ ingressDevice=ingressDevice,
+ egressDeviceList=egressDeviceList,
+ portIngress=portIngress,
+ portEgressList=portEgressList,
+ ethType=ethType,
+ ethSrc=srcMac,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc="",
+ ipDst="",
+ tcpSrc="",
+ tcpDst="" ) )
+
+ else:
+ main.log.info("Invalid test Name - Type either SingletoMultiple or MultipletoSingle")
+ return main.FALSE
+
+ # Check intents state
+ time.sleep( main.checkIntentSleep )
+ intentResult = checkIntentState( main, intentsId )
+
+ # Check intents state again if first check fails...
+ if not intentResult:
+ intentResult = checkIntentState( main, intentsId )
+ if intentResult:
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
+
+ # Check flows count in each node
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Initial Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow Count Failed\n'
+ # Verify flows
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Flow State Failed\n'
+
+ # Ping hosts...
+ pingTemp = ping6allHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Initial Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Initial Pingall Failed\n'
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and sw3 and sw4 and sw5 and expectedLink1 and expectedLink2:
+ # Take two links down
+ # Take first link down
+ linkDownResult1 = link( main, sw1, sw2, "down" )
+ if linkDownResult1:
+ main.assertReturnString += 'First Link Down Passed\n'
+ else:
+ main.assertReturnString += 'First Link Down Failed\n'
+
+ # Take second link down
+ linkDownResult2 = link( main, sw3, sw4, "down" )
+ if linkDownResult2:
+ main.assertReturnString += 'Second Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Second Link Down Failed\n'
+
+ # Check flows count in each node
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Link Down Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Flow Count Failed\n'
+ # Verify flows
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Link Down Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Flow State Failed\n'
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink1 )
+ if topoResult:
+ main.assertReturnString += 'Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Topology State Failed\n'
+
+ # Ping hosts
+ pingTemp = ping6allHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Down Ping6all Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Ping6all Failed\n'
+
+ # Check intent state
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
+
+ # Take third link down to isolate the node
+ linkDownResult3 = link( main, sw3, sw5, "down" )
+ if linkDownResult3:
+ main.assertReturnString += 'Isolation Third Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Isolation Third Link Down Failed\n'
+
+ # Check flows count in each node
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Isolation Link Down Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Isolation Link Down Flow Count Failed\n'
+
+ # Verify flows
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Isolation Link Down Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Isolation Link Down Flow State Failed\n'
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, expectedLink2 )
+ if topoResult:
+ main.assertReturnString += 'Isolation Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Isolation Link Down Topology State Failed\n'
+
+ # Ping hosts after isolation
+ main.log.info("Ping will fail if the node is isolated correctly.It will ping only after bringing up the isolation link")
+ pingIsolation = ping6allHosts( main, hostNames )
+ if pingIsolation:
+ main.assertReturnString += 'Isolation Link Down Ping6all Passed\n'
+ else:
+ main.assertReturnString += 'Isolation Link Down Ping6all Failed\n'
+
+ # Check intent state after isolation
+ main.log.info("Intent will be in FAILED state if the node is isolated correctly.It will be in INSTALLED state only after bringing up isolation link")
+ intentIsolation = checkIntentState( main, intentsId )
+ if intentIsolation:
+ main.assertReturnString += 'Isolation Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Isolation Link Down Intent State Failed\n'
+
+ linkDownResult = linkDownResult1 and linkDownResult2 and linkDownResult3
+
+ # Checks ONOS state in link down
+ if linkDownResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link down" )
+ else:
+ main.log.error( itemName + ": Failed to bring link down" )
+
+ # Bring the links back up
+ # Bring first link up
+ linkUpResult1 = link( main, sw1, sw2, "up" )
+ if linkUpResult1:
+ main.assertReturnString += 'First Link Up Passed\n'
+ else:
+ main.assertReturnString += 'First Link Up Failed\n'
+
+ # Bring second link up
+ linkUpResult2 = link( main, sw3, sw4, "up" )
+ if linkUpResult2:
+ main.assertReturnString += 'Second Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Second Link Up Failed\n'
+ # Bring third link up
+ linkUpResult3 = link( main, sw3, sw5, "up" )
+ if linkUpResult3:
+ main.assertReturnString += 'Third Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Third Link Up Failed\n'
+
+ linkUpResult = linkUpResult1 and linkUpResult2 and linkUpResult3
+ time.sleep( main.rerouteSleep )
+
+ # Check flows count in each node
+ FlowResult = checkFlowsCount( main )
+ if FlowResult:
+ main.assertReturnString += 'Link Up Flow Count Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Flow Count Failed\n'
+ # Verify flows
+ StateResult = checkFlowsState( main )
+ if StateResult:
+ main.assertReturnString += 'Link Up Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Flow State Failed\n'
+
+ # Check OnosTopology
+ topoResult = checkTopology( main, main.numLinks )
+ if topoResult:
+ main.assertReturnString += 'Link Up Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Topology State Failed\n'
+
+ # Ping hosts
+ pingTemp = ping6allHosts( main, hostNames )
+ pingResult = pingResult and pingTemp
+ if pingTemp:
+ main.assertReturnString += 'Link Up Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Pingall Failed\n'
+
+ # Check Intents
+ intentTemp = checkIntentState( main, intentsId )
+ intentResult = intentResult and intentTemp
+ if intentTemp:
+ main.assertReturnString += 'Link Up Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Intent State Failed\n'
+
+ # Checks ONOS state in link up
+ if linkUpResult and topoResult and pingResult and intentResult:
+ main.log.info( itemName + ": Successfully brought link back up" )
+ else:
+ main.log.error( itemName + ": Failed to bring link back up" )
+
+ # Remove all intents
+ removeIntentResult = removeAllIntents( main, intentsId )
+ if removeIntentResult:
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
+
+ testResult = pingResult and linkDownResult and linkUpResult \
+ and intentResult and removeIntentResult
+
+ return testResult
+
def ping6allHosts( main, hostList ):
# Ping all host in the hosts list variable
main.log.info( "Pinging: " + str( hostList ) )