blob: 4636bcc644633de6720f4a6912930d38fa52d2a4 [file] [log] [blame]
pingping-linffca7e22015-11-13 15:43:08 -08001# Testing the functionality of SDN-IP with single ONOS instance
2class USECASE_SdnipFunction_fsfw:
3
4 def __init__( self ):
5 self.default = ''
6 global branchName
7
8 # This case is to setup Mininet testbed
9 def CASE100( self, main ):
10 """
11 Start mininet
12 """
13 import os
14 import imp
15 main.log.case( "Setup the Mininet testbed" )
16 main.dependencyPath = main.testDir + \
17 main.params[ 'DEPENDENCY' ][ 'path' ]
18 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
19
20 main.step( "Starting Mininet Topology" )
21 topology = main.dependencyPath + main.topology
22 topoResult = main.Mininet.startNet( topoFile = topology )
23 utilities.assert_equals( expect = main.TRUE,
24 actual = topoResult,
25 onpass = "Successfully loaded topology",
26 onfail = "Failed to load topology" )
27 # Exit if topology did not load properly
28 if not topoResult:
29 main.cleanup()
30 main.exit()
31 main.step( "Connect switches to controller" )
32
33 global ONOS1Ip
34 ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
35 # connect all switches to controller
36 swResult = main.TRUE
37 for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
38 sw = "sw%s" % ( i )
39 swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip )
40 # swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip, port = "6633" )
41 utilities.assert_equals( expect = main.TRUE,
42 actual = swResult,
43 onpass = "Successfully connect all switches to ONOS",
44 onfail = "Failed to connect all switches to ONOS" )
45 if not swResult:
46 main.cleanup()
47 main.exit()
48
49 main.step( "Set up tunnel from Mininet node to onos node" )
50 forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', ONOS1Ip )
51 command = 'ssh -nNT -o "PasswordAuthentication no" \
52 -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, ONOS1Ip )
53
54 tunnelResult = main.TRUE
55 tunnelResult = main.Mininet.node( "root", command )
56 utilities.assert_equals( expect = True,
57 actual = ( "PasswordAuthentication" in tunnelResult ),
58 onpass = "Created tunnel succeeded",
59 onfail = "Create tunnel failed" )
60 if ("PasswordAuthentication" not in tunnelResult) :
61 main.cleanup()
62 main.exit()
63
64
65 # This case is to setup ONOS
66 def CASE101( self, main ):
67 """
68 Package ONOS and install it
69 Startup sequence:
70 cell <name>
71 onos-verify-cell
72 onos-package
73 onos-install -f
74 onos-wait-for-start
75 """
76 import json
77 import time
78 from operator import eq
79
80 main.case( "Setting up test environment" )
81
82 cellName = main.params[ 'ENV' ][ 'cellName' ]
83
84 main.step( "Applying cell variable to environment" )
85 cellResult = main.ONOSbench.setCell( cellName )
86 utilities.assert_equals( expect = main.TRUE,
87 actual = cellResult,
88 onpass = "Set cell succeeded",
89 onfail = "Set cell failed" )
90
91 verifyResult = main.ONOSbench.verifyCell()
92 utilities.assert_equals( expect = main.TRUE,
93 actual = verifyResult,
94 onpass = "Verify cell succeeded",
95 onfail = "Verify cell failed" )
96
97 branchName = main.ONOSbench.getBranchName()
98 main.log.report( "ONOS is on branch: " + branchName )
99
100 main.log.step( "Uninstalling ONOS" )
101 uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
102 utilities.assert_equals( expect = main.TRUE,
103 actual = uninstallResult,
104 onpass = "Uninstall ONOS succeeded",
105 onfail = "Uninstall ONOS failed" )
106 '''
107 main.step( "Git pull" )
108 gitPullResult = main.ONOSbench.gitPull()
109 main.log.info( "gitPullResult" )
110 main.log.info( gitPullResult )
111 gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 )
112 utilities.assert_equals( expect = True,
113 actual = gitPullResult2,
114 onpass = "Git pull ONOS succeeded",
115 onfail = "Git pull ONOS failed" )
116
117 main.step( "Using mvn clean install" )
118 if gitPullResult == main.TRUE:
119 mciResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
120 utilities.assert_equals( expect = main.TRUE,
121 actual = mciResult,
122 onpass = "Maven clean install ONOS succeeded",
123 onfail = "Maven clean install ONOS failed" )
124 else:
125 main.log.warn( "Did not pull new code so skipping mvn " +
126 "clean install" )
127 mciResult = main.TRUE
128 '''
129
130 main.ONOSbench.getVersion( report = True )
131
132 main.step( "Creating ONOS package" )
133 packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
134 utilities.assert_equals( expect = main.TRUE,
135 actual = packageResult,
136 onpass = "Package ONOS succeeded",
137 onfail = "Package ONOS failed" )
138
139 main.step( "Installing ONOS package" )
140 onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
141 node = ONOS1Ip )
142 utilities.assert_equals( expect = main.TRUE,
143 actual = onos1InstallResult,
144 onpass = "Install ONOS succeeded",
145 onfail = "Install ONOS failed" )
146
147 main.step( "Checking if ONOS is up yet" )
148 onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
149 utilities.assert_equals( expect = main.TRUE,
150 actual = onos1UpResult,
151 onpass = "ONOS is up",
152 onfail = "ONOS is NOT up" )
153
154 main.step( "Checking if ONOS CLI is ready" )
155 cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
156 commandlineTimeout = 100, onosStartTimeout = 600 )
157 utilities.assert_equals( expect = main.TRUE,
158 actual = cliResult,
159 onpass = "ONOS CLI is ready",
160 onfail = "ONOS CLI is NOT ready" )
161
162 caseResult = ( cellResult and verifyResult and
163 packageResult and
164 onos1InstallResult and onos1UpResult and cliResult )
165
166 utilities.assert_equals( expect = main.TRUE, actual = caseResult,
167 onpass = "ONOS startup successful",
168 onfail = "ONOS startup NOT successful" )
169
170 if caseResult == main.FALSE:
171 main.log.info( "ONOS startup failed!" )
172 main.cleanup()
173 main.exit()
174
175 main.log.info( "Get links in the network" )
176 time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
177 summaryResult = main.ONOScli.summary()
178 linkNum = json.loads( summaryResult )[ "links" ]
179 if linkNum < 100:
180 main.log.info( "Link number is wrong!" )
181 listResult = main.ONOScli.links( jsonFormat = False )
182 main.log.info( listResult )
183 main.cleanup()
184 main.exit()
185
186 listResult = main.ONOScli.links( jsonFormat = False )
187 main.log.info( listResult )
188
189 main.step( "Activate sdn-ip application" )
190 activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" )
191 utilities.assert_equals( expect = main.TRUE,
192 actual = activeSDNIPresult,
193 onpass = "Activate SDN-IP succeeded",
194 onfail = "Activate SDN-IP failed" )
195 if not activeSDNIPresult:
196 main.log.info( "Activate SDN-IP failed!" )
197 main.cleanup()
198 main.exit()
199
200
201 main.log.info( "Wait SDN-IP to finish installing connectivity intents \
202 and the BGP paths in data plane are ready..." )
203 time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
204 main.log.info( "Wait Quagga to finish delivery all routes to each \
205 other and to sdn-ip, plus finish installing all intents..." )
206 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
207 time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
208
209
210 def CASE102( self, main ):
211 '''
212 This test case is to load the methods from other Python files.
213 '''
214 main.case( "Loading methods from other Python file" )
215 # load the methods from other file
216 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
217 main.Functions = imp.load_source( wrapperFile,
218 main.dependencyPath +
219 wrapperFile +
220 ".py" )
221
222
223 def CASE1( self, main ):
224 '''
225 ping test from 3 bgp peers to BGP speaker
226 '''
227
228 main.case( "Ping tests between BGP peers and speakers" )
229 main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
230 peers = ["peer64514", "peer64515", "peer64516"],
231 expectAllSuccess = True )
232
233
234 def CASE2( self, main ):
235 '''
236 point-to-point intents test for each BGP peer and BGP speaker pair
237 '''
238 main.case( "Check point-to-point intents" )
239 main.log.info( "There are %s BGP peers in total "
240 % main.params[ 'config' ][ 'peerNum' ] )
241 main.step( "Check P2P intents number from ONOS CLI" )
242
243 getIntentsResult = main.ONOScli.intents( jsonFormat = True )
244 bgpIntentsActualNum = \
245 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
246 bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
247 main.log.info( "bgpIntentsExpected num is:" )
248 main.log.info( bgpIntentsExpectedNum )
249 main.log.info( "bgpIntentsActual num is:" )
250 main.log.info( bgpIntentsActualNum )
251 utilities.assertEquals( \
252 expect = True,
253 actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
254 onpass = "PointToPointIntent Intent Num is correct!",
255 onfail = "PointToPointIntent Intent Num is wrong!" )
256
257
258 def CASE3( self, main ):
259 '''
260 routes and intents check to all BGP peers
261 '''
262 main.case( "Check routes and M2S intents to all BGP peers" )
263
264 allRoutesExpected = []
265 allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
266 allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
267 allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
268
269 getRoutesResult = main.ONOScli.routes( jsonFormat = True )
270 allRoutesActual = \
271 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
272 allRoutesStrExpected = str( sorted( allRoutesExpected ) )
273 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
274
275 main.step( "Check routes installed" )
276 main.log.info( "Routes expected:" )
277 main.log.info( allRoutesStrExpected )
278 main.log.info( "Routes get from ONOS CLI:" )
279 main.log.info( allRoutesStrActual )
280 utilities.assertEquals( \
281 expect = allRoutesStrExpected, actual = allRoutesStrActual,
282 onpass = "Routes are correct!",
283 onfail = "Routes are wrong!" )
284
285 main.step( "Check M2S intents installed" )
286 getIntentsResult = main.ONOScli.intents( jsonFormat = True )
287 routeIntentsActualNum = \
288 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
289 routeIntentsExpectedNum = 3
290
291 main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
292 main.log.info( routeIntentsExpectedNum )
293 main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
294 main.log.info( routeIntentsActualNum )
295 utilities.assertEquals( \
296 expect = True,
297 actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
298 onpass = "MultiPointToSinglePoint Intent Num is correct!",
299 onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
300
301 main.step( "Check whether all flow status are ADDED" )
302 utilities.assertEquals( \
303 expect = main.TRUE,
304 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
305 onpass = "Flow status is correct!",
306 onfail = "Flow status is wrong!" )
307
308
309 def CASE4( self, main ):
310 '''
311 Ping test in data plane for each route
312 '''
313 main.case( "Ping test for each route, all hosts behind BGP peers" )
314 main.Functions.pingHostToHost( main,
315 hosts = ["host64514", "host64515", "host64516"],
316 expectAllSuccess = True )
317
318
319 def CASE5( self, main ):
320 '''
321 Cut links to peers one by one, check routes/intents
322 '''
323 import time
324 main.case( "Bring down links and check routes/intents" )
325 main.step( "Bring down the link between sw32 and peer64514" )
326 linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
327 OPTION = "down" )
328 utilities.assertEquals( expect = main.TRUE,
329 actual = linkResult1,
330 onpass = "Bring down link succeeded!",
331 onfail = "Bring down link failed!" )
332
333 if linkResult1 == main.TRUE:
334 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
335 main.Functions.checkRouteNum( main, 2 )
336 main.Functions.checkM2SintentNum( main, 2 )
337 else:
338 main.log.info( "Bring down link failed!" )
339 main.cleanup()
340 main.exit()
341
342 main.step( "Bring down the link between sw8 and peer64515" )
343 linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
344 OPTION = "down" )
345 utilities.assertEquals( expect = main.TRUE,
346 actual = linkResult2,
347 onpass = "Bring down link succeeded!",
348 onfail = "Bring down link failed!" )
349 if linkResult2 == main.TRUE:
350 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
351 main.Functions.checkRouteNum( main, 1 )
352 main.Functions.checkM2SintentNum( main, 1 )
353 else:
354 main.log.info( "Bring down link failed!" )
355 main.cleanup()
356 main.exit()
357
358 main.step( "Bring down the link between sw28 and peer64516" )
359 linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
360 OPTION = "down" )
361 utilities.assertEquals( expect = main.TRUE,
362 actual = linkResult3,
363 onpass = "Bring down link succeeded!",
364 onfail = "Bring down link failed!" )
365 if linkResult3 == main.TRUE:
366 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
367 main.Functions.checkRouteNum( main, 0 )
368 main.Functions.checkM2SintentNum( main, 0 )
369 else:
370 main.log.info( "Bring down link failed!" )
371 main.cleanup()
372 main.exit()
373
374 main.step( "Check whether all flow status are ADDED" )
375 utilities.assertEquals( \
376 expect = main.TRUE,
377 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
378 onpass = "Flow status is correct!",
379 onfail = "Flow status is wrong!" )
380
381 # Ping test
382 main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
383 peers = ["peer64514", "peer64515", "peer64516"],
384 expectAllSuccess = False )
385 main.Functions.pingHostToHost( main,
386 hosts = ["host64514", "host64515", "host64516"],
387 expectAllSuccess = False )
388
389
390 def CASE6( self, main ):
391 '''
392 Recover links to peers one by one, check routes/intents
393 '''
394 import time
395 main.case( "Bring up links and check routes/intents" )
396 main.step( "Bring up the link between sw32 and peer64514" )
397 linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
398 OPTION = "up" )
399 utilities.assertEquals( expect = main.TRUE,
400 actual = linkResult1,
401 onpass = "Bring up link succeeded!",
402 onfail = "Bring up link failed!" )
403 if linkResult1 == main.TRUE:
404 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
405 main.Functions.checkRouteNum( main, 1 )
406 main.Functions.checkM2SintentNum( main, 1 )
407 else:
408 main.log.info( "Bring up link failed!" )
409 main.cleanup()
410 main.exit()
411
412 main.step( "Bring up the link between sw8 and peer64515" )
413 linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
414 OPTION = "up" )
415 utilities.assertEquals( expect = main.TRUE,
416 actual = linkResult2,
417 onpass = "Bring up link succeeded!",
418 onfail = "Bring up link failed!" )
419 if linkResult2 == main.TRUE:
420 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
421 main.Functions.checkRouteNum( main, 2 )
422 main.Functions.checkM2SintentNum( main, 2 )
423 else:
424 main.log.info( "Bring up link failed!" )
425 main.cleanup()
426 main.exit()
427
428 main.step( "Bring up the link between sw28 and peer64516" )
429 linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
430 OPTION = "up" )
431 utilities.assertEquals( expect = main.TRUE,
432 actual = linkResult3,
433 onpass = "Bring up link succeeded!",
434 onfail = "Bring up link failed!" )
435 if linkResult3 == main.TRUE:
436 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
437 main.Functions.checkRouteNum( main, 3 )
438 main.Functions.checkM2SintentNum( main, 3 )
439 else:
440 main.log.info( "Bring up link failed!" )
441 main.cleanup()
442 main.exit()
443
444 main.step( "Check whether all flow status are ADDED" )
445 utilities.assertEquals( \
446 expect = main.TRUE,
447 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
448 onpass = "Flow status is correct!",
449 onfail = "Flow status is wrong!" )
450
451 # Ping test
452 main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
453 peers = ["peer64514", "peer64515", "peer64516"],
454 expectAllSuccess = True )
455 main.Functions.pingHostToHost( main,
456 hosts = ["host64514", "host64515", "host64516"],
457 expectAllSuccess = True )
458
459
460 def CASE7( self, main ):
461 '''
462 Shut down a edge switch, check P-2-P and M-2-S intents, ping test
463 '''
464 import time
465 main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
466 main.step( "Stop sw32" )
467 result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
468 utilities.assertEquals( expect = main.TRUE, actual = result,
469 onpass = "Stopping switch succeeded!",
470 onfail = "Stopping switch failed!" )
471
472 if result == main.TRUE:
473 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
474 main.Functions.checkRouteNum( main, 2 )
475 main.Functions.checkM2SintentNum( main, 2 )
476 main.Functions.checkP2PintentNum( main, 12 )
477 else:
478 main.log.info( "Stopping switch failed!" )
479 main.cleanup()
480 main.exit()
481
482 main.step( "Check ping between hosts behind BGP peers" )
483 result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
484 result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
485 result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
486
487 pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
488 and ( result3 == main.FALSE )
489 utilities.assert_equals( expect = True, actual = pingResult1,
490 onpass = "Ping test result is correct",
491 onfail = "Ping test result is wrong" )
492
493 if pingResult1 == False:
494 main.cleanup()
495 main.exit()
496
497 main.step( "Check ping between BGP peers and speakers" )
498 result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
499 result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
500 result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
501
502 pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
503 and ( result6 == main.TRUE )
504 utilities.assert_equals( expect = True, actual = pingResult2,
505 onpass = "Speaker1 ping peers successful",
506 onfail = "Speaker1 ping peers NOT successful" )
507
508 if pingResult2 == False:
509 main.cleanup()
510 main.exit()
511
512 main.step( "Check whether all flow status are ADDED" )
513 utilities.assertEquals( \
514 expect = main.TRUE,
515 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
516 onpass = "Flow status is correct!",
517 onfail = "Flow status is wrong!" )
518
519
520 def CASE8( self, main ):
521 '''
522 Bring up the edge switch (sw32) which was shut down in CASE7,
523 check P-2-P and M-2-S intents, ping test
524 '''
525 import time
526 main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
527 main.step( "Start sw32" )
528 result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
529 utilities.assertEquals( \
530 expect = main.TRUE,
531 actual = result1,
532 onpass = "Starting switch succeeded!",
533 onfail = "Starting switch failed!" )
534
535 result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
536 utilities.assertEquals( \
537 expect = main.TRUE,
538 actual = result2,
539 onpass = "Connect switch to ONOS succeeded!",
540 onfail = "Connect switch to ONOS failed!" )
541
542 if result1 and result2:
543 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
544 main.Functions.checkRouteNum( main, 3 )
545 main.Functions.checkM2SintentNum( main, 3 )
546 main.Functions.checkP2PintentNum( main, 18 )
547 else:
548 main.log.info( "Starting switch failed!" )
549 main.cleanup()
550 main.exit()
551
552 main.step( "Check whether all flow status are ADDED" )
553 utilities.assertEquals( \
554 expect = main.TRUE,
555 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
556 onpass = "Flow status is correct!",
557 onfail = "Flow status is wrong!" )
558
559 # Ping test
560 main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
561 peers = ["peer64514", "peer64515", "peer64516"],
562 expectAllSuccess = True )
563 main.Functions.pingHostToHost( main,
564 hosts = ["host64514", "host64515", "host64516"],
565 expectAllSuccess = True )
566
567
568 def CASE9( self, main ):
569 '''
570 Bring down a switch in best path, check:
571 route number, P2P intent number, M2S intent number, ping test
572 '''
573 main.case( "Stop sw11 located in best path, \
574 check route number, P2P intent number, M2S intent number, ping test" )
575
576 main.log.info( "Check the flow number correctness before stopping sw11" )
577 main.Functions.checkFlowNum( main, "sw11", 13 )
578 main.Functions.checkFlowNum( main, "sw1", 3 )
579 main.Functions.checkFlowNum( main, "sw7", 3 )
580 main.log.info( main.Mininet.checkFlows( "sw11" ) )
581 main.log.info( main.Mininet.checkFlows( "sw1" ) )
582 main.log.info( main.Mininet.checkFlows( "sw7" ) )
583
584 main.step( "Stop sw11" )
585 result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
586 utilities.assertEquals( expect = main.TRUE, actual = result,
587 onpass = "Stopping switch succeeded!",
588 onfail = "Stopping switch failed!" )
589 if result:
590 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
591 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
592 main.Functions.checkRouteNum( main, 3 )
593 main.Functions.checkM2SintentNum( main, 3 )
594 main.Functions.checkP2PintentNum( main, 18 )
595 else:
596 main.log.info( "Stopping switch failed!" )
597 main.cleanup()
598 main.exit()
599
600 main.step( "Check whether all flow status are ADDED" )
601 utilities.assertEquals( \
602 expect = main.TRUE,
603 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
604 onpass = "Flow status is correct!",
605 onfail = "Flow status is wrong!" )
606 # Ping test
607 main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
608 peers = ["peer64514", "peer64515", "peer64516"],
609 expectAllSuccess = True )
610 main.Functions.pingHostToHost( main,
611 hosts = ["host64514", "host64515", "host64516"],
612 expectAllSuccess = True )
613
614
615 def CASE10( self, main ):
616 '''
617 Bring up the switch which was stopped in CASE9, check:
618 route number, P2P intent number, M2S intent number, ping test
619 '''
620 main.case( "Start sw11 which was stopped in CASE9, \
621 check route number, P2P intent number, M2S intent number, ping test" )
622
623 main.log.info( "Check the flow status before starting sw11" )
624 main.Functions.checkFlowNum( main, "sw1", 11 )
625 main.Functions.checkFlowNum( main, "sw7", 5 )
626 main.log.info( main.Mininet.checkFlows( "sw1" ) )
627 main.log.info( main.Mininet.checkFlows( "sw7" ) )
628
629 main.step( "Start sw11" )
630 result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
631 utilities.assertEquals( expect = main.TRUE, actual = result1,
632 onpass = "Starting switch succeeded!",
633 onfail = "Starting switch failed!" )
634 result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
635 utilities.assertEquals( expect = main.TRUE, actual = result2,
636 onpass = "Connect switch to ONOS succeeded!",
637 onfail = "Connect switch to ONOS failed!" )
638 if result1 and result2:
639 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
640 main.Functions.checkRouteNum( main, 3 )
641 main.Functions.checkM2SintentNum( main, 3 )
642 main.Functions.checkP2PintentNum( main, 18 )
643
644 main.log.debug( main.Mininet.checkFlows( "sw11" ) )
645 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
646 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
647 else:
648 main.log.info( "Starting switch failed!" )
649 main.cleanup()
650 main.exit()
651
652 main.step( "Check whether all flow status are ADDED" )
653 utilities.assertEquals( \
654 expect = main.TRUE,
655 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
656 onpass = "Flow status is correct!",
657 onfail = "Flow status is wrong!" )
658 # Ping test
659 main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
660 peers = ["peer64514", "peer64515", "peer64516"],
661 expectAllSuccess = True )
662 main.Functions.pingHostToHost( main,
663 hosts = ["host64514", "host64515", "host64516"],
664 expectAllSuccess = True )