Change the batch size to 1000 and test on BM
- use cli to check flows
- update SCPFscalingMaxIntnetsWithFlowObj test
- modify some driver functions, add timeout handle for pexcept
- test will run to 70000 intents, because more intents will casue onos crashed
- skip vervify flows, because sometimes it will casue onos crashed
Change-Id: I05adfdcfca4a50d81b1f2030aaa2194054507f3c
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py
index e405fd3..b959666 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.py
@@ -3,7 +3,7 @@
import time
import os
'''
-SCPFscalingMaxIntentsWithFlowObj
+SCPFscalingMaxIntents
Push test Intents to onos
CASE10: set up Null Provider
CASE11: set up Open Flows
@@ -54,10 +54,6 @@
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' ]
@@ -82,6 +78,13 @@
# main.scale[ 0 ] determines the current number of ONOS controller
main.CLIs = []
main.numCtrls = int( main.scale[ 0 ] )
+ main.ONOSip = []
+ main.maxNumBatch = 0
+ main.AllONOSip = main.ONOSbench.getOnosIps()
+ for i in range(main.numCtrls):
+ main.ONOSip.append(main.AllONOSip[i])
+ main.log.info(main.ONOSip)
+
main.log.info( "Creating list of ONOS cli handles" )
for i in range(main.numCtrls):
main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) )
@@ -301,25 +304,16 @@
Setting up mininet
'''
import json
- import time
+ import time
+ devices = []
+ devices = main.CLIs[0].getAllDevicesId()
+ for d in devices:
+ main.CLIs[0].deviceRemove( d )
- 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.log.info("Set Intent Compiler use Flow Object")
- main.CLIs[0].setCfg( "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator", "useFlowObjectives", "true" )
-
+ main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
+ "useFlowObjectives", "true")
+ time.sleep(main.startUpSleep)
main.step('Starting mininet topology')
mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
utilities.assert_equals( expect=main.TRUE,
@@ -336,13 +330,26 @@
onfail="Failed assign switches to masters" )
time.sleep(main.startUpSleep)
+ # Balancing Masters
+ 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" )
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
+ caseResult = mnStatus and swStatus
utilities.assert_equals( expect=main.TRUE,
actual=caseResult,
onpass="Successfully setup Mininet",
@@ -396,6 +403,7 @@
# keeps track of how many flows have been installed, set to 0 at start
currFlows = 0
# limit for the number of intents that can be installed
+ main.batchSize = int( int(main.batchSize)/int(main.numCtrls))
limit = main.maxIntents / main.batchSize
# total intents installed
totalIntents = 0
@@ -407,7 +415,12 @@
stepResult = main.TRUE
# temp variable to contain the number of flows
flowsNum = 0
+ if main.numCtrls > 1:
+ # if more than one onos nodes, we should check more frequently
+ main.checkInterval = main.checkInterval/4
+ # make sure the checkInterval divisible batchSize
+ main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
for i in range(limit):
# Threads pool
@@ -427,7 +440,8 @@
kwargs={ "offset": offtmp,
"options": "-i",
"timeout": main.timeout,
- "background":False } )
+ "background":False,
+ "noExit":True} )
pool.append(t)
t.start()
main.threadID = main.threadID + 1
@@ -444,108 +458,45 @@
main.log.info("Verify Intents states")
# k is a control variable for verify retry attempts
k = 1
- intentVerify = main.FALSE
while k <= main.verifyAttempts:
# 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
-
- main.log.info("Total Intents: {} INSTALLED: {}".format(totalIntents, temp))
- if totalIntents == temp:
- intentVerify = main.TRUE
+ intentsState = main.CLIs[0].checkIntentSummary(timeout=600)
+ if intentsState:
+ totalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600)
+ if temp < totalIntents:
+ temp = totalIntents
+ else:
+ totalIntents = temp
break
- intentVerify = main.FALSE
+ main.log.info("Total Intents: {}".format( totalIntents) )
k = k+1
- if not intentVerify:
+
+ if not intentsState:
# If some intents are not installed, grep the previous flows list, and 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
- if currFlows == 0:
- # If currFlows equal 0, which means we failed to install intents at first, or we didn't get
- # the correct number, so we need get flows here.
- flowsState = json.loads( main.ONOSrest1.flows() )
+ main.log.info("Total Intents: {}".format( totalIntents) )
break
-
- main.log.info("Verify Flows states")
- k = 1
- flowsVerify = main.TRUE
- while k <= main.verifyAttempts:
- # while loop for check flows by using REST api
- time.sleep(3)
- temp = 0
- flowsStateCount = []
- flowsState = json.loads( main.ONOSrest1.flows() )
- main.log.info("Total flows now: {}".format(len(flowsState)))
- if ( flowsNum < len(flowsState) ):
- flowsNum = len(flowsState)
- print(flowsNum)
- 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
-
+ # We don't want to check flows if intents not installed, because onos will drop flows
+ temp = 0
+ totalFlows = 0
+ if temp < totalFlows:
+ temp = totalFlows
+ else:
+ totalFlows = main.CLIs[0].getTotalFlowsNum(timeout=600, noExit=True)
del main.scale[0]
utilities.assert_equals( expect = main.TRUE,
- actual = intentVerify,
+ actual = intentsState,
onpass = "Successfully pushed and verified intents",
onfail = "Failed to push and verify intents" )
- # we need the total intents before crash
- totalIntents = len(intentsState)
- totalFlows = flowsNum
-
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