blob: 4bca4daa8c15ea9fd4fe498b0e14a3affcba3f01 [file] [log] [blame]
GlennRCb3202c52015-08-24 14:43:30 -07001
2# This is a performance scale intent that test onos to see how many intents can
3# be installed and rerouted using the null provider and mininet.
GlennRCed771242016-01-13 17:02:47 -08004'''
5This test will not test on reroute and OVS!!!
6If you need test on reroute or OVS, change the params file
7
8Test information:
9 - BatchSize: 1000
10 - Minimum intents: 10,000
11 - Maximum Intents: 1,000,000
12 - Check Interval: 10,000
13 - Link:
14 - ingress: 0000000000000001/9
15 - egress: 0000000000000002/9
16 - Timeout: 120 Seconds
17'''
GlennRCb3202c52015-08-24 14:43:30 -070018
19class SCPFmaxIntents:
20
21 def __init__( self ):
22 self.default = ''
23
GlennRCed771242016-01-13 17:02:47 -080024 def CASE1( self, main ):
GlennRCb3202c52015-08-24 14:43:30 -070025 import time
26 import os
27 import imp
28
29 """
30 - Construct tests variables
31 - GIT ( optional )
32 - Checkout ONOS master branch
33 - Pull latest ONOS code
34 - Building ONOS ( optional )
35 - Install ONOS package
36 - Build ONOS package
GlennRCec6c7612015-08-31 14:52:10 -070037 - Set up cell
38 - Create cell file
39 - Set cell file
40 - Verify cell file
41 - Kill ONOS process
GlennRCb3202c52015-08-24 14:43:30 -070042 """
43
44 main.case( "Constructing test variables and building ONOS package" )
45 main.step( "Constructing test variables" )
46 stepResult = main.FALSE
47
48 # Test variables
49 main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
50 main.dependencyPath = main.testOnDirectory + \
51 main.params['DEPENDENCY']['path']
52 main.cellName = main.params[ 'ENV' ][ 'cellName' ]
53 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
GlennRCb3202c52015-08-24 14:43:30 -070054 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
55 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
56 main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
57 main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
58 main.timeout = int(main.params['SLEEP']['timeout'])
GlennRCb3202c52015-08-24 14:43:30 -070059 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
60 main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
61 main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
62 main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
GlennRCed771242016-01-13 17:02:47 -080063 main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] )
64 main.ingress = main.params['LINK']['ingress']
65 main.egress = main.params['LINK']['egress']
GlennRC4c745432015-09-17 17:09:13 -070066 main.dbFileName = main.params['DATABASE']['file']
GlennRCb3202c52015-08-24 14:43:30 -070067 main.cellData = {} # for creating cell file
GlennRCed771242016-01-13 17:02:47 -080068 main.reroute = main.params['reroute']
69 if main.reroute == "True":
70 main.reroute = True
71 else:
72 main.reroute = False
GlennRCb3202c52015-08-24 14:43:30 -070073 main.CLIs = []
74 main.ONOSip = []
75 main.maxNumBatch = 0
GlennRCb3202c52015-08-24 14:43:30 -070076 main.ONOSip = main.ONOSbench.getOnosIps()
77 main.log.info(main.ONOSip)
GlennRC4c745432015-09-17 17:09:13 -070078 main.setupSkipped = False
79
80 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
81 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
82 gitBranch = main.params[ 'GIT' ][ 'branch' ]
83 gitPull = main.params[ 'GIT' ][ 'pull' ]
84 nic = main.params['DATABASE']['nic']
85 node = main.params['DATABASE']['node']
86 nic = main.params['DATABASE']['nic']
87 node = main.params['DATABASE']['node']
GlennRCb3202c52015-08-24 14:43:30 -070088
GlennRCec6c7612015-08-31 14:52:10 -070089 # main.scale[ 0 ] determines the current number of ONOS controller
90 main.numCtrls = int( main.scale[ 0 ] )
91
GlennRC4c745432015-09-17 17:09:13 -070092 main.log.info("Creating list of ONOS cli handles")
93 for i in range(main.maxNodes):
94 main.CLIs.append( getattr( main, 'ONOScli' + str( i+1 )))
GlennRCb3202c52015-08-24 14:43:30 -070095
GlennRC4c745432015-09-17 17:09:13 -070096 if not main.CLIs:
97 main.log.error("Failed to create the list of ONOS cli handles")
98 main.cleanup()
99 main.exit()
100
101 main.log.info("Loading wrapper files")
GlennRCb3202c52015-08-24 14:43:30 -0700102 main.startUp = imp.load_source( wrapperFile1,
103 main.dependencyPath +
104 wrapperFile1 +
105 ".py" )
106
107 main.intentFunctions = imp.load_source( wrapperFile2,
108 main.dependencyPath +
109 wrapperFile2 +
110 ".py" )
111
112 copyResult = main.ONOSbench.copyMininetFile( main.topology,
113 main.dependencyPath,
114 main.Mininet1.user_name,
115 main.Mininet1.ip_address )
116
GlennRC4c745432015-09-17 17:09:13 -0700117 commit = main.ONOSbench.getVersion(report=True)
118 commit = commit.split(" ")[1]
GlennRCb3202c52015-08-24 14:43:30 -0700119
120 if gitPull == 'True':
GlennRC4c745432015-09-17 17:09:13 -0700121 if not main.startUp.onosBuild( main, gitBranch ):
122 main.log.error("Failed to build ONOS")
123 main.cleanup()
124 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700125 else:
126 main.log.warn( "Did not pull new code so skipping mvn " +
127 "clean install" )
128
GlennRC4c745432015-09-17 17:09:13 -0700129 main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
GlennRCb3202c52015-08-24 14:43:30 -0700130 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800131 " before initiating environment setup" )
GlennRCb3202c52015-08-24 14:43:30 -0700132
133 for i in range( main.maxNodes ):
134 main.ONOSbench.onosDie( main.ONOSip[ i ] )
135
GlennRC4c745432015-09-17 17:09:13 -0700136 main.log.info( "NODE COUNT = %s" % main.numCtrls)
GlennRCb3202c52015-08-24 14:43:30 -0700137
138 tempOnosIp = []
139 for i in range( main.numCtrls ):
140 tempOnosIp.append( main.ONOSip[i] )
141
142 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
143 "temp",
144 main.Mininet1.ip_address,
145 main.apps,
146 tempOnosIp )
147
GlennRCed771242016-01-13 17:02:47 -0800148 main.step( "Apply cell to environment" )
149 cellResult = main.ONOSbench.setCell( "temp" )
150 verifyResult = main.ONOSbench.verifyCell()
151 stepResult = cellResult and verifyResult
152 utilities.assert_equals( expect=main.TRUE,
153 actual=stepResult,
154 onpass="Successfully applied cell to " + \
155 "environment",
156 onfail="Failed to apply cell to environment " )
GlennRCb3202c52015-08-24 14:43:30 -0700157
GlennRCed771242016-01-13 17:02:47 -0800158 main.step( "Creating ONOS package" )
159 packageResult = main.ONOSbench.onosPackage()
160 stepResult = packageResult
161 utilities.assert_equals( expect=main.TRUE,
162 actual=stepResult,
163 onpass="Successfully created ONOS package",
164 onfail="Failed to create ONOS package" )
GlennRCec6c7612015-08-31 14:52:10 -0700165
GlennRC58ea2542015-09-02 14:23:34 -0700166 main.log.info("Creating DB file")
GlennRC4c745432015-09-17 17:09:13 -0700167 with open(main.dbFileName, "w+") as dbFile:
GlennRCec6c7612015-08-31 14:52:10 -0700168 temp = "'" + commit + "',"
GlennRC58ea2542015-09-02 14:23:34 -0700169 temp += "'" + nic + "',"
170 temp += str(main.numCtrls) + ","
GlennRC5719ff02015-09-08 17:25:30 -0700171 temp += "'" + node + "1" + "'"
YPZhangb5d3f832016-01-23 22:54:26 -0800172 temp += ",0"
173 temp += ",0"
174 temp += ",0"
175 temp += ",0"
GlennRC4c745432015-09-17 17:09:13 -0700176 dbFile.write(temp)
GlennRCec6c7612015-08-31 14:52:10 -0700177
GlennRCed771242016-01-13 17:02:47 -0800178 def CASE2( self, main ):
GlennRCec6c7612015-08-31 14:52:10 -0700179 """
180 - Uninstall ONOS cluster
181 - Verify ONOS start up
182 - Install ONOS cluster
183 - Connect to cli
184 """
GlennRC4c745432015-09-17 17:09:13 -0700185
GlennRCed771242016-01-13 17:02:47 -0800186 main.step( "Installing ONOS with -f" )
187 onosInstallResult = main.TRUE
GlennRCb3202c52015-08-24 14:43:30 -0700188 for i in range( main.numCtrls ):
GlennRCed771242016-01-13 17:02:47 -0800189 onosInstallResult = onosInstallResult and \
190 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
191 stepResult = onosInstallResult
192 utilities.assert_equals( expect=main.TRUE,
193 actual=stepResult,
194 onpass="Successfully installed ONOS package",
195 onfail="Failed to install ONOS package" )
GlennRCb3202c52015-08-24 14:43:30 -0700196
GlennRCed771242016-01-13 17:02:47 -0800197 time.sleep( main.startUpSleep )
GlennRCb3202c52015-08-24 14:43:30 -0700198
GlennRCed771242016-01-13 17:02:47 -0800199 main.step( "Start ONOS cli" )
200 cliResult = main.TRUE
GlennRCb3202c52015-08-24 14:43:30 -0700201 for i in range( main.numCtrls ):
GlennRCed771242016-01-13 17:02:47 -0800202 cliResult = cliResult and \
203 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
204 stepResult = cliResult
205 utilities.assert_equals( expect=main.TRUE,
206 actual=stepResult,
207 onpass="Successfully start ONOS cli",
208 onfail="Failed to start ONOS cli" )
209
210 time.sleep( main.startUpSleep )
GlennRCb3202c52015-08-24 14:43:30 -0700211
212 def CASE10( self, main ):
213 """
214 Setting up null-provider
215 """
216 import json
GlennRCb3202c52015-08-24 14:43:30 -0700217 # Activate apps
GlennRCed771242016-01-13 17:02:47 -0800218 main.step("Activating null-provider")
YPZhangf6f14a02016-01-28 15:17:31 -0800219 appStatus = utilities.retry( main.CLIs[0].activateApp,
220 main.FALSE,
221 ['org.onosproject.null'],
222 sleep=main.verifySleep,
223 attempts=main.verifyAttempts )
GlennRCed771242016-01-13 17:02:47 -0800224 utilities.assert_equals( expect=main.TRUE,
225 actual=appStatus,
226 onpass="Successfully activated null-provider",
227 onfail="Failed activate null-provider" )
GlennRCb3202c52015-08-24 14:43:30 -0700228
229 # Setup the null-provider
GlennRCed771242016-01-13 17:02:47 -0800230 main.step("Configuring null-provider")
YPZhangf6f14a02016-01-28 15:17:31 -0800231 cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
232 main.FALSE,
233 [ main.ONOSip[0],
234 'org.onosproject.provider.nil.NullProviders', 'deviceCount 3'],
235 sleep=main.verifySleep,
236 attempts = main.verifyAttempts )
237 cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
238 main.FALSE,
239 [ main.ONOSip[0],
240 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'],
241 sleep=main.verifySleep,
242 attempts = main.verifyAttempts )
243
244 cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
245 main.FALSE,
246 [ main.ONOSip[0],
247 'org.onosproject.provider.nil.NullProviders', 'enabled true'],
248 sleep=main.verifySleep,
249 attempts = main.verifyAttempts )
250
GlennRCb3202c52015-08-24 14:43:30 -0700251
GlennRCed771242016-01-13 17:02:47 -0800252 utilities.assert_equals( expect=main.TRUE,
253 actual=cfgStatus,
254 onpass="Successfully configured null-provider",
255 onfail="Failed to configure null-provider" )
GlennRCb3202c52015-08-24 14:43:30 -0700256
GlennRC4c745432015-09-17 17:09:13 -0700257 # give onos some time to settle
258 time.sleep(main.startUpSleep)
GlennRCb3202c52015-08-24 14:43:30 -0700259
GlennRCed771242016-01-13 17:02:47 -0800260 main.log.info("Setting default flows to zero")
GlennRC4c745432015-09-17 17:09:13 -0700261 main.defaultFlows = 0
GlennRCb3202c52015-08-24 14:43:30 -0700262
GlennRCed771242016-01-13 17:02:47 -0800263 main.step("Check status of null-provider setup")
264 caseResult = appStatus and cfgStatus
265 utilities.assert_equals( expect=main.TRUE,
266 actual=caseResult,
267 onpass="Setting up null-provider was successfull",
268 onfail="Failed to setup null-provider" )
269
270 # This tells the following cases if we are using the null-provider or ovs
271 main.switchType = "null:"
272
273 # If the null-provider setup was unsuccessfull, then there is no point to
274 # run the subsequent cases
275 if not caseResult:
GlennRC4c745432015-09-17 17:09:13 -0700276 main.setupSkipped = True
277
GlennRCb3202c52015-08-24 14:43:30 -0700278 def CASE11( self, main ):
279 '''
280 Setting up mininet
281 '''
282 import json
283 import time
284
GlennRCed771242016-01-13 17:02:47 -0800285 time.sleep(main.startUpSleep)
286
287 main.step("Activating openflow")
GlennRC4c745432015-09-17 17:09:13 -0700288 appStatus = main.CLIs[0].activateApp('org.onosproject.openflow')
GlennRCed771242016-01-13 17:02:47 -0800289 utilities.assert_equals( expect=main.TRUE,
290 actual=appStatus,
291 onpass="Successfully activated openflow",
292 onfail="Failed activate openflow" )
GlennRCb3202c52015-08-24 14:43:30 -0700293
GlennRCb3202c52015-08-24 14:43:30 -0700294 time.sleep(main.startUpSleep)
295
GlennRCed771242016-01-13 17:02:47 -0800296 main.step('Starting mininet topology')
GlennRC4c745432015-09-17 17:09:13 -0700297 mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
GlennRCed771242016-01-13 17:02:47 -0800298 utilities.assert_equals( expect=main.TRUE,
299 actual=mnStatus,
300 onpass="Successfully started Mininet",
301 onfail="Failed to activate Mininet" )
GlennRC4c745432015-09-17 17:09:13 -0700302
GlennRCed771242016-01-13 17:02:47 -0800303 main.step("Assinging masters to switches")
304 switches = main.Mininet1.getSwitches()
305 swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip )
306 utilities.assert_equals( expect=main.TRUE,
307 actual=swStatus,
308 onpass="Successfully assigned switches to masters",
309 onfail="Failed assign switches to masters" )
GlennRC4c745432015-09-17 17:09:13 -0700310
GlennRCb3202c52015-08-24 14:43:30 -0700311 time.sleep(main.startUpSleep)
312
GlennRCed771242016-01-13 17:02:47 -0800313 main.log.info("Getting default flows")
GlennRCb3202c52015-08-24 14:43:30 -0700314 jsonSum = json.loads(main.CLIs[0].summary())
GlennRCb3202c52015-08-24 14:43:30 -0700315 main.defaultFlows = jsonSum["flows"]
GlennRCb3202c52015-08-24 14:43:30 -0700316
GlennRCed771242016-01-13 17:02:47 -0800317 main.step("Check status of Mininet setup")
318 caseResult = appStatus and mnStatus and swStatus
319 utilities.assert_equals( expect=main.TRUE,
320 actual=caseResult,
321 onpass="Successfully setup Mininet",
322 onfail="Failed setup Mininet" )
323
324 # This tells the following cases if we are using the null-provider or ovs
325 main.switchType = "of:"
326
327 if not caseResult:
GlennRC4c745432015-09-17 17:09:13 -0700328 main.setupSkipped = True
GlennRCb3202c52015-08-24 14:43:30 -0700329
330 def CASE20( self, main ):
GlennRCb3202c52015-08-24 14:43:30 -0700331 '''
332 Pushing intents
333 '''
GlennRC4c745432015-09-17 17:09:13 -0700334
GlennRCed771242016-01-13 17:02:47 -0800335 if main.reroute:
336 if main.switchType == "of:":
337 main.minIntents = int(main.params['OVS']['REROUTE']['min_intents'])
338 main.maxIntents = int(main.params['OVS']['REROUTE']['max_intents'])
339 main.checkInterval = int(main.params['OVS']['REROUTE']['check_interval'])
340 main.batchSize = int(main.params['OVS']['REROUTE']['batch_size'])
341 else:
342 main.minIntents = int(main.params['NULL']['REROUTE']['min_intents'])
343 main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents'])
344 main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval'])
345 main.batchSize = int(main.params['NULL']['REROUTE']['batch_size'])
346 else:
347 if main.switchType == "of:":
348 main.minIntents = int(main.params['OVS']['PUSH']['min_intents'])
349 main.maxIntents = int(main.params['OVS']['PUSH']['max_intents'])
350 main.checkInterval = int(main.params['OVS']['PUSH']['check_interval'])
351 main.batchSize = int(main.params['OVS']['PUSH']['batch_size'])
352 else:
353 main.minIntents = int(main.params['NULL']['PUSH']['min_intents'])
354 main.maxIntents = int(main.params['NULL']['PUSH']['max_intents'])
355 main.checkInterval = int(main.params['NULL']['PUSH']['check_interval'])
356 main.batchSize = int(main.params['NULL']['PUSH']['batch_size'])
357
358 # check if the case needs to be skipped
GlennRC4c745432015-09-17 17:09:13 -0700359 if main.setupSkipped:
360 main.setupSkipped = False
361 main.skipCase()
362
GlennRCb3202c52015-08-24 14:43:30 -0700363 # the index where the next intents will be installed
364 offset = 0
GlennRC33a42072015-09-11 11:32:44 -0700365 # keeps track of how many intents have been installed
GlennRCed771242016-01-13 17:02:47 -0800366 currIntents = 0
GlennRC33a42072015-09-11 11:32:44 -0700367 # keeps track of how many flows have been installed
GlennRCed771242016-01-13 17:02:47 -0800368 currFlows = main.defaultFlows
GlennRC9882f352015-08-27 18:03:28 -0700369 # limit for the number of intents that can be installed
370 limit = main.maxIntents / main.batchSize
GlennRCd0e5ed22015-09-03 11:54:27 -0700371
GlennRCed771242016-01-13 17:02:47 -0800372 main.step( "Pushing intents" )
GlennRCd0e5ed22015-09-03 11:54:27 -0700373 for i in range(limit):
GlennRCed771242016-01-13 17:02:47 -0800374 pushResult = main.ONOScli1.pushTestIntents( main.switchType + main.ingress,
375 main.switchType + main.egress,
376 main.batchSize,
377 offset = offset,
378 options = "-i",
379 timeout = main.timeout )
380 if pushResult == None:
381 main.log.info( "Timeout!" )
382 main.skipCase()
383 time.sleep(1)
GlennRCd0e5ed22015-09-03 11:54:27 -0700384
GlennRCed771242016-01-13 17:02:47 -0800385 # Update offset
GlennRCd0e5ed22015-09-03 11:54:27 -0700386 offset += main.batchSize
GlennRCd0e5ed22015-09-03 11:54:27 -0700387
GlennRCed771242016-01-13 17:02:47 -0800388 if offset >= main.minIntents and offset % main.checkInterval == 0:
389 intentVerify = utilities.retry( main.ONOScli1.checkIntentSummary,
390 main.FALSE,
391 [main.timeout],
392 sleep=main.verifySleep,
393 attempts=main.verifyAttempts )
GlennRC33a42072015-09-11 11:32:44 -0700394
GlennRCed771242016-01-13 17:02:47 -0800395 flowVerify = utilities.retry( main.ONOScli1.checkFlowsState,
396 main.FALSE,
397 [False,main.timeout],
398 sleep=main.verifySleep,
399 attempts=main.verifyAttempts )
GlennRCb3202c52015-08-24 14:43:30 -0700400
GlennRCed771242016-01-13 17:02:47 -0800401 if not intentVerify:
402 main.log.error( "Failed to install intents" )
GlennRCd0e5ed22015-09-03 11:54:27 -0700403 break
GlennRCb3202c52015-08-24 14:43:30 -0700404
GlennRCed771242016-01-13 17:02:47 -0800405 if main.reroute:
406 main.step( "Reroute" )
407 # tear down a link
408 main.log.info("Tearing down link")
409 if main.switchType == "of:":
410 downlink = main.Mininet1.link( END1 = "s1", END2 = "s3", OPTION = "down" )
411 else:
412 downlink = main.ONOScli1.link( main.ingress, main.egress, "down")
413
414 if downlink:
415 main.log.info( "Successfully tear down link" )
416 else:
417 main.log.warn( "Failed to tear down link" )
418
419 time.sleep(main.rerouteSleep)
420
421 # Verifying intents
422 main.step( "Checking intents and flows" )
423 intentVerify = utilities.retry( main.ONOScli1.checkIntentSummary,
424 main.FALSE,
425 [main.timeout],
426 sleep=main.verifySleep,
427 attempts=main.verifyAttempts )
428 # Verfying flows
429 flowVerify = utilities.retry( main.ONOScli1.checkFlowsState,
430 main.FALSE,
431 [False, main.timeout],
432 sleep = main.verifySleep,
433 attempts = main.verifyAttempts )
434
435 if not intentVerify:
436 main.log.error( "Failed to install intents" )
437 # Bring link back up
438 main.log.info("Bringing link back up")
439 if main.switchType == "of:":
440 uplink = main.Mininet1.link( END1 = "s1", END2 = "s3", OPTION = "up" )
441 else:
442 uplink = main.ONOScli1.link( main.ingress, main.egress, "up" )
443
444 if uplink:
445 main.log.info( "Successfully bring link back up" )
446 else:
447 main.log.warn( "Failed to bring link back up" )
448
449 time.sleep(main.rerouteSleep)
450
451 # Verifying intents
452 main.step( "Checking intents and flows" )
453 intentVerify = utilities.retry( main.ONOScli1.checkIntentSummary,
454 main.FALSE,
455 [main.timeout],
456 sleep=main.verifySleep,
457 attempts=main.verifyAttempts )
458 # Verfying flows
459 flowVerify = utilities.retry( main.ONOScli1.checkFlowsState,
460 main.FALSE,
461 [False, main.timeout],
462 sleep = main.verifySleep,
463 attempts = main.verifyAttempts )
464
465 if not intentVerify:
466 main.log.error( "Failed to install intents" )
467
468 rerouteResult = downlink and uplink
469 utilities.assert_equals( expect = main.TRUE,
470 actual = rerouteResult,
471 onpass = "Successfully reroute",
472 onfail = "Failed to reroute" )
473
474 utilities.assert_equals( expect = main.TRUE,
475 actual = intentVerify,
476 onpass = "Successfully pushed and verified intents",
477 onfail = "Failed to push and verify intents" )
YPZhangb5d3f832016-01-23 22:54:26 -0800478 currIntents = main.ONOScli1.getTotalIntentsNum()
YPZhange3109a72016-02-02 11:25:37 -0800479 currFlows = 0
480 # Get current flows from REST API
481 temp = json.loads( main.ONOSrest1.flows() )
482 for t in temp:
483 if t.get("state") == "ADDED":
484 currFlows = currFlows + 1
YPZhangf6f14a02016-01-28 15:17:31 -0800485 main.log.info( "Total Intents Installed: {}".format( currIntents ) )
486 main.log.info( "Total Flows ADDED: {}".format( currFlows ) )
GlennRCec6c7612015-08-31 14:52:10 -0700487
GlennRC58ea2542015-09-02 14:23:34 -0700488 main.log.info("Writing results to DB file")
GlennRC4c745432015-09-17 17:09:13 -0700489 with open(main.dbFileName, "a") as dbFile:
GlennRCed771242016-01-13 17:02:47 -0800490 temp = "," + str(currIntents)
491 temp += "," + str(currFlows)
YPZhangb5d3f832016-01-23 22:54:26 -0800492 temp += ",0"
493 temp += ",0\n"
GlennRC4c745432015-09-17 17:09:13 -0700494 dbFile.write(temp)
GlennRC14d54f72015-09-03 10:51:37 -0700495
GlennRCed771242016-01-13 17:02:47 -0800496 if main.switchType == "of:":
497 main.step( "Stopping mininet" )
498 stepResult = main.Mininet1.stopNet()
499 utilities.assert_equals( expect = main.TRUE,
500 actual = stepResult,
501 oppass = "Successfully stop Mininet",
502 opfail = "Failed stop Mininet" )
503
GlennRCb3202c52015-08-24 14:43:30 -0700504
505 def CASE100( self, main ):
506 '''
507 Report errors/warnings/exceptions
508 '''
509 main.log.info("Error report: \n")
510 main.ONOSbench.logReport( main.ONOSip[ 0 ],
511 [ "INFO",
512 "FOLLOWER",
513 "WARN",
514 "flow",
515 "ERROR",
516 "Except" ],
517 "s" )