blob: c27bd47fb8d0ea434c056647fc0bf964e4528710 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2016 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
suibin zhang17308622016-04-14 15:45:30 -070022class SCPFbatchFlowResp:
Jon Hall5c3ff722017-05-24 17:24:59 -070023
24 """
suibin zhang17308622016-04-14 15:45:30 -070025 Testing end-to-end ONOS response time from POST of batched flows to when ONOS returns
26 response confirmation of all flows ADDED; subsequently testing the response time from when REST DELETE to
27 ONOS confirmation of all flows REMOVED.
Jon Hall5c3ff722017-05-24 17:24:59 -070028 """
suibin zhang17308622016-04-14 15:45:30 -070029 def __init__( self ):
30 self.default = ''
31
32 def CASE1( self, main ):
33 import time
34 import os
35 import imp
36
37 """
38 - Construct tests variables
39 - GIT ( optional )
40 - Checkout ONOS master branch
41 - Pull latest ONOS code
suibin zhang17308622016-04-14 15:45:30 -070042 """
Devin Lim58046fa2017-07-05 16:55:00 -070043 try:
44 from tests.dependencies.ONOSSetup import ONOSSetup
45 main.testSetUp = ONOSSetup()
46 except ImportError:
47 main.log.error( "ONOSSetup not found. exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -070048 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070049 main.testSetUp.envSetupDescription()
50 stepResult = main.FALSE
51 try:
52 # Test variables
53 main.testOnDirectory = os.path.dirname( os.getcwd() )
54 main.cellName = main.params[ 'CASE1' ][ 'cellName' ]
55 main.apps = main.params[ 'CASE1' ][ 'cellApps' ]
56 main.maxNodes = int( main.params[ 'GLOBAL' ][ 'maxNodes' ] )
57 main.startUpSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'startup' ] )
58 main.startMNSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'startMN' ] )
59 main.addFlowSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'addFlow' ] )
60 main.delFlowSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'delFlow' ] )
61 main.chkFlowSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'chkFlow' ] )
You Wanga3cbc052017-07-27 12:22:12 -070062 main.skipPackaging = main.params[ 'CASE2' ][ 'skipPackaging' ]
63 if main.skipPackaging.lower() == "true":
64 main.skipPackaging = True
65 else:
66 main.skipPackaging = False
Devin Lim58046fa2017-07-05 16:55:00 -070067 main.cfgSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'cfg' ] )
68 main.numSw = int( main.params[ 'GLOBAL' ][ 'numSw' ] )
69 main.numThreads = int( main.params[ 'GLOBAL' ][ 'numThreads' ] )
70 main.cluster = main.params[ 'GLOBAL' ][ 'cluster' ]
suibin zhang17308622016-04-14 15:45:30 -070071
Devin Lim58046fa2017-07-05 16:55:00 -070072 stepResult = main.testSetUp.envSetup()
73 except Exception as e:
74 main.testSetUp.envSetupException( e )
75 main.testSetUp.evnSetupConclusion( stepResult )
Jon Hall5c3ff722017-05-24 17:24:59 -070076 main.commit = main.commit.split( " " )[ 1 ]
YPZhang28909bc2016-06-20 13:29:11 -070077
suibin zhang17308622016-04-14 15:45:30 -070078
79 def CASE2( self, main ):
80 """
81 - Set up cell
82 - Create cell file
83 - Set cell file
84 - Verify cell file
85 - Kill ONOS process
86 - Uninstall ONOS cluster
87 - Verify ONOS start up
88 - Install ONOS cluster
89 - Connect to cli
90 """
Devin Lim142b5342017-07-20 15:22:39 -070091 main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster,
92 skipPack=main.skipPackaging )
suibin zhang17308622016-04-14 15:45:30 -070093
suibin zhang17308622016-04-14 15:45:30 -070094 def CASE10( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -070095 """
suibin zhang17308622016-04-14 15:45:30 -070096 Start Mininet
Jon Hall5c3ff722017-05-24 17:24:59 -070097 """
suibin zhang17308622016-04-14 15:45:30 -070098 import time
99
100 main.case( "Enable openflow-base on onos and start Mininet." )
101
Jon Hall5c3ff722017-05-24 17:24:59 -0700102 main.step( "Activate openflow-base App" )
103 app = main.params[ 'CASE10' ][ 'app' ]
Devin Lim142b5342017-07-20 15:22:39 -0700104 stepResult = main.Cluster.active( 0 ).CLI.activateApp( app )
Jon Hall5c3ff722017-05-24 17:24:59 -0700105 time.sleep( main.cfgSleep )
106 main.log.info( stepResult )
suibin zhang17308622016-04-14 15:45:30 -0700107 utilities.assert_equals( expect=main.TRUE,
108 actual=stepResult,
109 onpass="Successfully activate " + app,
110 onfail="Failed to activate app " + app )
111
Jon Hall5c3ff722017-05-24 17:24:59 -0700112 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700113
Jon Hall5c3ff722017-05-24 17:24:59 -0700114 main.step( "Configure AdaptiveFlowSampling " )
Devin Lim142b5342017-07-20 15:22:39 -0700115 stepResult = main.Cluster.active( 0 ).CLI.setCfg( component=main.params[ 'CASE10' ][ 'cfg' ],
Jon Hall5c3ff722017-05-24 17:24:59 -0700116 propName="adaptiveFlowSampling ", value=main.params[ 'CASE10' ][ 'adaptiveFlowenabled' ] )
suibin zhang17308622016-04-14 15:45:30 -0700117 utilities.assert_equals( expect=main.TRUE,
118 actual=stepResult,
119 onpass="App Configuration Succeeded! ",
120 onfail="App Configuration Failed!" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700121 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700122
Jon Hall5c3ff722017-05-24 17:24:59 -0700123 main.step( "Setup Mininet Linear Topology with " + str( main.numSw ) + " switches" )
124 argStr = main.params[ 'CASE10' ][ 'mnArgs' ].format( main.numSw )
125 stepResult = main.Mininet1.startNet( args=argStr )
suibin zhang17308622016-04-14 15:45:30 -0700126
127 utilities.assert_equals( expect=main.TRUE,
128 actual=stepResult,
129 onpass="Successfully loaded topology",
130 onfail="Failed to load topology" )
131
132 time.sleep( main.startMNSleep )
133
134 main.step( "Assign switches to controller" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700135 for i in range( 1, main.numSw + 1 ):
Devin Lim142b5342017-07-20 15:22:39 -0700136 main.Mininet1.assignSwController( "s" + str( i ),
137 main.Cluster.active( 0 ).ipAddress )
suibin zhang17308622016-04-14 15:45:30 -0700138
139 utilities.assert_equals( expect=main.TRUE,
140 actual=stepResult,
141 onpass="Successfully assigned switch to controller",
142 onfail="Failed to assign switch to controller" )
143
144 main.deviceIdPrefix = "of:"
145
146 time.sleep( main.startMNSleep )
147
148 def CASE11( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700149 """
suibin zhang17308622016-04-14 15:45:30 -0700150 Start Null Provider
Jon Hall5c3ff722017-05-24 17:24:59 -0700151 """
suibin zhang17308622016-04-14 15:45:30 -0700152 import time
153
154 main.case( "Setup Null Provider for linear Topology" )
155
Jon Hall5c3ff722017-05-24 17:24:59 -0700156 main.step( "Activate Null Provider App" )
Devin Lim142b5342017-07-20 15:22:39 -0700157 stepResult = main.ONOSbench.onosCli( ONOSIp=main.Cluster.active( 0 ).ipAddress,
Jon Hall5c3ff722017-05-24 17:24:59 -0700158 cmdstr="app activate org.onosproject.null" )
suibin zhang17308622016-04-14 15:45:30 -0700159 utilities.assert_equals( expect=main.TRUE,
160 actual=stepResult,
161 onpass="Successfully activated org.onosproject.null",
162 onfail="Failed to activate org.onosproject.null" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700163 time.sleep( main.cfgSleep )
Devin Lim142b5342017-07-20 15:22:39 -0700164 cfgs = main.params[ 'CASE11' ][ 'cfg' ]
Jon Hall5c3ff722017-05-24 17:24:59 -0700165 main.step( "Setup Null Provider Linear Topology with " + str( main.numSw ) + " devices." )
Devin Lim142b5342017-07-20 15:22:39 -0700166 r1 = main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
167 cfgs,
168 "deviceCount " + str( main.numSw ) )
169 r2 = main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
170 cfgs,
171 "topoShape " + main.params[ 'CASE11' ][ 'nullTopo' ] )
172 r3 = main.ONOSbench.onosCfgSet( main.Cluster.active( 0 ).ipAddress,
173 cfgs,
174 "enabled " + main.params[ 'CASE11' ][ 'nullStart' ] )
suibin zhang17308622016-04-14 15:45:30 -0700175 stepResult = r1 & r2 & r3
176 utilities.assert_equals( expect=main.TRUE,
177 actual=stepResult,
178 onpass="App Configuration Succeeded! ",
179 onfail="App Configuration Failed!" )
180 time.sleep( main.cfgSleep )
181
Jon Hall5c3ff722017-05-24 17:24:59 -0700182 main.log.info( "Check to make sure null providers are configured correctly." )
183 main.ONOSbench.handle.sendline( "onos $OC1 summary" )
184 stepResult = main.ONOSbench.handle.expect( ":~" )
185 main.log.info( "ONOS Summary: " + main.ONOSbench.handle.before )
suibin zhang17308622016-04-14 15:45:30 -0700186
187 main.deviceIdPrefix = "null:"
188
189 time.sleep( main.startMNSleep )
190
suibin zhang17308622016-04-14 15:45:30 -0700191 def CASE1000( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700192 """
suibin zhang17308622016-04-14 15:45:30 -0700193 create JSON object with batched flows
Jon Hall5c3ff722017-05-24 17:24:59 -0700194 """
suibin zhang17308622016-04-14 15:45:30 -0700195 import numpy
196 import time
197 from pprint import pprint
198
199 main.case( "Create a json object for the batched flows" )
200
201 main.step( "Parse batch creation information" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700202 main.batchSize = int( main.params[ 'CASE1000' ][ 'batchSize' ] )
203 main.log.info( "Number of flows in a batch is:" + str( main.batchSize ) )
suibin zhang17308622016-04-14 15:45:30 -0700204
205 main.flowJsonBatchList = []
206 startSw = 1
207
Jon Hall5c3ff722017-05-24 17:24:59 -0700208 main.step( "Creating a full list of batches" )
209 for index in range( 1, int( main.params[ 'CASE1000' ][ 'batches' ] ) + 1 ):
suibin zhang17308622016-04-14 15:45:30 -0700210 if startSw <= main.numSw:
211 ind = startSw
212 else:
213 startSw = 1
214 ind = startSw
215
Jon Hall5c3ff722017-05-24 17:24:59 -0700216 main.log.info( "Creating batch: " + str( index ) )
Devin Lim142b5342017-07-20 15:22:39 -0700217 flowJsonBatch = main.Cluster.active( 0 ).REST.createFlowBatch( numSw=main.numSw,
Jon Hall5c3ff722017-05-24 17:24:59 -0700218 swIndex=ind,
219 batchSize=main.batchSize,
220 batchIndex=index,
suibin zhang17308622016-04-14 15:45:30 -0700221 deviceIdpreFix=main.deviceIdPrefix,
Jon Hall5c3ff722017-05-24 17:24:59 -0700222 ingressPort=2,
223 egressPort=3 )
224 main.flowJsonBatchList.append( flowJsonBatch )
suibin zhang17308622016-04-14 15:45:30 -0700225
226 startSw += 1
Jon Hall5c3ff722017-05-24 17:24:59 -0700227 main.log.info( "Number of items created in the batch list is: " + str( len( main.flowJsonBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700228
Jon Hall5c3ff722017-05-24 17:24:59 -0700229 def CASE2100( self, main ):
230 """
suibin zhang17308622016-04-14 15:45:30 -0700231 Posting flow batches using threads
Jon Hall5c3ff722017-05-24 17:24:59 -0700232 """
233 main.case( "Using REST API /flows/{} to post flow batch - multi-threads" )
234 main.step( "Using REST API /flows/{} to post flow batch - multi-threads" )
suibin zhang17308622016-04-14 15:45:30 -0700235
236 from Queue import Queue
237 from threading import Thread
238 import time
239 import json
240
241 main.threadID = 0
242 main.addedBatchList = []
243 q = Queue()
244 tAllAdded = 0
You Wang7b5b2262016-11-10 13:54:56 -0800245 main.postFailed = False
suibin zhang17308622016-04-14 15:45:30 -0700246
Jon Hall5c3ff722017-05-24 17:24:59 -0700247 def postWorker( id ):
suibin zhang17308622016-04-14 15:45:30 -0700248 while True:
249 item = q.get()
Jon Hall5c3ff722017-05-24 17:24:59 -0700250 #print json.dumps( item )
Devin Lim142b5342017-07-20 15:22:39 -0700251 status, response = main.Cluster.active( 0 ).REST.sendFlowBatch( batch=item )
You Wang7b5b2262016-11-10 13:54:56 -0800252 if status == main.TRUE:
Jon Hall5c3ff722017-05-24 17:24:59 -0700253 main.log.info( "Thread {} is working on posting. ".format( id ) )
254 #print json.dumps( response )
255 main.addedBatchList.append( response[ 1 ] )
You Wang7b5b2262016-11-10 13:54:56 -0800256 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700257 main.log.error( "Thread {} failed to post.".format( id ) )
You Wang7b5b2262016-11-10 13:54:56 -0800258 main.postFailed = True
suibin zhang17308622016-04-14 15:45:30 -0700259 q.task_done()
260
Jon Hall5c3ff722017-05-24 17:24:59 -0700261 for i in range( int( main.params[ 'CASE2100' ][ 'numThreads' ] ) ):
262 threadID = "ThreadID-" + str( i )
263 t = Thread( target=postWorker, name=threadID, args=( threadID, ) )
suibin zhang17308622016-04-14 15:45:30 -0700264 t.daemon = True
265 t.start()
266
267 tStartPost = time.time()
268 for item in main.flowJsonBatchList:
Jon Hall5c3ff722017-05-24 17:24:59 -0700269 q.put( item )
suibin zhang17308622016-04-14 15:45:30 -0700270
271 q.join()
272 tLastPostEnd = time.time()
You Wang7b5b2262016-11-10 13:54:56 -0800273 if main.postFailed:
274 main.log.error( "Flow batch posting failed, exit test" )
Devin Lim44075962017-08-11 10:56:37 -0700275 main.cleanAndExit()
suibin zhang17308622016-04-14 15:45:30 -0700276
Jon Hall5c3ff722017-05-24 17:24:59 -0700277 main.step( "Check to ensure all flows are in added state." )
278 #pprint( main.addedBatchList )
suibin zhang17308622016-04-14 15:45:30 -0700279 resp = main.FALSE
Jon Hall5c3ff722017-05-24 17:24:59 -0700280 while resp != main.TRUE and ( tAllAdded - tLastPostEnd < int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ) ):
281 if main.params[ 'CASE2100' ][ 'RESTchkFlow' ] == 'main.TRUE':
Devin Lim142b5342017-07-20 15:22:39 -0700282 resp = main.Cluster.active( 0 ).REST.checkFlowsState()
suibin zhang17308622016-04-14 15:45:30 -0700283 else:
Devin Lim142b5342017-07-20 15:22:39 -0700284 handle = main.Cluster.active( 0 ).CLI.flows( state=" |grep PEND|wc -l", jsonFormat=False )
Jon Hall5c3ff722017-05-24 17:24:59 -0700285 main.log.info( "handle returns PENDING flows: " + handle )
suibin zhang17308622016-04-14 15:45:30 -0700286 if handle == "0":
287 resp = main.TRUE
288
289 time.sleep( main.chkFlowSleep )
290 tAllAdded = time.time()
291
Jon Hall5c3ff722017-05-24 17:24:59 -0700292 if tAllAdded - tLastPostEnd >= int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ):
293 main.log.warn( "ONOS Flows still in pending state after: {} seconds.".format( tAllAdded - tLastPostEnd ) )
suibin zhang17308622016-04-14 15:45:30 -0700294
Jon Hall5c3ff722017-05-24 17:24:59 -0700295 main.numFlows = int( main.params[ 'CASE1000' ][ 'batches' ] ) *\
296 int( main.params[ 'CASE1000' ][ 'batchSize' ] )
297 main.log.info( "Total number of flows: " + str( main.numFlows ) )
298 main.elapsePOST = tLastPostEnd - tStartPost
299 main.log.info( "Total POST elapse time: " + str( main.elapsePOST ) )
300 main.log.info( "Rate of ADD Controller response: " + str( main.numFlows / ( main.elapsePOST ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700301
302 main.POSTtoCONFRM = tAllAdded - tLastPostEnd
Jon Hall5c3ff722017-05-24 17:24:59 -0700303 main.log.info( "Elapse time from end of last REST POST to Flows in ADDED state: " +
304 str( main.POSTtoCONFRM ) )
305 main.log.info( "Rate of Confirmed Batch Flow ADD is ( flows/sec ): " +
306 str( main.numFlows / main.POSTtoCONFRM ) )
307 main.log.info( "Number of flow Batches in the addedBatchList is: " +
308 str( len( main.addedBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700309
Jon Hall5c3ff722017-05-24 17:24:59 -0700310 def CASE3100( self, main ):
311 """
suibin zhang17308622016-04-14 15:45:30 -0700312 DELETE flow batches using threads
Jon Hall5c3ff722017-05-24 17:24:59 -0700313 """
314 main.case( "Using REST API /flows/{} to delete flow batch - multi-threads" )
315 main.step( "Using REST API /flows/{} to delete flow batch - multi-threads" )
suibin zhang17308622016-04-14 15:45:30 -0700316
317 from Queue import Queue
318 from threading import Thread
319 import time
320 import json
321
322 main.threadID = 0
323 q = Queue()
324 tAllRemoved = 0
325
Jon Hall5c3ff722017-05-24 17:24:59 -0700326 main.log.info( "Number of flow batches at start of remove: " + str( len( main.addedBatchList ) ) )
327
328 def removeWorker( id ):
suibin zhang17308622016-04-14 15:45:30 -0700329 while True:
330 item = q.get()
Devin Lim142b5342017-07-20 15:22:39 -0700331 response = main.Cluster.active( 0 ).REST.removeFlowBatch( batch=json.loads( item ) )
Jon Hall5c3ff722017-05-24 17:24:59 -0700332 main.log.info( "Thread {} is working on deleting. ".format( id ) )
suibin zhang17308622016-04-14 15:45:30 -0700333 q.task_done()
334
Jon Hall5c3ff722017-05-24 17:24:59 -0700335 for i in range( int( main.params[ 'CASE2100' ][ 'numThreads' ] ) ):
336 threadID = "ThreadID-" + str( i )
337 t = Thread( target=removeWorker, name=threadID, args=( threadID, ) )
suibin zhang17308622016-04-14 15:45:30 -0700338 t.daemon = True
339 t.start()
340
341 tStartDelete = time.time()
342 for item in main.addedBatchList:
Jon Hall5c3ff722017-05-24 17:24:59 -0700343 q.put( item )
suibin zhang17308622016-04-14 15:45:30 -0700344
345 q.join()
346 tLastDeleteEnd = time.time()
Jon Hall5c3ff722017-05-24 17:24:59 -0700347 main.log.info( "Number of flow batches at end of remove: " + str( len( main.addedBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700348
Jon Hall5c3ff722017-05-24 17:24:59 -0700349 main.step( "Check to ensure all flows are in added state." )
350 #pprint( main.addedBatchList )
suibin zhang17308622016-04-14 15:45:30 -0700351 resp = main.FALSE
Jon Hall5c3ff722017-05-24 17:24:59 -0700352 while resp != main.TRUE and ( tAllRemoved - tLastDeleteEnd < int( main.params[ 'CASE3100' ][ 'chkFlowTO' ] ) ):
353 if main.params[ 'CASE3100' ][ 'RESTchkFlow' ] == 'main.TRUE':
Devin Lim142b5342017-07-20 15:22:39 -0700354 resp = main.Cluster.active( 0 ).REST.checkFlowsState()
suibin zhang17308622016-04-14 15:45:30 -0700355 else:
Devin Lim142b5342017-07-20 15:22:39 -0700356 handle = main.Cluster.active( 0 ).CLI.flows( state=" |grep PEND|wc -l", jsonFormat=False )
Jon Hall5c3ff722017-05-24 17:24:59 -0700357 main.log.info( "handle returns PENDING flows: " + handle )
suibin zhang17308622016-04-14 15:45:30 -0700358 if handle == "0":
359 resp = main.TRUE
360 time.sleep( main.chkFlowSleep )
361 tAllRemoved = time.time()
362
Jon Hall5c3ff722017-05-24 17:24:59 -0700363 if tLastDeleteEnd - tLastDeleteEnd >= int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ):
364 main.log.warn( "ONOS Flows still in pending state after: {} seconds.".format( tAllRemoved - tLastDeleteEnd ) )
suibin zhang17308622016-04-14 15:45:30 -0700365
Jon Hall5c3ff722017-05-24 17:24:59 -0700366 main.numFlows = int( main.params[ 'CASE1000' ][ 'batches' ] ) *\
367 int( main.params[ 'CASE1000' ][ 'batchSize' ] )
368 main.log.info( "Total number of flows: " + str( main.numFlows ) )
369 main.elapseDELETE = tLastDeleteEnd - tStartDelete
370 main.log.info( "Total DELETE elapse time: " + str( main.elapseDELETE ) )
371 main.log.info( "Rate of DELETE Controller response: " + str( main.numFlows / ( main.elapseDELETE ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700372
373 main.DELtoCONFRM = tAllRemoved - tLastDeleteEnd
Jon Hall5c3ff722017-05-24 17:24:59 -0700374 main.log.info( "Elapse time from end of last REST DELETE to Flows in REMOVED state: " +
375 str( main.DELtoCONFRM ) )
376 main.log.info( "Rate of Confirmed Batch Flow REMOVED is ( flows/sec ): " + str( main.numFlows / main.DELtoCONFRM ) )
suibin zhang17308622016-04-14 15:45:30 -0700377
Jon Hall5c3ff722017-05-24 17:24:59 -0700378 def CASE100( self, main ):
suibin zhang17308622016-04-14 15:45:30 -0700379 from pprint import pprint
380
381 main.case( "Check to ensure onos flows." )
382
Devin Lim142b5342017-07-20 15:22:39 -0700383 resp = main.Cluster.active( 0 ).REST.checkFlowsState()
Jon Hall5c3ff722017-05-24 17:24:59 -0700384 #pprint( resp )
suibin zhang17308622016-04-14 15:45:30 -0700385
Jon Hall5c3ff722017-05-24 17:24:59 -0700386 def CASE210( self, main ):
387 main.case( "Log test results to a data file" )
388 main.step( "Write test resulted data to a data file" )
suibin zhang17308622016-04-14 15:45:30 -0700389 main.scale = main.maxNodes
390
391 try:
Jon Hall5c3ff722017-05-24 17:24:59 -0700392 dbFileName = "/tmp/SCPFbatchFlowRespData"
393 dbfile = open( dbFileName, "w+" )
suibin zhang17308622016-04-14 15:45:30 -0700394 temp = "'" + main.commit + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700395 temp += "'1gig',"
suibin zhang17308622016-04-14 15:45:30 -0700396 temp += "'" + str( main.scale ) + "',"
397 temp += "'" + main.cluster + "',"
398 temp += "'" + str( main.elapsePOST ) + "',"
399 temp += "'" + str( main.POSTtoCONFRM ) + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700400 temp += "'" + str( main.numFlows / main.POSTtoCONFRM ) + "',"
Jon Hall5c3ff722017-05-24 17:24:59 -0700401 temp += "'" + str( main.elapseDELETE ) + "',"
402 temp += "'" + str( main.DELtoCONFRM ) + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700403 temp += "'" + str( main.numFlows / main.DELtoCONFRM ) + "',"
404 temp += "'" + str( main.numSw ) + "'\n"
suibin zhang17308622016-04-14 15:45:30 -0700405 dbfile.write( temp )
406 dbfile.close()
407 stepResult = main.TRUE
408 except IOError:
Jon Hall5c3ff722017-05-24 17:24:59 -0700409 main.log.warn( "Error opening " + dbFileName + " to write results." )
suibin zhang17308622016-04-14 15:45:30 -0700410 stepResult = main.FALSE
411
412 utilities.assert_equals( expect=main.TRUE,
413 actual=stepResult,
414 onpass="Succeeded to write results to datafile",
415 onfail="Failed to write results to datafile " )
Jon Hall5c3ff722017-05-24 17:24:59 -0700416
suibin zhang17308622016-04-14 15:45:30 -0700417 def CASE110( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700418 """
suibin zhang17308622016-04-14 15:45:30 -0700419 Report errors/warnings/exceptions
Jon Hall5c3ff722017-05-24 17:24:59 -0700420 """
421 main.log.info( "Error report: \n" )
Devin Lim142b5342017-07-20 15:22:39 -0700422 main.ONOSbench.logReport( main.Cluster.active( 0 ).ipAddress,
suibin zhang17308622016-04-14 15:45:30 -0700423 [ "INFO",
424 "FOLLOWER",
425 "WARN",
426 "flow",
427 "ERROR",
428 "Except" ],
429 "s" )
430 #main.stop()
431