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