blob: f82d684ddec7b4bc916238804d76e78a6a1bebae [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,
156 tempOnosIp )
157
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")
YPZhangcb86c5b2016-01-27 17:38:12 -0800347 main.step('Starting mininet topology')
348 mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
349 utilities.assert_equals( expect=main.TRUE,
350 actual=mnStatus,
351 onpass="Successfully started Mininet",
352 onfail="Failed to activate Mininet" )
353
354 main.step("Assinging masters to switches")
355 switches = main.Mininet1.getSwitches()
356 swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
357 utilities.assert_equals( expect=main.TRUE,
358 actual=swStatus,
359 onpass="Successfully assigned switches to masters",
360 onfail="Failed assign switches to masters" )
361
362 time.sleep(main.startUpSleep)
YPZhangebf9eb52016-05-12 15:20:24 -0700363 # Balancing Masters
364 main.step( "Balancing Masters" )
365 stepResult = main.FALSE
366 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
367 main.FALSE,
368 [],
369 sleep=3,
370 attempts=3 )
371
372 utilities.assert_equals( expect=main.TRUE,
373 actual=stepResult,
374 onpass="Balance masters was successfull",
375 onfail="Failed to balance masters" )
YPZhangcb86c5b2016-01-27 17:38:12 -0800376
377 main.log.info("Getting default flows")
378 jsonSum = json.loads(main.CLIs[0].summary())
379 main.defaultFlows = jsonSum["flows"]
380
381 main.step("Check status of Mininet setup")
YPZhangebf9eb52016-05-12 15:20:24 -0700382 caseResult = mnStatus and swStatus
YPZhangcb86c5b2016-01-27 17:38:12 -0800383 utilities.assert_equals( expect=main.TRUE,
384 actual=caseResult,
385 onpass="Successfully setup Mininet",
386 onfail="Failed setup Mininet" )
387
388 # This tells the following cases if we are using the null-provider or ovs
389 main.switchType = "of:"
390
391 time.sleep(main.startUpSleep)
392 main.step( "Balancing Masters" )
393
394 stepResult = main.FALSE
395 stepResult = utilities.retry( main.CLIs[0].balanceMasters,
396 main.FALSE,
397 [],
398 sleep=3,
399 attempts=3 )
400
401 utilities.assert_equals( expect=main.TRUE,
402 actual=stepResult,
403 onpass="Balance masters was successfull",
404 onfail="Failed to balance masters")
405
406 time.sleep(5)
407 if not caseResult:
408 main.setupSkipped = True
409
410
411
412 def CASE20( self, main ):
413 if main.reroute:
414 main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
415 main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
416 main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
417 main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
418 else:
419 main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
420 main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
421 main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
422 main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
423
424 # check if the case needs to be skipped
425 if main.setupSkipped:
426 main.setupSkipped = False
427 main.skipCase()
428
429 # the index where the next intents will be installed
430 offfset = 0
431 # keeps track of how many intents have been installed
432 currIntents = 0
YPZhang3097ba92016-02-16 17:32:32 -0800433 # keeps track of how many flows have been installed, set to 0 at start
434 currFlows = 0
YPZhangcb86c5b2016-01-27 17:38:12 -0800435 # limit for the number of intents that can be installed
YPZhangebf9eb52016-05-12 15:20:24 -0700436 main.batchSize = int( int(main.batchSize)/int(main.numCtrls))
YPZhangcb86c5b2016-01-27 17:38:12 -0800437 limit = main.maxIntents / main.batchSize
438 # total intents installed
439 totalIntents = 0
440
441 intentsState = None
442
443 offtmp = 0
444 main.step( "Pushing intents" )
445 stepResult = main.TRUE
YPZhang47779c22016-03-07 13:03:07 -0800446 # temp variable to contain the number of flows
447 flowsNum = 0
YPZhangebf9eb52016-05-12 15:20:24 -0700448 if main.numCtrls > 1:
449 # if more than one onos nodes, we should check more frequently
450 main.checkInterval = main.checkInterval/4
YPZhangcb86c5b2016-01-27 17:38:12 -0800451
YPZhangebf9eb52016-05-12 15:20:24 -0700452 # make sure the checkInterval divisible batchSize
453 main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
YPZhangac53ebf2016-05-13 16:26:19 -0700454 flowTemp=0
YPZhang14a4aa92016-07-15 13:37:15 -0700455 intentVerifyTemp = 0
YPZhangac53ebf2016-05-13 16:26:19 -0700456 totalFlows=0
YPZhangcb86c5b2016-01-27 17:38:12 -0800457 for i in range(limit):
458
459 # Threads pool
460 pool = []
461
462 for j in range( int( main.numCtrls) ):
463 if main.numCtrls > 1:
464 time.sleep( 1 )
465 offtmp = offfset + main.maxIntents * j
466 # Push intents by using threads
467 t = main.Thread( target=main.CLIs[j].pushTestIntents,
468 threadID=main.threadID,
469 name="Push-Test-Intents",
470 args=[ main.switchType + main.ingress,
471 main.switchType + main.egress,
472 main.batchSize ],
473 kwargs={ "offset": offtmp,
474 "options": "-i",
475 "timeout": main.timeout,
YPZhangebf9eb52016-05-12 15:20:24 -0700476 "background":False,
477 "noExit":True} )
YPZhangcb86c5b2016-01-27 17:38:12 -0800478 pool.append(t)
479 t.start()
480 main.threadID = main.threadID + 1
481 for t in pool:
482 t.join()
483 stepResult = stepResult and t.result
484 offfset = offfset + main.batchSize
485
YPZhang3097ba92016-02-16 17:32:32 -0800486 totalIntents = main.batchSize * main.numCtrls + totalIntents
YPZhangcb86c5b2016-01-27 17:38:12 -0800487 if totalIntents >= main.minIntents and totalIntents % main.checkInterval == 0:
488 # if reach to minimum number and check interval, verify Intetns and flows
489 time.sleep( main.verifySleep * main.numCtrls )
490
491 main.log.info("Verify Intents states")
YPZhang3097ba92016-02-16 17:32:32 -0800492 # k is a control variable for verify retry attempts
YPZhangcb86c5b2016-01-27 17:38:12 -0800493 k = 1
YPZhang3097ba92016-02-16 17:32:32 -0800494 while k <= main.verifyAttempts:
YPZhang14a4aa92016-07-15 13:37:15 -0700495 # while loop for check intents by using CLI driver
YPZhangcb86c5b2016-01-27 17:38:12 -0800496 time.sleep(5)
YPZhang14a4aa92016-07-15 13:37:15 -0700497 intentsState = main.CLIs[0].checkIntentSummary(timeout=600, noExit=True)
YPZhangebf9eb52016-05-12 15:20:24 -0700498 if intentsState:
YPZhang14a4aa92016-07-15 13:37:15 -0700499 verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
500 if intentVerifyTemp < verifyTotalIntents:
501 intentVerifyTemp = verifyTotalIntents
YPZhangebf9eb52016-05-12 15:20:24 -0700502 else:
YPZhang14a4aa92016-07-15 13:37:15 -0700503 verifyTotalIntents = intentVerifyTemp
YPZhang6e758fb2016-07-26 09:20:55 -0700504 intentsState = False
YPZhang14a4aa92016-07-15 13:37:15 -0700505 main.log.info("Total Installed Intents: {}".format( verifyTotalIntents ) )
YPZhangcb86c5b2016-01-27 17:38:12 -0800506 break
YPZhangcb86c5b2016-01-27 17:38:12 -0800507 k = k+1
YPZhangac53ebf2016-05-13 16:26:19 -0700508
YPZhang14a4aa92016-07-15 13:37:15 -0700509 k = 1
510 flowVerify = True
511 while k <= main.verifyAttempts:
512 time.sleep(5)
513 totalFlows = main.CLIs[0].getTotalFlowsNum( timeout=600, noExit=True )
514 expectFlows = totalIntents * 7 + main.defaultFlows
515 if totalFlows == expectFlows:
516 main.log.info("Total Flows Added: {}".format(totalFlows))
517 break
518 else:
519 main.log.info("Some Flows are not added, retry...")
520 main.log.info("Total Flows Added: {} Expect Flows: {}".format(totalFlows, expectFlows))
521 flowVerify = False
YPZhangac53ebf2016-05-13 16:26:19 -0700522
YPZhang14a4aa92016-07-15 13:37:15 -0700523 k += 1
524 if flowTemp < totalFlows:
525 flowTemp = totalFlows
526 else:
527 totalFlows = flowTemp
528
529 if not intentsState or not flowVerify:
YPZhanga4acbb82016-03-02 17:28:25 -0800530 # If some intents are not installed, grep the previous flows list, and finished this test case
YPZhang14a4aa92016-07-15 13:37:15 -0700531 main.log.warn( "Intents or flows are not installed" )
532 verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
533 if intentVerifyTemp < verifyTotalIntents:
534 intentVerifyTemp = verifyTotalIntents
535 else:
536 verifyTotalIntents = intentVerifyTemp
537 if flowTemp < totalFlows:
538 flowTemp = totalFlows
539 else:
540 totalFlows = flowTemp
YPZhangac53ebf2016-05-13 16:26:19 -0700541 main.log.info("Total Intents: {}".format( verifyTotalIntents) )
YPZhangcb86c5b2016-01-27 17:38:12 -0800542 break
YPZhange96a3062016-05-12 16:18:35 -0700543
YPZhangcb86c5b2016-01-27 17:38:12 -0800544 del main.scale[0]
545 utilities.assert_equals( expect = main.TRUE,
YPZhangebf9eb52016-05-12 15:20:24 -0700546 actual = intentsState,
YPZhangcb86c5b2016-01-27 17:38:12 -0800547 onpass = "Successfully pushed and verified intents",
548 onfail = "Failed to push and verify intents" )
549
YPZhangcb86c5b2016-01-27 17:38:12 -0800550 main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
551 main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
552
553 main.step('clean up Mininet')
554 main.Mininet1.stopNet()
YPZhangcb86c5b2016-01-27 17:38:12 -0800555 main.log.info("Writing results to DS file")
556 with open(main.dbFileName, "a") as dbFile:
557 # Scale number
558 temp = str(main.numCtrls)
559 temp += ",'" + "baremetal1" + "'"
560 # how many intents we installed before crash
YPZhangac53ebf2016-05-13 16:26:19 -0700561 temp += "," + str(verifyTotalIntents)
YPZhangcb86c5b2016-01-27 17:38:12 -0800562 # how many flows we installed before crash
563 temp += "," + str(totalFlows)
564 # other columns in database, but we didn't use in this test
565 temp += "," + "0,0,0,0,0,0"
566 temp += "\n"
567 dbFile.write( temp )