blob: a48ddf7ca4ea40931598d372b2ae0e9a8b9dfd31 [file] [log] [blame]
kelvin-onlab1d381fe2015-07-14 16:24:56 -07001"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07002Copyright 2015 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003
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
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070011 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070012
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"""
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070021"""
kelvin-onlab1d381fe2015-07-14 16:24:56 -070022 Wrapper function for FuncTopo
23 Includes onosclidriver and mininetclidriver functions
24"""
25import time
26import json
27import re
28
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070029
kelvin-onlab1d381fe2015-07-14 16:24:56 -070030def __init__( self ):
31 self.default = ''
32
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070033
Chiyu Chengb8c2c842016-10-05 12:40:49 -070034def getTimestampFromString( main, targetString ):
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070035 # Get time string from the target string
Chiyu Chengb8c2c842016-10-05 12:40:49 -070036 try:
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070037 assert isinstance( targetString, str )
Chiyu Chengb8c2c842016-10-05 12:40:49 -070038 timeString = targetString.split( ' | ' )
39 timeString = timeString[ 0 ]
40 from datetime import datetime
41 # convert time string to timestamp
42 t = datetime.strptime( timeString, "%Y-%m-%d %H:%M:%S,%f" )
43 import time
44 timestamp = time.mktime( t.timetuple() )
45 timestamp += int( t.microsecond / 1000 ) / 1000.0
46 return timestamp
47 except AssertionError:
48 main.log.error( "Got nothing firom log" )
49 return -1
50 except IndexError:
51 main.log.error( "Time string index error" )
52 return -1
53 except ValueError:
54 main.log.error( "Got wrong string from log" )
55 return -1
56
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070057
Chiyu Cheng899621b2016-11-14 11:14:48 -080058def getRoleRequestTimeFromTshark( main ):
59 try:
60 main.log.info( "Get role request time" )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070061 with open( main.tsharkResultPath, "r" ) as resultFile:
Chiyu Cheng899621b2016-11-14 11:14:48 -080062 resultText = resultFile.readlines()
63 # select the last role request string
64 roleRequestString = resultText[ len( resultText ) - 1 ]
65 main.log.info( roleRequestString )
66 # get timestamp from role request string
67 roleRequestTime = roleRequestString.split( " " )
68 resultFile.close()
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070069 return float( roleRequestTime[ 1 ] )
Chiyu Cheng899621b2016-11-14 11:14:48 -080070 except IndexError:
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070071 main.log.error( "Got wrong role request string from Tshark file" )
Chiyu Cheng899621b2016-11-14 11:14:48 -080072 return -1
Devin Lima7cfdbd2017-09-29 15:02:22 -070073 except ValueError:
74 main.log.error( "Got wrong string from log" )
75 return -1
Chiyu Cheng899621b2016-11-14 11:14:48 -080076
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070077
78def compareTimeDiffWithRoleRequest( main, term, Mode, index=0 ):
79 """
Chiyu Cheng899621b2016-11-14 11:14:48 -080080 Description:
81 Compare the time difference between the time of target term and the time of role request
82 Inclides onosclidriver functions
83
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070084 """
Chiyu Cheng899621b2016-11-14 11:14:48 -080085 try:
Devin Lim142b5342017-07-20 15:22:39 -070086 termInfo = main.Cluster.active( index ).CLI.logSearch( mode=Mode, searchTerm=term )
Chiyu Cheng899621b2016-11-14 11:14:48 -080087 termTime = getTimestampFromString( main, termInfo[ 0 ] )
88 roleRequestTime = getRoleRequestTimeFromTshark( main )
89 if termTime == -1 or roleRequestTime == -1:
90 main.writeData = -1
91 main.log.error( "Can't compare the difference with role request time" )
92 return -1
Jon Hall465d56c2016-12-05 10:03:02 -080093 # Only concern about the absolute value of difference.
Chiyu Cheng899621b2016-11-14 11:14:48 -080094 return abs( roleRequestTime - termTime )
95 except IndexError:
96 main.log.error( "Catch the wrong information of search term " )
97 main.writeData = -1
98 return -1
Devin Lima7cfdbd2017-09-29 15:02:22 -070099 except ValueError:
100 main.log.error( "Got wrong string from log" )
101 return -1
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700102
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700103def getInfoFromLog( main, term1, mode1, term2, mode2, index=0, funcMode='TD' ):
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700104 """
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700105 Description:
106 Get needed informations of the search term from karaf.log
107 Includes onosclidriver functions
108 Function mode:
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700109 TD ( time difference ):
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700110 Get time difference between start and end
111 Term1: startTerm
112 Term2: endTerm
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700113 DR ( disconnect rate ):
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700114 Get switch disconnect rate
115 Term1: disconnectTerm
116 Term2: connectTerm
117
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700118 """
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700119 try:
Devin Lim142b5342017-07-20 15:22:39 -0700120 termInfo1 = main.Cluster.active( index ).CLI.logSearch( mode=mode1, searchTerm=term1 )
121 termInfo2 = main.Cluster.active( index ).CLI.logSearch( mode=mode2, searchTerm=term2 )
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700122 if funcMode == 'TD':
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700123 startTime = getTimestampFromString( main, termInfo1[ 0 ] )
124 endTime = getTimestampFromString( main, termInfo2[ 0 ] )
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700125 if startTime == -1 or endTime == -1:
126 main.log.error( "Wrong Time!" )
127 main.writeData = -1
128 return -1
129 return endTime - startTime
130 if funcMode == 'DR':
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700131 # In this mode, termInfo1 means the total number of switch disconnection and
132 # termInfo2 means the total number of new switch connection
133 # termInfo2 - termInfo1 means the actual real number of switch connection.
Chiyu Chengb8c2c842016-10-05 12:40:49 -0700134 disconnection = int( termInfo1 ) * 1.0
135 expectConnection = int( main.currScale ) ** 2
136 realConnection = int( termInfo2 ) - int( termInfo1 )
137 if expectConnection != realConnection:
138 main.log.error( "The number of real switch connection doesn't match the number of expected connection" )
139 main.writeData = -1
140 return -1
141 rate = disconnection / expectConnection
142 return rate
143 except IndexError:
144 main.log.error( "Catch the wrong information of search term" )
145 main.writeData = -1
146 return -1
Devin Lima7cfdbd2017-09-29 15:02:22 -0700147 except ValueError:
148 main.log.error( "Got wrong string from log" )
149 return -1
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700150
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700151def testTopology( main, topoFile='', args='', mnCmd='', timeout=300, clean=True ):
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700152 """
153 Description:
154 This function combines different wrapper functions in this module
155 to simulate a topology test
156 Test Steps:
157 - Load topology
158 - Discover topology
159 - Compare topology
160 - pingall
161 - Bring links down
162 - Compare topology
163 - pingall
164 - Bring links up
165 - Compare topology
166 - pingall
167 Options:
168 clean: Does sudo mn -c to clean mininet residue
169 Please read mininetclidriver.py >> startNet( .. ) function for details
170 Returns:
171 Returns main.TRUE if the test is successful, main.FALSE otherwise
172 """
173 testTopoResult = main.TRUE
174 compareTopoResult = main.TRUE
175 topoObjectResult = main.TRUE
176 stopResult = main.TRUE
177
178 if clean:
179 # Cleans minient
180 stopResult = stopMininet( main )
181
182 # Restart ONOS to clear hosts test new mininet topology
183 reinstallOnosResult = reinstallOnos( main )
184
185 # Starts topology
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700186 startResult = startNewTopology( main, topoFile, args, mnCmd, timeout=timeout )
GlennRC1c5df3c2015-08-27 16:12:09 -0700187 # onos needs time to see the links
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700188 time.sleep( 15 )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700189
190 # Gets list of switches in mininet
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700191 # assignSwitch( main )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700192
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700193 testTopoResult = startResult and topoObjectResult
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700194
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700195 return testTopoResult
196
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700197
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700198def startNewTopology( main, topoFile='', args='', mnCmd='', timeout=900 ):
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700199 """
200 Description:
201 This wrapper function starts new topology
202 Options:
203 Please read mininetclidriver.py >> startNet( .. ) function for details
204 Return:
205 Returns main.TRUE if topology is successfully created by mininet,
206 main.FALSE otherwise
207 NOTE:
208 Assumes Mininet1 is the name of the handler
209 """
210 assert main, "There is no main variable"
211 assert main.Mininet1, "Mininet 1 is not created"
212 result = main.TRUE
213
214 main.log.info( main.topoName + ": Starting new Mininet topology" )
215
216 # log which method is being used
217 if topoFile:
218 main.log.info( main.topoName + ": Starting topology with " +
219 topoFile + "topology file" )
220 elif not topoFile and not mnCmd:
221 main.log.info( main.topoName + ": Starting topology using" +
222 " the topo file" )
223 elif topoFile and mnCmd:
224 main.log.error( main.topoName + ": You can only use one " +
225 "method to start a topology" )
226 elif mnCmd:
227 main.log.info( main.topoName + ": Starting topology with '" +
228 mnCmd + "' Mininet command" )
229
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700230 result = main.Mininet1.startNet( topoFile=topoFile,
231 args=args,
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700232 mnCmd=mnCmd,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700233 timeout=timeout )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700234
235 return result
236
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700237
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700238def stopMininet( main ):
239 """
240 Stops current topology and execute mn -c basically triggers
241 stopNet in mininetclidrivers
242
243 NOTE: Mininet should be running when issuing this command other wise
244 the this function will cause the test to stop
245 """
246 stopResult = main.TRUE
247 stopResult = main.Mininet1.stopNet()
248 time.sleep( 30 )
249 if not stopResult:
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700250 main.log.info( main.topoName + ": Did not stop Mininet topology" )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700251 return stopResult
252
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700253
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700254def compareTopo( main ):
255 """
256 Compare topology( devices, links, ports, hosts ) between ONOS and
257 mininet using sts
258 """
Devin Lim142b5342017-07-20 15:22:39 -0700259 try:
260 from tests.dependencies.topology import Topology
261 except ImportError:
262 main.log.error( "Topology not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700263 main.cleanAndExit()
Devin Lim142b5342017-07-20 15:22:39 -0700264 try:
265 main.topoRelated
266 except ( NameError, AttributeError ):
267 main.topoRelated = Topology()
268 return main.topoRelated.compareTopos( main.Mininet1 )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700269
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700270
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700271def assignSwitch( main ):
272 """
273 Returns switch list using getSwitch in Mininet driver
274 """
275 switchList = []
276 assignResult = main.TRUE
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700277 switchList = main.Mininet1.getSwitch()
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700278 assignResult = main.Mininet1.assignSwController( sw=switchList,
Devin Lim142b5342017-07-20 15:22:39 -0700279 ip=main.Cluster.active( 0 ).ipAddress,
GlennRC632e2892015-10-19 18:58:41 -0700280 port=6633 )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700281
282 for sw in switchList:
283 response = main.Mininet1.getSwController( sw )
Devin Lim142b5342017-07-20 15:22:39 -0700284 if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700285 assignResult = assignResult and main.TRUE
286 else:
287 assignResult = main.FALSE
288
289 return switchList
290
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700291
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700292def connectivity( main, timeout=900, shortCircuit=True, acceptableFailed=20 ):
293 """
294 Use fwd app and pingall to discover all the hosts
295 """
296 activateResult = main.TRUE
297 appCheck = main.TRUE
298 getDataResult = main.TRUE
299 main.log.info( main.topoName + ": Activating reactive forwarding app " )
Devin Lim142b5342017-07-20 15:22:39 -0700300 activateResult = main.Cluster.active( 0 ).activateApp( "org.onosproject.fwd" )
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700301
302 if main.hostsData:
303 main.hostsData = {}
Devin Lim142b5342017-07-20 15:22:39 -0700304 for ctrl in main.Cluster.active():
305 appCheck = appCheck and ctrl.CLI.appToIDCheck()
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700306 if appCheck != main.TRUE:
Devin Lim142b5342017-07-20 15:22:39 -0700307 main.log.warn( ctrl.CLI.apps() )
308 main.log.warn( ctrl.CLI.appIDs() )
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700309
310 time.sleep( main.fwdSleep )
311
312 # Discover hosts using pingall
313 pingResult = main.Mininet1.pingall( timeout=timeout,
314 shortCircuit=shortCircuit,
315 acceptableFailed=acceptableFailed )
316
317 main.log.info( main.topoName + ": Deactivate reactive forwarding app " )
Devin Lim142b5342017-07-20 15:22:39 -0700318 activateResult = main.Cluster.active( 0 ).deactivateApp( "org.onosproject.fwd" )
319 for ctrl in main.Cluster.active():
320 appCheck = appCheck and ctrl.CLI.appToIDCheck()
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700321 if appCheck != main.TRUE:
Devin Lim142b5342017-07-20 15:22:39 -0700322 main.log.warn( ctrl.CLI.apps() )
323 main.log.warn( ctrl.CLI.appIDs() )
kelvin-onlabd9e23de2015-08-06 10:34:44 -0700324
325 return pingResult
326
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700327
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700328def getHostsData( main ):
329 """
330 Use fwd app and pingall to discover all the hosts
331 """
332 activateResult = main.TRUE
333 appCheck = main.TRUE
334 getDataResult = main.TRUE
335 main.log.info( main.topoName + ": Activating reactive forwarding app " )
Devin Lim142b5342017-07-20 15:22:39 -0700336 activateResult = main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.fwd" )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700337
338 if main.hostsData:
339 main.hostsData = {}
Devin Lim142b5342017-07-20 15:22:39 -0700340 for ctrl in main.Cluster.active():
341 appCheck = appCheck and ctrl.CLI.appToIDCheck()
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700342 if appCheck != main.TRUE:
Devin Lim142b5342017-07-20 15:22:39 -0700343 main.log.warn( ctrl.CLI.apps() )
344 main.log.warn( ctrl.CLI.appIDs() )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700345
346 time.sleep( main.fwdSleep )
347 # Discover hosts using pingall
348 pingResult = main.Mininet1.pingall( timeout=900 )
349
Devin Lim142b5342017-07-20 15:22:39 -0700350 hostsJson = json.loads( main.Cluster.active( 0 ).CLI.hosts() )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700351 hosts = main.Mininet1.getHosts().keys()
352
353 for host in hosts:
354 main.hostsData[ host ] = {}
355 main.hostsData[ host ][ 'mac' ] = \
356 main.Mininet1.getMacAddress( host ).upper()
357 for hostj in hostsJson:
358 if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
359 main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
360 main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
361 main.hostsData[ host ][ 'location' ] = \
Jeremy Ronquillo0e538bc2017-06-13 15:16:09 -0700362 hostj[ 'locations' ][ 0 ][ 'elementId' ] + '/' + \
363 hostj[ 'locations' ][ 0 ][ 'port' ]
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700364 main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
365
366 if activateResult and main.hostsData:
367 main.log.info( main.topoName + ": Successfully used fwd app" +
368 " to discover hosts " )
369 getDataResult = main.TRUE
370 else:
371 main.log.info( main.topoName + ": Failed to use fwd app" +
372 " to discover hosts " )
373 getDataResult = main.FALSE
374
375 main.log.info( main.topoName + ": Deactivate reactive forwarding app " )
Devin Lim142b5342017-07-20 15:22:39 -0700376 activateResult = main.Cluster.active( 0 ).CLI.deactivateApp( "org.onosproject.fwd" )
377 for ctrl in main.Cluster.active():
378 appCheck = appCheck and ctrl.CLI.appToIDCheck()
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700379 if appCheck != main.TRUE:
Devin Lim142b5342017-07-20 15:22:39 -0700380 main.log.warn( ctrl.CLI.apps() )
381 main.log.warn( ctrl.CLI.appIDs() )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700382
383 # This data can be use later for intents
384 print main.hostsData
385
386 return getDataResult
387
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700388
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700389def reinstallOnos( main ):
390 """
391 Description:
392 Stop and start ONOS that clears hosts,devices etc. in order to test
393 new mininet topology
394 Return:
395 Retruns main.TRUE for a successful restart, main.FALSE otherwise.
396 """
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700397 stopResult = []
398 startResult = []
399 onosIsUpResult = []
400 restartResult = main.TRUE
401
Devin Lim142b5342017-07-20 15:22:39 -0700402 uninstallResult = main.testSetUp.uninstallOnos( main.Cluster, False )
403 if uninstallResult != main.TRUE:
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700404 restartResult = main.FALSE
Devin Lim142b5342017-07-20 15:22:39 -0700405 installResult = main.testSetUp.installOnos( main.Cluster, False )
406 if installResult != main.TRUE:
You Wangf5de25b2017-01-06 15:13:01 -0800407 restartResult = main.FALSE
408
Devin Lim142b5342017-07-20 15:22:39 -0700409 secureSshResult = main.testSetUp.setupSsh( main.Cluster )
410 if secureSshResult != main.TRUE:
411 restartResult = main.FALSE
412
413 for ctrl in main.Cluster.runningNodes:
414 onosIsUpResult.append( main.ONOSbench.isup( ctrl.ipAddress ) )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700415
416 if all( result == main.TRUE for result in onosIsUpResult ):
417 main.log.report( "ONOS instance is up and ready" )
418 else:
419 main.log.report( "ONOS instance may not be up, stop and " +
420 "start ONOS again " )
Devin Lim142b5342017-07-20 15:22:39 -0700421 for ctrl in main.Cluster.runningNodes:
422 stopResult.append( main.ONOSbench.onosStop( ctrl.ipAddress ) )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700423
424 if all( result == main.TRUE for result in stopResult ):
425 main.log.info( main.topoName + ": Successfully stop ONOS cluster" )
426 else:
427 main.log.error( main.topoName + ": Failed to stop ONOS cluster" )
428
Devin Lim142b5342017-07-20 15:22:39 -0700429 for ctrl in main.Cluster.runningNodes:
430 startResult.append( main.ONOSbench.onosStart( ctrl.ipAddress ) )
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700431
432 if all( result == main.TRUE for result in startResult ):
433 main.log.info( main.topoName + ": Successfully start ONOS cluster" )
434 else:
435 main.log.error( main.topoName + ": Failed to start ONOS cluster" )
436
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700437 main.log.info( main.topoName + ": Starting ONOS CLI" )
Devin Lim142b5342017-07-20 15:22:39 -0700438 cliResult = main.testSetUp.startOnosClis( main.Cluster )
439 if cliResult != main.TRUE:
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700440 restartResult = main.FALSE
441
kelvin-onlab1d381fe2015-07-14 16:24:56 -0700442 return restartResult
Devin Lim4a87b2a2017-10-11 18:23:12 -0700443
444def checkingONOSStablility( main ):
445 compareRetry = 0
446 while compareRetry < 3 and main.postResult:
447 for controller in main.Cluster.active():
448 if controller.CLI.summary() is None:
449 main.info.error( "Something happened to ONOS. Skip the rest of the steps" )
450 main.postResult = False
451 break
452 time.sleep( 5 )
453 compareRetry += 1
454 time.sleep( 10 )