Merge "Add HA test for split brain scenario"
diff --git a/.gitignore b/.gitignore
index ae9e171..fa270ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
*.pyc
.DS_Store
._.DS_Store
+
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index 0419583..fe26d5a 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -11,18 +11,18 @@
self.default = ''
def installHostIntent( main,
- name,
- host1,
- host2,
- onosNode=0,
- ethType="",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ipAddresses="",
- tcp="",
- sw1="",
- sw2=""):
+ name,
+ host1,
+ host2,
+ onosNode=0,
+ ethType="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="",
+ sw2=""):
"""
Installs a Host Intent
@@ -83,7 +83,7 @@
args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
return intentId
else:
- main.log.error( "Single to Multi Intent did not install correctly" )
+ main.log.error( "Host Intent did not install correctly" )
return main.FALSE
def testHostIntent( main,
@@ -149,7 +149,7 @@
tempHostsData = {}
onosNode = int( onosNode )
- main.log.info( itemName + ": Testing Single to Multi Point Intent" )
+ main.log.info( itemName + ": Testing Host Intent" )
if not host1.get( "id" ):
main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
@@ -1511,8 +1511,7 @@
# Second check of intents since some of the intents may be in
# INSTALLING state, they should be in INSTALLED at this time
for i in range( main.numCtrls ):
- tempResult = main.CLIs[ i ].checkIntentState(
- intentsId=intentsId )
+ tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
results.append( tempResult )
if all( result == main.TRUE for result in results ):
main.log.info( itemName + ": Intents are installed correctly" )
diff --git a/TestON/tests/FUNCintent/FUNCintent.params b/TestON/tests/FUNCintent/FUNCintent.params
index f061c67..d19a45d 100644
--- a/TestON/tests/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNCintent/FUNCintent.params
@@ -16,7 +16,7 @@
# 3000 - Test single to multi point intents
# 4000 - Test multi to single point intents
# 5000 - Test host mobility
- # 6000 - Test multi to single end point failure
+ # 6000 - Test Multi Point intent End Point Failure
<testcases>1,[2,10,12,13,15,1000,2000,3000,4000,5000,6000,16]*2,[2,11,12,13,15,1000,2000,3000,4000,5000,6000,16]*2</testcases>
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index b4ca8af..e1660f1 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -538,7 +538,6 @@
onpass="Successfully populated hostsData",
onfail="Failed to populate hostsData" )
-
def CASE16( self, main ):
"""
Stop mininet and remove scapy host
@@ -1496,7 +1495,7 @@
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.log.info( "Moving h1 from s5 to s6")
main.Mininet1.moveHost( "h1","s5","s6" )
# Send discovery ping from moved host
@@ -1530,16 +1529,16 @@
onosNode='0',
host1=host1,
host2=host2 )
-
- testResult = main.intentFunction.testHostIntent( main,
- name='Host Mobility IPV4',
- intentId = installResult,
- onosNode='0',
- host1=host1,
- host2=host2,
- sw1="s6",
- sw2="s2",
- expectedLink=18 )
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='Host Mobility IPV4',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1="s6",
+ sw2="s2",
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
actual=testResult,
@@ -1924,4 +1923,4 @@
onpass=main.assertReturnString,
onfail=main.assertReturnString )
- main.intentFunction.report( main )
+ main.intentFunction.report( main )
\ No newline at end of file
diff --git a/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py
index 2dadea4..af02e45 100644
--- a/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintentRest/Dependency/FuncIntentFunction.py
@@ -11,412 +11,607 @@
def __init__( self ):
self.default = ''
-def hostIntent( main,
- name,
- host1,
- host2,
- onosNode=0,
- host1Id="",
- host2Id="",
- mac1="",
- mac2="",
- vlan1="-1",
- vlan2="-1",
- sw1="",
- sw2="",
- expectedLink=0 ):
+def installHostIntent( main,
+ name,
+ host1,
+ host2,
+ onosNode=0,
+ ethType="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="",
+ sw2=""):
"""
- Description:
- Verify add-host-intent
- Steps:
- - 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
- Required:
- name - Type of host intent to add eg. IPV4 | VLAN | Dualstack
- host1 - Name of first host
- host2 - Name of second host
- Optional:
- onosNode - ONOS node to install the intents in main.CLIs[ ]
- 0 by default so that it will always use the first
- ONOS node
- host1Id - ONOS id of the first host eg. 00:00:00:00:00:01/-1
- host2Id - ONOS id of the second host
- mac1 - Mac address of first host
- mac2 - Mac address of the second host
- vlan1 - Vlan tag of first host, defaults to -1
- vlan2 - Vlan tag of second host, defaults to -1
- sw1 - First switch to bring down & up for rerouting purpose
- sw2 - Second switch to bring down & up for rerouting purpose
- expectedLink - Expected link when the switches are down, it should
- be two links lower than the links before the two
- switches are down
+ Installs a Host Intent
+
+ Description:
+ Install a host intent using
+ add-host-intent
+
+ Steps:
+ - Fetch host data if not given
+ - Add host intent
+ - Ingress device is the first sender host
+ - Egress devices are the recipient devices
+ - Ports if defined in senders or recipients
+ - MAC address ethSrc loaded from Ingress device
+ - Check intent state with retry
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ host1 - Dictionary for host1
+ { "name":"h8", "id":"of:0000000000000005/8" }
+ host2 - Dictionary for host2
+ { "name":"h16", "id":"of:0000000000000006/8" }
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ ethType - Ethernet type eg. IPV4, IPV6
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ tcp - TCP ports in the same order as the hosts in hostNames
"""
- # Assert variables
assert main, "There is no main variable"
- assert name, "variable name is empty"
- assert host1 and host2, "You must specify hosts"
+ assert host1, "You must specify host1"
+ assert host2, "You must specify host2"
- global itemName
+ global itemName # The name of this run. Used for logs.
itemName = name
- h1Id = host1Id
- h2Id = host2Id
- h1Mac = mac1
- h2Mac = mac2
- vlan1 = vlan1
- vlan2 = vlan2
- hostNames = [ host1 , host2 ]
- intentsId = []
- stepResult = main.TRUE
- pingResult = main.TRUE
- intentResult = main.TRUE
- removeIntentResult = main.TRUE
- flowResult = main.TRUE
- topoResult = main.TRUE
- linkDownResult = main.TRUE
- linkUpResult = main.TRUE
onosNode = int( onosNode )
- if main.hostsData:
- if not h1Mac:
- h1Mac = main.hostsData[ host1 ][ 'mac' ]
- if not h2Mac:
- h2Mac = main.hostsData[ host2 ][ 'mac' ]
- if main.hostsData[ host1 ][ 'vlan' ] != '-1':
- vlan1 = main.hostsData[ host1 ][ 'vlan' ]
- if main.hostsData[ host2 ][ 'vlan' ] != '-1':
- vlan2 = main.hostsData[ host2 ][ 'vlan' ]
- if not h1Id:
- h1Id = main.hostsData[ host1 ][ 'id' ]
- if not h2Id:
- h2Id = main.hostsData[ host2 ][ 'id' ]
+ main.log.info( itemName + ": Adding single point to multi point intents" )
- assert h1Id and h2Id, "You must specify host IDs"
- if not ( h1Id and h2Id ):
- main.log.info( "There are no host IDs" )
- return main.FALSE
+ if not host1.get( "id" ):
+ main.log.warn( "ID not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
+ main.log.debug( main.hostsData.get( host1.get( "name" ) ) )
+ host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "id" )
- # Discover hosts using arping
- if not main.hostsData:
- main.log.info( itemName + ": Discover host using arping" )
- main.Mininet1.arping( srcHost=host1, dstHost=host2 )
- main.Mininet1.arping( srcHost=host2, dstHost=host1 )
- h1Id = main.CLIs[ 0 ].getHost( mac=h1Mac )
- h2Id = main.CLIs[ 0 ].getHost( mac=h2Mac )
-
- # Check flows count in each node
- checkFlowsCount( main )
+ if not host2.get( "id" ):
+ main.log.warn( "ID not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
+ host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "id" )
# Adding host intents
main.log.info( itemName + ": Adding host intents" )
- intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=h1Id,
- hostIdTwo=h2Id )
+ intent1 = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
+ hostIdTwo=host2.get( "id" ) )
# Get all intents ID in the system, time delay right after intents are added
time.sleep( main.addIntentSleep )
intentsId = main.CLIs[ 0 ].getIntentsId()
- # Check intents state
- time.sleep( main.checkIntentSleep )
- intentResult = checkIntentState( main, intentsId )
- checkFlowsCount( main )
+ if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
+ args = (main, intentsId ), sleep=main.checkIntentSleep ):
+ return intentsId
+ else:
+ main.log.error( "Host Intent did not install correctly" )
+ return main.FALSE
- # Check intents state again if first check fails...
- if not intentResult:
- intentResult = checkIntentState( main, intentsId )
+def testHostIntent( main,
+ name,
+ intentId,
+ host1,
+ host2,
+ onosNode=0,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=0):
+ """
+ Test a Host Intent
- # Check flows count in each node
- checkFlowsCount( main )
- # Verify flows
- checkFlowsState( main )
+ Description:
+ Test a host intent of given ID between given hosts
- # Ping hosts
- firstPingResult = pingallHosts( main, hostNames )
- if not firstPingResult:
- main.log.debug( "First ping failed, there must be" +
- " something wrong with ONOS performance" )
+ Steps:
+ - Fetch host data if not given
+ - Check Intent State
+ - Check Flow State
+ - Check Connectivity
+ - Check Lack of Connectivity Between Hosts not in the Intent
+ - Reroute
+ - Take Expected Link Down
+ - Check Intent State
+ - Check Flow State
+ - Check Topology
+ - Check Connectivity
+ - Bring Expected Link Up
+ - Check Intent State
+ - Check Flow State
+ - Check Topology
+ - Check Connectivity
+ - Remove Topology
- # Ping hosts again...
- pingResult = pingResult and pingallHosts( main, hostNames )
-
- # Test rerouting if these variables exist
- if sw1 and sw2 and expectedLink:
- # link down
- linkDownResult = link( main, sw1, sw2, "down" )
- intentResult = intentResult and checkIntentState( main, intentsId )
-
- # Check flows count in each node
- checkFlowsCount( main )
- # Verify flows
- checkFlowsState( main )
-
- # Check OnosTopology
- topoResult = checkTopology( main, expectedLink )
-
- # Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
-
- intentResult = checkIntentState( main, intentsId )
-
- # 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" )
-
- # link up
- linkUpResult = link( main, sw1, sw2, "up" )
- time.sleep( main.rerouteSleep )
-
- # Check flows count in each node
- checkFlowsCount( main )
- # Verify flows
- checkFlowsState( main )
-
- # Check OnosTopology
- topoResult = checkTopology( main, main.numLinks )
-
- # Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
-
- intentResult = checkIntentState( main, intentsId )
-
- # 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 )
-
- stepResult = pingResult and linkDownResult and linkUpResult \
- and intentResult and removeIntentResult
-
- return stepResult
-
-def pointIntent( main,
- name,
- host1,
- host2,
- onosNode=0,
- deviceId1="",
- deviceId2="",
- port1="",
- port2="",
- ethType="",
- mac1="",
- mac2="",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="",
- sw2="",
- expectedLink=0 ):
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ intentId - intent ID to be tested ( and removed )
+ host1 - Dictionary for host1
+ { "name":"h8", "id":"of:0000000000000005/8" }
+ host2 - Dictionary for host2
+ { "name":"h16", "id":"of:0000000000000006/8" }
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
"""
- Description:
- Verify add-point-intent
- Steps:
- - Get device ids | ports
- - Add point 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
- Required:
- name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
- host1 - Name of first host
- host2 - Name of second host
- Optional:
- onosNode - ONOS node to install the intents in main.CLIs[ ]
- 0 by default so that it will always use the first
- ONOS node
- deviceId1 - ONOS device id of the first switch, the same as the
- location of the first host eg. of:0000000000000001/1,
- located at device 1 port 1
- deviceId2 - ONOS device id of the second switch
- port1 - The port number where the first host is attached
- port2 - The port number where the second host is attached
- ethType - Ethernet type eg. IPV4, IPV6
- mac1 - Mac address of first host
- mac2 - Mac address of the second host
- bandwidth - Bandwidth capacity
- lambdaAlloc - Allocate lambda, defaults to False
- ipProto - IP protocol
- ip1 - IP address of first host
- ip2 - IP address of second host
- tcp1 - TCP port of first host
- tcp2 - TCP port of second host
- sw1 - First switch to bring down & up for rerouting purpose
- sw2 - Second switch to bring down & up for rerouting purpose
- expectedLink - Expected link when the switches are down, it should
- be two links lower than the links before the two
- switches are down
- """
+ # Parameter Validity Check
assert main, "There is no main variable"
- assert name, "variable name is empty"
- assert host1 and host2, "You must specify hosts"
+ assert host1, "You must specify host1"
+ assert host2, "You must specify host2"
global itemName
itemName = name
- host1 = host1
- host2 = host2
- hostNames = [ host1, host2 ]
- intentsId = []
-
- pingResult = main.TRUE
- intentResult = main.TRUE
- removeIntentResult = main.TRUE
- flowResult = main.TRUE
- topoResult = main.TRUE
- linkDownResult = main.TRUE
- linkUpResult = main.TRUE
+ tempHostsData = {}
onosNode = int( onosNode )
- # Adding bidirectional point intents
- main.log.info( itemName + ": Adding point intents" )
- intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
- egressDevice=deviceId2,
- ingressPort=port1,
- egressPort=port2,
- ethType=ethType,
- ethSrc=mac1,
- ethDst=mac2,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip1,
- ipDst=ip2,
- tcpSrc=tcp1,
- tcpDst=tcp2 )
+ main.log.info( itemName + ": Testing Host Intent" )
- intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
- egressDevice=deviceId1,
- ingressPort=port2,
- egressPort=port1,
- ethType=ethType,
- ethSrc=mac2,
- ethDst=mac1,
- bandwidth=bandwidth,
- lambdaAlloc=lambdaAlloc,
- ipProto=ipProto,
- ipSrc=ip2,
- ipDst=ip1,
- tcpSrc=tcp2,
- tcpDst=tcp1 )
+ if not host1.get( "id" ):
+ main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
+ host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "location" )
- # Get all intents ID in the system, time delay right after intents are added
- time.sleep( main.addIntentSleep )
- intentsId = main.CLIs[ 0 ].getIntentsId()
+ if not host2.get( "id" ):
+ main.log.warn( "Id not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
+ host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "location" )
- # Check intents state
- time.sleep( main.checkIntentSleep )
- intentResult = checkIntentState( main, intentsId )
- # Check flows count in each node
- checkFlowsCount( main )
+ senderNames = [ host1.get( "name" ), host2.get( "name" ) ]
+ recipientNames = [ host1.get( "name" ), host2.get( "name" ) ]
- # Check intents state again if first check fails...
- if not intentResult:
- intentResult = checkIntentState( main, intentsId )
+ testResult = main.TRUE
+ main.log.info( itemName + ": Adding single point to multi point intents" )
+
+ # Check intent state
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
+ testResult = main.FALSE
# Check flows count in each node
- checkFlowsCount( main )
- # Verify flows
- checkFlowsState( main )
+ 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 ):
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Intial Flow State Failed\n'
+ testResult = main.FALSE
- # Ping hosts
- firstPingResult = pingallHosts( main, hostNames )
- if not firstPingResult:
- main.log.debug( "First ping failed, there must be" +
- " something wrong with ONOS performance" )
-
- # Ping hosts again...
- pingResult = pingResult and pingallHosts( main, hostNames )
+ # Check Connectivity
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ main.assertReturnString += 'Initial Ping Passed\n'
+ else:
+ main.assertReturnString += 'Initial Ping Failed\n'
+ testResult = main.FALSE
# Test rerouting if these variables exist
if sw1 and sw2 and expectedLink:
- # link down
- linkDownResult = link( main, sw1, sw2, "down" )
- intentResult = intentResult and checkIntentState( main, intentsId )
+ # Take link down
+ if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
+ main.assertReturnString += 'Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Failed\n'
+ testResult = main.FALSE
+
+ # Check intent state
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
+ testResult = main.FALSE
# Check flows count in each node
- checkFlowsCount( main )
- # Verify flows
- checkFlowsState( main )
+ 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 ):
+ main.assertReturnString += 'Link Down Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Flow State Failed\n'
+ testResult = main.FALSE
# Check OnosTopology
- topoResult = checkTopology( main, expectedLink )
-
- # Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
-
- intentResult = checkIntentState( main, intentsId )
-
- # Checks ONOS state in link down
- if linkDownResult and topoResult and pingResult and intentResult:
- main.log.info( itemName + ": Successfully brought link down" )
+ if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink ), sleep=10 ):
+ main.assertReturnString += 'Link Down Topology State Passed\n'
else:
- main.log.error( itemName + ": Failed to bring link down" )
+ main.assertReturnString += 'Link Down Topology State Failed\n'
+ testResult = main.FALSE
- # link up
- linkUpResult = link( main, sw1, sw2, "up" )
+ # Check Connection
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ main.assertReturnString += 'Link Down Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Pingall Failed\n'
+ testResult = main.FALSE
+
+ # Bring link up
+ if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
+ main.assertReturnString += 'Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Failed\n'
+ testResult = main.FALSE
+
+ # Wait for reroute
time.sleep( main.rerouteSleep )
+ # Check Intents
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Link Up Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Intent State Failed\n'
+ testResult = main.FALSE
+
# Check flows count in each node
- checkFlowsCount( main )
- # Verify flows
- checkFlowsState( main )
+ 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 ):
+ main.assertReturnString += 'Link Up Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Flow State Failed\n'
+ testResult = main.FALSE
# Check OnosTopology
- topoResult = checkTopology( main, main.numLinks )
-
- # Ping hosts
- pingResult = pingResult and pingallHosts( main, hostNames )
-
- intentResult = checkIntentState( main, intentsId )
-
- # Checks ONOS state in link up
- if linkUpResult and topoResult and pingResult and intentResult:
- main.log.info( itemName + ": Successfully brought link back up" )
+ if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
+ main.assertReturnString += 'Link Up Topology State Passed\n'
else:
- main.log.error( itemName + ": Failed to bring link back up" )
+ main.assertReturnString += 'Link Up Topology State Failed\n'
+ testResult = main.FALSE
+
+ # Check Connection
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ main.assertReturnString += 'Link Up Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Pingall Failed\n'
+ testResult = main.FALSE
# Remove all intents
- removeIntentResult = removeAllIntents( main )
+ if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, ) ):
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
+ testResult = main.FALSE
- stepResult = pingResult and linkDownResult and linkUpResult \
- and intentResult and removeIntentResult
+ return testResult
- return stepResult
+def installPointIntent( main,
+ name,
+ senders,
+ recipients,
+ onosNode=0,
+ ethType="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipSrc="",
+ ipDst="",
+ tcpSrc="",
+ tcpDst=""):
+ """
+ Installs a Single to Single Point Intent
+
+ Description:
+ Install a single to single point intent
+
+ Steps:
+ - Fetch host data if not given
+ - Add point intent
+ - Ingress device is the first sender device
+ - Egress device is the first recipient device
+ - Ports if defined in senders or recipients
+ - MAC address ethSrc loaded from Ingress device
+ - Check intent state with retry
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+ senders - List of host dictionaries i.e.
+ [ { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } ]
+ recipients - List of host dictionaries i.e.
+ [ { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" } ]
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ ethType - Ethernet type eg. IPV4, IPV6
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ tcp - TCP ports in the same order as the hosts in hostNames
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+ """
+
+ assert main, "There is no main variable"
+ assert senders, "You must specify a sender"
+ assert recipients, "You must specify a recipient"
+ # Assert devices or main.hostsData, "You must specify devices"
+
+ global itemName # The name of this run. Used for logs.
+ itemName = name
+ onosNode = int( onosNode )
+
+ main.log.info( itemName + ": Adding single to single point intents" )
+
+ for sender in senders:
+ if not sender.get( "device" ):
+ main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
+ sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
+
+ for recipient in recipients:
+ if not recipient.get( "device" ):
+ main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
+ recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+
+
+ ingressDevice = senders[ 0 ].get( "device" )
+ egressDevice = recipients[ 0 ].get( "device" )
+
+ portIngress = senders[ 0 ].get( "port", "" )
+ portEgress = recipients[ 0 ].get( "port", "" )
+ main.log.debug( ingressDevice )
+ main.log.debug( egressDevice )
+
+ srcMac = senders[ 0 ].get( "mac" )
+ dstMac = recipients[ 0 ].get( "mac" )
+
+ ipSrc = senders[ 0 ].get( "ip" )
+ ipDst = recipients[ 0 ].get( "ip" )
+
+ intent1 = main.CLIs[ onosNode ].addPointIntent(
+ ingressDevice=ingressDevice,
+ egressDevice=egressDevice,
+ ingressPort=portIngress,
+ egressPort=portEgress,
+ ethType=ethType,
+ ethSrc=srcMac,
+ ethDst=dstMac,
+ bandwidth=bandwidth,
+ lambdaAlloc=lambdaAlloc,
+ ipProto=ipProto,
+ ipSrc=ipSrc,
+ ipDst=ipDst,
+ tcpSrc=tcpSrc,
+ tcpDst=tcpDst )
+
+ time.sleep( main.addIntentSleep )
+ intentsId = main.CLIs[ 0 ].getIntentsId()
+
+ if utilities.retry ( f=checkIntentState, retValue=main.FALSE,
+ args = (main, intentsId ), sleep=main.checkIntentSleep ):
+ return intentsId
+ else:
+ main.log.error( "Single to Single point intent did not install correctly" )
+ return main.FALSE
+
+ # Check intents state
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentsId ), sleep=main.checkIntentSleep ):
+ return intentsId
+ else:
+ main.log.error( "Point Intent did not install correctly" )
+ return main.FALSE
+
+def testPointIntent( main,
+ name,
+ intentId,
+ senders,
+ recipients,
+ badSenders={},
+ badRecipients={},
+ onosNode=0,
+ ethType="",
+ bandwidth="",
+ lambdaAlloc=False,
+ ipProto="",
+ ipAddresses="",
+ tcp="",
+ sw1="s5",
+ sw2="s2",
+ expectedLink=0):
+ """
+ Test a Point Intent
+
+ Description:
+ Test a point intent
+
+ Steps:
+ - Fetch host data if not given
+ - Check Intent State
+ - Check Flow State
+ - Check Connectivity
+ - Check Lack of Connectivity Between Hosts not in the Intent
+ - Reroute
+ - Take Expected Link Down
+ - Check Intent State
+ - Check Flow State
+ - Check Topology
+ - Check Connectivity
+ - Bring Expected Link Up
+ - Check Intent State
+ - Check Flow State
+ - Check Topology
+ - Check Connectivity
+ - Remove Topology
+
+ Required:
+ name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
+
+ senders - List of host dictionaries i.e.
+ { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
+ recipients - List of host dictionaries i.e.
+ { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }
+ Optional:
+ onosNode - ONOS node to install the intents in main.CLIs[ ]
+ 0 by default so that it will always use the first
+ ONOS node
+ ethType - Ethernet type eg. IPV4, IPV6
+ bandwidth - Bandwidth capacity
+ lambdaAlloc - Allocate lambda, defaults to False
+ ipProto - IP protocol
+ tcp - TCP ports in the same order as the hosts in hostNames
+ sw1 - First switch to bring down & up for rerouting purpose
+ sw2 - Second switch to bring down & up for rerouting purpose
+ expectedLink - Expected link when the switches are down, it should
+ be two links lower than the links before the two
+ switches are down
+
+ """
+
+ # Parameter Validity Check
+ assert main, "There is no main variable"
+ assert senders, "You must specify a sender"
+ assert recipients, "You must specify a recipient"
+
+ global itemName
+ itemName = name
+ tempHostsData = {}
+ onosNode = int( onosNode )
+
+ main.log.info( itemName + ": Testing Point Intent" )
+
+ # Names for scapy
+ senderNames = [ x.get( "name" ) for x in senders ]
+ recipientNames = [ x.get( "name" ) for x in recipients ]
+ badSenderNames = [ x.get( "name" ) for x in badSenders ]
+ badRecipientNames = [ x.get( "name" ) for x in badRecipients ]
+
+ for sender in senders:
+ if not sender.get( "device" ):
+ main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
+ sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
+
+ for recipient in recipients:
+ if not recipient.get( "device" ):
+ main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
+ recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
+
+ testResult = main.TRUE
+ main.log.info( itemName + ": Testing point intents" )
+
+ # Check intent state
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Initial Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Initial Intent State Failed\n'
+ 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 ):
+ main.assertReturnString += 'Initial Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Intial Flow State Failed\n'
+ testResult = main.FALSE
+
+ # Check Connectivity
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ main.assertReturnString += 'Initial Ping Passed\n'
+ else:
+ main.assertReturnString += 'Initial Ping Failed\n'
+ testResult = main.FALSE
+
+ # Check connections that shouldn't work
+ if badSenderNames:
+ main.log.info( "Checking that packets from incorrect sender do not go through" )
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, badSenderNames, recipientNames ), kwargs={ "expectFailure":True } ):
+ main.assertReturnString += 'Bad Sender Ping Passed\n'
+ else:
+ main.assertReturnString += 'Bad Sender Ping Failed\n'
+ testResult = main.FALSE
+
+ if badRecipientNames:
+ main.log.info( "Checking that packets to incorrect recipients do not go through" )
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, badRecipientNames ), kwargs={ "expectFailure":True } ):
+ main.assertReturnString += 'Bad Recipient Ping Passed\n'
+ else:
+ main.assertReturnString += 'Bad Recipient Ping Failed\n'
+ testResult = main.FALSE
+
+ # Test rerouting if these variables exist
+ if sw1 and sw2 and expectedLink:
+ # Take link down
+ if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
+ main.assertReturnString += 'Link Down Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Failed\n'
+ testResult = main.FALSE
+
+ # Check intent state
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Link Down Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Intent State Failed\n'
+ 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 ):
+ main.assertReturnString += 'Link Down Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Flow State Failed\n'
+ testResult = main.FALSE
+
+ # Check OnosTopology
+ if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink ), sleep=10 ):
+ main.assertReturnString += 'Link Down Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Topology State Failed\n'
+ testResult = main.FALSE
+
+ # Check Connection
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ main.assertReturnString += 'Link Down Pingall Passed\n'
+ else:
+ main.assertReturnString += 'Link Down Pingall Failed\n'
+ testResult = main.FALSE
+
+ # Bring link up
+ if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
+ main.assertReturnString += 'Link Up Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Failed\n'
+ testResult = main.FALSE
+
+ # Wait for reroute
+ time.sleep( main.rerouteSleep )
+
+ # Check Intents
+ if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, intentId ), sleep=main.checkIntentSleep ):
+ main.assertReturnString += 'Link Up Intent State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Intent State Failed\n'
+ 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 ):
+ main.assertReturnString += 'Link Up Flow State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Flow State Failed\n'
+ testResult = main.FALSE
+
+ # Check OnosTopology
+ if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
+ main.assertReturnString += 'Link Up Topology State Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Topology State Failed\n'
+ testResult = main.FALSE
+
+ # Check Connection
+ if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames ) ):
+ main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
+ else:
+ main.assertReturnString += 'Link Up Scapy Packet Recieved Failed\n'
+ testResult = main.FALSE
+
+ # Remove all intents
+ if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, ) ):
+ main.assertReturnString += 'Remove Intents Passed'
+ else:
+ main.assertReturnString += 'Remove Intents Failed'
+ testResult = main.FALSE
+
+ return testResult
def pointIntentTcp( main,
name,
@@ -1233,16 +1428,17 @@
main.log.info( itemName + ": Intents are installed correctly" )
else:
# Wait for at least 5 second before checking the intents again
+ main.log.error( "Intents are not installed correctly. Waiting 5 sec" )
time.sleep( 5 )
results = []
# Second check of intents since some of the intents may be in
# INSTALLING state, they should be in INSTALLED at this time
for i in range( main.numCtrls ):
- tempResult = main.CLIs[ i ].checkIntentState(
- intentsId=intentsId )
+ tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
results.append( tempResult )
if all( result == main.TRUE for result in results ):
main.log.info( itemName + ": Intents are installed correctly" )
+ intentResult = main.TRUE
else:
main.log.error( itemName + ": Intents are NOT installed correctly" )
intentResult = main.FALSE
@@ -1296,10 +1492,191 @@
else:
for i in range( main.numCtrls ):
main.log.debug( itemName + ": ONOS node " + str( i + 1 ) +
- " has " + flowsCount[ i ] + " flows" )
+ " has " + str( flowsCount[ i ] ) + " flows" )
else:
main.log.error( "Checking flows count failed, check summary command" )
return main.FALSE
return main.TRUE
+def sendDiscoveryArp( main, hosts=None ):
+ """
+ Sends Discovery ARP packets from each host provided
+ Defaults to each host in main.scapyHosts
+ """
+ # Send an arp ping from each host
+ if not hosts:
+ hosts = main.scapyHosts
+ for host in hosts:
+ pkt = 'Ether( src="{0}")/ARP( psrc="{1}")'.format( host.hostMac ,host.hostIp )
+ # Send from the VLAN interface if there is one so ONOS discovers the VLAN correctly
+ iface = None
+ for interface in host.getIfList():
+ if '.' in interface:
+ main.log.debug( "Detected VLAN interface {0}. Sending ARP packet from {0}".format( interface ) )
+ iface = interface
+ break
+ host.sendPacket( packet=pkt, iface=iface )
+ main.log.info( "Sending ARP packet from {0}".format( host.name ) )
+
+def confirmHostDiscovery( main ):
+ """
+ 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
+
+ # Check for matching hosts on each node
+ scapyHostIPs = [ x.hostIp for x in main.scapyHosts if x.hostIp != "0.0.0.0" ]
+ for controller in range( main.numCtrls ):
+ controllerStr = str( controller + 1 ) # ONOS node number
+ # Compare Hosts
+ # Load hosts data for controller node
+ if hosts[ controller ] and "Error" not in hosts[ controller ]:
+ try:
+ hostData = json.loads( hosts[ controller ] )
+ except ( TypeError, ValueError ):
+ main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
+ hostFails.append( controllerStr )
+ else:
+ onosHostIPs = [ x.get( "ipAddresses" )[ 0 ]
+ for x in hostData
+ if len( x.get( "ipAddresses" ) ) > 0 ]
+ if not set( collections.Counter( scapyHostIPs ) ).issubset( set ( collections.Counter( onosHostIPs ) ) ):
+ main.log.warn( "Controller {0} only sees nodes with {1} IPs. It should see all of the following: {2}".format( controllerStr, onosHostIPs, scapyHostIPs ) )
+ hostFails.append( controllerStr )
+ else:
+ main.log.error( "Hosts returned nothing or an error." )
+ hostFails.append( controllerStr )
+
+ if hostFails:
+ main.log.error( "List of failed ONOS Nodes:" + ', '.join(map(str, hostFails )) )
+ return main.FALSE
+ else:
+ return main.TRUE
+
+def populateHostData( main ):
+ """
+ Populates hostsData
+ """
+ import json
+ try:
+ hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
+ hosts = main.Mininet1.getHosts().keys()
+ # TODO: Make better use of new getHosts function
+ for host in hosts:
+ main.hostsData[ host ] = {}
+ main.hostsData[ host ][ 'mac' ] = \
+ main.Mininet1.getMacAddress( host ).upper()
+ for hostj in hostsJson:
+ if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
+ main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
+ main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
+ main.hostsData[ host ][ 'location' ] = \
+ hostj[ 'location' ][ 'elementId' ] + '/' + \
+ hostj[ 'location' ][ 'port' ]
+ main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
+ return main.TRUE
+ except KeyError:
+ main.log.error( "KeyError while populating hostsData")
+ return main.FALSE
+
+def scapyCheckConnection( main, senders, recipients, packet=None, packetFilter=None, expectFailure=False ):
+ """
+ Checks the connectivity between all given sender hosts and all given recipient hosts
+ Packet may be specified. Defaults to Ether/IP packet
+ Packet Filter may be specified. Defaults to Ether/IP from current sender MAC
+ Todo: Optional packet and packet filter attributes for sender and recipients
+ Expect Failure when the sender and recipient are not supposed to have connectivity
+ Timeout of 1 second, returns main.TRUE if the filter is not triggered and kills the filter
+
+ """
+ connectionsFunctional = main.TRUE
+
+ if not packetFilter:
+ packetFilter = 'ether host {}'
+
+ if expectFailure:
+ timeout = 1
+ else:
+ timeout = 10
+
+ for sender in senders:
+ try:
+ senderComp = getattr( main, sender )
+ except AttributeError:
+ main.log.error( "main has no attribute {}".format( sender ) )
+ connectionsFunctional = main.FALSE
+ continue
+
+ for recipient in recipients:
+ # Do not send packets to self since recipient CLI will already be busy
+ if recipient == sender:
+ continue
+ try:
+ recipientComp = getattr( main, recipient )
+ except AttributeError:
+ main.log.error( "main has no attribute {}".format( recipient ) )
+ connectionsFunctional = main.FALSE
+ continue
+
+ recipientComp.startFilter( pktFilter = packetFilter.format( senderComp.hostMac ) )
+
+ if not packet:
+ pkt = 'Ether( src="{0}", dst="{2}" )/IP( src="{1}", dst="{3}" )'.format(
+ senderComp.hostMac,
+ senderComp.hostIp,
+ recipientComp.hostMac,
+ recipientComp.hostIp )
+ else:
+ pkt = packet
+ senderComp.sendPacket( packet = pkt )
+
+ if recipientComp.checkFilter( timeout ):
+ if expectFailure:
+ main.log.error( "Packet from {0} successfully received by {1} when it should not have been".format( sender , recipient ) )
+ connectionsFunctional = main.FALSE
+ else:
+ main.log.info( "Packet from {0} successfully received by {1}".format( sender , recipient ) )
+ else:
+ recipientComp.killFilter()
+ if expectFailure:
+ main.log.info( "As expected, packet from {0} was not received by {1}".format( sender , recipient ) )
+ else:
+ main.log.error( "Packet from {0} was not received by {1}".format( sender , recipient ) )
+ connectionsFunctional = main.FALSE
+
+ return connectionsFunctional
+
+def report( main ):
+ """
+ Report errors/warnings/exceptions
+ """
+ main.ONOSbench.logReport( main.ONOSip[ 0 ],
+ [ "INFO",
+ "FOLLOWER",
+ "WARN",
+ "flow",
+ "ERROR",
+ "Except" ],
+ "s" )
+
+ main.log.info( "ERROR report: \n" )
+ for i in range( main.numCtrls ):
+ main.ONOSbench.logReport( main.ONOSip[ i ],
+ [ "ERROR" ],
+ "d" )
+
+ main.log.info( "EXCEPTIONS report: \n" )
+ for i in range( main.numCtrls ):
+ main.ONOSbench.logReport( main.ONOSip[ i ],
+ [ "Except" ],
+ "d" )
+
+ main.log.info( "WARNING report: \n" )
+ for i in range( main.numCtrls ):
+ main.ONOSbench.logReport( main.ONOSip[ i ],
+ [ "WARN" ],
+ "d" )
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.params b/TestON/tests/FUNCintentRest/FUNCintentRest.params
index 058b57a..94339b4 100644
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.params
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.params
@@ -2,22 +2,25 @@
# CASE - Description
# 1 - Variable initialization and optional pull and build ONOS package
# 2 - Install ONOS
+ # 8 - Compare Topology
# 9 - Report logs
# 10 - Start Mininet with Openflow 1.0
# 11 - Start Mininet with Openflow 1.3
# 12 - Assign switch to controller
- # 13 - Create a data of hosts information
- # 14 - Stop Mininet
+ # 13 - Create Scapy Components
+ # 14 - Discover all hosts and Create a dictionary of hosts information
+ # 15 - Discover hosts with scapy arping ( only discovers scapy hosts )
+ # 16 - Stop Mininet
# 1000 - Test host intents
# 2000 - Test point intents
# 3000 - Test single to multi point intents
# 4000 - Test multi to single point intents
# 5000 - Test host mobility
- <testcases>1,[2,10,12,13,1000,2000,14],[2,11,12,13,1000,2000,14]</testcases>
+ <testcases>1,[2,10,12,13,15,1000,2000,5000,16]*2,[2,11,12,13,15,1000,2000,5000,16]*2</testcases>
<SCALE>
- <size>1,1</size>
+ <size>1,3,1,3</size>
</SCALE>
<DEPENDENCY>
@@ -40,8 +43,10 @@
<startup>15</startup>
<reroute>5</reroute>
<checkintent>5</checkintent>
- <fwd>5</fwd>
- <addIntent>3</addIntent>
+ <removeintent>10</removeintent>
+ <fwd>10</fwd>
+ <addIntent>10</addIntent>
+ <topoAttempts>3</topoAttempts>
</SLEEP>
<MININET>
@@ -49,6 +54,10 @@
<links>20</links>
</MININET>
+ <SCAPY>
+ <HOSTNAMES>h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13,h14,h15,h16,h17,h18,h19,h20,h21,h22,h23,h24</HOSTNAMES>
+ </SCAPY>
+
# Intent tests params
<SDNIP>
<tcpProto>6</tcpProto>
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNCintentRest/FUNCintentRest.py
index c5f12ab..258a9c1 100644
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.py
@@ -1,5 +1,10 @@
# Testing the basic intent functionality of ONOS
+# TODO: Replace the CLI calls with REST API equivalents as they become available.
+# - May need to write functions in the onosrestdriver.py file to do this
+# TODO: Complete implementation of case 3000, 4000, and 6000 as REST API allows
+# -Currently there is no support in the REST API for Multi to Single and Single to Multi point intents
+# As such, these cases are incomplete and should not be enabled in the .params file
import time
import json
@@ -48,11 +53,12 @@
wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
- main.checkIntentSleep = int( main.params[ 'SLEEP' ]\
- [ 'checkintent' ] )
+ main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
+ main.removeIntentsleeo = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
main.addIntentSleep = int( main.params[ 'SLEEP' ][ 'addIntent' ] )
+ main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
gitPull = main.params[ 'GIT' ][ 'pull' ]
main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
@@ -60,8 +66,12 @@
main.hostsData = {}
main.CLIs = []
main.ONOSip = []
+ main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
+ main.scapyHosts = [] # List of scapy hosts for iterating
+ main.assertReturnString = '' # Assembled assert return string
main.ONOSip = main.ONOSbench.getOnosIps()
+ print main.ONOSip
# Assigning ONOS cli handles to a list
try:
@@ -94,7 +104,7 @@
copyResult1 = main.ONOSbench.scp( main.Mininet1,
main.dependencyPath +
main.topology,
- main.Mininet1.home,
+ main.Mininet1.home + "custom/",
direction="to" )
if main.CLIs:
stepResult = main.TRUE
@@ -154,6 +164,18 @@
main.log.info( "Safety check, killing all ONOS processes" +
" before initiating environment setup" )
+ time.sleep( main.startUpSleep )
+ main.step( "Uninstalling ONOS package" )
+ onosUninstallResult = main.TRUE
+ for ip in main.ONOSip:
+ onosUninstallResult = onosUninstallResult and \
+ main.ONOSbench.onosUninstall( nodeIp=ip )
+ stepResult = onosUninstallResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully uninstalled ONOS package",
+ onfail="Failed to uninstall ONOS package" )
+
for i in range( main.maxNodes ):
main.ONOSbench.onosDie( main.ONOSip[ i ] )
@@ -186,18 +208,6 @@
onfail="Failed to create ONOS package" )
time.sleep( main.startUpSleep )
- main.step( "Uninstalling ONOS package" )
- onosUninstallResult = main.TRUE
- for ip in main.ONOSip:
- onosUninstallResult = onosUninstallResult and \
- main.ONOSbench.onosUninstall( nodeIp=ip )
- stepResult = onosUninstallResult
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="Successfully uninstalled ONOS package",
- onfail="Failed to uninstall ONOS package" )
-
- time.sleep( main.startUpSleep )
main.step( "Installing ONOS package" )
onosInstallResult = main.TRUE
for i in range( main.numCtrls ):
@@ -234,12 +244,103 @@
onpass="ONOS service is ready",
onfail="ONOS service did not start properly" )
+ # Revisit adding the cli after ensuring the test works without it
+ # Start an ONOS cli to provide functionality that is not currently
+ # supported by the Rest API
+
+ # main.step( "Start ONOS cli" )
+ # cliResult = main.TRUE
+ # for i in range( main.numCtrls ):
+ # cliResult = cliResult and \
+ # main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+ # stepResult = cliResult
+ # utilities.assert_equals( expect=main.TRUE,
+ # actual=stepResult,
+ # onpass="Successfully start ONOS cli",
+ # onfail="Failed to start ONOS cli" )
+
# Remove the first element in main.scale list
main.scale.remove( main.scale[ 0 ] )
+ main.intentFunction.report( main )
+
def CASE8( self, main ):
+ # OLD FUNCintentRest CASE 8
+ # This remains here for archiving and reference purposes and will be
+ # removed when the new FUNCintentRest is verified to work.
+ # """
+ # Compare Topo
+ # """
+ # import json
+
+ # main.case( "Compare ONOS Topology view to Mininet topology" )
+ # main.caseExplanation = "Compare topology elements between Mininet" +\
+ # " and ONOS"
+
+ # main.step( "Gathering topology information" )
+ # # TODO: add a paramaterized sleep here
+ # devicesResults = main.TRUE # Overall Boolean for device correctness
+ # linksResults = main.TRUE # Overall Boolean for link correctness
+ # hostsResults = main.TRUE # Overall Boolean for host correctness
+ # devices = main.topo.getAllDevices( main )
+ # hosts = main.topo.getAllHosts( main )
+ # ports = main.topo.getAllPorts( main )
+ # links = main.topo.getAllLinks( main )
+ # clusters = main.topo.getAllClusters( main )
+
+ # mnSwitches = main.Mininet1.getSwitches()
+ # mnLinks = main.Mininet1.getLinks()
+ # mnHosts = main.Mininet1.getHosts()
+
+ # main.step( "Comparing MN topology to ONOS topology" )
+ # for controller in range( main.numCtrls ):
+ # controllerStr = str( controller + 1 )
+ # if devices[ controller ] and ports[ controller ] and\
+ # "Error" not in devices[ controller ] and\
+ # "Error" not in ports[ controller ]:
+
+ # currentDevicesResult = main.Mininet1.compareSwitches(
+ # mnSwitches,
+ # json.loads( devices[ controller ] ),
+ # json.loads( ports[ controller ] ) )
+ # else:
+ # currentDevicesResult = main.FALSE
+ # utilities.assert_equals( expect=main.TRUE,
+ # actual=currentDevicesResult,
+ # onpass="ONOS" + controllerStr +
+ # " Switches view is correct",
+ # onfail="ONOS" + controllerStr +
+ # " Switches view is incorrect" )
+
+ # if links[ controller ] and "Error" not in links[ controller ]:
+ # currentLinksResult = main.Mininet1.compareLinks(
+ # mnSwitches, mnLinks,
+ # json.loads( links[ controller ] ) )
+ # else:
+ # currentLinksResult = main.FALSE
+ # utilities.assert_equals( expect=main.TRUE,
+ # actual=currentLinksResult,
+ # onpass="ONOS" + controllerStr +
+ # " links view is correct",
+ # onfail="ONOS" + controllerStr +
+ # " links view is incorrect" )
+
+ # if hosts[ controller ] or "Error" not in hosts[ controller ]:
+ # currentHostsResult = main.Mininet1.compareHosts(
+ # mnHosts,
+ # json.loads( hosts[ controller ] ) )
+ # else:
+ # currentHostsResult = main.FALSE
+ # utilities.assert_equals( expect=main.TRUE,
+ # actual=currentHostsResult,
+ # onpass="ONOS" + controllerStr +
+ # " hosts exist in Mininet",
+ # onfail="ONOS" + controllerStr +
+ # " hosts don't match Mininet" )
+
+ # NEW FUNCintentRest Case 8 as based off of the CASE 8 from FUNCintent
"""
- Compare Topo
+ Compare ONOS Topology to Mininet Topology
"""
import json
@@ -247,66 +348,114 @@
main.caseExplanation = "Compare topology elements between Mininet" +\
" and ONOS"
- main.step( "Gathering topology information" )
- # TODO: add a paramaterized sleep here
- devicesResults = main.TRUE
- linksResults = main.TRUE
- hostsResults = main.TRUE
- devices = main.topo.getAllDevices( main )
- hosts = main.topo.getAllHosts( main )
- ports = main.topo.getAllPorts( main )
- links = main.topo.getAllLinks( main )
- clusters = main.topo.getAllClusters( main )
+ main.log.info( "Gathering topology information from Mininet" )
+ devicesResults = main.FALSE # Overall Boolean for device correctness
+ linksResults = main.FALSE # Overall Boolean for link correctness
+ hostsResults = main.FALSE # Overall Boolean for host correctness
+ deviceFails = [] # Nodes where devices are incorrect
+ linkFails = [] # Nodes where links are incorrect
+ hostFails = [] # Nodes where hosts are incorrect
+ attempts = main.checkTopoAttempts # Remaining Attempts
mnSwitches = main.Mininet1.getSwitches()
mnLinks = main.Mininet1.getLinks()
mnHosts = main.Mininet1.getHosts()
- main.step( "Comparing MN topology to ONOS topology" )
- for controller in range( main.numCtrls ):
- controllerStr = str( controller + 1 )
- if devices[ controller ] and ports[ controller ] and\
- "Error" not in devices[ controller ] and\
- "Error" not in ports[ controller ]:
+ main.step( "Comparing Mininet topology to ONOS topology" )
- currentDevicesResult = main.Mininet1.compareSwitches(
- mnSwitches,
- json.loads( devices[ controller ] ),
- json.loads( ports[ controller ] ) )
- else:
- currentDevicesResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentDevicesResult,
- onpass="ONOS" + controllerStr +
- " Switches view is correct",
- onfail="ONOS" + controllerStr +
- " Switches view is incorrect" )
+ while ( attempts >= 0 ) and\
+ ( not devicesResults or not linksResults or not hostsResults ):
+ time.sleep( 2 )
+ if not devicesResults:
+ devices = main.topo.getAllDevices( main )
+ ports = main.topo.getAllPorts( main )
+ devicesResults = main.TRUE
+ deviceFails = [] # Reset for each failed attempt
+ if not linksResults:
+ links = main.topo.getAllLinks( main )
+ linksResults = main.TRUE
+ linkFails = [] # Reset for each failed attempt
+ if not hostsResults:
+ hosts = main.topo.getAllHosts( main )
+ hostsResults = main.TRUE
+ hostFails = [] # Reset for each failed attempt
- if links[ controller ] and "Error" not in links[ controller ]:
- currentLinksResult = main.Mininet1.compareLinks(
- mnSwitches, mnLinks,
- json.loads( links[ controller ] ) )
- else:
- currentLinksResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentLinksResult,
- onpass="ONOS" + controllerStr +
- " links view is correct",
- onfail="ONOS" + controllerStr +
- " links view is incorrect" )
+ # Check for matching topology on each node
+ for controller in range( main.numCtrls ):
+ controllerStr = str( controller + 1 ) # ONOS node number
+ # Compare Devices
+ if devices[ controller ] and ports[ controller ] and\
+ "Error" not in devices[ controller ] and\
+ "Error" not in ports[ controller ]:
- if hosts[ controller ] or "Error" not in hosts[ controller ]:
- currentHostsResult = main.Mininet1.compareHosts(
- mnHosts,
- json.loads( hosts[ controller ] ) )
- else:
- currentHostsResult = main.FALSE
- utilities.assert_equals( expect=main.TRUE,
- actual=currentHostsResult,
- onpass="ONOS" + controllerStr +
- " hosts exist in Mininet",
- onfail="ONOS" + controllerStr +
- " hosts don't match Mininet" )
+ try:
+ deviceData = json.loads( devices[ controller ] )
+ portData = json.loads( ports[ controller ] )
+ except (TypeError,ValueError):
+ main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
+ currentDevicesResult = main.FALSE
+ else:
+ currentDevicesResult = main.Mininet1.compareSwitches(
+ mnSwitches,deviceData,portData )
+ else:
+ currentDevicesResult = main.FALSE
+ if not currentDevicesResult:
+ deviceFails.append( controllerStr )
+ devicesResults = devicesResults and currentDevicesResult
+ # Compare Links
+ if links[ controller ] and "Error" not in links[ controller ]:
+ try:
+ linkData = json.loads( links[ controller ] )
+ except (TypeError,ValueError):
+ main.log.error("Could not load json:" + str( links[ controller ] ) )
+ currentLinksResult = main.FALSE
+ else:
+ currentLinksResult = main.Mininet1.compareLinks(
+ mnSwitches, mnLinks,linkData )
+ else:
+ currentLinksResult = main.FALSE
+ if not currentLinksResult:
+ linkFails.append( controllerStr )
+ linksResults = linksResults and currentLinksResult
+ # Compare Hosts
+ if hosts[ controller ] and "Error" not in hosts[ controller ]:
+ try:
+ hostData = json.loads( hosts[ controller ] )
+ except (TypeError,ValueError):
+ main.log.error("Could not load json:" + str( hosts[ controller ] ) )
+ currentHostsResult = main.FALSE
+ else:
+ currentHostsResult = main.Mininet1.compareHosts(
+ mnHosts,hostData )
+ else:
+ currentHostsResult = main.FALSE
+ if not currentHostsResult:
+ hostFails.append( controllerStr )
+ hostsResults = hostsResults and currentHostsResult
+ # Decrement Attempts Remaining
+ attempts -= 1
+
+
+ utilities.assert_equals( expect=[],
+ actual=deviceFails,
+ onpass="ONOS correctly discovered all devices",
+ onfail="ONOS incorrectly discovered devices on nodes: " +
+ str( deviceFails ) )
+ utilities.assert_equals( expect=[],
+ actual=linkFails,
+ onpass="ONOS correctly discovered all links",
+ onfail="ONOS incorrectly discovered links on nodes: " +
+ str( linkFails ) )
+ utilities.assert_equals( expect=[],
+ actual=hostFails,
+ onpass="ONOS correctly discovered all hosts",
+ onfail="ONOS incorrectly discovered hosts on nodes: " +
+ str( hostFails ) )
+ topoResults = hostsResults and linksResults and devicesResults
+ utilities.assert_equals( expect=main.TRUE,
+ actual=topoResults,
+ onpass="ONOS correctly discovered the topology",
+ onfail="ONOS incorrectly discovered the topology" )
def CASE9( self, main ):
'''
@@ -413,7 +562,35 @@
"to controller",
onfail="Failed to assign switches to " +
"controller" )
- def CASE13( self, main ):
+
+ def CASE13( self,main ):
+ """
+ Create Scapy components
+ """
+ main.case( "Create scapy components" )
+ main.step( "Create scapy components" )
+ import json
+ scapyResult = main.TRUE
+ for hostName in main.scapyHostNames:
+ main.Scapy1.createHostComponent( hostName )
+ main.scapyHosts.append( getattr( main, hostName ) )
+
+ main.step( "Start scapy components" )
+ for host in main.scapyHosts:
+ host.startHostCli()
+ host.startScapy()
+ host.updateSelf()
+ main.log.debug( host.name )
+ main.log.debug( host.hostIp )
+ main.log.debug( host.hostMac )
+
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully created Scapy Components",
+ onfail="Failed to discover Scapy Components" )
+
+ def CASE14( self, main ):
"""
Discover all hosts and store its data to a dictionary
"""
@@ -441,24 +618,73 @@
onpass="Successfully discovered hosts",
onfail="Failed to discover hosts" )
- def CASE14( self, main ):
+ def CASE15( self, main ):
"""
- Stop mininet
+ Discover all hosts with scapy arp packets and store its data to a dictionary
"""
- main.log.report( "Stop Mininet topology" )
- main.case( "Stop Mininet topology" )
+ 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.skipCase()
+
+ # Send ARP packets from each scapy host component
+ main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
+
+ stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
+ retValue=main.FALSE, args=[ main ],
+ attempts=main.checkTopoAttempts, sleep=2 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="ONOS correctly discovered all hosts",
+ onfail="ONOS incorrectly discovered hosts" )
+
+ main.step( "Populate hostsData" )
+ stepResult = main.intentFunction.populateHostData( main )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully populated hostsData",
+ onfail="Failed to populate hostsData" )
+
+ def CASE16( self, main ):
+ """
+ Stop mininet and remove scapy hosts
+ """
+ main.log.report( "Stop Mininet and Scapy" )
+ main.case( "Stop Mininet and Scapy" )
main.caseExplanation = "Stopping the current mininet topology " +\
"to start up fresh"
+ main.step( "Stopping and Removing Scapy Host Components" )
+ scapyResult = main.TRUE
+ for host in main.scapyHosts:
+ scapyResult = scapyResult and host.stopScapy()
+ main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
+
+ for host in main.scapyHosts:
+ scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
+ main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
+
+ main.scapyHosts = []
+ main.scapyHostIPs = []
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=scapyResult,
+ onpass="Successfully stopped scapy and removed host components",
+ onfail="Failed to stop mininet and scapy" )
+
main.step( "Stopping Mininet Topology" )
- topoResult = main.Mininet1.stopNet( )
- stepResult = topoResult
+ mininetResult = main.Mininet1.stopNet( )
+
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
onpass="Successfully stop mininet",
onfail="Failed to stop mininet" )
# Exit if topology did not load properly
- if not topoResult:
+ if not (mininetResult and scapyResult ):
main.cleanup()
main.exit()
@@ -502,120 +728,182 @@
"etc;\nThe test will use OF " + main.OFProtocol\
+ " OVS running in Mininet"
- main.step( "IPV4: Add host intents between h1 and h9" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
- onosNode='0',
+ main.step( "IPV4: Add and test host intents between h1 and h9" )
+ main.assertReturnString = "Assertion result for IPV4 host intent with mac addresses\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='IPV4',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
+
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='IPV4',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
sw1='s5',
sw2='s2',
- expectedLink=18 )
+ expectedLink = 18 )
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="IPV4: Host intent test successful " +
- "between two IPV4 hosts",
- onfail="IPV4: Host intent test failed " +
- "between two IPV4 hosts")
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
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',
+ main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
+ 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.intentFunction.installHostIntent( main,
+ name='DUALSTACK1',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
+
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='DUALSTACK1',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
sw1='s5',
sw2='s2',
- expectedLink=18 )
+ expectedLink = 18 )
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="DUALSTACK: Host intent test " +
- "successful between two " +
- "dual stack host using IPV4",
- onfail="DUALSTACK: Host intent test " +
- "failed between two" +
- "dual stack host using IPV4" )
-
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString)
main.step( "DUALSTACK2: Add host intents between h1 and h11" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
+ main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
+ host1 = { "name":"h1" }
+ host2 = { "name":"h11" }
+ testResult = main.FALSE
+ installResult = main.intentFunction.installHostIntent( main,
name='DUALSTACK2',
- host1='h1',
- host2='h11',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
+
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='DUALSTACK2',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
sw1='s5',
sw2='s2',
- expectedLink=18 )
+ expectedLink = 18 )
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="DUALSTACK2: Host intent test " +
- "successful between two " +
- "dual stack host using IPV4",
- onfail="DUALSTACK2: Host intent test " +
- "failed between two" +
- "dual stack host using IPV4" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "1HOP: Add host intents between h1 and h3" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
+ main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
+ host1 = { "name":"h1" }
+ host2 = { "name":"h3" }
+ testResult = main.FALSE
+ installResult = main.intentFunction.installHostIntent( main,
name='1HOP',
- host1='h1',
- host2='h3' )
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
- utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="1HOP: Host intent test " +
- "successful between two " +
- "host using IPV4 in the same switch",
- onfail="1HOP: Host intent test " +
- "failed between two" +
- "host using IPV4 in the same switch" )
-
- main.step( "VLAN1: Add vlan host intents between h4 and h12" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
- name='VLAN1',
- host1='h4',
- host2='h12',
- host1Id='00:00:00:00:00:04/100',
- host2Id='00:00:00:00:00:0C/100',
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='1HOP',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
sw1='s5',
sw2='s2',
- expectedLink=18 )
+ expectedLink = 18 )
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="VLAN1: Host intent test " +
- "successful between two " +
- "host using IPV4 in the same VLAN",
- onfail="VLAN1: Host intent test " +
- "failed between two" +
- "host using IPV4 in the same VLAN" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.step( "VLAN1: Add vlan host intents between h4 and h12" )
+ main.assertReturnString = "Assertion Result vlan IPV4\n"
+ host1 = { "name":"h4","id":"00:00:00:00:00:04/100" }
+ host2 = { "name":"h12","id":"00:00:00:00:00:0C/100" }
+ testResult = main.FALSE
+ installResult = main.intentFunction.installHostIntent( main,
+ name='VLAN1',
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
+
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='VLAN1',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink = 18 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
+ main.assertReturnString = "Assertion Result different VLAN negative test\n"
+ host1 = { "name":"h13" }
+ host2 = { "name":"h20" }
+ testResult = main.FALSE
+ installResult = main.intentFunction.installHostIntent( main,
name='VLAN2',
- host1='h13',
- host2='h20' )
+ onosNode='0',
+ host1=host1,
+ host2=host2 )
- utilities.assert_equals( expect=main.FALSE,
- actual=stepResult,
- onpass="VLAN2: Host intent negative test " +
- "successful between two " +
- "host using IPV4 in different VLAN",
- onfail="VLAN2: Host intent negative test " +
- "failed between two" +
- "host using IPV4 in different VLAN" )
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='VLAN2',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1='s5',
+ sw2='s2',
+ expectedLink = 18 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ # Uncomment the following if a REST command is ever added to check leaders
+ # or if the cli is enabled
+
+ # main.step( "Confirm that ONOS leadership is unchanged")
+ # intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
+ # main.intentFunction.checkLeaderChange( intentLeadersOld,
+ # intentLeadersNew )
+
+ # utilities.assert_equals( expect=main.TRUE,
+ # actual=testResult,
+ # onpass="ONOS Leaders Unchanged",
+ # onfail="ONOS Leader Mismatch")
+
+ main.intentFunction.report( main )
def CASE2000( self, main ):
"""
@@ -660,128 +948,140 @@
# No option point intents
main.step( "NOOPTION: Add point intents between h1 and h9" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.pointIntent(
+ main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
+ senders = [
+ { "name":"h1","device":"of:0000000000000005/1" }
+ ]
+ recipients = [
+ { "name":"h9","device":"of:0000000000000006/1" }
+ ]
+ testResult = main.FALSE
+ installResult = main.intentFunction.installPointIntent(
main,
name="NOOPTION",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ senders=senders,
+ recipients=recipients )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="NOOPTION",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="NOOPTION: Point intent test " +
- "successful using no match action",
- onfail="NOOPTION: Point intent test " +
- "failed using no match action" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
- stepResult = main.TRUE
main.step( "IPV4: Add point intents between h1 and h9" )
- stepResult = main.intentFunction.pointIntent(
+ main.assertReturnString = "Assertion Result for IPV4 point intent\n"
+ senders = [
+ { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
+ ]
+ recipients = [
+ { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
+ ]
+ installResult = main.intentFunction.installPointIntent(
main,
name="IPV4",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- port1="",
- port2="",
- ethType="IPV4",
- mac1="00:00:00:00:00:01",
- mac2="00:00:00:00:00:09",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ senders=senders,
+ recipients=recipients,
+ ethType="IPV4" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="IPV4",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="IPV4: Point intent test " +
- "successful using IPV4 type with " +
- "MAC addresses",
- onfail="IPV4: Point intent test " +
- "failed using IPV4 type with " +
- "MAC addresses" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "IPV4_2: Add point intents between h1 and h9" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.pointIntent(
+ main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
+ senders = [
+ { "name":"h1","device":"of:0000000000000005/1" }
+ ]
+ recipients = [
+ { "name":"h9","device":"of:0000000000000006/1" }
+ ]
+ installResult = main.intentFunction.installPointIntent(
main,
name="IPV4_2",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ senders=senders,
+ recipients=recipients,
+ ethType="IPV4" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="IPV4_2",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="IPV4_2: Point intent test " +
- "successful using IPV4 type with " +
- "no MAC addresses",
- onfail="IPV4_2: Point intent test " +
- "failed using IPV4 type with " +
- "no MAC addresses" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
- stepResult = main.TRUE
- mac1 = main.hostsData[ 'h1' ][ 'mac' ]
- mac2 = main.hostsData[ 'h9' ][ 'mac' ]
- try:
- ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
- ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
- except KeyError:
- main.log.debug( "Key Error getting IP addresses of h1 | h9 in" +
- "main.hostsData" )
- ip1 = main.Mininet1.getIPAddress( 'h1')
- ip2 = main.Mininet1.getIPAddress( 'h9')
-
+ main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
+ senders = [
+ { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01",
+ "ip":main.h1.hostIp }
+ ]
+ recipients = [
+ { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
+ "ip":main.h9.hostIp }
+ ]
ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
# Uneccessary, not including this in the selectors
- tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
- tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
+ tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
+ tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
- stepResult = main.intentFunction.pointIntent(
- main,
- name="SDNIP-ICMP",
- host1="h1",
- host2="h9",
- deviceId1="of:0000000000000005/1",
- deviceId2="of:0000000000000006/1",
- mac1=mac1,
- mac2=mac2,
- ethType="IPV4",
- ipProto=ipProto,
- ip1=ip1,
- ip2=ip2 )
+ installResult = main.intentFunction.installPointIntent(
+ main,
+ name="SDNIP-ICMP",
+ senders=senders,
+ recipients=recipients,
+ ethType="IPV4",
+ ipProto=ipProto,
+ tcpSrc=tcpSrc,
+ tcpDst=tcpDst )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="SDNIP_ICMP",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="SDNIP-ICMP: Point intent test " +
- "successful using IPV4 type with " +
- "IP protocol TCP enabled",
- onfail="SDNIP-ICMP: Point intent test " +
- "failed using IPV4 type with " +
- "IP protocol TCP enabled" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
- stepResult = main.TRUE
+ main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
mac1 = main.hostsData[ 'h1' ][ 'mac' ]
mac2 = main.hostsData[ 'h9' ][ 'mac' ]
ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
@@ -808,96 +1108,103 @@
utilities.assert_equals( expect=main.TRUE,
actual=stepResult,
- onpass="SDNIP-TCP: Point intent test " +
- "successful using IPV4 type with " +
- "IP protocol TCP enabled",
- onfail="SDNIP-TCP: Point intent test " +
- "failed using IPV4 type with " +
- "IP protocol TCP enabled" )
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
- main.step( "DUALSTACK1: Add point intents between h1 and h9" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.pointIntent(
+ main.step( "DUALSTACK1: Add point intents between h3 and h11" )
+ main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
+ senders = [
+ { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
+ ]
+ recipients = [
+ { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
+ ]
+ installResult = main.intentFunction.installPointIntent(
main,
name="DUALSTACK1",
- host1="h3",
- host2="h11",
- deviceId1="of:0000000000000005",
- deviceId2="of:0000000000000006",
- port1="3",
- port2="3",
- ethType="IPV4",
- mac1="00:00:00:00:00:03",
- mac2="00:00:00:00:00:0B",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ senders=senders,
+ recipients=recipients,
+ ethType="IPV4" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="DUALSTACK1",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="DUALSTACK1: Point intent test " +
- "successful using IPV4 type with " +
- "MAC addresses",
- onfail="DUALSTACK1: Point intent test " +
- "failed using IPV4 type with " +
- "MAC addresses" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "VLAN: Add point intents between h5 and h21" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.pointIntent(
+ main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
+ senders = [
+ { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" }
+ ]
+ recipients = [
+ { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" }
+ ]
+ installResult = main.intentFunction.installPointIntent(
main,
- name="VLAN",
- host1="h5",
- host2="h21",
- deviceId1="of:0000000000000005/5",
- deviceId2="of:0000000000000007/5",
- port1="",
- port2="",
- ethType="IPV4",
- mac1="00:00:00:00:00:05",
- mac2="00:00:00:00:00:15",
- bandwidth="",
- lambdaAlloc=False,
- ipProto="",
- ip1="",
- ip2="",
- tcp1="",
- tcp2="",
- sw1="s5",
- sw2="s2",
- expectedLink=18 )
+ name="DUALSTACK1",
+ senders=senders,
+ recipients=recipients,
+ ethType="IPV4" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="DUALSTACK1",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="VLAN1: Point intent test " +
- "successful using IPV4 type with " +
- "MAC addresses",
- onfail="VLAN1: Point intent test " +
- "failed using IPV4 type with " +
- "MAC addresses" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
main.step( "1HOP: Add point intents between h1 and h3" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
- name='1HOP',
- host1='h1',
- host2='h3' )
+ main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
+ senders = [
+ { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
+ ]
+ recipients = [
+ { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
+ ]
+ installResult = main.intentFunction.installPointIntent(
+ main,
+ name="1HOP IPV4",
+ senders=senders,
+ recipients=recipients,
+ ethType="IPV4" )
+
+ if installResult:
+ testResult = main.intentFunction.testPointIntent(
+ main,
+ intentId=installResult,
+ name="1HOP IPV4",
+ senders=senders,
+ recipients=recipients,
+ sw1="s5",
+ sw2="s2",
+ expectedLink=18)
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="1HOP: Point intent test " +
- "successful using IPV4 type with " +
- "no MAC addresses",
- onfail="1HOP: Point intent test " +
- "failed using IPV4 type with " +
- "no MAC addresses" )
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.intentFunction.report( main )
def CASE3000( self, main ):
"""
@@ -1178,8 +1485,52 @@
" to single point intents" )
def CASE5000( self, main ):
+ # """
+ # Will add description in next patch set
+ # """
+ # 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 host mobility with host intents " )
+ # 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" )
+
+ # main.intentFunction.getHostsData( main )
+ # h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
+
+ # utilities.assert_equals( expect="of:0000000000000006",
+ # actual=h1PostMove,
+ # onpass="Mobility: Successfully moved h1 to s6",
+ # onfail="Mobility: Failed to moved h1 to s6" +
+ # " to single point intents" +
+ # " with IPV4 type and MAC addresses" +
+ # " in the same VLAN" )
+
+ # main.step( "IPV4: Add host intents between h1 and h9" )
+ # stepResult = main.TRUE
+ # stepResult = main.intentFunction.hostIntent( main,
+ # onosNode='0',
+ # name='IPV4',
+ # 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="IPV4: Host intent test successful " +
+ # "between two IPV4 hosts",
+ # onfail="IPV4: Host intent test failed " +
+ # "between two IPV4 hosts")
"""
- Will add description in next patch set
+ Tests Host Mobility
+ Modifies the topology location of h1
"""
assert main, "There is no main"
assert main.CLIs, "There is no main.CLIs"
@@ -1187,37 +1538,58 @@
assert main.numSwitch, "Placed the total number of switch topology in \
main.numSwitch"
main.case( "Test host mobility with host intents " )
- main.step( " Testing host mobility by moving h1 from s5 to s6" )
+ 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" )
- main.intentFunction.getHostsData( main )
+ # Send discovery ping from moved host
+ # Moving the host brings down the default interfaces and creates a new one.
+ # Scapy is restarted on this host to detect the new interface
+ main.h1.stopScapy()
+ main.h1.startScapy()
+
+ # Discover new host location in ONOS and populate host data.
+ # Host 1 IP and MAC should be unchanged
+ main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
+ main.intentFunction.populateHostData( main )
+
h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
utilities.assert_equals( expect="of:0000000000000006",
actual=h1PostMove,
onpass="Mobility: Successfully moved h1 to s6",
- onfail="Mobility: Failed to moved h1 to s6" +
+ onfail="Mobility: Failed to move h1 to s6" +
" to single point intents" +
" with IPV4 type and MAC addresses" +
" in the same VLAN" )
main.step( "IPV4: Add host intents between h1 and h9" )
- stepResult = main.TRUE
- stepResult = main.intentFunction.hostIntent( main,
+ main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
+ host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
+ host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
+
+ installResult = main.intentFunction.installHostIntent( main,
+ name='IPV4 Mobility IPV4',
onosNode='0',
- name='IPV4',
- host1='h1',
- host2='h9',
- host1Id='00:00:00:00:00:01/-1',
- host2Id='00:00:00:00:00:09/-1' )
+ host1=host1,
+ host2=host2)
+ if installResult:
+ testResult = main.intentFunction.testHostIntent( main,
+ name='Host Mobility IPV4',
+ intentId = installResult,
+ onosNode='0',
+ host1=host1,
+ host2=host2,
+ sw1="s6",
+ sw2="s2",
+ expectedLink=18 )
utilities.assert_equals( expect=main.TRUE,
- actual=stepResult,
- onpass="IPV4: Host intent test successful " +
- "between two IPV4 hosts",
- onfail="IPV4: Host intent test failed " +
- "between two IPV4 hosts")
+ actual=testResult,
+ onpass=main.assertReturnString,
+ onfail=main.assertReturnString )
+
+ main.intentFunction.report( main )
+
diff --git a/TestON/tests/FUNCintentRest/FUNCintentRest.topo b/TestON/tests/FUNCintentRest/FUNCintentRest.topo
index efed3d6..6be48c6 100755
--- a/TestON/tests/FUNCintentRest/FUNCintentRest.topo
+++ b/TestON/tests/FUNCintentRest/FUNCintentRest.topo
@@ -50,8 +50,18 @@
<password></password>
<type>MininetCliDriver</type>
<connect_order>5</connect_order>
- <COMPONENTS> </COMPONENTS>
+ <COMPONENTS>
+ <home>~/mininet/</home>
+ </COMPONENTS>
</Mininet1>
+ <Scapy1>
+ <host>OCN</host>
+ <user>admin</user>
+ <password></password>
+ <type>ScapyCliDriver</type>
+ <connect_order>6</connect_order>
+ </Scapy1>
+
</COMPONENT>
</TOPOLOGY>
diff --git a/TestON/tests/SCPFscalingMaxIntents/Dependency/rerouteTopo.py b/TestON/tests/SCPFscalingMaxIntents/Dependency/rerouteTopo.py
new file mode 100755
index 0000000..774f12f
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/Dependency/rerouteTopo.py
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+"""
+Custom topology for Mininet
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import Host, RemoteController
+from mininet.node import Node
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
+
+class MyTopo( Topo ):
+
+ def __init__( self ):
+ # Initialize topology
+ Topo.__init__( self )
+
+ host1 = self.addHost('h1', ip='10.1.0.1/24')
+ host2 = self.addHost('h2', ip='10.1.0.2/24')
+ host3 = self.addHost('h3', ip='10.1.0.3/24')
+ host4 = self.addHost('h4', ip='10.1.0.4/24')
+ host5 = self.addHost('h5', ip='10.1.0.5/24')
+ host6 = self.addHost('h6', ip='10.1.0.6/24')
+ host7 = self.addHost('h7', ip='10.1.0.7/24')
+
+ s1 = self.addSwitch( 's1' )
+ s2 = self.addSwitch( 's2' )
+ s3 = self.addSwitch( 's3' )
+ s4 = self.addSwitch( 's4' )
+ s5 = self.addSwitch( 's5' )
+ s6 = self.addSwitch( 's6' )
+ s7 = self.addSwitch( 's7' )
+ s8 = self.addSwitch( 's8' )
+
+
+ self.addLink(s1, host1)
+ self.addLink(s2, host2)
+ self.addLink(s3, host3)
+ self.addLink(s4, host4)
+ self.addLink(s5, host5)
+ self.addLink(s6, host6)
+ self.addLink(s7, host7)
+
+
+
+ self.addLink(s1,s2)
+ self.addLink(s2,s3)
+ self.addLink(s3,s4)
+ self.addLink(s4,s5)
+ self.addLink(s5,s6)
+ self.addLink(s6,s7)
+ self.addLink(s4,s8)
+ self.addLink(s8,s5)
+
+ topos = { 'mytopo': ( lambda: MyTopo() ) }
+
+# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
+def setupNetwork():
+ "Create network"
+ topo = MyTopo()
+ network = Mininet(topo=topo, autoSetMacs=True, controller=None)
+ network.start()
+ CLI( network )
+ network.stop()
+
+if __name__ == '__main__':
+ setLogLevel('info')
+ #setLogLevel('debug')
+ setupNetwork()
diff --git a/TestON/tests/SCPFscalingMaxIntents/Dependency/startUp.py b/TestON/tests/SCPFscalingMaxIntents/Dependency/startUp.py
new file mode 100644
index 0000000..bf2a2b6
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/Dependency/startUp.py
@@ -0,0 +1,38 @@
+"""
+ This wrapper function is use for starting up onos instance
+"""
+
+import time
+import os
+import json
+
+def onosBuild( main, gitBranch ):
+ """
+ This includes pulling ONOS and building it using maven install
+ """
+
+ buildResult = main.FALSE
+
+ # Git checkout a branch of ONOS
+ checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+ # Does the git pull on the branch that was checked out
+ if not checkOutResult:
+ main.log.warn( "Failed to checked out " + gitBranch +
+ " branch")
+ else:
+ main.log.info( "Successfully checked out " + gitBranch +
+ " branch")
+ gitPullResult = main.ONOSbench.gitPull()
+ if gitPullResult == main.ERROR:
+ main.log.error( "Error pulling git branch" )
+ else:
+ main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+ # Maven clean install
+ buildResult = main.ONOSbench.cleanInstall()
+
+ return buildResult
+
+
+
+
diff --git a/TestON/tests/SCPFscalingMaxIntents/README b/TestON/tests/SCPFscalingMaxIntents/README
new file mode 100644
index 0000000..0c16859
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/README
@@ -0,0 +1,11 @@
+Summary:
+ This is a performance test suit, designed to test the upper limits
+ of onos and ovsdb with respect to installing intents.
+ In this test, CASE10 set up null provoder, CASE 11 set up ovs. Start from
+ 1 node, and scale to 7 nodes.
+ We push intents to every node by using Thread, and when the intents number
+ reach to the minimun number, we will verify intents and flows. If intents are
+ not installed correctly, test will stop pushing and finish this case.
+NOTE:
+ This test is largely based on the hardware used to run onos and mininet.
+ Therefore, results will very test station to test station.
diff --git a/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
new file mode 100644
index 0000000..3baf066
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
@@ -0,0 +1,99 @@
+<PARAMS>
+
+ # 0-init
+ # 1-setup
+ # 2-Install
+ # 10-null provider setup
+ # 20-pushing intents, and rerouting intents if reroute is true
+ # 0,1,2,10,20,1,2,10,20,1,2,10,20
+ <testcases>0,1,2,11,20,1,2,11,20,1,2,11,20,1,2,11,20</testcases>
+
+ <reroute>False</reroute>
+
+ <SCALE>1,3,5,7</SCALE>
+
+ <DEPENDENCY>
+ <path>/tests/SCPFscalingMaxIntents/Dependency/</path>
+ <wrapper1>startUp</wrapper1>
+ <topology>rerouteTopo.py</topology>
+ </DEPENDENCY>
+
+ <ENV>
+ <cellName>productionCell</cellName>
+ <cellApps>drivers</cellApps>
+ </ENV>
+
+ <GIT>
+ <pull>False</pull>
+ <branch>master</branch>
+ </GIT>
+
+ <CTRL>
+ <port>6653</port>
+ </CTRL>
+
+ <SLEEP>
+ <startup>10</startup>
+ <install>10</install>
+ <verify>15</verify>
+ <reroute>3</reroute>
+ # timeout for pexpect
+ <timeout>300</timeout>
+ </SLEEP>
+
+ <ATTEMPTS>
+ <verify>3</verify>
+ <push>3</push>
+ </ATTEMPTS>
+
+ <DATABASE>
+ <file>/tmp/ScalingMaxIntentDB</file>
+ <nic>1gig</nic>
+ <node>baremetal</node>
+ </DATABASE>
+
+ <LINK>
+ <ingress>0000000000000001/5</ingress>
+ <egress>0000000000000007/5</egress>
+ </LINK>
+
+ # CASE10
+ <NULL>
+ # CASE20
+ <PUSH>
+ <batch_size>100</batch_size>
+ <min_intents>100</min_intents>
+ <max_intents>100000</max_intents>
+ <check_interval>100</check_interval>
+ </PUSH>
+
+ # if reroute is true
+ <REROUTE>
+ <batch_size>1000</batch_size>
+ <min_intents>10000</min_intents>
+ <max_intents>1000000</max_intents>
+ <check_interval>100000</check_interval>
+ </REROUTE>
+ </NULL>
+
+ # CASE11
+ <OVS>
+ # CASE20
+ <PUSH>
+ <batch_size>1000</batch_size>
+ <min_intents>10000</min_intents>
+ <max_intents>500000</max_intents>
+ <check_interval>10000</check_interval>
+ </PUSH>
+
+ # if reroute is true
+ <REROUTE>
+ <batch_size>1000</batch_size>
+ <min_intents>10000</min_intents>
+ <max_intents>500000</max_intents>
+ <check_interval>10000</check_interval>
+ </REROUTE>
+ </OVS>
+
+
+</PARAMS>
diff --git a/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
new file mode 100644
index 0000000..5a7d0d0
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -0,0 +1,551 @@
+import sys
+import json
+import time
+import os
+'''
+SCPFscalingMaxIntents
+Push test Intents to onos
+CASE10: set up Null Provider
+CASE11: set up Open Flows
+Scale up when reach the Limited
+Start from 1 nodes, 8 devices. Then Scale up to 3,5,7 nodes
+Recommand batch size: 100, check interval: 100
+'''
+class SCPFscalingMaxIntents:
+ def __init__( self ):
+ self.default = ''
+
+ def CASE0( self, main):
+ import sys
+ import json
+ import time
+ import os
+ import imp
+
+ main.case( "Constructing test variables and building ONOS package" )
+ main.step( "Constructing test variables" )
+ stepResult = main.FALSE
+
+ # Test variables
+ main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+ main.dependencyPath = main.testOnDirectory + \
+ main.params['DEPENDENCY']['path']
+ main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+ main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+ main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+ main.scale = ( main.params[ 'SCALE' ] ).split( "," )
+ main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+ main.timeout = int(main.params['SLEEP']['timeout'])
+ main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+ main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
+ main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
+ main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
+ main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] )
+ main.ingress = main.params['LINK']['ingress']
+ main.egress = main.params['LINK']['egress']
+ main.dbFileName = main.params['DATABASE']['file']
+ main.cellData = {} # for creating cell file
+ main.reroute = main.params['reroute']
+ main.threadID = 0
+
+ if main.reroute == "True":
+ main.reroute = True
+ else:
+ main.reroute = False
+
+ main.CLIs = []
+ main.ONOSip = []
+ main.maxNumBatch = 0
+ main.ONOSip = main.ONOSbench.getOnosIps()
+ main.log.info(main.ONOSip)
+ main.setupSkipped = False
+
+ wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+ gitBranch = main.params[ 'GIT' ][ 'branch' ]
+ gitPull = main.params[ 'GIT' ][ 'pull' ]
+ nic = main.params['DATABASE']['nic']
+ node = main.params['DATABASE']['node']
+ nic = main.params['DATABASE']['nic']
+ node = main.params['DATABASE']['node']
+ stepResult = main.TRUE
+
+ main.log.info("Cresting DB file")
+ with open(main.dbFileName, "w+") as dbFile:
+ dbFile.write("")
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="environment set up successfull",
+ onfail="environment set up Failed" )
+
+ def CASE1( self ):
+ # main.scale[ 0 ] determines the current number of ONOS controller
+ main.CLIs = []
+ main.numCtrls = int( main.scale[ 0 ] )
+ main.log.info( "Creating list of ONOS cli handles" )
+ for i in range(main.numCtrls):
+ main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) )
+
+ main.log.info(main.CLIs)
+ if not main.CLIs:
+ main.log.error( "Failed to create the list of ONOS cli handles" )
+ main.cleanup()
+ main.exit()
+
+ main.log.info( "Loading wrapper files" )
+ main.startUp = imp.load_source( wrapperFile1,
+ main.dependencyPath +
+ wrapperFile1 +
+ ".py" )
+
+ copyResult = main.ONOSbench.copyMininetFile( main.topology,
+ main.dependencyPath,
+ main.Mininet1.user_name,
+ main.Mininet1.ip_address )
+
+ commit = main.ONOSbench.getVersion(report=True)
+ commit = commit.split(" ")[1]
+
+ if gitPull == 'True':
+ if not main.startUp.onosBuild( main, gitBranch ):
+ main.log.error( "Failed to build ONOS" )
+ main.cleanup()
+ main.exit()
+ else:
+ main.log.warn( "Did not pull new code so skipping mvn " +
+ "clean install" )
+ with open(main.dbFileName, "a") as dbFile:
+ temp = "'" + commit + "',"
+ temp += "'" + nic + "',"
+ dbFile.write(temp)
+
+ def CASE2( self, main ):
+ """
+ - Uninstall ONOS cluster
+ - Verify ONOS start up
+ - Install ONOS cluster
+ - Connect to cli
+ """
+ main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
+ main.log.info( "Safety check, killing all ONOS processes" +
+ " before initiating environment setup" )
+
+ for i in range( main.numCtrls ):
+ main.ONOSbench.onosDie( main.ONOSip[ i ] )
+
+ main.log.info( "NODE COUNT = %s" % main.numCtrls)
+
+ tempOnosIp = []
+ for i in range( main.numCtrls ):
+ tempOnosIp.append( main.ONOSip[i] )
+
+ main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
+ "temp",
+ main.Mininet1.ip_address,
+ main.apps,
+ tempOnosIp )
+
+ main.step( "Apply cell to environment" )
+ cellResult = main.ONOSbench.setCell( "temp" )
+ verifyResult = main.ONOSbench.verifyCell()
+ stepResult = cellResult and verifyResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully applied cell to " + \
+ "environment",
+ onfail="Failed to apply cell to environment " )
+
+ main.step( "Creating ONOS package" )
+ packageResult = main.ONOSbench.onosPackage()
+ stepResult = packageResult
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully created ONOS package",
+ onfail="Failed to create ONOS package" )
+
+ main.step( "Uninstall ONOS package on all Nodes" )
+ uninstallResult = main.TRUE
+ for i in range( int( main.numCtrls ) ):
+ main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] )
+ u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] )
+ utilities.assert_equals( expect=main.TRUE, actual=u_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ uninstallResult = ( uninstallResult and u_result )
+
+ main.step( "Install ONOS package on all Nodes" )
+ installResult = main.TRUE
+ for i in range( int( main.numCtrls ) ):
+ main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] )
+ i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] )
+ utilities.assert_equals( expect=main.TRUE, actual=i_result,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ installResult = installResult and i_result
+
+ main.step( "Verify ONOS nodes UP status" )
+ statusResult = main.TRUE
+ for i in range( int( main.numCtrls ) ):
+ main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
+ onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] )
+ utilities.assert_equals( expect=main.TRUE, actual=onos_status,
+ onpass="Test step PASS",
+ onfail="Test step FAIL" )
+ statusResult = ( statusResult and onos_status )
+
+ main.step( "Start ONOS CLI on all nodes" )
+ cliResult = main.TRUE
+ main.log.step(" Start ONOS cli using thread ")
+ startCliResult = main.TRUE
+ pool = []
+
+ for i in range( int( main.numCtrls) ):
+ t = main.Thread( target=main.CLIs[i].startOnosCli,
+ threadID=main.threadID,
+ name="startOnosCli",
+ args=[ main.ONOSip[i] ],
+ kwargs = {"onosStartTimeout":main.timeout} )
+ pool.append(t)
+ t.start()
+ main.threadID = main.threadID + 1
+ for t in pool:
+ t.join()
+ startCliResult = startCliResult and t.result
+ time.sleep( main.startUpSleep )
+
+ def CASE10( self, main ):
+ """
+ Setting up null-provider
+ """
+ import json
+ # Activate apps
+ main.step("Activating null-provider")
+ appStatus = utilities.retry( main.CLIs[0].activateApp,
+ main.FALSE,
+ ['org.onosproject.null'],
+ sleep=main.verifySleep,
+ attempts=main.verifyAttempts )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=appStatus,
+ onpass="Successfully activated null-provider",
+ onfail="Failed activate null-provider" )
+
+ # Setup the null-provider
+ main.step("Configuring null-provider")
+ cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
+ main.FALSE,
+ [ main.ONOSip[0],
+ 'org.onosproject.provider.nil.NullProviders', 'deviceCount 8'],
+ sleep=main.verifySleep,
+ attempts = main.verifyAttempts )
+ cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
+ main.FALSE,
+ [ main.ONOSip[0],
+ 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'],
+ sleep=main.verifySleep,
+ attempts = main.verifyAttempts )
+
+ cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
+ main.FALSE,
+ [ main.ONOSip[0],
+ 'org.onosproject.provider.nil.NullProviders', 'enabled true'],
+ sleep=main.verifySleep,
+ attempts = main.verifyAttempts )
+
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=cfgStatus,
+ onpass="Successfully configured null-provider",
+ onfail="Failed to configure null-provider" )
+
+ # give onos some time to settle
+ time.sleep(main.startUpSleep)
+
+ main.log.info("Setting default flows to zero")
+ main.defaultFlows = 0
+
+ main.step("Check status of null-provider setup")
+ caseResult = appStatus and cfgStatus
+ utilities.assert_equals( expect=main.TRUE,
+ actual=caseResult,
+ onpass="Setting up null-provider was successfull",
+ onfail="Failed to setup null-provider" )
+
+ # This tells the following cases if we are using the null-provider or ovs
+ main.switchType = "null:"
+
+ # If the null-provider setup was unsuccessfull, then there is no point to
+ # run the subsequent cases
+
+ time.sleep(main.startUpSleep)
+ main.step( "Balancing Masters" )
+
+ stepResult = main.FALSE
+ stepResult = utilities.retry( main.CLIs[0].balanceMasters,
+ main.FALSE,
+ [],
+ sleep=3,
+ attempts=3 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Balance masters was successfull",
+ onfail="Failed to balance masters")
+
+ time.sleep( 5 )
+ if not caseResult:
+ main.setupSkipped = True
+
+ def CASE11( self, main):
+ '''
+ Setting up mininet
+ '''
+ import json
+ import time
+
+ time.sleep(main.startUpSleep)
+
+ main.step("Activating openflow")
+ appStatus = utilities.retry( main.ONOSrest1.activateApp,
+ main.FALSE,
+ ['org.onosproject.openflow'],
+ sleep=3,
+ attempts=3 )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=appStatus,
+ onpass="Successfully activated openflow",
+ onfail="Failed activate openflow" )
+
+ time.sleep(main.startUpSleep)
+ main.step('Starting mininet topology')
+ mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
+ utilities.assert_equals( expect=main.TRUE,
+ actual=mnStatus,
+ onpass="Successfully started Mininet",
+ onfail="Failed to activate Mininet" )
+
+ main.step("Assinging masters to switches")
+ switches = main.Mininet1.getSwitches()
+ swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=swStatus,
+ onpass="Successfully assigned switches to masters",
+ onfail="Failed assign switches to masters" )
+
+ time.sleep(main.startUpSleep)
+
+ main.log.info("Getting default flows")
+ jsonSum = json.loads(main.CLIs[0].summary())
+ main.defaultFlows = jsonSum["flows"]
+
+ main.step("Check status of Mininet setup")
+ caseResult = appStatus and mnStatus and swStatus
+ utilities.assert_equals( expect=main.TRUE,
+ actual=caseResult,
+ onpass="Successfully setup Mininet",
+ onfail="Failed setup Mininet" )
+
+ # This tells the following cases if we are using the null-provider or ovs
+ main.switchType = "of:"
+
+ time.sleep(main.startUpSleep)
+ main.step( "Balancing Masters" )
+
+ stepResult = main.FALSE
+ stepResult = utilities.retry( main.CLIs[0].balanceMasters,
+ main.FALSE,
+ [],
+ sleep=3,
+ attempts=3 )
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Balance masters was successfull",
+ onfail="Failed to balance masters")
+
+ time.sleep(5)
+ if not caseResult:
+ main.setupSkipped = True
+
+
+
+ def CASE20( self, main ):
+ if main.reroute:
+ main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
+ main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
+ main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
+ main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
+ else:
+ main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
+ main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
+ main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
+ main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
+
+ # check if the case needs to be skipped
+ if main.setupSkipped:
+ main.setupSkipped = False
+ main.skipCase()
+
+ # the index where the next intents will be installed
+ offfset = 0
+ # keeps track of how many intents have been installed
+ currIntents = 0
+ # keeps track of how many flows have been installed
+ currFlows = main.defaultFlows
+ # limit for the number of intents that can be installed
+ limit = main.maxIntents / main.batchSize
+ # total intents installed
+ totalIntents = 0
+
+ intentsState = None
+
+ offtmp = 0
+ main.step( "Pushing intents" )
+ stepResult = main.TRUE
+
+ for i in range(limit):
+
+ # Threads pool
+ pool = []
+
+ for j in range( int( main.numCtrls) ):
+ if main.numCtrls > 1:
+ time.sleep( 1 )
+ offtmp = offfset + main.maxIntents * j
+ # Push intents by using threads
+ t = main.Thread( target=main.CLIs[j].pushTestIntents,
+ threadID=main.threadID,
+ name="Push-Test-Intents",
+ args=[ main.switchType + main.ingress,
+ main.switchType + main.egress,
+ main.batchSize ],
+ kwargs={ "offset": offtmp,
+ "options": "-i",
+ "timeout": main.timeout,
+ "background":False } )
+ pool.append(t)
+ t.start()
+ main.threadID = main.threadID + 1
+ for t in pool:
+ t.join()
+ stepResult = stepResult and t.result
+ offfset = offfset + main.batchSize
+
+ totalIntents = main.batchSize + totalIntents
+ if totalIntents >= main.minIntents and totalIntents % main.checkInterval == 0:
+ # if reach to minimum number and check interval, verify Intetns and flows
+ time.sleep( main.verifySleep * main.numCtrls )
+
+ main.log.info("Verify Intents states")
+ k = 1
+ intentVerify = main.FALSE
+
+ while k <= 3:
+ # while loop for check intents by using REST api
+ time.sleep(5)
+ temp = 0
+ intentsState = json.loads( main.ONOSrest1.intents() )
+ for f in intentsState:
+ # get INSTALLED intents number
+ if f.get("state") == "INSTALLED":
+ temp = temp + 1
+
+ totalIntents=len(intentsState)
+
+ main.log.info("Total Intents: {} INSTALLED: {}".format(totalIntents, temp))
+ if totalIntents == temp:
+ intentVerify = main.TRUE
+ break
+ intentVerify = main.FALSE
+ k = k+1
+
+ if not intentVerify:
+ # If some intents are not installed, finished this test case
+ main.log.warn( "Some intens did not install" )
+ # We don't want to check flows if intents not installed, because onos will drop flows
+ break
+
+ main.log.info("Verify Flows states")
+ k = 1
+ flowsVerify = main.TRUE
+
+ while k <= 3:
+ #while loop for check flows by using REST api
+ time.sleep(3)
+ temp = 0
+ flowsStateCount = []
+ flowsState = json.loads( main.ONOSrest1.flows() )
+ for f in flowsState:
+ # get PENDING_ADD flows
+ if f.get("state") == "PENDING_ADD":
+ temp = temp + 1
+
+ flowsStateCount.append(temp)
+ temp = 0
+
+ for f in flowsState:
+ # get PENDING_REMOVE flows
+ if f.get("state") == "PENDING_REMOVE":
+ temp = temp + 1
+
+ flowsStateCount.append(temp)
+ temp = 0
+
+ for f in flowsState:
+ # get REMOVED flows
+ if f.get("state") == "REMOVED":
+ temp = temp + 1
+
+ flowsStateCount.append(temp)
+ temp = 0
+
+ for f in flowsState:
+ # get FAILED flwos
+ if f.get("state") == "FAILED":
+ temp = temp + 1
+
+ flowsStateCount.append(temp)
+ temp = 0
+ k = k + 1
+ for c in flowsStateCount:
+ if int(c) > 0:
+ flowsVerify = main.FALSE
+
+ main.log.info( "Check flows States:" )
+ main.log.info( "PENDING_ADD: {}".format( flowsStateCount[0]) )
+ main.log.info( "PENDING_REMOVE: {}".format( flowsStateCount[1]) )
+ main.log.info( "REMOVED: {}".format( flowsStateCount[2]) )
+ main.log.info( "FAILED: {}".format( flowsStateCount[3]) )
+
+ if flowsVerify == main.TRUE:
+ break
+
+ del main.scale[0]
+ utilities.assert_equals( expect = main.TRUE,
+ actual = intentVerify,
+ onpass = "Successfully pushed and verified intents",
+ onfail = "Failed to push and verify intents" )
+
+ # we need the total intents before crash
+ totalIntents = len(intentsState)
+ totalFlows = len(flowsState)
+
+ main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
+ main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
+
+ main.step('clean up Mininet')
+ main.Mininet1.stopNet()
+
+ main.log.info("Writing results to DS file")
+ with open(main.dbFileName, "a") as dbFile:
+ # Scale number
+ temp = str(main.numCtrls)
+ temp += ",'" + "baremetal1" + "'"
+ # how many intents we installed before crash
+ temp += "," + str(totalIntents)
+ # how many flows we installed before crash
+ temp += "," + str(totalFlows)
+ # other columns in database, but we didn't use in this test
+ temp += "," + "0,0,0,0,0,0"
+ temp += "\n"
+ dbFile.write( temp )
diff --git a/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo
new file mode 100755
index 0000000..fd28336
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.topo
@@ -0,0 +1,101 @@
+<TOPOLOGY>
+
+ <COMPONENT>
+
+ <ONOSbench>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosDriver</type>
+ <connect_order>1</connect_order>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>7</nodes>
+ </COMPONENTS>
+ </ONOSbench>
+
+ <ONOSrest1>
+ <host>OC1</host>
+ <port>8181</port>
+ <user>onos</user>
+ <password>rocks</password>
+ <type>OnosRestDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </ONOSrest1>
+ <ONOScli1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>2</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli1>
+
+ <ONOScli2>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>3</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli2>
+
+ <ONOScli3>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>4</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli3>
+
+ <ONOScli4>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli4>
+
+ <ONOScli5>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>6</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli5>
+
+ <ONOScli6>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>7</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli6>
+
+ <ONOScli7>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>OnosCliDriver</type>
+ <connect_order>8</connect_order>
+ <COMPONENTS> </COMPONENTS>
+ </ONOScli7>
+
+ <Mininet1>
+ <host>localhost</host>
+ <user>admin</user>
+ <password>onos_test</password>
+ <type>MininetCliDriver</type>
+ <connect_order>5</connect_order>
+ <COMPONENTS>
+ </COMPONENTS>
+ </Mininet1>
+
+ </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/SCPFscalingMaxIntents/__init__.py b/TestON/tests/SCPFscalingMaxIntents/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/SCPFscalingMaxIntents/__init__.py
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos1.sh b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos1.sh
index aac0ac7..2610377 100755
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos1.sh
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos1.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-vrrpd -D -n -i eth0 -v 1 -p 50 10.128.20.11 -f /var/run/
+vrrpd -D -n -i eth0 -v 1 -p 150 10.128.20.11 -f /var/run/
vrrpd -D -n -i eth0 -v 2 -p 100 10.128.20.12 -f /var/run/
-vrrpd -D -n -i eth0 -v 3 -p 150 10.128.20.13 -f /var/run/
+vrrpd -D -n -i eth0 -v 3 -p 50 10.128.20.13 -f /var/run/
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos2.sh b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos2.sh
index 760e723..3504e30 100755
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos2.sh
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos2.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-vrrpd -D -n -i eth0 -v 1 -p 50 10.128.20.12 -f /var/run/
+vrrpd -D -n -i eth0 -v 1 -p 150 10.128.20.12 -f /var/run/
vrrpd -D -n -i eth0 -v 2 -p 100 10.128.20.13 -f /var/run/
-vrrpd -D -n -i eth0 -v 3 -p 150 10.128.20.11 -f /var/run/
+vrrpd -D -n -i eth0 -v 3 -p 50 10.128.20.11 -f /var/run/
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos3.sh b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos3.sh
index 4dd9c0b..a4c486b 100755
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos3.sh
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/vrrpd-onos3.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-vrrpd -D -n -i eth0 -v 1 -p 50 10.128.20.13 -f /var/run/
+vrrpd -D -n -i eth0 -v 1 -p 150 10.128.20.13 -f /var/run/
vrrpd -D -n -i eth0 -v 2 -p 100 10.128.20.11 -f /var/run/
-vrrpd -D -n -i eth0 -v 3 -p 150 10.128.20.12 -f /var/run/
+vrrpd -D -n -i eth0 -v 3 -p 50 10.128.20.12 -f /var/run/
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params
index d0d6eff..8124dfe 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params
@@ -1,6 +1,8 @@
<PARAMS>
- <testcases>101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12</testcases>
+ <testcases>101, 100, 200, 102, 1, 2, 3, 4, 7, 8, 9, 10, 11, 12</testcases>
+ # case6 needs a new driver, will enable it after this new driver
+ #<testcases>101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12</testcases>
#Environment variables
<ENV>
<cellName>sdnip_multiple_instance_VM</cellName>
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
index fca86aa..8f0dc3f 100644
--- a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
@@ -1,7 +1,8 @@
<PARAMS>
- <testcases>100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
-
+ <testcases>100, 101, 102, 1, 2, 3, 4, 7, 8, 9, 10</testcases>
+ #<testcases>100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
+ # case6 needs a new driver, will enable it after this new driver
#Environment variables
<ENV>
<cellName>sdnip_single_instance</cellName>