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