blob: 98c28bb12d0232cdc964ef73df99018352fa5379 [file] [log] [blame]
pingping-lin26990f02015-11-30 15:48:06 -08001# Testing the functionality of SDN-IP with single ONOS instance
2class USECASE_SdnipFunctionCluster_fsfw:
3
4 def __init__( self ):
5 self.default = ''
6 global branchName
7
8 def CASE100( self, main ):
9 """
10 Start mininet
11 """
12 import imp
13 main.log.case( "Setup the Mininet testbed" )
14 main.dependencyPath = main.testDir + \
15 main.params[ 'DEPENDENCY' ][ 'path' ]
16 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
17
18 main.step( "Starting Mininet Topology" )
19 topology = main.dependencyPath + main.topology
Jon Hall6e9897d2016-02-29 14:41:32 -080020 topoResult = main.Mininet.startNet( topoFile=topology )
21 utilities.assert_equals( expect=main.TRUE,
22 actual=topoResult,
23 onpass="Successfully loaded topology",
24 onfail="Failed to load topology" )
pingping-lin26990f02015-11-30 15:48:06 -080025 # Exit if topology did not load properly
26 if not topoResult:
27 main.cleanup()
28 main.exit()
pingping-lin14776632015-12-16 12:05:30 -080029 main.step( "Connect switches to FSFW" )
pingping-lin26990f02015-11-30 15:48:06 -080030
pingping-lin26990f02015-11-30 15:48:06 -080031 swResult = main.TRUE
32 for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
33 sw = "sw%s" % ( i )
pingping-lin14776632015-12-16 12:05:30 -080034 swResult = swResult and main.Mininet.assignSwController( sw, fsfwIp,
Jon Hall6e9897d2016-02-29 14:41:32 -080035 port=fsfwPort )
pingping-lin26990f02015-11-30 15:48:06 -080036
Jon Hall6e9897d2016-02-29 14:41:32 -080037 utilities.assert_equals( expect=main.TRUE,
38 actual=swResult,
39 onpass="Successfully connect all switches to FSFW",
40 onfail="Failed to connect all switches to FSFW" )
pingping-lin26990f02015-11-30 15:48:06 -080041 if not swResult:
42 main.cleanup()
43 main.exit()
44
45
46 def CASE101( self, main ):
47 """
48 Package ONOS and install it
49 Startup sequence:
50 cell <name>
51 onos-verify-cell
52 onos-package
53 onos-install -f
54 onos-wait-for-start
55 """
56 import json
57 import time
58 import os
59 from operator import eq
60
61 main.case( "Setting up ONOS environment" )
62
63 cellName = main.params[ 'ENV' ][ 'cellName' ]
64 global ONOS1Ip
65 global ONOS2Ip
66 global ONOS3Ip
67 ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
68 ONOS2Ip = os.getenv( main.params[ 'CTRL' ][ 'ip2' ] )
69 ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] )
Jon Hall6e9897d2016-02-29 14:41:32 -080070 ipList = [ ONOS1Ip, ONOS2Ip, ONOS3Ip ]
pingping-lin26990f02015-11-30 15:48:06 -080071
pingping-lin14776632015-12-16 12:05:30 -080072 global pr64514
73 global pr64515
74 global pr64516
75 pr64514 = main.params['config']['pr64514']
76 pr64515 = main.params['config']['pr64515']
77 pr64516 = main.params['config']['pr64516']
78
79 global fsfwIp
80 global fsfwPort
81 fsfwIp = main.params[ 'CTRL' ][ 'fsfwIp' ]
82 fsfwPort = main.params[ 'CTRL' ][ 'fsfwPort' ]
pingping-lin26990f02015-11-30 15:48:06 -080083
Jon Hall6e9897d2016-02-29 14:41:32 -080084 main.step( "Create cell file" )
85 cellAppString = main.params[ 'ENV' ][ 'appString' ]
86 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
87 main.Mininet.ip_address,
88 cellAppString, ipList )
89
pingping-lin26990f02015-11-30 15:48:06 -080090 main.step( "Applying cell variable to environment" )
91 cellResult = main.ONOSbench.setCell( cellName )
Jon Hall6e9897d2016-02-29 14:41:32 -080092 utilities.assert_equals( expect=main.TRUE,
93 actual=cellResult,
94 onpass="Set cell succeeded",
95 onfail="Set cell failed" )
pingping-lin26990f02015-11-30 15:48:06 -080096
97 verifyResult = main.ONOSbench.verifyCell()
Jon Hall6e9897d2016-02-29 14:41:32 -080098 utilities.assert_equals( expect=main.TRUE,
99 actual=verifyResult,
100 onpass="Verify cell succeeded",
101 onfail="Verify cell failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800102
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 and main.ONOSbench.onosUninstall( ONOS2Ip ) \
109 and main.ONOSbench.onosUninstall( ONOS3Ip )
Jon Hall6e9897d2016-02-29 14:41:32 -0800110 utilities.assert_equals( expect=main.TRUE,
111 actual=uninstallResult,
112 onpass="Uninstall ONOS from nodes succeeded",
113 onfail="Uninstall ONOS form nodes failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800114
Jon Hall6e9897d2016-02-29 14:41:32 -0800115 main.ONOSbench.getVersion( report=True )
pingping-lin26990f02015-11-30 15:48:06 -0800116
117 main.step( "Creating ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800118 packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
119 utilities.assert_equals( expect=main.TRUE,
120 actual=packageResult,
121 onpass="Package ONOS succeeded",
122 onfail="Package ONOS failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800123
124 main.step( "Installing ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800125 onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
126 node=ONOS1Ip )
127 onos2InstallResult = main.ONOSbench.onosInstall( options="-f",
128 node=ONOS2Ip )
129 onos3InstallResult = main.ONOSbench.onosInstall( options="-f",
130 node=ONOS3Ip )
pingping-lin26990f02015-11-30 15:48:06 -0800131 onosInstallResult = onos1InstallResult and onos2InstallResult \
132 and onos3InstallResult
Jon Hall6e9897d2016-02-29 14:41:32 -0800133 utilities.assert_equals( expect=main.TRUE,
134 actual=onosInstallResult,
135 onpass="Install ONOS to nodes succeeded",
136 onfail="Install ONOS to nodes failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800137
138 main.step( "Checking if ONOS is up yet" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800139 onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
140 onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
141 onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout=420 )
pingping-lin26990f02015-11-30 15:48:06 -0800142 onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult
Jon Hall6e9897d2016-02-29 14:41:32 -0800143 utilities.assert_equals( expect=main.TRUE,
144 actual=onosUpResult,
145 onpass="ONOS nodes are up",
146 onfail="ONOS nodes are NOT up" )
pingping-lin26990f02015-11-30 15:48:06 -0800147
148 main.step( "Checking if ONOS CLI is ready" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800149 main.CLIs = []
pingping-lin26990f02015-11-30 15:48:06 -0800150 cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800151 commandlineTimeout=100, onosStartTimeout=600 )
152 main.CLIs.append( main.ONOScli1 )
pingping-lin26990f02015-11-30 15:48:06 -0800153 cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800154 commandlineTimeout=100, onosStartTimeout=600 )
155 main.CLIs.append( main.ONOScli2 )
156 cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip,
157 commandlineTimeout=100, onosStartTimeout=600 )
158 main.CLIs.append( main.ONOScli3 )
159 cliResult = cliResult1 and cliResult2 and cliResult3
160 utilities.assert_equals( expect=main.TRUE,
161 actual=cliResult,
162 onpass="ONOS CLIs are ready",
163 onfail="ONOS CLIs are not ready" )
pingping-lin26990f02015-11-30 15:48:06 -0800164
Jon Hall6e9897d2016-02-29 14:41:32 -0800165 for i in range( 10 ):
166 ready = True
167 for cli in main.CLIs:
168 output = cli.summary()
169 if not output:
170 ready = False
171 if ready:
172 break
173 time.sleep( 30 )
174 utilities.assert_equals( expect=True, actual=ready,
175 onpass="ONOS summary command succeded",
176 onfail="ONOS summary command failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800177
Jon Hall6e9897d2016-02-29 14:41:32 -0800178 if not ready:
pingping-lin26990f02015-11-30 15:48:06 -0800179 main.log.error( "ONOS startup failed!" )
180 main.cleanup()
181 main.exit()
182
pingping-lin26990f02015-11-30 15:48:06 -0800183 def CASE200( self, main ):
184 main.case( "Activate sdn-ip application" )
185 main.log.info( "waiting link discovery......" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800186 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
pingping-lin26990f02015-11-30 15:48:06 -0800187
188 main.log.info( "Get links in the network" )
189 summaryResult = main.ONOScli1.summary()
190 linkNum = json.loads( summaryResult )[ "links" ]
Jon Hall6e9897d2016-02-29 14:41:32 -0800191 listResult = main.ONOScli1.links( jsonFormat=False )
pingping-lin26990f02015-11-30 15:48:06 -0800192 main.log.info( listResult )
pingping-lin26990f02015-11-30 15:48:06 -0800193 if linkNum < 100:
194 main.log.error( "Link number is wrong!" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800195 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
196 listResult = main.ONOScli1.links( jsonFormat=False )
197 main.log.info( listResult )
pingping-lin26990f02015-11-30 15:48:06 -0800198 main.cleanup()
199 main.exit()
200
201 main.step( "Activate sdn-ip application" )
202 activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800203 utilities.assert_equals( expect=main.TRUE,
204 actual=activeSDNIPresult,
205 onpass="Activate SDN-IP succeeded",
206 onfail="Activate SDN-IP failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800207 if not activeSDNIPresult:
Jon Hall6e9897d2016-02-29 14:41:32 -0800208 main.log.info( "Activate SDN-IP failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800209 main.cleanup()
210 main.exit()
211
212
213 def CASE102( self, main ):
214 '''
215 This test case is to load the methods from other Python files, and create
216 tunnels from mininet host to onos nodes.
217 '''
218 import time
219 main.case( "Load methods from other Python file and create tunnels" )
220 # load the methods from other file
221 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
222 main.Functions = imp.load_source( wrapperFile1,
223 main.dependencyPath +
224 wrapperFile1 +
225 ".py" )
226 # Create tunnels
227 main.Functions.setupTunnel( main, '1.1.1.2', 2000, ONOS1Ip, 2000 )
228 main.Functions.setupTunnel( main, '1.1.1.4', 2000, ONOS2Ip, 2000 )
229 main.Functions.setupTunnel( main, '1.1.1.6', 2000, ONOS3Ip, 2000 )
230
231 main.log.info( "Wait SDN-IP to finish installing connectivity intents \
232 and the BGP paths in data plane are ready..." )
233 time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
234
235 main.log.info( "Wait Quagga to finish delivery all routes to each \
236 other and to sdn-ip, plus finish installing all intents..." )
237 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
pingping-lin26990f02015-11-30 15:48:06 -0800238
239 def CASE1( self, main ):
240 '''
241 ping test from 3 bgp peers to BGP speaker
242 '''
243
244 main.case( "Ping tests between BGP peers and speakers" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800245 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
246 peers=["pr64514", "pr64515", "pr64516"],
247 expectAllSuccess=True )
248 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
249 peers=[pr64514, pr64515, pr64516],
250 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800251
252 def CASE2( self, main ):
253 '''
254 point-to-point intents test for each BGP peer and BGP speaker pair
255 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800256 import time
pingping-lin26990f02015-11-30 15:48:06 -0800257 main.case( "Check point-to-point intents" )
258 main.log.info( "There are %s BGP peers in total "
259 % main.params[ 'config' ][ 'peerNum' ] )
260 main.step( "Check P2P intents number from ONOS CLI" )
261
Jon Hall6e9897d2016-02-29 14:41:32 -0800262 getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
pingping-lin26990f02015-11-30 15:48:06 -0800263 bgpIntentsActualNum = \
264 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
265 bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
Jon Hall6e9897d2016-02-29 14:41:32 -0800266 if bgpIntentsActualNum != bgpIntentsExpectedNum:
267 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
268 bgpIntentsActualNum = \
269 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
pingping-lin26990f02015-11-30 15:48:06 -0800270 main.log.info( "bgpIntentsExpected num is:" )
271 main.log.info( bgpIntentsExpectedNum )
272 main.log.info( "bgpIntentsActual num is:" )
273 main.log.info( bgpIntentsActualNum )
274 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800275 expect=True,
276 actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
277 onpass="PointToPointIntent Intent Num is correct!",
278 onfail="PointToPointIntent Intent Num is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800279
280
281 def CASE3( self, main ):
282 '''
283 routes and intents check to all BGP peers
284 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800285 import time
pingping-lin26990f02015-11-30 15:48:06 -0800286 main.case( "Check routes and M2S intents to all BGP peers" )
287
288 allRoutesExpected = []
289 allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
290 allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
291 allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
292
Jon Hall6e9897d2016-02-29 14:41:32 -0800293 getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
pingping-lin26990f02015-11-30 15:48:06 -0800294 allRoutesActual = \
295 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
296 allRoutesStrExpected = str( sorted( allRoutesExpected ) )
297 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800298 if allRoutesStrActual != allRoutesStrExpected:
299 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
300 allRoutesActual = \
301 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
302 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
pingping-lin26990f02015-11-30 15:48:06 -0800303
304 main.step( "Check routes installed" )
305 main.log.info( "Routes expected:" )
306 main.log.info( allRoutesStrExpected )
307 main.log.info( "Routes get from ONOS CLI:" )
308 main.log.info( allRoutesStrActual )
309 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800310 expect=allRoutesStrExpected, actual=allRoutesStrActual,
311 onpass="Routes are correct!",
312 onfail="Routes are wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800313
314 main.step( "Check M2S intents installed" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800315 getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
pingping-lin26990f02015-11-30 15:48:06 -0800316 routeIntentsActualNum = \
317 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
318 routeIntentsExpectedNum = 3
Jon Hall6e9897d2016-02-29 14:41:32 -0800319 if routeIntentsActualNum != routeIntentsExpectedNum:
320 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
321 routeIntentsActualNum = \
322 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
pingping-lin26990f02015-11-30 15:48:06 -0800323
324 main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
325 main.log.info( routeIntentsExpectedNum )
326 main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
327 main.log.info( routeIntentsActualNum )
328 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800329 expect=routeIntentsExpectedNum,
330 actual=routeIntentsActualNum,
331 onpass="MultiPointToSinglePoint Intent Num is correct!",
332 onfail="MultiPointToSinglePoint Intent Num is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800333
334 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800335 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
336 main.FALSE,
337 kwargs={'isPENDING':False},
338 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800339 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800340 expect=main.TRUE,
341 actual=flowCheck,
342 onpass="Flow status is correct!",
343 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800344
345
346 def CASE4( self, main ):
347 '''
348 Ping test in data plane for each route
349 '''
350 main.case( "Ping test for each route, all hosts behind BGP peers" )
351 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800352 hosts=["host64514", "host64515", "host64516"],
353 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800354
355
356 def CASE5( self, main ):
357 '''
358 Cut links to peers one by one, check routes/intents
359 '''
360 import time
361 main.case( "Bring down links and check routes/intents" )
362 main.step( "Bring down the link between sw32 and peer64514" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800363 linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
364 OPTION="down" )
pingping-lin3806f112016-01-04 10:38:25 -0800365 # When bring down a link, Mininet will bring down both the interfaces
366 # at the two sides of the link. Here we do not want to bring down the
367 # host side interface, since I noticed when bring up in CASE6, some of
368 # the configuration information will lost.
Jon Hall6e9897d2016-02-29 14:41:32 -0800369 utilities.assertEquals( expect=main.TRUE,
370 actual=linkResult1,
371 onpass="Bring down link succeeded!",
372 onfail="Bring down link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800373
374 if linkResult1 == main.TRUE:
375 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
376 main.Functions.checkRouteNum( main, 2 )
377 main.Functions.checkM2SintentNum( main, 2 )
378 else:
379 main.log.error( "Bring down link failed!" )
380 main.cleanup()
381 main.exit()
382
383 main.step( "Bring down the link between sw8 and peer64515" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800384 linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
385 OPTION="down" )
386 utilities.assertEquals( expect=main.TRUE,
387 actual=linkResult2,
388 onpass="Bring down link succeeded!",
389 onfail="Bring down link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800390 if linkResult2 == main.TRUE:
391 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
392 main.Functions.checkRouteNum( main, 1 )
393 main.Functions.checkM2SintentNum( main, 1 )
394 else:
395 main.log.error( "Bring down link failed!" )
396 main.cleanup()
397 main.exit()
398
399 main.step( "Bring down the link between sw28 and peer64516" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800400 linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
401 OPTION="down" )
402 utilities.assertEquals( expect=main.TRUE,
403 actual=linkResult3,
404 onpass="Bring down link succeeded!",
405 onfail="Bring down link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800406 if linkResult3 == main.TRUE:
407 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
408 main.Functions.checkRouteNum( main, 0 )
409 main.Functions.checkM2SintentNum( main, 0 )
410 else:
411 main.log.error( "Bring down link failed!" )
412 main.cleanup()
413 main.exit()
414
415 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800416 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
417 main.FALSE,
418 kwargs={'isPENDING':False},
419 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800420 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800421 expect=main.TRUE,
422 actual=flowCheck,
423 onpass="Flow status is correct!",
424 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800425
426 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800427 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
428 peers=["pr64514", "pr64515", "pr64516"],
429 expectAllSuccess=False )
pingping-lin26990f02015-11-30 15:48:06 -0800430 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800431 hosts=["host64514", "host64515", "host64516"],
432 expectAllSuccess=False )
pingping-lin26990f02015-11-30 15:48:06 -0800433
434
435 def CASE6( self, main ):
436 '''
437 Recover links to peers one by one, check routes/intents
438 '''
439 import time
440 main.case( "Bring up links and check routes/intents" )
441 main.step( "Bring up the link between sw32 and peer64514" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800442 linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
443 OPTION="up" )
444 utilities.assertEquals( expect=main.TRUE,
445 actual=linkResult1,
446 onpass="Bring up link succeeded!",
447 onfail="Bring up link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800448 if linkResult1 == main.TRUE:
449 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
450 main.Functions.checkRouteNum( main, 1 )
451 main.Functions.checkM2SintentNum( main, 1 )
452 else:
453 main.log.error( "Bring up link failed!" )
454 main.cleanup()
455 main.exit()
456
457 main.step( "Bring up the link between sw8 and peer64515" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800458 linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
459 OPTION="up" )
460 utilities.assertEquals( expect=main.TRUE,
461 actual=linkResult2,
462 onpass="Bring up link succeeded!",
463 onfail="Bring up link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800464 if linkResult2 == main.TRUE:
465 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
466 main.Functions.checkRouteNum( main, 2 )
467 main.Functions.checkM2SintentNum( main, 2 )
468 else:
469 main.log.error( "Bring up link failed!" )
470 main.cleanup()
471 main.exit()
472
473 main.step( "Bring up the link between sw28 and peer64516" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800474 linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
475 OPTION="up" )
476 utilities.assertEquals( expect=main.TRUE,
477 actual=linkResult3,
478 onpass="Bring up link succeeded!",
479 onfail="Bring up link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800480 if linkResult3 == main.TRUE:
481 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
482 main.Functions.checkRouteNum( main, 3 )
483 main.Functions.checkM2SintentNum( main, 3 )
484 else:
485 main.log.error( "Bring up link failed!" )
486 main.cleanup()
487 main.exit()
488
489 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800490 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
491 main.FALSE,
492 kwargs={'isPENDING':False},
493 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800494 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800495 expect=main.TRUE,
496 actual=flowCheck,
497 onpass="Flow status is correct!",
498 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800499
500 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800501 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
502 peers=["pr64514", "pr64515", "pr64516"],
503 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800504 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800505 hosts=["host64514", "host64515", "host64516"],
506 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800507
508
509 def CASE7( self, main ):
510 '''
511 Shut down a edge switch, check P-2-P and M-2-S intents, ping test
512 '''
513 import time
514 main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
515 main.step( "Stop sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800516 result = main.Mininet.switch( SW="sw32", OPTION="stop" )
517 utilities.assertEquals( expect=main.TRUE, actual=result,
518 onpass="Stopping switch succeeded!",
519 onfail="Stopping switch failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800520
521 if result == main.TRUE:
522 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
523 main.Functions.checkRouteNum( main, 2 )
524 main.Functions.checkM2SintentNum( main, 2 )
525 main.Functions.checkP2PintentNum( main, 12 * 2 )
526 else:
527 main.log.error( "Stopping switch failed!" )
528 main.cleanup()
529 main.exit()
530
531 main.step( "Check ping between hosts behind BGP peers" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800532 result1 = main.Mininet.pingHost( src="host64514", target="host64515" )
533 result2 = main.Mininet.pingHost( src="host64515", target="host64516" )
534 result3 = main.Mininet.pingHost( src="host64514", target="host64516" )
pingping-lin26990f02015-11-30 15:48:06 -0800535
536 pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
537 and ( result3 == main.FALSE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800538 utilities.assert_equals( expect=True, actual=pingResult1,
539 onpass="Ping test result is correct",
540 onfail="Ping test result is wrong" )
pingping-lin26990f02015-11-30 15:48:06 -0800541
542 if pingResult1 == False:
543 main.cleanup()
544 main.exit()
545
546 main.step( "Check ping between BGP peers and speaker1" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800547 result4 = main.Mininet.pingHost( src="speaker1", target="pr64514" )
548 result5 = main.Mininet.pingHost( src="speaker1", target="pr64515" )
549 result6 = main.Mininet.pingHost( src="speaker1", target="pr64516" )
pingping-lin26990f02015-11-30 15:48:06 -0800550
551 pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
552 and ( result6 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800553 utilities.assert_equals( expect=True, actual=pingResult2,
554 onpass="Speaker1 ping peers successful",
555 onfail="Speaker1 ping peers NOT successful" )
pingping-lin26990f02015-11-30 15:48:06 -0800556
557 if pingResult2 == False:
558 main.cleanup()
559 main.exit()
560
561 main.step( "Check ping between BGP peers and speaker2" )
562 # TODO
Jon Hall6e9897d2016-02-29 14:41:32 -0800563 result7 = main.Mininet.pingHost( src="speaker2", target=pr64514 )
564 result8 = main.Mininet.pingHost( src="speaker2", target=pr64515 )
565 result9 = main.Mininet.pingHost( src="speaker2", target=pr64516 )
pingping-lin26990f02015-11-30 15:48:06 -0800566
567 pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
568 and ( result9 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800569 utilities.assert_equals( expect=True, actual=pingResult2,
570 onpass="Speaker2 ping peers successful",
571 onfail="Speaker2 ping peers NOT successful" )
pingping-lin26990f02015-11-30 15:48:06 -0800572
573 if pingResult3 == False:
574 main.cleanup()
575 main.exit()
576
577 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800578 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
579 main.FALSE,
580 kwargs={'isPENDING':False},
581 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800582 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800583 expect=main.TRUE,
584 actual=flowCheck,
585 onpass="Flow status is correct!",
586 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800587
588
589 def CASE8( self, main ):
590 '''
591 Bring up the edge switch (sw32) which was shut down in CASE7,
592 check P-2-P and M-2-S intents, ping test
593 '''
594 import time
595 main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
596 main.step( "Start sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800597 result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
pingping-lin26990f02015-11-30 15:48:06 -0800598 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800599 expect=main.TRUE,
600 actual=result1,
601 onpass="Starting switch succeeded!",
602 onfail="Starting switch failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800603
pingping-lin3806f112016-01-04 10:38:25 -0800604 result2 = main.Mininet.assignSwController( "sw32", fsfwIp,
Jon Hall6e9897d2016-02-29 14:41:32 -0800605 port=fsfwPort )
pingping-lin26990f02015-11-30 15:48:06 -0800606 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800607 expect=main.TRUE,
608 actual=result2,
609 onpass="Connect switch to FSFW succeeded!",
610 onfail="Connect switch to FSFW failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800611
612 if result1 and result2:
613 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
614 main.Functions.checkRouteNum( main, 3 )
615 main.Functions.checkM2SintentNum( main, 3 )
616 main.Functions.checkP2PintentNum( main, 18 * 2 )
617 else:
618 main.log.error( "Starting switch failed!" )
619 main.cleanup()
620 main.exit()
621
622 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800623 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
624 main.FALSE,
625 kwargs={'isPENDING':False},
626 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800627 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800628 expect=main.TRUE,
629 actual=flowCheck,
630 onpass="Flow status is correct!",
631 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800632
633 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800634 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
635 peers=["pr64514", "pr64515", "pr64516"],
636 expectAllSuccess=True )
637 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
638 peers=[pr64514, pr64515, pr64516],
639 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800640 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800641 hosts=["host64514", "host64515", "host64516"],
642 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800643
644
645 def CASE9( self, main ):
646 '''
647 Bring down a switch in best path, check:
648 route number, P2P intent number, M2S intent number, ping test
649 '''
650 main.case( "Stop sw11 located in best path, \
651 check route number, P2P intent number, M2S intent number, ping test" )
652
653 main.log.info( "Check the flow number correctness before stopping sw11" )
654 main.Functions.checkFlowNum( main, "sw11", 19 )
655 main.Functions.checkFlowNum( main, "sw1", 3 )
656 main.Functions.checkFlowNum( main, "sw7", 3 )
657 main.log.info( main.Mininet.checkFlows( "sw11" ) )
658 main.log.info( main.Mininet.checkFlows( "sw1" ) )
659 main.log.info( main.Mininet.checkFlows( "sw7" ) )
660
661 main.step( "Stop sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800662 result = main.Mininet.switch( SW="sw11", OPTION="stop" )
663 utilities.assertEquals( expect=main.TRUE, actual=result,
664 onpass="Stopping switch succeeded!",
665 onfail="Stopping switch failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800666 if result:
667 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
668 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
669 main.Functions.checkRouteNum( main, 3 )
670 main.Functions.checkM2SintentNum( main, 3 )
671 main.Functions.checkP2PintentNum( main, 18 * 2 )
672 else:
673 main.log.error( "Stopping switch failed!" )
674 main.cleanup()
675 main.exit()
676
677 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800678 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
679 main.FALSE,
680 kwargs={'isPENDING':False},
681 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800682 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800683 expect=main.TRUE,
684 actual=flowCheck,
685 onpass="Flow status is correct!",
686 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800687 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800688 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
689 peers=["pr64514", "pr64515", "pr64516"],
690 expectAllSuccess=True )
691 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
692 peers=[pr64514, pr64515, pr64516],
693 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800694 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800695 hosts=["host64514", "host64515", "host64516"],
696 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800697
698
699 def CASE10( self, main ):
700 '''
701 Bring up the switch which was stopped in CASE9, check:
702 route number, P2P intent number, M2S intent number, ping test
703 '''
704 main.case( "Start sw11 which was stopped in CASE9, \
705 check route number, P2P intent number, M2S intent number, ping test" )
706
707 main.log.info( "Check the flow status before starting sw11" )
708 main.Functions.checkFlowNum( main, "sw1", 17 )
709 main.Functions.checkFlowNum( main, "sw7", 5 )
710 main.log.info( main.Mininet.checkFlows( "sw1" ) )
711 main.log.info( main.Mininet.checkFlows( "sw7" ) )
712
713 main.step( "Start sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800714 result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
715 utilities.assertEquals( expect=main.TRUE, actual=result1,
716 onpass="Starting switch succeeded!",
717 onfail="Starting switch failed!" )
pingping-lin3806f112016-01-04 10:38:25 -0800718 result2 = main.Mininet.assignSwController( "sw11", fsfwIp,
Jon Hall6e9897d2016-02-29 14:41:32 -0800719 port=fsfwPort )
720 utilities.assertEquals( expect=main.TRUE, actual=result2,
721 onpass="Connect switch to FSFW succeeded!",
722 onfail="Connect switch to FSFW failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800723 if result1 and result2:
724 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
725 main.Functions.checkRouteNum( main, 3 )
726 main.Functions.checkM2SintentNum( main, 3 )
727 main.Functions.checkP2PintentNum( main, 18 * 2 )
728
729 main.log.debug( main.Mininet.checkFlows( "sw11" ) )
730 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
731 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
732 else:
733 main.log.error( "Starting switch failed!" )
734 main.cleanup()
735 main.exit()
736
737 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800738 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
739 main.FALSE,
740 kwargs={'isPENDING':False},
741 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800742 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800743 expect=main.TRUE,
744 actual=flowCheck,
745 onpass="Flow status is correct!",
746 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800747 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800748 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
749 peers=["pr64514", "pr64515", "pr64516"],
750 expectAllSuccess=True )
751 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
752 peers=[pr64514, pr64515, pr64516],
753 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800754 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800755 hosts=["host64514", "host64515", "host64516"],
756 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800757
758
759 def CASE11(self, main):
760 import time
761 main.case( "Kill speaker1, check:\
762 route number, P2P intent number, M2S intent number, ping test" )
763 main.log.info( "Check network status before killing speaker1" )
764 main.Functions.checkRouteNum( main, 3 )
765 main.Functions.checkM2SintentNum( main, 3 )
766 main.Functions.checkP2PintentNum( main, 18 * 2 )
767 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800768 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
769 main.FALSE,
770 kwargs={'isPENDING':False},
771 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800772 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800773 expect=main.TRUE,
774 actual=flowCheck,
775 onpass="Flow status is correct!",
776 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800777
Jon Hall6e9897d2016-02-29 14:41:32 -0800778 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
779 peers=["pr64514", "pr64515", "pr64516"],
780 expectAllSuccess=True )
781 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
782 peers=[pr64514, pr64515, pr64516],
783 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800784 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800785 hosts=["host64514", "host64515", "host64516"],
786 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800787
788 main.step( "Kill speaker1" )
789 command1 = "ps -e | grep bgp -c"
790 result1 = main.Mininet.node( "root", command1 )
791
792 # The total BGP daemon number in this test environment is 5.
793 if "5" in result1:
794 main.log.debug( "Before kill speaker1, 5 BGP daemons - correct" )
795 else:
796 main.log.warn( "Before kill speaker1, number of BGP daemons is wrong" )
797 main.log.info( result1 )
798
799 command2 = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`"
800 result2 = main.Mininet.node( "root", command2 )
801
802 result3 = main.Mininet.node( "root", command1 )
803
Jon Hall6e9897d2016-02-29 14:41:32 -0800804 utilities.assert_equals( expect=True,
805 actual=( "4" in result3 ),
806 onpass="Kill speaker1 succeeded",
807 onfail="Kill speaker1 failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800808 if ( "4" not in result3 ) :
809 main.log.info( result3 )
810 main.cleanup()
811 main.exit()
812
813 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
814 main.Functions.checkRouteNum( main, 3 )
815 main.Functions.checkM2SintentNum( main, 3 )
816 main.Functions.checkP2PintentNum( main, 18 * 2 )
817
818 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800819 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
820 main.FALSE,
821 kwargs={'isPENDING':False},
822 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800823 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800824 expect=main.TRUE,
825 actual=flowCheck,
826 onpass="Flow status is correct!",
827 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800828
829 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800830 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
831 peers=["pr64514", "pr64515", "pr64516"],
832 expectAllSuccess=False )
pingping-lin26990f02015-11-30 15:48:06 -0800833 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800834 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
835 peers=[pr64514, pr64515, pr64516],
836 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800837 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800838 hosts=["host64514", "host64515", "host64516"],
839 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800840
841
842 def CASE12( self, main ):
843 import time
844 import json
845 main.case( "Bring down leader ONOS node, check: \
846 route number, P2P intent number, M2S intent number, ping test" )
847 main.step( "Find out ONOS leader node" )
848 result = main.ONOScli1.leaders()
849 jsonResult = json.loads( result )
850 leaderIP = ""
851 for entry in jsonResult:
852 if entry["topic"] == "org.onosproject.sdnip":
853 leaderIP = entry["leader"]
854 main.log.info( "leaderIP is: " )
855 main.log.info( leaderIP )
856
857 main.step( "Uninstall ONOS/SDN-IP leader node" )
858 if leaderIP == ONOS1Ip:
859 uninstallResult = main.ONOSbench.onosStop( ONOS1Ip )
860 elif leaderIP == ONOS2Ip:
861 uninstallResult = main.ONOSbench.onosStop( ONOS2Ip )
862 else:
863 uninstallResult = main.ONOSbench.onosStop( ONOS3Ip )
864
Jon Hall6e9897d2016-02-29 14:41:32 -0800865 utilities.assert_equals( expect=main.TRUE,
866 actual=uninstallResult,
867 onpass="Uninstall ONOS leader succeeded",
868 onfail="Uninstall ONOS leader failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800869 if uninstallResult != main.TRUE:
870 main.cleanup()
871 main.exit()
872 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
873
874 if leaderIP == ONOS1Ip:
Jon Hall6e9897d2016-02-29 14:41:32 -0800875 main.Functions.checkRouteNum( main, 3, ONOScli="ONOScli2" )
876 main.Functions.checkM2SintentNum( main, 3, ONOScli="ONOScli2" )
877 main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli="ONOScli2" )
pingping-lin26990f02015-11-30 15:48:06 -0800878
879 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800880 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
881 main.FALSE,
882 kwargs={'isPENDING':False},
883 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800884 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800885 expect=main.TRUE,
886 actual=flowCheck,
887 onpass="Flow status is correct!",
888 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800889 else:
890 main.Functions.checkRouteNum( main, 3 )
891 main.Functions.checkM2SintentNum( main, 3 )
892 main.Functions.checkP2PintentNum( main, 18 * 2 )
893
894 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800895 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
896 main.FALSE,
897 kwargs={'isPENDING':False},
898 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800899 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800900 expect=main.TRUE,
901 actual=flowCheck,
902 onpass="Flow status is correct!",
903 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800904
Jon Hall6e9897d2016-02-29 14:41:32 -0800905 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
906 peers=["pr64514", "pr64515", "pr64516"],
907 expectAllSuccess=True )
908 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
909 peers=[pr64514, pr64515, pr64516],
910 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800911 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800912 hosts=["host64514", "host64515", "host64516"],
913 expectAllSuccess=True )