blob: 41f1693dc23361b1b85cf6abbb170ebcd41aafe4 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
You Wangb6586542016-02-26 09:25:56 -080027 import re
28 import imp
Hari Krishnac195f3b2015-07-08 20:02:24 -070029
30 global intentState
31 main.threadID = 0
You Wangb6586542016-02-26 09:25:56 -080032 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
33 main.dependencyPath = main.testOnDirectory + \
34 main.params[ 'DEPENDENCY' ][ 'path' ]
35 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070036 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070037 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
38 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070039 karafTimeout = main.params['CTRL']['karafCliTimeout']
You Wangb6586542016-02-26 09:25:56 -080040 main.linkSleep = int( main.params['timers']['LinkDiscovery'] )
GlennRCa8d786a2015-09-23 17:40:11 -070041 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
You Wangb6586542016-02-26 09:25:56 -080042 main.pingSleep = int( main.params['timers']['pingSleep'] )
43 main.topoCheckDelay = int( main.params['timers']['topoCheckDelay'] )
44 main.pingTimeoutSmallTopo = int( main.params['timers']['pingTimeoutSmallTopo'] )
45 main.pingTimeoutLargeTopo = int( main.params['timers']['pingTimeoutLargeTopo'] )
46 main.remHostDelay = int( main.params['timers']['remHostDelay'] )
47 main.remDevDelay = int( main.params['timers']['remDevDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070048 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070049 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070050 main.intentCheck = int( main.params['TEST']['intentChecks'] )
You Wang0779bac2016-01-27 16:32:33 -080051 main.linkCheck = int( main.params['TEST']['linkChecks'] )
GlennRC289c1b62015-12-12 10:45:43 -080052 main.topoCheck = int( main.params['TEST']['topoChecks'] )
GlennRCf7be6632015-10-20 13:04:07 -070053 main.numPings = int( main.params['TEST']['numPings'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070054 main.newTopo = ""
55 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070056
GlennRC9e7465e2015-10-02 13:50:36 -070057 main.failSwitch = True if main.failSwitch == "on" else False
58 main.emailOnStop = True if main.emailOnStop == "on" else False
59
Hari Krishnac195f3b2015-07-08 20:02:24 -070060 for i in range( 1, int(main.numCtrls) + 1 ):
61 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070062
You Wangb6586542016-02-26 09:25:56 -080063 main.CHOtestFunctions = imp.load_source( wrapperFile,
64 main.dependencyPath +
65 wrapperFile +
66 ".py" )
67
Hari Krishnac195f3b2015-07-08 20:02:24 -070068 main.case( "Set up test environment" )
69 main.log.report( "Set up test environment" )
70 main.log.report( "_______________________" )
71
Hari Krishna6185fc12015-07-13 15:42:31 -070072 main.step( "Apply Cell environment for ONOS" )
73 if ( main.onoscell ):
74 cellName = main.onoscell
75 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070076 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
77 onpass="Test step PASS",
78 onfail="Test step FAIL" )
79 else:
80 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
81 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080082 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070083 main.exit()
84
Hari Krishnac195f3b2015-07-08 20:02:24 -070085 main.step( "Git checkout and pull " + git_branch )
86 if git_pull == 'on':
87 checkout_result = main.ONOSbench.gitCheckout( git_branch )
88 pull_result = main.ONOSbench.gitPull()
89 cp_result = ( checkout_result and pull_result )
90 else:
91 checkout_result = main.TRUE
92 pull_result = main.TRUE
93 main.log.info( "Skipped git checkout and pull" )
94 cp_result = ( checkout_result and pull_result )
95 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
96 onpass="Test step PASS",
97 onfail="Test step FAIL" )
98
99 main.step( "mvn clean & install" )
100 if git_pull == 'on':
101 mvn_result = main.ONOSbench.cleanInstall()
102 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
103 onpass="Test step PASS",
104 onfail="Test step FAIL" )
105 else:
106 mvn_result = main.TRUE
107 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
108
109 main.ONOSbench.getVersion( report=True )
110
Hari Krishnac195f3b2015-07-08 20:02:24 -0700111 main.step( "Create ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700112 packageResult = main.ONOSbench.buckBuild()
Hari Krishnac195f3b2015-07-08 20:02:24 -0700113 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
114 onpass="Test step PASS",
115 onfail="Test step FAIL" )
116
117 main.step( "Uninstall ONOS package on all Nodes" )
118 uninstallResult = main.TRUE
119 for i in range( int( main.numCtrls ) ):
120 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
121 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
122 utilities.assert_equals( expect=main.TRUE, actual=u_result,
123 onpass="Test step PASS",
124 onfail="Test step FAIL" )
125 uninstallResult = ( uninstallResult and u_result )
126
127 main.step( "Install ONOS package on all Nodes" )
128 installResult = main.TRUE
129 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700130 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700131 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
132 utilities.assert_equals( expect=main.TRUE, actual=i_result,
133 onpass="Test step PASS",
134 onfail="Test step FAIL" )
135 installResult = ( installResult and i_result )
136
Chiyu Chengef109502016-11-21 15:51:38 -0800137 main.step( "Set up ONOS secure SSH" )
138 secureSshResult = main.TRUE
139 for i in range( int( main.numCtrls ) ):
140 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
141 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
142 onpass="Test step PASS",
143 onfail="Test step FAIL" )
144
You Wang0357c432017-01-09 16:13:33 -0800145 time.sleep( 5 )
146 main.step( "Starting ONOS service" )
147 stopResult = main.TRUE
148 startResult = main.TRUE
149 onosIsUp = main.TRUE
150 for i in range( main.numCtrls ):
151 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
152 if onosIsUp == main.TRUE:
153 main.log.report( "ONOS instance is up and ready" )
154 else:
155 main.log.report( "ONOS instance may not be up, stop and " +
156 "start ONOS again " )
157 for i in range( main.numCtrls ):
158 stopResult = stopResult and \
159 main.ONOSbench.onosStop( main.ONOSip[ i ] )
160 for i in range( main.numCtrls ):
161 startResult = startResult and \
162 main.ONOSbench.onosStart( main.ONOSip[ i ] )
163 stepResult = onosIsUp and stopResult and startResult
164 utilities.assert_equals( expect=main.TRUE,
165 actual=stepResult,
166 onpass="ONOS service is ready",
167 onfail="ONOS service did not start properly" )
168
Hari Krishnac195f3b2015-07-08 20:02:24 -0700169 main.step( "Start ONOS CLI on all nodes" )
170 cliResult = main.TRUE
Jon Hall6509dbf2016-06-21 17:01:17 -0700171 main.step(" Start ONOS cli using thread ")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700172 startCliResult = main.TRUE
173 pool = []
174 time1 = time.time()
175 for i in range( int( main.numCtrls) ):
176 t = main.Thread( target=main.CLIs[i].startOnosCli,
177 threadID=main.threadID,
178 name="startOnosCli",
179 args=[ main.onosIPs[i], karafTimeout ] )
180 pool.append(t)
181 t.start()
182 main.threadID = main.threadID + 1
183 for t in pool:
184 t.join()
185 startCliResult = startCliResult and t.result
186 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700187
Hari Krishnac195f3b2015-07-08 20:02:24 -0700188 if not startCliResult:
189 main.log.info("ONOS CLI did not start up properly")
190 main.cleanup()
191 main.exit()
192 else:
193 main.log.info("Successful CLI startup")
194 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700195
196 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
You Wangb6586542016-02-26 09:25:56 -0800197 time.sleep(30)
Hari Krishna4223dbd2015-08-13 16:29:53 -0700198 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
199 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
200 cfgResult = cfgResult1 and cfgResult2
201 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
202 onpass="ipv6NeighborDiscovery cfg is set to true",
203 onfail="Failed to cfg set ipv6NeighborDiscovery" )
204
205 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700206 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
207 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
208 onpass="Set up test environment PASS",
209 onfail="Set up test environment FAIL" )
210
211 def CASE20( self, main ):
212 """
213 This test script Loads a new Topology (Att) on CHO setup and balances all switches
214 """
215 import re
216 import time
217 import copy
218
GlennRC3de72232015-12-16 10:48:35 -0800219 main.prefix = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -0700220 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
221 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
222 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800223 main.pingTimeout = main.pingTimeoutSmallTopo
224
Hari Krishnac195f3b2015-07-08 20:02:24 -0700225 main.log.report(
226 "Load Att topology and Balance all Mininet switches across controllers" )
227 main.log.report(
228 "________________________________________________________________________" )
229 main.case(
230 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700231
Hari Krishnac195f3b2015-07-08 20:02:24 -0700232 main.step( "Start Mininet with Att topology" )
233 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700234 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700235 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700236 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
237 topoPath = mininetDir + main.newTopo
238 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700239
Hari Krishnac195f3b2015-07-08 20:02:24 -0700240 main.step( "Assign switches to controllers" )
241 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
242 main.Mininet1.assignSwController(
243 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700244 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700245
246 switch_mastership = main.TRUE
247 for i in range( 1, ( main.numMNswitches + 1 ) ):
248 response = main.Mininet1.getSwController( "s" + str( i ) )
249 print( "Response is " + str( response ) )
250 if re.search( "tcp:" + main.onosIPs[0], response ):
251 switch_mastership = switch_mastership and main.TRUE
252 else:
253 switch_mastership = main.FALSE
254
255 if switch_mastership == main.TRUE:
256 main.log.report( "Controller assignment successfull" )
257 else:
258 main.log.report( "Controller assignment failed" )
259
260 time.sleep(30) # waiting here to make sure topology converges across all nodes
261
262 main.step( "Balance devices across controllers" )
263 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700264 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265 time.sleep( 5 )
266
267 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700268 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700269 case2Result = ( switch_mastership and startStatus )
270 utilities.assert_equals(
271 expect=main.TRUE,
272 actual=case2Result,
273 onpass="Starting new Att topology test PASS",
274 onfail="Starting new Att topology test FAIL" )
275
276 def CASE21( self, main ):
277 """
278 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
279 """
280 import re
281 import time
282 import copy
283
GlennRC3de72232015-12-16 10:48:35 -0800284 main.prefix = 1
Hari Krishnac195f3b2015-07-08 20:02:24 -0700285 main.newTopo = main.params['TOPO2']['topo']
286 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
287 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
288 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800289 main.pingTimeout = main.pingTimeoutSmallTopo
290
Hari Krishnac195f3b2015-07-08 20:02:24 -0700291 main.log.report(
292 "Load Chordal topology and Balance all Mininet switches across controllers" )
293 main.log.report(
294 "________________________________________________________________________" )
295 main.case(
296 "Assign and Balance all Mininet switches across controllers" )
297
GlennRCc6cd2a62015-08-10 16:08:22 -0700298 main.step("Start Mininet with Chordal topology")
299 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700300 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700301 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
302 topoPath = mininetDir + main.newTopo
303 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700304
305 main.step( "Assign switches to controllers" )
306
307 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
308 main.Mininet1.assignSwController(
309 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700310 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700311
312 switch_mastership = main.TRUE
313 for i in range( 1, ( main.numMNswitches + 1 ) ):
314 response = main.Mininet1.getSwController( "s" + str( i ) )
315 print( "Response is " + str( response ) )
316 if re.search( "tcp:" + main.onosIPs[0], response ):
317 switch_mastership = switch_mastership and main.TRUE
318 else:
319 switch_mastership = main.FALSE
320
321 if switch_mastership == main.TRUE:
322 main.log.report( "Controller assignment successfull" )
323 else:
324 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700325
Hari Krishnac195f3b2015-07-08 20:02:24 -0700326 main.step( "Balance devices across controllers" )
327 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700328 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700329 time.sleep( 5 )
330
GlennRCbddd58f2015-10-01 15:45:25 -0700331 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700332 time.sleep(30)
333 utilities.assert_equals(
334 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700335 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700336 onpass="Starting new Chordal topology test PASS",
337 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700338
Hari Krishnac195f3b2015-07-08 20:02:24 -0700339 def CASE22( self, main ):
340 """
341 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
342 """
343 import re
344 import time
345 import copy
346
GlennRC3de72232015-12-16 10:48:35 -0800347 main.prefix = 2
Hari Krishnac195f3b2015-07-08 20:02:24 -0700348 main.newTopo = main.params['TOPO3']['topo']
349 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
350 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
351 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800352 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700353
Hari Krishnac195f3b2015-07-08 20:02:24 -0700354 main.log.report(
355 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
356 main.log.report(
357 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800358 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700359
360 main.step("Start Mininet with Spine topology")
361 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700362 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700363 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
364 topoPath = mininetDir + main.newTopo
365 startStatus = main.Mininet1.startNet(topoFile = topoPath)
366
Hari Krishnac195f3b2015-07-08 20:02:24 -0700367 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
368 main.Mininet1.assignSwController(
369 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700370 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700371
372 switch_mastership = main.TRUE
373 for i in range( 1, ( main.numMNswitches + 1 ) ):
374 response = main.Mininet1.getSwController( "s" + str( i ) )
375 print( "Response is " + str( response ) )
376 if re.search( "tcp:" + main.onosIPs[0], response ):
377 switch_mastership = switch_mastership and main.TRUE
378 else:
379 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700380
Hari Krishnac195f3b2015-07-08 20:02:24 -0700381 if switch_mastership == main.TRUE:
382 main.log.report( "Controller assignment successfull" )
383 else:
384 main.log.report( "Controller assignment failed" )
385 time.sleep( 5 )
386
387 main.step( "Balance devices across controllers" )
388 for i in range( int( main.numCtrls ) ):
389 balanceResult = main.ONOScli1.balanceMasters()
390 # giving some breathing time for ONOS to complete re-balance
391 time.sleep( 3 )
392
GlennRCbddd58f2015-10-01 15:45:25 -0700393 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700394 time.sleep(60)
395 utilities.assert_equals(
396 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700397 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700398 onpass="Starting new Spine topology test PASS",
399 onfail="Starting new Spine topology test FAIL" )
400
401 def CASE3( self, main ):
402 """
403 This Test case will be extended to collect and store more data related
404 ONOS state.
405 """
406 import re
407 import copy
408 main.deviceDPIDs = []
409 main.hostMACs = []
410 main.deviceLinks = []
411 main.deviceActiveLinksCount = []
412 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700413
Hari Krishnac195f3b2015-07-08 20:02:24 -0700414 main.log.report(
415 "Collect and Store topology details from ONOS before running any Tests" )
416 main.log.report(
417 "____________________________________________________________________" )
418 main.case( "Collect and Store Topology Details from ONOS" )
419 main.step( "Collect and store current number of switches and links" )
420 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700421 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700422 numOnosDevices = topology_result[ 'devices' ]
423 numOnosLinks = topology_result[ 'links' ]
424 topoResult = main.TRUE
425
GlennRCee8f3bf2015-12-14 16:18:39 -0800426 for check in range(main.topoCheck):
427 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
428 main.step( "Store Device DPIDs" )
429 for i in range( 1, (main.numMNswitches+1) ):
GlennRC20fc6522015-12-23 23:26:57 -0800430 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800431 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700432
GlennRCee8f3bf2015-12-14 16:18:39 -0800433 main.step( "Store Host MACs" )
434 for i in range( 1, ( main.numMNhosts + 1 ) ):
435 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
436 print "Host MACs in Store: \n", str( main.hostMACs )
437 main.MACsDict = {}
438 print "Creating dictionary of DPID and HostMacs"
439 for i in range(len(main.hostMACs)):
440 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
441 print main.MACsDict
442 main.step( "Collect and store all Devices Links" )
443 linksResult = main.ONOScli1.links( jsonFormat=False )
444 ansi_escape = re.compile( r'\x1b[^m]*m' )
445 linksResult = ansi_escape.sub( '', linksResult )
446 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
447 linksResult = linksResult.splitlines()
448 main.deviceLinks = copy.copy( linksResult )
449 print "Device Links Stored: \n", str( main.deviceLinks )
450 # this will be asserted to check with the params provided count of
451 # links
452 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700453
GlennRCee8f3bf2015-12-14 16:18:39 -0800454 main.step( "Collect and store each Device ports enabled Count" )
455 time1 = time.time()
456 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
457 pool = []
458 for cli in main.CLIs:
459 if i >= main.numMNswitches + 1:
460 break
GlennRC20fc6522015-12-23 23:26:57 -0800461 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800462 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
463 t.start()
464 pool.append(t)
465 i = i + 1
466 main.threadID = main.threadID + 1
467 for thread in pool:
468 thread.join()
469 portResult = thread.result
470 main.devicePortsEnabledCount.append( portResult )
471 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
472 time2 = time.time()
473 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700474
GlennRCee8f3bf2015-12-14 16:18:39 -0800475 main.step( "Collect and store each Device active links Count" )
476 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700477
GlennRCee8f3bf2015-12-14 16:18:39 -0800478 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
479 pool = []
480 for cli in main.CLIs:
481 if i >= main.numMNswitches + 1:
482 break
GlennRC20fc6522015-12-23 23:26:57 -0800483 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800484 t = main.Thread( target = cli.getDeviceLinksActiveCount,
485 threadID = main.threadID,
486 name = "getDevicePortsEnabledCount",
487 args = [dpid])
488 t.start()
489 pool.append(t)
490 i = i + 1
491 main.threadID = main.threadID + 1
492 for thread in pool:
493 thread.join()
494 linkCountResult = thread.result
495 main.deviceActiveLinksCount.append( linkCountResult )
496 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
497 time2 = time.time()
498 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700499
GlennRCee8f3bf2015-12-14 16:18:39 -0800500 # Exit out of the topo check loop
501 break
502
503 else:
504 main.log.info("Devices (expected): %s, Links (expected): %s" %
505 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
506 main.log.info("Devices (actual): %s, Links (actual): %s" %
507 ( numOnosDevices , numOnosLinks ) )
508 main.log.info("Topology does not match, trying again...")
509 topoResult = main.FALSE
510 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700511
512 # just returning TRUE for now as this one just collects data
513 case3Result = topoResult
514 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
515 onpass="Saving ONOS topology data test PASS",
516 onfail="Saving ONOS topology data test FAIL" )
517
GlennRC186b7362015-12-11 18:20:16 -0800518
GlennRC20fc6522015-12-23 23:26:57 -0800519
520 def CASE200( self, main ):
521
522 import time
523 main.log.report( "Clean up ONOS" )
Jon Hall6509dbf2016-06-21 17:01:17 -0700524 main.case( "Stop topology and remove hosts and devices" )
GlennRC20fc6522015-12-23 23:26:57 -0800525
526 main.step( "Stop Topology" )
527 stopStatus = main.Mininet1.stopNet()
528 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
529 onpass="Stopped mininet",
530 onfail="Failed to stop mininet" )
531
532
533 main.log.info( "Constructing host id list" )
534 hosts = []
535 for i in range( main.numMNhosts ):
536 hosts.append( "h" + str(i+1) )
537
538 main.step( "Getting host ids" )
539 hostList = main.CLIs[0].getHostsId( hosts )
540 hostIdResult = True if hostList else False
541 utilities.assert_equals( expect=True, actual=hostIdResult,
542 onpass="Successfully obtained the host ids.",
543 onfail="Failed to obtain the host ids" )
544
545 main.step( "Removing hosts" )
546 hostResult = main.CLIs[0].removeHost( hostList )
547 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
548 onpass="Successfully removed hosts",
549 onfail="Failed remove hosts" )
550
551 time.sleep( main.remHostDelay )
552
553 main.log.info( "Constructing device uri list" )
554 deviceList = []
555 for i in range( main.numMNswitches ):
556 deviceList.append( "of:00000000000000" + format( i+1, "02x" ) )
557
558 main.step( "Removing devices" )
559 deviceResult = main.CLIs[0].removeDevice( deviceList )
560 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
561 onpass="Successfully removed devices",
562 onfail="Failed remove devices" )
563
564 time.sleep( main.remDevDelay )
565
566 main.log.info( "Summary\n{}".format( main.CLIs[0].summary( jsonFormat=False ) ) )
567
568
Hari Krishnac195f3b2015-07-08 20:02:24 -0700569 def CASE40( self, main ):
570 """
GlennRC15d164c2015-12-15 17:12:25 -0800571 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700572 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700573 import time
GlennRC15d164c2015-12-15 17:12:25 -0800574 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700575 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800576 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700577
GlennRC15d164c2015-12-15 17:12:25 -0800578 main.step( "Enable Reactive forwarding" )
579 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
580 utilities.assert_equals( expect=main.TRUE, actual=appResult,
581 onpass="Successfully install fwd app",
582 onfail="Failed to install fwd app" )
583
Hari Krishnac195f3b2015-07-08 20:02:24 -0700584
GlennRC6ac11b12015-10-21 17:41:28 -0700585 main.step( "Verify Ping across all hosts" )
586 for i in range(main.numPings):
587 time1 = time.time()
588 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
589 if not pingResult:
590 main.log.warn("First pingall failed. Retrying...")
591 time.sleep(main.pingSleep)
GlennRC15d164c2015-12-15 17:12:25 -0800592 else:
593 break
GlennRC6ac11b12015-10-21 17:41:28 -0700594
Hari Krishnac195f3b2015-07-08 20:02:24 -0700595 time2 = time.time()
596 timeDiff = round( ( time2 - time1 ), 2 )
597 main.log.report(
598 "Time taken for Ping All: " +
599 str( timeDiff ) +
600 " seconds" )
601
GlennRC15d164c2015-12-15 17:12:25 -0800602 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700603 onpass="Reactive Mode IPv4 Pingall test PASS",
604 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700605
You Wangb6586542016-02-26 09:25:56 -0800606 if not pingResult and main.failSwitch:
607 main.log.report("Stopping test")
608 main.stop( email=main.emailOnStop )
609
GlennRC15d164c2015-12-15 17:12:25 -0800610 main.step( "Disable Reactive forwarding" )
611 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
612 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800613 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800614 onfail="Failed to deactivate fwd app" )
615
Hari Krishnac195f3b2015-07-08 20:02:24 -0700616 def CASE41( self, main ):
617 """
618 Verify Reactive forwarding (Chordal Topology)
619 """
620 import re
621 import copy
622 import time
623 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
624 main.log.report( "______________________________________________" )
625 main.case( "Enable Reactive forwarding and Verify ping all" )
626 main.step( "Enable Reactive forwarding" )
627 installResult = main.TRUE
628 # Activate fwd app
629 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
630
631 appCheck = main.TRUE
632 pool = []
633 for cli in main.CLIs:
634 t = main.Thread( target=cli.appToIDCheck,
635 name="appToIDCheck-" + str( i ),
636 args=[] )
637 pool.append( t )
638 t.start()
639 for t in pool:
640 t.join()
641 appCheck = appCheck and t.result
642 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
643 onpass="App Ids seem to be correct",
644 onfail="Something is wrong with app Ids" )
645 if appCheck != main.TRUE:
646 main.log.warn( main.CLIs[0].apps() )
647 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700648
Hari Krishnac195f3b2015-07-08 20:02:24 -0700649 time.sleep( 10 )
650
GlennRC6ac11b12015-10-21 17:41:28 -0700651 main.step( "Verify Ping across all hosts" )
652 for i in range(main.numPings):
653 time1 = time.time()
654 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
655 if not pingResult:
656 main.log.warn("First pingall failed. Retrying...")
657 time.sleep(main.pingSleep)
658 else: break
659
Hari Krishnac195f3b2015-07-08 20:02:24 -0700660 time2 = time.time()
661 timeDiff = round( ( time2 - time1 ), 2 )
662 main.log.report(
663 "Time taken for Ping All: " +
664 str( timeDiff ) +
665 " seconds" )
666
You Wangb6586542016-02-26 09:25:56 -0800667 if not pingResult and main.failSwitch:
668 main.log.report("Stopping test")
669 main.stop( email=main.emailOnStop )
670
GlennRC626ba132015-09-18 16:16:31 -0700671 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700672 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700673 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700674 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700675
GlennRCbddd58f2015-10-01 15:45:25 -0700676 caseResult = appCheck and pingResult
677 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700678 onpass="Reactive Mode IPv4 Pingall test PASS",
679 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700680
681 def CASE42( self, main ):
682 """
683 Verify Reactive forwarding (Spine Topology)
684 """
685 import re
686 import copy
687 import time
688 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
689 main.log.report( "______________________________________________" )
690 main.case( "Enable Reactive forwarding and Verify ping all" )
691 main.step( "Enable Reactive forwarding" )
692 installResult = main.TRUE
693 # Activate fwd app
694 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
695
696 appCheck = main.TRUE
697 pool = []
698 for cli in main.CLIs:
699 t = main.Thread( target=cli.appToIDCheck,
700 name="appToIDCheck-" + str( i ),
701 args=[] )
702 pool.append( t )
703 t.start()
704 for t in pool:
705 t.join()
706 appCheck = appCheck and t.result
707 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
708 onpass="App Ids seem to be correct",
709 onfail="Something is wrong with app Ids" )
710 if appCheck != main.TRUE:
711 main.log.warn( main.CLIs[0].apps() )
712 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700713
Hari Krishnac195f3b2015-07-08 20:02:24 -0700714 time.sleep( 10 )
715
GlennRC6ac11b12015-10-21 17:41:28 -0700716 main.step( "Verify Ping across all hosts" )
717 for i in range(main.numPings):
718 time1 = time.time()
719 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
720 if not pingResult:
721 main.log.warn("First pingall failed. Retrying...")
722 time.sleep(main.pingSleep)
723 else: break
724
Hari Krishnac195f3b2015-07-08 20:02:24 -0700725 time2 = time.time()
726 timeDiff = round( ( time2 - time1 ), 2 )
727 main.log.report(
728 "Time taken for Ping All: " +
729 str( timeDiff ) +
730 " seconds" )
731
You Wangb6586542016-02-26 09:25:56 -0800732 if not pingResult and main.failSwitch:
733 main.log.report("Stopping test")
734 main.stop( email=main.emailOnStop )
735
GlennRC626ba132015-09-18 16:16:31 -0700736 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700737 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700738 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700739 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
740
GlennRCbddd58f2015-10-01 15:45:25 -0700741 caseResult = appCheck and pingResult
742 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700743 onpass="Reactive Mode IPv4 Pingall test PASS",
744 onfail="Reactive Mode IPv4 Pingall test FAIL" )
745
GlennRC026dba62016-01-07 18:42:33 -0800746 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800747 """
748 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
749 """
GlennRC026dba62016-01-07 18:42:33 -0800750 import time
You Wang0779bac2016-01-27 16:32:33 -0800751 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800752 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800753 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800754
755 main.step( "Enable Reactive forwarding" )
756 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
757 utilities.assert_equals( expect=main.TRUE, actual=appResult,
758 onpass="Successfully install fwd app",
759 onfail="Failed to install fwd app" )
760
761 numHosts = int( main.params['TOPO1']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800762
763 for i in range(numHosts):
764 src = "h1"
765 dest = "h" + str(i+1)
766 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
767 main.Mininet1.handle.expect( "mininet>" )
768 main.log.info( main.Mininet1.handle.before )
769
770 hosts = main.CLIs[0].hosts( jsonFormat=False )
771
772 main.log.info( hosts )
773
774 main.step( "Disable Reactive forwarding" )
775 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
776 utilities.assert_equals( expect=main.TRUE, actual=appResult,
777 onpass="Successfully deactivated fwd app",
778 onfail="Failed to deactivate fwd app" )
779
780 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800781 """
782 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
783 """
GlennRC026dba62016-01-07 18:42:33 -0800784 import time
You Wang0779bac2016-01-27 16:32:33 -0800785 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800786 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800787 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800788
789 main.step( "Enable Reactive forwarding" )
790 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
791 utilities.assert_equals( expect=main.TRUE, actual=appResult,
792 onpass="Successfully install fwd app",
793 onfail="Failed to install fwd app" )
794
795 numHosts = int( main.params['TOPO2']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800796
797 for i in range(numHosts):
798 src = "h1"
799 dest = "h" + str(i+1)
800 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
801 main.Mininet1.handle.expect( "mininet>" )
802 main.log.info( main.Mininet1.handle.before )
803
804 hosts = main.CLIs[0].hosts( jsonFormat=False )
805
806 main.log.info( hosts )
807
808 main.step( "Disable Reactive forwarding" )
809 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
810 utilities.assert_equals( expect=main.TRUE, actual=appResult,
811 onpass="Successfully deactivated fwd app",
812 onfail="Failed to deactivate fwd app" )
813
814 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800815 """
816 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
817 """
GlennRC026dba62016-01-07 18:42:33 -0800818 import time
You Wang0779bac2016-01-27 16:32:33 -0800819 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800820 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800821 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800822
823 main.step( "Enable Reactive forwarding" )
824 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
825 utilities.assert_equals( expect=main.TRUE, actual=appResult,
826 onpass="Successfully install fwd app",
827 onfail="Failed to install fwd app" )
828
829 numHosts = int( main.params['TOPO3']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800830
You Wang0779bac2016-01-27 16:32:33 -0800831 for i in range(11, numHosts+10):
GlennRC026dba62016-01-07 18:42:33 -0800832 src = "h11"
You Wang0779bac2016-01-27 16:32:33 -0800833 dest = "h" + str(i+1)
GlennRC026dba62016-01-07 18:42:33 -0800834 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
835 main.Mininet1.handle.expect( "mininet>" )
836 main.log.info( main.Mininet1.handle.before )
837
838 hosts = main.CLIs[0].hosts( jsonFormat=False )
839
840 main.log.info( hosts )
841
842 main.step( "Disable Reactive forwarding" )
843 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
844 utilities.assert_equals( expect=main.TRUE, actual=appResult,
845 onpass="Successfully deactivated fwd app",
846 onfail="Failed to deactivate fwd app" )
847
Hari Krishna4223dbd2015-08-13 16:29:53 -0700848 def CASE140( self, main ):
849 """
850 Verify IPv6 Reactive forwarding (Att Topology)
851 """
852 import re
853 import copy
854 import time
855 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
856 main.log.report( "______________________________________________" )
857 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
858 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
859
860 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
861 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
862 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
863 cfgResult = cfgResult1 and cfgResult2
864 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
865 onpass="Reactive mode ipv6Fowarding cfg is set to true",
866 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
867
868 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700869 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700870 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700871 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
872 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700873 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700874 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700875 time2 = time.time()
876 timeDiff = round( ( time2 - time1 ), 2 )
877 main.log.report(
878 "Time taken for IPv6 Ping All: " +
879 str( timeDiff ) +
880 " seconds" )
881
GlennRC626ba132015-09-18 16:16:31 -0700882 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700883 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
884 else:
885 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700886
Jon Hall4ba53f02015-07-29 13:07:41 -0700887
GlennRC15d164c2015-12-15 17:12:25 -0800888 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700889 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700890 onpass="Reactive Mode IPv6 Pingall test PASS",
891 onfail="Reactive Mode IPv6 Pingall test FAIL" )
892
893 def CASE141( self, main ):
894 """
895 Verify IPv6 Reactive forwarding (Chordal Topology)
896 """
897 import re
898 import copy
899 import time
900 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
901 main.log.report( "______________________________________________" )
902 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
903 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
904
905 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
906 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
907 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
908 cfgResult = cfgResult1 and cfgResult2
909 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
910 onpass="Reactive mode ipv6Fowarding cfg is set to true",
911 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
912
913 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700914 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700915 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700916 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
917 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700918 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700919 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700920 time2 = time.time()
921 timeDiff = round( ( time2 - time1 ), 2 )
922 main.log.report(
923 "Time taken for IPv6 Ping All: " +
924 str( timeDiff ) +
925 " seconds" )
926
GlennRC626ba132015-09-18 16:16:31 -0700927 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700928 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
929 else:
930 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
931
932 main.step( "Disable Reactive forwarding" )
933
934 main.log.info( "Uninstall reactive forwarding app" )
935 appCheck = main.TRUE
936 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
937 pool = []
938 for cli in main.CLIs:
939 t = main.Thread( target=cli.appToIDCheck,
940 name="appToIDCheck-" + str( i ),
941 args=[] )
942 pool.append( t )
943 t.start()
944
945 for t in pool:
946 t.join()
947 appCheck = appCheck and t.result
948 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
949 onpass="App Ids seem to be correct",
950 onfail="Something is wrong with app Ids" )
951 if appCheck != main.TRUE:
952 main.log.warn( main.CLIs[0].apps() )
953 main.log.warn( main.CLIs[0].appIDs() )
954
955 # Waiting for reative flows to be cleared.
956 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700957 caseResult = appCheck and cfgResult and pingResult
958 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700959 onpass="Reactive Mode IPv6 Pingall test PASS",
960 onfail="Reactive Mode IPv6 Pingall test FAIL" )
961
962 def CASE142( self, main ):
963 """
964 Verify IPv6 Reactive forwarding (Spine Topology)
965 """
966 import re
967 import copy
968 import time
969 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
970 main.log.report( "______________________________________________" )
971 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
972 # Spine topology do not have hosts h1-h10
973 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
974 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
975 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
976 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
977 cfgResult = cfgResult1 and cfgResult2
978 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
979 onpass="Reactive mode ipv6Fowarding cfg is set to true",
980 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
981
982 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700983 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700984 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700985 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
986 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700987 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700988 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700989 time2 = time.time()
990 timeDiff = round( ( time2 - time1 ), 2 )
991 main.log.report(
992 "Time taken for IPv6 Ping All: " +
993 str( timeDiff ) +
994 " seconds" )
995
GlennRC626ba132015-09-18 16:16:31 -0700996 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700997 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
998 else:
999 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
1000
1001 main.step( "Disable Reactive forwarding" )
1002
1003 main.log.info( "Uninstall reactive forwarding app" )
1004 appCheck = main.TRUE
1005 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1006 pool = []
1007 for cli in main.CLIs:
1008 t = main.Thread( target=cli.appToIDCheck,
1009 name="appToIDCheck-" + str( i ),
1010 args=[] )
1011 pool.append( t )
1012 t.start()
1013
1014 for t in pool:
1015 t.join()
1016 appCheck = appCheck and t.result
1017 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1018 onpass="App Ids seem to be correct",
1019 onfail="Something is wrong with app Ids" )
1020 if appCheck != main.TRUE:
1021 main.log.warn( main.CLIs[0].apps() )
1022 main.log.warn( main.CLIs[0].appIDs() )
1023
1024 # Waiting for reative flows to be cleared.
1025 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -07001026 caseResult = appCheck and cfgResult and pingResult
1027 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001028 onpass="Reactive Mode IPv6 Pingall test PASS",
1029 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001030
You Wang0779bac2016-01-27 16:32:33 -08001031 def CASE147( self, main ):
1032 """
1033 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
1034 """
1035 import time
1036 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
1037 main.log.report( "______________________________________________" )
1038 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1039
1040 main.step( "Enable IPv4 Reactive forwarding" )
1041 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1042 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1043 onpass="Successfully install fwd app",
1044 onfail="Failed to install fwd app" )
1045
1046 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1047 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1048 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1049 cfgResult = cfgResult1 and cfgResult2
1050 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1051 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1052 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1053
You Wangb6586542016-02-26 09:25:56 -08001054 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001055 numHosts = int( main.params['TOPO1']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001056 for i in range(numHosts):
1057 src = "h1"
1058 dest = "1000::" + str(i+1)
1059 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1060 main.Mininet1.handle.expect( "mininet>" )
1061 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001062 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001063 main.log.info( hosts )
1064
1065 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001066 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1067 appCheck = main.TRUE
1068 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1069 pool = []
1070 for cli in main.CLIs:
1071 t = main.Thread( target=cli.appToIDCheck,
1072 name="appToIDCheck-" + str( i ),
1073 args=[] )
1074 pool.append( t )
1075 t.start()
1076
1077 for t in pool:
1078 t.join()
1079 appCheck = appCheck and t.result
1080 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1081 onpass="App Ids seem to be correct",
1082 onfail="Something is wrong with app Ids" )
1083
1084 if appCheck != main.TRUE:
1085 main.log.warn( main.CLIs[0].apps() )
1086 main.log.warn( main.CLIs[0].appIDs() )
1087
1088 # Waiting for reative flows to be cleared.
1089 time.sleep( 30 )
1090
1091 main.step( "Disable IPv4 Reactive forwarding" )
1092 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1093 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1094 onpass="Successfully deactivated IPv4 fwd app",
1095 onfail="Failed to deactivate IPv4 fwd app" )
1096
1097 def CASE148( self, main ):
1098 """
1099 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1100 """
1101 import time
1102 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1103 main.log.report( "______________________________________________" )
1104 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1105
1106 main.step( "Enable IPv4 Reactive forwarding" )
1107 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1108 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1109 onpass="Successfully install fwd app",
1110 onfail="Failed to install fwd app" )
1111
1112 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1113 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1114 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1115 cfgResult = cfgResult1 and cfgResult2
1116 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1117 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1118 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1119
You Wangb6586542016-02-26 09:25:56 -08001120 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001121 numHosts = int( main.params['TOPO2']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001122 for i in range(numHosts):
1123 src = "h1"
1124 dest = "1000::" + str(i+1)
1125 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1126 main.Mininet1.handle.expect( "mininet>" )
1127 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001128 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001129 main.log.info( hosts )
1130
1131 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001132 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1133 appCheck = main.TRUE
1134 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1135 pool = []
1136 for cli in main.CLIs:
1137 t = main.Thread( target=cli.appToIDCheck,
1138 name="appToIDCheck-" + str( i ),
1139 args=[] )
1140 pool.append( t )
1141 t.start()
1142
1143 for t in pool:
1144 t.join()
1145 appCheck = appCheck and t.result
1146 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1147 onpass="App Ids seem to be correct",
1148 onfail="Something is wrong with app Ids" )
1149
1150 if appCheck != main.TRUE:
1151 main.log.warn( main.CLIs[0].apps() )
1152 main.log.warn( main.CLIs[0].appIDs() )
1153
1154 # Waiting for reative flows to be cleared.
1155 time.sleep( 30 )
1156
1157 main.step( "Disable IPv4 Reactive forwarding" )
1158 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1159 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1160 onpass="Successfully deactivated IPv4 fwd app",
1161 onfail="Failed to deactivate IPv4 fwd app" )
1162
1163 def CASE149( self, main ):
1164 """
1165 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1166 """
1167 import time
1168 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1169 main.log.report( "______________________________________________" )
1170 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1171
1172 main.step( "Enable IPv4 Reactive forwarding" )
1173 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1174 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1175 onpass="Successfully install fwd app",
1176 onfail="Failed to install fwd app" )
1177
1178 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1179 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1180 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1181 cfgResult = cfgResult1 and cfgResult2
1182 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1183 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1184 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1185
You Wangb6586542016-02-26 09:25:56 -08001186 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001187 numHosts = int( main.params['TOPO3']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001188 for i in range(11, numHosts+10):
1189 src = "h11"
1190 dest = "1000::" + str(i+1)
1191 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1192 main.Mininet1.handle.expect( "mininet>" )
1193 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001194 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001195 main.log.info( hosts )
1196
1197 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001198 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1199 appCheck = main.TRUE
1200 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1201 pool = []
1202 for cli in main.CLIs:
1203 t = main.Thread( target=cli.appToIDCheck,
1204 name="appToIDCheck-" + str( i ),
1205 args=[] )
1206 pool.append( t )
1207 t.start()
1208
1209 for t in pool:
1210 t.join()
1211 appCheck = appCheck and t.result
1212 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1213 onpass="App Ids seem to be correct",
1214 onfail="Something is wrong with app Ids" )
1215
1216 if appCheck != main.TRUE:
1217 main.log.warn( main.CLIs[0].apps() )
1218 main.log.warn( main.CLIs[0].appIDs() )
1219
1220 # Waiting for reative flows to be cleared.
1221 time.sleep( 30 )
1222
1223 main.step( "Disable IPv4 Reactive forwarding" )
1224 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1225 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1226 onpass="Successfully deactivated IPv4 fwd app",
1227 onfail="Failed to deactivate IPv4 fwd app" )
1228
Hari Krishnac195f3b2015-07-08 20:02:24 -07001229 def CASE5( self, main ):
1230 """
1231 Compare current ONOS topology with reference data
1232 """
1233 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001234
Hari Krishnac195f3b2015-07-08 20:02:24 -07001235 devicesDPIDTemp = []
1236 hostMACsTemp = []
1237 deviceLinksTemp = []
1238 deviceActiveLinksCountTemp = []
1239 devicePortsEnabledCountTemp = []
1240
1241 main.log.report(
1242 "Compare ONOS topology with reference data in Stores" )
1243 main.log.report( "__________________________________________________" )
1244 main.case( "Compare ONOS topology with reference data" )
1245
1246 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001247
GlennRC289c1b62015-12-12 10:45:43 -08001248 for check in range(main.topoCheck):
1249 time1 = time.time()
1250 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
1251 pool = []
1252 for cli in main.CLIs:
1253 if i >= main.numMNswitches + 1:
1254 break
GlennRC20fc6522015-12-23 23:26:57 -08001255 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001256 t = main.Thread(target = cli.getDevicePortsEnabledCount,
1257 threadID = main.threadID,
1258 name = "getDevicePortsEnabledCount",
1259 args = [dpid])
1260 t.start()
1261 pool.append(t)
1262 i = i + 1
1263 main.threadID = main.threadID + 1
1264 for thread in pool:
1265 thread.join()
1266 portResult = thread.result
1267 #portTemp = re.split( r'\t+', portResult )
1268 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1269 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001270
GlennRC289c1b62015-12-12 10:45:43 -08001271 time2 = time.time()
1272 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
1273 main.log.info (
1274 "Device Enabled ports EXPECTED: %s" %
1275 str( main.devicePortsEnabledCount ) )
1276 main.log.info (
1277 "Device Enabled ports ACTUAL: %s" %
1278 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001279
GlennRC289c1b62015-12-12 10:45:43 -08001280 if ( cmp( main.devicePortsEnabledCount,
1281 devicePortsEnabledCountTemp ) == 0 ):
1282 stepResult1 = main.TRUE
1283 else:
1284 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001285
GlennRC289c1b62015-12-12 10:45:43 -08001286 main.step( "Compare Device active links with reference" )
1287 time1 = time.time()
1288 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
1289 pool = []
1290 for cli in main.CLIs:
1291 if i >= main.numMNswitches + 1:
1292 break
GlennRC20fc6522015-12-23 23:26:57 -08001293 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001294 t = main.Thread(target = cli.getDeviceLinksActiveCount,
1295 threadID = main.threadID,
1296 name = "getDeviceLinksActiveCount",
1297 args = [dpid])
1298 t.start()
1299 pool.append(t)
1300 i = i + 1
1301 main.threadID = main.threadID + 1
1302 for thread in pool:
1303 thread.join()
1304 linkCountResult = thread.result
1305 #linkCountTemp = re.split( r'\t+', linkCountResult )
1306 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1307 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001308
GlennRC289c1b62015-12-12 10:45:43 -08001309 time2 = time.time()
1310 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
1311 main.log.info (
1312 "Device Active links EXPECTED: %s" %
1313 str( main.deviceActiveLinksCount ) )
1314 main.log.info (
1315 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1316 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1317 stepResult2 = main.TRUE
1318 else:
1319 stepResult2 = main.FALSE
1320
1321 """
1322 place holder for comparing devices, hosts, paths and intents if required.
1323 Links and ports data would be incorrect with out devices anyways.
1324 """
1325 caseResult = ( stepResult1 and stepResult2 )
1326
1327 if caseResult:
1328 break
1329 else:
1330 time.sleep( main.topoCheckDelay )
1331 main.log.warn( "Topology check failed. Trying again..." )
1332
1333
1334 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001335 onpass="Compare Topology test PASS",
1336 onfail="Compare Topology test FAIL" )
1337
1338 def CASE60( self ):
1339 """
1340 Install 300 host intents and verify ping all (Att Topology)
1341 """
1342 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1343 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001344 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001345
Hari Krishnac195f3b2015-07-08 20:02:24 -07001346 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001347 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001348 main.intentIds = list(intentIdList)
1349
GlennRCa8d786a2015-09-23 17:40:11 -07001350 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001351 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001352 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1353 onpass="INTENTS INSTALLED",
1354 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001355
1356 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001357 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001358 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1359 onpass="PING ALL PASS",
1360 onfail="PING ALL FAIL" )
1361
GlennRCbddd58f2015-10-01 15:45:25 -07001362 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001363 utilities.assert_equals(
1364 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001365 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001366 onpass="Install 300 Host Intents and Ping All test PASS",
1367 onfail="Install 300 Host Intents and Ping All test FAIL" )
1368
GlennRCfcfdc4f2015-09-30 16:01:57 -07001369 if not intentState:
1370 main.log.debug( "Intents failed to install completely" )
1371 if not pingResult:
1372 main.log.debug( "Pingall failed" )
1373
GlennRCbddd58f2015-10-01 15:45:25 -07001374 if not caseResult and main.failSwitch:
1375 main.log.report("Stopping test")
1376 main.stop( email=main.emailOnStop )
1377
Hari Krishnac195f3b2015-07-08 20:02:24 -07001378 def CASE61( self ):
1379 """
You Wang0779bac2016-01-27 16:32:33 -08001380 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001381 """
You Wang0779bac2016-01-27 16:32:33 -08001382 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001383 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001384 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001385
Hari Krishnac195f3b2015-07-08 20:02:24 -07001386 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001387 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001388 main.intentIds = list(intentIdList)
1389
GlennRCa8d786a2015-09-23 17:40:11 -07001390 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001391 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001392 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1393 onpass="INTENTS INSTALLED",
1394 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001395
1396 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001397 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001398 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1399 onpass="PING ALL PASS",
1400 onfail="PING ALL FAIL" )
1401
GlennRCbddd58f2015-10-01 15:45:25 -07001402 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001403 utilities.assert_equals( expect=main.TRUE,
1404 actual=caseResult,
1405 onpass="Install 300 Host Intents and Ping All test PASS",
1406 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001407
GlennRCfcfdc4f2015-09-30 16:01:57 -07001408 if not intentState:
1409 main.log.debug( "Intents failed to install completely" )
1410 if not pingResult:
1411 main.log.debug( "Pingall failed" )
1412
GlennRCbddd58f2015-10-01 15:45:25 -07001413 if not caseResult and main.failSwitch:
1414 main.log.report("Stopping test")
1415 main.stop( email=main.emailOnStop )
1416
Hari Krishnac195f3b2015-07-08 20:02:24 -07001417 def CASE62( self ):
1418 """
1419 Install 2278 host intents and verify ping all for Spine Topology
1420 """
1421 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1422 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001423 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001424
You Wangb6586542016-02-26 09:25:56 -08001425 main.step( "Add host Intents" )
1426 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001427 main.intentIds = list(intentIdList)
1428
GlennRCa8d786a2015-09-23 17:40:11 -07001429 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001430 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001431 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1432 onpass="INTENTS INSTALLED",
1433 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001434
1435 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001436 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001437 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1438 onpass="PING ALL PASS",
1439 onfail="PING ALL FAIL" )
1440
GlennRCbddd58f2015-10-01 15:45:25 -07001441 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001442 utilities.assert_equals( expect=main.TRUE,
1443 actual=caseResult,
1444 onpass="Install 2278 Host Intents and Ping All test PASS",
1445 onfail="Install 2278 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001446
GlennRCfcfdc4f2015-09-30 16:01:57 -07001447 if not intentState:
1448 main.log.debug( "Intents failed to install completely" )
1449 if not pingResult:
1450 main.log.debug( "Pingall failed" )
1451
GlennRCbddd58f2015-10-01 15:45:25 -07001452 if not caseResult and main.failSwitch:
1453 main.log.report("Stopping test")
1454 main.stop( email=main.emailOnStop )
1455
Hari Krishna4223dbd2015-08-13 16:29:53 -07001456 def CASE160( self ):
1457 """
1458 Verify IPv6 ping across 300 host intents (Att Topology)
1459 """
1460 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1461 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001462 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001463
Hari Krishna4223dbd2015-08-13 16:29:53 -07001464 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001465 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1466 utilities.assert_equals( expect=main.TRUE,
1467 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001468 onpass="PING ALL PASS",
1469 onfail="PING ALL FAIL" )
1470
GlennRCbddd58f2015-10-01 15:45:25 -07001471 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001472 utilities.assert_equals(
1473 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001474 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001475 onpass="IPv6 Ping across 300 host intents test PASS",
1476 onfail="IPv6 Ping across 300 host intents test FAIL" )
1477
You Wangb6586542016-02-26 09:25:56 -08001478 if not caseResult and main.failSwitch:
1479 main.log.report("Stopping test")
1480 main.stop( email=main.emailOnStop )
1481
Hari Krishna4223dbd2015-08-13 16:29:53 -07001482 def CASE161( self ):
1483 """
You Wang0779bac2016-01-27 16:32:33 -08001484 Verify IPv6 ping across 300 host intents (Chordal Topology)
Hari Krishna4223dbd2015-08-13 16:29:53 -07001485 """
You Wang0779bac2016-01-27 16:32:33 -08001486 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001487 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001488 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001489
Hari Krishna4223dbd2015-08-13 16:29:53 -07001490 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001491 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001492 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1493 onpass="PING ALL PASS",
1494 onfail="PING ALL FAIL" )
1495
GlennRCbddd58f2015-10-01 15:45:25 -07001496 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001497 utilities.assert_equals(
1498 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001499 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001500 onpass="IPv6 Ping across 300 host intents test PASS",
1501 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001502
You Wangb6586542016-02-26 09:25:56 -08001503 if not caseResult and main.failSwitch:
1504 main.log.report("Stopping test")
1505 main.stop( email=main.emailOnStop )
1506
Hari Krishna4223dbd2015-08-13 16:29:53 -07001507 def CASE162( self ):
1508 """
1509 Verify IPv6 ping across 2278 host intents (Spine Topology)
1510 """
1511 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1512 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001513 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001514
Hari Krishna4223dbd2015-08-13 16:29:53 -07001515 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001516 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001517 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1518 onpass="PING ALL PASS",
1519 onfail="PING ALL FAIL" )
1520
GlennRCbddd58f2015-10-01 15:45:25 -07001521 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001522 utilities.assert_equals(
1523 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001524 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001525 onpass="IPv6 Ping across 2278 host intents test PASS",
1526 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001527
You Wangb6586542016-02-26 09:25:56 -08001528 if not caseResult and main.failSwitch:
1529 main.log.report("Stopping test")
1530 main.stop( email=main.emailOnStop )
1531
Hari Krishnac195f3b2015-07-08 20:02:24 -07001532 def CASE70( self, main ):
1533 """
1534 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1535 """
1536 import random
1537 main.randomLink1 = []
1538 main.randomLink2 = []
1539 main.randomLink3 = []
1540 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1541 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1542 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1543 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1544 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1545 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1546 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001547
1548 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1549 main.log.report( "___________________________________________________________________________" )
1550 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1551 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1552 if ( int( switchLinksToToggle ) ==
1553 0 or int( switchLinksToToggle ) > 5 ):
1554 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1555 #main.cleanup()
1556 #main.exit()
1557 else:
1558 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1559
1560 main.step( "Cut links on Core devices using user provided range" )
1561 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1562 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1563 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1564 for i in range( int( switchLinksToToggle ) ):
1565 main.Mininet1.link(
1566 END1=link1End1,
1567 END2=main.randomLink1[ i ],
1568 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001569 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001570 main.Mininet1.link(
1571 END1=link2End1,
1572 END2=main.randomLink2[ i ],
1573 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001574 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575 main.Mininet1.link(
1576 END1=link3End1,
1577 END2=main.randomLink3[ i ],
1578 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001579 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001580
You Wang0779bac2016-01-27 16:32:33 -08001581 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001582 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1583 int( main.numMNlinks ) -
1584 int( switchLinksToToggle ) * 6 )
1585 utilities.assert_equals( expect=main.TRUE,
1586 actual=linkDown,
1587 onpass="Link down discovered properly",
1588 onfail="Link down was not discovered in " +
1589 str( main.linkSleep * main.linkCheck ) +
1590 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591
GlennRCfcfdc4f2015-09-30 16:01:57 -07001592 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001593 intentState = main.CHOtestFunctions.checkIntents()
1594 utilities.assert_equals( expect=main.TRUE,
1595 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001596 onpass="INTENTS INSTALLED",
1597 onfail="SOME INTENTS NOT INSTALLED" )
1598
Hari Krishnac195f3b2015-07-08 20:02:24 -07001599 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001600 pingResult = main.CHOtestFunctions.checkPingall()
1601 utilities.assert_equals( expect=main.TRUE,
1602 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001603 onpass="PING ALL PASS",
1604 onfail="PING ALL FAIL" )
1605
GlennRCbddd58f2015-10-01 15:45:25 -07001606 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001607 utilities.assert_equals( expect=main.TRUE,
1608 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001609 onpass="Random Link cut Test PASS",
1610 onfail="Random Link cut Test FAIL" )
1611
GlennRCfcfdc4f2015-09-30 16:01:57 -07001612 # Printing what exactly failed
1613 if not linkDown:
1614 main.log.debug( "Link down was not discovered correctly" )
1615 if not pingResult:
1616 main.log.debug( "Pingall failed" )
1617 if not intentState:
1618 main.log.debug( "Intents are not all installed" )
1619
GlennRCbddd58f2015-10-01 15:45:25 -07001620 if not caseResult and main.failSwitch:
1621 main.log.report("Stopping test")
1622 main.stop( email=main.emailOnStop )
1623
Hari Krishnac195f3b2015-07-08 20:02:24 -07001624 def CASE80( self, main ):
1625 """
1626 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1627 """
1628 import random
1629 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1630 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1631 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001632 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001633 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1634
1635 main.log.report(
1636 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1637 main.log.report(
1638 "__________________________________________________________________" )
1639 main.case(
1640 "Host intents - Bring the core links up that are down and verify ping all" )
1641 main.step( "Bring randomly cut links on Core devices up" )
1642 for i in range( int( switchLinksToToggle ) ):
1643 main.Mininet1.link(
1644 END1=link1End1,
1645 END2=main.randomLink1[ i ],
1646 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001647 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001648 main.Mininet1.link(
1649 END1=link2End1,
1650 END2=main.randomLink2[ i ],
1651 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001652 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001653 main.Mininet1.link(
1654 END1=link3End1,
1655 END2=main.randomLink3[ i ],
1656 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001657 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001658
You Wang0779bac2016-01-27 16:32:33 -08001659 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001660 linkUp = main.CHOtestFunctions.checkLinkEvents( "up",
1661 int( main.numMNlinks ) )
1662 utilities.assert_equals( expect=main.TRUE,
1663 actual=linkUp,
1664 onpass="Link up discovered properly",
1665 onfail="Link up was not discovered in " +
1666 str( main.linkSleep * main.linkCheck ) +
1667 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001668
GlennRCfcfdc4f2015-09-30 16:01:57 -07001669 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001670 intentState = main.CHOtestFunctions.checkIntents()
1671 utilities.assert_equals( expect=main.TRUE,
1672 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001673 onpass="INTENTS INSTALLED",
1674 onfail="SOME INTENTS NOT INSTALLED" )
1675
Hari Krishnac195f3b2015-07-08 20:02:24 -07001676 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001677 pingResult = main.CHOtestFunctions.checkPingall()
1678 utilities.assert_equals( expect=main.TRUE,
1679 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001680 onpass="PING ALL PASS",
1681 onfail="PING ALL FAIL" )
1682
GlennRCbddd58f2015-10-01 15:45:25 -07001683 caseResult = linkUp and pingResult
1684 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001685 onpass="Link Up Test PASS",
1686 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001687 # Printing what exactly failed
1688 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001689 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001690 if not pingResult:
1691 main.log.debug( "Pingall failed" )
1692 if not intentState:
1693 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001694
GlennRCbddd58f2015-10-01 15:45:25 -07001695 if not caseResult and main.failSwitch:
1696 main.log.report("Stopping test")
1697 main.stop( email=main.emailOnStop )
1698
Hari Krishnac195f3b2015-07-08 20:02:24 -07001699 def CASE71( self, main ):
1700 """
1701 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1702 """
1703 import random
1704 main.randomLink1 = []
1705 main.randomLink2 = []
1706 main.randomLink3 = []
1707 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1708 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1709 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1710 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1711 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1712 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1713 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
You Wangb6586542016-02-26 09:25:56 -08001714 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001715
1716 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1717 main.log.report( "___________________________________________________________________________" )
1718 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1719 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1720 if ( int( switchLinksToToggle ) ==
1721 0 or int( switchLinksToToggle ) > 5 ):
1722 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1723 #main.cleanup()
1724 #main.exit()
1725 else:
1726 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1727
1728 main.step( "Cut links on Core devices using user provided range" )
1729 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1730 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1731 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1732 for i in range( int( switchLinksToToggle ) ):
1733 main.Mininet1.link(
1734 END1=link1End1,
1735 END2=main.randomLink1[ i ],
1736 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001737 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001738 main.Mininet1.link(
1739 END1=link2End1,
1740 END2=main.randomLink2[ i ],
1741 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001742 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001743 main.Mininet1.link(
1744 END1=link3End1,
1745 END2=main.randomLink3[ i ],
1746 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001747 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001748
You Wang0779bac2016-01-27 16:32:33 -08001749 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001750 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1751 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 )
1752 utilities.assert_equals( expect=main.TRUE,
1753 actual=linkDown,
1754 onpass="Link down discovered properly",
1755 onfail="Link down was not discovered in " +
1756 str( main.linkSleep * main.linkCheck ) +
1757 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001758
GlennRCfcfdc4f2015-09-30 16:01:57 -07001759 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001760 intentState = main.CHOtestFunctions.checkIntents()
1761 utilities.assert_equals( expect=main.TRUE,
1762 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001763 onpass="INTENTS INSTALLED",
1764 onfail="SOME INTENTS NOT INSTALLED" )
1765
Hari Krishnac195f3b2015-07-08 20:02:24 -07001766 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001767 pingResult = main.CHOtestFunctions.checkPingall()
1768 utilities.assert_equals( expect=main.TRUE,
1769 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001770 onpass="PING ALL PASS",
1771 onfail="PING ALL FAIL" )
1772
GlennRCbddd58f2015-10-01 15:45:25 -07001773 caseResult = linkDown and pingResult and intentState
1774 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001775 onpass="Random Link cut Test PASS",
1776 onfail="Random Link cut Test FAIL" )
1777
GlennRCfcfdc4f2015-09-30 16:01:57 -07001778 # Printing what exactly failed
1779 if not linkDown:
1780 main.log.debug( "Link down was not discovered correctly" )
1781 if not pingResult:
1782 main.log.debug( "Pingall failed" )
1783 if not intentState:
1784 main.log.debug( "Intents are not all installed" )
1785
GlennRCbddd58f2015-10-01 15:45:25 -07001786 if not caseResult and main.failSwitch:
1787 main.log.report("Stopping test")
1788 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001789
Hari Krishnac195f3b2015-07-08 20:02:24 -07001790 def CASE81( self, main ):
1791 """
1792 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1793 """
1794 import random
1795 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1796 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1797 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001798 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001799 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1800
1801 main.log.report(
1802 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1803 main.log.report(
1804 "__________________________________________________________________" )
1805 main.case(
1806 "Point intents - Bring the core links up that are down and verify ping all" )
1807 main.step( "Bring randomly cut links on Core devices up" )
1808 for i in range( int( switchLinksToToggle ) ):
1809 main.Mininet1.link(
1810 END1=link1End1,
1811 END2=main.randomLink1[ i ],
1812 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001813 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001814 main.Mininet1.link(
1815 END1=link2End1,
1816 END2=main.randomLink2[ i ],
1817 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001818 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819 main.Mininet1.link(
1820 END1=link3End1,
1821 END2=main.randomLink3[ i ],
1822 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001823 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824
You Wang0779bac2016-01-27 16:32:33 -08001825 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001826 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1827 utilities.assert_equals( expect=main.TRUE,
1828 actual=linkUp,
1829 onpass="Link up discovered properly",
1830 onfail="Link up was not discovered in " +
1831 str( main.linkSleep * main.linkCheck ) +
1832 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001833
GlennRCfcfdc4f2015-09-30 16:01:57 -07001834 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001835 intentState = main.CHOtestFunctions.checkIntents()
1836 utilities.assert_equals( expect=main.TRUE,
1837 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001838 onpass="INTENTS INSTALLED",
1839 onfail="SOME INTENTS NOT INSTALLED" )
1840
Hari Krishnac195f3b2015-07-08 20:02:24 -07001841 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001842 pingResult = main.CHOtestFunctions.checkPingall()
1843 utilities.assert_equals( expect=main.TRUE,
1844 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001845 onpass="PING ALL PASS",
1846 onfail="PING ALL FAIL" )
1847
GlennRCbddd58f2015-10-01 15:45:25 -07001848 caseResult = linkUp and pingResult
1849 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001850 onpass="Link Up Test PASS",
1851 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001852 # Printing what exactly failed
1853 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001854 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001855 if not pingResult:
1856 main.log.debug( "Pingall failed" )
1857 if not intentState:
1858 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001859
GlennRCbddd58f2015-10-01 15:45:25 -07001860 if not caseResult and main.failSwitch:
1861 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001862 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001863
Hari Krishnac195f3b2015-07-08 20:02:24 -07001864 def CASE72( self, main ):
1865 """
1866 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1867 """
1868 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001869 import itertools
You Wangb6586542016-02-26 09:25:56 -08001870 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001871
Hari Krishnac195f3b2015-07-08 20:02:24 -07001872 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1873 main.log.report( "___________________________________________________________________________" )
1874 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1875 switches = []
1876 switchesComb = []
1877 for i in range( main.numMNswitches ):
1878 switches.append('s%d'%(i+1))
1879 switchesLinksComb = list(itertools.combinations(switches,2))
1880 main.randomLinks = random.sample(switchesLinksComb, 5 )
1881 print main.randomLinks
1882 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001883
Hari Krishnac195f3b2015-07-08 20:02:24 -07001884 for switch in main.randomLinks:
1885 main.Mininet1.link(
1886 END1=switch[0],
1887 END2=switch[1],
1888 OPTION="down")
You Wangb6586542016-02-26 09:25:56 -08001889 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001890
You Wang0779bac2016-01-27 16:32:33 -08001891 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001892 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1893 utilities.assert_equals( expect=main.TRUE,
1894 actual=linkDown,
1895 onpass="Link down discovered properly",
1896 onfail="Link down was not discovered in " +
1897 str( main.linkSleep * main.linkCheck ) +
1898 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001899
GlennRCfcfdc4f2015-09-30 16:01:57 -07001900 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001901 intentState = main.CHOtestFunctions.checkIntents()
1902 utilities.assert_equals( expect=main.TRUE,
1903 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001904 onpass="INTENTS INSTALLED",
1905 onfail="SOME INTENTS NOT INSTALLED" )
1906
Hari Krishnac195f3b2015-07-08 20:02:24 -07001907 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001908 pingResult = main.CHOtestFunctions.checkPingall()
1909 utilities.assert_equals( expect=main.TRUE,
1910 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001911 onpass="PING ALL PASS",
1912 onfail="PING ALL FAIL" )
1913
GlennRCbddd58f2015-10-01 15:45:25 -07001914 caseResult = linkDown and pingResult and intentState
1915 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001916 onpass="Random Link cut Test PASS",
1917 onfail="Random Link cut Test FAIL" )
1918
GlennRCfcfdc4f2015-09-30 16:01:57 -07001919 # Printing what exactly failed
1920 if not linkDown:
1921 main.log.debug( "Link down was not discovered correctly" )
1922 if not pingResult:
1923 main.log.debug( "Pingall failed" )
1924 if not intentState:
1925 main.log.debug( "Intents are not all installed" )
1926
GlennRCbddd58f2015-10-01 15:45:25 -07001927 if not caseResult and main.failSwitch:
1928 main.log.report("Stopping test")
1929 main.stop( email=main.emailOnStop )
1930
Hari Krishnac195f3b2015-07-08 20:02:24 -07001931 def CASE82( self, main ):
1932 """
1933 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1934 """
1935 import random
You Wangb6586542016-02-26 09:25:56 -08001936 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001937
Hari Krishnac195f3b2015-07-08 20:02:24 -07001938 main.log.report(
1939 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1940 main.log.report(
1941 "__________________________________________________________________" )
1942 main.case(
1943 "Host intents - Bring the core links up that are down and verify ping all" )
1944 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001945
Hari Krishnac195f3b2015-07-08 20:02:24 -07001946 for switch in main.randomLinks:
1947 main.Mininet1.link(
1948 END1=switch[0],
1949 END2=switch[1],
1950 OPTION="up")
You Wangb6586542016-02-26 09:25:56 -08001951 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001952
You Wang0779bac2016-01-27 16:32:33 -08001953 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001954 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1955 utilities.assert_equals( expect=main.TRUE,
1956 actual=linkUp,
1957 onpass="Link up discovered properly",
1958 onfail="Link up was not discovered in " +
1959 str( main.linkSleep * main.linkCheck ) +
1960 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001961
GlennRCfcfdc4f2015-09-30 16:01:57 -07001962 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001963 intentState = main.CHOtestFunctions.checkIntents()
1964 utilities.assert_equals( expect=main.TRUE,
1965 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001966 onpass="INTENTS INSTALLED",
1967 onfail="SOME INTENTS NOT INSTALLED" )
1968
Hari Krishnac195f3b2015-07-08 20:02:24 -07001969 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001970 pingResult = main.CHOtestFunctions.checkPingall()
1971 utilities.assert_equals( expect=main.TRUE,
1972 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001973 onpass="PING ALL PASS",
1974 onfail="PING ALL FAIL" )
1975
GlennRCbddd58f2015-10-01 15:45:25 -07001976 caseResult = linkUp and pingResult
1977 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001978 onpass="Link Up Test PASS",
1979 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001980 # Printing what exactly failed
1981 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001982 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001983 if not pingResult:
1984 main.log.debug( "Pingall failed" )
1985 if not intentState:
1986 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001987
GlennRCbddd58f2015-10-01 15:45:25 -07001988 if not caseResult and main.failSwitch:
1989 main.log.report("Stopping test")
1990 main.stop( email=main.emailOnStop )
1991
Hari Krishnac195f3b2015-07-08 20:02:24 -07001992 def CASE73( self, main ):
1993 """
1994 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1995 """
1996 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001997 import itertools
You Wangb6586542016-02-26 09:25:56 -08001998 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001999
Hari Krishnac195f3b2015-07-08 20:02:24 -07002000 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2001 main.log.report( "___________________________________________________________________________" )
2002 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2003 switches = []
2004 switchesComb = []
2005 for i in range( main.numMNswitches ):
2006 switches.append('s%d'%(i+1))
2007 switchesLinksComb = list(itertools.combinations(switches,2))
2008 main.randomLinks = random.sample(switchesLinksComb, 5 )
2009 print main.randomLinks
2010 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002011
Hari Krishnac195f3b2015-07-08 20:02:24 -07002012 for switch in main.randomLinks:
2013 main.Mininet1.link(
2014 END1=switch[0],
2015 END2=switch[1],
2016 OPTION="down")
You Wangb6586542016-02-26 09:25:56 -08002017 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002018
You Wang0779bac2016-01-27 16:32:33 -08002019 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002020 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
2021 utilities.assert_equals( expect=main.TRUE,
2022 actual=linkDown,
2023 onpass="Link down discovered properly",
2024 onfail="Link down was not discovered in " +
2025 str( main.linkSleep * main.linkCheck ) +
2026 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002027
GlennRCfcfdc4f2015-09-30 16:01:57 -07002028 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002029 intentState = main.CHOtestFunctions.checkIntents()
2030 utilities.assert_equals( expect=main.TRUE,
2031 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002032 onpass="INTENTS INSTALLED",
2033 onfail="SOME INTENTS NOT INSTALLED" )
2034
Hari Krishnac195f3b2015-07-08 20:02:24 -07002035 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002036 pingResult = main.CHOtestFunctions.checkPingall()
2037 utilities.assert_equals( expect=main.TRUE,
2038 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002039 onpass="PING ALL PASS",
2040 onfail="PING ALL FAIL" )
2041
GlennRCbddd58f2015-10-01 15:45:25 -07002042 caseResult = linkDown and pingResult and intentState
2043 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002044 onpass="Random Link cut Test PASS",
2045 onfail="Random Link cut Test FAIL" )
2046
GlennRCfcfdc4f2015-09-30 16:01:57 -07002047 # Printing what exactly failed
2048 if not linkDown:
2049 main.log.debug( "Link down was not discovered correctly" )
2050 if not pingResult:
2051 main.log.debug( "Pingall failed" )
2052 if not intentState:
2053 main.log.debug( "Intents are not all installed" )
2054
GlennRCbddd58f2015-10-01 15:45:25 -07002055 if not caseResult and main.failSwitch:
2056 main.log.report("Stopping test")
2057 main.stop( email=main.emailOnStop )
2058
Hari Krishnac195f3b2015-07-08 20:02:24 -07002059 def CASE83( self, main ):
2060 """
2061 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2062 """
2063 import random
You Wangb6586542016-02-26 09:25:56 -08002064 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002065
Hari Krishnac195f3b2015-07-08 20:02:24 -07002066 main.log.report(
2067 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2068 main.log.report(
2069 "__________________________________________________________________" )
2070 main.case(
2071 "Point intents - Bring the core links up that are down and verify ping all" )
2072 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002073
Hari Krishnac195f3b2015-07-08 20:02:24 -07002074 for switch in main.randomLinks:
2075 main.Mininet1.link(
2076 END1=switch[0],
2077 END2=switch[1],
2078 OPTION="up")
You Wangb6586542016-02-26 09:25:56 -08002079 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002080
You Wang0779bac2016-01-27 16:32:33 -08002081 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002082 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2083 utilities.assert_equals( expect=main.TRUE,
2084 actual=linkUp,
2085 onpass="Link up discovered properly",
2086 onfail="Link up was not discovered in " +
2087 str( main.linkSleep * main.linkCheck ) +
2088 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002089
GlennRCfcfdc4f2015-09-30 16:01:57 -07002090 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002091 intentState = main.CHOtestFunctions.checkIntents()
2092 utilities.assert_equals( expect=main.TRUE,
2093 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002094 onpass="INTENTS INSTALLED",
2095 onfail="SOME INTENTS NOT INSTALLED" )
2096
Hari Krishnac195f3b2015-07-08 20:02:24 -07002097 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002098 pingResult = main.CHOtestFunctions.checkPingall()
2099 utilities.assert_equals( expect=main.TRUE,
2100 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002101 onpass="PING ALL PASS",
2102 onfail="PING ALL FAIL" )
2103
GlennRCbddd58f2015-10-01 15:45:25 -07002104 caseResult = linkUp and pingResult
2105 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002106 onpass="Link Up Test PASS",
2107 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002108 # Printing what exactly failed
2109 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002110 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002111 if not pingResult:
2112 main.log.debug( "Pingall failed" )
2113 if not intentState:
2114 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002115
GlennRCbddd58f2015-10-01 15:45:25 -07002116 if not caseResult and main.failSwitch:
2117 main.log.report("Stopping test")
2118 main.stop( email=main.emailOnStop )
2119
Hari Krishnac195f3b2015-07-08 20:02:24 -07002120 def CASE74( self, main ):
2121 """
2122 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2123 """
2124 import random
2125 main.randomLink1 = []
2126 main.randomLink2 = []
2127 main.randomLink3 = []
2128 main.randomLink4 = []
2129 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2130 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2131 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2132 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2133 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2134 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002135 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002136
Hari Krishnac195f3b2015-07-08 20:02:24 -07002137 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2138 main.log.report( "___________________________________________________________________________" )
Jon Hall6509dbf2016-06-21 17:01:17 -07002139 main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002140
2141 main.step( "Bring some core links down" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002142 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002143 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002144 linkIndex.remove(linkIndexS9)
2145 linkIndexS10 = random.sample(linkIndex,1)[0]
2146 main.randomLink1 = link1End2top[linkIndexS9]
2147 main.randomLink2 = link2End2top[linkIndexS10]
2148 main.randomLink3 = random.sample(link1End2bot,1)[0]
2149 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002150
2151 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002152 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2153 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2154 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002155 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002156 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002157 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002158
You Wangb6586542016-02-26 09:25:56 -08002159 main.step( "Verify link down is discoverd by onos" )
2160 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2161 utilities.assert_equals( expect=main.TRUE,
2162 actual=linkDown,
2163 onpass="Link down discovered properly",
2164 onfail="Link down was not discovered in " +
2165 str( main.linkSleep * main.linkCheck ) +
2166 " seconds" )
You Wang0779bac2016-01-27 16:32:33 -08002167
You Wangb6586542016-02-26 09:25:56 -08002168 main.step( "Verify intents are installed" )
2169 intentState = main.CHOtestFunctions.checkIntents()
2170 utilities.assert_equals( expect=main.TRUE,
2171 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002172 onpass="INTENTS INSTALLED",
2173 onfail="SOME INTENTS NOT INSTALLED" )
2174
Hari Krishnac195f3b2015-07-08 20:02:24 -07002175 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002176 pingResult = main.CHOtestFunctions.checkPingall()
2177 utilities.assert_equals( expect=main.TRUE,
2178 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002179 onpass="PING ALL PASS",
2180 onfail="PING ALL FAIL" )
2181
GlennRCbddd58f2015-10-01 15:45:25 -07002182 caseResult = linkDown and pingResult and intentState
2183 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002184 onpass="Random Link cut Test PASS",
2185 onfail="Random Link cut Test FAIL" )
2186
GlennRCfcfdc4f2015-09-30 16:01:57 -07002187 # Printing what exactly failed
2188 if not linkDown:
2189 main.log.debug( "Link down was not discovered correctly" )
2190 if not pingResult:
2191 main.log.debug( "Pingall failed" )
2192 if not intentState:
2193 main.log.debug( "Intents are not all installed" )
2194
GlennRCbddd58f2015-10-01 15:45:25 -07002195 if not caseResult and main.failSwitch:
2196 main.log.report("Stopping test")
2197 main.stop( email=main.emailOnStop )
2198
Hari Krishnac195f3b2015-07-08 20:02:24 -07002199 def CASE84( self, main ):
2200 """
2201 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2202 """
2203 import random
2204 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2205 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002206 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002207 main.log.report(
2208 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2209 main.log.report(
2210 "__________________________________________________________________" )
2211 main.case(
2212 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002213
You Wang0779bac2016-01-27 16:32:33 -08002214 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002215 # Work around for link state propagation delay. Added some sleep time.
2216 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2217 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002218 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002219 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002220 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002221 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002222
You Wang0779bac2016-01-27 16:32:33 -08002223 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002224 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2225 utilities.assert_equals( expect=main.TRUE,
2226 actual=linkUp,
2227 onpass="Link up discovered properly",
2228 onfail="Link up was not discovered in " +
2229 str( main.linkSleep * main.linkCheck ) +
2230 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002231
GlennRCfcfdc4f2015-09-30 16:01:57 -07002232 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002233 intentState = main.CHOtestFunctions.checkIntents()
2234 utilities.assert_equals( expect=main.TRUE,
2235 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002236 onpass="INTENTS INSTALLED",
2237 onfail="SOME INTENTS NOT INSTALLED" )
2238
Hari Krishnac195f3b2015-07-08 20:02:24 -07002239 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002240 pingResult = main.CHOtestFunctions.checkPingall()
2241 utilities.assert_equals( expect=main.TRUE,
2242 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002243 onpass="PING ALL PASS",
2244 onfail="PING ALL FAIL" )
2245
GlennRCbddd58f2015-10-01 15:45:25 -07002246 caseResult = linkUp and pingResult
2247 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002248 onpass="Link Up Test PASS",
2249 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002250 # Printing what exactly failed
2251 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002252 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002253 if not pingResult:
2254 main.log.debug( "Pingall failed" )
2255 if not intentState:
2256 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002257
GlennRCbddd58f2015-10-01 15:45:25 -07002258 if not caseResult and main.failSwitch:
2259 main.log.report("Stopping test")
2260 main.stop( email=main.emailOnStop )
2261
Hari Krishnab79d0822015-08-20 09:48:43 -07002262 def CASE75( self, main ):
2263 """
2264 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2265 """
2266 import random
2267 main.randomLink1 = []
2268 main.randomLink2 = []
2269 main.randomLink3 = []
2270 main.randomLink4 = []
2271 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2272 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2273 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2274 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2275 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2276 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002277 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002278
2279 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2280 main.log.report( "___________________________________________________________________________" )
2281 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002282
2283 main.step( "Bring some core links down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002284 linkIndex = range(4)
2285 linkIndexS9 = random.sample(linkIndex,1)[0]
2286 linkIndex.remove(linkIndexS9)
2287 linkIndexS10 = random.sample(linkIndex,1)[0]
2288 main.randomLink1 = link1End2top[linkIndexS9]
2289 main.randomLink2 = link2End2top[linkIndexS10]
2290 main.randomLink3 = random.sample(link1End2bot,1)[0]
2291 main.randomLink4 = random.sample(link2End2bot,1)[0]
2292
2293 # Work around for link state propagation delay. Added some sleep time.
2294 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2295 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2296 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002297 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002298 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002299 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002300
You Wang0779bac2016-01-27 16:32:33 -08002301 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002302 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2303 utilities.assert_equals( expect=main.TRUE,
2304 actual=linkDown,
2305 onpass="Link down discovered properly",
2306 onfail="Link down was not discovered in " +
2307 str( main.linkSleep * main.linkCheck ) +
2308 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002309
GlennRCfcfdc4f2015-09-30 16:01:57 -07002310 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002311 intentState = main.CHOtestFunctions.checkIntents()
2312 utilities.assert_equals( expect=main.TRUE,
2313 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002314 onpass="INTENTS INSTALLED",
2315 onfail="SOME INTENTS NOT INSTALLED" )
2316
Hari Krishnab79d0822015-08-20 09:48:43 -07002317 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002318 pingResult = main.CHOtestFunctions.checkPingall()
2319 utilities.assert_equals( expect=main.TRUE,
2320 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002321 onpass="PING ALL PASS",
2322 onfail="PING ALL FAIL" )
2323
GlennRCbddd58f2015-10-01 15:45:25 -07002324 caseResult = linkDown and pingResult and intentState
2325 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002326 onpass="Random Link cut Test PASS",
2327 onfail="Random Link cut Test FAIL" )
2328
GlennRCfcfdc4f2015-09-30 16:01:57 -07002329 # Printing what exactly failed
2330 if not linkDown:
2331 main.log.debug( "Link down was not discovered correctly" )
2332 if not pingResult:
2333 main.log.debug( "Pingall failed" )
2334 if not intentState:
2335 main.log.debug( "Intents are not all installed" )
2336
GlennRCbddd58f2015-10-01 15:45:25 -07002337 if not caseResult and main.failSwitch:
2338 main.log.report("Stopping test")
2339 main.stop( email=main.emailOnStop )
2340
Hari Krishnab79d0822015-08-20 09:48:43 -07002341 def CASE85( self, main ):
2342 """
2343 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2344 """
2345 import random
2346 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2347 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002348 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002349 main.log.report(
2350 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2351 main.log.report(
2352 "__________________________________________________________________" )
2353 main.case(
2354 "Point intents - Bring the core links up that are down and verify ping all" )
2355
You Wang0779bac2016-01-27 16:32:33 -08002356 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002357 # Work around for link state propagation delay. Added some sleep time.
2358 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2359 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2360 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002361 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002362 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002363 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002364
You Wang0779bac2016-01-27 16:32:33 -08002365 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002366 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2367 utilities.assert_equals( expect=main.TRUE,
2368 actual=linkUp,
2369 onpass="Link up discovered properly",
2370 onfail="Link up was not discovered in " +
2371 str( main.linkSleep * main.linkCheck ) +
2372 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002373
GlennRCfcfdc4f2015-09-30 16:01:57 -07002374 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002375 intentState = main.CHOtestFunctions.checkIntents()
2376 utilities.assert_equals( expect=main.TRUE,
2377 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002378 onpass="INTENTS INSTALLED",
2379 onfail="SOME INTENTS NOT INSTALLED" )
2380
Hari Krishnab79d0822015-08-20 09:48:43 -07002381 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002382 pingResult = main.CHOtestFunctions.checkPingall()
2383 utilities.assert_equals( expect=main.TRUE,
2384 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002385 onpass="PING ALL PASS",
2386 onfail="PING ALL FAIL" )
2387
GlennRCbddd58f2015-10-01 15:45:25 -07002388 caseResult = linkUp and pingResult
2389 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002390 onpass="Link Up Test PASS",
2391 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002392 # Printing what exactly failed
2393 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002394 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002395 if not pingResult:
2396 main.log.debug( "Pingall failed" )
2397 if not intentState:
2398 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002399
GlennRCbddd58f2015-10-01 15:45:25 -07002400 if not caseResult and main.failSwitch:
2401 main.log.report("Stopping test")
2402 main.stop( email=main.emailOnStop )
2403
Hari Krishna4223dbd2015-08-13 16:29:53 -07002404 def CASE170( self ):
2405 """
2406 IPv6 ping all with some core links down( Host Intents-Att Topo)
2407 """
2408 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2409 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002410 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002411
Hari Krishna4223dbd2015-08-13 16:29:53 -07002412 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002413 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2414 utilities.assert_equals( expect=main.TRUE,
2415 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002416 onpass="PING ALL PASS",
2417 onfail="PING ALL FAIL" )
2418
GlennRCbddd58f2015-10-01 15:45:25 -07002419 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002420 utilities.assert_equals(
2421 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002422 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002423 onpass="IPv6 Ping across 300 host intents test PASS",
2424 onfail="IPv6 Ping across 300 host intents test FAIL" )
2425
You Wangb6586542016-02-26 09:25:56 -08002426 if not caseResult and main.failSwitch:
2427 main.log.report("Stopping test")
2428 main.stop( email=main.emailOnStop )
2429
Hari Krishna4223dbd2015-08-13 16:29:53 -07002430 def CASE180( self ):
2431 """
2432 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2433 """
2434 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2435 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002436 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002437
Hari Krishna4223dbd2015-08-13 16:29:53 -07002438 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002439 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2440 utilities.assert_equals( expect=main.TRUE,
2441 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002442 onpass="PING ALL PASS",
2443 onfail="PING ALL FAIL" )
2444
GlennRCbddd58f2015-10-01 15:45:25 -07002445 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002446 utilities.assert_equals(
2447 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002448 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002449 onpass="IPv6 Ping across 300 host intents test PASS",
2450 onfail="IPv6 Ping across 300 host intents test FAIL" )
2451
You Wangb6586542016-02-26 09:25:56 -08002452 if not caseResult and main.failSwitch:
2453 main.log.report("Stopping test")
2454 main.stop( email=main.emailOnStop )
2455
Hari Krishna4223dbd2015-08-13 16:29:53 -07002456 def CASE171( self ):
2457 """
2458 IPv6 ping all with some core links down( Point Intents-Att Topo)
2459 """
2460 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2461 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002462 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002463
Hari Krishna4223dbd2015-08-13 16:29:53 -07002464 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002465 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2466 utilities.assert_equals( expect=main.TRUE,
2467 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002468 onpass="PING ALL PASS",
2469 onfail="PING ALL FAIL" )
2470
GlennRCbddd58f2015-10-01 15:45:25 -07002471 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002472 utilities.assert_equals(
2473 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002474 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002475 onpass="IPv6 Ping across 600 point intents test PASS",
2476 onfail="IPv6 Ping across 600 point intents test FAIL" )
2477
You Wangb6586542016-02-26 09:25:56 -08002478 if not caseResult and main.failSwitch:
2479 main.log.report("Stopping test")
2480 main.stop( email=main.emailOnStop )
2481
Hari Krishna4223dbd2015-08-13 16:29:53 -07002482 def CASE181( self ):
2483 """
2484 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2485 """
2486 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2487 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002488 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002489
Hari Krishna4223dbd2015-08-13 16:29:53 -07002490 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002491 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2492 utilities.assert_equals( expect=main.TRUE,
2493 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002494 onpass="PING ALL PASS",
2495 onfail="PING ALL FAIL" )
2496
GlennRCbddd58f2015-10-01 15:45:25 -07002497 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002498 utilities.assert_equals(
2499 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002500 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002501 onpass="IPv6 Ping across 600 Point intents test PASS",
2502 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2503
You Wangb6586542016-02-26 09:25:56 -08002504 if not caseResult and main.failSwitch:
2505 main.log.report("Stopping test")
2506 main.stop( email=main.emailOnStop )
2507
Hari Krishna4223dbd2015-08-13 16:29:53 -07002508 def CASE172( self ):
2509 """
2510 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2511 """
2512 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2513 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002514 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002515
Hari Krishna4223dbd2015-08-13 16:29:53 -07002516 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002517 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2518 utilities.assert_equals( expect=main.TRUE,
2519 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002520 onpass="PING ALL PASS",
2521 onfail="PING ALL FAIL" )
2522
GlennRCbddd58f2015-10-01 15:45:25 -07002523 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002524 utilities.assert_equals(
2525 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002526 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002527 onpass="IPv6 Ping across 300 host intents test PASS",
2528 onfail="IPv6 Ping across 300 host intents test FAIL" )
2529
2530 def CASE182( self ):
2531 """
2532 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2533 """
2534 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2535 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002536 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002537
Hari Krishna4223dbd2015-08-13 16:29:53 -07002538 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002539 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2540 utilities.assert_equals( expect=main.TRUE,
2541 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002542 onpass="PING ALL PASS",
2543 onfail="PING ALL FAIL" )
2544
GlennRCbddd58f2015-10-01 15:45:25 -07002545 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002546 utilities.assert_equals(
2547 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002548 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002549 onpass="IPv6 Ping across 300 host intents test PASS",
2550 onfail="IPv6 Ping across 300 host intents test FAIL" )
2551
You Wangb6586542016-02-26 09:25:56 -08002552 if not caseResult and main.failSwitch:
2553 main.log.report("Stopping test")
2554 main.stop( email=main.emailOnStop )
2555
Hari Krishna4223dbd2015-08-13 16:29:53 -07002556 def CASE173( self ):
2557 """
2558 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2559 """
2560 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2561 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002562 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002563
Hari Krishna4223dbd2015-08-13 16:29:53 -07002564 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002565 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2566 utilities.assert_equals( expect=main.TRUE,
2567 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002568 onpass="PING ALL PASS",
2569 onfail="PING ALL FAIL" )
2570
GlennRCbddd58f2015-10-01 15:45:25 -07002571 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002572 utilities.assert_equals(
2573 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002574 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002575 onpass="IPv6 Ping across 600 point intents test PASS",
2576 onfail="IPv6 Ping across 600 point intents test FAIL" )
2577
You Wangb6586542016-02-26 09:25:56 -08002578 if not caseResult and main.failSwitch:
2579 main.log.report("Stopping test")
2580 main.stop( email=main.emailOnStop )
2581
Hari Krishna4223dbd2015-08-13 16:29:53 -07002582 def CASE183( self ):
2583 """
2584 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2585 """
2586 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2587 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002588 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002589
Hari Krishna4223dbd2015-08-13 16:29:53 -07002590 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002591 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2592 utilities.assert_equals( expect=main.TRUE,
2593 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002594 onpass="PING ALL PASS",
2595 onfail="PING ALL FAIL" )
2596
GlennRCbddd58f2015-10-01 15:45:25 -07002597 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002598 utilities.assert_equals(
2599 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002600 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002601 onpass="IPv6 Ping across 600 Point intents test PASS",
2602 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2603
You Wangb6586542016-02-26 09:25:56 -08002604 if not caseResult and main.failSwitch:
2605 main.log.report("Stopping test")
2606 main.stop( email=main.emailOnStop )
2607
Hari Krishna4223dbd2015-08-13 16:29:53 -07002608 def CASE174( self ):
2609 """
2610 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2611 """
2612 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2613 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002614 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002615
Hari Krishna4223dbd2015-08-13 16:29:53 -07002616 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002617 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2618 utilities.assert_equals( expect=main.TRUE,
2619 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002620 onpass="PING ALL PASS",
2621 onfail="PING ALL FAIL" )
2622
GlennRCbddd58f2015-10-01 15:45:25 -07002623 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002624 utilities.assert_equals(
2625 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002626 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002627 onpass="IPv6 Ping across 2278 host intents test PASS",
2628 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2629
You Wangb6586542016-02-26 09:25:56 -08002630 if not caseResult and main.failSwitch:
2631 main.log.report("Stopping test")
2632 main.stop( email=main.emailOnStop )
2633
Hari Krishna4223dbd2015-08-13 16:29:53 -07002634 def CASE184( self ):
2635 """
2636 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2637 """
2638 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2639 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002640 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002641
Hari Krishna4223dbd2015-08-13 16:29:53 -07002642 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002643 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2644 utilities.assert_equals( expect=main.TRUE,
2645 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002646 onpass="PING ALL PASS",
2647 onfail="PING ALL FAIL" )
2648
GlennRCbddd58f2015-10-01 15:45:25 -07002649 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002650 utilities.assert_equals(
2651 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002652 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002653 onpass="IPv6 Ping across 2278 host intents test PASS",
2654 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2655
You Wangb6586542016-02-26 09:25:56 -08002656 if not caseResult and main.failSwitch:
2657 main.log.report("Stopping test")
2658 main.stop( email=main.emailOnStop )
2659
Hari Krishna4223dbd2015-08-13 16:29:53 -07002660 def CASE175( self ):
2661 """
2662 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2663 """
2664 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2665 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002666 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002667
Hari Krishna4223dbd2015-08-13 16:29:53 -07002668 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002669 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2670 utilities.assert_equals( expect=main.TRUE,
2671 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002672 onpass="PING ALL PASS",
2673 onfail="PING ALL FAIL" )
2674
GlennRCbddd58f2015-10-01 15:45:25 -07002675 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002676 utilities.assert_equals(
2677 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002678 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002679 onpass="IPv6 Ping across 4556 point intents test PASS",
2680 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2681
You Wangb6586542016-02-26 09:25:56 -08002682 if not caseResult and main.failSwitch:
2683 main.log.report("Stopping test")
2684 main.stop( email=main.emailOnStop )
2685
Hari Krishna4223dbd2015-08-13 16:29:53 -07002686 def CASE185( self ):
2687 """
2688 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
2689 """
2690 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2691 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002692 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002693
Hari Krishna4223dbd2015-08-13 16:29:53 -07002694 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002695 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2696 utilities.assert_equals( expect=main.TRUE,
2697 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002698 onpass="PING ALL PASS",
2699 onfail="PING ALL FAIL" )
2700
GlennRCbddd58f2015-10-01 15:45:25 -07002701 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002702 utilities.assert_equals(
2703 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002704 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002705 onpass="IPv6 Ping across 4556 Point intents test PASS",
2706 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2707
You Wangb6586542016-02-26 09:25:56 -08002708 if not caseResult and main.failSwitch:
2709 main.log.report("Stopping test")
2710 main.stop( email=main.emailOnStop )
2711
Hari Krishnac195f3b2015-07-08 20:02:24 -07002712 def CASE90( self ):
2713 """
2714 Install 600 point intents and verify ping all (Att Topology)
2715 """
2716 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2717 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002718 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002719
Hari Krishnac195f3b2015-07-08 20:02:24 -07002720 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002721 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002722 main.intentIds = list(intentIdList)
2723
GlennRCa8d786a2015-09-23 17:40:11 -07002724 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002725 intentState = main.CHOtestFunctions.checkIntents()
2726 utilities.assert_equals( expect=main.TRUE,
2727 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002728 onpass="INTENTS INSTALLED",
2729 onfail="SOME INTENTS NOT INSTALLED" )
2730
Hari Krishnac195f3b2015-07-08 20:02:24 -07002731 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002732 pingResult = main.CHOtestFunctions.checkPingall()
2733 utilities.assert_equals( expect=main.TRUE,
2734 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002735 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002736 onfail="PING ALL FAIL" )
2737
GlennRCbddd58f2015-10-01 15:45:25 -07002738 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002739 utilities.assert_equals(
2740 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002741 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002742 onpass="Install 600 point Intents and Ping All test PASS",
2743 onfail="Install 600 point Intents and Ping All test FAIL" )
2744
GlennRCbddd58f2015-10-01 15:45:25 -07002745 if not intentState:
2746 main.log.debug( "Intents failed to install completely" )
2747 if not pingResult:
2748 main.log.debug( "Pingall failed" )
2749
2750 if not caseResult and main.failSwitch:
2751 main.log.report("Stopping test")
2752 main.stop( email=main.emailOnStop )
2753
Hari Krishnac195f3b2015-07-08 20:02:24 -07002754 def CASE91( self ):
2755 """
2756 Install 600 point intents and verify ping all (Chordal Topology)
2757 """
2758 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2759 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002760 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002761
Hari Krishnac195f3b2015-07-08 20:02:24 -07002762 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002763 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002764 main.intentIds = list(intentIdList)
2765
GlennRCa8d786a2015-09-23 17:40:11 -07002766 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002767 intentState = main.CHOtestFunctions.checkIntents()
2768 utilities.assert_equals( expect=main.TRUE,
2769 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002770 onpass="INTENTS INSTALLED",
2771 onfail="SOME INTENTS NOT INSTALLED" )
2772
Hari Krishnac195f3b2015-07-08 20:02:24 -07002773 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002774 pingResult = main.CHOtestFunctions.checkPingall()
2775 utilities.assert_equals( expect=main.TRUE,
2776 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002777 onpass="PING ALL PASS",
2778 onfail="PING ALL FAIL" )
2779
GlennRCbddd58f2015-10-01 15:45:25 -07002780 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002781 utilities.assert_equals(
2782 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002783 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002784 onpass="Install 600 point Intents and Ping All test PASS",
2785 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002786
GlennRCbddd58f2015-10-01 15:45:25 -07002787 if not intentState:
2788 main.log.debug( "Intents failed to install completely" )
2789 if not pingResult:
2790 main.log.debug( "Pingall failed" )
2791
2792 if not caseResult and main.failSwitch:
2793 main.log.report("Stopping test")
2794 main.stop( email=main.emailOnStop )
2795
Hari Krishnac195f3b2015-07-08 20:02:24 -07002796 def CASE92( self ):
2797 """
2798 Install 4556 point intents and verify ping all (Spine Topology)
2799 """
2800 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2801 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002802 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002803
You Wangb6586542016-02-26 09:25:56 -08002804 main.step( "Add point Intents" )
2805 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002806 main.intentIds = list(intentIdList)
2807
GlennRCa8d786a2015-09-23 17:40:11 -07002808 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002809 intentState = main.CHOtestFunctions.checkIntents()
2810 utilities.assert_equals( expect=main.TRUE,
2811 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002812 onpass="INTENTS INSTALLED",
2813 onfail="SOME INTENTS NOT INSTALLED" )
2814
Hari Krishnac195f3b2015-07-08 20:02:24 -07002815 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002816 pingResult = main.CHOtestFunctions.checkPingall()
2817 utilities.assert_equals( expect=main.TRUE,
2818 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002819 onpass="PING ALL PASS",
2820 onfail="PING ALL FAIL" )
2821
GlennRCbddd58f2015-10-01 15:45:25 -07002822 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002823 utilities.assert_equals(
2824 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002825 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002826 onpass="Install 4556 point Intents and Ping All test PASS",
2827 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002828
GlennRCbddd58f2015-10-01 15:45:25 -07002829 if not intentState:
2830 main.log.debug( "Intents failed to install completely" )
2831 if not pingResult:
2832 main.log.debug( "Pingall failed" )
2833
2834 if not caseResult and main.failSwitch:
2835 main.log.report("Stopping test")
2836 main.stop( email=main.emailOnStop )
2837
Hari Krishnac195f3b2015-07-08 20:02:24 -07002838 def CASE93( self ):
2839 """
2840 Install multi-single point intents and verify Ping all works
2841 for att topology
2842 """
2843 import copy
2844 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002845 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002846 main.log.report( "Install multi-single point intents and verify Ping all" )
2847 main.log.report( "___________________________________________" )
2848 main.case( "Install multi-single point intents and Ping all" )
2849 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2850 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2851 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07002852 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002853 time1 = time.time()
2854 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2855 pool = []
2856 for cli in main.CLIs:
2857 egressDevice = deviceDPIDsCopy[i]
2858 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2859 ingressDeviceList.remove(egressDevice)
2860 if i >= len( deviceDPIDsCopy ):
2861 break
2862 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2863 threadID=main.threadID,
2864 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002865 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002866 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002867 t.start()
2868 i = i + 1
2869 main.threadID = main.threadID + 1
2870 for thread in pool:
2871 thread.join()
2872 intentIdList.append(thread.result)
2873 time2 = time.time()
2874 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07002875
GlennRCdb2c8422015-09-29 12:21:59 -07002876 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002877 # Giving onos multiple chances to install intents
2878 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002879 if i != 0:
2880 main.log.warn( "Verification failed. Retrying..." )
2881 main.log.info("Waiting for onos to install intents...")
2882 time.sleep( main.checkIntentsDelay )
2883
2884 intentState = main.TRUE
2885 for e in range(int(main.numCtrls)):
2886 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08002887 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
2888 if not IntentStateIndividual:
2889 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
2890 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002891 if intentState:
2892 break
You Wangb6586542016-02-26 09:25:56 -08002893 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002894 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08002895 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07002896
2897 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2898 onpass="INTENTS INSTALLED",
2899 onfail="SOME INTENTS NOT INSTALLED" )
2900
GlennRCfa69a2a2015-10-02 15:54:06 -07002901 main.step("Verify flows are all added")
2902
2903 for i in range( main.flowCheck ):
2904 if i != 0:
2905 main.log.warn( "verification failed. Retrying..." )
2906 main.log.info( "Waiting for onos to add flows..." )
2907 time.sleep( main.checkFlowsDelay )
2908
2909 flowState = main.TRUE
2910 for cli in main.CLIs:
2911 flowState = cli.checkFlowState()
2912 if not flowState:
2913 main.log.warn( "Not all flows added" )
2914 if flowState:
2915 break
2916 else:
2917 #Dumping summary
2918 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
2919
2920 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2921 onpass="FLOWS INSTALLED",
2922 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002923
Hari Krishnac195f3b2015-07-08 20:02:24 -07002924 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002925 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07002926 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002927 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2928 if not pingResult:
2929 main.log.warn("First pingall failed. Retrying...")
2930 time.sleep(main.pingSleep)
2931 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07002932
Hari Krishnac195f3b2015-07-08 20:02:24 -07002933 time2 = time.time()
2934 timeDiff = round( ( time2 - time1 ), 2 )
2935 main.log.report(
2936 "Time taken for Ping All: " +
2937 str( timeDiff ) +
2938 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002939
GlennRCbddd58f2015-10-01 15:45:25 -07002940 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002941 utilities.assert_equals(
2942 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002943 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002944 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2945 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002946
GlennRCfa69a2a2015-10-02 15:54:06 -07002947 if not intentState:
2948 main.log.debug( "Intents failed to install completely" )
2949 if not pingResult:
2950 main.log.debug( "Pingall failed" )
2951 if not checkFlowsState:
2952 main.log.debug( "Flows failed to add completely" )
2953
2954 if not caseResult and main.failSwitch:
2955 main.log.report("Stopping test")
2956 main.stop( email=main.emailOnStop )
2957
Hari Krishnac195f3b2015-07-08 20:02:24 -07002958 def CASE94( self ):
2959 """
2960 Install multi-single point intents and verify Ping all works
2961 for Chordal topology
2962 """
2963 import copy
2964 import time
2965 main.log.report( "Install multi-single point intents and verify Ping all" )
2966 main.log.report( "___________________________________________" )
2967 main.case( "Install multi-single point intents and Ping all" )
2968 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2969 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2970 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07002971 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002972 time1 = time.time()
2973 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2974 pool = []
2975 for cli in main.CLIs:
2976 egressDevice = deviceDPIDsCopy[i]
2977 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2978 ingressDeviceList.remove(egressDevice)
2979 if i >= len( deviceDPIDsCopy ):
2980 break
2981 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2982 threadID=main.threadID,
2983 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002984 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002985 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002986 t.start()
2987 i = i + 1
2988 main.threadID = main.threadID + 1
2989 for thread in pool:
2990 thread.join()
2991 intentIdList.append(thread.result)
2992 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002993 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07002994
2995 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002996 # Giving onos multiple chances to install intents
2997 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002998 if i != 0:
2999 main.log.warn( "Verification failed. Retrying..." )
3000 main.log.info("Waiting for onos to install intents...")
3001 time.sleep( main.checkIntentsDelay )
3002
3003 intentState = main.TRUE
3004 for e in range(int(main.numCtrls)):
3005 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003006 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3007 if not IntentStateIndividual:
3008 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3009 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003010 if intentState:
3011 break
You Wangb6586542016-02-26 09:25:56 -08003012 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003013 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003014 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003015
GlennRCdb2c8422015-09-29 12:21:59 -07003016 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3017 onpass="INTENTS INSTALLED",
3018 onfail="SOME INTENTS NOT INSTALLED" )
3019
GlennRCfa69a2a2015-10-02 15:54:06 -07003020 main.step("Verify flows are all added")
3021
3022 for i in range( main.flowCheck ):
3023 if i != 0:
3024 main.log.warn( "verification failed. Retrying..." )
3025 main.log.info( "Waiting for onos to add flows..." )
3026 time.sleep( main.checkFlowsDelay )
3027
3028 flowState = main.TRUE
3029 for cli in main.CLIs:
3030 flowState = cli.checkFlowState()
3031 if not flowState:
3032 main.log.warn( "Not all flows added" )
3033 if flowState:
3034 break
3035 else:
3036 #Dumping summary
3037 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3038
3039 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3040 onpass="FLOWS INSTALLED",
3041 onfail="SOME FLOWS NOT ADDED" )
3042
Hari Krishnac195f3b2015-07-08 20:02:24 -07003043 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003044 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003045 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003046 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3047 if not pingResult:
3048 main.log.warn("First pingall failed. Retrying...")
3049 time.sleep(main.pingSleep)
3050 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003051
Hari Krishnac195f3b2015-07-08 20:02:24 -07003052 time2 = time.time()
3053 timeDiff = round( ( time2 - time1 ), 2 )
3054 main.log.report(
3055 "Time taken for Ping All: " +
3056 str( timeDiff ) +
3057 " seconds" )
3058
GlennRCfa69a2a2015-10-02 15:54:06 -07003059 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003060 utilities.assert_equals(
3061 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003062 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003063 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3064 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003065
GlennRCfa69a2a2015-10-02 15:54:06 -07003066 if not intentState:
3067 main.log.debug( "Intents failed to install completely" )
3068 if not pingResult:
3069 main.log.debug( "Pingall failed" )
3070 if not checkFlowsState:
3071 main.log.debug( "Flows failed to add completely" )
3072
3073 if not caseResult and main.failSwitch:
3074 main.log.report("Stopping test")
3075 main.stop( email=main.emailOnStop )
3076
3077 def CASE95( self ):
3078 """
3079 Install multi-single point intents and verify Ping all works
3080 for Spine topology
3081 """
3082 import copy
3083 import time
3084 main.log.report( "Install multi-single point intents and verify Ping all" )
3085 main.log.report( "___________________________________________" )
3086 main.case( "Install multi-single point intents and Ping all" )
3087 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3088 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3089 intentIdList = []
3090 main.log.info( "MACsDict" + str(main.MACsDict) )
3091 time1 = time.time()
3092 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3093 pool = []
3094 for cli in main.CLIs:
3095 egressDevice = deviceDPIDsCopy[i]
3096 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3097 ingressDeviceList.remove(egressDevice)
3098 if i >= len( deviceDPIDsCopy ):
3099 break
3100 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3101 threadID=main.threadID,
3102 name="addMultipointToSinglepointIntent",
3103 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3104 pool.append(t)
3105 t.start()
3106 i = i + 1
3107 main.threadID = main.threadID + 1
3108 for thread in pool:
3109 thread.join()
3110 intentIdList.append(thread.result)
3111 time2 = time.time()
3112 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3113
3114 main.step("Verify intents are installed")
GlennRCfa69a2a2015-10-02 15:54:06 -07003115 # Giving onos multiple chances to install intents
3116 for i in range( main.intentCheck ):
3117 if i != 0:
3118 main.log.warn( "Verification failed. Retrying..." )
3119 main.log.info("Waiting for onos to install intents...")
3120 time.sleep( main.checkIntentsDelay )
3121
3122 intentState = main.TRUE
3123 for e in range(int(main.numCtrls)):
3124 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003125 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3126 if not IntentStateIndividual:
3127 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3128 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003129 if intentState:
3130 break
You Wangb6586542016-02-26 09:25:56 -08003131 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003132 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003133 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003134
3135 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3136 onpass="INTENTS INSTALLED",
3137 onfail="SOME INTENTS NOT INSTALLED" )
3138
3139 main.step("Verify flows are all added")
3140
3141 for i in range( main.flowCheck ):
3142 if i != 0:
3143 main.log.warn( "verification failed. Retrying..." )
3144 main.log.info( "Waiting for onos to add flows..." )
3145 time.sleep( main.checkFlowsDelay )
3146
3147 flowState = main.TRUE
3148 for cli in main.CLIs:
3149 flowState = cli.checkFlowState()
3150 if not flowState:
3151 main.log.warn( "Not all flows added" )
3152 if flowState:
3153 break
3154 else:
3155 #Dumping summary
3156 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3157
3158 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3159 onpass="FLOWS INSTALLED",
3160 onfail="SOME FLOWS NOT ADDED" )
3161
3162 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003163 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003164 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003165 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3166 if not pingResult:
3167 main.log.warn("First pingall failed. Retrying...")
3168 time.sleep(main.pingSleep)
3169 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003170
3171 time2 = time.time()
3172 timeDiff = round( ( time2 - time1 ), 2 )
3173 main.log.report(
3174 "Time taken for Ping All: " +
3175 str( timeDiff ) +
3176 " seconds" )
3177
3178 caseResult = ( checkFlowsState and pingResult and intentState )
3179 utilities.assert_equals(
3180 expect=main.TRUE,
3181 actual=caseResult,
3182 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3183 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3184
3185 if not intentState:
3186 main.log.debug( "Intents failed to install completely" )
3187 if not pingResult:
3188 main.log.debug( "Pingall failed" )
3189 if not checkFlowsState:
3190 main.log.debug( "Flows failed to add completely" )
3191
3192 if not caseResult and main.failSwitch:
3193 main.log.report("Stopping test")
3194 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003195
3196 def CASE96( self ):
3197 """
3198 Install single-multi point intents and verify Ping all works
3199 for att topology
3200 """
3201 import copy
3202 main.log.report( "Install single-multi point intents and verify Ping all" )
3203 main.log.report( "___________________________________________" )
3204 main.case( "Install single-multi point intents and Ping all" )
3205 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3206 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3207 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003208 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003209 time1 = time.time()
3210 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3211 pool = []
3212 for cli in main.CLIs:
3213 ingressDevice = deviceDPIDsCopy[i]
3214 egressDeviceList = copy.copy(deviceDPIDsCopy)
3215 egressDeviceList.remove(ingressDevice)
3216 if i >= len( deviceDPIDsCopy ):
3217 break
3218 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3219 threadID=main.threadID,
3220 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003221 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003222 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003223 t.start()
3224 i = i + 1
3225 main.threadID = main.threadID + 1
3226 for thread in pool:
3227 thread.join()
3228 intentIdList.append(thread.result)
3229 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003230 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003231
3232 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003233 # Giving onos multiple chances to install intents
3234 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003235 if i != 0:
3236 main.log.warn( "Verification failed. Retrying..." )
3237 main.log.info("Waiting for onos to install intents...")
3238 time.sleep( main.checkIntentsDelay )
3239
3240 intentState = main.TRUE
3241 for e in range(int(main.numCtrls)):
3242 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003243 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3244 if not IntentStateIndividual:
3245 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3246 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003247 if intentState:
3248 break
You Wangb6586542016-02-26 09:25:56 -08003249 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003250 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003251 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003252
GlennRCdb2c8422015-09-29 12:21:59 -07003253 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3254 onpass="INTENTS INSTALLED",
3255 onfail="SOME INTENTS NOT INSTALLED" )
3256
GlennRCfa69a2a2015-10-02 15:54:06 -07003257 main.step("Verify flows are all added")
3258
3259 for i in range( main.flowCheck ):
3260 if i != 0:
3261 main.log.warn( "verification failed. Retrying..." )
3262 main.log.info( "Waiting for onos to add flows..." )
3263 time.sleep( main.checkFlowsDelay )
3264
3265 flowState = main.TRUE
3266 for cli in main.CLIs:
3267 flowState = cli.checkFlowState()
3268 if not flowState:
3269 main.log.warn( "Not all flows added" )
3270 if flowState:
3271 break
3272 else:
3273 #Dumping summary
3274 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3275
3276 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3277 onpass="FLOWS INSTALLED",
3278 onfail="SOME FLOWS NOT ADDED" )
3279
Hari Krishnac195f3b2015-07-08 20:02:24 -07003280 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003281 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003282 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003283 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3284 if not pingResult:
3285 main.log.warn("First pingall failed. Retrying...")
3286 time.sleep(main.pingSleep)
3287 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003288
Hari Krishnac195f3b2015-07-08 20:02:24 -07003289 time2 = time.time()
3290 timeDiff = round( ( time2 - time1 ), 2 )
3291 main.log.report(
3292 "Time taken for Ping All: " +
3293 str( timeDiff ) +
3294 " seconds" )
3295
GlennRCfa69a2a2015-10-02 15:54:06 -07003296 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003297 utilities.assert_equals(
3298 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003299 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003300 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3301 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3302
GlennRCfa69a2a2015-10-02 15:54:06 -07003303 if not intentState:
3304 main.log.debug( "Intents failed to install completely" )
3305 if not pingResult:
3306 main.log.debug( "Pingall failed" )
3307 if not checkFlowsState:
3308 main.log.debug( "Flows failed to add completely" )
3309
3310 if not caseResult and main.failSwitch:
3311 main.log.report("Stopping test")
3312 main.stop( email=main.emailOnStop )
3313
Hari Krishnac195f3b2015-07-08 20:02:24 -07003314 def CASE97( self ):
3315 """
3316 Install single-multi point intents and verify Ping all works
3317 for Chordal topology
3318 """
3319 import copy
3320 main.log.report( "Install single-multi point intents and verify Ping all" )
3321 main.log.report( "___________________________________________" )
3322 main.case( "Install single-multi point intents and Ping all" )
3323 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3324 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3325 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003326 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003327 time1 = time.time()
3328 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3329 pool = []
3330 for cli in main.CLIs:
3331 ingressDevice = deviceDPIDsCopy[i]
3332 egressDeviceList = copy.copy(deviceDPIDsCopy)
3333 egressDeviceList.remove(ingressDevice)
3334 if i >= len( deviceDPIDsCopy ):
3335 break
3336 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3337 threadID=main.threadID,
3338 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003339 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003340 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003341 t.start()
3342 i = i + 1
3343 main.threadID = main.threadID + 1
3344 for thread in pool:
3345 thread.join()
3346 intentIdList.append(thread.result)
3347 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003348 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003349
3350 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003351 # Giving onos multiple chances to install intents
3352 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003353 if i != 0:
3354 main.log.warn( "Verification failed. Retrying..." )
3355 main.log.info("Waiting for onos to install intents...")
3356 time.sleep( main.checkIntentsDelay )
3357
3358 intentState = main.TRUE
3359 for e in range(int(main.numCtrls)):
3360 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003361 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3362 if not IntentStateIndividual:
3363 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3364 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003365 if intentState:
3366 break
You Wangb6586542016-02-26 09:25:56 -08003367 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003368 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003369 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003370
GlennRCdb2c8422015-09-29 12:21:59 -07003371 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3372 onpass="INTENTS INSTALLED",
3373 onfail="SOME INTENTS NOT INSTALLED" )
3374
GlennRCfa69a2a2015-10-02 15:54:06 -07003375 main.step("Verify flows are all added")
3376
3377 for i in range( main.flowCheck ):
3378 if i != 0:
3379 main.log.warn( "verification failed. Retrying..." )
3380 main.log.info( "Waiting for onos to add flows..." )
3381 time.sleep( main.checkFlowsDelay )
3382
3383 flowState = main.TRUE
3384 for cli in main.CLIs:
3385 flowState = cli.checkFlowState()
3386 if not flowState:
3387 main.log.warn( "Not all flows added" )
3388 if flowState:
3389 break
3390 else:
3391 #Dumping summary
3392 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3393
3394 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3395 onpass="FLOWS INSTALLED",
3396 onfail="SOME FLOWS NOT ADDED" )
3397
Hari Krishnac195f3b2015-07-08 20:02:24 -07003398 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003399 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003400 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003401 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3402 if not pingResult:
3403 main.log.warn("First pingall failed. Retrying...")
3404 time.sleep(main.pingSleep)
3405 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003406
Hari Krishnac195f3b2015-07-08 20:02:24 -07003407 time2 = time.time()
3408 timeDiff = round( ( time2 - time1 ), 2 )
3409 main.log.report(
3410 "Time taken for Ping All: " +
3411 str( timeDiff ) +
3412 " seconds" )
3413
GlennRCfa69a2a2015-10-02 15:54:06 -07003414 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003415 utilities.assert_equals(
3416 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003417 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003418 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3419 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3420
GlennRCfa69a2a2015-10-02 15:54:06 -07003421 if not intentState:
3422 main.log.debug( "Intents failed to install completely" )
3423 if not pingResult:
3424 main.log.debug( "Pingall failed" )
3425 if not checkFlowsState:
3426 main.log.debug( "Flows failed to add completely" )
3427
3428 if not caseResult and main.failSwitch:
3429 main.log.report("Stopping test")
3430 main.stop( email=main.emailOnStop )
3431
Hari Krishnac195f3b2015-07-08 20:02:24 -07003432 def CASE98( self ):
3433 """
3434 Install single-multi point intents and verify Ping all works
3435 for Spine topology
3436 """
3437 import copy
3438 main.log.report( "Install single-multi point intents and verify Ping all" )
3439 main.log.report( "___________________________________________" )
3440 main.case( "Install single-multi point intents and Ping all" )
3441 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3442 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3443 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3444 intentIdList = []
3445 MACsDictCopy = {}
3446 for i in range( len( deviceDPIDsCopy ) ):
3447 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3448
GlennRCfa69a2a2015-10-02 15:54:06 -07003449 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3450 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003451 time1 = time.time()
3452 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3453 pool = []
3454 for cli in main.CLIs:
3455 if i >= len( deviceDPIDsCopy ):
3456 break
3457 ingressDevice = deviceDPIDsCopy[i]
3458 egressDeviceList = copy.copy(deviceDPIDsCopy)
3459 egressDeviceList.remove(ingressDevice)
3460 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3461 threadID=main.threadID,
3462 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003463 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003464 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003465 t.start()
3466 i = i + 1
3467 main.threadID = main.threadID + 1
3468 for thread in pool:
3469 thread.join()
3470 intentIdList.append(thread.result)
3471 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003472 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003473
3474 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003475 # Giving onos multiple chances to install intents
3476 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003477 if i != 0:
3478 main.log.warn( "Verification failed. Retrying..." )
3479 main.log.info("Waiting for onos to install intents...")
3480 time.sleep( main.checkIntentsDelay )
3481
3482 intentState = main.TRUE
3483 for e in range(int(main.numCtrls)):
3484 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003485 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3486 if not IntentStateIndividual:
3487 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3488 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003489 if intentState:
3490 break
You Wangb6586542016-02-26 09:25:56 -08003491 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003492 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003493 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003494
GlennRCdb2c8422015-09-29 12:21:59 -07003495 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3496 onpass="INTENTS INSTALLED",
3497 onfail="SOME INTENTS NOT INSTALLED" )
3498
GlennRCfa69a2a2015-10-02 15:54:06 -07003499 main.step("Verify flows are all added")
3500
3501 for i in range( main.flowCheck ):
3502 if i != 0:
3503 main.log.warn( "verification failed. Retrying..." )
3504 main.log.info( "Waiting for onos to add flows..." )
3505 time.sleep( main.checkFlowsDelay )
3506
3507 flowState = main.TRUE
3508 for cli in main.CLIs:
3509 flowState = cli.checkFlowState()
3510 if not flowState:
3511 main.log.warn( "Not all flows added" )
3512 if flowState:
3513 break
3514 else:
3515 #Dumping summary
3516 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3517
3518 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3519 onpass="FLOWS INSTALLED",
3520 onfail="SOME FLOWS NOT ADDED" )
3521
Hari Krishnac195f3b2015-07-08 20:02:24 -07003522 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003523 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003524 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003525 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3526 if not pingResult:
3527 main.log.warn("First pingall failed. Retrying...")
3528 time.sleep(main.pingSleep)
3529 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003530
Hari Krishnac195f3b2015-07-08 20:02:24 -07003531 time2 = time.time()
3532 timeDiff = round( ( time2 - time1 ), 2 )
3533 main.log.report(
3534 "Time taken for Ping All: " +
3535 str( timeDiff ) +
3536 " seconds" )
3537
GlennRCfa69a2a2015-10-02 15:54:06 -07003538 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003539 utilities.assert_equals(
3540 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003541 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003542 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3543 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3544
GlennRCfa69a2a2015-10-02 15:54:06 -07003545 if not intentState:
3546 main.log.debug( "Intents failed to install completely" )
3547 if not pingResult:
3548 main.log.debug( "Pingall failed" )
3549 if not checkFlowsState:
3550 main.log.debug( "Flows failed to add completely" )
3551
3552 if not caseResult and main.failSwitch:
3553 main.log.report("Stopping test")
3554 main.stop( email=main.emailOnStop )
3555
Hari Krishna4223dbd2015-08-13 16:29:53 -07003556 def CASE190( self ):
3557 """
3558 Verify IPv6 ping across 600 Point intents (Att Topology)
3559 """
3560 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3561 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003562 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003563
Hari Krishna4223dbd2015-08-13 16:29:53 -07003564 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003565 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3566 utilities.assert_equals( expect=main.TRUE,
3567 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003568 onpass="PING ALL PASS",
3569 onfail="PING ALL FAIL" )
3570
GlennRCbddd58f2015-10-01 15:45:25 -07003571 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003572 utilities.assert_equals(
3573 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003574 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003575 onpass="IPv6 Ping across 600 Point intents test PASS",
3576 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3577
You Wangb6586542016-02-26 09:25:56 -08003578 if not caseResult and main.failSwitch:
3579 main.log.report("Stopping test")
3580 main.stop( email=main.emailOnStop )
3581
Hari Krishna4223dbd2015-08-13 16:29:53 -07003582 def CASE191( self ):
3583 """
3584 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3585 """
3586 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3587 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003588 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003589
Hari Krishna4223dbd2015-08-13 16:29:53 -07003590 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003591 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3592 utilities.assert_equals( expect=main.TRUE,
3593 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003594 onpass="PING ALL PASS",
3595 onfail="PING ALL FAIL" )
3596
GlennRCbddd58f2015-10-01 15:45:25 -07003597 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003598 utilities.assert_equals(
3599 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003600 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003601 onpass="IPv6 Ping across 600 Point intents test PASS",
3602 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3603
You Wangb6586542016-02-26 09:25:56 -08003604 if not caseResult and main.failSwitch:
3605 main.log.report("Stopping test")
3606 main.stop( email=main.emailOnStop )
3607
Hari Krishna4223dbd2015-08-13 16:29:53 -07003608 def CASE192( self ):
3609 """
3610 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3611 """
3612 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3613 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003614 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003615
Hari Krishna4223dbd2015-08-13 16:29:53 -07003616 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003617 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3618 utilities.assert_equals( expect=main.TRUE,
3619 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003620 onpass="PING ALL PASS",
3621 onfail="PING ALL FAIL" )
3622
GlennRCbddd58f2015-10-01 15:45:25 -07003623 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003624 utilities.assert_equals(
3625 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003626 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003627 onpass="IPv6 Ping across 4556 Point intents test PASS",
3628 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003629
You Wangb6586542016-02-26 09:25:56 -08003630 if not caseResult and main.failSwitch:
3631 main.log.report("Stopping test")
3632 main.stop( email=main.emailOnStop )
3633
Hari Krishnac195f3b2015-07-08 20:02:24 -07003634 def CASE10( self ):
3635 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003636 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003637 """
3638 Remove all Intents
3639 """
3640 main.log.report( "Remove all intents that were installed previously" )
3641 main.log.report( "______________________________________________" )
3642 main.log.info( "Remove all intents" )
3643 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003644 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003645 main.step( "Obtain the intent id's first" )
3646 intentsList = main.ONOScli1.getAllIntentIds()
3647 ansi_escape = re.compile( r'\x1b[^m]*m' )
3648 intentsList = ansi_escape.sub( '', intentsList )
3649 intentsList = intentsList.replace(
3650 " onos:intents | grep id=",
3651 "" ).replace(
3652 "id=",
3653 "" ).replace(
3654 "\r\r",
3655 "" )
3656 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003657 intentIdList = []
3658 step1Result = main.TRUE
3659 moreIntents = main.TRUE
3660 removeIntentCount = 0
3661 intentsCount = len(intentsList)
3662 main.log.info ( "Current number of intents: " + str(intentsCount) )
You Wangb6586542016-02-26 09:25:56 -08003663
3664 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003665 if ( len( intentsList ) > 1 ):
3666 results = main.TRUE
3667 main.log.info("Removing intent...")
3668 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003669 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003670 if removeIntentCount == 5:
3671 break
3672 removeIntentCount = removeIntentCount + 1
3673 intentsList1 = main.ONOScli1.getAllIntentIds()
3674 if len( intentsList1 ) == 0:
3675 break
3676 ansi_escape = re.compile( r'\x1b[^m]*m' )
3677 intentsList1 = ansi_escape.sub( '', intentsList1 )
3678 intentsList1 = intentsList1.replace(
3679 " onos:intents | grep id=",
3680 "" ).replace(
3681 " state=",
3682 "" ).replace(
3683 "\r\r",
3684 "" )
3685 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003686 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3687 print intentsList1
3688 intentIdList1 = []
3689 if ( len( intentsList1 ) > 0 ):
3690 moreIntents = main.TRUE
3691 for i in range( len( intentsList1 ) ):
3692 intentsTemp1 = intentsList1[ i ].split( ',' )
3693 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3694 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3695 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3696 time1 = time.time()
3697 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3698 pool = []
3699 for cli in main.CLIs:
3700 if i >= len( intentIdList1 ):
3701 break
3702 t = main.Thread( target=cli.removeIntent,
3703 threadID=main.threadID,
3704 name="removeIntent",
3705 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3706 pool.append(t)
3707 t.start()
3708 i = i + 1
3709 main.threadID = main.threadID + 1
3710 for thread in pool:
3711 thread.join()
3712 intentIdList.append(thread.result)
3713 #time.sleep(2)
3714 time2 = time.time()
3715 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003716 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003717 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003718 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003719 else:
3720 time.sleep(10)
3721 if len( main.ONOScli1.intents()):
3722 continue
3723 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003724 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003725 else:
3726 print "Removed %d intents" %(intentsCount)
3727 step1Result = main.TRUE
3728 else:
3729 print "No Intent IDs found in Intents list: ", intentsList
3730 step1Result = main.FALSE
3731
3732 print main.ONOScli1.intents()
You Wangb6586542016-02-26 09:25:56 -08003733
3734 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003735 caseResult = step1Result
3736 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003737 onpass="Intent removal test successful",
3738 onfail="Intent removal test failed" )
3739
3740 def CASE12( self, main ):
3741 """
3742 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3743 """
3744 import re
3745 import copy
3746 import time
3747
Hari Krishnac195f3b2015-07-08 20:02:24 -07003748 threadID = 0
3749
3750 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3751 main.log.report( "_____________________________________________________" )
3752 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3753 main.step( "Enable intent based Reactive forwarding" )
3754 installResult = main.FALSE
3755 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003756
Hari Krishnac195f3b2015-07-08 20:02:24 -07003757 pool = []
3758 time1 = time.time()
3759 for cli,feature in main.CLIs:
3760 t = main.Thread(target=cli,threadID=threadID,
3761 name="featureInstall",args=[feature])
3762 pool.append(t)
3763 t.start()
3764 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003765
Hari Krishnac195f3b2015-07-08 20:02:24 -07003766 results = []
3767 for thread in pool:
3768 thread.join()
3769 results.append(thread.result)
3770 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003771
Hari Krishnac195f3b2015-07-08 20:02:24 -07003772 if( all(result == main.TRUE for result in results) == False):
3773 main.log.info("Did not install onos-app-ifwd feature properly")
3774 #main.cleanup()
3775 #main.exit()
3776 else:
3777 main.log.info("Successful feature:install onos-app-ifwd")
3778 installResult = main.TRUE
3779 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003780
GlennRC6ac11b12015-10-21 17:41:28 -07003781 main.step( "Verify Ping across all hosts" )
3782 for i in range(main.numPings):
3783 time1 = time.time()
3784 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3785 if not pingResult:
3786 main.log.warn("First pingall failed. Retrying...")
3787 time.sleep(main.pingSleep)
3788 else: break
3789
Hari Krishnac195f3b2015-07-08 20:02:24 -07003790 time2 = time.time()
3791 timeDiff = round( ( time2 - time1 ), 2 )
3792 main.log.report(
3793 "Time taken for Ping All: " +
3794 str( timeDiff ) +
3795 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003796
GlennRC626ba132015-09-18 16:16:31 -07003797 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003798 main.log.report( "Pingall Test in Reactive mode successful" )
3799 else:
3800 main.log.report( "Pingall Test in Reactive mode failed" )
3801
3802 main.step( "Disable Intent based Reactive forwarding" )
3803 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003804
Hari Krishnac195f3b2015-07-08 20:02:24 -07003805 pool = []
3806 time1 = time.time()
3807 for cli,feature in main.CLIs:
3808 t = main.Thread(target=cli,threadID=threadID,
3809 name="featureUninstall",args=[feature])
3810 pool.append(t)
3811 t.start()
3812 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003813
Hari Krishnac195f3b2015-07-08 20:02:24 -07003814 results = []
3815 for thread in pool:
3816 thread.join()
3817 results.append(thread.result)
3818 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003819
Hari Krishnac195f3b2015-07-08 20:02:24 -07003820 if( all(result == main.TRUE for result in results) == False):
3821 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3822 uninstallResult = main.FALSE
3823 #main.cleanup()
3824 #main.exit()
3825 else:
3826 main.log.info("Successful feature:uninstall onos-app-ifwd")
3827 uninstallResult = main.TRUE
3828 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
3829
3830 # Waiting for reative flows to be cleared.
3831 time.sleep( 10 )
3832
GlennRCbddd58f2015-10-01 15:45:25 -07003833 caseResult = installResult and pingResult and uninstallResult
3834 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003835 onpass="Intent based Reactive forwarding Pingall test PASS",
3836 onfail="Intent based Reactive forwarding Pingall test FAIL" )