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