blob: 42b4bc8c444e9c9b53be7b7a3f2c9002f8b8b4fc [file] [log] [blame]
pingping-linea32cf82015-10-08 22:37:37 -07001# Testing the functionality of SDN-IP with single ONOS instance
2class USECASE_SdnipFunctionCluster:
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-linea32cf82015-10-08 22:37:37 -070025 # Exit if topology did not load properly
26 if not topoResult:
27 main.cleanup()
28 main.exit()
29 main.step( "Connect switches to controllers" )
30
31 # connect all switches to controllers
32 swResult = main.TRUE
33 for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
34 sw = "sw%s" % ( i )
35 swResult = swResult and main.Mininet.assignSwController( sw,
36 [ONOS1Ip, ONOS2Ip, ONOS3Ip] )
37
Jon Hall6e9897d2016-02-29 14:41:32 -080038 utilities.assert_equals( expect=main.TRUE,
39 actual=swResult,
40 onpass="Successfully connect all switches to ONOS",
41 onfail="Failed to connect all switches to ONOS" )
pingping-linea32cf82015-10-08 22:37:37 -070042 if not swResult:
43 main.cleanup()
44 main.exit()
45
46
47 def CASE101( self, main ):
48 """
49 Package ONOS and install it
50 Startup sequence:
51 cell <name>
52 onos-verify-cell
53 onos-package
54 onos-install -f
55 onos-wait-for-start
56 """
57 import json
58 import time
59 import os
60 from operator import eq
61
62 main.case( "Setting up ONOS environment" )
63
64 cellName = main.params[ 'ENV' ][ 'cellName' ]
65 global ONOS1Ip
66 global ONOS2Ip
67 global ONOS3Ip
68 ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
69 ONOS2Ip = os.getenv( main.params[ 'CTRL' ][ 'ip2' ] )
70 ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] )
Jon Hall6e9897d2016-02-29 14:41:32 -080071 ipList = [ ONOS1Ip, ONOS2Ip, ONOS3Ip ]
pingping-linea32cf82015-10-08 22:37:37 -070072
73 global peer64514
74 global peer64515
75 global peer64516
76 peer64514 = main.params['config']['peer64514']
77 peer64515 = main.params['config']['peer64515']
78 peer64516 = main.params['config']['peer64516']
79
Jon Hall6e9897d2016-02-29 14:41:32 -080080 main.step( "Create cell file" )
81 cellAppString = main.params[ 'ENV' ][ 'appString' ]
82 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
83 main.Mininet.ip_address,
84 cellAppString, ipList )
85
pingping-linea32cf82015-10-08 22:37:37 -070086 main.step( "Applying cell variable to environment" )
87 cellResult = main.ONOSbench.setCell( cellName )
Jon Hall6e9897d2016-02-29 14:41:32 -080088 utilities.assert_equals( expect=main.TRUE,
89 actual=cellResult,
90 onpass="Set cell succeeded",
91 onfail="Set cell failed" )
pingping-linea32cf82015-10-08 22:37:37 -070092
93 verifyResult = main.ONOSbench.verifyCell()
Jon Hall6e9897d2016-02-29 14:41:32 -080094 utilities.assert_equals( expect=main.TRUE,
95 actual=verifyResult,
96 onpass="Verify cell succeeded",
97 onfail="Verify cell failed" )
pingping-linea32cf82015-10-08 22:37:37 -070098
99 branchName = main.ONOSbench.getBranchName()
100 main.log.report( "ONOS is on branch: " + branchName )
101
102 main.log.step( "Uninstalling ONOS" )
103 uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
104 and main.ONOSbench.onosUninstall( ONOS2Ip ) \
105 and main.ONOSbench.onosUninstall( ONOS3Ip )
Jon Hall6e9897d2016-02-29 14:41:32 -0800106 utilities.assert_equals( expect=main.TRUE,
107 actual=uninstallResult,
108 onpass="Uninstall ONOS from nodes succeeded",
109 onfail="Uninstall ONOS form nodes failed" )
pingping-linea32cf82015-10-08 22:37:37 -0700110
Jon Hall6e9897d2016-02-29 14:41:32 -0800111 main.ONOSbench.getVersion( report=True )
pingping-linea32cf82015-10-08 22:37:37 -0700112
113 main.step( "Creating ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800114 packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
115 utilities.assert_equals( expect=main.TRUE,
116 actual=packageResult,
117 onpass="Package ONOS succeeded",
118 onfail="Package ONOS failed" )
pingping-linea32cf82015-10-08 22:37:37 -0700119
120 main.step( "Installing ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800121 onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
122 node=ONOS1Ip )
123 onos2InstallResult = main.ONOSbench.onosInstall( options="-f",
124 node=ONOS2Ip )
125 onos3InstallResult = main.ONOSbench.onosInstall( options="-f",
126 node=ONOS3Ip )
pingping-linea32cf82015-10-08 22:37:37 -0700127 onosInstallResult = onos1InstallResult and onos2InstallResult \
128 and onos3InstallResult
Jon Hall6e9897d2016-02-29 14:41:32 -0800129 utilities.assert_equals( expect=main.TRUE,
130 actual=onosInstallResult,
131 onpass="Install ONOS to nodes succeeded",
132 onfail="Install ONOS to nodes failed" )
pingping-linea32cf82015-10-08 22:37:37 -0700133
134 main.step( "Checking if ONOS is up yet" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800135 onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
136 onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
137 onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout=420 )
pingping-linea32cf82015-10-08 22:37:37 -0700138 onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult
Jon Hall6e9897d2016-02-29 14:41:32 -0800139 utilities.assert_equals( expect=main.TRUE,
140 actual=onosUpResult,
141 onpass="ONOS nodes are up",
142 onfail="ONOS nodes are NOT up" )
pingping-linea32cf82015-10-08 22:37:37 -0700143
144 main.step( "Checking if ONOS CLI is ready" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800145 main.CLIs = []
pingping-lina14c7c82015-10-09 15:44:36 -0700146 cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800147 commandlineTimeout=100, onosStartTimeout=600 )
148 main.CLIs.append( main.ONOScli1 )
pingping-lina14c7c82015-10-09 15:44:36 -0700149 cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800150 commandlineTimeout=100, onosStartTimeout=600 )
151 main.CLIs.append( main.ONOScli2 )
152 cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip,
153 commandlineTimeout=100, onosStartTimeout=600 )
154 main.CLIs.append( main.ONOScli3 )
155 cliResult = cliResult1 and cliResult2 and cliResult3
156 utilities.assert_equals( expect=main.TRUE,
157 actual=cliResult,
158 onpass="ONOS CLIs are ready",
159 onfail="ONOS CLIs are not ready" )
pingping-linea32cf82015-10-08 22:37:37 -0700160
Jon Hall6e9897d2016-02-29 14:41:32 -0800161 for i in range( 10 ):
162 ready = True
163 for cli in main.CLIs:
164 output = cli.summary()
165 if not output:
166 ready = False
167 if ready:
168 break
169 time.sleep( 30 )
170 utilities.assert_equals( expect=True, actual=ready,
171 onpass="ONOS summary command succeded",
172 onfail="ONOS summary command failed" )
pingping-linea32cf82015-10-08 22:37:37 -0700173
Jon Hall6e9897d2016-02-29 14:41:32 -0800174 if not ready:
pingping-linea32cf82015-10-08 22:37:37 -0700175 main.log.error( "ONOS startup failed!" )
176 main.cleanup()
177 main.exit()
178
pingping-linea32cf82015-10-08 22:37:37 -0700179 def CASE200( self, main ):
180 main.case( "Activate sdn-ip application" )
181 main.log.info( "waiting link discovery......" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800182 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
pingping-linea32cf82015-10-08 22:37:37 -0700183
184 main.log.info( "Get links in the network" )
pingping-lina14c7c82015-10-09 15:44:36 -0700185 summaryResult = main.ONOScli1.summary()
pingping-linea32cf82015-10-08 22:37:37 -0700186 linkNum = json.loads( summaryResult )[ "links" ]
Jon Hall6e9897d2016-02-29 14:41:32 -0800187 listResult = main.ONOScli1.links( jsonFormat=False )
pingping-lina14c7c82015-10-09 15:44:36 -0700188 main.log.info( listResult )
pingping-linea32cf82015-10-08 22:37:37 -0700189 if linkNum < 100:
190 main.log.error( "Link number is wrong!" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800191 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
192 listResult = main.ONOScli1.links( jsonFormat=False )
193 main.log.info( listResult )
pingping-linea32cf82015-10-08 22:37:37 -0700194 main.cleanup()
195 main.exit()
196
pingping-linea32cf82015-10-08 22:37:37 -0700197 main.step( "Activate sdn-ip application" )
pingping-lina14c7c82015-10-09 15:44:36 -0700198 activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800199 utilities.assert_equals( expect=main.TRUE,
200 actual=activeSDNIPresult,
201 onpass="Activate SDN-IP succeeded",
202 onfail="Activate SDN-IP failed" )
pingping-linea32cf82015-10-08 22:37:37 -0700203 if not activeSDNIPresult:
Jon Hall6e9897d2016-02-29 14:41:32 -0800204 main.log.info( "Activate SDN-IP failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700205 main.cleanup()
206 main.exit()
207
pingping-linea32cf82015-10-08 22:37:37 -0700208
209 def CASE102( self, main ):
210 '''
211 This test case is to load the methods from other Python files, and create
212 tunnels from mininet host to onos nodes.
213 '''
214 import time
215 main.case( "Load methods from other Python file and create tunnels" )
216 # load the methods from other file
217 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
218 main.Functions = imp.load_source( wrapperFile1,
219 main.dependencyPath +
220 wrapperFile1 +
221 ".py" )
222 # Create tunnels
223 main.Functions.setupTunnel( main, '1.1.1.2', 2000, ONOS1Ip, 2000 )
224 main.Functions.setupTunnel( main, '1.1.1.4', 2000, ONOS2Ip, 2000 )
225 main.Functions.setupTunnel( main, '1.1.1.6', 2000, ONOS3Ip, 2000 )
226
227 main.log.info( "Wait SDN-IP to finish installing connectivity intents \
228 and the BGP paths in data plane are ready..." )
229 time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
230
231 main.log.info( "Wait Quagga to finish delivery all routes to each \
232 other and to sdn-ip, plus finish installing all intents..." )
233 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
pingping-linea32cf82015-10-08 22:37:37 -0700234
235 def CASE1( self, main ):
236 '''
237 ping test from 3 bgp peers to BGP speaker
238 '''
239
240 main.case( "Ping tests between BGP peers and speakers" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800241 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
242 peers=["peer64514", "peer64515", "peer64516"],
243 expectAllSuccess=True )
244 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
245 peers=[peer64514, peer64515, peer64516],
246 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700247
248 def CASE2( self, main ):
249 '''
250 point-to-point intents test for each BGP peer and BGP speaker pair
251 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800252 import time
pingping-linea32cf82015-10-08 22:37:37 -0700253 main.case( "Check point-to-point intents" )
254 main.log.info( "There are %s BGP peers in total "
255 % main.params[ 'config' ][ 'peerNum' ] )
256 main.step( "Check P2P intents number from ONOS CLI" )
257
Jon Hall6e9897d2016-02-29 14:41:32 -0800258 getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
pingping-linea32cf82015-10-08 22:37:37 -0700259 bgpIntentsActualNum = \
260 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
261 bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
Jon Hall6e9897d2016-02-29 14:41:32 -0800262 if bgpIntentsActualNum != bgpIntentsExpectedNum:
263 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
264 bgpIntentsActualNum = \
265 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
pingping-linea32cf82015-10-08 22:37:37 -0700266 main.log.info( "bgpIntentsExpected num is:" )
267 main.log.info( bgpIntentsExpectedNum )
268 main.log.info( "bgpIntentsActual num is:" )
269 main.log.info( bgpIntentsActualNum )
270 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800271 expect=True,
272 actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
273 onpass="PointToPointIntent Intent Num is correct!",
274 onfail="PointToPointIntent Intent Num is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700275
276
277 def CASE3( self, main ):
278 '''
279 routes and intents check to all BGP peers
280 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800281 import time
pingping-linea32cf82015-10-08 22:37:37 -0700282 main.case( "Check routes and M2S intents to all BGP peers" )
283
284 allRoutesExpected = []
285 allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
286 allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
287 allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
288
Jon Hall6e9897d2016-02-29 14:41:32 -0800289 getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
pingping-linea32cf82015-10-08 22:37:37 -0700290 allRoutesActual = \
291 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
292 allRoutesStrExpected = str( sorted( allRoutesExpected ) )
293 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800294 if allRoutesStrActual != allRoutesStrExpected:
295 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
296 allRoutesActual = \
297 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
298 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
pingping-linea32cf82015-10-08 22:37:37 -0700299
300 main.step( "Check routes installed" )
301 main.log.info( "Routes expected:" )
302 main.log.info( allRoutesStrExpected )
303 main.log.info( "Routes get from ONOS CLI:" )
304 main.log.info( allRoutesStrActual )
305 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800306 expect=allRoutesStrExpected, actual=allRoutesStrActual,
307 onpass="Routes are correct!",
308 onfail="Routes are wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700309
310 main.step( "Check M2S intents installed" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800311 getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
pingping-linea32cf82015-10-08 22:37:37 -0700312 routeIntentsActualNum = \
313 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
314 routeIntentsExpectedNum = 3
Jon Hall6e9897d2016-02-29 14:41:32 -0800315 if routeIntentsActualNum != routeIntentsExpectedNum:
316 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
317 routeIntentsActualNum = \
318 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
pingping-linea32cf82015-10-08 22:37:37 -0700319
320 main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
321 main.log.info( routeIntentsExpectedNum )
322 main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
323 main.log.info( routeIntentsActualNum )
324 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800325 expect=routeIntentsExpectedNum,
326 actual=routeIntentsActualNum,
327 onpass="MultiPointToSinglePoint Intent Num is correct!",
328 onfail="MultiPointToSinglePoint Intent Num is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700329
330 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800331 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
332 main.FALSE,
333 kwargs={'isPENDING':False},
334 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700335 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800336 expect=main.TRUE,
337 actual=flowCheck,
338 onpass="Flow status is correct!",
339 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700340
341
342 def CASE4( self, main ):
343 '''
344 Ping test in data plane for each route
345 '''
346 main.case( "Ping test for each route, all hosts behind BGP peers" )
347 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800348 hosts=["host64514", "host64515", "host64516"],
349 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700350
351
352 def CASE5( self, main ):
353 '''
354 Cut links to peers one by one, check routes/intents
355 '''
356 import time
357 main.case( "Bring down links and check routes/intents" )
358 main.step( "Bring down the link between sw32 and peer64514" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800359 linkResult1 = main.Mininet.link( END1="sw32", END2="peer64514",
360 OPTION="down" )
361 utilities.assertEquals( expect=main.TRUE,
362 actual=linkResult1,
363 onpass="Bring down link succeeded!",
364 onfail="Bring down link failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700365
366 if linkResult1 == main.TRUE:
367 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
368 main.Functions.checkRouteNum( main, 2 )
369 main.Functions.checkM2SintentNum( main, 2 )
370 else:
371 main.log.error( "Bring down link failed!" )
372 main.cleanup()
373 main.exit()
374
375 main.step( "Bring down the link between sw8 and peer64515" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800376 linkResult2 = main.Mininet.link( END1="sw8", END2="peer64515",
377 OPTION="down" )
378 utilities.assertEquals( expect=main.TRUE,
379 actual=linkResult2,
380 onpass="Bring down link succeeded!",
381 onfail="Bring down link failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700382 if linkResult2 == main.TRUE:
383 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
384 main.Functions.checkRouteNum( main, 1 )
385 main.Functions.checkM2SintentNum( main, 1 )
386 else:
387 main.log.error( "Bring down link failed!" )
388 main.cleanup()
389 main.exit()
390
391 main.step( "Bring down the link between sw28 and peer64516" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800392 linkResult3 = main.Mininet.link( END1="sw28", END2="peer64516",
393 OPTION="down" )
394 utilities.assertEquals( expect=main.TRUE,
395 actual=linkResult3,
396 onpass="Bring down link succeeded!",
397 onfail="Bring down link failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700398 if linkResult3 == main.TRUE:
399 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
400 main.Functions.checkRouteNum( main, 0 )
401 main.Functions.checkM2SintentNum( main, 0 )
402 else:
403 main.log.error( "Bring down link failed!" )
404 main.cleanup()
405 main.exit()
406
407 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800408 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
409 main.FALSE,
410 kwargs={'isPENDING':False},
411 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700412 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800413 expect=main.TRUE,
414 actual=flowCheck,
415 onpass="Flow status is correct!",
416 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700417
418 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800419 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
420 peers=["peer64514", "peer64515", "peer64516"],
421 expectAllSuccess=False )
pingping-linea32cf82015-10-08 22:37:37 -0700422 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800423 hosts=["host64514", "host64515", "host64516"],
424 expectAllSuccess=False )
pingping-linea32cf82015-10-08 22:37:37 -0700425
426
427 def CASE6( self, main ):
428 '''
429 Recover links to peers one by one, check routes/intents
430 '''
431 import time
432 main.case( "Bring up links and check routes/intents" )
433 main.step( "Bring up the link between sw32 and peer64514" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800434 linkResult1 = main.Mininet.link( END1="sw32", END2="peer64514",
435 OPTION="up" )
436 utilities.assertEquals( expect=main.TRUE,
437 actual=linkResult1,
438 onpass="Bring up link succeeded!",
439 onfail="Bring up link failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700440 if linkResult1 == main.TRUE:
441 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
442 main.Functions.checkRouteNum( main, 1 )
443 main.Functions.checkM2SintentNum( main, 1 )
444 else:
445 main.log.error( "Bring up link failed!" )
446 main.cleanup()
447 main.exit()
448
449 main.step( "Bring up the link between sw8 and peer64515" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800450 linkResult2 = main.Mininet.link( END1="sw8", END2="peer64515",
451 OPTION="up" )
452 utilities.assertEquals( expect=main.TRUE,
453 actual=linkResult2,
454 onpass="Bring up link succeeded!",
455 onfail="Bring up link failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700456 if linkResult2 == main.TRUE:
457 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
458 main.Functions.checkRouteNum( main, 2 )
459 main.Functions.checkM2SintentNum( main, 2 )
460 else:
461 main.log.error( "Bring up link failed!" )
462 main.cleanup()
463 main.exit()
464
465 main.step( "Bring up the link between sw28 and peer64516" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800466 linkResult3 = main.Mininet.link( END1="sw28", END2="peer64516",
467 OPTION="up" )
468 utilities.assertEquals( expect=main.TRUE,
469 actual=linkResult3,
470 onpass="Bring up link succeeded!",
471 onfail="Bring up link failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700472 if linkResult3 == main.TRUE:
473 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
474 main.Functions.checkRouteNum( main, 3 )
475 main.Functions.checkM2SintentNum( main, 3 )
476 else:
477 main.log.error( "Bring up link failed!" )
478 main.cleanup()
479 main.exit()
480
481 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800482 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
483 main.FALSE,
484 kwargs={'isPENDING':False},
485 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700486 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800487 expect=main.TRUE,
488 actual=flowCheck,
489 onpass="Flow status is correct!",
490 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700491
492 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800493 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
494 peers=["peer64514", "peer64515", "peer64516"],
495 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700496 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800497 hosts=["host64514", "host64515", "host64516"],
498 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700499
500
501 def CASE7( self, main ):
502 '''
503 Shut down a edge switch, check P-2-P and M-2-S intents, ping test
504 '''
505 import time
506 main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
507 main.step( "Stop sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800508 result = main.Mininet.switch( SW="sw32", OPTION="stop" )
509 utilities.assertEquals( expect=main.TRUE, actual=result,
510 onpass="Stopping switch succeeded!",
511 onfail="Stopping switch failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700512
513 if result == main.TRUE:
514 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
515 main.Functions.checkRouteNum( main, 2 )
516 main.Functions.checkM2SintentNum( main, 2 )
517 main.Functions.checkP2PintentNum( main, 12 * 2 )
518 else:
519 main.log.error( "Stopping switch failed!" )
520 main.cleanup()
521 main.exit()
522
523 main.step( "Check ping between hosts behind BGP peers" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800524 result1 = main.Mininet.pingHost( src="host64514", target="host64515" )
525 result2 = main.Mininet.pingHost( src="host64515", target="host64516" )
526 result3 = main.Mininet.pingHost( src="host64514", target="host64516" )
pingping-linea32cf82015-10-08 22:37:37 -0700527
528 pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
529 and ( result3 == main.FALSE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800530 utilities.assert_equals( expect=True, actual=pingResult1,
531 onpass="Ping test result is correct",
532 onfail="Ping test result is wrong" )
pingping-linea32cf82015-10-08 22:37:37 -0700533
534 if pingResult1 == False:
535 main.cleanup()
536 main.exit()
537
538 main.step( "Check ping between BGP peers and speaker1" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800539 result4 = main.Mininet.pingHost( src="speaker1", target="peer64514" )
540 result5 = main.Mininet.pingHost( src="speaker1", target="peer64515" )
541 result6 = main.Mininet.pingHost( src="speaker1", target="peer64516" )
pingping-linea32cf82015-10-08 22:37:37 -0700542
543 pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
544 and ( result6 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800545 utilities.assert_equals( expect=True, actual=pingResult2,
546 onpass="Speaker1 ping peers successful",
547 onfail="Speaker1 ping peers NOT successful" )
pingping-linea32cf82015-10-08 22:37:37 -0700548
549 if pingResult2 == False:
550 main.cleanup()
551 main.exit()
552
553 main.step( "Check ping between BGP peers and speaker2" )
554 # TODO
Jon Hall6e9897d2016-02-29 14:41:32 -0800555 result7 = main.Mininet.pingHost( src="speaker2", target=peer64514 )
556 result8 = main.Mininet.pingHost( src="speaker2", target=peer64515 )
557 result9 = main.Mininet.pingHost( src="speaker2", target=peer64516 )
pingping-linea32cf82015-10-08 22:37:37 -0700558
559 pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
560 and ( result9 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800561 utilities.assert_equals( expect=True, actual=pingResult2,
562 onpass="Speaker2 ping peers successful",
563 onfail="Speaker2 ping peers NOT successful" )
pingping-linea32cf82015-10-08 22:37:37 -0700564
565 if pingResult3 == False:
566 main.cleanup()
567 main.exit()
568
569 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800570 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
571 main.FALSE,
572 kwargs={'isPENDING':False},
573 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700574 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800575 expect=main.TRUE,
576 actual=flowCheck,
577 onpass="Flow status is correct!",
578 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700579
580
581 def CASE8( self, main ):
582 '''
583 Bring up the edge switch (sw32) which was shut down in CASE7,
584 check P-2-P and M-2-S intents, ping test
585 '''
586 import time
587 main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
588 main.step( "Start sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800589 result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
pingping-linea32cf82015-10-08 22:37:37 -0700590 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800591 expect=main.TRUE,
592 actual=result1,
593 onpass="Starting switch succeeded!",
594 onfail="Starting switch failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700595
596 result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
597 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800598 expect=main.TRUE,
599 actual=result2,
600 onpass="Connect switch to ONOS succeeded!",
601 onfail="Connect switch to ONOS failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700602
603 if result1 and result2:
604 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
605 main.Functions.checkRouteNum( main, 3 )
606 main.Functions.checkM2SintentNum( main, 3 )
607 main.Functions.checkP2PintentNum( main, 18 * 2 )
608 else:
609 main.log.error( "Starting switch failed!" )
610 main.cleanup()
611 main.exit()
612
613 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800614 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
615 main.FALSE,
616 kwargs={'isPENDING':False},
617 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700618 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800619 expect=main.TRUE,
620 actual=flowCheck,
621 onpass="Flow status is correct!",
622 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700623
624 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800625 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
626 peers=["peer64514", "peer64515", "peer64516"],
627 expectAllSuccess=True )
628 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
629 peers=[peer64514, peer64515, peer64516],
630 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700631 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800632 hosts=["host64514", "host64515", "host64516"],
633 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700634
635
636 def CASE9( self, main ):
637 '''
638 Bring down a switch in best path, check:
639 route number, P2P intent number, M2S intent number, ping test
640 '''
641 main.case( "Stop sw11 located in best path, \
642 check route number, P2P intent number, M2S intent number, ping test" )
643
644 main.log.info( "Check the flow number correctness before stopping sw11" )
645 main.Functions.checkFlowNum( main, "sw11", 19 )
646 main.Functions.checkFlowNum( main, "sw1", 3 )
647 main.Functions.checkFlowNum( main, "sw7", 3 )
648 main.log.info( main.Mininet.checkFlows( "sw11" ) )
649 main.log.info( main.Mininet.checkFlows( "sw1" ) )
650 main.log.info( main.Mininet.checkFlows( "sw7" ) )
651
652 main.step( "Stop sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800653 result = main.Mininet.switch( SW="sw11", OPTION="stop" )
654 utilities.assertEquals( expect=main.TRUE, actual=result,
655 onpass="Stopping switch succeeded!",
656 onfail="Stopping switch failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700657 if result:
658 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
659 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
660 main.Functions.checkRouteNum( main, 3 )
661 main.Functions.checkM2SintentNum( main, 3 )
662 main.Functions.checkP2PintentNum( main, 18 * 2 )
663 else:
664 main.log.error( "Stopping switch failed!" )
665 main.cleanup()
666 main.exit()
667
668 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800669 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
670 main.FALSE,
671 kwargs={'isPENDING':False},
672 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700673 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800674 expect=main.TRUE,
675 actual=flowCheck,
676 onpass="Flow status is correct!",
677 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700678 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800679 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
680 peers=["peer64514", "peer64515", "peer64516"],
681 expectAllSuccess=True )
682 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
683 peers=[peer64514, peer64515, peer64516],
684 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700685 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800686 hosts=["host64514", "host64515", "host64516"],
687 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700688
689
690 def CASE10( self, main ):
691 '''
692 Bring up the switch which was stopped in CASE9, check:
693 route number, P2P intent number, M2S intent number, ping test
694 '''
695 main.case( "Start sw11 which was stopped in CASE9, \
696 check route number, P2P intent number, M2S intent number, ping test" )
697
698 main.log.info( "Check the flow status before starting sw11" )
699 main.Functions.checkFlowNum( main, "sw1", 17 )
700 main.Functions.checkFlowNum( main, "sw7", 5 )
701 main.log.info( main.Mininet.checkFlows( "sw1" ) )
702 main.log.info( main.Mininet.checkFlows( "sw7" ) )
703
704 main.step( "Start sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800705 result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
706 utilities.assertEquals( expect=main.TRUE, actual=result1,
707 onpass="Starting switch succeeded!",
708 onfail="Starting switch failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700709 result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
Jon Hall6e9897d2016-02-29 14:41:32 -0800710 utilities.assertEquals( expect=main.TRUE, actual=result2,
711 onpass="Connect switch to ONOS succeeded!",
712 onfail="Connect switch to ONOS failed!" )
pingping-linea32cf82015-10-08 22:37:37 -0700713 if result1 and result2:
714 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
715 main.Functions.checkRouteNum( main, 3 )
716 main.Functions.checkM2SintentNum( main, 3 )
717 main.Functions.checkP2PintentNum( main, 18 * 2 )
718
719 main.log.debug( main.Mininet.checkFlows( "sw11" ) )
720 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
721 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
722 else:
723 main.log.error( "Starting switch failed!" )
724 main.cleanup()
725 main.exit()
726
727 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800728 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
729 main.FALSE,
730 kwargs={'isPENDING':False},
731 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700732 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800733 expect=main.TRUE,
734 actual=flowCheck,
735 onpass="Flow status is correct!",
736 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700737 # Ping test
Jon Hall6e9897d2016-02-29 14:41:32 -0800738 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
739 peers=["peer64514", "peer64515", "peer64516"],
740 expectAllSuccess=True )
741 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
742 peers=[peer64514, peer64515, peer64516],
743 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700744 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800745 hosts=["host64514", "host64515", "host64516"],
746 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700747
748
749 def CASE11(self, main):
750 import time
751 main.case( "Kill speaker1, check:\
752 route number, P2P intent number, M2S intent number, ping test" )
pingping-lina14c7c82015-10-09 15:44:36 -0700753 main.log.info( "Check network status before killing speaker1" )
pingping-linea32cf82015-10-08 22:37:37 -0700754 main.Functions.checkRouteNum( main, 3 )
755 main.Functions.checkM2SintentNum( main, 3 )
756 main.Functions.checkP2PintentNum( main, 18 * 2 )
757 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800758 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
759 main.FALSE,
760 kwargs={'isPENDING':False},
761 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700762 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800763 expect=main.TRUE,
764 actual=flowCheck,
765 onpass="Flow status is correct!",
766 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700767
Jon Hall6e9897d2016-02-29 14:41:32 -0800768 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
769 peers=["peer64514", "peer64515", "peer64516"],
770 expectAllSuccess=True )
771 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
772 peers=[peer64514, peer64515, peer64516],
773 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700774 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800775 hosts=["host64514", "host64515", "host64516"],
776 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700777
778 main.step( "Kill speaker1" )
pingping-lin145cd0a2015-10-09 17:44:34 -0700779 command1 = "ps -e | grep bgp -c"
780 result1 = main.Mininet.node( "root", command1 )
781
782 # The total BGP daemon number in this test environment is 5.
783 if "5" in result1:
784 main.log.debug( "Before kill speaker1, 5 BGP daemons - correct" )
785 else:
786 main.log.warn( "Before kill speaker1, number of BGP daemons is wrong" )
787 main.log.info( result1 )
788
789 command2 = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`"
790 result2 = main.Mininet.node( "root", command2 )
791
792 result3 = main.Mininet.node( "root", command1 )
793
Jon Hall6e9897d2016-02-29 14:41:32 -0800794 utilities.assert_equals( expect=True,
795 actual=( "4" in result3 ),
796 onpass="Kill speaker1 succeeded",
797 onfail="Kill speaker1 failed" )
pingping-lin145cd0a2015-10-09 17:44:34 -0700798 if ( "4" not in result3 ) :
799 main.log.info( result3 )
pingping-linea32cf82015-10-08 22:37:37 -0700800 main.cleanup()
801 main.exit()
802
803 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
804 main.Functions.checkRouteNum( main, 3 )
805 main.Functions.checkM2SintentNum( main, 3 )
806 main.Functions.checkP2PintentNum( main, 18 * 2 )
807
808 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800809 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
810 main.FALSE,
811 kwargs={'isPENDING':False},
812 attempts=10 )
pingping-linea32cf82015-10-08 22:37:37 -0700813 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800814 expect=main.TRUE,
815 actual=flowCheck,
816 onpass="Flow status is correct!",
817 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700818
819 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800820 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
821 peers=["peer64514", "peer64515", "peer64516"],
822 expectAllSuccess=False )
pingping-linea32cf82015-10-08 22:37:37 -0700823 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800824 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
825 peers=[peer64514, peer64515, peer64516],
826 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700827 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800828 hosts=["host64514", "host64515", "host64516"],
829 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700830
831
832 def CASE12( self, main ):
833 import time
pingping-lina14c7c82015-10-09 15:44:36 -0700834 import json
pingping-linea32cf82015-10-08 22:37:37 -0700835 main.case( "Bring down leader ONOS node, check: \
836 route number, P2P intent number, M2S intent number, ping test" )
837 main.step( "Find out ONOS leader node" )
pingping-lina14c7c82015-10-09 15:44:36 -0700838 result = main.ONOScli1.leaders()
pingping-lin3f932a72015-10-09 16:44:50 -0700839 jsonResult = json.loads( result )
pingping-lina14c7c82015-10-09 15:44:36 -0700840 leaderIP = ""
841 for entry in jsonResult:
842 if entry["topic"] == "org.onosproject.sdnip":
843 leaderIP = entry["leader"]
844 main.log.info( "leaderIP is: " )
845 main.log.info( leaderIP )
846
847 main.step( "Uninstall ONOS/SDN-IP leader node" )
848 if leaderIP == ONOS1Ip:
849 uninstallResult = main.ONOSbench.onosStop( ONOS1Ip )
850 elif leaderIP == ONOS2Ip:
851 uninstallResult = main.ONOSbench.onosStop( ONOS2Ip )
852 else:
853 uninstallResult = main.ONOSbench.onosStop( ONOS3Ip )
854
Jon Hall6e9897d2016-02-29 14:41:32 -0800855 utilities.assert_equals( expect=main.TRUE,
856 actual=uninstallResult,
857 onpass="Uninstall ONOS leader succeeded",
858 onfail="Uninstall ONOS leader failed" )
pingping-linea32cf82015-10-08 22:37:37 -0700859 if uninstallResult != main.TRUE:
860 main.cleanup()
861 main.exit()
862 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
pingping-linea32cf82015-10-08 22:37:37 -0700863
pingping-lina14c7c82015-10-09 15:44:36 -0700864 if leaderIP == ONOS1Ip:
Jon Hall6e9897d2016-02-29 14:41:32 -0800865 main.Functions.checkRouteNum( main, 3, ONOScli="ONOScli2" )
866 main.Functions.checkM2SintentNum( main, 3, ONOScli="ONOScli2" )
867 main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli="ONOScli2" )
pingping-lina14c7c82015-10-09 15:44:36 -0700868
869 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800870 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
871 main.FALSE,
872 kwargs={'isPENDING':False},
873 attempts=10 )
pingping-lina14c7c82015-10-09 15:44:36 -0700874 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800875 expect=main.TRUE,
876 actual=flowCheck,
877 onpass="Flow status is correct!",
878 onfail="Flow status is wrong!" )
pingping-lina14c7c82015-10-09 15:44:36 -0700879 else:
880 main.Functions.checkRouteNum( main, 3 )
881 main.Functions.checkM2SintentNum( main, 3 )
882 main.Functions.checkP2PintentNum( main, 18 * 2 )
883
884 main.step( "Check whether all flow status are ADDED" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800885 flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
886 main.FALSE,
887 kwargs={'isPENDING':False},
888 attempts=10 )
pingping-lina14c7c82015-10-09 15:44:36 -0700889 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800890 expect=main.TRUE,
891 actual=flowCheck,
892 onpass="Flow status is correct!",
893 onfail="Flow status is wrong!" )
pingping-linea32cf82015-10-08 22:37:37 -0700894
Jon Hall6e9897d2016-02-29 14:41:32 -0800895 main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
896 peers=["peer64514", "peer64515", "peer64516"],
897 expectAllSuccess=True )
898 main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
899 peers=[peer64514, peer64515, peer64516],
900 expectAllSuccess=True )
pingping-linea32cf82015-10-08 22:37:37 -0700901 main.Functions.pingHostToHost( main,
Jon Hall6e9897d2016-02-29 14:41:32 -0800902 hosts=["host64514", "host64515", "host64516"],
903 expectAllSuccess=True )