blob: 2757598ed537863e4f729fad0657cf322caf83da [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' ] )
62 main.onosPackaging = main.params[ 'CASE2' ][ 'incPackaging' ] == "true"
63 main.cfgSleep = float( main.params[ 'GLOBAL' ][ 'SLEEP' ][ 'cfg' ] )
64 main.numSw = int( main.params[ 'GLOBAL' ][ 'numSw' ] )
65 main.numThreads = int( main.params[ 'GLOBAL' ][ 'numThreads' ] )
66 main.cluster = main.params[ 'GLOBAL' ][ 'cluster' ]
suibin zhang17308622016-04-14 15:45:30 -070067
Devin Lim58046fa2017-07-05 16:55:00 -070068 stepResult = main.testSetUp.envSetup()
69 except Exception as e:
70 main.testSetUp.envSetupException( e )
71 main.testSetUp.evnSetupConclusion( stepResult )
Jon Hall5c3ff722017-05-24 17:24:59 -070072 main.commit = main.commit.split( " " )[ 1 ]
YPZhang28909bc2016-06-20 13:29:11 -070073
suibin zhang17308622016-04-14 15:45:30 -070074
75 def CASE2( self, main ):
76 """
77 - Set up cell
78 - Create cell file
79 - Set cell file
80 - Verify cell file
81 - Kill ONOS process
82 - Uninstall ONOS cluster
83 - Verify ONOS start up
84 - Install ONOS cluster
85 - Connect to cli
86 """
Devin Lim58046fa2017-07-05 16:55:00 -070087 main.testSetUp.ONOSSetUp( main.Mininet1, skipPack=main.onosPackaging )
suibin zhang17308622016-04-14 15:45:30 -070088
suibin zhang17308622016-04-14 15:45:30 -070089 def CASE10( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -070090 """
suibin zhang17308622016-04-14 15:45:30 -070091 Start Mininet
Jon Hall5c3ff722017-05-24 17:24:59 -070092 """
suibin zhang17308622016-04-14 15:45:30 -070093 import time
94
95 main.case( "Enable openflow-base on onos and start Mininet." )
96
Jon Hall5c3ff722017-05-24 17:24:59 -070097 main.step( "Activate openflow-base App" )
98 app = main.params[ 'CASE10' ][ 'app' ]
YPZhang5d0552f2016-05-18 13:02:52 -070099 stepResult = main.ONOScli1.activateApp( app )
Jon Hall5c3ff722017-05-24 17:24:59 -0700100 time.sleep( main.cfgSleep )
101 main.log.info( stepResult )
suibin zhang17308622016-04-14 15:45:30 -0700102 utilities.assert_equals( expect=main.TRUE,
103 actual=stepResult,
104 onpass="Successfully activate " + app,
105 onfail="Failed to activate app " + app )
106
Jon Hall5c3ff722017-05-24 17:24:59 -0700107 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700108
Jon Hall5c3ff722017-05-24 17:24:59 -0700109 main.step( "Configure AdaptiveFlowSampling " )
110 stepResult = main.ONOScli1.setCfg( component="org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider",
111 propName="adaptiveFlowSampling ", value=main.params[ 'CASE10' ][ 'adaptiveFlowenabled' ] )
suibin zhang17308622016-04-14 15:45:30 -0700112 utilities.assert_equals( expect=main.TRUE,
113 actual=stepResult,
114 onpass="App Configuration Succeeded! ",
115 onfail="App Configuration Failed!" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700116 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700117
Jon Hall5c3ff722017-05-24 17:24:59 -0700118 main.step( "Setup Mininet Linear Topology with " + str( main.numSw ) + " switches" )
119 argStr = main.params[ 'CASE10' ][ 'mnArgs' ].format( main.numSw )
120 stepResult = main.Mininet1.startNet( args=argStr )
suibin zhang17308622016-04-14 15:45:30 -0700121
122 utilities.assert_equals( expect=main.TRUE,
123 actual=stepResult,
124 onpass="Successfully loaded topology",
125 onfail="Failed to load topology" )
126
127 time.sleep( main.startMNSleep )
128
129 main.step( "Assign switches to controller" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700130 for i in range( 1, main.numSw + 1 ):
131 main.Mininet1.assignSwController( "s" + str( i ), main.ONOSip[ 0 ] )
suibin zhang17308622016-04-14 15:45:30 -0700132
133 utilities.assert_equals( expect=main.TRUE,
134 actual=stepResult,
135 onpass="Successfully assigned switch to controller",
136 onfail="Failed to assign switch to controller" )
137
138 main.deviceIdPrefix = "of:"
139
140 time.sleep( main.startMNSleep )
141
142 def CASE11( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700143 """
suibin zhang17308622016-04-14 15:45:30 -0700144 Start Null Provider
Jon Hall5c3ff722017-05-24 17:24:59 -0700145 """
suibin zhang17308622016-04-14 15:45:30 -0700146 import time
147
148 main.case( "Setup Null Provider for linear Topology" )
149
Jon Hall5c3ff722017-05-24 17:24:59 -0700150 main.step( "Activate Null Provider App" )
151 stepResult = main.ONOSbench.onosCli( ONOSIp=main.ONOSip[ 0 ],
152 cmdstr="app activate org.onosproject.null" )
suibin zhang17308622016-04-14 15:45:30 -0700153 utilities.assert_equals( expect=main.TRUE,
154 actual=stepResult,
155 onpass="Successfully activated org.onosproject.null",
156 onfail="Failed to activate org.onosproject.null" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700157 time.sleep( main.cfgSleep )
suibin zhang17308622016-04-14 15:45:30 -0700158
Jon Hall5c3ff722017-05-24 17:24:59 -0700159 main.step( "Setup Null Provider Linear Topology with " + str( main.numSw ) + " devices." )
160 r1 = main.ONOSbench.onosCfgSet( main.ONOSip[ 0 ], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str( main.numSw ) )
161 r2 = main.ONOSbench.onosCfgSet( main.ONOSip[ 0 ], "org.onosproject.provider.nil.NullProviders", "topoShape " + main.params[ 'CASE11' ][ 'nullTopo' ] )
162 r3 = main.ONOSbench.onosCfgSet( main.ONOSip[ 0 ], "org.onosproject.provider.nil.NullProviders", "enabled " + main.params[ 'CASE11' ][ 'nullStart' ] )
suibin zhang17308622016-04-14 15:45:30 -0700163 stepResult = r1 & r2 & r3
164 utilities.assert_equals( expect=main.TRUE,
165 actual=stepResult,
166 onpass="App Configuration Succeeded! ",
167 onfail="App Configuration Failed!" )
168 time.sleep( main.cfgSleep )
169
Jon Hall5c3ff722017-05-24 17:24:59 -0700170 main.log.info( "Check to make sure null providers are configured correctly." )
171 main.ONOSbench.handle.sendline( "onos $OC1 summary" )
172 stepResult = main.ONOSbench.handle.expect( ":~" )
173 main.log.info( "ONOS Summary: " + main.ONOSbench.handle.before )
suibin zhang17308622016-04-14 15:45:30 -0700174
175 main.deviceIdPrefix = "null:"
176
177 time.sleep( main.startMNSleep )
178
suibin zhang17308622016-04-14 15:45:30 -0700179 def CASE1000( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700180 """
suibin zhang17308622016-04-14 15:45:30 -0700181 create JSON object with batched flows
Jon Hall5c3ff722017-05-24 17:24:59 -0700182 """
suibin zhang17308622016-04-14 15:45:30 -0700183 import numpy
184 import time
185 from pprint import pprint
186
187 main.case( "Create a json object for the batched flows" )
188
189 main.step( "Parse batch creation information" )
Jon Hall5c3ff722017-05-24 17:24:59 -0700190 main.batchSize = int( main.params[ 'CASE1000' ][ 'batchSize' ] )
191 main.log.info( "Number of flows in a batch is:" + str( main.batchSize ) )
suibin zhang17308622016-04-14 15:45:30 -0700192
193 main.flowJsonBatchList = []
194 startSw = 1
195
Jon Hall5c3ff722017-05-24 17:24:59 -0700196 main.step( "Creating a full list of batches" )
197 for index in range( 1, int( main.params[ 'CASE1000' ][ 'batches' ] ) + 1 ):
suibin zhang17308622016-04-14 15:45:30 -0700198 if startSw <= main.numSw:
199 ind = startSw
200 else:
201 startSw = 1
202 ind = startSw
203
Jon Hall5c3ff722017-05-24 17:24:59 -0700204 main.log.info( "Creating batch: " + str( index ) )
205 flowJsonBatch = main.ONOSrest.createFlowBatch( numSw=main.numSw,
206 swIndex=ind,
207 batchSize=main.batchSize,
208 batchIndex=index,
suibin zhang17308622016-04-14 15:45:30 -0700209 deviceIdpreFix=main.deviceIdPrefix,
Jon Hall5c3ff722017-05-24 17:24:59 -0700210 ingressPort=2,
211 egressPort=3 )
212 main.flowJsonBatchList.append( flowJsonBatch )
suibin zhang17308622016-04-14 15:45:30 -0700213
214 startSw += 1
Jon Hall5c3ff722017-05-24 17:24:59 -0700215 main.log.info( "Number of items created in the batch list is: " + str( len( main.flowJsonBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700216
Jon Hall5c3ff722017-05-24 17:24:59 -0700217 def CASE2100( self, main ):
218 """
suibin zhang17308622016-04-14 15:45:30 -0700219 Posting flow batches using threads
Jon Hall5c3ff722017-05-24 17:24:59 -0700220 """
221 main.case( "Using REST API /flows/{} to post flow batch - multi-threads" )
222 main.step( "Using REST API /flows/{} to post flow batch - multi-threads" )
suibin zhang17308622016-04-14 15:45:30 -0700223
224 from Queue import Queue
225 from threading import Thread
226 import time
227 import json
228
229 main.threadID = 0
230 main.addedBatchList = []
231 q = Queue()
232 tAllAdded = 0
You Wang7b5b2262016-11-10 13:54:56 -0800233 main.postFailed = False
suibin zhang17308622016-04-14 15:45:30 -0700234
Jon Hall5c3ff722017-05-24 17:24:59 -0700235 def postWorker( id ):
suibin zhang17308622016-04-14 15:45:30 -0700236 while True:
237 item = q.get()
Jon Hall5c3ff722017-05-24 17:24:59 -0700238 #print json.dumps( item )
239 status, response = main.ONOSrest.sendFlowBatch( batch=item )
You Wang7b5b2262016-11-10 13:54:56 -0800240 if status == main.TRUE:
Jon Hall5c3ff722017-05-24 17:24:59 -0700241 main.log.info( "Thread {} is working on posting. ".format( id ) )
242 #print json.dumps( response )
243 main.addedBatchList.append( response[ 1 ] )
You Wang7b5b2262016-11-10 13:54:56 -0800244 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700245 main.log.error( "Thread {} failed to post.".format( id ) )
You Wang7b5b2262016-11-10 13:54:56 -0800246 main.postFailed = True
suibin zhang17308622016-04-14 15:45:30 -0700247 q.task_done()
248
Jon Hall5c3ff722017-05-24 17:24:59 -0700249 for i in range( int( main.params[ 'CASE2100' ][ 'numThreads' ] ) ):
250 threadID = "ThreadID-" + str( i )
251 t = Thread( target=postWorker, name=threadID, args=( threadID, ) )
suibin zhang17308622016-04-14 15:45:30 -0700252 t.daemon = True
253 t.start()
254
255 tStartPost = time.time()
256 for item in main.flowJsonBatchList:
Jon Hall5c3ff722017-05-24 17:24:59 -0700257 q.put( item )
suibin zhang17308622016-04-14 15:45:30 -0700258
259 q.join()
260 tLastPostEnd = time.time()
You Wang7b5b2262016-11-10 13:54:56 -0800261 if main.postFailed:
262 main.log.error( "Flow batch posting failed, exit test" )
263 main.cleanup()
264 main.exit()
suibin zhang17308622016-04-14 15:45:30 -0700265
Jon Hall5c3ff722017-05-24 17:24:59 -0700266 main.step( "Check to ensure all flows are in added state." )
267 #pprint( main.addedBatchList )
suibin zhang17308622016-04-14 15:45:30 -0700268 resp = main.FALSE
Jon Hall5c3ff722017-05-24 17:24:59 -0700269 while resp != main.TRUE and ( tAllAdded - tLastPostEnd < int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ) ):
270 if main.params[ 'CASE2100' ][ 'RESTchkFlow' ] == 'main.TRUE':
suibin zhang17308622016-04-14 15:45:30 -0700271 resp = main.ONOSrest.checkFlowsState()
272 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700273 handle = main.CLIs[ 0 ].flows( state=" |grep PEND|wc -l", jsonFormat=False )
274 main.log.info( "handle returns PENDING flows: " + handle )
suibin zhang17308622016-04-14 15:45:30 -0700275 if handle == "0":
276 resp = main.TRUE
277
278 time.sleep( main.chkFlowSleep )
279 tAllAdded = time.time()
280
Jon Hall5c3ff722017-05-24 17:24:59 -0700281 if tAllAdded - tLastPostEnd >= int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ):
282 main.log.warn( "ONOS Flows still in pending state after: {} seconds.".format( tAllAdded - tLastPostEnd ) )
suibin zhang17308622016-04-14 15:45:30 -0700283
Jon Hall5c3ff722017-05-24 17:24:59 -0700284 main.numFlows = int( main.params[ 'CASE1000' ][ 'batches' ] ) *\
285 int( main.params[ 'CASE1000' ][ 'batchSize' ] )
286 main.log.info( "Total number of flows: " + str( main.numFlows ) )
287 main.elapsePOST = tLastPostEnd - tStartPost
288 main.log.info( "Total POST elapse time: " + str( main.elapsePOST ) )
289 main.log.info( "Rate of ADD Controller response: " + str( main.numFlows / ( main.elapsePOST ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700290
291 main.POSTtoCONFRM = tAllAdded - tLastPostEnd
Jon Hall5c3ff722017-05-24 17:24:59 -0700292 main.log.info( "Elapse time from end of last REST POST to Flows in ADDED state: " +
293 str( main.POSTtoCONFRM ) )
294 main.log.info( "Rate of Confirmed Batch Flow ADD is ( flows/sec ): " +
295 str( main.numFlows / main.POSTtoCONFRM ) )
296 main.log.info( "Number of flow Batches in the addedBatchList is: " +
297 str( len( main.addedBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700298
Jon Hall5c3ff722017-05-24 17:24:59 -0700299 def CASE3100( self, main ):
300 """
suibin zhang17308622016-04-14 15:45:30 -0700301 DELETE flow batches using threads
Jon Hall5c3ff722017-05-24 17:24:59 -0700302 """
303 main.case( "Using REST API /flows/{} to delete flow batch - multi-threads" )
304 main.step( "Using REST API /flows/{} to delete flow batch - multi-threads" )
suibin zhang17308622016-04-14 15:45:30 -0700305
306 from Queue import Queue
307 from threading import Thread
308 import time
309 import json
310
311 main.threadID = 0
312 q = Queue()
313 tAllRemoved = 0
314
Jon Hall5c3ff722017-05-24 17:24:59 -0700315 main.log.info( "Number of flow batches at start of remove: " + str( len( main.addedBatchList ) ) )
316
317 def removeWorker( id ):
suibin zhang17308622016-04-14 15:45:30 -0700318 while True:
319 item = q.get()
Jon Hall5c3ff722017-05-24 17:24:59 -0700320 response = main.ONOSrest.removeFlowBatch( batch=json.loads( item ) )
321 main.log.info( "Thread {} is working on deleting. ".format( id ) )
suibin zhang17308622016-04-14 15:45:30 -0700322 q.task_done()
323
Jon Hall5c3ff722017-05-24 17:24:59 -0700324 for i in range( int( main.params[ 'CASE2100' ][ 'numThreads' ] ) ):
325 threadID = "ThreadID-" + str( i )
326 t = Thread( target=removeWorker, name=threadID, args=( threadID, ) )
suibin zhang17308622016-04-14 15:45:30 -0700327 t.daemon = True
328 t.start()
329
330 tStartDelete = time.time()
331 for item in main.addedBatchList:
Jon Hall5c3ff722017-05-24 17:24:59 -0700332 q.put( item )
suibin zhang17308622016-04-14 15:45:30 -0700333
334 q.join()
335 tLastDeleteEnd = time.time()
Jon Hall5c3ff722017-05-24 17:24:59 -0700336 main.log.info( "Number of flow batches at end of remove: " + str( len( main.addedBatchList ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700337
Jon Hall5c3ff722017-05-24 17:24:59 -0700338 main.step( "Check to ensure all flows are in added state." )
339 #pprint( main.addedBatchList )
suibin zhang17308622016-04-14 15:45:30 -0700340 resp = main.FALSE
Jon Hall5c3ff722017-05-24 17:24:59 -0700341 while resp != main.TRUE and ( tAllRemoved - tLastDeleteEnd < int( main.params[ 'CASE3100' ][ 'chkFlowTO' ] ) ):
342 if main.params[ 'CASE3100' ][ 'RESTchkFlow' ] == 'main.TRUE':
suibin zhang17308622016-04-14 15:45:30 -0700343 resp = main.ONOSrest.checkFlowsState()
344 else:
Jon Hall5c3ff722017-05-24 17:24:59 -0700345 handle = main.CLIs[ 0 ].flows( state=" |grep PEND|wc -l", jsonFormat=False )
346 main.log.info( "handle returns PENDING flows: " + handle )
suibin zhang17308622016-04-14 15:45:30 -0700347 if handle == "0":
348 resp = main.TRUE
349 time.sleep( main.chkFlowSleep )
350 tAllRemoved = time.time()
351
Jon Hall5c3ff722017-05-24 17:24:59 -0700352 if tLastDeleteEnd - tLastDeleteEnd >= int( main.params[ 'CASE2100' ][ 'chkFlowTO' ] ):
353 main.log.warn( "ONOS Flows still in pending state after: {} seconds.".format( tAllRemoved - tLastDeleteEnd ) )
suibin zhang17308622016-04-14 15:45:30 -0700354
Jon Hall5c3ff722017-05-24 17:24:59 -0700355 main.numFlows = int( main.params[ 'CASE1000' ][ 'batches' ] ) *\
356 int( main.params[ 'CASE1000' ][ 'batchSize' ] )
357 main.log.info( "Total number of flows: " + str( main.numFlows ) )
358 main.elapseDELETE = tLastDeleteEnd - tStartDelete
359 main.log.info( "Total DELETE elapse time: " + str( main.elapseDELETE ) )
360 main.log.info( "Rate of DELETE Controller response: " + str( main.numFlows / ( main.elapseDELETE ) ) )
suibin zhang17308622016-04-14 15:45:30 -0700361
362 main.DELtoCONFRM = tAllRemoved - tLastDeleteEnd
Jon Hall5c3ff722017-05-24 17:24:59 -0700363 main.log.info( "Elapse time from end of last REST DELETE to Flows in REMOVED state: " +
364 str( main.DELtoCONFRM ) )
365 main.log.info( "Rate of Confirmed Batch Flow REMOVED is ( flows/sec ): " + str( main.numFlows / main.DELtoCONFRM ) )
suibin zhang17308622016-04-14 15:45:30 -0700366
Jon Hall5c3ff722017-05-24 17:24:59 -0700367 def CASE100( self, main ):
suibin zhang17308622016-04-14 15:45:30 -0700368 from pprint import pprint
369
370 main.case( "Check to ensure onos flows." )
371
372 resp = main.ONOSrest.checkFlowsState()
Jon Hall5c3ff722017-05-24 17:24:59 -0700373 #pprint( resp )
suibin zhang17308622016-04-14 15:45:30 -0700374
Jon Hall5c3ff722017-05-24 17:24:59 -0700375 def CASE210( self, main ):
376 main.case( "Log test results to a data file" )
377 main.step( "Write test resulted data to a data file" )
suibin zhang17308622016-04-14 15:45:30 -0700378 main.scale = main.maxNodes
379
380 try:
Jon Hall5c3ff722017-05-24 17:24:59 -0700381 dbFileName = "/tmp/SCPFbatchFlowRespData"
382 dbfile = open( dbFileName, "w+" )
suibin zhang17308622016-04-14 15:45:30 -0700383 temp = "'" + main.commit + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700384 temp += "'1gig',"
suibin zhang17308622016-04-14 15:45:30 -0700385 temp += "'" + str( main.scale ) + "',"
386 temp += "'" + main.cluster + "',"
387 temp += "'" + str( main.elapsePOST ) + "',"
388 temp += "'" + str( main.POSTtoCONFRM ) + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700389 temp += "'" + str( main.numFlows / main.POSTtoCONFRM ) + "',"
Jon Hall5c3ff722017-05-24 17:24:59 -0700390 temp += "'" + str( main.elapseDELETE ) + "',"
391 temp += "'" + str( main.DELtoCONFRM ) + "',"
YPZhang28909bc2016-06-20 13:29:11 -0700392 temp += "'" + str( main.numFlows / main.DELtoCONFRM ) + "',"
393 temp += "'" + str( main.numSw ) + "'\n"
suibin zhang17308622016-04-14 15:45:30 -0700394 dbfile.write( temp )
395 dbfile.close()
396 stepResult = main.TRUE
397 except IOError:
Jon Hall5c3ff722017-05-24 17:24:59 -0700398 main.log.warn( "Error opening " + dbFileName + " to write results." )
suibin zhang17308622016-04-14 15:45:30 -0700399 stepResult = main.FALSE
400
401 utilities.assert_equals( expect=main.TRUE,
402 actual=stepResult,
403 onpass="Succeeded to write results to datafile",
404 onfail="Failed to write results to datafile " )
Jon Hall5c3ff722017-05-24 17:24:59 -0700405
suibin zhang17308622016-04-14 15:45:30 -0700406 def CASE110( self, main ):
Jon Hall5c3ff722017-05-24 17:24:59 -0700407 """
suibin zhang17308622016-04-14 15:45:30 -0700408 Report errors/warnings/exceptions
Jon Hall5c3ff722017-05-24 17:24:59 -0700409 """
410 main.log.info( "Error report: \n" )
suibin zhang17308622016-04-14 15:45:30 -0700411 main.ONOSbench.logReport( main.ONOSip[ 0 ],
412 [ "INFO",
413 "FOLLOWER",
414 "WARN",
415 "flow",
416 "ERROR",
417 "Except" ],
418 "s" )
419 #main.stop()
420