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/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
index 6efe17e..cb75b01 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
@@ -13,14 +13,14 @@
<SCALE>1,3,5,7</SCALE>
<DEPENDENCY>
- <path>/tests/SCPFscalingMaxIntents/dependencies/</path>
+ <path>/tests/SCPF/SCPFscalingMaxIntents/dependencies/</path>
<wrapper1>startUp</wrapper1>
<topology>rerouteTopo.py</topology>
</DEPENDENCY>
<ENV>
<cellName>productionCell</cellName>
- <cellApps>drivers</cellApps>
+ <cellApps>drivers,openflow</cellApps>
</ENV>
<GIT>
@@ -61,10 +61,10 @@
<NULL>
# CASE20
<PUSH>
- <batch_size>100</batch_size>
- <min_intents>100</min_intents>
- <max_intents>100000</max_intents>
- <check_interval>100</check_interval>
+ <batch_size>1000</batch_size>
+ <min_intents>10000</min_intents>
+ <max_intents>70000</max_intents>
+ <check_interval>10000</check_interval>
</PUSH>
# if reroute is true
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index 27bc5c2..bf34f83 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -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) ) )
@@ -302,19 +305,11 @@
'''
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" )
+
+ devices = []
+ devices = main.CLIs[0].getAllDevicesId()
+ for d in devices:
+ main.CLIs[0].deviceRemove( d )
time.sleep(main.startUpSleep)
main.step('Starting mininet topology')
@@ -333,13 +328,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",
@@ -393,6 +401,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
@@ -404,7 +413,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
@@ -424,7 +438,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
@@ -441,108 +456,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
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/__init__.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/__init__.py