blob: 9032e1fe8bbc17c0b67ce02756950c78e7910d6e [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
118 if gitPull == 'True':
119 if not main.startUp.onosBuild( main, gitBranch ):
120 main.log.error( "Failed to build ONOS" )
121 main.cleanup()
122 main.exit()
123 else:
124 main.log.warn( "Did not pull new code so skipping mvn " +
125 "clean install" )
126 with open(main.dbFileName, "a") as dbFile:
127 temp = "'" + commit + "',"
128 temp += "'" + nic + "',"
129 dbFile.write(temp)
130
131 def CASE2( self, main ):
132 """
133 - Uninstall ONOS cluster
134 - Verify ONOS start up
135 - Install ONOS cluster
136 - Connect to cli
137 """
138 main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
139 main.log.info( "Safety check, killing all ONOS processes" +
140 " before initiating environment setup" )
141
142 for i in range( main.numCtrls ):
You Wangb98a9fa2017-02-15 17:27:42 -0800143 main.ONOSbench.onosStop( main.ONOSip[ i ] )
144 main.ONOSbench.onosKill( main.ONOSip[ i ] )
YPZhangcb86c5b2016-01-27 17:38:12 -0800145
146 main.log.info( "NODE COUNT = %s" % main.numCtrls)
147
148 tempOnosIp = []
149 for i in range( main.numCtrls ):
150 tempOnosIp.append( main.ONOSip[i] )
151
152 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
153 "temp",
154 main.Mininet1.ip_address,
155 main.apps,
Devin Lim461f0872017-06-05 16:49:33 -0700156 tempOnosIp, main.ONOScli1.user_name )
YPZhangcb86c5b2016-01-27 17:38:12 -0800157
158 main.step( "Apply cell to environment" )
159 cellResult = main.ONOSbench.setCell( "temp" )
160 verifyResult = main.ONOSbench.verifyCell()
161 stepResult = cellResult and verifyResult
162 utilities.assert_equals( expect=main.TRUE,
163 actual=stepResult,
164 onpass="Successfully applied cell to " + \
165 "environment",
166 onfail="Failed to apply cell to environment " )
167
168 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700169 packageResult = main.ONOSbench.buckBuild()
YPZhangcb86c5b2016-01-27 17:38:12 -0800170 stepResult = packageResult
171 utilities.assert_equals( expect=main.TRUE,
172 actual=stepResult,
173 onpass="Successfully created ONOS package",
174 onfail="Failed to create ONOS package" )
175
176 main.step( "Uninstall ONOS package on all Nodes" )
177 uninstallResult = main.TRUE
178 for i in range( int( main.numCtrls ) ):
179 main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] )
180 u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] )
181 utilities.assert_equals( expect=main.TRUE, actual=u_result,
182 onpass="Test step PASS",
183 onfail="Test step FAIL" )
184 uninstallResult = ( uninstallResult and u_result )
185
186 main.step( "Install ONOS package on all Nodes" )
187 installResult = main.TRUE
188 for i in range( int( main.numCtrls ) ):
189 main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] )
190 i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] )
191 utilities.assert_equals( expect=main.TRUE, actual=i_result,
192 onpass="Test step PASS",
193 onfail="Test step FAIL" )
194 installResult = installResult and i_result
195
Chiyu Chengef109502016-11-21 15:51:38 -0800196 main.step( "Set up ONOS secure SSH" )
197 secureSshResult = main.TRUE
198 for i in range( int( main.numCtrls ) ):
199 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
200 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
201 onpass="Test step PASS",
202 onfail="Test step FAIL" )
203
You Wang0357c432017-01-09 16:13:33 -0800204 time.sleep( main.startUpSleep )
205 main.step( "Starting ONOS service" )
206 stopResult = main.TRUE
207 startResult = main.TRUE
208 onosIsUp = main.TRUE
209 for i in range( main.numCtrls ):
210 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
211 if onosIsUp == main.TRUE:
212 main.log.report( "ONOS instance is up and ready" )
213 else:
214 main.log.report( "ONOS instance may not be up, stop and " +
215 "start ONOS again " )
216 for i in range( main.numCtrls ):
217 stopResult = stopResult and \
218 main.ONOSbench.onosStop( main.ONOSip[ i ] )
219 for i in range( main.numCtrls ):
220 startResult = startResult and \
221 main.ONOSbench.onosStart( main.ONOSip[ i ] )
222 stepResult = onosIsUp and stopResult and startResult
223 utilities.assert_equals( expect=main.TRUE,
224 actual=stepResult,
225 onpass="ONOS service is ready",
226 onfail="ONOS service did not start properly" )
227
YPZhangcb86c5b2016-01-27 17:38:12 -0800228 main.step( "Start ONOS CLI on all nodes" )
229 cliResult = main.TRUE
Jon Hall6509dbf2016-06-21 17:01:17 -0700230 main.step(" Start ONOS cli using thread ")
YPZhangcb86c5b2016-01-27 17:38:12 -0800231 startCliResult = main.TRUE
232 pool = []
233
234 for i in range( int( main.numCtrls) ):
235 t = main.Thread( target=main.CLIs[i].startOnosCli,
236 threadID=main.threadID,
237 name="startOnosCli",
238 args=[ main.ONOSip[i] ],
239 kwargs = {"onosStartTimeout":main.timeout} )
240 pool.append(t)
241 t.start()
242 main.threadID = main.threadID + 1
243 for t in pool:
244 t.join()
245 startCliResult = startCliResult and t.result
246 time.sleep( main.startUpSleep )
247
248 def CASE10( self, main ):
249 """
250 Setting up null-provider
251 """
252 import json
253 # Activate apps
254 main.step("Activating null-provider")
255 appStatus = utilities.retry( main.CLIs[0].activateApp,
256 main.FALSE,
257 ['org.onosproject.null'],
258 sleep=main.verifySleep,
259 attempts=main.verifyAttempts )
260 utilities.assert_equals( expect=main.TRUE,
261 actual=appStatus,
262 onpass="Successfully activated null-provider",
263 onfail="Failed activate null-provider" )
264
265 # Setup the null-provider
266 main.step("Configuring null-provider")
267 cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
268 main.FALSE,
269 [ main.ONOSip[0],
270 'org.onosproject.provider.nil.NullProviders', 'deviceCount 8'],
271 sleep=main.verifySleep,
272 attempts = main.verifyAttempts )
273 cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
274 main.FALSE,
275 [ main.ONOSip[0],
276 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'],
277 sleep=main.verifySleep,
278 attempts = main.verifyAttempts )
279
280 cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
281 main.FALSE,
282 [ main.ONOSip[0],
283 'org.onosproject.provider.nil.NullProviders', 'enabled true'],
284 sleep=main.verifySleep,
285 attempts = main.verifyAttempts )
286
287
288 utilities.assert_equals( expect=main.TRUE,
289 actual=cfgStatus,
290 onpass="Successfully configured null-provider",
291 onfail="Failed to configure null-provider" )
292
293 # give onos some time to settle
294 time.sleep(main.startUpSleep)
295
296 main.log.info("Setting default flows to zero")
297 main.defaultFlows = 0
298
299 main.step("Check status of null-provider setup")
300 caseResult = appStatus and cfgStatus
301 utilities.assert_equals( expect=main.TRUE,
302 actual=caseResult,
303 onpass="Setting up null-provider was successfull",
304 onfail="Failed to setup null-provider" )
305
306 # This tells the following cases if we are using the null-provider or ovs
307 main.switchType = "null:"
308
309 # If the null-provider setup was unsuccessfull, then there is no point to
310 # run the subsequent cases
311
312 time.sleep(main.startUpSleep)
313 main.step( "Balancing Masters" )
314
315 stepResult = main.FALSE
316 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
317 main.FALSE,
318 [],
319 sleep=3,
320 attempts=3 )
321
322 utilities.assert_equals( expect=main.TRUE,
323 actual=stepResult,
324 onpass="Balance masters was successfull",
325 onfail="Failed to balance masters")
326
327 time.sleep( 5 )
328 if not caseResult:
329 main.setupSkipped = True
330
331 def CASE11( self, main):
332 '''
333 Setting up mininet
334 '''
335 import json
336 import time
YPZhangebf9eb52016-05-12 15:20:24 -0700337
338 devices = []
339 devices = main.CLIs[0].getAllDevicesId()
340 for d in devices:
341 main.CLIs[0].deviceRemove( d )
YPZhangcb86c5b2016-01-27 17:38:12 -0800342
343 time.sleep(main.startUpSleep)
YPZhange6ef82a2016-07-05 16:48:15 -0700344 if main.flowObj:
345 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
346 "useFlowObjectives", value="true")
You Wang106d0fa2017-05-15 17:22:15 -0700347 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
348 "defaultFlowObjectiveCompiler",
349 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
YPZhangcb86c5b2016-01-27 17:38:12 -0800350 main.step('Starting mininet topology')
351 mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
352 utilities.assert_equals( expect=main.TRUE,
353 actual=mnStatus,
354 onpass="Successfully started Mininet",
355 onfail="Failed to activate Mininet" )
356
357 main.step("Assinging masters to switches")
358 switches = main.Mininet1.getSwitches()
359 swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
360 utilities.assert_equals( expect=main.TRUE,
361 actual=swStatus,
362 onpass="Successfully assigned switches to masters",
363 onfail="Failed assign switches to masters" )
364
365 time.sleep(main.startUpSleep)
YPZhangebf9eb52016-05-12 15:20:24 -0700366 # Balancing Masters
367 main.step( "Balancing Masters" )
368 stepResult = main.FALSE
369 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
370 main.FALSE,
371 [],
372 sleep=3,
373 attempts=3 )
374
375 utilities.assert_equals( expect=main.TRUE,
376 actual=stepResult,
377 onpass="Balance masters was successfull",
378 onfail="Failed to balance masters" )
YPZhangcb86c5b2016-01-27 17:38:12 -0800379
380 main.log.info("Getting default flows")
381 jsonSum = json.loads(main.CLIs[0].summary())
382 main.defaultFlows = jsonSum["flows"]
383
384 main.step("Check status of Mininet setup")
YPZhangebf9eb52016-05-12 15:20:24 -0700385 caseResult = mnStatus and swStatus
YPZhangcb86c5b2016-01-27 17:38:12 -0800386 utilities.assert_equals( expect=main.TRUE,
387 actual=caseResult,
388 onpass="Successfully setup Mininet",
389 onfail="Failed setup Mininet" )
390
391 # This tells the following cases if we are using the null-provider or ovs
392 main.switchType = "of:"
393
394 time.sleep(main.startUpSleep)
395 main.step( "Balancing Masters" )
396
397 stepResult = main.FALSE
398 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
399 main.FALSE,
400 [],
401 sleep=3,
402 attempts=3 )
403
404 utilities.assert_equals( expect=main.TRUE,
405 actual=stepResult,
406 onpass="Balance masters was successfull",
407 onfail="Failed to balance masters")
408
409 time.sleep(5)
410 if not caseResult:
411 main.setupSkipped = True
412
413
414
415 def CASE20( self, main ):
416 if main.reroute:
417 main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
418 main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
419 main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
420 main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
421 else:
422 main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
423 main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
424 main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
425 main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
426
427 # check if the case needs to be skipped
428 if main.setupSkipped:
429 main.setupSkipped = False
430 main.skipCase()
431
432 # the index where the next intents will be installed
433 offfset = 0
434 # keeps track of how many intents have been installed
435 currIntents = 0
YPZhang3097ba92016-02-16 17:32:32 -0800436 # keeps track of how many flows have been installed, set to 0 at start
437 currFlows = 0
YPZhangcb86c5b2016-01-27 17:38:12 -0800438 # limit for the number of intents that can be installed
YPZhangebf9eb52016-05-12 15:20:24 -0700439 main.batchSize = int( int(main.batchSize)/int(main.numCtrls))
YPZhangcb86c5b2016-01-27 17:38:12 -0800440 limit = main.maxIntents / main.batchSize
441 # total intents installed
442 totalIntents = 0
443
444 intentsState = None
445
446 offtmp = 0
447 main.step( "Pushing intents" )
448 stepResult = main.TRUE
YPZhang47779c22016-03-07 13:03:07 -0800449 # temp variable to contain the number of flows
450 flowsNum = 0
YPZhangebf9eb52016-05-12 15:20:24 -0700451 if main.numCtrls > 1:
452 # if more than one onos nodes, we should check more frequently
453 main.checkInterval = main.checkInterval/4
YPZhangcb86c5b2016-01-27 17:38:12 -0800454
YPZhangebf9eb52016-05-12 15:20:24 -0700455 # make sure the checkInterval divisible batchSize
456 main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
YPZhangac53ebf2016-05-13 16:26:19 -0700457 flowTemp=0
YPZhang14a4aa92016-07-15 13:37:15 -0700458 intentVerifyTemp = 0
YPZhangac53ebf2016-05-13 16:26:19 -0700459 totalFlows=0
YPZhangcb86c5b2016-01-27 17:38:12 -0800460 for i in range(limit):
461
462 # Threads pool
463 pool = []
464
465 for j in range( int( main.numCtrls) ):
466 if main.numCtrls > 1:
467 time.sleep( 1 )
468 offtmp = offfset + main.maxIntents * j
469 # Push intents by using threads
470 t = main.Thread( target=main.CLIs[j].pushTestIntents,
471 threadID=main.threadID,
472 name="Push-Test-Intents",
473 args=[ main.switchType + main.ingress,
474 main.switchType + main.egress,
475 main.batchSize ],
476 kwargs={ "offset": offtmp,
477 "options": "-i",
478 "timeout": main.timeout,
YPZhangebf9eb52016-05-12 15:20:24 -0700479 "background":False,
480 "noExit":True} )
YPZhangcb86c5b2016-01-27 17:38:12 -0800481 pool.append(t)
482 t.start()
483 main.threadID = main.threadID + 1
484 for t in pool:
485 t.join()
486 stepResult = stepResult and t.result
487 offfset = offfset + main.batchSize
488
YPZhang3097ba92016-02-16 17:32:32 -0800489 totalIntents = main.batchSize * main.numCtrls + totalIntents
YPZhangcb86c5b2016-01-27 17:38:12 -0800490 if totalIntents >= main.minIntents and totalIntents % main.checkInterval == 0:
491 # if reach to minimum number and check interval, verify Intetns and flows
492 time.sleep( main.verifySleep * main.numCtrls )
493
494 main.log.info("Verify Intents states")
YPZhang3097ba92016-02-16 17:32:32 -0800495 # k is a control variable for verify retry attempts
YPZhangcb86c5b2016-01-27 17:38:12 -0800496 k = 1
YPZhang3097ba92016-02-16 17:32:32 -0800497 while k <= main.verifyAttempts:
YPZhang14a4aa92016-07-15 13:37:15 -0700498 # while loop for check intents by using CLI driver
YPZhangcb86c5b2016-01-27 17:38:12 -0800499 time.sleep(5)
YPZhang14a4aa92016-07-15 13:37:15 -0700500 intentsState = main.CLIs[0].checkIntentSummary(timeout=600, noExit=True)
YPZhangebf9eb52016-05-12 15:20:24 -0700501 if intentsState:
YPZhang14a4aa92016-07-15 13:37:15 -0700502 verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
503 if intentVerifyTemp < verifyTotalIntents:
504 intentVerifyTemp = verifyTotalIntents
YPZhangebf9eb52016-05-12 15:20:24 -0700505 else:
YPZhang14a4aa92016-07-15 13:37:15 -0700506 verifyTotalIntents = intentVerifyTemp
YPZhang6e758fb2016-07-26 09:20:55 -0700507 intentsState = False
YPZhang14a4aa92016-07-15 13:37:15 -0700508 main.log.info("Total Installed Intents: {}".format( verifyTotalIntents ) )
YPZhangcb86c5b2016-01-27 17:38:12 -0800509 break
YPZhangcb86c5b2016-01-27 17:38:12 -0800510 k = k+1
YPZhangac53ebf2016-05-13 16:26:19 -0700511
YPZhang14a4aa92016-07-15 13:37:15 -0700512 k = 1
513 flowVerify = True
514 while k <= main.verifyAttempts:
515 time.sleep(5)
516 totalFlows = main.CLIs[0].getTotalFlowsNum( timeout=600, noExit=True )
517 expectFlows = totalIntents * 7 + main.defaultFlows
518 if totalFlows == expectFlows:
519 main.log.info("Total Flows Added: {}".format(totalFlows))
520 break
521 else:
522 main.log.info("Some Flows are not added, retry...")
523 main.log.info("Total Flows Added: {} Expect Flows: {}".format(totalFlows, expectFlows))
524 flowVerify = False
YPZhangac53ebf2016-05-13 16:26:19 -0700525
YPZhang14a4aa92016-07-15 13:37:15 -0700526 k += 1
527 if flowTemp < totalFlows:
528 flowTemp = totalFlows
529 else:
530 totalFlows = flowTemp
531
532 if not intentsState or not flowVerify:
YPZhanga4acbb82016-03-02 17:28:25 -0800533 # If some intents are not installed, grep the previous flows list, and finished this test case
YPZhang14a4aa92016-07-15 13:37:15 -0700534 main.log.warn( "Intents or flows are not installed" )
535 verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
536 if intentVerifyTemp < verifyTotalIntents:
537 intentVerifyTemp = verifyTotalIntents
538 else:
539 verifyTotalIntents = intentVerifyTemp
540 if flowTemp < totalFlows:
541 flowTemp = totalFlows
542 else:
543 totalFlows = flowTemp
YPZhangac53ebf2016-05-13 16:26:19 -0700544 main.log.info("Total Intents: {}".format( verifyTotalIntents) )
YPZhangcb86c5b2016-01-27 17:38:12 -0800545 break
YPZhange96a3062016-05-12 16:18:35 -0700546
YPZhangcb86c5b2016-01-27 17:38:12 -0800547 del main.scale[0]
548 utilities.assert_equals( expect = main.TRUE,
YPZhangebf9eb52016-05-12 15:20:24 -0700549 actual = intentsState,
YPZhangcb86c5b2016-01-27 17:38:12 -0800550 onpass = "Successfully pushed and verified intents",
551 onfail = "Failed to push and verify intents" )
552
YPZhangcb86c5b2016-01-27 17:38:12 -0800553 main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
554 main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
555
556 main.step('clean up Mininet')
557 main.Mininet1.stopNet()
YPZhangcb86c5b2016-01-27 17:38:12 -0800558 main.log.info("Writing results to DS file")
559 with open(main.dbFileName, "a") as dbFile:
560 # Scale number
561 temp = str(main.numCtrls)
562 temp += ",'" + "baremetal1" + "'"
563 # how many intents we installed before crash
YPZhangac53ebf2016-05-13 16:26:19 -0700564 temp += "," + str(verifyTotalIntents)
YPZhangcb86c5b2016-01-27 17:38:12 -0800565 # how many flows we installed before crash
566 temp += "," + str(totalFlows)
567 # other columns in database, but we didn't use in this test
568 temp += "," + "0,0,0,0,0,0"
569 temp += "\n"
570 dbFile.write( temp )