blob: 5a81c2332e584c7aa9aef4edb8581152d4dc54a3 [file] [log] [blame]
YPZhangcb86c5b2016-01-27 17:38:12 -08001import sys
2import json
3import time
4import os
5'''
6SCPFscalingMaxIntents
7Push test Intents to onos
8CASE10: set up Null Provider
9CASE11: set up Open Flows
YPZhang14a4aa92016-07-15 13:37:15 -070010Check flows number, if flows number is not as except, finished this test iteration
YPZhangcb86c5b2016-01-27 17:38:12 -080011Scale up when reach the Limited
12Start from 1 nodes, 8 devices. Then Scale up to 3,5,7 nodes
YPZhangcb86c5b2016-01-27 17:38:12 -080013'''
14class SCPFscalingMaxIntents:
15 def __init__( self ):
16 self.default = ''
17
18 def CASE0( self, main):
19 import sys
20 import json
21 import time
22 import os
23 import imp
24
25 main.case( "Constructing test variables and building ONOS package" )
26 main.step( "Constructing test variables" )
27 stepResult = main.FALSE
28
29 # Test variables
30 main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
31 main.dependencyPath = main.testOnDirectory + \
32 main.params['DEPENDENCY']['path']
33 main.cellName = main.params[ 'ENV' ][ 'cellName' ]
34 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
35 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
36 main.scale = ( main.params[ 'SCALE' ] ).split( "," )
37 main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
38 main.timeout = int(main.params['SLEEP']['timeout'])
39 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
40 main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
41 main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
42 main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
43 main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] )
44 main.ingress = main.params['LINK']['ingress']
45 main.egress = main.params['LINK']['egress']
YPZhangcb86c5b2016-01-27 17:38:12 -080046 main.cellData = {} # for creating cell file
47 main.reroute = main.params['reroute']
YPZhange6ef82a2016-07-05 16:48:15 -070048 main.flowObj = main.params['TEST']['flowObj']
49 if main.flowObj == "True":
50 main.flowObj = True
51 main.dbFileName = main.params['DATABASE']['dbFlowObj']
52 else:
53 main.flowObj = False
54 main.dbFileName = main.params['DATABASE']['dbName']
YPZhangcb86c5b2016-01-27 17:38:12 -080055 main.threadID = 0
56
57 if main.reroute == "True":
58 main.reroute = True
59 else:
60 main.reroute = False
61
62 main.CLIs = []
YPZhangcb86c5b2016-01-27 17:38:12 -080063 main.setupSkipped = False
64
65 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
66 gitBranch = main.params[ 'GIT' ][ 'branch' ]
67 gitPull = main.params[ 'GIT' ][ 'pull' ]
68 nic = main.params['DATABASE']['nic']
69 node = main.params['DATABASE']['node']
70 nic = main.params['DATABASE']['nic']
71 node = main.params['DATABASE']['node']
72 stepResult = main.TRUE
73
74 main.log.info("Cresting DB file")
75 with open(main.dbFileName, "w+") as dbFile:
76 dbFile.write("")
77
78 utilities.assert_equals( expect=main.TRUE,
79 actual=stepResult,
80 onpass="environment set up successfull",
81 onfail="environment set up Failed" )
82
83 def CASE1( self ):
84 # main.scale[ 0 ] determines the current number of ONOS controller
85 main.CLIs = []
86 main.numCtrls = int( main.scale[ 0 ] )
YPZhangebf9eb52016-05-12 15:20:24 -070087 main.ONOSip = []
88 main.maxNumBatch = 0
89 main.AllONOSip = main.ONOSbench.getOnosIps()
90 for i in range(main.numCtrls):
91 main.ONOSip.append(main.AllONOSip[i])
92 main.log.info(main.ONOSip)
93
YPZhangcb86c5b2016-01-27 17:38:12 -080094 main.log.info( "Creating list of ONOS cli handles" )
95 for i in range(main.numCtrls):
96 main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) )
97
98 main.log.info(main.CLIs)
99 if not main.CLIs:
100 main.log.error( "Failed to create the list of ONOS cli handles" )
101 main.cleanup()
102 main.exit()
103
104 main.log.info( "Loading wrapper files" )
105 main.startUp = imp.load_source( wrapperFile1,
106 main.dependencyPath +
107 wrapperFile1 +
108 ".py" )
109
110 copyResult = main.ONOSbench.copyMininetFile( main.topology,
111 main.dependencyPath,
112 main.Mininet1.user_name,
113 main.Mininet1.ip_address )
114
115 commit = main.ONOSbench.getVersion(report=True)
116 commit = commit.split(" ")[1]
117
YPZhangcb86c5b2016-01-27 17:38:12 -0800118 with open(main.dbFileName, "a") as dbFile:
119 temp = "'" + commit + "',"
120 temp += "'" + nic + "',"
121 dbFile.write(temp)
122
123 def CASE2( self, main ):
124 """
125 - Uninstall ONOS cluster
126 - Verify ONOS start up
127 - Install ONOS cluster
128 - Connect to cli
129 """
130 main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
131 main.log.info( "Safety check, killing all ONOS processes" +
132 " before initiating environment setup" )
133
134 for i in range( main.numCtrls ):
You Wangb98a9fa2017-02-15 17:27:42 -0800135 main.ONOSbench.onosStop( main.ONOSip[ i ] )
136 main.ONOSbench.onosKill( main.ONOSip[ i ] )
YPZhangcb86c5b2016-01-27 17:38:12 -0800137
138 main.log.info( "NODE COUNT = %s" % main.numCtrls)
139
140 tempOnosIp = []
141 for i in range( main.numCtrls ):
142 tempOnosIp.append( main.ONOSip[i] )
143
144 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
145 "temp",
146 main.Mininet1.ip_address,
147 main.apps,
Devin Limdc78e202017-06-09 18:30:07 -0700148 tempOnosIp, main.ONOScli1.karafUser )
YPZhangcb86c5b2016-01-27 17:38:12 -0800149
150 main.step( "Apply cell to environment" )
151 cellResult = main.ONOSbench.setCell( "temp" )
152 verifyResult = main.ONOSbench.verifyCell()
153 stepResult = cellResult and verifyResult
154 utilities.assert_equals( expect=main.TRUE,
155 actual=stepResult,
156 onpass="Successfully applied cell to " + \
157 "environment",
158 onfail="Failed to apply cell to environment " )
159
160 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700161 packageResult = main.ONOSbench.buckBuild()
YPZhangcb86c5b2016-01-27 17:38:12 -0800162 stepResult = packageResult
163 utilities.assert_equals( expect=main.TRUE,
164 actual=stepResult,
165 onpass="Successfully created ONOS package",
166 onfail="Failed to create ONOS package" )
167
168 main.step( "Uninstall ONOS package on all Nodes" )
169 uninstallResult = main.TRUE
170 for i in range( int( main.numCtrls ) ):
171 main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] )
172 u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] )
173 utilities.assert_equals( expect=main.TRUE, actual=u_result,
174 onpass="Test step PASS",
175 onfail="Test step FAIL" )
176 uninstallResult = ( uninstallResult and u_result )
177
178 main.step( "Install ONOS package on all Nodes" )
179 installResult = main.TRUE
180 for i in range( int( main.numCtrls ) ):
181 main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] )
182 i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] )
183 utilities.assert_equals( expect=main.TRUE, actual=i_result,
184 onpass="Test step PASS",
185 onfail="Test step FAIL" )
186 installResult = installResult and i_result
187
Chiyu Chengef109502016-11-21 15:51:38 -0800188 main.step( "Set up ONOS secure SSH" )
189 secureSshResult = main.TRUE
190 for i in range( int( main.numCtrls ) ):
191 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
192 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
193 onpass="Test step PASS",
194 onfail="Test step FAIL" )
195
You Wang0357c432017-01-09 16:13:33 -0800196 time.sleep( main.startUpSleep )
197 main.step( "Starting ONOS service" )
198 stopResult = main.TRUE
199 startResult = main.TRUE
200 onosIsUp = main.TRUE
201 for i in range( main.numCtrls ):
202 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
203 if onosIsUp == main.TRUE:
204 main.log.report( "ONOS instance is up and ready" )
205 else:
206 main.log.report( "ONOS instance may not be up, stop and " +
207 "start ONOS again " )
208 for i in range( main.numCtrls ):
209 stopResult = stopResult and \
210 main.ONOSbench.onosStop( main.ONOSip[ i ] )
211 for i in range( main.numCtrls ):
212 startResult = startResult and \
213 main.ONOSbench.onosStart( main.ONOSip[ i ] )
214 stepResult = onosIsUp and stopResult and startResult
215 utilities.assert_equals( expect=main.TRUE,
216 actual=stepResult,
217 onpass="ONOS service is ready",
218 onfail="ONOS service did not start properly" )
219
YPZhangcb86c5b2016-01-27 17:38:12 -0800220 main.step( "Start ONOS CLI on all nodes" )
221 cliResult = main.TRUE
Jon Hall6509dbf2016-06-21 17:01:17 -0700222 main.step(" Start ONOS cli using thread ")
YPZhangcb86c5b2016-01-27 17:38:12 -0800223 startCliResult = main.TRUE
224 pool = []
225
226 for i in range( int( main.numCtrls) ):
227 t = main.Thread( target=main.CLIs[i].startOnosCli,
228 threadID=main.threadID,
229 name="startOnosCli",
230 args=[ main.ONOSip[i] ],
231 kwargs = {"onosStartTimeout":main.timeout} )
232 pool.append(t)
233 t.start()
234 main.threadID = main.threadID + 1
235 for t in pool:
236 t.join()
237 startCliResult = startCliResult and t.result
238 time.sleep( main.startUpSleep )
239
240 def CASE10( self, main ):
241 """
242 Setting up null-provider
243 """
244 import json
245 # Activate apps
246 main.step("Activating null-provider")
247 appStatus = utilities.retry( main.CLIs[0].activateApp,
248 main.FALSE,
249 ['org.onosproject.null'],
250 sleep=main.verifySleep,
251 attempts=main.verifyAttempts )
252 utilities.assert_equals( expect=main.TRUE,
253 actual=appStatus,
254 onpass="Successfully activated null-provider",
255 onfail="Failed activate null-provider" )
256
257 # Setup the null-provider
258 main.step("Configuring null-provider")
259 cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
260 main.FALSE,
261 [ main.ONOSip[0],
262 'org.onosproject.provider.nil.NullProviders', 'deviceCount 8'],
263 sleep=main.verifySleep,
264 attempts = main.verifyAttempts )
265 cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
266 main.FALSE,
267 [ main.ONOSip[0],
268 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'],
269 sleep=main.verifySleep,
270 attempts = main.verifyAttempts )
271
272 cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
273 main.FALSE,
274 [ main.ONOSip[0],
275 'org.onosproject.provider.nil.NullProviders', 'enabled true'],
276 sleep=main.verifySleep,
277 attempts = main.verifyAttempts )
278
279
280 utilities.assert_equals( expect=main.TRUE,
281 actual=cfgStatus,
282 onpass="Successfully configured null-provider",
283 onfail="Failed to configure null-provider" )
284
285 # give onos some time to settle
286 time.sleep(main.startUpSleep)
287
288 main.log.info("Setting default flows to zero")
289 main.defaultFlows = 0
290
291 main.step("Check status of null-provider setup")
292 caseResult = appStatus and cfgStatus
293 utilities.assert_equals( expect=main.TRUE,
294 actual=caseResult,
295 onpass="Setting up null-provider was successfull",
296 onfail="Failed to setup null-provider" )
297
298 # This tells the following cases if we are using the null-provider or ovs
299 main.switchType = "null:"
300
301 # If the null-provider setup was unsuccessfull, then there is no point to
302 # run the subsequent cases
303
304 time.sleep(main.startUpSleep)
305 main.step( "Balancing Masters" )
306
307 stepResult = main.FALSE
308 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
309 main.FALSE,
310 [],
311 sleep=3,
312 attempts=3 )
313
314 utilities.assert_equals( expect=main.TRUE,
315 actual=stepResult,
316 onpass="Balance masters was successfull",
317 onfail="Failed to balance masters")
318
319 time.sleep( 5 )
320 if not caseResult:
321 main.setupSkipped = True
322
323 def CASE11( self, main):
324 '''
325 Setting up mininet
326 '''
327 import json
328 import time
YPZhangebf9eb52016-05-12 15:20:24 -0700329
330 devices = []
331 devices = main.CLIs[0].getAllDevicesId()
332 for d in devices:
333 main.CLIs[0].deviceRemove( d )
YPZhangcb86c5b2016-01-27 17:38:12 -0800334
335 time.sleep(main.startUpSleep)
YPZhange6ef82a2016-07-05 16:48:15 -0700336 if main.flowObj:
337 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
338 "useFlowObjectives", value="true")
You Wang106d0fa2017-05-15 17:22:15 -0700339 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
340 "defaultFlowObjectiveCompiler",
341 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
YPZhangcb86c5b2016-01-27 17:38:12 -0800342 main.step('Starting mininet topology')
343 mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
344 utilities.assert_equals( expect=main.TRUE,
345 actual=mnStatus,
346 onpass="Successfully started Mininet",
347 onfail="Failed to activate Mininet" )
348
349 main.step("Assinging masters to switches")
350 switches = main.Mininet1.getSwitches()
351 swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
352 utilities.assert_equals( expect=main.TRUE,
353 actual=swStatus,
354 onpass="Successfully assigned switches to masters",
355 onfail="Failed assign switches to masters" )
356
357 time.sleep(main.startUpSleep)
YPZhangebf9eb52016-05-12 15:20:24 -0700358 # Balancing Masters
359 main.step( "Balancing Masters" )
360 stepResult = main.FALSE
361 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
362 main.FALSE,
363 [],
364 sleep=3,
365 attempts=3 )
366
367 utilities.assert_equals( expect=main.TRUE,
368 actual=stepResult,
369 onpass="Balance masters was successfull",
370 onfail="Failed to balance masters" )
YPZhangcb86c5b2016-01-27 17:38:12 -0800371
372 main.log.info("Getting default flows")
373 jsonSum = json.loads(main.CLIs[0].summary())
374 main.defaultFlows = jsonSum["flows"]
375
376 main.step("Check status of Mininet setup")
YPZhangebf9eb52016-05-12 15:20:24 -0700377 caseResult = mnStatus and swStatus
YPZhangcb86c5b2016-01-27 17:38:12 -0800378 utilities.assert_equals( expect=main.TRUE,
379 actual=caseResult,
380 onpass="Successfully setup Mininet",
381 onfail="Failed setup Mininet" )
382
383 # This tells the following cases if we are using the null-provider or ovs
384 main.switchType = "of:"
385
386 time.sleep(main.startUpSleep)
387 main.step( "Balancing Masters" )
388
389 stepResult = main.FALSE
390 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
391 main.FALSE,
392 [],
393 sleep=3,
394 attempts=3 )
395
396 utilities.assert_equals( expect=main.TRUE,
397 actual=stepResult,
398 onpass="Balance masters was successfull",
399 onfail="Failed to balance masters")
400
401 time.sleep(5)
402 if not caseResult:
403 main.setupSkipped = True
404
405
406
407 def CASE20( self, main ):
408 if main.reroute:
409 main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
410 main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
411 main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
412 main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
413 else:
414 main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
415 main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
416 main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
417 main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
418
419 # check if the case needs to be skipped
420 if main.setupSkipped:
421 main.setupSkipped = False
422 main.skipCase()
423
424 # the index where the next intents will be installed
425 offfset = 0
426 # keeps track of how many intents have been installed
427 currIntents = 0
YPZhang3097ba92016-02-16 17:32:32 -0800428 # keeps track of how many flows have been installed, set to 0 at start
429 currFlows = 0
YPZhangcb86c5b2016-01-27 17:38:12 -0800430 # limit for the number of intents that can be installed
YPZhangebf9eb52016-05-12 15:20:24 -0700431 main.batchSize = int( int(main.batchSize)/int(main.numCtrls))
YPZhangcb86c5b2016-01-27 17:38:12 -0800432 limit = main.maxIntents / main.batchSize
433 # total intents installed
434 totalIntents = 0
435
436 intentsState = None
437
438 offtmp = 0
439 main.step( "Pushing intents" )
440 stepResult = main.TRUE
YPZhang47779c22016-03-07 13:03:07 -0800441 # temp variable to contain the number of flows
442 flowsNum = 0
YPZhangebf9eb52016-05-12 15:20:24 -0700443 if main.numCtrls > 1:
444 # if more than one onos nodes, we should check more frequently
445 main.checkInterval = main.checkInterval/4
YPZhangcb86c5b2016-01-27 17:38:12 -0800446
YPZhangebf9eb52016-05-12 15:20:24 -0700447 # make sure the checkInterval divisible batchSize
448 main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
YPZhangac53ebf2016-05-13 16:26:19 -0700449 flowTemp=0
YPZhang14a4aa92016-07-15 13:37:15 -0700450 intentVerifyTemp = 0
YPZhangac53ebf2016-05-13 16:26:19 -0700451 totalFlows=0
YPZhangcb86c5b2016-01-27 17:38:12 -0800452 for i in range(limit):
453
454 # Threads pool
455 pool = []
456
457 for j in range( int( main.numCtrls) ):
458 if main.numCtrls > 1:
459 time.sleep( 1 )
460 offtmp = offfset + main.maxIntents * j
461 # Push intents by using threads
462 t = main.Thread( target=main.CLIs[j].pushTestIntents,
463 threadID=main.threadID,
464 name="Push-Test-Intents",
465 args=[ main.switchType + main.ingress,
466 main.switchType + main.egress,
467 main.batchSize ],
468 kwargs={ "offset": offtmp,
469 "options": "-i",
470 "timeout": main.timeout,
YPZhangebf9eb52016-05-12 15:20:24 -0700471 "background":False,
472 "noExit":True} )
YPZhangcb86c5b2016-01-27 17:38:12 -0800473 pool.append(t)
474 t.start()
475 main.threadID = main.threadID + 1
476 for t in pool:
477 t.join()
478 stepResult = stepResult and t.result
479 offfset = offfset + main.batchSize
480
YPZhang3097ba92016-02-16 17:32:32 -0800481 totalIntents = main.batchSize * main.numCtrls + totalIntents
YPZhangcb86c5b2016-01-27 17:38:12 -0800482 if totalIntents >= main.minIntents and totalIntents % main.checkInterval == 0:
483 # if reach to minimum number and check interval, verify Intetns and flows
484 time.sleep( main.verifySleep * main.numCtrls )
485
486 main.log.info("Verify Intents states")
YPZhang3097ba92016-02-16 17:32:32 -0800487 # k is a control variable for verify retry attempts
YPZhangcb86c5b2016-01-27 17:38:12 -0800488 k = 1
YPZhang3097ba92016-02-16 17:32:32 -0800489 while k <= main.verifyAttempts:
YPZhang14a4aa92016-07-15 13:37:15 -0700490 # while loop for check intents by using CLI driver
YPZhangcb86c5b2016-01-27 17:38:12 -0800491 time.sleep(5)
YPZhang14a4aa92016-07-15 13:37:15 -0700492 intentsState = main.CLIs[0].checkIntentSummary(timeout=600, noExit=True)
YPZhangebf9eb52016-05-12 15:20:24 -0700493 if intentsState:
YPZhang14a4aa92016-07-15 13:37:15 -0700494 verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
495 if intentVerifyTemp < verifyTotalIntents:
496 intentVerifyTemp = verifyTotalIntents
YPZhangebf9eb52016-05-12 15:20:24 -0700497 else:
YPZhang14a4aa92016-07-15 13:37:15 -0700498 verifyTotalIntents = intentVerifyTemp
YPZhang6e758fb2016-07-26 09:20:55 -0700499 intentsState = False
YPZhang14a4aa92016-07-15 13:37:15 -0700500 main.log.info("Total Installed Intents: {}".format( verifyTotalIntents ) )
YPZhangcb86c5b2016-01-27 17:38:12 -0800501 break
YPZhangcb86c5b2016-01-27 17:38:12 -0800502 k = k+1
YPZhangac53ebf2016-05-13 16:26:19 -0700503
YPZhang14a4aa92016-07-15 13:37:15 -0700504 k = 1
505 flowVerify = True
506 while k <= main.verifyAttempts:
507 time.sleep(5)
508 totalFlows = main.CLIs[0].getTotalFlowsNum( timeout=600, noExit=True )
509 expectFlows = totalIntents * 7 + main.defaultFlows
510 if totalFlows == expectFlows:
511 main.log.info("Total Flows Added: {}".format(totalFlows))
512 break
513 else:
514 main.log.info("Some Flows are not added, retry...")
515 main.log.info("Total Flows Added: {} Expect Flows: {}".format(totalFlows, expectFlows))
516 flowVerify = False
YPZhangac53ebf2016-05-13 16:26:19 -0700517
YPZhang14a4aa92016-07-15 13:37:15 -0700518 k += 1
519 if flowTemp < totalFlows:
520 flowTemp = totalFlows
521 else:
522 totalFlows = flowTemp
523
524 if not intentsState or not flowVerify:
YPZhanga4acbb82016-03-02 17:28:25 -0800525 # If some intents are not installed, grep the previous flows list, and finished this test case
YPZhang14a4aa92016-07-15 13:37:15 -0700526 main.log.warn( "Intents or flows are not installed" )
527 verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
528 if intentVerifyTemp < verifyTotalIntents:
529 intentVerifyTemp = verifyTotalIntents
530 else:
531 verifyTotalIntents = intentVerifyTemp
532 if flowTemp < totalFlows:
533 flowTemp = totalFlows
534 else:
535 totalFlows = flowTemp
YPZhangac53ebf2016-05-13 16:26:19 -0700536 main.log.info("Total Intents: {}".format( verifyTotalIntents) )
YPZhangcb86c5b2016-01-27 17:38:12 -0800537 break
YPZhange96a3062016-05-12 16:18:35 -0700538
YPZhangcb86c5b2016-01-27 17:38:12 -0800539 del main.scale[0]
540 utilities.assert_equals( expect = main.TRUE,
YPZhangebf9eb52016-05-12 15:20:24 -0700541 actual = intentsState,
YPZhangcb86c5b2016-01-27 17:38:12 -0800542 onpass = "Successfully pushed and verified intents",
543 onfail = "Failed to push and verify intents" )
544
YPZhangcb86c5b2016-01-27 17:38:12 -0800545 main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
546 main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
547
548 main.step('clean up Mininet')
549 main.Mininet1.stopNet()
YPZhangcb86c5b2016-01-27 17:38:12 -0800550 main.log.info("Writing results to DS file")
551 with open(main.dbFileName, "a") as dbFile:
552 # Scale number
553 temp = str(main.numCtrls)
554 temp += ",'" + "baremetal1" + "'"
555 # how many intents we installed before crash
YPZhangac53ebf2016-05-13 16:26:19 -0700556 temp += "," + str(verifyTotalIntents)
YPZhangcb86c5b2016-01-27 17:38:12 -0800557 # how many flows we installed before crash
558 temp += "," + str(totalFlows)
559 # other columns in database, but we didn't use in this test
560 temp += "," + "0,0,0,0,0,0"
561 temp += "\n"
562 dbFile.write( temp )