blob: 45ea36968b1abe5e27566913fcdaea839762b4da [file] [log] [blame]
pingping-lin28e7b212015-09-10 10:14:58 -07001# Testing the functionality of SDN-IP with single ONOS instance
2class USECASE_SdnipI2:
3
4 def __init__( self ):
5 self.default = ''
6 global branchName
7
pingping-linb702c602015-09-10 17:00:29 -07008 # This case is to setup Mininet testbed
9 def CASE100( self, main ):
10 """
11 Start mininet
12 """
13 import os
pingping-lin4f80c492015-09-15 14:34:42 -070014 import imp
pingping-linb702c602015-09-10 17:00:29 -070015 main.log.case( "Start Mininet topology" )
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 stepResult = topoResult
24 utilities.assert_equals( expect = main.TRUE,
25 actual = stepResult,
26 onpass = "Successfully loaded topology",
27 onfail = "Failed to load topology" )
28 # Exit if topology did not load properly
29 if not topoResult:
30 main.cleanup()
31 main.exit()
pingping-lin28e7b212015-09-10 10:14:58 -070032
33 # This case is to setup ONOS
pingping-linb702c602015-09-10 17:00:29 -070034 def CASE101( self, main ):
pingping-lin28e7b212015-09-10 10:14:58 -070035 """
36 CASE100 is to compile ONOS and install it
37 Startup sequence:
38 cell <name>
39 onos-verify-cell
40 git pull
41 mvn clean install
42 onos-package
43 onos-install -f
44 onos-wait-for-start
45 """
46 import json
47 import time
48 from operator import eq
49
50 main.case( "Setting up test environment" )
51
52 cellName = main.params[ 'ENV' ][ 'cellName' ]
pingping-lind791d342015-09-17 18:34:31 -070053 global ONOS1Ip
pingping-lin28e7b212015-09-10 10:14:58 -070054 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
55
56 main.step( "Applying cell variable to environment" )
57 cellResult = main.ONOSbench.setCell( cellName )
58 verifyResult = main.ONOSbench.verifyCell()
59
60 branchName = main.ONOSbench.getBranchName()
61 main.log.info( "ONOS is on branch: " + branchName )
62
63 main.log.report( "Uninstalling ONOS" )
64 main.ONOSbench.onosUninstall( ONOS1Ip )
65
66 # cleanInstallResult = main.TRUE
67 # gitPullResult = main.TRUE
68
69 main.step( "Git pull" )
70 gitPullResult = main.ONOSbench.gitPull()
71
72 main.step( "Using mvn clean install" )
73 if gitPullResult == main.TRUE:
74 cleanInstallResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
75 else:
76 main.log.warn( "Did not pull new code so skipping mvn " +
77 "clean install" )
78 cleanInstallResult = main.TRUE
79
80 main.ONOSbench.getVersion( report = True )
81
82 main.step( "Creating ONOS package" )
83 packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
84
85 main.step( "Installing ONOS package" )
86 onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
87 node = ONOS1Ip )
88
89 main.step( "Checking if ONOS is up yet" )
90 for i in range( 2 ):
91 onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
92 if onos1Isup:
93 break
94 if not onos1Isup:
95 main.log.report( "ONOS1 didn't start!" )
96
97 cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
98 commandlineTimeout = 100, onosStartTimeout = 600 )
99
pingping-linb702c602015-09-10 17:00:29 -0700100 caseResult = ( cleanInstallResult and packageResult and
pingping-lin28e7b212015-09-10 10:14:58 -0700101 cellResult and verifyResult and
102 onos1InstallResult and
103 onos1Isup and cliResult )
104
pingping-linb702c602015-09-10 17:00:29 -0700105 utilities.assert_equals( expect = main.TRUE, actual = caseResult,
pingping-lin28e7b212015-09-10 10:14:58 -0700106 onpass = "ONOS startup successful",
107 onfail = "ONOS startup NOT successful" )
108
pingping-linb702c602015-09-10 17:00:29 -0700109 if caseResult == main.FALSE:
pingping-lin28e7b212015-09-10 10:14:58 -0700110 main.cleanup()
111 main.exit()
112
pingping-lin28e7b212015-09-10 10:14:58 -0700113 main.step( "Get links in the network" )
114 listResult = main.ONOScli.links( jsonFormat = False )
115 main.log.info( listResult )
116 main.log.info( "Activate sdn-ip application" )
117 main.ONOScli.activateApp( "org.onosproject.sdnip" )
pingping-linb702c602015-09-10 17:00:29 -0700118
119 main.log.info( "Wait sdn-ip to finish installing connectivity intents, \
120 and the BGP paths in data plane are ready..." )
pingping-lin28e7b212015-09-10 10:14:58 -0700121 time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
pingping-linb702c602015-09-10 17:00:29 -0700122 main.log.info( "Wait Quagga to finish delivery all routes to each \
123 other and to sdn-ip, plus finish installing all intents..." )
pingping-lin28e7b212015-09-10 10:14:58 -0700124 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
125 time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
126
127
pingping-lin4f80c492015-09-15 14:34:42 -0700128 def CASE102( self, main ):
129 '''
130 This test case is to load the methods from other Python files.
131 '''
132 main.case( "Loading the methods from other Python file" )
133 # load the methods from other file
134 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
135 main.Functions = imp.load_source( wrapperFile,
136 main.dependencyPath +
137 wrapperFile +
138 ".py" )
139
140
pingping-lin0ce60622015-09-10 14:37:33 -0700141 def CASE1( self, main ):
142 '''
143 ping test from 3 bgp peers to BGP speaker
144 '''
pingping-lin950b50d2015-09-14 12:00:08 -0700145
146 m2SIntentsNumberActual = main.ONOScli.m2SIntentInstalledNumber()
147 main.log.info( "MultiPointToSinglePoint intent number actual is:" )
148 main.log.info( m2SIntentsNumberActual )
149
pingping-lin0ce60622015-09-10 14:37:33 -0700150 main.case( "This case is to check ping between BGP peers and speakers" )
pingping-linb702c602015-09-10 17:00:29 -0700151 result1 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
152 result2 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
153 result3 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
154
pingping-lin950b50d2015-09-14 12:00:08 -0700155
pingping-linb702c602015-09-10 17:00:29 -0700156 caseResult = result1 and result2 and result3
157 utilities.assert_equals( expect = main.TRUE, actual = caseResult,
158 onpass = "Speaker1 ping peers successful",
159 onfail = "Speaker1 ping peers NOT successful" )
160
161 if caseResult == main.FALSE:
162 main.cleanup()
163 main.exit()
pingping-lin0ce60622015-09-10 14:37:33 -0700164
pingping-lin950b50d2015-09-14 12:00:08 -0700165
pingping-lin0ce60622015-09-10 14:37:33 -0700166 def CASE2( self, main ):
167 '''
168 point-to-point intents test for each BGP peer and BGP speaker pair
169 '''
170 main.case( "This case is to check point-to-point intents" )
171 main.log.info( "There are %s BGP peers in total "
172 % main.params[ 'config' ][ 'peerNum' ] )
173 main.step( "Get point-to-point intents from ONOS CLI" )
174
175 getIntentsResult = main.ONOScli.intents( jsonFormat = True )
176 bgpIntentsActualNum = \
177 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
178 bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
179 main.log.info( "bgpIntentsExpected num is:" )
180 main.log.info( bgpIntentsExpectedNum )
181 main.log.info( "bgpIntentsActual num is:" )
182 main.log.info( bgpIntentsActualNum )
183 utilities.assertEquals( \
184 expect = True,
185 actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
186 onpass = "***PointToPointIntent Intent Num in SDN-IP are correct!***",
187 onfail = "***PointToPointIntent Intent Num in SDN-IP are wrong!***" )
188
189
190 def CASE3( self, main ):
191 '''
192 routes and intents check to all BGP peers
193 '''
194 main.case( "This case is to check routes and intents to all BGP peers" )
195
pingping-lin28e7b212015-09-10 10:14:58 -0700196 allRoutesExpected = []
197 allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
198 allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
199 allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
200
201 getRoutesResult = main.ONOScli.routes( jsonFormat = True )
202 allRoutesActual = \
203 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
204 allRoutesStrExpected = str( sorted( allRoutesExpected ) )
205 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
206
207 main.step( "Check routes installed" )
208 main.log.info( "Routes expected:" )
209 main.log.info( allRoutesStrExpected )
210 main.log.info( "Routes get from ONOS CLI:" )
211 main.log.info( allRoutesStrActual )
212 utilities.assertEquals( \
213 expect = allRoutesStrExpected, actual = allRoutesStrActual,
214 onpass = "***Routes in SDN-IP are correct!***",
215 onfail = "***Routes in SDN-IP are wrong!***" )
216
217 main.step( "Check MultiPointToSinglePointIntent intents installed" )
218 getIntentsResult = main.ONOScli.intents( jsonFormat = True )
219 routeIntentsActualNum = \
220 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
221 routeIntentsExpectedNum = 3
222
223 main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
224 main.log.info( routeIntentsExpectedNum )
225 main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
226 main.log.info( routeIntentsActualNum )
227 utilities.assertEquals( \
228 expect = True,
229 actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
230 onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
231 correct!***",
232 onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
233 wrong!***" )
234
pingping-linbab7f8a2015-09-21 17:33:36 -0700235 main.step( "Check whether all flow status are ADDED" )
236 utilities.assertEquals( \
237 expect = main.TRUE,
238 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
239 onpass = "***Flow status is correct!***",
240 onfail = "***Flow status is wrong!***" )
241
pingping-lin950b50d2015-09-14 12:00:08 -0700242
243 def CASE4( self, main ):
244 '''
245 Ping test in data plane for each route
246 '''
247 main.case( "This case is to check ping for each route" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700248 main.step( "Start ping tests between hosts behind BGP peers" )
pingping-lin950b50d2015-09-14 12:00:08 -0700249 result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
250 result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
251 result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
252
253 caseResult = result1 and result2 and result3
254 utilities.assert_equals( expect = main.TRUE, actual = caseResult,
255 onpass = "Ping test for each route successful",
256 onfail = "Ping test for each route NOT successful" )
257
258 if caseResult == main.FALSE:
259 main.cleanup()
260 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700261
262
263 def CASE5( self, main ):
264 '''
265 Cut links to peers one by one, check routes/intents
266 '''
267 import time
268 main.case( "This case is to bring down links and check routes/intents" )
269 main.step( "Bring down the link between sw32 and peer64514" )
270 result = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
271 OPTION = "down" )
272 if result == main.TRUE:
273 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
274 main.Functions.checkRouteNum( main, 2 )
275 main.Functions.checkM2SintentNum( main, 2 )
276 else:
277 main.log.info( "Bring down link failed!!!" )
278 main.exit();
279
280 main.step( "Bring down the link between sw8 and peer64515" )
281 result = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
282 OPTION = "down" )
283 if result == main.TRUE:
284 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
285 main.Functions.checkRouteNum( main, 1 )
286 main.Functions.checkM2SintentNum( main, 1 )
287 else:
288 main.log.info( "Bring down link failed!!!" )
289 main.exit();
290
291 main.step( "Bring down the link between sw28 and peer64516" )
292 result = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
293 OPTION = "down" )
294 if result == main.TRUE:
295 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
296 main.Functions.checkRouteNum( main, 0 )
297 main.Functions.checkM2SintentNum( main, 0 )
298 else:
299 main.log.info( "Bring down link failed!!!" )
300 main.exit();
301
pingping-linbab7f8a2015-09-21 17:33:36 -0700302 main.step( "Check whether all flow status are ADDED" )
303 utilities.assertEquals( \
304 expect = main.TRUE,
305 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
306 onpass = "***Flow status is correct!***",
307 onfail = "***Flow status is wrong!***" )
308
pingping-lin4f80c492015-09-15 14:34:42 -0700309
310 def CASE6(self, main):
311 '''
312 Recover links to peers one by one, check routes/intents
313 '''
314 import time
315 main.case( "This case is to bring up links and check routes/intents" )
316 main.step( "Bring up the link between sw32 and peer64514" )
317 result = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
318 OPTION = "up" )
319 if result == main.TRUE:
320 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
321 main.Functions.checkRouteNum( main, 1 )
322 main.Functions.checkM2SintentNum( main, 1 )
323 else:
324 main.log.info( "Bring up link failed!!!" )
325 main.exit();
326
327 main.step( "Bring up the link between sw8 and peer64515" )
328 result = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
329 OPTION = "up" )
330 if result == main.TRUE:
331 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
332 main.Functions.checkRouteNum( main, 2 )
333 main.Functions.checkM2SintentNum( main, 2 )
334 else:
335 main.log.info( "Bring up link failed!!!" )
336 main.exit();
337
338 main.step( "Bring up the link between sw28 and peer64516" )
339 result = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
340 OPTION = "up" )
341 if result == main.TRUE:
342 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
343 main.Functions.checkRouteNum( main, 3 )
344 main.Functions.checkM2SintentNum( main, 3 )
345 else:
346 main.log.info( "Bring up link failed!!!" )
347 main.exit();
pingping-linbab7f8a2015-09-21 17:33:36 -0700348
349 main.step( "Check whether all flow status are ADDED" )
350 utilities.assertEquals( \
351 expect = main.TRUE,
352 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
353 onpass = "***Flow status is correct!***",
354 onfail = "***Flow status is wrong!***" )
pingping-lin8244a3b2015-09-16 13:36:56 -0700355 '''
356 Note: at the end of this test case, we should carry out ping test.
357 So we run CASE4 again after CASE6
358 '''
359
360
361 def CASE7(self, main):
362 '''
363 shut down a edge switch, check P-2-P and M-2-S intents, ping test
364 '''
365 import time
366 main.case( "This case is to stop 1 edge switch,\
367 check P-2-P and M-2-S intents, ping test")
368 main.step( "Stop sw32" )
369 result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
370 if result == main.TRUE:
371 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
372 main.Functions.checkRouteNum( main, 2 )
373 main.Functions.checkM2SintentNum( main, 2 )
374 main.Functions.checkP2PintentNum( main, 12 )
375 else:
376 main.log.info( "Stop switch failed!!!" )
377 main.exit();
378
pingping-linbab7f8a2015-09-21 17:33:36 -0700379 main.step( "Check whether all flow status are ADDED" )
380 utilities.assertEquals( \
381 expect = main.TRUE,
382 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
383 onpass = "***Flow status is correct!***",
384 onfail = "***Flow status is wrong!***" )
385
pingping-lin8244a3b2015-09-16 13:36:56 -0700386 '''
387 main.step( "Stop sw8" )
388 result = main.Mininet.switch( SW = "sw8", OPTION = "stop" )
389 if result == main.TRUE:
390 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
391 main.Functions.checkRouteNum( main, 1 )
392
393 # Note: there should be 0 M2S intent, not 1.
394 main.Functions.checkM2SintentNum( main, 0 )
395 main.Functions.checkP2PintentNum( main, 6 )
396 else:
397 main.log.info( "Stop switch failed!!!" )
398 main.exit();
399
400 main.step( "Stop sw28" )
401 result = main.Mininet.switch( SW = "sw28", OPTION = "stop" )
402 if result == main.TRUE:
403 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
404 main.Functions.checkRouteNum( main, 0 )
405 main.Functions.checkM2SintentNum( main, 0 )
406 main.Functions.checkP2PintentNum( main, 0 )
407 else:
408 main.log.info( "Stop switch failed!!!" )
409 main.exit();
410 '''
411 '''
412 ping test between BGP speaker and BGP peers, ping test between hosts
413 behind BGP peers ===
414 '''
415
pingping-lind791d342015-09-17 18:34:31 -0700416
pingping-lin8244a3b2015-09-16 13:36:56 -0700417 def CASE8( self, main ):
pingping-lind791d342015-09-17 18:34:31 -0700418 '''
419 Bring up the edge switch which was shut down in CASE7,
420 check P-2-P and M-2-S intents, ping test
421 '''
422 import time
423 main.case( "This case is to start the switch which was shut down in CASE7,\
pingping-lin8244a3b2015-09-16 13:36:56 -0700424 check P-2-P and M-2-S intents, ping test" )
pingping-lind791d342015-09-17 18:34:31 -0700425 main.step( "Start sw32" )
426 result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
427 result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
428
429 if result1 and result2:
430 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
431 main.Functions.checkRouteNum( main, 3 )
432 main.Functions.checkM2SintentNum( main, 3 )
433 main.Functions.checkP2PintentNum( main, 18 )
434 else:
435 main.log.info( "Start switch failed!!!" )
436 main.cleanup()
437 main.exit();
pingping-lin4f80c492015-09-15 14:34:42 -0700438
pingping-linbab7f8a2015-09-21 17:33:36 -0700439 main.step( "Check whether all flow status are ADDED" )
440 utilities.assertEquals( \
441 expect = main.TRUE,
442 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
443 onpass = "***Flow status is correct!***",
444 onfail = "***Flow status is wrong!***" )
445
446
447 def CASE9(self, main):
448 '''
449 Bring down a switch in best path, check:
450 route number, P2P intent number, M2S intent number, ping test
451 '''
452 main.case( "This case is to stop switch in best path, \
453 check route number, P2P intent number, M2S intent number, ping test" )
454
455 main.step( "Check the flow status before stopping sw11" )
456 main.Functions.checkFlowNum( main, "sw11", 13 )
457 main.Functions.checkFlowNum( main, "sw1", 3 )
458 main.Functions.checkFlowNum( main, "sw7", 3 )
459 main.log.info( main.Mininet.checkFlows( "sw11" ) )
460 main.log.info( main.Mininet.checkFlows( "sw1" ) )
461 main.log.info( main.Mininet.checkFlows( "sw7" ) )
462
463 main.step( "Stop sw11" )
464 result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
465 if result:
466 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
467 main.Functions.checkRouteNum( main, 3 )
468 main.Functions.checkM2SintentNum( main, 3 )
469 main.Functions.checkP2PintentNum( main, 18 )
470
471 else:
472 main.log.info( "Stop switch failed!!!" )
473 main.cleanup()
474 main.exit();
475
476 main.step( "Check whether all flow status are ADDED" )
477 utilities.assertEquals( \
478 expect = main.TRUE,
479 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
480 onpass = "***Flow status is correct!***",
481 onfail = "***Flow status is wrong!***" )
482 '''
483 Note: this test case should be followed by ping test, CASE1 and CASE4
484 '''
485
486
487 def CASE10( self, main ):
488 '''
489 Bring up the switch which was stopped in CASE9, check:
490 route number, P2P intent number, M2S intent number, ping test
491 '''
492 main.case( "This case is to start switch which was stopped in CASE9, \
493 check route number, P2P intent number, M2S intent number, ping test" )
494 main.step( "Start sw11" )
495 result = main.Mininet.switch( SW = "sw11", OPTION = "start" )
496 if result:
497 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
498 main.Functions.checkRouteNum( main, 3 )
499 main.Functions.checkM2SintentNum( main, 3 )
500 main.Functions.checkP2PintentNum( main, 18 )
501
502 main.step( "Check the flow status after stop and start sw11" )
503 main.Functions.checkFlowNum( main, "sw11", 3 )
504 main.Functions.checkFlowNum( main, "sw1", 11 )
505 main.Functions.checkFlowNum( main, "sw7", 5 )
506 main.log.info( main.Mininet.checkFlows( "sw11" ) )
507 main.log.info( main.Mininet.checkFlows( "sw1" ) )
508 main.log.info( main.Mininet.checkFlows( "sw7" ) )
509 else:
510 main.log.info( "Start switch failed!!!" )
511 main.cleanup()
512 main.exit();
513
514 main.step( "Check whether all flow status are ADDED" )
515 utilities.assertEquals( \
516 expect = main.TRUE,
517 actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
518 onpass = "***Flow status is correct!***",
519 onfail = "***Flow status is wrong!***" )
520 '''
521 Note: this test case should be followed by ping test, CASE1 and CASE4
522 '''
523
pingping-lin9563aec2015-09-16 17:20:07 -0700524
525 def CASE20( self, main ):
526 '''
527 ping test from 3 bgp peers to BGP speaker
528 '''
pingping-linbab7f8a2015-09-21 17:33:36 -0700529 main.case( "This case is to check ping between BGP peers and speakers, \
530 and expect all ping tests to fail." )
531 main.step( "Start ping tests between BGP speaker and BGP peers" )
pingping-lin9563aec2015-09-16 17:20:07 -0700532 result1 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
533 result2 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
534 result3 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
535
536
537 caseResult = result1 or result2 or result3
538 utilities.assert_equals( expect = main.FALSE, actual = caseResult,
539 onpass = "Speaker1 failed to ping all peers - Correct",
540 onfail = "Speaker1 did not fail to ping all peers- NOT Correct" )
541
542 if caseResult == main.TRUE:
543 main.cleanup()
544 main.exit()
545
546
547 def CASE21( self, main ):
548 '''
549 Ping test in data plane for each route
550 '''
pingping-linbab7f8a2015-09-21 17:33:36 -0700551 main.case( "This case is to check ping for each route, and expect \
552 all ping tests to fail." )
553 main.step( "Start ping tests between hosts behind BGP peers" )
pingping-lin9563aec2015-09-16 17:20:07 -0700554 result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
555 result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
556 result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
557
558 caseResult = result1 or result2 or result3
559 utilities.assert_equals( expect = main.FALSE, actual = caseResult,
560 onpass = "Ping test for all routes failed- Correct",
561 onfail = "Ping test for all routes NOT failed- NOT Correct" )
562
563 if caseResult == main.TRUE:
564 main.cleanup()
565 main.exit()
566