blob: 88998453efb4f4453260069884c63340add7f0f2 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
9class OnosCHO:
10
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
17 git pull
18 mvn clean install
19 onos-package
20 apply cell <name>
21 onos-verify-cell
22 onos-uninstall
23 onos-install
24 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
30 main.pingTimeout = 300
31 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
32 cell_name = main.params[ 'ENV' ][ 'cellName' ]
33 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
34 git_branch = main.params[ 'GIT' ][ 'branch' ]
35 main.newTopo = ""
36 main.CLIs = []
37 main.onosIPs = []
38 main.onosPorts = []
39
40 for i in range( 1, int(main.numCtrls) + 1 ):
41 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
42 main.onosPorts.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
43
44 main.case( "Set up test environment" )
45 main.log.report( "Set up test environment" )
46 main.log.report( "_______________________" )
47
48 main.step( "Git checkout and pull " + git_branch )
49 if git_pull == 'on':
50 checkout_result = main.ONOSbench.gitCheckout( git_branch )
51 pull_result = main.ONOSbench.gitPull()
52 cp_result = ( checkout_result and pull_result )
53 else:
54 checkout_result = main.TRUE
55 pull_result = main.TRUE
56 main.log.info( "Skipped git checkout and pull" )
57 cp_result = ( checkout_result and pull_result )
58 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
59 onpass="Test step PASS",
60 onfail="Test step FAIL" )
61
62 main.step( "mvn clean & install" )
63 if git_pull == 'on':
64 mvn_result = main.ONOSbench.cleanInstall()
65 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
66 onpass="Test step PASS",
67 onfail="Test step FAIL" )
68 else:
69 mvn_result = main.TRUE
70 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
71
72 main.ONOSbench.getVersion( report=True )
73
74 main.step( "Apply Cell environment for ONOS" )
75 cell_result = main.ONOSbench.setCell( cell_name )
76 onosNodes = main.ONOSbench.getOnosIPfromCell()
77 main.onosIPs = onosNodes
78 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
79 onpass="Test step PASS",
80 onfail="Test step FAIL" )
81
82 main.step( "Create ONOS package" )
83 packageResult = main.ONOSbench.onosPackage()
84 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
85 onpass="Test step PASS",
86 onfail="Test step FAIL" )
87
88 main.step( "Uninstall ONOS package on all Nodes" )
89 uninstallResult = main.TRUE
90 for i in range( int( main.numCtrls ) ):
91 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
92 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
93 utilities.assert_equals( expect=main.TRUE, actual=u_result,
94 onpass="Test step PASS",
95 onfail="Test step FAIL" )
96 uninstallResult = ( uninstallResult and u_result )
97
98 main.step( "Install ONOS package on all Nodes" )
99 installResult = main.TRUE
100 for i in range( int( main.numCtrls ) ):
101 main.log.info( "Intsalling package on ONOS Node IP: " + main.onosIPs[i] )
102 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
103 utilities.assert_equals( expect=main.TRUE, actual=i_result,
104 onpass="Test step PASS",
105 onfail="Test step FAIL" )
106 installResult = ( installResult and i_result )
107
108 main.step( "Verify ONOS nodes UP status" )
109 statusResult = main.TRUE
110 for i in range( int( main.numCtrls ) ):
111 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
112 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
113 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
114 onpass="Test step PASS",
115 onfail="Test step FAIL" )
116 statusResult = ( statusResult and onos_status )
117
118 main.step( "Start ONOS CLI on all nodes" )
119 cliResult = main.TRUE
120 karafTimeout = "3600000"
121 main.log.step(" Start ONOS cli using thread ")
122 startCliResult = main.TRUE
123 pool = []
124 time1 = time.time()
125 for i in range( int( main.numCtrls) ):
126 t = main.Thread( target=main.CLIs[i].startOnosCli,
127 threadID=main.threadID,
128 name="startOnosCli",
129 args=[ main.onosIPs[i], karafTimeout ] )
130 pool.append(t)
131 t.start()
132 main.threadID = main.threadID + 1
133 for t in pool:
134 t.join()
135 startCliResult = startCliResult and t.result
136 time2 = time.time()
137
138 if not startCliResult:
139 main.log.info("ONOS CLI did not start up properly")
140 main.cleanup()
141 main.exit()
142 else:
143 main.log.info("Successful CLI startup")
144 startCliResult = main.TRUE
145 case1Result = installResult and uninstallResult and statusResult and startCliResult
146 time.sleep(30)
147 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
148 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
149 onpass="Set up test environment PASS",
150 onfail="Set up test environment FAIL" )
151
152 def CASE20( self, main ):
153 """
154 This test script Loads a new Topology (Att) on CHO setup and balances all switches
155 """
156 import re
157 import time
158 import copy
159
160 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
161 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
162 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
163 main.pingTimeout = 300
164 main.log.report(
165 "Load Att topology and Balance all Mininet switches across controllers" )
166 main.log.report(
167 "________________________________________________________________________" )
168 main.case(
169 "Assign and Balance all Mininet switches across controllers" )
170
171 main.step( "Stop any previous Mininet network topology" )
172 cliResult = main.TRUE
173 if main.newTopo == main.params['TOPO3']['topo']:
174 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
175
176 main.step( "Start Mininet with Att topology" )
177 main.newTopo = main.params['TOPO1']['topo']
178 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
179
180 main.step( "Assign switches to controllers" )
181 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
182 main.Mininet1.assignSwController(
183 sw="s" + str( i ),
184 ip=main.onosIPs,
185 port=main.onosPorts )
186
187 switch_mastership = main.TRUE
188 for i in range( 1, ( main.numMNswitches + 1 ) ):
189 response = main.Mininet1.getSwController( "s" + str( i ) )
190 print( "Response is " + str( response ) )
191 if re.search( "tcp:" + main.onosIPs[0], response ):
192 switch_mastership = switch_mastership and main.TRUE
193 else:
194 switch_mastership = main.FALSE
195
196 if switch_mastership == main.TRUE:
197 main.log.report( "Controller assignment successfull" )
198 else:
199 main.log.report( "Controller assignment failed" )
200
201 time.sleep(30) # waiting here to make sure topology converges across all nodes
202
203 main.step( "Balance devices across controllers" )
204 balanceResult = main.ONOScli1.balanceMasters()
205 # giving some breathing time for ONOS to complete re-balance
206 time.sleep( 5 )
207
208 topology_output = main.ONOScli1.topology()
209 topology_result = main.ONOSbench.getTopology( topology_output )
210 case2Result = ( switch_mastership and startStatus )
211 utilities.assert_equals(
212 expect=main.TRUE,
213 actual=case2Result,
214 onpass="Starting new Att topology test PASS",
215 onfail="Starting new Att topology test FAIL" )
216
217 def CASE21( self, main ):
218 """
219 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
220 """
221 import re
222 import time
223 import copy
224
225 main.newTopo = main.params['TOPO2']['topo']
226 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
227 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
228 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
229 main.pingTimeout = 300
230 main.log.report(
231 "Load Chordal topology and Balance all Mininet switches across controllers" )
232 main.log.report(
233 "________________________________________________________________________" )
234 main.case(
235 "Assign and Balance all Mininet switches across controllers" )
236
237 main.step( "Stop any previous Mininet network topology" )
238 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
239
240 main.step( "Start Mininet with Chordal topology" )
241 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
242
243 main.step( "Assign switches to controllers" )
244
245 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
246 main.Mininet1.assignSwController(
247 sw="s" + str( i ),
248 ip=main.onosIPs,
249 port=main.onosPorts )
250
251 switch_mastership = main.TRUE
252 for i in range( 1, ( main.numMNswitches + 1 ) ):
253 response = main.Mininet1.getSwController( "s" + str( i ) )
254 print( "Response is " + str( response ) )
255 if re.search( "tcp:" + main.onosIPs[0], response ):
256 switch_mastership = switch_mastership and main.TRUE
257 else:
258 switch_mastership = main.FALSE
259
260 if switch_mastership == main.TRUE:
261 main.log.report( "Controller assignment successfull" )
262 else:
263 main.log.report( "Controller assignment failed" )
264
265 main.step( "Balance devices across controllers" )
266 balanceResult = main.ONOScli1.balanceMasters()
267 # giving some breathing time for ONOS to complete re-balance
268 time.sleep( 5 )
269
270 case21Result = switch_mastership
271 time.sleep(30)
272 utilities.assert_equals(
273 expect=main.TRUE,
274 actual=case21Result,
275 onpass="Starting new Chordal topology test PASS",
276 onfail="Starting new Chordal topology test FAIL" )
277
278 def CASE22( self, main ):
279 """
280 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
281 """
282 import re
283 import time
284 import copy
285
286 main.newTopo = main.params['TOPO3']['topo']
287 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
288 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
289 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
290 main.pingTimeout = 600
291
292 main.log.report(
293 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
294 main.log.report(
295 "________________________________________________________________________" )
296 main.case(
297 "Assign and Balance all Mininet switches across controllers" )
298 main.step( "Stop any previous Mininet network topology" )
299 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
300 main.step( "Start Mininet with Spine topology" )
301 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
302 time.sleep(60)
303 main.step( "Assign switches to controllers" )
304
305 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
306 main.Mininet1.assignSwController(
307 sw="s" + str( i ),
308 ip=main.onosIPs,
309 port=main.onosPorts )
310
311 switch_mastership = main.TRUE
312 for i in range( 1, ( main.numMNswitches + 1 ) ):
313 response = main.Mininet1.getSwController( "s" + str( i ) )
314 print( "Response is " + str( response ) )
315 if re.search( "tcp:" + main.onosIPs[0], response ):
316 switch_mastership = switch_mastership and main.TRUE
317 else:
318 switch_mastership = main.FALSE
319
320 if switch_mastership == main.TRUE:
321 main.log.report( "Controller assignment successfull" )
322 else:
323 main.log.report( "Controller assignment failed" )
324 time.sleep( 5 )
325
326 main.step( "Balance devices across controllers" )
327 for i in range( int( main.numCtrls ) ):
328 balanceResult = main.ONOScli1.balanceMasters()
329 # giving some breathing time for ONOS to complete re-balance
330 time.sleep( 3 )
331
332 case22Result = switch_mastership
333 time.sleep(60)
334 utilities.assert_equals(
335 expect=main.TRUE,
336 actual=case22Result,
337 onpass="Starting new Spine topology test PASS",
338 onfail="Starting new Spine topology test FAIL" )
339
340 def CASE3( self, main ):
341 """
342 This Test case will be extended to collect and store more data related
343 ONOS state.
344 """
345 import re
346 import copy
347 main.deviceDPIDs = []
348 main.hostMACs = []
349 main.deviceLinks = []
350 main.deviceActiveLinksCount = []
351 main.devicePortsEnabledCount = []
352
353 main.log.report(
354 "Collect and Store topology details from ONOS before running any Tests" )
355 main.log.report(
356 "____________________________________________________________________" )
357 main.case( "Collect and Store Topology Details from ONOS" )
358 main.step( "Collect and store current number of switches and links" )
359 topology_output = main.ONOScli1.topology()
360 topology_result = main.ONOSbench.getTopology( topology_output )
361 numOnosDevices = topology_result[ 'devices' ]
362 numOnosLinks = topology_result[ 'links' ]
363 topoResult = main.TRUE
364
365 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
366 main.step( "Store Device DPIDs" )
367 for i in range( 1, (main.numMNswitches+1) ):
368 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
369 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
370
371 main.step( "Store Host MACs" )
372 for i in range( 1, ( main.numMNhosts + 1 ) ):
373 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
374 print "Host MACs in Store: \n", str( main.hostMACs )
375 main.MACsDict = {}
376 print "Creating dictionary of DPID and HostMacs"
377 for i in range(len(main.hostMACs)):
378 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
379 print main.MACsDict
380 main.step( "Collect and store all Devices Links" )
381 linksResult = main.ONOScli1.links( jsonFormat=False )
382 ansi_escape = re.compile( r'\x1b[^m]*m' )
383 linksResult = ansi_escape.sub( '', linksResult )
384 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
385 linksResult = linksResult.splitlines()
386 main.deviceLinks = copy.copy( linksResult )
387 print "Device Links Stored: \n", str( main.deviceLinks )
388 # this will be asserted to check with the params provided count of
389 # links
390 print "Length of Links Store", len( main.deviceLinks )
391
392 main.step( "Collect and store each Device ports enabled Count" )
393 time1 = time.time()
394 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
395 pool = []
396 for cli in main.CLIs:
397 if i >= main.numMNswitches + 1:
398 break
399 dpid = "of:00000000000000" + format( i,'02x' )
400 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
401 t.start()
402 pool.append(t)
403 i = i + 1
404 main.threadID = main.threadID + 1
405 for thread in pool:
406 thread.join()
407 portResult = thread.result
408 main.devicePortsEnabledCount.append( portResult )
409 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
410 time2 = time.time()
411 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
412
413 main.step( "Collect and store each Device active links Count" )
414 time1 = time.time()
415
416 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
417 pool = []
418 for cli in main.CLIs:
419 if i >= main.numMNswitches + 1:
420 break
421 dpid = "of:00000000000000" + format( i,'02x' )
422 t = main.Thread( target = cli.getDeviceLinksActiveCount,
423 threadID = main.threadID,
424 name = "getDevicePortsEnabledCount",
425 args = [dpid])
426 t.start()
427 pool.append(t)
428 i = i + 1
429 main.threadID = main.threadID + 1
430 for thread in pool:
431 thread.join()
432 linkCountResult = thread.result
433 main.deviceActiveLinksCount.append( linkCountResult )
434 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
435 time2 = time.time()
436 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
437
438 else:
439 main.log.info("Devices (expected): %s, Links (expected): %s" %
440 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
441 main.log.info("Devices (actual): %s, Links (actual): %s" %
442 ( numOnosDevices , numOnosLinks ) )
443 main.log.info("Topology does not match, exiting CHO test...")
444 topoResult = main.FALSE
445 # It's better exit here from running the test
446 main.cleanup()
447 main.exit()
448
449 # just returning TRUE for now as this one just collects data
450 case3Result = topoResult
451 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
452 onpass="Saving ONOS topology data test PASS",
453 onfail="Saving ONOS topology data test FAIL" )
454
455 def CASE40( self, main ):
456 """
457 Verify Reactive forwarding (Att Topology)
458 """
459 import re
460 import copy
461 import time
462 main.log.report( "Verify Reactive forwarding (Att Topology)" )
463 main.log.report( "______________________________________________" )
464 main.case( "Enable Reactive forwarding and Verify ping all" )
465 main.step( "Enable Reactive forwarding" )
466 installResult = main.TRUE
467 # Activate fwd app
468 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
469 appCheck = main.TRUE
470 pool = []
471 for cli in main.CLIs:
472 t = main.Thread( target=cli.appToIDCheck,
473 name="appToIDCheck-" + str( i ),
474 args=[] )
475 pool.append( t )
476 t.start()
477 for t in pool:
478 t.join()
479 appCheck = appCheck and t.result
480 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
481 onpass="App Ids seem to be correct",
482 onfail="Something is wrong with app Ids" )
483 if appCheck != main.TRUE:
484 main.log.warn( main.CLIs[0].apps() )
485 main.log.warn( main.CLIs[0].appIDs() )
486
487 time.sleep( 10 )
488
489 main.step( "Verify Pingall" )
490 ping_result = main.FALSE
491 time1 = time.time()
492 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
493 time2 = time.time()
494 timeDiff = round( ( time2 - time1 ), 2 )
495 main.log.report(
496 "Time taken for Ping All: " +
497 str( timeDiff ) +
498 " seconds" )
499
500 if ping_result == main.TRUE:
501 main.log.report( "Pingall Test in Reactive mode successful" )
502 else:
503 main.log.report( "Pingall Test in Reactive mode failed" )
504
505 main.step( "Disable Reactive forwarding" )
506
507 main.log.info( "Uninstall reactive forwarding app" )
508 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
509 pool = []
510 for cli in main.CLIs:
511 t = main.Thread( target=cli.appToIDCheck,
512 name="appToIDCheck-" + str( i ),
513 args=[] )
514 pool.append( t )
515 t.start()
516
517 for t in pool:
518 t.join()
519 appCheck = appCheck and t.result
520 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
521 onpass="App Ids seem to be correct",
522 onfail="Something is wrong with app Ids" )
523 if appCheck != main.TRUE:
524 main.log.warn( main.CLIs[0].apps() )
525 main.log.warn( main.CLIs[0].appIDs() )
526
527 # Waiting for reative flows to be cleared.
528 time.sleep( 30 )
529 case40Result = installResult and uninstallResult and ping_result
530 utilities.assert_equals( expect=main.TRUE, actual=case40Result,
531 onpass="Reactive Mode Pingall test PASS",
532 onfail="Reactive Mode Pingall test FAIL" )
533
534 def CASE41( self, main ):
535 """
536 Verify Reactive forwarding (Chordal Topology)
537 """
538 import re
539 import copy
540 import time
541 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
542 main.log.report( "______________________________________________" )
543 main.case( "Enable Reactive forwarding and Verify ping all" )
544 main.step( "Enable Reactive forwarding" )
545 installResult = main.TRUE
546 # Activate fwd app
547 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
548
549 appCheck = main.TRUE
550 pool = []
551 for cli in main.CLIs:
552 t = main.Thread( target=cli.appToIDCheck,
553 name="appToIDCheck-" + str( i ),
554 args=[] )
555 pool.append( t )
556 t.start()
557 for t in pool:
558 t.join()
559 appCheck = appCheck and t.result
560 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
561 onpass="App Ids seem to be correct",
562 onfail="Something is wrong with app Ids" )
563 if appCheck != main.TRUE:
564 main.log.warn( main.CLIs[0].apps() )
565 main.log.warn( main.CLIs[0].appIDs() )
566
567 time.sleep( 10 )
568
569 main.step( "Verify Pingall" )
570 ping_result = main.FALSE
571 time1 = time.time()
572 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
573 time2 = time.time()
574 timeDiff = round( ( time2 - time1 ), 2 )
575 main.log.report(
576 "Time taken for Ping All: " +
577 str( timeDiff ) +
578 " seconds" )
579
580 if ping_result == main.TRUE:
581 main.log.report( "Pingall Test in Reactive mode successful" )
582 else:
583 main.log.report( "Pingall Test in Reactive mode failed" )
584
585 main.step( "Disable Reactive forwarding" )
586
587 main.log.info( "Uninstall reactive forwarding app" )
588 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
589 pool = []
590 for cli in main.CLIs:
591 t = main.Thread( target=cli.appToIDCheck,
592 name="appToIDCheck-" + str( i ),
593 args=[] )
594 pool.append( t )
595 t.start()
596
597 for t in pool:
598 t.join()
599 appCheck = appCheck and t.result
600 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
601 onpass="App Ids seem to be correct",
602 onfail="Something is wrong with app Ids" )
603 if appCheck != main.TRUE:
604 main.log.warn( main.CLIs[0].apps() )
605 main.log.warn( main.CLIs[0].appIDs() )
606
607 # Waiting for reative flows to be cleared.
608 time.sleep( 30 )
609 case41Result = installResult and uninstallResult and ping_result
610 utilities.assert_equals( expect=main.TRUE, actual=case41Result,
611 onpass="Reactive Mode Pingall test PASS",
612 onfail="Reactive Mode Pingall test FAIL" )
613
614 def CASE42( self, main ):
615 """
616 Verify Reactive forwarding (Spine Topology)
617 """
618 import re
619 import copy
620 import time
621 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
622 main.log.report( "______________________________________________" )
623 main.case( "Enable Reactive forwarding and Verify ping all" )
624 main.step( "Enable Reactive forwarding" )
625 installResult = main.TRUE
626 # Activate fwd app
627 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
628
629 appCheck = main.TRUE
630 pool = []
631 for cli in main.CLIs:
632 t = main.Thread( target=cli.appToIDCheck,
633 name="appToIDCheck-" + str( i ),
634 args=[] )
635 pool.append( t )
636 t.start()
637 for t in pool:
638 t.join()
639 appCheck = appCheck and t.result
640 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
641 onpass="App Ids seem to be correct",
642 onfail="Something is wrong with app Ids" )
643 if appCheck != main.TRUE:
644 main.log.warn( main.CLIs[0].apps() )
645 main.log.warn( main.CLIs[0].appIDs() )
646
647 time.sleep( 10 )
648
649 main.step( "Verify Pingall" )
650 ping_result = main.FALSE
651 time1 = time.time()
652 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
653 time2 = time.time()
654 timeDiff = round( ( time2 - time1 ), 2 )
655 main.log.report(
656 "Time taken for Ping All: " +
657 str( timeDiff ) +
658 " seconds" )
659
660 if ping_result == main.TRUE:
661 main.log.report( "Pingall Test in Reactive mode successful" )
662 else:
663 main.log.report( "Pingall Test in Reactive mode failed" )
664
665 main.step( "Disable Reactive forwarding" )
666
667 main.log.info( "Uninstall reactive forwarding app" )
668 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
669 pool = []
670 for cli in main.CLIs:
671 t = main.Thread( target=cli.appToIDCheck,
672 name="appToIDCheck-" + str( i ),
673 args=[] )
674 pool.append( t )
675 t.start()
676
677 for t in pool:
678 t.join()
679 appCheck = appCheck and t.result
680 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
681 onpass="App Ids seem to be correct",
682 onfail="Something is wrong with app Ids" )
683 if appCheck != main.TRUE:
684 main.log.warn( main.CLIs[0].apps() )
685 main.log.warn( main.CLIs[0].appIDs() )
686
687 # Waiting for reative flows to be cleared.
688 time.sleep( 30 )
689 case42Result = installResult and uninstallResult and ping_result
690 utilities.assert_equals( expect=main.TRUE, actual=case42Result,
691 onpass="Reactive Mode Pingall test PASS",
692 onfail="Reactive Mode Pingall test FAIL" )
693
694 def CASE5( self, main ):
695 """
696 Compare current ONOS topology with reference data
697 """
698 import re
699
700 devicesDPIDTemp = []
701 hostMACsTemp = []
702 deviceLinksTemp = []
703 deviceActiveLinksCountTemp = []
704 devicePortsEnabledCountTemp = []
705
706 main.log.report(
707 "Compare ONOS topology with reference data in Stores" )
708 main.log.report( "__________________________________________________" )
709 main.case( "Compare ONOS topology with reference data" )
710
711 main.step( "Compare current Device ports enabled with reference" )
712 time1 = time.time()
713 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
714 pool = []
715 for cli in main.CLIs:
716 if i >= main.numMNswitches + 1:
717 break
718 dpid = "of:00000000000000" + format( i,'02x' )
719 t = main.Thread(target = cli.getDevicePortsEnabledCount,
720 threadID = main.threadID,
721 name = "getDevicePortsEnabledCount",
722 args = [dpid])
723 t.start()
724 pool.append(t)
725 i = i + 1
726 main.threadID = main.threadID + 1
727 for thread in pool:
728 thread.join()
729 portResult = thread.result
730 #portTemp = re.split( r'\t+', portResult )
731 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
732 devicePortsEnabledCountTemp.append( portResult )
733
734 time2 = time.time()
735 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
736 main.log.info (
737 "Device Enabled ports EXPECTED: %s" %
738 str( main.devicePortsEnabledCount ) )
739 main.log.info (
740 "Device Enabled ports ACTUAL: %s" %
741 str( devicePortsEnabledCountTemp ) )
742
743 if ( cmp( main.devicePortsEnabledCount,
744 devicePortsEnabledCountTemp ) == 0 ):
745 stepResult1 = main.TRUE
746 else:
747 stepResult1 = main.FALSE
748
749 main.step( "Compare Device active links with reference" )
750 time1 = time.time()
751 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
752 pool = []
753 for cli in main.CLIs:
754 if i >= main.numMNswitches + 1:
755 break
756 dpid = "of:00000000000000" + format( i,'02x' )
757 t = main.Thread(target = cli.getDeviceLinksActiveCount,
758 threadID = main.threadID,
759 name = "getDeviceLinksActiveCount",
760 args = [dpid])
761 t.start()
762 pool.append(t)
763 i = i + 1
764 main.threadID = main.threadID + 1
765 for thread in pool:
766 thread.join()
767 linkCountResult = thread.result
768 #linkCountTemp = re.split( r'\t+', linkCountResult )
769 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
770 deviceActiveLinksCountTemp.append( linkCountResult )
771
772 time2 = time.time()
773 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
774 main.log.info (
775 "Device Active links EXPECTED: %s" %
776 str( main.deviceActiveLinksCount ) )
777 main.log.info (
778 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
779 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
780 stepResult2 = main.TRUE
781 else:
782 stepResult2 = main.FALSE
783
784 """
785 place holder for comparing devices, hosts, paths and intents if required.
786 Links and ports data would be incorrect with out devices anyways.
787 """
788 case5Result = ( stepResult1 and stepResult2 )
789 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
790 onpass="Compare Topology test PASS",
791 onfail="Compare Topology test FAIL" )
792
793 def CASE60( self ):
794 """
795 Install 300 host intents and verify ping all (Att Topology)
796 """
797 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
798 main.log.report( "_______________________________________" )
799 import itertools
800 import time
801 main.case( "Install 300 host intents" )
802 main.step( "Add host Intents" )
803 intentResult = main.TRUE
804 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
805
806 intentIdList = []
807 time1 = time.time()
808 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
809 pool = []
810 for cli in main.CLIs:
811 if i >= len( hostCombos ):
812 break
813 t = main.Thread( target=cli.addHostIntent,
814 threadID=main.threadID,
815 name="addHostIntent",
816 args=[hostCombos[i][0],hostCombos[i][1]])
817 pool.append(t)
818 t.start()
819 i = i + 1
820 main.threadID = main.threadID + 1
821 for thread in pool:
822 thread.join()
823 intentIdList.append(thread.result)
824 time2 = time.time()
825 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
826
827 intentResult = main.TRUE
828 intentsJson = main.ONOScli2.intents()
829 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
830 intentsJson = intentsJson)
831 print "len of intent ID", str(len(intentIdList))
832 print "len of intent state results", str(len(getIntentStateResult))
833 print getIntentStateResult
834 # Takes awhile for all the onos to get the intents
835 time.sleep( 30 )
836 """intentState = main.TRUE
837 for i in getIntentStateResult:
838 if getIntentStateResult.get( 'state' ) != 'INSTALLED':
839 """
840
841
842 main.step( "Verify Ping across all hosts" )
843 pingResult = main.FALSE
844 time1 = time.time()
845 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
846 time2 = time.time()
847 timeDiff = round( ( time2 - time1 ), 2 )
848 main.log.report(
849 "Time taken for Ping All: " +
850 str( timeDiff ) +
851 " seconds" )
852 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
853 onpass="PING ALL PASS",
854 onfail="PING ALL FAIL" )
855
856 case60Result = ( intentResult and pingResult )
857 waitForDebug = int (main.params[ 'ENV' ][ 'debugWait' ])
858 time.sleep(waitForDebug)
859 utilities.assert_equals(
860 expect=main.TRUE,
861 actual=case60Result,
862 onpass="Install 300 Host Intents and Ping All test PASS",
863 onfail="Install 300 Host Intents and Ping All test FAIL" )
864
865 def CASE61( self ):
866 """
867 Install 600 host intents and verify ping all for Chordal Topology
868 """
869 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
870 main.log.report( "_______________________________________" )
871 import itertools
872
873 main.case( "Install 600 host intents" )
874 main.step( "Add host Intents" )
875 intentResult = main.TRUE
876 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
877
878 intentIdList = []
879 time1 = time.time()
880
881 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
882 pool = []
883 for cli in main.CLIs:
884 if i >= len( hostCombos ):
885 break
886 t = main.Thread( target=cli.addHostIntent,
887 threadID=main.threadID,
888 name="addHostIntent",
889 args=[hostCombos[i][0],hostCombos[i][1]])
890 pool.append(t)
891 t.start()
892 i = i + 1
893 main.threadID = main.threadID + 1
894 for thread in pool:
895 thread.join()
896 intentIdList.append(thread.result)
897 time2 = time.time()
898 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
899 intentResult = main.TRUE
900 intentsJson = main.ONOScli2.intents()
901 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
902 intentsJson = intentsJson)
903 print getIntentStateResult
904
905 main.step( "Verify Ping across all hosts" )
906 pingResult = main.FALSE
907 time1 = time.time()
908 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
909 time2 = time.time()
910 timeDiff = round( ( time2 - time1 ), 2 )
911 main.log.report(
912 "Time taken for Ping All: " +
913 str( timeDiff ) +
914 " seconds" )
915 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
916 onpass="PING ALL PASS",
917 onfail="PING ALL FAIL" )
918
919 case14Result = ( intentResult and pingResult )
920
921 utilities.assert_equals(
922 expect=main.TRUE,
923 actual=case14Result,
924 onpass="Install 300 Host Intents and Ping All test PASS",
925 onfail="Install 300 Host Intents and Ping All test FAIL" )
926
927 def CASE62( self ):
928 """
929 Install 2278 host intents and verify ping all for Spine Topology
930 """
931 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
932 main.log.report( "_______________________________________" )
933 import itertools
934
935 main.case( "Install 2278 host intents" )
936 main.step( "Add host Intents" )
937 intentResult = main.TRUE
938 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
939 main.pingTimeout = 300
940 intentIdList = []
941 time1 = time.time()
942 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
943 pool = []
944 for cli in main.CLIs:
945 if i >= len( hostCombos ):
946 break
947 t = main.Thread( target=cli.addHostIntent,
948 threadID=main.threadID,
949 name="addHostIntent",
950 args=[hostCombos[i][0],hostCombos[i][1]])
951 pool.append(t)
952 t.start()
953 i = i + 1
954 main.threadID = main.threadID + 1
955 for thread in pool:
956 thread.join()
957 intentIdList.append(thread.result)
958 time2 = time.time()
959 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
960 intentResult = main.TRUE
961 intentsJson = main.ONOScli2.intents()
962 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
963 intentsJson = intentsJson)
964 print getIntentStateResult
965
966 main.step( "Verify Ping across all hosts" )
967 pingResult = main.FALSE
968 time1 = time.time()
969 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
970 time2 = time.time()
971 timeDiff = round( ( time2 - time1 ), 2 )
972 main.log.report(
973 "Time taken for Ping All: " +
974 str( timeDiff ) +
975 " seconds" )
976 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
977 onpass="PING ALL PASS",
978 onfail="PING ALL FAIL" )
979
980 case15Result = ( intentResult and pingResult )
981
982 utilities.assert_equals(
983 expect=main.TRUE,
984 actual=case15Result,
985 onpass="Install 2278 Host Intents and Ping All test PASS",
986 onfail="Install 2278 Host Intents and Ping All test FAIL" )
987
988 def CASE70( self, main ):
989 """
990 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
991 """
992 import random
993 main.randomLink1 = []
994 main.randomLink2 = []
995 main.randomLink3 = []
996 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
997 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
998 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
999 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1000 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1001 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1002 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1003 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1004
1005 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1006 main.log.report( "___________________________________________________________________________" )
1007 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1008 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1009 if ( int( switchLinksToToggle ) ==
1010 0 or int( switchLinksToToggle ) > 5 ):
1011 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1012 #main.cleanup()
1013 #main.exit()
1014 else:
1015 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1016
1017 main.step( "Cut links on Core devices using user provided range" )
1018 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1019 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1020 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1021 for i in range( int( switchLinksToToggle ) ):
1022 main.Mininet1.link(
1023 END1=link1End1,
1024 END2=main.randomLink1[ i ],
1025 OPTION="down" )
1026 time.sleep( link_sleep )
1027 main.Mininet1.link(
1028 END1=link2End1,
1029 END2=main.randomLink2[ i ],
1030 OPTION="down" )
1031 time.sleep( link_sleep )
1032 main.Mininet1.link(
1033 END1=link3End1,
1034 END2=main.randomLink3[ i ],
1035 OPTION="down" )
1036 time.sleep( link_sleep )
1037
1038 topology_output = main.ONOScli2.topology()
1039 linkDown = main.ONOSbench.checkStatus(
1040 topology_output, main.numMNswitches, str(
1041 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1042 utilities.assert_equals(
1043 expect=main.TRUE,
1044 actual=linkDown,
1045 onpass="Link Down discovered properly",
1046 onfail="Link down was not discovered in " +
1047 str( link_sleep ) +
1048 " seconds" )
1049
1050 main.step( "Verify Ping across all hosts" )
1051 pingResultLinkDown = main.FALSE
1052 time1 = time.time()
1053 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
1054 time2 = time.time()
1055 timeDiff = round( ( time2 - time1 ), 2 )
1056 main.log.report(
1057 "Time taken for Ping All: " +
1058 str( timeDiff ) +
1059 " seconds" )
1060 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1061 onpass="PING ALL PASS",
1062 onfail="PING ALL FAIL" )
1063
1064 caseResult70 = linkDown and pingResultLinkDown
1065 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
1066 onpass="Random Link cut Test PASS",
1067 onfail="Random Link cut Test FAIL" )
1068
1069 def CASE80( self, main ):
1070 """
1071 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1072 """
1073 import random
1074 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1075 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1076 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1077 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1078 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1079
1080 main.log.report(
1081 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1082 main.log.report(
1083 "__________________________________________________________________" )
1084 main.case(
1085 "Host intents - Bring the core links up that are down and verify ping all" )
1086 main.step( "Bring randomly cut links on Core devices up" )
1087 for i in range( int( switchLinksToToggle ) ):
1088 main.Mininet1.link(
1089 END1=link1End1,
1090 END2=main.randomLink1[ i ],
1091 OPTION="up" )
1092 time.sleep( link_sleep )
1093 main.Mininet1.link(
1094 END1=link2End1,
1095 END2=main.randomLink2[ i ],
1096 OPTION="up" )
1097 time.sleep( link_sleep )
1098 main.Mininet1.link(
1099 END1=link3End1,
1100 END2=main.randomLink3[ i ],
1101 OPTION="up" )
1102 time.sleep( link_sleep )
1103
1104 topology_output = main.ONOScli2.topology()
1105 linkUp = main.ONOSbench.checkStatus(
1106 topology_output,
1107 main.numMNswitches,
1108 str( main.numMNlinks ) )
1109 utilities.assert_equals(
1110 expect=main.TRUE,
1111 actual=linkUp,
1112 onpass="Link up discovered properly",
1113 onfail="Link up was not discovered in " +
1114 str( link_sleep ) +
1115 " seconds" )
1116
1117 main.step( "Verify Ping across all hosts" )
1118 pingResultLinkUp = main.FALSE
1119 time1 = time.time()
1120 pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout )
1121 time2 = time.time()
1122 timeDiff = round( ( time2 - time1 ), 2 )
1123 main.log.report(
1124 "Time taken for Ping All: " +
1125 str( timeDiff ) +
1126 " seconds" )
1127 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1128 onpass="PING ALL PASS",
1129 onfail="PING ALL FAIL" )
1130
1131 caseResult80 = linkUp and pingResultLinkUp
1132 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
1133 onpass="Link Up Test PASS",
1134 onfail="Link Up Test FAIL" )
1135
1136 def CASE71( self, main ):
1137 """
1138 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1139 """
1140 import random
1141 main.randomLink1 = []
1142 main.randomLink2 = []
1143 main.randomLink3 = []
1144 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1145 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1146 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1147 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1148 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1149 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1150 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1151 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1152
1153 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1154 main.log.report( "___________________________________________________________________________" )
1155 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1156 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1157 if ( int( switchLinksToToggle ) ==
1158 0 or int( switchLinksToToggle ) > 5 ):
1159 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1160 #main.cleanup()
1161 #main.exit()
1162 else:
1163 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1164
1165 main.step( "Cut links on Core devices using user provided range" )
1166 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1167 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1168 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1169 for i in range( int( switchLinksToToggle ) ):
1170 main.Mininet1.link(
1171 END1=link1End1,
1172 END2=main.randomLink1[ i ],
1173 OPTION="down" )
1174 time.sleep( link_sleep )
1175 main.Mininet1.link(
1176 END1=link2End1,
1177 END2=main.randomLink2[ i ],
1178 OPTION="down" )
1179 time.sleep( link_sleep )
1180 main.Mininet1.link(
1181 END1=link3End1,
1182 END2=main.randomLink3[ i ],
1183 OPTION="down" )
1184 time.sleep( link_sleep )
1185
1186 topology_output = main.ONOScli2.topology()
1187 linkDown = main.ONOSbench.checkStatus(
1188 topology_output, main.numMNswitches, str(
1189 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1190 utilities.assert_equals(
1191 expect=main.TRUE,
1192 actual=linkDown,
1193 onpass="Link Down discovered properly",
1194 onfail="Link down was not discovered in " +
1195 str( link_sleep ) +
1196 " seconds" )
1197
1198 main.step( "Verify Ping across all hosts" )
1199 pingResultLinkDown = main.FALSE
1200 time1 = time.time()
1201 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
1202 time2 = time.time()
1203 timeDiff = round( ( time2 - time1 ), 2 )
1204 main.log.report(
1205 "Time taken for Ping All: " +
1206 str( timeDiff ) +
1207 " seconds" )
1208 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1209 onpass="PING ALL PASS",
1210 onfail="PING ALL FAIL" )
1211
1212 caseResult71 = linkDown and pingResultLinkDown
1213 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1214 onpass="Random Link cut Test PASS",
1215 onfail="Random Link cut Test FAIL" )
1216
1217 def CASE81( self, main ):
1218 """
1219 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1220 """
1221 import random
1222 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1223 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1224 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1225 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1226 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1227
1228 main.log.report(
1229 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1230 main.log.report(
1231 "__________________________________________________________________" )
1232 main.case(
1233 "Point intents - Bring the core links up that are down and verify ping all" )
1234 main.step( "Bring randomly cut links on Core devices up" )
1235 for i in range( int( switchLinksToToggle ) ):
1236 main.Mininet1.link(
1237 END1=link1End1,
1238 END2=main.randomLink1[ i ],
1239 OPTION="up" )
1240 time.sleep( link_sleep )
1241 main.Mininet1.link(
1242 END1=link2End1,
1243 END2=main.randomLink2[ i ],
1244 OPTION="up" )
1245 time.sleep( link_sleep )
1246 main.Mininet1.link(
1247 END1=link3End1,
1248 END2=main.randomLink3[ i ],
1249 OPTION="up" )
1250 time.sleep( link_sleep )
1251
1252 topology_output = main.ONOScli2.topology()
1253 linkUp = main.ONOSbench.checkStatus(
1254 topology_output,
1255 main.numMNswitches,
1256 str( main.numMNlinks ) )
1257 utilities.assert_equals(
1258 expect=main.TRUE,
1259 actual=linkUp,
1260 onpass="Link up discovered properly",
1261 onfail="Link up was not discovered in " +
1262 str( link_sleep ) +
1263 " seconds" )
1264
1265 main.step( "Verify Ping across all hosts" )
1266 pingResultLinkUp = main.FALSE
1267 time1 = time.time()
1268 pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout )
1269 time2 = time.time()
1270 timeDiff = round( ( time2 - time1 ), 2 )
1271 main.log.report(
1272 "Time taken for Ping All: " +
1273 str( timeDiff ) +
1274 " seconds" )
1275 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1276 onpass="PING ALL PASS",
1277 onfail="PING ALL FAIL" )
1278
1279 caseResult81 = linkUp and pingResultLinkUp
1280 utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
1281 onpass="Link Up Test PASS",
1282 onfail="Link Up Test FAIL" )
1283
1284 def CASE72( self, main ):
1285 """
1286 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1287 """
1288 import random
1289 import itertools
1290 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1291
1292 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1293 main.log.report( "___________________________________________________________________________" )
1294 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1295 switches = []
1296 switchesComb = []
1297 for i in range( main.numMNswitches ):
1298 switches.append('s%d'%(i+1))
1299 switchesLinksComb = list(itertools.combinations(switches,2))
1300 main.randomLinks = random.sample(switchesLinksComb, 5 )
1301 print main.randomLinks
1302 main.step( "Cut links on random devices" )
1303
1304 for switch in main.randomLinks:
1305 main.Mininet1.link(
1306 END1=switch[0],
1307 END2=switch[1],
1308 OPTION="down")
1309 time.sleep( link_sleep )
1310
1311 topology_output = main.ONOScli2.topology()
1312 linkDown = main.ONOSbench.checkStatus(
1313 topology_output, main.numMNswitches, str(
1314 int( main.numMNlinks ) - 5 * 2 ) )
1315 utilities.assert_equals(
1316 expect=main.TRUE,
1317 actual=linkDown,
1318 onpass="Link Down discovered properly",
1319 onfail="Link down was not discovered in " +
1320 str( link_sleep ) +
1321 " seconds" )
1322
1323 main.step( "Verify Ping across all hosts" )
1324 pingResultLinkDown = main.FALSE
1325 time1 = time.time()
1326 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1327 time2 = time.time()
1328 timeDiff = round( ( time2 - time1 ), 2 )
1329 main.log.report(
1330 "Time taken for Ping All: " +
1331 str( timeDiff ) +
1332 " seconds" )
1333 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1334 onpass="PING ALL PASS",
1335 onfail="PING ALL FAIL" )
1336
1337 caseResult71 = pingResultLinkDown
1338 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1339 onpass="Random Link cut Test PASS",
1340 onfail="Random Link cut Test FAIL" )
1341
1342 def CASE82( self, main ):
1343 """
1344 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1345 """
1346 import random
1347 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1348
1349 main.log.report(
1350 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1351 main.log.report(
1352 "__________________________________________________________________" )
1353 main.case(
1354 "Host intents - Bring the core links up that are down and verify ping all" )
1355 main.step( "Bring randomly cut links on devices up" )
1356
1357 for switch in main.randomLinks:
1358 main.Mininet1.link(
1359 END1=switch[0],
1360 END2=switch[1],
1361 OPTION="up")
1362 time.sleep( link_sleep )
1363
1364 topology_output = main.ONOScli2.topology()
1365 linkUp = main.ONOSbench.checkStatus(
1366 topology_output,
1367 main.numMNswitches,
1368 str( main.numMNlinks ) )
1369 utilities.assert_equals(
1370 expect=main.TRUE,
1371 actual=linkUp,
1372 onpass="Link up discovered properly",
1373 onfail="Link up was not discovered in " +
1374 str( link_sleep ) +
1375 " seconds" )
1376
1377 main.step( "Verify Ping across all hosts" )
1378 pingResultLinkUp = main.FALSE
1379 time1 = time.time()
1380 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1381 time2 = time.time()
1382 timeDiff = round( ( time2 - time1 ), 2 )
1383 main.log.report(
1384 "Time taken for Ping All: " +
1385 str( timeDiff ) +
1386 " seconds" )
1387 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1388 onpass="PING ALL PASS",
1389 onfail="PING ALL FAIL" )
1390
1391 caseResult82 = linkUp and pingResultLinkUp
1392 utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
1393 onpass="Link Up Test PASS",
1394 onfail="Link Up Test FAIL" )
1395
1396 def CASE73( self, main ):
1397 """
1398 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1399 """
1400 import random
1401 import itertools
1402 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1403
1404 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1405 main.log.report( "___________________________________________________________________________" )
1406 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1407 switches = []
1408 switchesComb = []
1409 for i in range( main.numMNswitches ):
1410 switches.append('s%d'%(i+1))
1411 switchesLinksComb = list(itertools.combinations(switches,2))
1412 main.randomLinks = random.sample(switchesLinksComb, 5 )
1413 print main.randomLinks
1414 main.step( "Cut links on random devices" )
1415
1416 for switch in main.randomLinks:
1417 main.Mininet1.link(
1418 END1=switch[0],
1419 END2=switch[1],
1420 OPTION="down")
1421 time.sleep( link_sleep )
1422
1423 topology_output = main.ONOScli2.topology()
1424 linkDown = main.ONOSbench.checkStatus(
1425 topology_output, main.numMNswitches, str(
1426 int( main.numMNlinks ) - 5 * 2 ) )
1427 utilities.assert_equals(
1428 expect=main.TRUE,
1429 actual=linkDown,
1430 onpass="Link Down discovered properly",
1431 onfail="Link down was not discovered in " +
1432 str( link_sleep ) +
1433 " seconds" )
1434
1435 main.step( "Verify Ping across all hosts" )
1436 pingResultLinkDown = main.FALSE
1437 time1 = time.time()
1438 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1439 time2 = time.time()
1440 timeDiff = round( ( time2 - time1 ), 2 )
1441 main.log.report(
1442 "Time taken for Ping All: " +
1443 str( timeDiff ) +
1444 " seconds" )
1445 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1446 onpass="PING ALL PASS",
1447 onfail="PING ALL FAIL" )
1448
1449 caseResult73 = pingResultLinkDown
1450 utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
1451 onpass="Random Link cut Test PASS",
1452 onfail="Random Link cut Test FAIL" )
1453
1454 def CASE83( self, main ):
1455 """
1456 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
1457 """
1458 import random
1459 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1460
1461 main.log.report(
1462 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
1463 main.log.report(
1464 "__________________________________________________________________" )
1465 main.case(
1466 "Point intents - Bring the core links up that are down and verify ping all" )
1467 main.step( "Bring randomly cut links on devices up" )
1468
1469 for switch in main.randomLinks:
1470 main.Mininet1.link(
1471 END1=switch[0],
1472 END2=switch[1],
1473 OPTION="up")
1474 time.sleep( link_sleep )
1475
1476 topology_output = main.ONOScli2.topology()
1477 linkUp = main.ONOSbench.checkStatus(
1478 topology_output,
1479 main.numMNswitches,
1480 str( main.numMNlinks ) )
1481 utilities.assert_equals(
1482 expect=main.TRUE,
1483 actual=linkUp,
1484 onpass="Link up discovered properly",
1485 onfail="Link up was not discovered in " +
1486 str( link_sleep ) +
1487 " seconds" )
1488
1489 main.step( "Verify Ping across all hosts" )
1490 pingResultLinkUp = main.FALSE
1491 time1 = time.time()
1492 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1493 time2 = time.time()
1494 timeDiff = round( ( time2 - time1 ), 2 )
1495 main.log.report(
1496 "Time taken for Ping All: " +
1497 str( timeDiff ) +
1498 " seconds" )
1499 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1500 onpass="PING ALL PASS",
1501 onfail="PING ALL FAIL" )
1502
1503 caseResult83 = linkUp and pingResultLinkUp
1504 utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
1505 onpass="Link Up Test PASS",
1506 onfail="Link Up Test FAIL" )
1507
1508 def CASE74( self, main ):
1509 """
1510 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
1511 """
1512 import random
1513 main.randomLink1 = []
1514 main.randomLink2 = []
1515 main.randomLink3 = []
1516 main.randomLink4 = []
1517 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1518 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
1519 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
1520 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1521 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
1522 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
1523 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1524 main.pingTimeout = 400
1525
1526 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
1527 main.log.report( "___________________________________________________________________________" )
1528
1529 linkIndex = range(4)
1530 linkIndexS9 = random.sample(linkIndex,1)[0]
1531 linkIndex.remove(linkIndexS9)
1532 linkIndexS10 = random.sample(linkIndex,1)[0]
1533 main.randomLink1 = link1End2top[linkIndexS9]
1534 main.randomLink2 = link2End2top[linkIndexS10]
1535 main.randomLink3 = random.sample(link1End2bot,1)[0]
1536 main.randomLink4 = random.sample(link2End2bot,1)[0]
1537 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
1538 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
1539 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
1540 time.sleep( link_sleep )
1541 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
1542 time.sleep( link_sleep )
1543
1544 topology_output = main.ONOScli2.topology()
1545 linkDown = main.ONOSbench.checkStatus(
1546 topology_output, main.numMNswitches, str(
1547 int( main.numMNlinks ) - 8 ))
1548 utilities.assert_equals(
1549 expect=main.TRUE,
1550 actual=linkDown,
1551 onpass="Link Down discovered properly",
1552 onfail="Link down was not discovered in " +
1553 str( link_sleep ) +
1554 " seconds" )
1555
1556 main.step( "Verify Ping across all hosts" )
1557 pingResultLinkDown = main.FALSE
1558 time1 = time.time()
1559 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1560 time2 = time.time()
1561 timeDiff = round( ( time2 - time1 ), 2 )
1562 main.log.report(
1563 "Time taken for Ping All: " +
1564 str( timeDiff ) +
1565 " seconds" )
1566 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1567 onpass="PING ALL PASS",
1568 onfail="PING ALL FAIL" )
1569
1570 caseResult74 = linkDown and pingResultLinkDown
1571 utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
1572 onpass="Random Link cut Test PASS",
1573 onfail="Random Link cut Test FAIL" )
1574
1575 def CASE84( self, main ):
1576 """
1577 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
1578 """
1579 import random
1580 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1581 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1582 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1583 main.log.report(
1584 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
1585 main.log.report(
1586 "__________________________________________________________________" )
1587 main.case(
1588 "Host intents - Bring the core links up that are down and verify ping all" )
1589
1590 #main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
1591 #main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
1592 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
1593 time.sleep( link_sleep )
1594 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
1595 time.sleep( link_sleep )
1596
1597 topology_output = main.ONOScli2.topology()
1598 linkUp = main.ONOSbench.checkStatus(
1599 topology_output,
1600 main.numMNswitches,
1601 str( main.numMNlinks ) )
1602 utilities.assert_equals(
1603 expect=main.TRUE,
1604 actual=linkUp,
1605 onpass="Link up discovered properly",
1606 onfail="Link up was not discovered in " +
1607 str( link_sleep ) +
1608 " seconds" )
1609
1610 main.step( "Verify Ping across all hosts" )
1611 pingResultLinkUp = main.FALSE
1612 time1 = time.time()
1613 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1614 time2 = time.time()
1615 timeDiff = round( ( time2 - time1 ), 2 )
1616 main.log.report(
1617 "Time taken for Ping All: " +
1618 str( timeDiff ) +
1619 " seconds" )
1620 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1621 onpass="PING ALL PASS",
1622 onfail="PING ALL FAIL" )
1623
1624 caseResult84 = linkUp and pingResultLinkUp
1625 utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
1626 onpass="Link Up Test PASS",
1627 onfail="Link Up Test FAIL" )
1628
1629 def CASE90( self ):
1630 """
1631 Install 600 point intents and verify ping all (Att Topology)
1632 """
1633 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
1634 main.log.report( "_______________________________________" )
1635 import itertools
1636 import time
1637 main.case( "Install 600 point intents" )
1638 main.step( "Add point Intents" )
1639 intentResult = main.TRUE
1640 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1641
1642 intentIdList = []
1643 time1 = time.time()
1644 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1645 pool = []
1646 for cli in main.CLIs:
1647 if i >= len( deviceCombos ):
1648 break
1649 t = main.Thread( target=cli.addPointIntent,
1650 threadID=main.threadID,
1651 name="addPointIntent",
1652 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4",main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
1653 pool.append(t)
1654 #time.sleep(1)
1655 t.start()
1656 i = i + 1
1657 main.threadID = main.threadID + 1
1658 for thread in pool:
1659 thread.join()
1660 intentIdList.append(thread.result)
1661 time2 = time.time()
1662 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1663 intentResult = main.TRUE
1664 intentsJson = main.ONOScli2.intents()
1665 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1666 intentsJson = intentsJson)
1667 print getIntentStateResult
1668 # Takes awhile for all the onos to get the intents
1669 time.sleep(60)
1670 main.step( "Verify Ping across all hosts" )
1671 pingResult = main.FALSE
1672 time1 = time.time()
1673 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1674 time2 = time.time()
1675 timeDiff = round( ( time2 - time1 ), 2 )
1676 main.log.report(
1677 "Time taken for Ping All: " +
1678 str( timeDiff ) +
1679 " seconds" )
1680 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1681 onpass="PING tALL PASS",
1682 onfail="PING ALL FAIL" )
1683
1684 case90Result = ( intentResult and pingResult )
1685
1686 utilities.assert_equals(
1687 expect=main.TRUE,
1688 actual=case90Result,
1689 onpass="Install 600 point Intents and Ping All test PASS",
1690 onfail="Install 600 point Intents and Ping All test FAIL" )
1691
1692 def CASE91( self ):
1693 """
1694 Install 600 point intents and verify ping all (Chordal Topology)
1695 """
1696 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
1697 main.log.report( "_______________________________________" )
1698 import itertools
1699 import time
1700 main.case( "Install 600 point intents" )
1701 main.step( "Add point Intents" )
1702 intentResult = main.TRUE
1703 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1704
1705 intentIdList = []
1706 time1 = time.time()
1707 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1708 pool = []
1709 for cli in main.CLIs:
1710 if i >= len( deviceCombos ):
1711 break
1712 t = main.Thread( target=cli.addPointIntent,
1713 threadID=main.threadID,
1714 name="addPointIntent",
1715 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1716 pool.append(t)
1717 #time.sleep(1)
1718 t.start()
1719 i = i + 1
1720 main.threadID = main.threadID + 1
1721 for thread in pool:
1722 thread.join()
1723 intentIdList.append(thread.result)
1724 time2 = time.time()
1725 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1726 intentResult = main.TRUE
1727 intentsJson = main.ONOScli2.intents()
1728 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1729 intentsJson = intentsJson)
1730 print getIntentStateResult
1731 # Takes awhile for all the onos to get the intents
1732 time.sleep(30)
1733 main.step( "Verify Ping across all hosts" )
1734 pingResult = main.FALSE
1735 time1 = time.time()
1736 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1737 time2 = time.time()
1738 timeDiff = round( ( time2 - time1 ), 2 )
1739 main.log.report(
1740 "Time taken for Ping All: " +
1741 str( timeDiff ) +
1742 " seconds" )
1743 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1744 onpass="PING ALL PASS",
1745 onfail="PING ALL FAIL" )
1746
1747 case91Result = ( intentResult and pingResult )
1748
1749 utilities.assert_equals(
1750 expect=main.TRUE,
1751 actual=case91Result,
1752 onpass="Install 600 point Intents and Ping All test PASS",
1753 onfail="Install 600 point Intents and Ping All test FAIL" )
1754
1755 def CASE92( self ):
1756 """
1757 Install 4556 point intents and verify ping all (Spine Topology)
1758 """
1759 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
1760 main.log.report( "_______________________________________" )
1761 import itertools
1762 import time
1763 main.case( "Install 4556 point intents" )
1764 main.step( "Add point Intents" )
1765 intentResult = main.TRUE
1766 main.pingTimeout = 600
1767 for i in range(len(main.hostMACs)):
1768 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
1769 print main.MACsDict
1770 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
1771 intentIdList = []
1772 time1 = time.time()
1773 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1774 pool = []
1775 for cli in main.CLIs:
1776 if i >= len( deviceCombos ):
1777 break
1778 t = main.Thread( target=cli.addPointIntent,
1779 threadID=main.threadID,
1780 name="addPointIntent",
1781 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1782 pool.append(t)
1783 #time.sleep(1)
1784 t.start()
1785 i = i + 1
1786 main.threadID = main.threadID + 1
1787 for thread in pool:
1788 thread.join()
1789 intentIdList.append(thread.result)
1790 time2 = time.time()
1791 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1792 intentResult = main.TRUE
1793 intentsJson = main.ONOScli2.intents()
1794 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1795 intentsJson = intentsJson)
1796 #print getIntentStateResult
1797 # Takes awhile for all the onos to get the intents
1798 time.sleep(60)
1799 main.step( "Verify Ping across all hosts" )
1800 pingResult = main.FALSE
1801 time1 = time.time()
1802 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1803 time2 = time.time()
1804 timeDiff = round( ( time2 - time1 ), 2 )
1805 main.log.report(
1806 "Time taken for Ping All: " +
1807 str( timeDiff ) +
1808 " seconds" )
1809 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1810 onpass="PING ALL PASS",
1811 onfail="PING ALL FAIL" )
1812
1813 case92Result = ( intentResult and pingResult )
1814
1815 utilities.assert_equals(
1816 expect=main.TRUE,
1817 actual=case92Result,
1818 onpass="Install 4556 point Intents and Ping All test PASS",
1819 onfail="Install 4556 point Intents and Ping All test FAIL" )
1820
1821 def CASE93( self ):
1822 """
1823 Install multi-single point intents and verify Ping all works
1824 for att topology
1825 """
1826 import copy
1827 import time
1828 main.log.report( "Install multi-single point intents and verify Ping all" )
1829 main.log.report( "___________________________________________" )
1830 main.case( "Install multi-single point intents and Ping all" )
1831 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
1832 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
1833 intentIdList = []
1834 print "MACsDict", main.MACsDict
1835 time1 = time.time()
1836 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
1837 pool = []
1838 for cli in main.CLIs:
1839 egressDevice = deviceDPIDsCopy[i]
1840 ingressDeviceList = copy.copy(deviceDPIDsCopy)
1841 ingressDeviceList.remove(egressDevice)
1842 if i >= len( deviceDPIDsCopy ):
1843 break
1844 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
1845 threadID=main.threadID,
1846 name="addMultipointToSinglepointIntent",
1847 args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
1848 pool.append(t)
1849 #time.sleep(1)
1850 t.start()
1851 i = i + 1
1852 main.threadID = main.threadID + 1
1853 for thread in pool:
1854 thread.join()
1855 intentIdList.append(thread.result)
1856 time2 = time.time()
1857 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1858 time.sleep(30)
1859 print "getting all intents ID"
1860 intentIdTemp = main.ONOScli1.getAllIntentsId()
1861 print intentIdTemp
1862 print len(intentIdList)
1863 print intentIdList
1864 checkIntentStateResult = main.TRUE
1865 print "Checking intents state"
1866 checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1867 checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1868 checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1869 checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1870 checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1871
1872 if checkIntentStateResult:
1873 main.log.info( "All intents are installed correctly " )
1874
1875 print "Checking flows state "
1876 checkFlowsState = main.ONOScli1.checkFlowsState()
1877 time.sleep(50)
1878 main.step( "Verify Ping across all hosts" )
1879 pingResult = main.FALSE
1880 time1 = time.time()
1881 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1882 time2 = time.time()
1883 timeDiff = round( ( time2 - time1 ), 2 )
1884 main.log.report(
1885 "Time taken for Ping All: " +
1886 str( timeDiff ) +
1887 " seconds" )
1888 checkFlowsState = main.ONOScli1.checkFlowsState()
1889 case93Result = pingResult
1890 utilities.assert_equals(
1891 expect=main.TRUE,
1892 actual=case93Result,
1893 onpass="Install 25 multi to single point Intents and Ping All test PASS",
1894 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
1895
1896 def CASE94( self ):
1897 """
1898 Install multi-single point intents and verify Ping all works
1899 for Chordal topology
1900 """
1901 import copy
1902 import time
1903 main.log.report( "Install multi-single point intents and verify Ping all" )
1904 main.log.report( "___________________________________________" )
1905 main.case( "Install multi-single point intents and Ping all" )
1906 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
1907 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
1908 intentIdList = []
1909 print "MACsDict", main.MACsDict
1910 time1 = time.time()
1911 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
1912 pool = []
1913 for cli in main.CLIs:
1914 egressDevice = deviceDPIDsCopy[i]
1915 ingressDeviceList = copy.copy(deviceDPIDsCopy)
1916 ingressDeviceList.remove(egressDevice)
1917 if i >= len( deviceDPIDsCopy ):
1918 break
1919 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
1920 threadID=main.threadID,
1921 name="addMultipointToSinglepointIntent",
1922 args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
1923 pool.append(t)
1924 #time.sleep(1)
1925 t.start()
1926 i = i + 1
1927 main.threadID = main.threadID + 1
1928 for thread in pool:
1929 thread.join()
1930 intentIdList.append(thread.result)
1931 time2 = time.time()
1932 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1933 time.sleep(5)
1934 main.step( "Verify Ping across all hosts" )
1935 pingResult = main.FALSE
1936 time1 = time.time()
1937 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1938 time2 = time.time()
1939 timeDiff = round( ( time2 - time1 ), 2 )
1940 main.log.report(
1941 "Time taken for Ping All: " +
1942 str( timeDiff ) +
1943 " seconds" )
1944
1945 case94Result = pingResult
1946 utilities.assert_equals(
1947 expect=main.TRUE,
1948 actual=case94Result,
1949 onpass="Install 25 multi to single point Intents and Ping All test PASS",
1950 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
1951
1952 #def CASE95 multi-single point intent for Spine
1953
1954 def CASE96( self ):
1955 """
1956 Install single-multi point intents and verify Ping all works
1957 for att topology
1958 """
1959 import copy
1960 main.log.report( "Install single-multi point intents and verify Ping all" )
1961 main.log.report( "___________________________________________" )
1962 main.case( "Install single-multi point intents and Ping all" )
1963 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
1964 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
1965 intentIdList = []
1966 print "MACsDict", main.MACsDict
1967 time1 = time.time()
1968 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
1969 pool = []
1970 for cli in main.CLIs:
1971 ingressDevice = deviceDPIDsCopy[i]
1972 egressDeviceList = copy.copy(deviceDPIDsCopy)
1973 egressDeviceList.remove(ingressDevice)
1974 if i >= len( deviceDPIDsCopy ):
1975 break
1976 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
1977 threadID=main.threadID,
1978 name="addSinglepointToMultipointIntent",
1979 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice)])
1980 pool.append(t)
1981 #time.sleep(1)
1982 t.start()
1983 i = i + 1
1984 main.threadID = main.threadID + 1
1985 for thread in pool:
1986 thread.join()
1987 intentIdList.append(thread.result)
1988 time2 = time.time()
1989 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1990 time.sleep(5)
1991 main.step( "Verify Ping across all hosts" )
1992 pingResult = main.FALSE
1993 time1 = time.time()
1994 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1995 time2 = time.time()
1996 timeDiff = round( ( time2 - time1 ), 2 )
1997 main.log.report(
1998 "Time taken for Ping All: " +
1999 str( timeDiff ) +
2000 " seconds" )
2001
2002 case96Result = pingResult
2003 utilities.assert_equals(
2004 expect=main.TRUE,
2005 actual=case96Result,
2006 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2007 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2008
2009 def CASE97( self ):
2010 """
2011 Install single-multi point intents and verify Ping all works
2012 for Chordal topology
2013 """
2014 import copy
2015 main.log.report( "Install single-multi point intents and verify Ping all" )
2016 main.log.report( "___________________________________________" )
2017 main.case( "Install single-multi point intents and Ping all" )
2018 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2019 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
2020 intentIdList = []
2021 print "MACsDict", main.MACsDict
2022 time1 = time.time()
2023 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2024 pool = []
2025 for cli in main.CLIs:
2026 ingressDevice = deviceDPIDsCopy[i]
2027 egressDeviceList = copy.copy(deviceDPIDsCopy)
2028 egressDeviceList.remove(ingressDevice)
2029 if i >= len( deviceDPIDsCopy ):
2030 break
2031 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2032 threadID=main.threadID,
2033 name="addSinglepointToMultipointIntent",
2034 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice),''])
2035 pool.append(t)
2036 #time.sleep(1)
2037 t.start()
2038 i = i + 1
2039 main.threadID = main.threadID + 1
2040 for thread in pool:
2041 thread.join()
2042 intentIdList.append(thread.result)
2043 time2 = time.time()
2044 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2045 time.sleep(5)
2046 main.step( "Verify Ping across all hosts" )
2047 pingResult = main.FALSE
2048 time1 = time.time()
2049 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2050 time2 = time.time()
2051 timeDiff = round( ( time2 - time1 ), 2 )
2052 main.log.report(
2053 "Time taken for Ping All: " +
2054 str( timeDiff ) +
2055 " seconds" )
2056
2057 case97Result = pingResult
2058 utilities.assert_equals(
2059 expect=main.TRUE,
2060 actual=case97Result,
2061 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2062 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2063
2064 def CASE98( self ):
2065 """
2066 Install single-multi point intents and verify Ping all works
2067 for Spine topology
2068 """
2069 import copy
2070 main.log.report( "Install single-multi point intents and verify Ping all" )
2071 main.log.report( "___________________________________________" )
2072 main.case( "Install single-multi point intents and Ping all" )
2073 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2074 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
2075 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
2076 intentIdList = []
2077 MACsDictCopy = {}
2078 for i in range( len( deviceDPIDsCopy ) ):
2079 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
2080
2081 print "deviceDPIDsCopy", deviceDPIDsCopy
2082 print ""
2083 print "MACsDictCopy", MACsDictCopy
2084 time1 = time.time()
2085 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2086 pool = []
2087 for cli in main.CLIs:
2088 if i >= len( deviceDPIDsCopy ):
2089 break
2090 ingressDevice = deviceDPIDsCopy[i]
2091 egressDeviceList = copy.copy(deviceDPIDsCopy)
2092 egressDeviceList.remove(ingressDevice)
2093 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2094 threadID=main.threadID,
2095 name="addSinglepointToMultipointIntent",
2096 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',MACsDictCopy.get(ingressDevice),''])
2097 pool.append(t)
2098 #time.sleep(1)
2099 t.start()
2100 i = i + 1
2101 main.threadID = main.threadID + 1
2102 for thread in pool:
2103 thread.join()
2104 intentIdList.append(thread.result)
2105 time2 = time.time()
2106 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2107 time.sleep(5)
2108 main.step( "Verify Ping across all hosts" )
2109 pingResult = main.FALSE
2110 time1 = time.time()
2111 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2112 time2 = time.time()
2113 timeDiff = round( ( time2 - time1 ), 2 )
2114 main.log.report(
2115 "Time taken for Ping All: " +
2116 str( timeDiff ) +
2117 " seconds" )
2118
2119 case98Result = pingResult
2120 utilities.assert_equals(
2121 expect=main.TRUE,
2122 actual=case98Result,
2123 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2124 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2125
2126 def CASE10( self ):
2127 import time
2128 """
2129 Remove all Intents
2130 """
2131 main.log.report( "Remove all intents that were installed previously" )
2132 main.log.report( "______________________________________________" )
2133 main.log.info( "Remove all intents" )
2134 main.case( "Removing intents" )
2135 main.step( "Obtain the intent id's first" )
2136 intentsList = main.ONOScli1.getAllIntentIds()
2137 ansi_escape = re.compile( r'\x1b[^m]*m' )
2138 intentsList = ansi_escape.sub( '', intentsList )
2139 intentsList = intentsList.replace(
2140 " onos:intents | grep id=",
2141 "" ).replace(
2142 "id=",
2143 "" ).replace(
2144 "\r\r",
2145 "" )
2146 intentsList = intentsList.splitlines()
2147 #intentsList = intentsList[ 1: ]
2148 intentIdList = []
2149 step1Result = main.TRUE
2150 moreIntents = main.TRUE
2151 removeIntentCount = 0
2152 intentsCount = len(intentsList)
2153 main.log.info ( "Current number of intents: " + str(intentsCount) )
2154 if ( len( intentsList ) > 1 ):
2155 results = main.TRUE
2156 main.log.info("Removing intent...")
2157 while moreIntents:
2158 #This is a work around for a major issue. We cycle through intents removal for up to 5 times.
2159 if removeIntentCount == 5:
2160 break
2161 removeIntentCount = removeIntentCount + 1
2162 intentsList1 = main.ONOScli1.getAllIntentIds()
2163 if len( intentsList1 ) == 0:
2164 break
2165 ansi_escape = re.compile( r'\x1b[^m]*m' )
2166 intentsList1 = ansi_escape.sub( '', intentsList1 )
2167 intentsList1 = intentsList1.replace(
2168 " onos:intents | grep id=",
2169 "" ).replace(
2170 " state=",
2171 "" ).replace(
2172 "\r\r",
2173 "" )
2174 intentsList1 = intentsList1.splitlines()
2175 #intentsList1 = intentsList1[ 1: ]
2176 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
2177 print intentsList1
2178 intentIdList1 = []
2179 if ( len( intentsList1 ) > 0 ):
2180 moreIntents = main.TRUE
2181 for i in range( len( intentsList1 ) ):
2182 intentsTemp1 = intentsList1[ i ].split( ',' )
2183 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
2184 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
2185 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
2186 time1 = time.time()
2187 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
2188 pool = []
2189 for cli in main.CLIs:
2190 if i >= len( intentIdList1 ):
2191 break
2192 t = main.Thread( target=cli.removeIntent,
2193 threadID=main.threadID,
2194 name="removeIntent",
2195 args=[intentIdList1[i],'org.onosproject.cli',False,False])
2196 pool.append(t)
2197 t.start()
2198 i = i + 1
2199 main.threadID = main.threadID + 1
2200 for thread in pool:
2201 thread.join()
2202 intentIdList.append(thread.result)
2203 #time.sleep(2)
2204 time2 = time.time()
2205 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
2206 time.sleep(10)
2207 main.log.info("Purging WITHDRAWN Intents")
2208 purgeResult = main.ONOScli2.purgeWithdrawnIntents()
2209 else:
2210 time.sleep(10)
2211 if len( main.ONOScli1.intents()):
2212 continue
2213 break
2214 time.sleep(10)
2215 else:
2216 print "Removed %d intents" %(intentsCount)
2217 step1Result = main.TRUE
2218 else:
2219 print "No Intent IDs found in Intents list: ", intentsList
2220 step1Result = main.FALSE
2221
2222 print main.ONOScli1.intents()
2223 caseResult10 = step1Result
2224 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
2225 onpass="Intent removal test successful",
2226 onfail="Intent removal test failed" )
2227
2228 def CASE12( self, main ):
2229 """
2230 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
2231 """
2232 import re
2233 import copy
2234 import time
2235
2236 Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
2237 threadID = 0
2238
2239 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
2240 main.log.report( "_____________________________________________________" )
2241 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
2242 main.step( "Enable intent based Reactive forwarding" )
2243 installResult = main.FALSE
2244 feature = "onos-app-ifwd"
2245
2246 pool = []
2247 time1 = time.time()
2248 for cli,feature in main.CLIs:
2249 t = main.Thread(target=cli,threadID=threadID,
2250 name="featureInstall",args=[feature])
2251 pool.append(t)
2252 t.start()
2253 threadID = threadID + 1
2254
2255 results = []
2256 for thread in pool:
2257 thread.join()
2258 results.append(thread.result)
2259 time2 = time.time()
2260
2261 if( all(result == main.TRUE for result in results) == False):
2262 main.log.info("Did not install onos-app-ifwd feature properly")
2263 #main.cleanup()
2264 #main.exit()
2265 else:
2266 main.log.info("Successful feature:install onos-app-ifwd")
2267 installResult = main.TRUE
2268 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
2269
2270 main.step( "Verify Pingall" )
2271 ping_result = main.FALSE
2272 time1 = time.time()
2273 ping_result = main.Mininet1.pingall(timeout=600)
2274 time2 = time.time()
2275 timeDiff = round( ( time2 - time1 ), 2 )
2276 main.log.report(
2277 "Time taken for Ping All: " +
2278 str( timeDiff ) +
2279 " seconds" )
2280
2281 if ping_result == main.TRUE:
2282 main.log.report( "Pingall Test in Reactive mode successful" )
2283 else:
2284 main.log.report( "Pingall Test in Reactive mode failed" )
2285
2286 main.step( "Disable Intent based Reactive forwarding" )
2287 uninstallResult = main.FALSE
2288
2289 pool = []
2290 time1 = time.time()
2291 for cli,feature in main.CLIs:
2292 t = main.Thread(target=cli,threadID=threadID,
2293 name="featureUninstall",args=[feature])
2294 pool.append(t)
2295 t.start()
2296 threadID = threadID + 1
2297
2298 results = []
2299 for thread in pool:
2300 thread.join()
2301 results.append(thread.result)
2302 time2 = time.time()
2303
2304 if( all(result == main.TRUE for result in results) == False):
2305 main.log.info("Did not uninstall onos-app-ifwd feature properly")
2306 uninstallResult = main.FALSE
2307 #main.cleanup()
2308 #main.exit()
2309 else:
2310 main.log.info("Successful feature:uninstall onos-app-ifwd")
2311 uninstallResult = main.TRUE
2312 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
2313
2314 # Waiting for reative flows to be cleared.
2315 time.sleep( 10 )
2316
2317 case11Result = installResult and ping_result and uninstallResult
2318 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
2319 onpass="Intent based Reactive forwarding Pingall test PASS",
2320 onfail="Intent based Reactive forwarding Pingall test FAIL" )
2321
2322 def CASE99(self):
2323 import time
2324 # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
2325 main.step( "Stop ONOS on all Nodes" )
2326 stopResult = main.TRUE
2327 for i in range( 1, int( main.numCtrls ) + 1 ):
2328 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2329 main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
2330 sresult = main.ONOSbench.onosStop( ONOS_ip )
2331 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2332 onpass="Test step PASS",
2333 onfail="Test step FAIL" )
2334 stopResult = ( stopResult and sresult )
2335
2336 main.step( "Start ONOS on all Nodes" )
2337 startResult = main.TRUE
2338 for i in range( 1, int( main.numCtrls ) + 1 ):
2339 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2340 main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
2341 sresult = main.ONOSbench.onosStart( ONOS_ip )
2342 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2343 onpass="Test step PASS",
2344 onfail="Test step FAIL" )
2345 startResult = ( startResult and sresult )
2346
2347 main.step( "Start ONOS CLI on all nodes" )
2348 cliResult = main.TRUE
2349 time.sleep( 30 )
2350 main.log.step(" Start ONOS cli using thread ")
2351 pool = []
2352 time1 = time.time()
2353 for i in range( int( main.numCtrls ) ):
2354 t = main.Thread(target=main.CLIs[i].startOnosCli,
2355 threadID=main.threadID,
2356 name="startOnosCli",
2357 args=main.onosIPs[i])
2358 pool.append(t)
2359 t.start()
2360 main.threadID = main.threadID + 1
2361 for t in pool:
2362 t.join()
2363 cliResult = cliResult and t.result
2364 time2 = time.time()
2365
2366 if not cliResult:
2367 main.log.info("ONOS CLI did not start up properly")
2368 #main.cleanup()
2369 #main.exit()
2370 else:
2371 main.log.info("Successful CLI startup")
2372 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
2373
2374 case99Result = ( startResult and cliResult )
2375 time.sleep(30)
2376 utilities.assert_equals(
2377 expect=main.TRUE,
2378 actual=case99Result,
2379 onpass="Starting new Chordal topology test PASS",
2380 onfail="Starting new Chordal topology test FAIL" )