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/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 7e5cb3c..0822879 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -382,11 +382,12 @@
main.cleanup()
main.exit()
- def log( self, cmdStr, level="" ):
+ def log( self, cmdStr, level="",noExit=False):
"""
log the commands in the onos CLI.
returns main.TRUE on success
returns main.FALSE if Error occurred
+ if noExit is True, TestON will not exit, but clean up
Available level: DEBUG, TRACE, INFO, WARN, ERROR
Level defaults to INFO
"""
@@ -424,24 +425,38 @@
return main.TRUE
except pexpect.TIMEOUT:
main.log.exception( self.name + ": TIMEOUT exception found" )
- main.cleanup()
- main.exit()
+ if noExit:
+ main.cleanup()
+ return None
+ else:
+ main.cleanup()
+ main.exit()
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
- main.cleanup()
- main.exit()
+ if noExit:
+ main.cleanup()
+ return None
+ else:
+ main.cleanup()
+ main.exit()
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
- main.cleanup()
- main.exit()
+ if noExit:
+ main.cleanup()
+ return None
+ else:
+ main.cleanup()
+ main.exit()
- def sendline( self, cmdStr, showResponse=False, debug=False, timeout=10 ):
+ def sendline( self, cmdStr, showResponse=False, debug=False, timeout=10, noExit=False ):
"""
Send a completely user specified string to
the onos> prompt. Use this function if you have
a very specific command to send.
+ if noExit is True, TestON will not exit, but clean up
+
Warning: There are no sanity checking to commands
sent using this method.
@@ -450,7 +465,7 @@
if debug:
# NOTE: This adds and average of .4 seconds per call
logStr = "\"Sending CLI command: '" + cmdStr + "'\""
- self.log( logStr )
+ self.log( logStr,noExit=noExit )
self.handle.sendline( cmdStr )
i = self.handle.expect( ["onos>", "\$"], timeout )
response = self.handle.before
@@ -505,12 +520,20 @@
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
- main.cleanup()
- main.exit()
+ if noExit:
+ main.cleanup()
+ return None
+ else:
+ main.cleanup()
+ main.exit()
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
- main.cleanup()
- main.exit()
+ if noExit:
+ main.cleanup()
+ return None
+ else:
+ main.cleanup()
+ main.exit()
# IMPORTANT NOTE:
# For all cli commands, naming convention should match
@@ -2200,8 +2223,11 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": ONOS timeout" )
+ return None
- def flows( self, state="", jsonFormat=True, timeout=60 ):
+ def flows( self, state="", jsonFormat=True, timeout=60, noExit=False ):
"""
Optional:
* jsonFormat: enable output formatting in json
@@ -2213,7 +2239,7 @@
if jsonFormat:
cmdStr += " -j "
cmdStr += state
- handle = self.sendline( cmdStr, timeout=timeout )
+ handle = self.sendline( cmdStr, timeout=timeout, noExit=noExit )
assert "Command not found:" not in handle, handle
if re.search( "Error:", handle ):
main.log.error( self.name + ": flows() response: " +
@@ -2242,7 +2268,7 @@
count = int(self.getTotalFlowsNum( timeout=timeout ))
return count if (count > min) else False
- def checkFlowsState( self, isPENDING=True, timeout=60 ):
+ def checkFlowsState( self, isPENDING=True, timeout=60,noExit=False ):
"""
Description:
Check the if all the current flows are in ADDED state
@@ -2291,9 +2317,13 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": ONOS timeout" )
+ return None
+
def pushTestIntents( self, ingress, egress, batchSize, offset="",
- options="", timeout=10, background = False ):
+ options="", timeout=10, background = False, noExit=False ):
"""
Description:
Push a number of intents in a batch format to
@@ -2322,7 +2352,7 @@
batchSize,
offset,
back )
- response = self.sendline( cmd, timeout=timeout )
+ response = self.sendline( cmd, timeout=timeout, noExit=noExit )
assert "Command not found:" not in response, response
main.log.info( response )
if response == None:
@@ -2350,7 +2380,7 @@
main.cleanup()
main.exit()
- def getTotalFlowsNum( self, timeout=60 ):
+ def getTotalFlowsNum( self, timeout=60, noExit=False ):
"""
Description:
Get the number of ADDED flows.
@@ -2361,7 +2391,7 @@
try:
# get total added flows number
cmd = "flows -s|grep ADDED|wc -l"
- totalFlows = self.sendline( cmd, timeout=timeout )
+ totalFlows = self.sendline( cmd, timeout=timeout, noExit=noExit )
if totalFlows == None:
# if timeout, we will get total number of all flows, and subtract other states
@@ -2371,7 +2401,7 @@
statesCount = [0, 0, 0, 0]
# get total flows from summary
- response = json.loads( self.sendline( "summary -j", timeout=timeout ) )
+ response = json.loads( self.sendline( "summary -j", timeout=timeout, noExit=noExit ) )
totalFlows = int( response.get("flows") )
for s in states:
@@ -2407,8 +2437,11 @@
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
main.exit()
+ except pexpect.TIMEOUT:
+ main.log.error( self.name + ": ONOS timeout" )
+ return None
- def getTotalIntentsNum( self ):
+ def getTotalIntentsNum( self, timeout=60 ):
"""
Description:
Get the total number of intents, include every states.
@@ -2417,7 +2450,7 @@
"""
try:
cmd = "summary -j"
- response = self.sendline( cmd )
+ response = self.sendline( cmd, timeout=timeout )
if response == None:
return -1
response = json.loads( response )
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
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params
index ed0badf..8083e7a 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/SCPFscalingMaxIntentsWithFlowObj.params
@@ -13,14 +13,14 @@
<SCALE>1,3,5,7</SCALE>
<DEPENDENCY>
- <path>/tests/SCPFscalingMaxIntents/dependencies/</path>
+ <path>/tests/SCPF/SCPFscalingMaxIntentsWithFlowObj/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/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