blob: 4ca92c78307bf59c241c71c2d8df97cd959b1502 [file] [log] [blame]
pingping-lin28e7b212015-09-10 10:14:58 -07001# Testing the functionality of SDN-IP with single ONOS instance
pingping-lin5bb663b2015-09-24 11:47:50 -07002class USECASE_SdnipFunction:
pingping-lin28e7b212015-09-10 10:14:58 -07003
4 def __init__( self ):
5 self.default = ''
6 global branchName
7
pingping-linb702c602015-09-10 17:00:29 -07008 def CASE100( self, main ):
9 """
10 Start mininet
11 """
12 import os
Jon Hall70b768c2016-04-19 08:38:29 -070013 main.case( "Setup the Mininet testbed" )
pingping-linb702c602015-09-10 17:00:29 -070014 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-linb702c602015-09-10 17:00:29 -070025 # Exit if topology did not load properly
26 if not topoResult:
27 main.cleanup()
28 main.exit()
pingping-lin5bb663b2015-09-24 11:47:50 -070029 main.step( "Connect switches to controller" )
30
31 global ONOS1Ip
32 ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
33 # connect all switches to controller
34 swResult = main.TRUE
35 for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
36 sw = "sw%s" % ( i )
37 swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip )
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-lin5bb663b2015-09-24 11:47:50 -070042 if not swResult:
43 main.cleanup()
44 main.exit()
45
46 main.step( "Set up tunnel from Mininet node to onos node" )
47 forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', ONOS1Ip )
48 command = 'ssh -nNT -o "PasswordAuthentication no" \
49 -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, ONOS1Ip )
50
51 tunnelResult = main.TRUE
52 tunnelResult = main.Mininet.node( "root", command )
Jon Hall6e9897d2016-02-29 14:41:32 -080053 utilities.assert_equals( expect=True,
54 actual=( "PasswordAuthentication" in tunnelResult ),
55 onpass="Created tunnel succeeded",
56 onfail="Create tunnel failed" )
pingping-linb3ebd3f2015-09-28 22:17:05 -070057 if ("PasswordAuthentication" not in tunnelResult) :
pingping-lin5bb663b2015-09-24 11:47:50 -070058 main.cleanup()
59 main.exit()
pingping-lin5bb663b2015-09-24 11:47:50 -070060
pingping-linb702c602015-09-10 17:00:29 -070061 def CASE101( self, main ):
pingping-lin28e7b212015-09-10 10:14:58 -070062 """
pingping-linea32cf82015-10-08 22:37:37 -070063 Package ONOS and install it
pingping-lin28e7b212015-09-10 10:14:58 -070064 Startup sequence:
65 cell <name>
66 onos-verify-cell
pingping-lin28e7b212015-09-10 10:14:58 -070067 onos-package
68 onos-install -f
69 onos-wait-for-start
70 """
pingping-lin28e7b212015-09-10 10:14:58 -070071 import time
Jon Hall6e9897d2016-02-29 14:41:32 -080072 import os
pingping-lin28e7b212015-09-10 10:14:58 -070073
Jon Hall6e9897d2016-02-29 14:41:32 -080074 main.case( "Setting up ONOS environment" )
pingping-lin28e7b212015-09-10 10:14:58 -070075
76 cellName = main.params[ 'ENV' ][ 'cellName' ]
Jon Hall6e9897d2016-02-29 14:41:32 -080077 global ONOS1Ip
78 ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
79 ipList = [ ONOS1Ip ]
80
Jon Hall70b768c2016-04-19 08:38:29 -070081 main.step( "Copying config files" )
82 src = os.path.dirname( main.testFile ) + "/network-cfg.json"
83 dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
84 status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
85 utilities.assert_equals( expect=main.TRUE,
86 actual=status,
87 onpass="Copy config file succeeded",
88 onfail="Copy config file failed" )
89
Jon Hall6e9897d2016-02-29 14:41:32 -080090 main.step( "Create cell file" )
91 cellAppString = main.params[ 'ENV' ][ 'appString' ]
92 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
93 main.Mininet.ip_address,
94 cellAppString, ipList )
pingping-lin28e7b212015-09-10 10:14:58 -070095
96 main.step( "Applying cell variable to environment" )
97 cellResult = main.ONOSbench.setCell( cellName )
Jon Hall6e9897d2016-02-29 14:41:32 -080098 utilities.assert_equals( expect=main.TRUE,
99 actual=cellResult,
100 onpass="Set cell succeeded",
101 onfail="Set cell failed" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700102
Jon Hall70b768c2016-04-19 08:38:29 -0700103 main.step( "Verify cell connectivity" )
pingping-lin28e7b212015-09-10 10:14:58 -0700104 verifyResult = main.ONOSbench.verifyCell()
Jon Hall6e9897d2016-02-29 14:41:32 -0800105 utilities.assert_equals( expect=main.TRUE,
106 actual=verifyResult,
107 onpass="Verify cell succeeded",
108 onfail="Verify cell failed" )
pingping-lin28e7b212015-09-10 10:14:58 -0700109
110 branchName = main.ONOSbench.getBranchName()
pingping-linb3ebd3f2015-09-28 22:17:05 -0700111 main.log.report( "ONOS is on branch: " + branchName )
pingping-lin28e7b212015-09-10 10:14:58 -0700112
Jon Hall6509dbf2016-06-21 17:01:17 -0700113 main.step( "Uninstalling ONOS" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700114 uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
Jon Hall6e9897d2016-02-29 14:41:32 -0800115 utilities.assert_equals( expect=main.TRUE,
116 actual=uninstallResult,
117 onpass="Uninstall ONOS succeeded",
118 onfail="Uninstall ONOS failed" )
pingping-linaede0312015-09-30 17:53:19 -0700119 '''
pingping-lin28e7b212015-09-10 10:14:58 -0700120 main.step( "Git pull" )
121 gitPullResult = main.ONOSbench.gitPull()
pingping-linb3ebd3f2015-09-28 22:17:05 -0700122 main.log.info( "gitPullResult" )
123 main.log.info( gitPullResult )
124 gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 )
Jon Hall6e9897d2016-02-29 14:41:32 -0800125 utilities.assert_equals( expect=True,
126 actual=gitPullResult2,
127 onpass="Git pull ONOS succeeded",
128 onfail="Git pull ONOS failed" )
pingping-lin28e7b212015-09-10 10:14:58 -0700129
130 main.step( "Using mvn clean install" )
131 if gitPullResult == main.TRUE:
Jon Hall6e9897d2016-02-29 14:41:32 -0800132 mciResult = main.ONOSbench.cleanInstall( mciTimeout=1000 )
133 utilities.assert_equals( expect=main.TRUE,
134 actual=mciResult,
135 onpass="Maven clean install ONOS succeeded",
136 onfail="Maven clean install ONOS failed" )
pingping-lin28e7b212015-09-10 10:14:58 -0700137 else:
138 main.log.warn( "Did not pull new code so skipping mvn " +
139 "clean install" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700140 mciResult = main.TRUE
pingping-linaede0312015-09-30 17:53:19 -0700141 '''
pingping-lin28e7b212015-09-10 10:14:58 -0700142
Jon Hall6e9897d2016-02-29 14:41:32 -0800143 main.ONOSbench.getVersion( report=True )
pingping-lin28e7b212015-09-10 10:14:58 -0700144
145 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700146 packageResult = main.ONOSbench.buckBuild()
Jon Hall6e9897d2016-02-29 14:41:32 -0800147 utilities.assert_equals( expect=main.TRUE,
148 actual=packageResult,
149 onpass="Package ONOS succeeded",
150 onfail="Package ONOS failed" )
pingping-lin28e7b212015-09-10 10:14:58 -0700151
152 main.step( "Installing ONOS package" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800153 onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
154 node=ONOS1Ip )
155 utilities.assert_equals( expect=main.TRUE,
156 actual=onos1InstallResult,
157 onpass="Install ONOS succeeded",
158 onfail="Install ONOS failed" )
pingping-lin28e7b212015-09-10 10:14:58 -0700159
Chiyu Chengef109502016-11-21 15:51:38 -0800160 main.step( "Set up ONOS secure SSH" )
161 secureSshResult = main.ONOSbench.onosSecureSSH( node=ONOS1Ip )
162 utilities.assert_equals( expect=main.TRUE,
163 actual=secureSshResult,
164 onpass="Set up ONOS secure SSH succeeded",
165 onfail="Set up ONOS secure SSH failed " )
166
You Wangf5de25b2017-01-06 15:13:01 -0800167 main.step( "Checking if ONOS is up yet" )
168 onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
169 utilities.assert_equals( expect=main.TRUE,
170 actual=onos1UpResult,
171 onpass="ONOS is up",
172 onfail="ONOS is NOT up" )
173
pingping-linb3ebd3f2015-09-28 22:17:05 -0700174 main.step( "Checking if ONOS CLI is ready" )
pingping-lin28e7b212015-09-10 10:14:58 -0700175 cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
Jon Hall6e9897d2016-02-29 14:41:32 -0800176 commandlineTimeout=100, onosStartTimeout=600 )
177 utilities.assert_equals( expect=main.TRUE,
178 actual=cliResult,
179 onpass="ONOS CLI is ready",
180 onfail="ONOS CLI is not ready" )
pingping-lin28e7b212015-09-10 10:14:58 -0700181
Jon Hall6e9897d2016-02-29 14:41:32 -0800182 for i in range( 10 ):
183 ready = True
184 output = main.ONOScli.summary()
185 if not output:
186 ready = False
187 if ready:
188 break
189 time.sleep( 30 )
190 utilities.assert_equals( expect=True, actual=ready,
191 onpass="ONOS summary command succeded",
192 onfail="ONOS summary command failed" )
pingping-lin28e7b212015-09-10 10:14:58 -0700193
Jon Hall6e9897d2016-02-29 14:41:32 -0800194 if not ready:
195 main.log.error( "ONOS startup failed!" )
pingping-lin28e7b212015-09-10 10:14:58 -0700196 main.cleanup()
197 main.exit()
198
Jon Hall6e9897d2016-02-29 14:41:32 -0800199 def CASE200( self, main ):
alisone4121a92016-11-22 16:31:36 -0800200 import json
201 import time
202
Jon Hall6e9897d2016-02-29 14:41:32 -0800203 main.case( "Activate sdn-ip application" )
204 main.log.info( "waiting link discovery......" )
205 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
206
pingping-linb3ebd3f2015-09-28 22:17:05 -0700207 main.log.info( "Get links in the network" )
pingping-lin3f091d62015-09-29 12:00:05 -0700208 summaryResult = main.ONOScli.summary()
209 linkNum = json.loads( summaryResult )[ "links" ]
Jon Hall6e9897d2016-02-29 14:41:32 -0800210 listResult = main.ONOScli.links( jsonFormat=False )
211 main.log.info( listResult )
pingping-lin3f091d62015-09-29 12:00:05 -0700212 if linkNum < 100:
Jon Hall6e9897d2016-02-29 14:41:32 -0800213 main.log.error( "Link number is wrong!" )
214 time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
215 listResult = main.ONOScli.links( jsonFormat=False )
pingping-lin3f091d62015-09-29 12:00:05 -0700216 main.log.info( listResult )
217 main.cleanup()
218 main.exit()
219
pingping-linb3ebd3f2015-09-28 22:17:05 -0700220 main.step( "Activate sdn-ip application" )
221 activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800222 utilities.assert_equals( expect=main.TRUE,
223 actual=activeSDNIPresult,
224 onpass="Activate SDN-IP succeeded",
225 onfail="Activate SDN-IP failed" )
pingping-lin3f091d62015-09-29 12:00:05 -0700226 if not activeSDNIPresult:
227 main.log.info( "Activate SDN-IP failed!" )
228 main.cleanup()
229 main.exit()
230
pingping-linb3ebd3f2015-09-28 22:17:05 -0700231
232 main.log.info( "Wait SDN-IP to finish installing connectivity intents \
pingping-linb702c602015-09-10 17:00:29 -0700233 and the BGP paths in data plane are ready..." )
pingping-lin28e7b212015-09-10 10:14:58 -0700234 time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
pingping-linb702c602015-09-10 17:00:29 -0700235 main.log.info( "Wait Quagga to finish delivery all routes to each \
236 other and to sdn-ip, plus finish installing all intents..." )
pingping-lin28e7b212015-09-10 10:14:58 -0700237 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
238 time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
239
240
pingping-lin4f80c492015-09-15 14:34:42 -0700241 def CASE102( self, main ):
242 '''
243 This test case is to load the methods from other Python files.
244 '''
alisone4121a92016-11-22 16:31:36 -0800245 import imp
246
pingping-linb3ebd3f2015-09-28 22:17:05 -0700247 main.case( "Loading methods from other Python file" )
pingping-lin4f80c492015-09-15 14:34:42 -0700248 # load the methods from other file
249 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
250 main.Functions = imp.load_source( wrapperFile,
251 main.dependencyPath +
252 wrapperFile +
253 ".py" )
254
255
pingping-lin0ce60622015-09-10 14:37:33 -0700256 def CASE1( self, main ):
257 '''
alisone4121a92016-11-22 16:31:36 -0800258 ping test from 7 bgp peers to BGP speaker
pingping-lin0ce60622015-09-10 14:37:33 -0700259 '''
pingping-lin950b50d2015-09-14 12:00:08 -0700260
pingping-linb3ebd3f2015-09-28 22:17:05 -0700261 main.case( "Ping tests between BGP peers and speakers" )
alisone4121a92016-11-22 16:31:36 -0800262 main.Functions.pingSpeakerToPeer( main, speakers=[ "spk1" ],
263 peers=[ "p64514", "p64515", "p64516" ],
264 expectAllSuccess=True )
pingping-lin0ce60622015-09-10 14:37:33 -0700265
alisone4121a92016-11-22 16:31:36 -0800266 main.Functions.pingSpeakerToPeer( main, speakers=[ "spk2" ],
267 peers=[ "p64517", "p64518" ],
268 expectAllSuccess=True )
269
270 main.Functions.pingSpeakerToPeer( main, speakers=[ "spk3" ],
271 peers=[ "p64519", "p64520" ],
272 expectAllSuccess=True )
pingping-lin950b50d2015-09-14 12:00:08 -0700273
pingping-lin0ce60622015-09-10 14:37:33 -0700274 def CASE2( self, main ):
275 '''
276 point-to-point intents test for each BGP peer and BGP speaker pair
277 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800278 import time
alisone4121a92016-11-22 16:31:36 -0800279 from operator import eq
280
pingping-linb3ebd3f2015-09-28 22:17:05 -0700281 main.case( "Check point-to-point intents" )
pingping-lin0ce60622015-09-10 14:37:33 -0700282 main.log.info( "There are %s BGP peers in total "
283 % main.params[ 'config' ][ 'peerNum' ] )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700284 main.step( "Check P2P intents number from ONOS CLI" )
pingping-lin0ce60622015-09-10 14:37:33 -0700285
Jon Hall6e9897d2016-02-29 14:41:32 -0800286 getIntentsResult = main.ONOScli.intents( jsonFormat=True )
pingping-lin0ce60622015-09-10 14:37:33 -0700287 bgpIntentsActualNum = \
288 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
289 bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
Jon Hall6e9897d2016-02-29 14:41:32 -0800290 if bgpIntentsActualNum != bgpIntentsExpectedNum:
291 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
Jon Hallfabd7e52016-04-19 19:20:59 -0700292 getIntentsResult = main.ONOScli.intents( jsonFormat=True )
Jon Hall6e9897d2016-02-29 14:41:32 -0800293 bgpIntentsActualNum = \
294 main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
pingping-lin0ce60622015-09-10 14:37:33 -0700295 main.log.info( "bgpIntentsExpected num is:" )
296 main.log.info( bgpIntentsExpectedNum )
297 main.log.info( "bgpIntentsActual num is:" )
298 main.log.info( bgpIntentsActualNum )
299 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800300 expect=True,
301 actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
302 onpass="PointToPointIntent Intent Num is correct!",
303 onfail="PointToPointIntent Intent Num is wrong!" )
pingping-lin0ce60622015-09-10 14:37:33 -0700304
305
306 def CASE3( self, main ):
307 '''
308 routes and intents check to all BGP peers
309 '''
Jon Hall6e9897d2016-02-29 14:41:32 -0800310 import time
pingping-linb3ebd3f2015-09-28 22:17:05 -0700311 main.case( "Check routes and M2S intents to all BGP peers" )
pingping-lin0ce60622015-09-10 14:37:33 -0700312
pingping-lin28e7b212015-09-10 10:14:58 -0700313 allRoutesExpected = []
314 allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" )
315 allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
316 allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
317
alisone4121a92016-11-22 16:31:36 -0800318 allRoutesExpected.append( "7.0.0.0/24" + "/" + "10.0.7.1" )
319 allRoutesExpected.append( "8.0.0.0/24" + "/" + "10.0.8.1" )
320 allRoutesExpected.append( "9.0.0.0/24" + "/" + "10.0.9.1" )
321 allRoutesExpected.append( "20.0.0.0/24" + "/" + "10.0.20.1" )
322
Jon Hall6e9897d2016-02-29 14:41:32 -0800323 getRoutesResult = main.ONOScli.routes( jsonFormat=True )
pingping-lin28e7b212015-09-10 10:14:58 -0700324 allRoutesActual = \
325 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
326 allRoutesStrExpected = str( sorted( allRoutesExpected ) )
327 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800328 if allRoutesStrActual != allRoutesStrExpected:
329 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
Jon Hallfabd7e52016-04-19 19:20:59 -0700330 getRoutesResult = main.ONOScli.routes( jsonFormat=True )
Jon Hall6e9897d2016-02-29 14:41:32 -0800331 allRoutesActual = \
332 main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
333 allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
pingping-lin28e7b212015-09-10 10:14:58 -0700334
335 main.step( "Check routes installed" )
336 main.log.info( "Routes expected:" )
337 main.log.info( allRoutesStrExpected )
338 main.log.info( "Routes get from ONOS CLI:" )
339 main.log.info( allRoutesStrActual )
340 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800341 expect=allRoutesStrExpected, actual=allRoutesStrActual,
342 onpass="Routes are correct!",
343 onfail="Routes are wrong!" )
pingping-lin28e7b212015-09-10 10:14:58 -0700344
pingping-linb3ebd3f2015-09-28 22:17:05 -0700345 main.step( "Check M2S intents installed" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800346 getIntentsResult = main.ONOScli.intents( jsonFormat=True )
pingping-lin28e7b212015-09-10 10:14:58 -0700347 routeIntentsActualNum = \
348 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
alisone4121a92016-11-22 16:31:36 -0800349 routeIntentsExpectedNum = 7
Jon Hall6e9897d2016-02-29 14:41:32 -0800350 if routeIntentsActualNum != routeIntentsExpectedNum:
351 time.sleep( int( main.params['timers']['RouteDelivery'] ) )
Jon Hallfabd7e52016-04-19 19:20:59 -0700352 getIntentsResult = main.ONOScli.intents( jsonFormat=True )
Jon Hall6e9897d2016-02-29 14:41:32 -0800353 routeIntentsActualNum = \
354 main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
pingping-lin28e7b212015-09-10 10:14:58 -0700355
356 main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
357 main.log.info( routeIntentsExpectedNum )
358 main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
359 main.log.info( routeIntentsActualNum )
360 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800361 expect=routeIntentsExpectedNum,
362 actual=routeIntentsActualNum,
363 onpass="MultiPointToSinglePoint Intent Num is correct!",
364 onfail="MultiPointToSinglePoint Intent Num is wrong!" )
pingping-lin28e7b212015-09-10 10:14:58 -0700365
pingping-linbab7f8a2015-09-21 17:33:36 -0700366 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700367 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800368 main.FALSE,
369 kwargs={'isPENDING':False},
370 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700371 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800372 expect=main.TRUE,
373 actual=flowCheck,
374 onpass="Flow status is correct!",
375 onfail="Flow status is wrong!" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700376
pingping-lin950b50d2015-09-14 12:00:08 -0700377
378 def CASE4( self, main ):
379 '''
380 Ping test in data plane for each route
381 '''
pingping-linb3ebd3f2015-09-28 22:17:05 -0700382 main.case( "Ping test for each route, all hosts behind BGP peers" )
alisone4121a92016-11-22 16:31:36 -0800383 #No vlan
pingping-lin829428d2015-09-22 20:50:00 -0700384 main.Functions.pingHostToHost( main,
alisone4121a92016-11-22 16:31:36 -0800385 hosts=[ "h64514", "h64515", "h64516" ],
386 expectAllSuccess=True )
387 #vlan 10
388 main.Functions.pingHostToHost( main,
389 hosts=[ "h64519", "h64520" ],
390 expectAllSuccess=True )
pingping-lin4f80c492015-09-15 14:34:42 -0700391
alisone4121a92016-11-22 16:31:36 -0800392 # vlan 20
393 main.Functions.pingHostToHost( main,
394 hosts=[ "h64517", "h64518" ],
395 expectAllSuccess=True )
pingping-lin4f80c492015-09-15 14:34:42 -0700396
397 def CASE5( self, main ):
398 '''
399 Cut links to peers one by one, check routes/intents
400 '''
401 import time
pingping-linb3ebd3f2015-09-28 22:17:05 -0700402 main.case( "Bring down links and check routes/intents" )
alisone4121a92016-11-22 16:31:36 -0800403 main.step( "Bring down the link between sw32 and p64514" )
404 linkResult1 = main.Mininet.link( END1="sw32", END2="p64514",
Jon Hall6e9897d2016-02-29 14:41:32 -0800405 OPTION="down" )
406 utilities.assertEquals( expect=main.TRUE,
407 actual=linkResult1,
408 onpass="Bring down link succeeded!",
409 onfail="Bring down link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700410
411 if linkResult1 == main.TRUE:
pingping-lin4f80c492015-09-15 14:34:42 -0700412 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800413 main.Functions.checkRouteNum( main, 6 ) #We have 7 links between peers and sw. After one link down, 7-1=6.
414 main.Functions.checkM2SintentNum( main, 6 )
pingping-lin4f80c492015-09-15 14:34:42 -0700415 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800416 main.log.error( "Bring down link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700417 main.cleanup()
418 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700419
alisone4121a92016-11-22 16:31:36 -0800420 main.step( "Bring down the link between sw8 and p64515" )
421 linkResult2 = main.Mininet.link( END1="sw8", END2="p64515",
Jon Hall6e9897d2016-02-29 14:41:32 -0800422 OPTION="down" )
423 utilities.assertEquals( expect=main.TRUE,
424 actual=linkResult2,
425 onpass="Bring down link succeeded!",
426 onfail="Bring down link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700427 if linkResult2 == main.TRUE:
pingping-lin4f80c492015-09-15 14:34:42 -0700428 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800429 main.Functions.checkRouteNum( main, 5 ) #2 links down, 7-2=5.
430 main.Functions.checkM2SintentNum( main, 5 )
pingping-lin4f80c492015-09-15 14:34:42 -0700431 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800432 main.log.error( "Bring down link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700433 main.cleanup()
434 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700435
alisone4121a92016-11-22 16:31:36 -0800436 main.step( "Bring down the link between sw28 and p64516" )
437 linkResult3 = main.Mininet.link( END1="sw28", END2="p64516",
Jon Hall6e9897d2016-02-29 14:41:32 -0800438 OPTION="down" )
439 utilities.assertEquals( expect=main.TRUE,
440 actual=linkResult3,
441 onpass="Bring down link succeeded!",
442 onfail="Bring down link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700443 if linkResult3 == main.TRUE:
pingping-lin4f80c492015-09-15 14:34:42 -0700444 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800445 main.Functions.checkRouteNum( main, 4 ) #3 links downs 7-3=4
446 main.Functions.checkM2SintentNum( main, 4 )
pingping-lin4f80c492015-09-15 14:34:42 -0700447 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800448 main.log.error( "Bring down link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700449 main.cleanup()
450 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700451
pingping-linbab7f8a2015-09-21 17:33:36 -0700452 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700453 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800454 main.FALSE,
455 kwargs={'isPENDING':False},
456 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700457 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800458 expect=main.TRUE,
459 actual=flowCheck,
460 onpass="Flow status is correct!",
461 onfail="Flow status is wrong!" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700462
pingping-lin829428d2015-09-22 20:50:00 -0700463 # Ping test
alisone4121a92016-11-22 16:31:36 -0800464 main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
465 peers=["p64514", "p64515", "p64516"],
466 expectAllSuccess=False )
467
pingping-lin829428d2015-09-22 20:50:00 -0700468 main.Functions.pingHostToHost( main,
alisone4121a92016-11-22 16:31:36 -0800469 hosts=["h64514", "h64515", "h64516"],
470 expectAllSuccess=False )
pingping-lin4f80c492015-09-15 14:34:42 -0700471
pingping-lin829428d2015-09-22 20:50:00 -0700472
473 def CASE6( self, main ):
pingping-lin4f80c492015-09-15 14:34:42 -0700474 '''
475 Recover links to peers one by one, check routes/intents
476 '''
477 import time
pingping-linb3ebd3f2015-09-28 22:17:05 -0700478 main.case( "Bring up links and check routes/intents" )
alisone4121a92016-11-22 16:31:36 -0800479 main.step( "Bring up the link between sw32 and p64514" )
480 linkResult1 = main.Mininet.link( END1="sw32", END2="p64514",
Jon Hall6e9897d2016-02-29 14:41:32 -0800481 OPTION="up" )
482 utilities.assertEquals( expect=main.TRUE,
483 actual=linkResult1,
484 onpass="Bring up link succeeded!",
485 onfail="Bring up link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700486 if linkResult1 == main.TRUE:
pingping-lin4f80c492015-09-15 14:34:42 -0700487 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800488 main.Functions.checkRouteNum( main, 5 ) #one links up, 4+1=5
489 main.Functions.checkM2SintentNum( main, 5 )
pingping-lin4f80c492015-09-15 14:34:42 -0700490 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800491 main.log.error( "Bring up link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700492 main.cleanup()
493 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700494
alisone4121a92016-11-22 16:31:36 -0800495 main.step( "Bring up the link between sw8 and p64515" )
496 linkResult2 = main.Mininet.link( END1="sw8", END2="p64515",
Jon Hall6e9897d2016-02-29 14:41:32 -0800497 OPTION="up" )
498 utilities.assertEquals( expect=main.TRUE,
499 actual=linkResult2,
500 onpass="Bring up link succeeded!",
501 onfail="Bring up link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700502 if linkResult2 == main.TRUE:
pingping-lin4f80c492015-09-15 14:34:42 -0700503 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800504 main.Functions.checkRouteNum( main, 6 )
505 main.Functions.checkM2SintentNum( main, 6 )
pingping-lin4f80c492015-09-15 14:34:42 -0700506 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800507 main.log.error( "Bring up link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700508 main.cleanup()
509 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700510
alisone4121a92016-11-22 16:31:36 -0800511 main.step( "Bring up the link between sw28 and p64516" )
512 linkResult3 = main.Mininet.link( END1="sw28", END2="p64516",
Jon Hall6e9897d2016-02-29 14:41:32 -0800513 OPTION="up" )
514 utilities.assertEquals( expect=main.TRUE,
515 actual=linkResult3,
516 onpass="Bring up link succeeded!",
517 onfail="Bring up link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700518 if linkResult3 == main.TRUE:
pingping-lin4f80c492015-09-15 14:34:42 -0700519 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800520 main.Functions.checkRouteNum( main, 7 )
521 main.Functions.checkM2SintentNum( main, 7 )
pingping-lin4f80c492015-09-15 14:34:42 -0700522 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800523 main.log.error( "Bring up link failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700524 main.cleanup()
525 main.exit()
pingping-linbab7f8a2015-09-21 17:33:36 -0700526
527 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700528 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800529 main.FALSE,
530 kwargs={'isPENDING':False},
531 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700532 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800533 expect=main.TRUE,
534 actual=flowCheck,
535 onpass="Flow status is correct!",
536 onfail="Flow status is wrong!" )
pingping-lin829428d2015-09-22 20:50:00 -0700537
538 # Ping test
alisone4121a92016-11-22 16:31:36 -0800539 main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
540 peers=["p64514", "p64515", "p64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800541 expectAllSuccess=True )
pingping-lin829428d2015-09-22 20:50:00 -0700542 main.Functions.pingHostToHost( main,
alisone4121a92016-11-22 16:31:36 -0800543 hosts=["h64514", "h64515", "h64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800544 expectAllSuccess=True )
pingping-lin8244a3b2015-09-16 13:36:56 -0700545
546
pingping-lin829428d2015-09-22 20:50:00 -0700547 def CASE7( self, main ):
pingping-lin8244a3b2015-09-16 13:36:56 -0700548 '''
pingping-lin829428d2015-09-22 20:50:00 -0700549 Shut down a edge switch, check P-2-P and M-2-S intents, ping test
pingping-lin8244a3b2015-09-16 13:36:56 -0700550 '''
551 import time
pingping-linb3ebd3f2015-09-28 22:17:05 -0700552 main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
pingping-lin8244a3b2015-09-16 13:36:56 -0700553 main.step( "Stop sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800554 result = main.Mininet.switch( SW="sw32", OPTION="stop" )
555 utilities.assertEquals( expect=main.TRUE, actual=result,
556 onpass="Stopping switch succeeded!",
557 onfail="Stopping switch failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700558
pingping-lin8244a3b2015-09-16 13:36:56 -0700559 if result == main.TRUE:
560 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800561 main.Functions.checkRouteNum( main, 6 ) #stop one sw, which bring one link between peer and sw down.
562 main.Functions.checkM2SintentNum( main, 6 )
563 main.Functions.checkP2PintentNum( main, 36 ) #6 intents from sw to speakers x 6 intents to sw x 2 intents between them
pingping-lin8244a3b2015-09-16 13:36:56 -0700564 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800565 main.log.error( "Stopping switch failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700566 main.cleanup()
567 main.exit()
pingping-lin8244a3b2015-09-16 13:36:56 -0700568
pingping-lin829428d2015-09-22 20:50:00 -0700569 main.step( "Check ping between hosts behind BGP peers" )
alisone4121a92016-11-22 16:31:36 -0800570 result1 = main.Mininet.pingHost( src="h64514", target="h64515" )
571 result2 = main.Mininet.pingHost( src="h64515", target="h64516" )
572 result3 = main.Mininet.pingHost( src="h64514", target="h64516" )
pingping-lin829428d2015-09-22 20:50:00 -0700573
574 pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
575 and ( result3 == main.FALSE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800576 utilities.assert_equals( expect=True, actual=pingResult1,
577 onpass="Ping test result is correct",
578 onfail="Ping test result is wrong" )
pingping-lin829428d2015-09-22 20:50:00 -0700579
580 if pingResult1 == False:
581 main.cleanup()
582 main.exit()
583
584 main.step( "Check ping between BGP peers and speakers" )
alisone4121a92016-11-22 16:31:36 -0800585 result4 = main.Mininet.pingHost( src="spk1", target="p64514" )
586 result5 = main.Mininet.pingHost( src="spk1", target="p64515" )
587 result6 = main.Mininet.pingHost( src="spk1", target="p64516" )
pingping-lin829428d2015-09-22 20:50:00 -0700588
589 pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
590 and ( result6 == main.TRUE )
Jon Hall6e9897d2016-02-29 14:41:32 -0800591 utilities.assert_equals( expect=True, actual=pingResult2,
592 onpass="Speaker1 ping peers successful",
593 onfail="Speaker1 ping peers NOT successful" )
pingping-lin829428d2015-09-22 20:50:00 -0700594
595 if pingResult2 == False:
596 main.cleanup()
597 main.exit()
598
pingping-linbab7f8a2015-09-21 17:33:36 -0700599 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700600 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800601 main.FALSE,
602 kwargs={'isPENDING':False},
603 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700604 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800605 expect=main.TRUE,
606 actual=flowCheck,
607 onpass="Flow status is correct!",
608 onfail="Flow status is wrong!" )
pingping-lin8244a3b2015-09-16 13:36:56 -0700609
pingping-lind791d342015-09-17 18:34:31 -0700610
pingping-lin8244a3b2015-09-16 13:36:56 -0700611 def CASE8( self, main ):
pingping-lind791d342015-09-17 18:34:31 -0700612 '''
pingping-linb3ebd3f2015-09-28 22:17:05 -0700613 Bring up the edge switch (sw32) which was shut down in CASE7,
pingping-lind791d342015-09-17 18:34:31 -0700614 check P-2-P and M-2-S intents, ping test
615 '''
616 import time
pingping-linb3ebd3f2015-09-28 22:17:05 -0700617 main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
pingping-lind791d342015-09-17 18:34:31 -0700618 main.step( "Start sw32" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800619 result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700620 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800621 expect=main.TRUE,
622 actual=result1,
623 onpass="Starting switch succeeded!",
624 onfail="Starting switch failed!" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700625
pingping-lind791d342015-09-17 18:34:31 -0700626 result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700627 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800628 expect=main.TRUE,
629 actual=result2,
630 onpass="Connect switch to ONOS succeeded!",
631 onfail="Connect switch to ONOS failed!" )
pingping-lind791d342015-09-17 18:34:31 -0700632
633 if result1 and result2:
634 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800635 main.Functions.checkRouteNum( main, 7 )
636 main.Functions.checkM2SintentNum( main, 7 )
637 main.Functions.checkP2PintentNum( main, 42 )
pingping-lind791d342015-09-17 18:34:31 -0700638 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800639 main.log.error( "Starting switch failed!" )
pingping-lind791d342015-09-17 18:34:31 -0700640 main.cleanup()
pingping-linb3ebd3f2015-09-28 22:17:05 -0700641 main.exit()
pingping-lin4f80c492015-09-15 14:34:42 -0700642
pingping-linbab7f8a2015-09-21 17:33:36 -0700643 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700644 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800645 main.FALSE,
646 kwargs={'isPENDING':False},
647 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700648 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800649 expect=main.TRUE,
650 actual=flowCheck,
651 onpass="Flow status is correct!",
652 onfail="Flow status is wrong!" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700653
pingping-lin829428d2015-09-22 20:50:00 -0700654 # Ping test
alisone4121a92016-11-22 16:31:36 -0800655 main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
656 peers=["p64514", "p64515", "p64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800657 expectAllSuccess=True )
pingping-lin829428d2015-09-22 20:50:00 -0700658 main.Functions.pingHostToHost( main,
alisone4121a92016-11-22 16:31:36 -0800659 hosts=["h64514", "h64515", "h64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800660 expectAllSuccess=True )
pingping-linbab7f8a2015-09-21 17:33:36 -0700661
pingping-lin829428d2015-09-22 20:50:00 -0700662
663 def CASE9( self, main ):
pingping-linbab7f8a2015-09-21 17:33:36 -0700664 '''
665 Bring down a switch in best path, check:
666 route number, P2P intent number, M2S intent number, ping test
667 '''
pingping-linb3ebd3f2015-09-28 22:17:05 -0700668 main.case( "Stop sw11 located in best path, \
pingping-linbab7f8a2015-09-21 17:33:36 -0700669 check route number, P2P intent number, M2S intent number, ping test" )
670
pingping-lin581a3662015-09-29 17:43:39 -0700671 main.log.info( "Check the flow number correctness before stopping sw11" )
alisone4121a92016-11-22 16:31:36 -0800672 main.Functions.checkFlowNum( main, "sw11", 43 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700673 main.Functions.checkFlowNum( main, "sw1", 3 )
alisone4121a92016-11-22 16:31:36 -0800674 main.Functions.checkFlowNum( main, "sw7", 34 )
Jon Hall6e9897d2016-02-29 14:41:32 -0800675 main.log.debug( main.Mininet.checkFlows( "sw11" ) )
676 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
677 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
pingping-linbab7f8a2015-09-21 17:33:36 -0700678
679 main.step( "Stop sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800680 result = main.Mininet.switch( SW="sw11", OPTION="stop" )
681 utilities.assertEquals( expect=main.TRUE, actual=result,
682 onpass="Stopping switch succeeded!",
683 onfail="Stopping switch failed!" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700684 if result:
685 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700686 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800687 main.Functions.checkRouteNum( main, 7 )
688 main.Functions.checkM2SintentNum( main, 7 )
689 main.Functions.checkP2PintentNum( main, 42 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700690 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800691 main.log.error( "Stopping switch failed!" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700692 main.cleanup()
pingping-linb3ebd3f2015-09-28 22:17:05 -0700693 main.exit()
pingping-linbab7f8a2015-09-21 17:33:36 -0700694
695 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700696 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800697 main.FALSE,
698 kwargs={'isPENDING':False},
699 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700700 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800701 expect=main.TRUE,
702 actual=flowCheck,
703 onpass="Flow status is correct!",
704 onfail="Flow status is wrong!" )
pingping-lin829428d2015-09-22 20:50:00 -0700705 # Ping test
alisone4121a92016-11-22 16:31:36 -0800706 main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
707 peers=["p64514", "p64515", "p64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800708 expectAllSuccess=True )
pingping-lin829428d2015-09-22 20:50:00 -0700709 main.Functions.pingHostToHost( main,
alisone4121a92016-11-22 16:31:36 -0800710 hosts=["h64514", "h64515", "h64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800711 expectAllSuccess=True )
pingping-linbab7f8a2015-09-21 17:33:36 -0700712
713
714 def CASE10( self, main ):
715 '''
716 Bring up the switch which was stopped in CASE9, check:
717 route number, P2P intent number, M2S intent number, ping test
718 '''
pingping-linb3ebd3f2015-09-28 22:17:05 -0700719 main.case( "Start sw11 which was stopped in CASE9, \
pingping-linbab7f8a2015-09-21 17:33:36 -0700720 check route number, P2P intent number, M2S intent number, ping test" )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700721
pingping-lin581a3662015-09-29 17:43:39 -0700722 main.log.info( "Check the flow status before starting sw11" )
alisone4121a92016-11-22 16:31:36 -0800723 main.Functions.checkFlowNum( main, "sw1", 33 )
724 main.Functions.checkFlowNum( main, "sw7", 28 )
Jon Hall6e9897d2016-02-29 14:41:32 -0800725 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
726 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
pingping-linb3ebd3f2015-09-28 22:17:05 -0700727
pingping-linbab7f8a2015-09-21 17:33:36 -0700728 main.step( "Start sw11" )
Jon Hall6e9897d2016-02-29 14:41:32 -0800729 result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
730 utilities.assertEquals( expect=main.TRUE, actual=result1,
731 onpass="Starting switch succeeded!",
732 onfail="Starting switch failed!" )
pingping-lin0351dee2015-09-28 13:26:35 -0700733 result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
Jon Hall6e9897d2016-02-29 14:41:32 -0800734 utilities.assertEquals( expect=main.TRUE, actual=result2,
735 onpass="Connect switch to ONOS succeeded!",
736 onfail="Connect switch to ONOS failed!" )
pingping-lin0351dee2015-09-28 13:26:35 -0700737 if result1 and result2:
pingping-linbab7f8a2015-09-21 17:33:36 -0700738 time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
alisone4121a92016-11-22 16:31:36 -0800739 main.Functions.checkRouteNum( main, 7 )
740 main.Functions.checkM2SintentNum( main, 7 )
741 main.Functions.checkP2PintentNum( main, 42 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700742
pingping-lin3f091d62015-09-29 12:00:05 -0700743 main.log.debug( main.Mininet.checkFlows( "sw11" ) )
744 main.log.debug( main.Mininet.checkFlows( "sw1" ) )
745 main.log.debug( main.Mininet.checkFlows( "sw7" ) )
pingping-linbab7f8a2015-09-21 17:33:36 -0700746 else:
Jon Hall6e9897d2016-02-29 14:41:32 -0800747 main.log.error( "Starting switch failed!" )
pingping-linbab7f8a2015-09-21 17:33:36 -0700748 main.cleanup()
pingping-linb3ebd3f2015-09-28 22:17:05 -0700749 main.exit()
pingping-linbab7f8a2015-09-21 17:33:36 -0700750
751 main.step( "Check whether all flow status are ADDED" )
Jon Hall1aa05602016-04-05 10:25:39 -0700752 flowCheck = utilities.retry( main.ONOScli.checkFlowsState,
Jon Hall6e9897d2016-02-29 14:41:32 -0800753 main.FALSE,
754 kwargs={'isPENDING':False},
755 attempts=10 )
pingping-linbab7f8a2015-09-21 17:33:36 -0700756 utilities.assertEquals( \
Jon Hall6e9897d2016-02-29 14:41:32 -0800757 expect=main.TRUE,
758 actual=flowCheck,
759 onpass="Flow status is correct!",
760 onfail="Flow status is wrong!" )
pingping-lin829428d2015-09-22 20:50:00 -0700761 # Ping test
alisone4121a92016-11-22 16:31:36 -0800762 main.Functions.pingSpeakerToPeer( main, speakers=["spk1"],
763 peers=["p64514", "p64515", "p64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800764 expectAllSuccess=True )
pingping-lin829428d2015-09-22 20:50:00 -0700765 main.Functions.pingHostToHost( main,
alisone4121a92016-11-22 16:31:36 -0800766 hosts=["h64514", "h64515", "h64516"],
Jon Hall6e9897d2016-02-29 14:41:32 -0800767 expectAllSuccess=True )