blob: a7908641ca1d927fcd5c6a3dd92d549c6d8b95cd [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.
4
5class SCPFmaxIntents:
6
7 def __init__( self ):
8 self.default = ''
9
10 def CASE0( self, main ):
11 import time
12 import os
13 import imp
14
15 """
16 - Construct tests variables
17 - GIT ( optional )
18 - Checkout ONOS master branch
19 - Pull latest ONOS code
20 - Building ONOS ( optional )
21 - Install ONOS package
22 - Build ONOS package
GlennRCec6c7612015-08-31 14:52:10 -070023 - Set up cell
24 - Create cell file
25 - Set cell file
26 - Verify cell file
27 - Kill ONOS process
GlennRCb3202c52015-08-24 14:43:30 -070028 """
29
30 main.case( "Constructing test variables and building ONOS package" )
31 main.step( "Constructing test variables" )
32 stepResult = main.FALSE
33
34 # Test variables
35 main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
36 main.dependencyPath = main.testOnDirectory + \
37 main.params['DEPENDENCY']['path']
38 main.cellName = main.params[ 'ENV' ][ 'cellName' ]
39 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
GlennRCb3202c52015-08-24 14:43:30 -070040 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
41 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
42 main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
43 main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
44 main.timeout = int(main.params['SLEEP']['timeout'])
45 main.minIntents = int(main.params['TEST']['min_intents'])
GlennRC9882f352015-08-27 18:03:28 -070046 main.maxIntents = int(main.params['TEST']['max_intents'])
GlennRCb3202c52015-08-24 14:43:30 -070047 main.checkInterval = int(main.params['TEST']['check_interval'])
GlennRCb3202c52015-08-24 14:43:30 -070048 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
49 main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
50 main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
51 main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
GlennRCb3202c52015-08-24 14:43:30 -070052 main.batchSize = int(main.params['TEST']['batch_size'])
GlennRC4c745432015-09-17 17:09:13 -070053 main.dbFileName = main.params['DATABASE']['file']
GlennRCb3202c52015-08-24 14:43:30 -070054 main.cellData = {} # for creating cell file
55 main.CLIs = []
56 main.ONOSip = []
57 main.maxNumBatch = 0
GlennRCb3202c52015-08-24 14:43:30 -070058 main.ONOSip = main.ONOSbench.getOnosIps()
59 main.log.info(main.ONOSip)
GlennRC4c745432015-09-17 17:09:13 -070060 main.setupSkipped = False
61
62 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
63 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
64 gitBranch = main.params[ 'GIT' ][ 'branch' ]
65 gitPull = main.params[ 'GIT' ][ 'pull' ]
66 nic = main.params['DATABASE']['nic']
67 node = main.params['DATABASE']['node']
68 nic = main.params['DATABASE']['nic']
69 node = main.params['DATABASE']['node']
GlennRCb3202c52015-08-24 14:43:30 -070070
GlennRCec6c7612015-08-31 14:52:10 -070071 # main.scale[ 0 ] determines the current number of ONOS controller
72 main.numCtrls = int( main.scale[ 0 ] )
73
GlennRC4c745432015-09-17 17:09:13 -070074 main.log.info("Creating list of ONOS cli handles")
75 for i in range(main.maxNodes):
76 main.CLIs.append( getattr( main, 'ONOScli' + str( i+1 )))
GlennRCb3202c52015-08-24 14:43:30 -070077
GlennRC4c745432015-09-17 17:09:13 -070078 if not main.CLIs:
79 main.log.error("Failed to create the list of ONOS cli handles")
80 main.cleanup()
81 main.exit()
82
83 main.log.info("Loading wrapper files")
GlennRCb3202c52015-08-24 14:43:30 -070084 main.startUp = imp.load_source( wrapperFile1,
85 main.dependencyPath +
86 wrapperFile1 +
87 ".py" )
88
89 main.intentFunctions = imp.load_source( wrapperFile2,
90 main.dependencyPath +
91 wrapperFile2 +
92 ".py" )
93
94 copyResult = main.ONOSbench.copyMininetFile( main.topology,
95 main.dependencyPath,
96 main.Mininet1.user_name,
97 main.Mininet1.ip_address )
98
GlennRC4c745432015-09-17 17:09:13 -070099 commit = main.ONOSbench.getVersion(report=True)
100 commit = commit.split(" ")[1]
GlennRCb3202c52015-08-24 14:43:30 -0700101
102 if gitPull == 'True':
GlennRC4c745432015-09-17 17:09:13 -0700103 if not main.startUp.onosBuild( main, gitBranch ):
104 main.log.error("Failed to build ONOS")
105 main.cleanup()
106 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700107 else:
108 main.log.warn( "Did not pull new code so skipping mvn " +
109 "clean install" )
110
GlennRC4c745432015-09-17 17:09:13 -0700111 main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
GlennRCb3202c52015-08-24 14:43:30 -0700112 main.log.info( "Safety check, killing all ONOS processes" +
113 " before initiating enviornment setup" )
114
115 for i in range( main.maxNodes ):
116 main.ONOSbench.onosDie( main.ONOSip[ i ] )
117
GlennRC4c745432015-09-17 17:09:13 -0700118 main.log.info( "NODE COUNT = %s" % main.numCtrls)
GlennRCb3202c52015-08-24 14:43:30 -0700119
120 tempOnosIp = []
121 for i in range( main.numCtrls ):
122 tempOnosIp.append( main.ONOSip[i] )
123
124 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
125 "temp",
126 main.Mininet1.ip_address,
127 main.apps,
128 tempOnosIp )
129
GlennRC4c745432015-09-17 17:09:13 -0700130 main.log.info( "Applying cell to environment" )
131 cell = main.ONOSbench.setCell( "temp" )
132 verify = main.ONOSbench.verifyCell()
133 if not cell or not verify:
134 main.log.error("Failed to apply cell to environment")
135 main.cleanup()
136 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700137
GlennRC4c745432015-09-17 17:09:13 -0700138 main.log.info( "Creating ONOS package" )
139 if not main.ONOSbench.onosPackage():
140 main.log.error("Failed to create ONOS package")
141 main.cleanup()
142 main.exit()
GlennRCec6c7612015-08-31 14:52:10 -0700143
GlennRC58ea2542015-09-02 14:23:34 -0700144 main.log.info("Creating DB file")
GlennRC4c745432015-09-17 17:09:13 -0700145 with open(main.dbFileName, "w+") as dbFile:
GlennRCec6c7612015-08-31 14:52:10 -0700146 temp = "'" + commit + "',"
GlennRC58ea2542015-09-02 14:23:34 -0700147 temp += "'" + nic + "',"
148 temp += str(main.numCtrls) + ","
GlennRC5719ff02015-09-08 17:25:30 -0700149 temp += "'" + node + "1" + "'"
GlennRC4c745432015-09-17 17:09:13 -0700150 dbFile.write(temp)
GlennRCec6c7612015-08-31 14:52:10 -0700151
152 def CASE1( self, main ):
153 """
154 - Uninstall ONOS cluster
155 - Verify ONOS start up
156 - Install ONOS cluster
157 - Connect to cli
158 """
GlennRC4c745432015-09-17 17:09:13 -0700159
160 main.log.info( "Uninstalling ONOS package" )
161 main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[i] )
GlennRCb3202c52015-08-24 14:43:30 -0700162 for i in range( main.maxNodes ):
GlennRC4c745432015-09-17 17:09:13 -0700163 if not main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[i] ):
164 main.log.error("Failed to uninstall onos on node %s" % (i+1))
165 main.cleanup()
166 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700167
GlennRC4c745432015-09-17 17:09:13 -0700168 main.log.info( "Installing ONOS package" )
GlennRCb3202c52015-08-24 14:43:30 -0700169 for i in range( main.numCtrls ):
GlennRC4c745432015-09-17 17:09:13 -0700170 if not main.ONOSbench.onosInstall( node=main.ONOSip[i] ):
171 main.log.error("Failed to install onos on node %s" % (i+1))
172 main.cleanup()
173 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700174
GlennRC4c745432015-09-17 17:09:13 -0700175 main.log.info( "Starting ONOS service" )
GlennRCb3202c52015-08-24 14:43:30 -0700176 for i in range( main.numCtrls ):
GlennRC4c745432015-09-17 17:09:13 -0700177 start = main.ONOSbench.onosStart( main.ONOSip[i] )
178 isup = main.ONOSbench.isup( main.ONOSip[i] )
179 if not start or not isup:
180 main.log.error("Failed to start onos service on node %s" % (i+1))
181 main.cleanup()
182 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700183
GlennRC4c745432015-09-17 17:09:13 -0700184 main.log.info( "Starting ONOS cli" )
GlennRCb3202c52015-08-24 14:43:30 -0700185 for i in range( main.numCtrls ):
GlennRC4c745432015-09-17 17:09:13 -0700186 if not main.CLIs[i].startOnosCli( main.ONOSip[i] ):
187 main.log.error("Failed to start onos cli on node %s" % (i+1))
188 main.cleanup()
189 main.exit()
GlennRCb3202c52015-08-24 14:43:30 -0700190
191 def CASE10( self, main ):
192 """
193 Setting up null-provider
194 """
195 import json
196 import pexpect
197
198 # Activate apps
GlennRC4c745432015-09-17 17:09:13 -0700199 main.log.info("Activating null-provider")
200 appStatus = main.CLIs[0].activateApp('org.onosproject.null')
201 if not appStatus:
202 main.log.error("Failed to activate null-provider")
GlennRCb3202c52015-08-24 14:43:30 -0700203
204 # Setup the null-provider
GlennRC4c745432015-09-17 17:09:13 -0700205 main.log.info("Configuring null-provider")
206 cfgStatus = main.ONOSbench.onosCfgSet( main.ONOSip[0],
207 'org.onosproject.provider.nil.NullProviders', 'deviceCount 3' )
208 cfgStatus = cfgStatus and main.ONOSbench.onosCfgSet( main.ONOSip[0],
209 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute' )
210 cfgStatus = cfgStatus and main.ONOSbench.onosCfgSet( main.ONOSip[0],
211 'org.onosproject.provider.nil.NullProviders', 'enabled true' )
GlennRCb3202c52015-08-24 14:43:30 -0700212
GlennRC4c745432015-09-17 17:09:13 -0700213 if not cfgStatus:
214 main.log.error("Failed to configure null-provider")
GlennRCb3202c52015-08-24 14:43:30 -0700215
GlennRC4c745432015-09-17 17:09:13 -0700216 # give onos some time to settle
217 time.sleep(main.startUpSleep)
GlennRCb3202c52015-08-24 14:43:30 -0700218
GlennRC4c745432015-09-17 17:09:13 -0700219 main.defaultFlows = 0
GlennRCb3202c52015-08-24 14:43:30 -0700220 main.ingress = ":0000000000000001/3"
221 main.egress = ":0000000000000003/2"
222 main.switch = "null"
223 main.linkUpCmd = "null-link null:0000000000000001/3 null:0000000000000003/1 up"
224 main.linkDownCmd = "null-link null:0000000000000001/3 null:0000000000000003/1 down"
225
GlennRC4c745432015-09-17 17:09:13 -0700226 if not appStatus or not cfgStatus:
227 main.setupSkipped = True
228
GlennRCb3202c52015-08-24 14:43:30 -0700229 def CASE11( self, main ):
230 '''
231 Setting up mininet
232 '''
233 import json
234 import time
235
GlennRC4c745432015-09-17 17:09:13 -0700236 main.log.step("Activating openflow")
237 appStatus = main.CLIs[0].activateApp('org.onosproject.openflow')
238 if appStatus:
239 main.log.error("Failed to activate openflow")
GlennRCb3202c52015-08-24 14:43:30 -0700240
GlennRCb3202c52015-08-24 14:43:30 -0700241 time.sleep(main.startUpSleep)
242
GlennRC4c745432015-09-17 17:09:13 -0700243 main.log.info('Starting mininet topology')
244 mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
245 if mnStatus:
246 main.log.error("Failed to start mininet")
247
248 main.log.info("Assinging masters to switches")
249 swStatus = main.Mininet1.assignSwController(sw='s1', ip=main.ONOSip[0])
250 swStatus = swStatus and main.Mininet1.assignSwController(sw='s2', ip=main.ONOSip[0])
251 swStatus = swStatus and main.Mininet1.assignSwController(sw='s3', ip=main.ONOSip[0])
252 if not swStatus:
253 main.log.info("Failed to assign masters to switches")
254
GlennRCb3202c52015-08-24 14:43:30 -0700255 time.sleep(main.startUpSleep)
256
257 jsonSum = json.loads(main.CLIs[0].summary())
GlennRC4c745432015-09-17 17:09:13 -0700258 sumStatus = (jsonSum['devices'] == 3 and jsonSum['SCC(s)'] == 1)
GlennRCb3202c52015-08-24 14:43:30 -0700259
GlennRC4c745432015-09-17 17:09:13 -0700260 main.log.step("Getting default flows")
GlennRCb3202c52015-08-24 14:43:30 -0700261 jsonSum = json.loads(main.CLIs[0].summary())
262
GlennRCb3202c52015-08-24 14:43:30 -0700263 main.defaultFlows = jsonSum["flows"]
264 main.ingress = ":0000000000000001/3"
265 main.egress = ":0000000000000003/2"
266 main.switch = "of"
267 main.linkDownCmd = 'link s1 s3 down'
268 main.linkUpCmd = 'link s1 s3 up'
269
GlennRC4c745432015-09-17 17:09:13 -0700270 if not appStatus or not mnStatus or not swStatus or not sumStatus:
271 main.setupSkipped = True
GlennRCb3202c52015-08-24 14:43:30 -0700272
273 def CASE20( self, main ):
274 import pexpect
275 '''
276 Pushing intents
277 '''
GlennRC4c745432015-09-17 17:09:13 -0700278
279 # check if the setup case has been skipped
280 if main.setupSkipped:
281 main.setupSkipped = False
282 main.skipCase()
283
GlennRCb3202c52015-08-24 14:43:30 -0700284 # the index where the next intents will be installed
285 offset = 0
286 # the number of intents we expect to be in the installed state
287 expectedIntents = 0
GlennRC33a42072015-09-11 11:32:44 -0700288 # keeps track of how many intents have been installed
289 maxIntents = 0
GlennRCb3202c52015-08-24 14:43:30 -0700290 # the number of flows we expect to be in the added state
291 expectedFlows = main.defaultFlows
GlennRC33a42072015-09-11 11:32:44 -0700292 # keeps track of how many flows have been installed
293 maxFlows = main.defaultFlows
GlennRC9882f352015-08-27 18:03:28 -0700294 # limit for the number of intents that can be installed
295 limit = main.maxIntents / main.batchSize
GlennRCd0e5ed22015-09-03 11:54:27 -0700296
297 for i in range(limit):
298 # Push intents
GlennRC4c745432015-09-17 17:09:13 -0700299 main.log.info("Pushing intents")
300 main.intentFunctions.pushIntents( main,
301 main.switch,
302 main.ingress,
303 main.egress,
304 main.batchSize,
305 offset,
306 sleep=main.installSleep,
307 timeout=main.timeout,
308 options="-i" )
GlennRCd0e5ed22015-09-03 11:54:27 -0700309
310 offset += main.batchSize
311 expectedIntents = offset
312 expectedFlows += main.batchSize*2
313
GlennRC4c745432015-09-17 17:09:13 -0700314 main.log.info("Grabbing number of installed intents and flows")
GlennRC33a42072015-09-11 11:32:44 -0700315 maxIntents = main.intentFunctions.getIntents( main )
316 maxFlows = main.intentFunctions.getFlows( main )
317
GlennRC5719ff02015-09-08 17:25:30 -0700318 if offset >= main.minIntents and offset % main.checkInterval == 0 or expectedIntents == main.maxIntents:
GlennRCd0e5ed22015-09-03 11:54:27 -0700319 # Verifying intents
GlennRC4c745432015-09-17 17:09:13 -0700320 main.log.info("Verifying intents\nExpected intents: " + str(expectedIntents))
321 intentStatus = main.intentFunctions.verifyIntents( main,
322 expectedIntents,
323 sleep=main.verifySleep,
324 timeout=main.timeout)
GlennRCd0e5ed22015-09-03 11:54:27 -0700325 # Verfying flows
GlennRC4c745432015-09-17 17:09:13 -0700326 main.log.info("Verifying flows\nExpected Flows: " + str(expectedFlows))
327 flowStatus = main.intentFunctions.verifyFlows( main,
GlennRCd0e5ed22015-09-03 11:54:27 -0700328 expectedFlows,
329 sleep=main.verifySleep,
330 timeout=main.timeout)
GlennRCb3202c52015-08-24 14:43:30 -0700331
GlennRC4c745432015-09-17 17:09:13 -0700332 if not flowStatus or not intentsStataus:
333 main.log.error("Failed to verify")
GlennRCd0e5ed22015-09-03 11:54:27 -0700334 break
GlennRCb3202c52015-08-24 14:43:30 -0700335
GlennRCb3202c52015-08-24 14:43:30 -0700336 main.log.info("Summary: Intents=" + str(expectedIntents) + " Flows=" + str(expectedFlows))
GlennRCec6c7612015-08-31 14:52:10 -0700337 main.log.info("Installed intents: " + str(maxIntents) +
GlennRC5719ff02015-09-08 17:25:30 -0700338 " Added flows: " + str(maxFlows))
GlennRCec6c7612015-08-31 14:52:10 -0700339
GlennRC58ea2542015-09-02 14:23:34 -0700340 main.log.info("Writing results to DB file")
GlennRC4c745432015-09-17 17:09:13 -0700341 with open(dbFileName, "a") as dbFile:
GlennRC5719ff02015-09-08 17:25:30 -0700342 temp = "," + str(maxIntents)
343 temp += "," + str(maxFlows)
GlennRC4c745432015-09-17 17:09:13 -0700344 dbFile.write(temp)
GlennRCb3202c52015-08-24 14:43:30 -0700345
346 # Stopping mininet
347 if main.switch == "of":
348 main.log.info("Stopping mininet")
349 main.Mininet1.stopNet()
350
351 def CASE21( self, main ):
352 import pexpect
353 import time
354 '''
355 Reroute
356 '''
GlennRC4c745432015-09-17 17:09:13 -0700357
358 # check if the setup case has been skipped
359 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
365 # the number of intents we expect to be in the installed state
366 expectedIntents = 0
GlennRC33a42072015-09-11 11:32:44 -0700367 # keeps track of how many intents have been installed
368 maxIntents = 0
GlennRCb3202c52015-08-24 14:43:30 -0700369 # the number of flows we expect to be in the added state
370 expectedFlows = main.defaultFlows
GlennRC33a42072015-09-11 11:32:44 -0700371 # keeps track of how many flows have been installed
372 maxFlows = main.defaultFlows
GlennRC9882f352015-08-27 18:03:28 -0700373 # limit for the number of intents that can be installed
374 limit = main.maxIntents / main.batchSize
GlennRCd0e5ed22015-09-03 11:54:27 -0700375
376 for i in range(limit):
377 # Push intents
GlennRC4c745432015-09-17 17:09:13 -0700378 main.log.info("Pushing intents")
379 main.intentFunctions.pushIntents( main,
380 main.switch,
381 main.ingress,
382 main.egress,
383 main.batchSize,
384 offset,
385 sleep=main.installSleep,
386 timeout=main.timeout,
387 options="-i" )
GlennRC33a42072015-09-11 11:32:44 -0700388
GlennRCd0e5ed22015-09-03 11:54:27 -0700389 offset += main.batchSize
390 expectedIntents = offset
391 expectedFlows += main.batchSize*2
392
GlennRC4c745432015-09-17 17:09:13 -0700393 main.log.info("Grabbing number of installed intents and flows")
394 maxIntents = main.intentFunctions.getIntents( main )
395 maxFlows = main.intentFunctions.getFlows( main )
396
GlennRCd0e5ed22015-09-03 11:54:27 -0700397 # Verifying intents
GlennRC4c745432015-09-17 17:09:13 -0700398 main.log.info("Verifying intents\n\tExpected intents: " + str(expectedIntents))
399 intentStatus = main.intentFunctions.verifyIntents( main,
400 expectedIntents,
401 sleep=main.verifySleep,
402 timeout=main.timeout)
GlennRCd0e5ed22015-09-03 11:54:27 -0700403 # Verfying flows
GlennRC4c745432015-09-17 17:09:13 -0700404 main.log.info("Verifying flows\n\tExpected Flows: " + str(expectedFlows))
405 flowStatus = main.intentFunctions.verifyFlows( main,
GlennRCd0e5ed22015-09-03 11:54:27 -0700406 expectedFlows,
407 sleep=main.verifySleep,
GlennRC4c745432015-09-17 17:09:13 -0700408 timeout=main.timeout)
GlennRCb3202c52015-08-24 14:43:30 -0700409
GlennRC4c745432015-09-17 17:09:13 -0700410 if not flowStatus or not intentsStataus:
411 main.log.error("Failed to verify\n\tSkipping case")
412 main.log.skipCase()
GlennRCb3202c52015-08-24 14:43:30 -0700413
GlennRCd0e5ed22015-09-03 11:54:27 -0700414 # tear down a link
415 main.log.step("Tearing down link")
416 if main.switch == "of":
417 main.log.info("Sending: " + main.linkDownCmd)
418 main.Mininet1.handle.sendline(main.linkDownCmd)
419 main.Mininet1.handle.expect('mininet>')
420 else:
421 main.log.info("Sending: " + main.linkDownCmd)
422 main.CLIs[0].handle.sendline(main.linkDownCmd)
423 main.CLIs[0].handle.expect('onos>')
GlennRC4c745432015-09-17 17:09:13 -0700424
GlennRCd0e5ed22015-09-03 11:54:27 -0700425 time.sleep(main.rerouteSleep)
GlennRCb3202c52015-08-24 14:43:30 -0700426
GlennRCd0e5ed22015-09-03 11:54:27 -0700427 # rerouting adds a 1000 flows
428 expectedFlows += 1000
GlennRCb3202c52015-08-24 14:43:30 -0700429
GlennRC4c745432015-09-17 17:09:13 -0700430 main.log.info("Grabbing number of added flows")
431 maxFlows = main.intentFunctions.getFlows( main )
432
GlennRCd0e5ed22015-09-03 11:54:27 -0700433 # Verfying flows
GlennRC4c745432015-09-17 17:09:13 -0700434 main.log.info("Verifying flows\n\tExpected Flows: " + str(expectedFlows))
435 flowStatus = main.intentFunctions.verifyFlows( main,
GlennRCd0e5ed22015-09-03 11:54:27 -0700436 expectedFlows,
437 sleep=main.verifySleep,
438 timeout=main.timeout)
GlennRC4c745432015-09-17 17:09:13 -0700439 if not flowStatus:
440 main.log.error("Failed to verify flows\n\tSkipping case")
441 main.skipCase()
GlennRCb3202c52015-08-24 14:43:30 -0700442
GlennRCd0e5ed22015-09-03 11:54:27 -0700443 # Bring link back up
GlennRC4c745432015-09-17 17:09:13 -0700444 main.log.step("Bringing link back up")
GlennRCd0e5ed22015-09-03 11:54:27 -0700445 if main.switch == "of":
446 main.log.info("Sending: " + main.linkUpCmd)
447 main.Mininet1.handle.sendline(main.linkUpCmd)
448 main.Mininet1.handle.expect('mininet>')
449 else:
450 main.log.info("Sending: " + main.linkUpCmd)
451 main.CLIs[0].handle.sendline(main.linkUpCmd)
452 main.CLIs[0].handle.expect('onos>')
GlennRC4c745432015-09-17 17:09:13 -0700453
GlennRCd0e5ed22015-09-03 11:54:27 -0700454 time.sleep(main.rerouteSleep)
GlennRCb3202c52015-08-24 14:43:30 -0700455
GlennRCb3202c52015-08-24 14:43:30 -0700456 main.log.info("Summary: Intents=" + str(expectedIntents) + " Flows=" + str(expectedFlows))
GlennRCec6c7612015-08-31 14:52:10 -0700457 main.log.info("Installed intents: " + str(maxIntents) +
GlennRC5719ff02015-09-08 17:25:30 -0700458 " Added flows: " + str(maxFlows))
GlennRCec6c7612015-08-31 14:52:10 -0700459
GlennRC4c745432015-09-17 17:09:13 -0700460 with open(main.dbFileName, "a") as dbFile:
GlennRC5719ff02015-09-08 17:25:30 -0700461 temp = "," + str(maxIntents)
462 temp += "," + str(maxFlows)
GlennRC4c745432015-09-17 17:09:13 -0700463 dbFile.write(temp)
GlennRC14d54f72015-09-03 10:51:37 -0700464
GlennRCb3202c52015-08-24 14:43:30 -0700465 # Stopping mininet
466 if main.switch == "of":
467 main.log.info("Stopping mininet")
468 main.Mininet1.stopNet()
469
470 def CASE100( self, main ):
471 '''
472 Report errors/warnings/exceptions
473 '''
474 main.log.info("Error report: \n")
475 main.ONOSbench.logReport( main.ONOSip[ 0 ],
476 [ "INFO",
477 "FOLLOWER",
478 "WARN",
479 "flow",
480 "ERROR",
481 "Except" ],
482 "s" )