Improve stability of intent reroute test
Change-Id: I38cbfec749de322626a5d3abfcdc92a73cf94dc3
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
index 2edd9a1..c3c0ff6 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
@@ -52,15 +52,15 @@
</GIT>
<ATTEMPTS>
- <verify>3</verify>
+ <verify>5</verify>
+ <maxInvalidRun>10</maxInvalidRun>
</ATTEMPTS>
<SLEEP>
- <startup>10</startup>
+ <startup>5</startup>
<setmaster>5</setmaster>
<install>10</install>
- <verify>3</verify>
- <reroute>3</reroute>
+ <verify>5</verify>
# timeout for pexpect
<timeout>300</timeout>
</SLEEP>
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index 4d72293..ac0a673 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -80,6 +80,7 @@
main.verifySleep = int(main.params['SLEEP']['verify'])
main.setMasterSleep = int(main.params['SLEEP']['setmaster'])
main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
+ main.maxInvalidRun = int(main.params['ATTEMPTS']['maxInvalidRun'])
main.sampleSize = int(main.params['TEST']['sampleSize'])
main.warmUp = int(main.params['TEST']['warmUp'])
main.ingress = main.params['TEST']['ingress']
@@ -222,7 +223,7 @@
onpass="Test step PASS",
onfail="Test step FAIL" )
- time.sleep(2)
+ time.sleep(main.startUpSleep)
main.step("Start ONOS CLI on all nodes")
cliResult = main.TRUE
main.step(" Start ONOS cli using thread ")
@@ -257,6 +258,7 @@
main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.intent" )
# Balance Master
main.CLIs[0].balanceMasters()
+ time.sleep( main.setMasterSleep )
if len(main.ONOSip) > 1:
main.CLIs[0].deviceRole(main.end1[ 'name' ], main.ONOSip[0])
main.CLIs[0].deviceRole(main.end2[ 'name' ], main.ONOSip[0])
@@ -272,6 +274,7 @@
ts = time.time()
print(main.intentsList)
for batchSize in main.intentsList:
+ main.batchSize = batchSize
main.log.report("Intent Batch size: " + str(batchSize) + "\n ")
main.LatencyList = []
main.LatencyListTopoToFirstInstalled = []
@@ -282,7 +285,7 @@
main.totalLines = []
for i in range( main.numCtrls ):
main.totalLines.append( '' )
- while main.validRun <= main.warmUp + main.sampleSize and main.invalidRun <= 20:
+ while main.validRun <= main.warmUp + main.sampleSize and main.invalidRun <= main.maxInvalidRun:
if main.validRun >= main.warmUp:
main.log.info("================================================")
main.log.info("Starting test iteration: {} ".format( main.validRun - main.warmUp))
@@ -292,7 +295,7 @@
main.log.info("====================Warm Up=====================")
# push intents
- main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
+ main.CLIs[0].pushTestIntents(main.ingress, main.egress, main.batchSize,
offset=1, options="-i", timeout=main.timeout)
# check links and flows
@@ -311,7 +314,7 @@
break
k += 1
if not main.verify:
- main.log.warn("Links or flows number are not match!")
+ main.log.warn("Links or flows number not as expected")
main.log.warn("links: {}, flows: {} ".format(linkCheck, flowsCheck))
# bring back topology
main.intentRerouteLatFuncs.bringBackTopology( main )
@@ -326,20 +329,19 @@
timeout=main.timeout, showResponse=False)
main.verify = main.FALSE
k = 0
- topoManagerLog = ""
while k <= main.verifyAttempts:
time.sleep(main.verifySleep)
summary = json.loads(main.CLIs[0].summary(timeout=main.timeout))
linkCheck = summary.get("links")
flowsCheck = summary.get("flows")
- if linkCheck == (main.deviceCount - 1) * 2:
+ if linkCheck == (main.deviceCount - 1) * 2 and flowsCheck == batchSize * main.deviceCount:
main.log.info("links: {}, flows: {} ".format(linkCheck, flowsCheck))
main.verify = main.TRUE
break
k += 1
if not main.verify:
- main.log.warn("Links number are not match in TopologyManager log!")
- main.log.warn(topoManagerLog)
+ main.log.warn("Links or flows number not as expected")
+ main.log.warn("links: {}, flows: {} ".format(linkCheck, flowsCheck))
# bring back topology
main.intentRerouteLatFuncs.bringBackTopology( main )
if main.validRun >= main.warmUp:
@@ -374,8 +376,8 @@
flowsCheck = 0
while k <= main.verifyAttempts:
time.sleep(main.verifySleep)
- main.CLIs[0].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep(1)
+ main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
+ offset=1, options="-w", timeout=main.timeout)
main.CLIs[0].purgeWithdrawnIntents()
summary = json.loads(main.CLIs[0].summary())
linkCheck = summary.get("links")
@@ -387,12 +389,12 @@
break
k += 1
if not main.verify:
- main.log.error("links, flows, or intents are not correct!")
+ main.log.error("links, flows or intents number not as expected")
main.log.info("links: {}, flows: {}, intents: {} ".format(linkCheck, flowsCheck, intentCheck))
# bring back topology
main.intentRerouteLatFuncs.bringBackTopology( main )
continue
- main.log.info("total negative results num: " + str( main.record ) )
+ #main.log.info("total negative results num: " + str( main.record ) )
aveLatency = 0
aveLatencyTopoToFirstInstalled = 0
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py b/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py
index fc18cb6..24cf32b 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/dependencies/intentRerouteLatFuncs.py
@@ -21,13 +21,19 @@
def bringBackTopology( main ):
main.log.info( "Bring back topology " )
- main.CLIs[ 0 ].removeAllIntents(purge=True, sync=True, timeout=main.timeout)
- time.sleep( 1 )
+ main.CLIs[ 0 ].pushTestIntents(main.ingress, main.egress, main.batchSize,
+ offset=1, options="-w", timeout=main.timeout)
main.CLIs[ 0 ].purgeWithdrawnIntents()
main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount", value=0)
main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled", value="false")
main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled", value="true")
+ main.CLIs[ 0 ].balanceMasters()
+ time.sleep( main.setMasterSleep )
+ if len( main.ONOSip ) > 1:
+ main.CLIs[ 0 ].deviceRole(main.end1[ 'name' ], main.ONOSip[ 0 ])
+ main.CLIs[ 0 ].deviceRole(main.end2[ 'name' ], main.ONOSip[ 0 ])
+ time.sleep( main.setMasterSleep )
def getValues( main ):
'''