blob: 9512cd5cecc71b4a22ccf42979ac7eb8de8d8828 [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" )
48 main.exit()
49 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 """
You Wanga3cbc052017-07-27 12:22:12 -070091 main.testSetUp.ONOSSetUp( main.Mininet1, skipPack=main.skipPackaging )
suibin zhang17308622016-04-14 15:45:30 -070092
suibin zhang17308622016-04-14 15:45:30 -070093 def CASE10( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -070094 """
suibin zhang17308622016-04-14 15:45:30 -070095 Start Mininet
Jon Hall5c3ff722017-05-24 17:24:59 -070096 """
suibin zhang17308622016-04-14 15:45:30 -070097 import time
98
99 main.case( "Enable openflow-base on onos and start Mininet." )
100
Jon Hall5c3ff722017-05-24 17:24:59 -0700101 main.step( "Activate openflow-base App" )
102 app = main.params[ 'CASE10' ][ 'app' ]
YPZhang5d0552f2016-05-18 13:02:52 -0700103 stepResult = main.ONOScli1.activateApp( app )
Jon Hall5c3ff722017-05-24 17:24:59 -0700104 time.sleep( main.cfgSleep )
105 main.log.info( stepResult )
suibin zhang17308622016-04-14 15:45:30 -0700106 utilities.assert_equals( expect=main.TRUE,
107 actual=stepResult,
108 onpass="Successfully activate " + app,
109 onfail="Failed to activate app " + app )
110
Jon Hall5c3ff722017-05-24 17:24:59 -0700111 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700112
Jon Hall5c3ff722017-05-24 17:24:59 -0700113 main.step( "Configure AdaptiveFlowSampling " )
114 stepResult = main.ONOScli1.setCfg( component="org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider",
115 propName="adaptiveFlowSampling ", value=main.params[ 'CASE10' ][ 'adaptiveFlowenabled' ] )
suibin zhang17308622016-04-14 15:45:30 -0700116 utilities.assert_equals( expect=main.TRUE,
117 actual=stepResult,
118 onpass="App Configuration Succeeded! ",
119 onfail="App Configuration Failed!" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700120 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700121
Jon Hall5c3ff722017-05-24 17:24:59 -0700122 main.step( "Setup Mininet Linear Topology with " + str( main.numSw ) + " switches" )
123 argStr = main.params[ 'CASE10' ][ 'mnArgs' ].format( main.numSw )
124 stepResult = main.Mininet1.startNet( args=argStr )
suibin zhang17308622016-04-14 15:45:30 -0700125
126 utilities.assert_equals( expect=main.TRUE,
127 actual=stepResult,
128 onpass="Successfully loaded topology",
129 onfail="Failed to load topology" )
130
131 time.sleep( main.startMNSleep )
132
133 main.step( "Assign switches to controller" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700134 for i in range( 1, main.numSw + 1 ):
135 main.Mininet1.assignSwController( "s" + str( i ), main.ONOSip[ 0 ] )
suibin zhang17308622016-04-14 15:45:30 -0700136
137 utilities.assert_equals( expect=main.TRUE,
138 actual=stepResult,
139 onpass="Successfully assigned switch to controller",
140 onfail="Failed to assign switch to controller" )
141
142 main.deviceIdPrefix = "of:"
143
144 time.sleep( main.startMNSleep )
145
146 def CASE11( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700147 """
suibin zhang17308622016-04-14 15:45:30 -0700148 Start Null Provider
Jon Hall5c3ff722017-05-24 17:24:59 -0700149 """
suibin zhang17308622016-04-14 15:45:30 -0700150 import time
151
152 main.case( "Setup Null Provider for linear Topology" )
153
Jon Hall5c3ff722017-05-24 17:24:59 -0700154 main.step( "Activate Null Provider App" )
155 stepResult = main.ONOSbench.onosCli( ONOSIp=main.ONOSip[ 0 ],
156 cmdstr="app activate org.onosproject.null" )
suibin zhang17308622016-04-14 15:45:30 -0700157 utilities.assert_equals( expect=main.TRUE,
158 actual=stepResult,
159 onpass="Successfully activated org.onosproject.null",
160 onfail="Failed to activate org.onosproject.null" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700161 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700162
Jon Hall5c3ff722017-05-24 17:24:59 -0700163 main.step( "Setup Null Provider Linear Topology with " + str( main.numSw ) + " devices." )
164 r1 = main.ONOSbench.onosCfgSet( main.ONOSip[ 0 ], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str( main.numSw ) )
165 r2 = main.ONOSbench.onosCfgSet( main.ONOSip[ 0 ], "org.onosproject.provider.nil.NullProviders", "topoShape " + main.params[ 'CASE11' ][ 'nullTopo' ] )
166 r3 = main.ONOSbench.onosCfgSet( main.ONOSip[ 0 ], "org.onosproject.provider.nil.NullProviders", "enabled " + main.params[ 'CASE11' ][ 'nullStart' ] )
suibin zhang17308622016-04-14 15:45:30 -0700167 stepResult = r1 & r2 & r3
168 utilities.assert_equals( expect=main.TRUE,
169 actual=stepResult,
170 onpass="App Configuration Succeeded! ",
171 onfail="App Configuration Failed!" )
172 time.sleep( main.cfgSleep )
173
Jon Hall5c3ff722017-05-24 17:24:59 -0700174 main.log.info( "Check to make sure null providers are configured correctly." )
175 main.ONOSbench.handle.sendline( "onos $OC1 summary" )
176 stepResult = main.ONOSbench.handle.expect( ":~" )
177 main.log.info( "ONOS Summary: " + main.ONOSbench.handle.before )
suibin zhang17308622016-04-14 15:45:30 -0700178
179 main.deviceIdPrefix = "null:"
180
181 time.sleep( main.startMNSleep )
182
suibin zhang17308622016-04-14 15:45:30 -0700183 def CASE1000( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700184 """
suibin zhang17308622016-04-14 15:45:30 -0700185 create JSON object with batched flows
Jon Hall5c3ff722017-05-24 17:24:59 -0700186 """
suibin zhang17308622016-04-14 15:45:30 -0700187 import numpy
188 import time
189 from pprint import pprint
190
191 main.case( "Create a json object for the batched flows" )
192
193 main.step( "Parse batch creation information" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700194 main.batchSize = int( main.params[ 'CASE1000' ][ 'batchSize' ] )
195 main.log.info( "Number of flows in a batch is:" + str( main.batchSize ) )
suibin zhang17308622016-04-14 15:45:30 -0700196
197 main.flowJsonBatchList = []
198 startSw = 1
199
Jon Hall5c3ff722017-05-24 17:24:59 -0700200 main.step( "Creating a full list of batches" )
201 for index in range( 1, int( main.params[ 'CASE1000' ][ 'batches' ] ) + 1 ):
suibin zhang17308622016-04-14 15:45:30 -0700202 if startSw <= main.numSw:
203 ind = startSw
204 else:
205 startSw = 1
206 ind = startSw
207
Jon Hall5c3ff722017-05-24 17:24:59 -0700208 main.log.info( "Creating batch: " + str( index ) )
209 flowJsonBatch = main.ONOSrest.createFlowBatch( numSw=main.numSw,
210 swIndex=ind,
211 batchSize=main.batchSize,
212 batchIndex=index,
suibin zhang17308622016-04-14 15:45:30 -0700213 deviceIdpreFix=main.deviceIdPrefix,
Jon Hall5c3ff722017-05-24 17:24:59 -0700214 ingressPort=2,
215 egressPort=3 )
216 main.flowJsonBatchList.append( flowJsonBatch )
suibin zhang17308622016-04-14 15:45:30 -0700217
218 startSw += 1
Jon Hall5c3ff722017-05-24 17:24:59 -0700219 main.log.info( "Number of items created in the batch list is: " + str( len( main.flowJsonBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700220
Jon Hall5c3ff722017-05-24 17:24:59 -0700221 def CASE2100( self, main ):
222 """
suibin zhang17308622016-04-14 15:45:30 -0700223 Posting flow batches using threads
Jon Hall5c3ff722017-05-24 17:24:59 -0700224 """
225 main.case( "Using REST API /flows/{} to post flow batch - multi-threads" )
226 main.step( "Using REST API /flows/{} to post flow batch - multi-threads" )
suibin zhang17308622016-04-14 15:45:30 -0700227
228 from Queue import Queue
229 from threading import Thread
230 import time
231 import json
232
233 main.threadID = 0
234 main.addedBatchList = []
235 q = Queue()
236 tAllAdded = 0
You Wang7b5b2262016-11-10 13:54:56 -0800237 main.postFailed = False
suibin zhang17308622016-04-14 15:45:30 -0700238
Jon Hall5c3ff722017-05-24 17:24:59 -0700239 def postWorker( id ):
suibin zhang17308622016-04-14 15:45:30 -0700240 while True:
241 item = q.get()
Jon Hall5c3ff722017-05-24 17:24:59 -0700242 #print json.dumps( item )
243 status, response = main.ONOSrest.sendFlowBatch( batch=item )
You Wang7b5b2262016-11-10 13:54:56 -0800244 if status == main.TRUE:
Jon Hall5c3ff722017-05-24 17:24:59 -0700245 main.log.info( "Thread {} is working on posting. ".format( id ) )
246 #print json.dumps( response )
247 main.addedBatchList.append( response[ 1 ] )
You Wang7b5b2262016-11-10 13:54:56 -0800248 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700249 main.log.error( "Thread {} failed to post.".format( id ) )
You Wang7b5b2262016-11-10 13:54:56 -0800250 main.postFailed = True
suibin zhang17308622016-04-14 15:45:30 -0700251 q.task_done()
252
Jon Hall5c3ff722017-05-24 17:24:59 -0700253 for i in range( int( main.params[ 'CASE2100' ][ 'numThreads' ] ) ):
254 threadID = "ThreadID-" + str( i )
255 t = Thread( target=postWorker, name=threadID, args=( threadID, ) )
suibin zhang17308622016-04-14 15:45:30 -0700256 t.daemon = True
257 t.start()
258
259 tStartPost = time.time()
260 for item in main.flowJsonBatchList:
Jon Hall5c3ff722017-05-24 17:24:59 -0700261 q.put( item )
suibin zhang17308622016-04-14 15:45:30 -0700262
263 q.join()
264 tLastPostEnd = time.time()
You Wang7b5b2262016-11-10 13:54:56 -0800265 if main.postFailed:
266 main.log.error( "Flow batch posting failed, exit test" )
267 main.cleanup()
268 main.exit()
suibin zhang17308622016-04-14 15:45:30 -0700269
Jon Hall5c3ff722017-05-24 17:24:59 -0700270 main.step( "Check to ensure all flows are in added state." )
271 #pprint( main.addedBatchList )
suibin zhang17308622016-04-14 15:45:30 -0700272 resp = main.FALSE
Jon Hall5c3ff722017-05-24 17:24:59 -0700273 while resp != main.TRUE and ( tAllAdded - tLastPostEnd < int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ) ):
274 if main.params[ 'CASE2100' ][ 'RESTchkFlow' ] == 'main.TRUE':
suibin zhang17308622016-04-14 15:45:30 -0700275 resp = main.ONOSrest.checkFlowsState()
276 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700277 handle = main.CLIs[ 0 ].flows( state=" |grep PEND|wc -l", jsonFormat=False )
278 main.log.info( "handle returns PENDING flows: " + handle )
suibin zhang17308622016-04-14 15:45:30 -0700279 if handle == "0":
280 resp = main.TRUE
281
282 time.sleep( main.chkFlowSleep )
283 tAllAdded = time.time()
284
Jon Hall5c3ff722017-05-24 17:24:59 -0700285 if tAllAdded - tLastPostEnd >= int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ):
286 main.log.warn( "ONOS Flows still in pending state after: {} seconds.".format( tAllAdded - tLastPostEnd ) )
suibin zhang17308622016-04-14 15:45:30 -0700287
Jon Hall5c3ff722017-05-24 17:24:59 -0700288 main.numFlows = int( main.params[ 'CASE1000' ][ 'batches' ] ) *\
289 int( main.params[ 'CASE1000' ][ 'batchSize' ] )
290 main.log.info( "Total number of flows: " + str( main.numFlows ) )
291 main.elapsePOST = tLastPostEnd - tStartPost
292 main.log.info( "Total POST elapse time: " + str( main.elapsePOST ) )
293 main.log.info( "Rate of ADD Controller response: " + str( main.numFlows / ( main.elapsePOST ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700294
295 main.POSTtoCONFRM = tAllAdded - tLastPostEnd
Jon Hall5c3ff722017-05-24 17:24:59 -0700296 main.log.info( "Elapse time from end of last REST POST to Flows in ADDED state: " +
297 str( main.POSTtoCONFRM ) )
298 main.log.info( "Rate of Confirmed Batch Flow ADD is ( flows/sec ): " +
299 str( main.numFlows / main.POSTtoCONFRM ) )
300 main.log.info( "Number of flow Batches in the addedBatchList is: " +
301 str( len( main.addedBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700302
Jon Hall5c3ff722017-05-24 17:24:59 -0700303 def CASE3100( self, main ):
304 """
suibin zhang17308622016-04-14 15:45:30 -0700305 DELETE flow batches using threads
Jon Hall5c3ff722017-05-24 17:24:59 -0700306 """
307 main.case( "Using REST API /flows/{} to delete flow batch - multi-threads" )
308 main.step( "Using REST API /flows/{} to delete flow batch - multi-threads" )
suibin zhang17308622016-04-14 15:45:30 -0700309
310 from Queue import Queue
311 from threading import Thread
312 import time
313 import json
314
315 main.threadID = 0
316 q = Queue()
317 tAllRemoved = 0
318
Jon Hall5c3ff722017-05-24 17:24:59 -0700319 main.log.info( "Number of flow batches at start of remove: " + str( len( main.addedBatchList ) ) )
320
321 def removeWorker( id ):
suibin zhang17308622016-04-14 15:45:30 -0700322 while True:
323 item = q.get()
Jon Hall5c3ff722017-05-24 17:24:59 -0700324 response = main.ONOSrest.removeFlowBatch( batch=json.loads( item ) )
325 main.log.info( "Thread {} is working on deleting. ".format( id ) )
suibin zhang17308622016-04-14 15:45:30 -0700326 q.task_done()
327
Jon Hall5c3ff722017-05-24 17:24:59 -0700328 for i in range( int( main.params[ 'CASE2100' ][ 'numThreads' ] ) ):
329 threadID = "ThreadID-" + str( i )
330 t = Thread( target=removeWorker, name=threadID, args=( threadID, ) )
suibin zhang17308622016-04-14 15:45:30 -0700331 t.daemon = True
332 t.start()
333
334 tStartDelete = time.time()
335 for item in main.addedBatchList:
Jon Hall5c3ff722017-05-24 17:24:59 -0700336 q.put( item )
suibin zhang17308622016-04-14 15:45:30 -0700337
338 q.join()
339 tLastDeleteEnd = time.time()
Jon Hall5c3ff722017-05-24 17:24:59 -0700340 main.log.info( "Number of flow batches at end of remove: " + str( len( main.addedBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700341
Jon Hall5c3ff722017-05-24 17:24:59 -0700342 main.step( "Check to ensure all flows are in added state." )
343 #pprint( main.addedBatchList )
suibin zhang17308622016-04-14 15:45:30 -0700344 resp = main.FALSE
Jon Hall5c3ff722017-05-24 17:24:59 -0700345 while resp != main.TRUE and ( tAllRemoved - tLastDeleteEnd < int( main.params[ 'CASE3100' ][ 'chkFlowTO' ] ) ):
346 if main.params[ 'CASE3100' ][ 'RESTchkFlow' ] == 'main.TRUE':
suibin zhang17308622016-04-14 15:45:30 -0700347 resp = main.ONOSrest.checkFlowsState()
348 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700349 handle = main.CLIs[ 0 ].flows( state=" |grep PEND|wc -l", jsonFormat=False )
350 main.log.info( "handle returns PENDING flows: " + handle )
suibin zhang17308622016-04-14 15:45:30 -0700351 if handle == "0":
352 resp = main.TRUE
353 time.sleep( main.chkFlowSleep )
354 tAllRemoved = time.time()
355
Jon Hall5c3ff722017-05-24 17:24:59 -0700356 if tLastDeleteEnd - tLastDeleteEnd >= int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ):
357 main.log.warn( "ONOS Flows still in pending state after: {} seconds.".format( tAllRemoved - tLastDeleteEnd ) )
suibin zhang17308622016-04-14 15:45:30 -0700358
Jon Hall5c3ff722017-05-24 17:24:59 -0700359 main.numFlows = int( main.params[ 'CASE1000' ][ 'batches' ] ) *\
360 int( main.params[ 'CASE1000' ][ 'batchSize' ] )
361 main.log.info( "Total number of flows: " + str( main.numFlows ) )
362 main.elapseDELETE = tLastDeleteEnd - tStartDelete
363 main.log.info( "Total DELETE elapse time: " + str( main.elapseDELETE ) )
364 main.log.info( "Rate of DELETE Controller response: " + str( main.numFlows / ( main.elapseDELETE ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700365
366 main.DELtoCONFRM = tAllRemoved - tLastDeleteEnd
Jon Hall5c3ff722017-05-24 17:24:59 -0700367 main.log.info( "Elapse time from end of last REST DELETE to Flows in REMOVED state: " +
368 str( main.DELtoCONFRM ) )
369 main.log.info( "Rate of Confirmed Batch Flow REMOVED is ( flows/sec ): " + str( main.numFlows / main.DELtoCONFRM ) )
suibin zhang17308622016-04-14 15:45:30 -0700370
Jon Hall5c3ff722017-05-24 17:24:59 -0700371 def CASE100( self, main ):
suibin zhang17308622016-04-14 15:45:30 -0700372 from pprint import pprint
373
374 main.case( "Check to ensure onos flows." )
375
376 resp = main.ONOSrest.checkFlowsState()
Jon Hall5c3ff722017-05-24 17:24:59 -0700377 #pprint( resp )
suibin zhang17308622016-04-14 15:45:30 -0700378
Jon Hall5c3ff722017-05-24 17:24:59 -0700379 def CASE210( self, main ):
380 main.case( "Log test results to a data file" )
381 main.step( "Write test resulted data to a data file" )
suibin zhang17308622016-04-14 15:45:30 -0700382 main.scale = main.maxNodes
383
384 try:
Jon Hall5c3ff722017-05-24 17:24:59 -0700385 dbFileName = "/tmp/SCPFbatchFlowRespData"
386 dbfile = open( dbFileName, "w+" )
suibin zhang17308622016-04-14 15:45:30 -0700387 temp = "'" + main.commit + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700388 temp += "'1gig',"
suibin zhang17308622016-04-14 15:45:30 -0700389 temp += "'" + str( main.scale ) + "',"
390 temp += "'" + main.cluster + "',"
391 temp += "'" + str( main.elapsePOST ) + "',"
392 temp += "'" + str( main.POSTtoCONFRM ) + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700393 temp += "'" + str( main.numFlows / main.POSTtoCONFRM ) + "',"
Jon Hall5c3ff722017-05-24 17:24:59 -0700394 temp += "'" + str( main.elapseDELETE ) + "',"
395 temp += "'" + str( main.DELtoCONFRM ) + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700396 temp += "'" + str( main.numFlows / main.DELtoCONFRM ) + "',"
397 temp += "'" + str( main.numSw ) + "'\n"
suibin zhang17308622016-04-14 15:45:30 -0700398 dbfile.write( temp )
399 dbfile.close()
400 stepResult = main.TRUE
401 except IOError:
Jon Hall5c3ff722017-05-24 17:24:59 -0700402 main.log.warn( "Error opening " + dbFileName + " to write results." )
suibin zhang17308622016-04-14 15:45:30 -0700403 stepResult = main.FALSE
404
405 utilities.assert_equals( expect=main.TRUE,
406 actual=stepResult,
407 onpass="Succeeded to write results to datafile",
408 onfail="Failed to write results to datafile " )
Jon Hall5c3ff722017-05-24 17:24:59 -0700409
suibin zhang17308622016-04-14 15:45:30 -0700410 def CASE110( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700411 """
suibin zhang17308622016-04-14 15:45:30 -0700412 Report errors/warnings/exceptions
Jon Hall5c3ff722017-05-24 17:24:59 -0700413 """
414 main.log.info( "Error report: \n" )
suibin zhang17308622016-04-14 15:45:30 -0700415 main.ONOSbench.logReport( main.ONOSip[ 0 ],
416 [ "INFO",
417 "FOLLOWER",
418 "WARN",
419 "flow",
420 "ERROR",
421 "Except" ],
422 "s" )
423 #main.stop()
424