blob: 3e27a10be75c6011a9a5441a79decd1193b08efe [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
Jon Hall70b768c2016-04-19 08:38:29 -070013 main.case( "Setup the Mininet testbed" )
pingping-lin26990f02015-11-30 15:48:06 -080014 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 Hall70b768c2016-04-19 08:38:29 -070084 main.step( "Copying config files" )
85 src = os.path.dirname( main.testFile ) + "/network-cfg.json"
86 dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
87 status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
88 utilities.assert_equals( expect=main.TRUE,
89 actual=status,
90 onpass="Copy config file succeeded",
91 onfail="Copy config file failed" )
92
Jon Hall6e9897d2016-02-29 14:41:32 -080093 main.step( "Create cell file" )
94 cellAppString = main.params[ 'ENV' ][ 'appString' ]
95 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
96 main.Mininet.ip_address,
97 cellAppString, ipList )
98
pingping-lin26990f02015-11-30 15:48:06 -080099 main.step( "Applying cell variable to environment" )
100 cellResult = main.ONOSbench.setCell( cellName )
Jon Hall6e9897d2016-02-29 14:41:32 -0800101 utilities.assert_equals( expect=main.TRUE,
102 actual=cellResult,
103 onpass="Set cell succeeded",
104 onfail="Set cell failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800105
Jon Hall70b768c2016-04-19 08:38:29 -0700106 main.step( "Verify cell connectivity" )
pingping-lin26990f02015-11-30 15:48:06 -0800107 verifyResult = main.ONOSbench.verifyCell()
Jon Hall6e9897d2016-02-29 14:41:32 -0800108 utilities.assert_equals( expect=main.TRUE,
109 actual=verifyResult,
110 onpass="Verify cell succeeded",
111 onfail="Verify cell failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800112
113 branchName = main.ONOSbench.getBranchName()
114 main.log.report( "ONOS is on branch: " + branchName )
115
116 main.log.step( "Uninstalling ONOS" )
117 uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
118 and main.ONOSbench.onosUninstall( ONOS2Ip ) \
119 and main.ONOSbench.onosUninstall( ONOS3Ip )
Jon Hall6e9897d2016-02-29 14:41:32 -0800120 utilities.assert_equals( expect=main.TRUE,
121 actual=uninstallResult,
122 onpass="Uninstall ONOS from nodes succeeded",
123 onfail="Uninstall ONOS form nodes failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800124
Jon Hall6e9897d2016-02-29 14:41:32 -0800125 main.ONOSbench.getVersion( report=True )
pingping-lin26990f02015-11-30 15:48:06 -0800126
127 main.step( "Creating ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800128 packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
129 utilities.assert_equals( expect=main.TRUE,
130 actual=packageResult,
131 onpass="Package ONOS succeeded",
132 onfail="Package ONOS failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800133
134 main.step( "Installing ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800135 onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
136 node=ONOS1Ip )
137 onos2InstallResult = main.ONOSbench.onosInstall( options="-f",
138 node=ONOS2Ip )
139 onos3InstallResult = main.ONOSbench.onosInstall( options="-f",
140 node=ONOS3Ip )
pingping-lin26990f02015-11-30 15:48:06 -0800141 onosInstallResult = onos1InstallResult and onos2InstallResult \
142 and onos3InstallResult
Jon Hall6e9897d2016-02-29 14:41:32 -0800143 utilities.assert_equals( expect=main.TRUE,
144 actual=onosInstallResult,
145 onpass="Install ONOS to nodes succeeded",
146 onfail="Install ONOS to nodes failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800147
148 main.step( "Checking if ONOS is up yet" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800149 onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
150 onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
151 onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout=420 )
pingping-lin26990f02015-11-30 15:48:06 -0800152 onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult
Jon Hall6e9897d2016-02-29 14:41:32 -0800153 utilities.assert_equals( expect=main.TRUE,
154 actual=onosUpResult,
155 onpass="ONOS nodes are up",
156 onfail="ONOS nodes are NOT up" )
pingping-lin26990f02015-11-30 15:48:06 -0800157
158 main.step( "Checking if ONOS CLI is ready" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800159 main.CLIs = []
pingping-lin26990f02015-11-30 15:48:06 -0800160 cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800161 commandlineTimeout=100, onosStartTimeout=600 )
162 main.CLIs.append( main.ONOScli1 )
pingping-lin26990f02015-11-30 15:48:06 -0800163 cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800164 commandlineTimeout=100, onosStartTimeout=600 )
165 main.CLIs.append( main.ONOScli2 )
166 cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip,
167 commandlineTimeout=100, onosStartTimeout=600 )
168 main.CLIs.append( main.ONOScli3 )
169 cliResult = cliResult1 and cliResult2 and cliResult3
170 utilities.assert_equals( expect=main.TRUE,
171 actual=cliResult,
172 onpass="ONOS CLIs are ready",
173 onfail="ONOS CLIs are not ready" )
pingping-lin26990f02015-11-30 15:48:06 -0800174
Jon Hall6e9897d2016-02-29 14:41:32 -0800175 for i in range( 10 ):
176 ready = True
177 for cli in main.CLIs:
178 output = cli.summary()
179 if not output:
180 ready = False
181 if ready:
182 break
183 time.sleep( 30 )
184 utilities.assert_equals( expect=True, actual=ready,
185 onpass="ONOS summary command succeded",
186 onfail="ONOS summary command failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800187
Jon Hall6e9897d2016-02-29 14:41:32 -0800188 if not ready:
pingping-lin26990f02015-11-30 15:48:06 -0800189 main.log.error( "ONOS startup failed!" )
190 main.cleanup()
191 main.exit()
192
pingping-lin26990f02015-11-30 15:48:06 -0800193 def CASE200( self, main ):
194 main.case( "Activate sdn-ip application" )
195 main.log.info( "waiting link discovery......" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800196 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
pingping-lin26990f02015-11-30 15:48:06 -0800197
198 main.log.info( "Get links in the network" )
199 summaryResult = main.ONOScli1.summary()
200 linkNum = json.loads( summaryResult )[ "links" ]
Jon Hall6e9897d2016-02-29 14:41:32 -0800201 listResult = main.ONOScli1.links( jsonFormat=False )
pingping-lin26990f02015-11-30 15:48:06 -0800202 main.log.info( listResult )
pingping-lin26990f02015-11-30 15:48:06 -0800203 if linkNum < 100:
204 main.log.error( "Link number is wrong!" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800205 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
206 listResult = main.ONOScli1.links( jsonFormat=False )
207 main.log.info( listResult )
pingping-lin26990f02015-11-30 15:48:06 -0800208 main.cleanup()
209 main.exit()
210
211 main.step( "Activate sdn-ip application" )
212 activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800213 utilities.assert_equals( expect=main.TRUE,
214 actual=activeSDNIPresult,
215 onpass="Activate SDN-IP succeeded",
216 onfail="Activate SDN-IP failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800217 if not activeSDNIPresult:
Jon Hall6e9897d2016-02-29 14:41:32 -0800218 main.log.info( "Activate SDN-IP failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800219 main.cleanup()
220 main.exit()
221
222
223 def CASE102( self, main ):
224 '''
225 This test case is to load the methods from other Python files, and create
226 tunnels from mininet host to onos nodes.
227 '''
228 import time
229 main.case( "Load methods from other Python file and create tunnels" )
230 # load the methods from other file
231 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
232 main.Functions = imp.load_source( wrapperFile1,
233 main.dependencyPath +
234 wrapperFile1 +
235 ".py" )
236 # Create tunnels
237 main.Functions.setupTunnel( main, '1.1.1.2', 2000, ONOS1Ip, 2000 )
238 main.Functions.setupTunnel( main, '1.1.1.4', 2000, ONOS2Ip, 2000 )
239 main.Functions.setupTunnel( main, '1.1.1.6', 2000, ONOS3Ip, 2000 )
240
241 main.log.info( "Wait SDN-IP to finish installing connectivity intents \
242 and the BGP paths in data plane are ready..." )
243 time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
244
245 main.log.info( "Wait Quagga to finish delivery all routes to each \
246 other and to sdn-ip, plus finish installing all intents..." )
247 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
pingping-lin26990f02015-11-30 15:48:06 -0800248
249 def CASE1( self, main ):
250 '''
251 ping test from 3 bgp peers to BGP speaker
252 '''
253
254 main.case( "Ping tests between BGP peers and speakers" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800255 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
256 peers=["pr64514", "pr64515", "pr64516"],
257 expectAllSuccess=True )
258 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
259 peers=[pr64514, pr64515, pr64516],
260 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800261
262 def CASE2( self, main ):
263 '''
264 point-to-point intents test for each BGP peer and BGP speaker pair
265 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800266 import time
pingping-lin26990f02015-11-30 15:48:06 -0800267 main.case( "Check point-to-point intents" )
268 main.log.info( "There are %s BGP peers in total "
269 % main.params[ 'config' ][ 'peerNum' ] )
270 main.step( "Check P2P intents number from ONOS CLI" )
271
Jon Hall6e9897d2016-02-29 14:41:32 -0800272 getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
pingping-lin26990f02015-11-30 15:48:06 -0800273 bgpIntentsActualNum = \
274 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
275 bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
Jon Hall6e9897d2016-02-29 14:41:32 -0800276 if bgpIntentsActualNum != bgpIntentsExpectedNum:
277 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
278 bgpIntentsActualNum = \
279 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
pingping-lin26990f02015-11-30 15:48:06 -0800280 main.log.info( "bgpIntentsExpected num is:" )
281 main.log.info( bgpIntentsExpectedNum )
282 main.log.info( "bgpIntentsActual num is:" )
283 main.log.info( bgpIntentsActualNum )
284 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800285 expect=True,
286 actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
287 onpass="PointToPointIntent Intent Num is correct!",
288 onfail="PointToPointIntent Intent Num is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800289
290
291 def CASE3( self, main ):
292 '''
293 routes and intents check to all BGP peers
294 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800295 import time
pingping-lin26990f02015-11-30 15:48:06 -0800296 main.case( "Check routes and M2S intents to all BGP peers" )
297
298 allRoutesExpected = []
299 allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
300 allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
301 allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
302
Jon Hall6e9897d2016-02-29 14:41:32 -0800303 getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
pingping-lin26990f02015-11-30 15:48:06 -0800304 allRoutesActual = \
305 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
306 allRoutesStrExpected = str( sorted( allRoutesExpected ) )
307 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800308 if allRoutesStrActual != allRoutesStrExpected:
309 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
310 allRoutesActual = \
311 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
312 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
pingping-lin26990f02015-11-30 15:48:06 -0800313
314 main.step( "Check routes installed" )
315 main.log.info( "Routes expected:" )
316 main.log.info( allRoutesStrExpected )
317 main.log.info( "Routes get from ONOS CLI:" )
318 main.log.info( allRoutesStrActual )
319 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800320 expect=allRoutesStrExpected, actual=allRoutesStrActual,
321 onpass="Routes are correct!",
322 onfail="Routes are wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800323
324 main.step( "Check M2S intents installed" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800325 getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
pingping-lin26990f02015-11-30 15:48:06 -0800326 routeIntentsActualNum = \
327 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
328 routeIntentsExpectedNum = 3
Jon Hall6e9897d2016-02-29 14:41:32 -0800329 if routeIntentsActualNum != routeIntentsExpectedNum:
330 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
331 routeIntentsActualNum = \
332 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
pingping-lin26990f02015-11-30 15:48:06 -0800333
334 main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
335 main.log.info( routeIntentsExpectedNum )
336 main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
337 main.log.info( routeIntentsActualNum )
338 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800339 expect=routeIntentsExpectedNum,
340 actual=routeIntentsActualNum,
341 onpass="MultiPointToSinglePoint Intent Num is correct!",
342 onfail="MultiPointToSinglePoint Intent Num is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800343
344 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800345 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
346 main.FALSE,
347 kwargs={'isPENDING':False},
348 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800349 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800350 expect=main.TRUE,
351 actual=flowCheck,
352 onpass="Flow status is correct!",
353 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800354
355
356 def CASE4( self, main ):
357 '''
358 Ping test in data plane for each route
359 '''
360 main.case( "Ping test for each route, all hosts behind BGP peers" )
361 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800362 hosts=["host64514", "host64515", "host64516"],
363 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800364
365
366 def CASE5( self, main ):
367 '''
368 Cut links to peers one by one, check routes/intents
369 '''
370 import time
371 main.case( "Bring down links and check routes/intents" )
372 main.step( "Bring down the link between sw32 and peer64514" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800373 linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
374 OPTION="down" )
pingping-lin3806f112016-01-04 10:38:25 -0800375 # When bring down a link, Mininet will bring down both the interfaces
376 # at the two sides of the link. Here we do not want to bring down the
377 # host side interface, since I noticed when bring up in CASE6, some of
378 # the configuration information will lost.
Jon Hall6e9897d2016-02-29 14:41:32 -0800379 utilities.assertEquals( expect=main.TRUE,
380 actual=linkResult1,
381 onpass="Bring down link succeeded!",
382 onfail="Bring down link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800383
384 if linkResult1 == main.TRUE:
385 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
386 main.Functions.checkRouteNum( main, 2 )
387 main.Functions.checkM2SintentNum( main, 2 )
388 else:
389 main.log.error( "Bring down link failed!" )
390 main.cleanup()
391 main.exit()
392
393 main.step( "Bring down the link between sw8 and peer64515" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800394 linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
395 OPTION="down" )
396 utilities.assertEquals( expect=main.TRUE,
397 actual=linkResult2,
398 onpass="Bring down link succeeded!",
399 onfail="Bring down link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800400 if linkResult2 == main.TRUE:
401 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
402 main.Functions.checkRouteNum( main, 1 )
403 main.Functions.checkM2SintentNum( main, 1 )
404 else:
405 main.log.error( "Bring down link failed!" )
406 main.cleanup()
407 main.exit()
408
409 main.step( "Bring down the link between sw28 and peer64516" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800410 linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
411 OPTION="down" )
412 utilities.assertEquals( expect=main.TRUE,
413 actual=linkResult3,
414 onpass="Bring down link succeeded!",
415 onfail="Bring down link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800416 if linkResult3 == main.TRUE:
417 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
418 main.Functions.checkRouteNum( main, 0 )
419 main.Functions.checkM2SintentNum( main, 0 )
420 else:
421 main.log.error( "Bring down link failed!" )
422 main.cleanup()
423 main.exit()
424
425 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800426 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
427 main.FALSE,
428 kwargs={'isPENDING':False},
429 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800430 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800431 expect=main.TRUE,
432 actual=flowCheck,
433 onpass="Flow status is correct!",
434 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800435
436 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800437 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
438 peers=["pr64514", "pr64515", "pr64516"],
439 expectAllSuccess=False )
pingping-lin26990f02015-11-30 15:48:06 -0800440 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800441 hosts=["host64514", "host64515", "host64516"],
442 expectAllSuccess=False )
pingping-lin26990f02015-11-30 15:48:06 -0800443
444
445 def CASE6( self, main ):
446 '''
447 Recover links to peers one by one, check routes/intents
448 '''
449 import time
450 main.case( "Bring up links and check routes/intents" )
451 main.step( "Bring up the link between sw32 and peer64514" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800452 linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
453 OPTION="up" )
454 utilities.assertEquals( expect=main.TRUE,
455 actual=linkResult1,
456 onpass="Bring up link succeeded!",
457 onfail="Bring up link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800458 if linkResult1 == main.TRUE:
459 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
460 main.Functions.checkRouteNum( main, 1 )
461 main.Functions.checkM2SintentNum( main, 1 )
462 else:
463 main.log.error( "Bring up link failed!" )
464 main.cleanup()
465 main.exit()
466
467 main.step( "Bring up the link between sw8 and peer64515" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800468 linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
469 OPTION="up" )
470 utilities.assertEquals( expect=main.TRUE,
471 actual=linkResult2,
472 onpass="Bring up link succeeded!",
473 onfail="Bring up link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800474 if linkResult2 == main.TRUE:
475 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
476 main.Functions.checkRouteNum( main, 2 )
477 main.Functions.checkM2SintentNum( main, 2 )
478 else:
479 main.log.error( "Bring up link failed!" )
480 main.cleanup()
481 main.exit()
482
483 main.step( "Bring up the link between sw28 and peer64516" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800484 linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
485 OPTION="up" )
486 utilities.assertEquals( expect=main.TRUE,
487 actual=linkResult3,
488 onpass="Bring up link succeeded!",
489 onfail="Bring up link failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800490 if linkResult3 == main.TRUE:
491 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
492 main.Functions.checkRouteNum( main, 3 )
493 main.Functions.checkM2SintentNum( main, 3 )
494 else:
495 main.log.error( "Bring up link failed!" )
496 main.cleanup()
497 main.exit()
498
499 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800500 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
501 main.FALSE,
502 kwargs={'isPENDING':False},
503 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800504 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800505 expect=main.TRUE,
506 actual=flowCheck,
507 onpass="Flow status is correct!",
508 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800509
510 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800511 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
512 peers=["pr64514", "pr64515", "pr64516"],
513 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800514 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800515 hosts=["host64514", "host64515", "host64516"],
516 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800517
518
519 def CASE7( self, main ):
520 '''
521 Shut down a edge switch, check P-2-P and M-2-S intents, ping test
522 '''
523 import time
524 main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
525 main.step( "Stop sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800526 result = main.Mininet.switch( SW="sw32", OPTION="stop" )
527 utilities.assertEquals( expect=main.TRUE, actual=result,
528 onpass="Stopping switch succeeded!",
529 onfail="Stopping switch failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800530
531 if result == main.TRUE:
532 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
533 main.Functions.checkRouteNum( main, 2 )
534 main.Functions.checkM2SintentNum( main, 2 )
535 main.Functions.checkP2PintentNum( main, 12 * 2 )
536 else:
537 main.log.error( "Stopping switch failed!" )
538 main.cleanup()
539 main.exit()
540
541 main.step( "Check ping between hosts behind BGP peers" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800542 result1 = main.Mininet.pingHost( src="host64514", target="host64515" )
543 result2 = main.Mininet.pingHost( src="host64515", target="host64516" )
544 result3 = main.Mininet.pingHost( src="host64514", target="host64516" )
pingping-lin26990f02015-11-30 15:48:06 -0800545
546 pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
547 and ( result3 == main.FALSE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800548 utilities.assert_equals( expect=True, actual=pingResult1,
549 onpass="Ping test result is correct",
550 onfail="Ping test result is wrong" )
pingping-lin26990f02015-11-30 15:48:06 -0800551
552 if pingResult1 == False:
553 main.cleanup()
554 main.exit()
555
556 main.step( "Check ping between BGP peers and speaker1" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800557 result4 = main.Mininet.pingHost( src="speaker1", target="pr64514" )
558 result5 = main.Mininet.pingHost( src="speaker1", target="pr64515" )
559 result6 = main.Mininet.pingHost( src="speaker1", target="pr64516" )
pingping-lin26990f02015-11-30 15:48:06 -0800560
561 pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
562 and ( result6 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800563 utilities.assert_equals( expect=True, actual=pingResult2,
564 onpass="Speaker1 ping peers successful",
565 onfail="Speaker1 ping peers NOT successful" )
pingping-lin26990f02015-11-30 15:48:06 -0800566
567 if pingResult2 == False:
568 main.cleanup()
569 main.exit()
570
571 main.step( "Check ping between BGP peers and speaker2" )
572 # TODO
Jon Hall6e9897d2016-02-29 14:41:32 -0800573 result7 = main.Mininet.pingHost( src="speaker2", target=pr64514 )
574 result8 = main.Mininet.pingHost( src="speaker2", target=pr64515 )
575 result9 = main.Mininet.pingHost( src="speaker2", target=pr64516 )
pingping-lin26990f02015-11-30 15:48:06 -0800576
577 pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
578 and ( result9 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800579 utilities.assert_equals( expect=True, actual=pingResult2,
580 onpass="Speaker2 ping peers successful",
581 onfail="Speaker2 ping peers NOT successful" )
pingping-lin26990f02015-11-30 15:48:06 -0800582
583 if pingResult3 == False:
584 main.cleanup()
585 main.exit()
586
587 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800588 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
589 main.FALSE,
590 kwargs={'isPENDING':False},
591 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800592 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800593 expect=main.TRUE,
594 actual=flowCheck,
595 onpass="Flow status is correct!",
596 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800597
598
599 def CASE8( self, main ):
600 '''
601 Bring up the edge switch (sw32) which was shut down in CASE7,
602 check P-2-P and M-2-S intents, ping test
603 '''
604 import time
605 main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
606 main.step( "Start sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800607 result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
pingping-lin26990f02015-11-30 15:48:06 -0800608 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800609 expect=main.TRUE,
610 actual=result1,
611 onpass="Starting switch succeeded!",
612 onfail="Starting switch failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800613
pingping-lin3806f112016-01-04 10:38:25 -0800614 result2 = main.Mininet.assignSwController( "sw32", fsfwIp,
Jon Hall6e9897d2016-02-29 14:41:32 -0800615 port=fsfwPort )
pingping-lin26990f02015-11-30 15:48:06 -0800616 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800617 expect=main.TRUE,
618 actual=result2,
619 onpass="Connect switch to FSFW succeeded!",
620 onfail="Connect switch to FSFW failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800621
622 if result1 and result2:
623 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
624 main.Functions.checkRouteNum( main, 3 )
625 main.Functions.checkM2SintentNum( main, 3 )
626 main.Functions.checkP2PintentNum( main, 18 * 2 )
627 else:
628 main.log.error( "Starting switch failed!" )
629 main.cleanup()
630 main.exit()
631
632 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800633 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
634 main.FALSE,
635 kwargs={'isPENDING':False},
636 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800637 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800638 expect=main.TRUE,
639 actual=flowCheck,
640 onpass="Flow status is correct!",
641 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800642
643 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800644 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
645 peers=["pr64514", "pr64515", "pr64516"],
646 expectAllSuccess=True )
647 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
648 peers=[pr64514, pr64515, pr64516],
649 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800650 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800651 hosts=["host64514", "host64515", "host64516"],
652 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800653
654
655 def CASE9( self, main ):
656 '''
657 Bring down a switch in best path, check:
658 route number, P2P intent number, M2S intent number, ping test
659 '''
660 main.case( "Stop sw11 located in best path, \
661 check route number, P2P intent number, M2S intent number, ping test" )
662
663 main.log.info( "Check the flow number correctness before stopping sw11" )
664 main.Functions.checkFlowNum( main, "sw11", 19 )
665 main.Functions.checkFlowNum( main, "sw1", 3 )
666 main.Functions.checkFlowNum( main, "sw7", 3 )
667 main.log.info( main.Mininet.checkFlows( "sw11" ) )
668 main.log.info( main.Mininet.checkFlows( "sw1" ) )
669 main.log.info( main.Mininet.checkFlows( "sw7" ) )
670
671 main.step( "Stop sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800672 result = main.Mininet.switch( SW="sw11", OPTION="stop" )
673 utilities.assertEquals( expect=main.TRUE, actual=result,
674 onpass="Stopping switch succeeded!",
675 onfail="Stopping switch failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800676 if result:
677 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
678 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
679 main.Functions.checkRouteNum( main, 3 )
680 main.Functions.checkM2SintentNum( main, 3 )
681 main.Functions.checkP2PintentNum( main, 18 * 2 )
682 else:
683 main.log.error( "Stopping switch failed!" )
684 main.cleanup()
685 main.exit()
686
687 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800688 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
689 main.FALSE,
690 kwargs={'isPENDING':False},
691 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800692 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800693 expect=main.TRUE,
694 actual=flowCheck,
695 onpass="Flow status is correct!",
696 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800697 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800698 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
699 peers=["pr64514", "pr64515", "pr64516"],
700 expectAllSuccess=True )
701 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
702 peers=[pr64514, pr64515, pr64516],
703 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800704 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800705 hosts=["host64514", "host64515", "host64516"],
706 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800707
708
709 def CASE10( self, main ):
710 '''
711 Bring up the switch which was stopped in CASE9, check:
712 route number, P2P intent number, M2S intent number, ping test
713 '''
714 main.case( "Start sw11 which was stopped in CASE9, \
715 check route number, P2P intent number, M2S intent number, ping test" )
716
717 main.log.info( "Check the flow status before starting sw11" )
718 main.Functions.checkFlowNum( main, "sw1", 17 )
719 main.Functions.checkFlowNum( main, "sw7", 5 )
720 main.log.info( main.Mininet.checkFlows( "sw1" ) )
721 main.log.info( main.Mininet.checkFlows( "sw7" ) )
722
723 main.step( "Start sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800724 result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
725 utilities.assertEquals( expect=main.TRUE, actual=result1,
726 onpass="Starting switch succeeded!",
727 onfail="Starting switch failed!" )
pingping-lin3806f112016-01-04 10:38:25 -0800728 result2 = main.Mininet.assignSwController( "sw11", fsfwIp,
Jon Hall6e9897d2016-02-29 14:41:32 -0800729 port=fsfwPort )
730 utilities.assertEquals( expect=main.TRUE, actual=result2,
731 onpass="Connect switch to FSFW succeeded!",
732 onfail="Connect switch to FSFW failed!" )
pingping-lin26990f02015-11-30 15:48:06 -0800733 if result1 and result2:
734 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
735 main.Functions.checkRouteNum( main, 3 )
736 main.Functions.checkM2SintentNum( main, 3 )
737 main.Functions.checkP2PintentNum( main, 18 * 2 )
738
739 main.log.debug( main.Mininet.checkFlows( "sw11" ) )
740 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
741 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
742 else:
743 main.log.error( "Starting switch failed!" )
744 main.cleanup()
745 main.exit()
746
747 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800748 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
749 main.FALSE,
750 kwargs={'isPENDING':False},
751 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800752 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800753 expect=main.TRUE,
754 actual=flowCheck,
755 onpass="Flow status is correct!",
756 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800757 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800758 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
759 peers=["pr64514", "pr64515", "pr64516"],
760 expectAllSuccess=True )
761 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
762 peers=[pr64514, pr64515, pr64516],
763 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800764 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800765 hosts=["host64514", "host64515", "host64516"],
766 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800767
768
769 def CASE11(self, main):
770 import time
771 main.case( "Kill speaker1, check:\
772 route number, P2P intent number, M2S intent number, ping test" )
773 main.log.info( "Check network status before killing speaker1" )
774 main.Functions.checkRouteNum( main, 3 )
775 main.Functions.checkM2SintentNum( main, 3 )
776 main.Functions.checkP2PintentNum( main, 18 * 2 )
777 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800778 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
779 main.FALSE,
780 kwargs={'isPENDING':False},
781 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800782 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800783 expect=main.TRUE,
784 actual=flowCheck,
785 onpass="Flow status is correct!",
786 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800787
Jon Hall6e9897d2016-02-29 14:41:32 -0800788 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
789 peers=["pr64514", "pr64515", "pr64516"],
790 expectAllSuccess=True )
791 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
792 peers=[pr64514, pr64515, pr64516],
793 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800794 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800795 hosts=["host64514", "host64515", "host64516"],
796 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800797
798 main.step( "Kill speaker1" )
799 command1 = "ps -e | grep bgp -c"
800 result1 = main.Mininet.node( "root", command1 )
801
802 # The total BGP daemon number in this test environment is 5.
803 if "5" in result1:
804 main.log.debug( "Before kill speaker1, 5 BGP daemons - correct" )
805 else:
806 main.log.warn( "Before kill speaker1, number of BGP daemons is wrong" )
807 main.log.info( result1 )
808
809 command2 = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`"
810 result2 = main.Mininet.node( "root", command2 )
811
812 result3 = main.Mininet.node( "root", command1 )
813
Jon Hall6e9897d2016-02-29 14:41:32 -0800814 utilities.assert_equals( expect=True,
815 actual=( "4" in result3 ),
816 onpass="Kill speaker1 succeeded",
817 onfail="Kill speaker1 failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800818 if ( "4" not in result3 ) :
819 main.log.info( result3 )
820 main.cleanup()
821 main.exit()
822
823 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
824 main.Functions.checkRouteNum( main, 3 )
825 main.Functions.checkM2SintentNum( main, 3 )
826 main.Functions.checkP2PintentNum( main, 18 * 2 )
827
828 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800829 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
830 main.FALSE,
831 kwargs={'isPENDING':False},
832 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800833 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800834 expect=main.TRUE,
835 actual=flowCheck,
836 onpass="Flow status is correct!",
837 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800838
839 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800840 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
841 peers=["pr64514", "pr64515", "pr64516"],
842 expectAllSuccess=False )
pingping-lin26990f02015-11-30 15:48:06 -0800843 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800844 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
845 peers=[pr64514, pr64515, pr64516],
846 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800847 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800848 hosts=["host64514", "host64515", "host64516"],
849 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800850
851
852 def CASE12( self, main ):
853 import time
854 import json
855 main.case( "Bring down leader ONOS node, check: \
856 route number, P2P intent number, M2S intent number, ping test" )
857 main.step( "Find out ONOS leader node" )
858 result = main.ONOScli1.leaders()
859 jsonResult = json.loads( result )
860 leaderIP = ""
861 for entry in jsonResult:
862 if entry["topic"] == "org.onosproject.sdnip":
863 leaderIP = entry["leader"]
864 main.log.info( "leaderIP is: " )
865 main.log.info( leaderIP )
866
867 main.step( "Uninstall ONOS/SDN-IP leader node" )
868 if leaderIP == ONOS1Ip:
869 uninstallResult = main.ONOSbench.onosStop( ONOS1Ip )
870 elif leaderIP == ONOS2Ip:
871 uninstallResult = main.ONOSbench.onosStop( ONOS2Ip )
872 else:
873 uninstallResult = main.ONOSbench.onosStop( ONOS3Ip )
874
Jon Hall6e9897d2016-02-29 14:41:32 -0800875 utilities.assert_equals( expect=main.TRUE,
876 actual=uninstallResult,
877 onpass="Uninstall ONOS leader succeeded",
878 onfail="Uninstall ONOS leader failed" )
pingping-lin26990f02015-11-30 15:48:06 -0800879 if uninstallResult != main.TRUE:
880 main.cleanup()
881 main.exit()
882 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
883
884 if leaderIP == ONOS1Ip:
Jon Hall6e9897d2016-02-29 14:41:32 -0800885 main.Functions.checkRouteNum( main, 3, ONOScli="ONOScli2" )
886 main.Functions.checkM2SintentNum( main, 3, ONOScli="ONOScli2" )
887 main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli="ONOScli2" )
pingping-lin26990f02015-11-30 15:48:06 -0800888
889 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800890 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
891 main.FALSE,
892 kwargs={'isPENDING':False},
893 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800894 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800895 expect=main.TRUE,
896 actual=flowCheck,
897 onpass="Flow status is correct!",
898 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800899 else:
900 main.Functions.checkRouteNum( main, 3 )
901 main.Functions.checkM2SintentNum( main, 3 )
902 main.Functions.checkP2PintentNum( main, 18 * 2 )
903
904 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800905 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
906 main.FALSE,
907 kwargs={'isPENDING':False},
908 attempts=10 )
pingping-lin26990f02015-11-30 15:48:06 -0800909 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800910 expect=main.TRUE,
911 actual=flowCheck,
912 onpass="Flow status is correct!",
913 onfail="Flow status is wrong!" )
pingping-lin26990f02015-11-30 15:48:06 -0800914
Jon Hall6e9897d2016-02-29 14:41:32 -0800915 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
916 peers=["pr64514", "pr64515", "pr64516"],
917 expectAllSuccess=True )
918 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
919 peers=[pr64514, pr64515, pr64516],
920 expectAllSuccess=True )
pingping-lin26990f02015-11-30 15:48:06 -0800921 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800922 hosts=["host64514", "host64515", "host64516"],
923 expectAllSuccess=True )