blob: 411035d49b06f56f6027d4497798ad02d55450f6 [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
137 main.step( "Verify ONOS nodes UP status" )
138 statusResult = main.TRUE
139 for i in range( int( main.numCtrls ) ):
140 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
141 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
142 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
143 onpass="Test step PASS",
144 onfail="Test step FAIL" )
145 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700146
Chiyu Chengef109502016-11-21 15:51:38 -0800147 main.step( "Set up ONOS secure SSH" )
148 secureSshResult = main.TRUE
149 for i in range( int( main.numCtrls ) ):
150 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
151 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
152 onpass="Test step PASS",
153 onfail="Test step FAIL" )
154
Hari Krishnac195f3b2015-07-08 20:02:24 -0700155 main.step( "Start ONOS CLI on all nodes" )
156 cliResult = main.TRUE
Jon Hall6509dbf2016-06-21 17:01:17 -0700157 main.step(" Start ONOS cli using thread ")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700158 startCliResult = main.TRUE
159 pool = []
160 time1 = time.time()
161 for i in range( int( main.numCtrls) ):
162 t = main.Thread( target=main.CLIs[i].startOnosCli,
163 threadID=main.threadID,
164 name="startOnosCli",
165 args=[ main.onosIPs[i], karafTimeout ] )
166 pool.append(t)
167 t.start()
168 main.threadID = main.threadID + 1
169 for t in pool:
170 t.join()
171 startCliResult = startCliResult and t.result
172 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700173
Hari Krishnac195f3b2015-07-08 20:02:24 -0700174 if not startCliResult:
175 main.log.info("ONOS CLI did not start up properly")
176 main.cleanup()
177 main.exit()
178 else:
179 main.log.info("Successful CLI startup")
180 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700181
182 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
You Wangb6586542016-02-26 09:25:56 -0800183 time.sleep(30)
Hari Krishna4223dbd2015-08-13 16:29:53 -0700184 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
185 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
186 cfgResult = cfgResult1 and cfgResult2
187 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
188 onpass="ipv6NeighborDiscovery cfg is set to true",
189 onfail="Failed to cfg set ipv6NeighborDiscovery" )
190
191 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700192 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
193 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
194 onpass="Set up test environment PASS",
195 onfail="Set up test environment FAIL" )
196
197 def CASE20( self, main ):
198 """
199 This test script Loads a new Topology (Att) on CHO setup and balances all switches
200 """
201 import re
202 import time
203 import copy
204
GlennRC3de72232015-12-16 10:48:35 -0800205 main.prefix = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -0700206 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
207 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
208 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800209 main.pingTimeout = main.pingTimeoutSmallTopo
210
Hari Krishnac195f3b2015-07-08 20:02:24 -0700211 main.log.report(
212 "Load Att topology and Balance all Mininet switches across controllers" )
213 main.log.report(
214 "________________________________________________________________________" )
215 main.case(
216 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700217
Hari Krishnac195f3b2015-07-08 20:02:24 -0700218 main.step( "Start Mininet with Att topology" )
219 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700220 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700221 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700222 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
223 topoPath = mininetDir + main.newTopo
224 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700225
Hari Krishnac195f3b2015-07-08 20:02:24 -0700226 main.step( "Assign switches to controllers" )
227 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
228 main.Mininet1.assignSwController(
229 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700230 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700231
232 switch_mastership = main.TRUE
233 for i in range( 1, ( main.numMNswitches + 1 ) ):
234 response = main.Mininet1.getSwController( "s" + str( i ) )
235 print( "Response is " + str( response ) )
236 if re.search( "tcp:" + main.onosIPs[0], response ):
237 switch_mastership = switch_mastership and main.TRUE
238 else:
239 switch_mastership = main.FALSE
240
241 if switch_mastership == main.TRUE:
242 main.log.report( "Controller assignment successfull" )
243 else:
244 main.log.report( "Controller assignment failed" )
245
246 time.sleep(30) # waiting here to make sure topology converges across all nodes
247
248 main.step( "Balance devices across controllers" )
249 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700250 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700251 time.sleep( 5 )
252
253 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700254 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700255 case2Result = ( switch_mastership and startStatus )
256 utilities.assert_equals(
257 expect=main.TRUE,
258 actual=case2Result,
259 onpass="Starting new Att topology test PASS",
260 onfail="Starting new Att topology test FAIL" )
261
262 def CASE21( self, main ):
263 """
264 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
265 """
266 import re
267 import time
268 import copy
269
GlennRC3de72232015-12-16 10:48:35 -0800270 main.prefix = 1
Hari Krishnac195f3b2015-07-08 20:02:24 -0700271 main.newTopo = main.params['TOPO2']['topo']
272 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
273 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
274 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800275 main.pingTimeout = main.pingTimeoutSmallTopo
276
Hari Krishnac195f3b2015-07-08 20:02:24 -0700277 main.log.report(
278 "Load Chordal topology and Balance all Mininet switches across controllers" )
279 main.log.report(
280 "________________________________________________________________________" )
281 main.case(
282 "Assign and Balance all Mininet switches across controllers" )
283
GlennRCc6cd2a62015-08-10 16:08:22 -0700284 main.step("Start Mininet with Chordal topology")
285 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700286 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700287 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
288 topoPath = mininetDir + main.newTopo
289 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290
291 main.step( "Assign switches to controllers" )
292
293 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
294 main.Mininet1.assignSwController(
295 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700296 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297
298 switch_mastership = main.TRUE
299 for i in range( 1, ( main.numMNswitches + 1 ) ):
300 response = main.Mininet1.getSwController( "s" + str( i ) )
301 print( "Response is " + str( response ) )
302 if re.search( "tcp:" + main.onosIPs[0], response ):
303 switch_mastership = switch_mastership and main.TRUE
304 else:
305 switch_mastership = main.FALSE
306
307 if switch_mastership == main.TRUE:
308 main.log.report( "Controller assignment successfull" )
309 else:
310 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700311
Hari Krishnac195f3b2015-07-08 20:02:24 -0700312 main.step( "Balance devices across controllers" )
313 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700314 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700315 time.sleep( 5 )
316
GlennRCbddd58f2015-10-01 15:45:25 -0700317 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700318 time.sleep(30)
319 utilities.assert_equals(
320 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700321 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700322 onpass="Starting new Chordal topology test PASS",
323 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700324
Hari Krishnac195f3b2015-07-08 20:02:24 -0700325 def CASE22( self, main ):
326 """
327 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
328 """
329 import re
330 import time
331 import copy
332
GlennRC3de72232015-12-16 10:48:35 -0800333 main.prefix = 2
Hari Krishnac195f3b2015-07-08 20:02:24 -0700334 main.newTopo = main.params['TOPO3']['topo']
335 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
336 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
337 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800338 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700339
Hari Krishnac195f3b2015-07-08 20:02:24 -0700340 main.log.report(
341 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
342 main.log.report(
343 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800344 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700345
346 main.step("Start Mininet with Spine topology")
347 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700348 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700349 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
350 topoPath = mininetDir + main.newTopo
351 startStatus = main.Mininet1.startNet(topoFile = topoPath)
352
Hari Krishnac195f3b2015-07-08 20:02:24 -0700353 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
354 main.Mininet1.assignSwController(
355 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700356 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700357
358 switch_mastership = main.TRUE
359 for i in range( 1, ( main.numMNswitches + 1 ) ):
360 response = main.Mininet1.getSwController( "s" + str( i ) )
361 print( "Response is " + str( response ) )
362 if re.search( "tcp:" + main.onosIPs[0], response ):
363 switch_mastership = switch_mastership and main.TRUE
364 else:
365 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700366
Hari Krishnac195f3b2015-07-08 20:02:24 -0700367 if switch_mastership == main.TRUE:
368 main.log.report( "Controller assignment successfull" )
369 else:
370 main.log.report( "Controller assignment failed" )
371 time.sleep( 5 )
372
373 main.step( "Balance devices across controllers" )
374 for i in range( int( main.numCtrls ) ):
375 balanceResult = main.ONOScli1.balanceMasters()
376 # giving some breathing time for ONOS to complete re-balance
377 time.sleep( 3 )
378
GlennRCbddd58f2015-10-01 15:45:25 -0700379 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700380 time.sleep(60)
381 utilities.assert_equals(
382 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700383 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700384 onpass="Starting new Spine topology test PASS",
385 onfail="Starting new Spine topology test FAIL" )
386
387 def CASE3( self, main ):
388 """
389 This Test case will be extended to collect and store more data related
390 ONOS state.
391 """
392 import re
393 import copy
394 main.deviceDPIDs = []
395 main.hostMACs = []
396 main.deviceLinks = []
397 main.deviceActiveLinksCount = []
398 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700399
Hari Krishnac195f3b2015-07-08 20:02:24 -0700400 main.log.report(
401 "Collect and Store topology details from ONOS before running any Tests" )
402 main.log.report(
403 "____________________________________________________________________" )
404 main.case( "Collect and Store Topology Details from ONOS" )
405 main.step( "Collect and store current number of switches and links" )
406 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700407 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700408 numOnosDevices = topology_result[ 'devices' ]
409 numOnosLinks = topology_result[ 'links' ]
410 topoResult = main.TRUE
411
GlennRCee8f3bf2015-12-14 16:18:39 -0800412 for check in range(main.topoCheck):
413 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
414 main.step( "Store Device DPIDs" )
415 for i in range( 1, (main.numMNswitches+1) ):
GlennRC20fc6522015-12-23 23:26:57 -0800416 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800417 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700418
GlennRCee8f3bf2015-12-14 16:18:39 -0800419 main.step( "Store Host MACs" )
420 for i in range( 1, ( main.numMNhosts + 1 ) ):
421 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
422 print "Host MACs in Store: \n", str( main.hostMACs )
423 main.MACsDict = {}
424 print "Creating dictionary of DPID and HostMacs"
425 for i in range(len(main.hostMACs)):
426 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
427 print main.MACsDict
428 main.step( "Collect and store all Devices Links" )
429 linksResult = main.ONOScli1.links( jsonFormat=False )
430 ansi_escape = re.compile( r'\x1b[^m]*m' )
431 linksResult = ansi_escape.sub( '', linksResult )
432 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
433 linksResult = linksResult.splitlines()
434 main.deviceLinks = copy.copy( linksResult )
435 print "Device Links Stored: \n", str( main.deviceLinks )
436 # this will be asserted to check with the params provided count of
437 # links
438 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700439
GlennRCee8f3bf2015-12-14 16:18:39 -0800440 main.step( "Collect and store each Device ports enabled Count" )
441 time1 = time.time()
442 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
443 pool = []
444 for cli in main.CLIs:
445 if i >= main.numMNswitches + 1:
446 break
GlennRC20fc6522015-12-23 23:26:57 -0800447 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800448 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
449 t.start()
450 pool.append(t)
451 i = i + 1
452 main.threadID = main.threadID + 1
453 for thread in pool:
454 thread.join()
455 portResult = thread.result
456 main.devicePortsEnabledCount.append( portResult )
457 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
458 time2 = time.time()
459 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700460
GlennRCee8f3bf2015-12-14 16:18:39 -0800461 main.step( "Collect and store each Device active links Count" )
462 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700463
GlennRCee8f3bf2015-12-14 16:18:39 -0800464 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
465 pool = []
466 for cli in main.CLIs:
467 if i >= main.numMNswitches + 1:
468 break
GlennRC20fc6522015-12-23 23:26:57 -0800469 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800470 t = main.Thread( target = cli.getDeviceLinksActiveCount,
471 threadID = main.threadID,
472 name = "getDevicePortsEnabledCount",
473 args = [dpid])
474 t.start()
475 pool.append(t)
476 i = i + 1
477 main.threadID = main.threadID + 1
478 for thread in pool:
479 thread.join()
480 linkCountResult = thread.result
481 main.deviceActiveLinksCount.append( linkCountResult )
482 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
483 time2 = time.time()
484 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700485
GlennRCee8f3bf2015-12-14 16:18:39 -0800486 # Exit out of the topo check loop
487 break
488
489 else:
490 main.log.info("Devices (expected): %s, Links (expected): %s" %
491 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
492 main.log.info("Devices (actual): %s, Links (actual): %s" %
493 ( numOnosDevices , numOnosLinks ) )
494 main.log.info("Topology does not match, trying again...")
495 topoResult = main.FALSE
496 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700497
498 # just returning TRUE for now as this one just collects data
499 case3Result = topoResult
500 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
501 onpass="Saving ONOS topology data test PASS",
502 onfail="Saving ONOS topology data test FAIL" )
503
GlennRC186b7362015-12-11 18:20:16 -0800504
GlennRC20fc6522015-12-23 23:26:57 -0800505
506 def CASE200( self, main ):
507
508 import time
509 main.log.report( "Clean up ONOS" )
Jon Hall6509dbf2016-06-21 17:01:17 -0700510 main.case( "Stop topology and remove hosts and devices" )
GlennRC20fc6522015-12-23 23:26:57 -0800511
512 main.step( "Stop Topology" )
513 stopStatus = main.Mininet1.stopNet()
514 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
515 onpass="Stopped mininet",
516 onfail="Failed to stop mininet" )
517
518
519 main.log.info( "Constructing host id list" )
520 hosts = []
521 for i in range( main.numMNhosts ):
522 hosts.append( "h" + str(i+1) )
523
524 main.step( "Getting host ids" )
525 hostList = main.CLIs[0].getHostsId( hosts )
526 hostIdResult = True if hostList else False
527 utilities.assert_equals( expect=True, actual=hostIdResult,
528 onpass="Successfully obtained the host ids.",
529 onfail="Failed to obtain the host ids" )
530
531 main.step( "Removing hosts" )
532 hostResult = main.CLIs[0].removeHost( hostList )
533 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
534 onpass="Successfully removed hosts",
535 onfail="Failed remove hosts" )
536
537 time.sleep( main.remHostDelay )
538
539 main.log.info( "Constructing device uri list" )
540 deviceList = []
541 for i in range( main.numMNswitches ):
542 deviceList.append( "of:00000000000000" + format( i+1, "02x" ) )
543
544 main.step( "Removing devices" )
545 deviceResult = main.CLIs[0].removeDevice( deviceList )
546 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
547 onpass="Successfully removed devices",
548 onfail="Failed remove devices" )
549
550 time.sleep( main.remDevDelay )
551
552 main.log.info( "Summary\n{}".format( main.CLIs[0].summary( jsonFormat=False ) ) )
553
554
Hari Krishnac195f3b2015-07-08 20:02:24 -0700555 def CASE40( self, main ):
556 """
GlennRC15d164c2015-12-15 17:12:25 -0800557 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700558 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700559 import time
GlennRC15d164c2015-12-15 17:12:25 -0800560 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700561 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800562 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700563
GlennRC15d164c2015-12-15 17:12:25 -0800564 main.step( "Enable Reactive forwarding" )
565 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
566 utilities.assert_equals( expect=main.TRUE, actual=appResult,
567 onpass="Successfully install fwd app",
568 onfail="Failed to install fwd app" )
569
Hari Krishnac195f3b2015-07-08 20:02:24 -0700570
GlennRC6ac11b12015-10-21 17:41:28 -0700571 main.step( "Verify Ping across all hosts" )
572 for i in range(main.numPings):
573 time1 = time.time()
574 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
575 if not pingResult:
576 main.log.warn("First pingall failed. Retrying...")
577 time.sleep(main.pingSleep)
GlennRC15d164c2015-12-15 17:12:25 -0800578 else:
579 break
GlennRC6ac11b12015-10-21 17:41:28 -0700580
Hari Krishnac195f3b2015-07-08 20:02:24 -0700581 time2 = time.time()
582 timeDiff = round( ( time2 - time1 ), 2 )
583 main.log.report(
584 "Time taken for Ping All: " +
585 str( timeDiff ) +
586 " seconds" )
587
GlennRC15d164c2015-12-15 17:12:25 -0800588 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700589 onpass="Reactive Mode IPv4 Pingall test PASS",
590 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700591
You Wangb6586542016-02-26 09:25:56 -0800592 if not pingResult and main.failSwitch:
593 main.log.report("Stopping test")
594 main.stop( email=main.emailOnStop )
595
GlennRC15d164c2015-12-15 17:12:25 -0800596 main.step( "Disable Reactive forwarding" )
597 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
598 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800599 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800600 onfail="Failed to deactivate fwd app" )
601
Hari Krishnac195f3b2015-07-08 20:02:24 -0700602 def CASE41( self, main ):
603 """
604 Verify Reactive forwarding (Chordal Topology)
605 """
606 import re
607 import copy
608 import time
609 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
610 main.log.report( "______________________________________________" )
611 main.case( "Enable Reactive forwarding and Verify ping all" )
612 main.step( "Enable Reactive forwarding" )
613 installResult = main.TRUE
614 # Activate fwd app
615 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
616
617 appCheck = main.TRUE
618 pool = []
619 for cli in main.CLIs:
620 t = main.Thread( target=cli.appToIDCheck,
621 name="appToIDCheck-" + str( i ),
622 args=[] )
623 pool.append( t )
624 t.start()
625 for t in pool:
626 t.join()
627 appCheck = appCheck and t.result
628 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
629 onpass="App Ids seem to be correct",
630 onfail="Something is wrong with app Ids" )
631 if appCheck != main.TRUE:
632 main.log.warn( main.CLIs[0].apps() )
633 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700634
Hari Krishnac195f3b2015-07-08 20:02:24 -0700635 time.sleep( 10 )
636
GlennRC6ac11b12015-10-21 17:41:28 -0700637 main.step( "Verify Ping across all hosts" )
638 for i in range(main.numPings):
639 time1 = time.time()
640 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
641 if not pingResult:
642 main.log.warn("First pingall failed. Retrying...")
643 time.sleep(main.pingSleep)
644 else: break
645
Hari Krishnac195f3b2015-07-08 20:02:24 -0700646 time2 = time.time()
647 timeDiff = round( ( time2 - time1 ), 2 )
648 main.log.report(
649 "Time taken for Ping All: " +
650 str( timeDiff ) +
651 " seconds" )
652
You Wangb6586542016-02-26 09:25:56 -0800653 if not pingResult and main.failSwitch:
654 main.log.report("Stopping test")
655 main.stop( email=main.emailOnStop )
656
GlennRC626ba132015-09-18 16:16:31 -0700657 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700658 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700659 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700660 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700661
GlennRCbddd58f2015-10-01 15:45:25 -0700662 caseResult = appCheck and pingResult
663 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700664 onpass="Reactive Mode IPv4 Pingall test PASS",
665 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700666
667 def CASE42( self, main ):
668 """
669 Verify Reactive forwarding (Spine Topology)
670 """
671 import re
672 import copy
673 import time
674 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
675 main.log.report( "______________________________________________" )
676 main.case( "Enable Reactive forwarding and Verify ping all" )
677 main.step( "Enable Reactive forwarding" )
678 installResult = main.TRUE
679 # Activate fwd app
680 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
681
682 appCheck = main.TRUE
683 pool = []
684 for cli in main.CLIs:
685 t = main.Thread( target=cli.appToIDCheck,
686 name="appToIDCheck-" + str( i ),
687 args=[] )
688 pool.append( t )
689 t.start()
690 for t in pool:
691 t.join()
692 appCheck = appCheck and t.result
693 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
694 onpass="App Ids seem to be correct",
695 onfail="Something is wrong with app Ids" )
696 if appCheck != main.TRUE:
697 main.log.warn( main.CLIs[0].apps() )
698 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700699
Hari Krishnac195f3b2015-07-08 20:02:24 -0700700 time.sleep( 10 )
701
GlennRC6ac11b12015-10-21 17:41:28 -0700702 main.step( "Verify Ping across all hosts" )
703 for i in range(main.numPings):
704 time1 = time.time()
705 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
706 if not pingResult:
707 main.log.warn("First pingall failed. Retrying...")
708 time.sleep(main.pingSleep)
709 else: break
710
Hari Krishnac195f3b2015-07-08 20:02:24 -0700711 time2 = time.time()
712 timeDiff = round( ( time2 - time1 ), 2 )
713 main.log.report(
714 "Time taken for Ping All: " +
715 str( timeDiff ) +
716 " seconds" )
717
You Wangb6586542016-02-26 09:25:56 -0800718 if not pingResult and main.failSwitch:
719 main.log.report("Stopping test")
720 main.stop( email=main.emailOnStop )
721
GlennRC626ba132015-09-18 16:16:31 -0700722 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700723 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700724 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700725 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
726
GlennRCbddd58f2015-10-01 15:45:25 -0700727 caseResult = appCheck and pingResult
728 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700729 onpass="Reactive Mode IPv4 Pingall test PASS",
730 onfail="Reactive Mode IPv4 Pingall test FAIL" )
731
GlennRC026dba62016-01-07 18:42:33 -0800732 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800733 """
734 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
735 """
GlennRC026dba62016-01-07 18:42:33 -0800736 import time
You Wang0779bac2016-01-27 16:32:33 -0800737 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800738 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800739 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800740
741 main.step( "Enable Reactive forwarding" )
742 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
743 utilities.assert_equals( expect=main.TRUE, actual=appResult,
744 onpass="Successfully install fwd app",
745 onfail="Failed to install fwd app" )
746
747 numHosts = int( main.params['TOPO1']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800748
749 for i in range(numHosts):
750 src = "h1"
751 dest = "h" + str(i+1)
752 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
753 main.Mininet1.handle.expect( "mininet>" )
754 main.log.info( main.Mininet1.handle.before )
755
756 hosts = main.CLIs[0].hosts( jsonFormat=False )
757
758 main.log.info( hosts )
759
760 main.step( "Disable Reactive forwarding" )
761 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
762 utilities.assert_equals( expect=main.TRUE, actual=appResult,
763 onpass="Successfully deactivated fwd app",
764 onfail="Failed to deactivate fwd app" )
765
766 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800767 """
768 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
769 """
GlennRC026dba62016-01-07 18:42:33 -0800770 import time
You Wang0779bac2016-01-27 16:32:33 -0800771 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800772 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800773 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800774
775 main.step( "Enable Reactive forwarding" )
776 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
777 utilities.assert_equals( expect=main.TRUE, actual=appResult,
778 onpass="Successfully install fwd app",
779 onfail="Failed to install fwd app" )
780
781 numHosts = int( main.params['TOPO2']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800782
783 for i in range(numHosts):
784 src = "h1"
785 dest = "h" + str(i+1)
786 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
787 main.Mininet1.handle.expect( "mininet>" )
788 main.log.info( main.Mininet1.handle.before )
789
790 hosts = main.CLIs[0].hosts( jsonFormat=False )
791
792 main.log.info( hosts )
793
794 main.step( "Disable Reactive forwarding" )
795 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
796 utilities.assert_equals( expect=main.TRUE, actual=appResult,
797 onpass="Successfully deactivated fwd app",
798 onfail="Failed to deactivate fwd app" )
799
800 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800801 """
802 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
803 """
GlennRC026dba62016-01-07 18:42:33 -0800804 import time
You Wang0779bac2016-01-27 16:32:33 -0800805 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800806 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800807 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800808
809 main.step( "Enable Reactive forwarding" )
810 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
811 utilities.assert_equals( expect=main.TRUE, actual=appResult,
812 onpass="Successfully install fwd app",
813 onfail="Failed to install fwd app" )
814
815 numHosts = int( main.params['TOPO3']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800816
You Wang0779bac2016-01-27 16:32:33 -0800817 for i in range(11, numHosts+10):
GlennRC026dba62016-01-07 18:42:33 -0800818 src = "h11"
You Wang0779bac2016-01-27 16:32:33 -0800819 dest = "h" + str(i+1)
GlennRC026dba62016-01-07 18:42:33 -0800820 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
821 main.Mininet1.handle.expect( "mininet>" )
822 main.log.info( main.Mininet1.handle.before )
823
824 hosts = main.CLIs[0].hosts( jsonFormat=False )
825
826 main.log.info( hosts )
827
828 main.step( "Disable Reactive forwarding" )
829 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
830 utilities.assert_equals( expect=main.TRUE, actual=appResult,
831 onpass="Successfully deactivated fwd app",
832 onfail="Failed to deactivate fwd app" )
833
Hari Krishna4223dbd2015-08-13 16:29:53 -0700834 def CASE140( self, main ):
835 """
836 Verify IPv6 Reactive forwarding (Att Topology)
837 """
838 import re
839 import copy
840 import time
841 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
842 main.log.report( "______________________________________________" )
843 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
844 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
845
846 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
847 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
848 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
849 cfgResult = cfgResult1 and cfgResult2
850 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
851 onpass="Reactive mode ipv6Fowarding cfg is set to true",
852 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
853
854 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700855 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700856 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700857 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
858 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700859 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700860 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700861 time2 = time.time()
862 timeDiff = round( ( time2 - time1 ), 2 )
863 main.log.report(
864 "Time taken for IPv6 Ping All: " +
865 str( timeDiff ) +
866 " seconds" )
867
GlennRC626ba132015-09-18 16:16:31 -0700868 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700869 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
870 else:
871 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700872
Jon Hall4ba53f02015-07-29 13:07:41 -0700873
GlennRC15d164c2015-12-15 17:12:25 -0800874 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700875 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700876 onpass="Reactive Mode IPv6 Pingall test PASS",
877 onfail="Reactive Mode IPv6 Pingall test FAIL" )
878
879 def CASE141( self, main ):
880 """
881 Verify IPv6 Reactive forwarding (Chordal Topology)
882 """
883 import re
884 import copy
885 import time
886 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
887 main.log.report( "______________________________________________" )
888 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
889 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
890
891 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
892 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
893 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
894 cfgResult = cfgResult1 and cfgResult2
895 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
896 onpass="Reactive mode ipv6Fowarding cfg is set to true",
897 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
898
899 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700900 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700901 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700902 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
903 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700904 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700905 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700906 time2 = time.time()
907 timeDiff = round( ( time2 - time1 ), 2 )
908 main.log.report(
909 "Time taken for IPv6 Ping All: " +
910 str( timeDiff ) +
911 " seconds" )
912
GlennRC626ba132015-09-18 16:16:31 -0700913 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700914 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
915 else:
916 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
917
918 main.step( "Disable Reactive forwarding" )
919
920 main.log.info( "Uninstall reactive forwarding app" )
921 appCheck = main.TRUE
922 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
923 pool = []
924 for cli in main.CLIs:
925 t = main.Thread( target=cli.appToIDCheck,
926 name="appToIDCheck-" + str( i ),
927 args=[] )
928 pool.append( t )
929 t.start()
930
931 for t in pool:
932 t.join()
933 appCheck = appCheck and t.result
934 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
935 onpass="App Ids seem to be correct",
936 onfail="Something is wrong with app Ids" )
937 if appCheck != main.TRUE:
938 main.log.warn( main.CLIs[0].apps() )
939 main.log.warn( main.CLIs[0].appIDs() )
940
941 # Waiting for reative flows to be cleared.
942 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700943 caseResult = appCheck and cfgResult and pingResult
944 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700945 onpass="Reactive Mode IPv6 Pingall test PASS",
946 onfail="Reactive Mode IPv6 Pingall test FAIL" )
947
948 def CASE142( self, main ):
949 """
950 Verify IPv6 Reactive forwarding (Spine Topology)
951 """
952 import re
953 import copy
954 import time
955 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
956 main.log.report( "______________________________________________" )
957 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
958 # Spine topology do not have hosts h1-h10
959 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
960 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
961 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
962 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
963 cfgResult = cfgResult1 and cfgResult2
964 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
965 onpass="Reactive mode ipv6Fowarding cfg is set to true",
966 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
967
968 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700969 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700970 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700971 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
972 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700973 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700974 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700975 time2 = time.time()
976 timeDiff = round( ( time2 - time1 ), 2 )
977 main.log.report(
978 "Time taken for IPv6 Ping All: " +
979 str( timeDiff ) +
980 " seconds" )
981
GlennRC626ba132015-09-18 16:16:31 -0700982 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700983 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
984 else:
985 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
986
987 main.step( "Disable Reactive forwarding" )
988
989 main.log.info( "Uninstall reactive forwarding app" )
990 appCheck = main.TRUE
991 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
992 pool = []
993 for cli in main.CLIs:
994 t = main.Thread( target=cli.appToIDCheck,
995 name="appToIDCheck-" + str( i ),
996 args=[] )
997 pool.append( t )
998 t.start()
999
1000 for t in pool:
1001 t.join()
1002 appCheck = appCheck and t.result
1003 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1004 onpass="App Ids seem to be correct",
1005 onfail="Something is wrong with app Ids" )
1006 if appCheck != main.TRUE:
1007 main.log.warn( main.CLIs[0].apps() )
1008 main.log.warn( main.CLIs[0].appIDs() )
1009
1010 # Waiting for reative flows to be cleared.
1011 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -07001012 caseResult = appCheck and cfgResult and pingResult
1013 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001014 onpass="Reactive Mode IPv6 Pingall test PASS",
1015 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001016
You Wang0779bac2016-01-27 16:32:33 -08001017 def CASE147( self, main ):
1018 """
1019 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
1020 """
1021 import time
1022 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
1023 main.log.report( "______________________________________________" )
1024 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1025
1026 main.step( "Enable IPv4 Reactive forwarding" )
1027 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1028 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1029 onpass="Successfully install fwd app",
1030 onfail="Failed to install fwd app" )
1031
1032 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1033 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1034 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1035 cfgResult = cfgResult1 and cfgResult2
1036 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1037 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1038 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1039
You Wangb6586542016-02-26 09:25:56 -08001040 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001041 numHosts = int( main.params['TOPO1']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001042 for i in range(numHosts):
1043 src = "h1"
1044 dest = "1000::" + str(i+1)
1045 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1046 main.Mininet1.handle.expect( "mininet>" )
1047 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001048 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001049 main.log.info( hosts )
1050
1051 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001052 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1053 appCheck = main.TRUE
1054 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1055 pool = []
1056 for cli in main.CLIs:
1057 t = main.Thread( target=cli.appToIDCheck,
1058 name="appToIDCheck-" + str( i ),
1059 args=[] )
1060 pool.append( t )
1061 t.start()
1062
1063 for t in pool:
1064 t.join()
1065 appCheck = appCheck and t.result
1066 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1067 onpass="App Ids seem to be correct",
1068 onfail="Something is wrong with app Ids" )
1069
1070 if appCheck != main.TRUE:
1071 main.log.warn( main.CLIs[0].apps() )
1072 main.log.warn( main.CLIs[0].appIDs() )
1073
1074 # Waiting for reative flows to be cleared.
1075 time.sleep( 30 )
1076
1077 main.step( "Disable IPv4 Reactive forwarding" )
1078 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1079 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1080 onpass="Successfully deactivated IPv4 fwd app",
1081 onfail="Failed to deactivate IPv4 fwd app" )
1082
1083 def CASE148( self, main ):
1084 """
1085 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1086 """
1087 import time
1088 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1089 main.log.report( "______________________________________________" )
1090 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1091
1092 main.step( "Enable IPv4 Reactive forwarding" )
1093 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1094 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1095 onpass="Successfully install fwd app",
1096 onfail="Failed to install fwd app" )
1097
1098 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1099 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1100 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1101 cfgResult = cfgResult1 and cfgResult2
1102 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1103 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1104 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1105
You Wangb6586542016-02-26 09:25:56 -08001106 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001107 numHosts = int( main.params['TOPO2']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001108 for i in range(numHosts):
1109 src = "h1"
1110 dest = "1000::" + str(i+1)
1111 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1112 main.Mininet1.handle.expect( "mininet>" )
1113 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001114 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001115 main.log.info( hosts )
1116
1117 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001118 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1119 appCheck = main.TRUE
1120 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1121 pool = []
1122 for cli in main.CLIs:
1123 t = main.Thread( target=cli.appToIDCheck,
1124 name="appToIDCheck-" + str( i ),
1125 args=[] )
1126 pool.append( t )
1127 t.start()
1128
1129 for t in pool:
1130 t.join()
1131 appCheck = appCheck and t.result
1132 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1133 onpass="App Ids seem to be correct",
1134 onfail="Something is wrong with app Ids" )
1135
1136 if appCheck != main.TRUE:
1137 main.log.warn( main.CLIs[0].apps() )
1138 main.log.warn( main.CLIs[0].appIDs() )
1139
1140 # Waiting for reative flows to be cleared.
1141 time.sleep( 30 )
1142
1143 main.step( "Disable IPv4 Reactive forwarding" )
1144 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1145 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1146 onpass="Successfully deactivated IPv4 fwd app",
1147 onfail="Failed to deactivate IPv4 fwd app" )
1148
1149 def CASE149( self, main ):
1150 """
1151 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1152 """
1153 import time
1154 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1155 main.log.report( "______________________________________________" )
1156 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1157
1158 main.step( "Enable IPv4 Reactive forwarding" )
1159 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1160 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1161 onpass="Successfully install fwd app",
1162 onfail="Failed to install fwd app" )
1163
1164 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1165 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1166 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1167 cfgResult = cfgResult1 and cfgResult2
1168 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1169 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1170 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1171
You Wangb6586542016-02-26 09:25:56 -08001172 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001173 numHosts = int( main.params['TOPO3']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001174 for i in range(11, numHosts+10):
1175 src = "h11"
1176 dest = "1000::" + str(i+1)
1177 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1178 main.Mininet1.handle.expect( "mininet>" )
1179 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001180 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001181 main.log.info( hosts )
1182
1183 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001184 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1185 appCheck = main.TRUE
1186 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1187 pool = []
1188 for cli in main.CLIs:
1189 t = main.Thread( target=cli.appToIDCheck,
1190 name="appToIDCheck-" + str( i ),
1191 args=[] )
1192 pool.append( t )
1193 t.start()
1194
1195 for t in pool:
1196 t.join()
1197 appCheck = appCheck and t.result
1198 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1199 onpass="App Ids seem to be correct",
1200 onfail="Something is wrong with app Ids" )
1201
1202 if appCheck != main.TRUE:
1203 main.log.warn( main.CLIs[0].apps() )
1204 main.log.warn( main.CLIs[0].appIDs() )
1205
1206 # Waiting for reative flows to be cleared.
1207 time.sleep( 30 )
1208
1209 main.step( "Disable IPv4 Reactive forwarding" )
1210 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1211 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1212 onpass="Successfully deactivated IPv4 fwd app",
1213 onfail="Failed to deactivate IPv4 fwd app" )
1214
Hari Krishnac195f3b2015-07-08 20:02:24 -07001215 def CASE5( self, main ):
1216 """
1217 Compare current ONOS topology with reference data
1218 """
1219 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001220
Hari Krishnac195f3b2015-07-08 20:02:24 -07001221 devicesDPIDTemp = []
1222 hostMACsTemp = []
1223 deviceLinksTemp = []
1224 deviceActiveLinksCountTemp = []
1225 devicePortsEnabledCountTemp = []
1226
1227 main.log.report(
1228 "Compare ONOS topology with reference data in Stores" )
1229 main.log.report( "__________________________________________________" )
1230 main.case( "Compare ONOS topology with reference data" )
1231
1232 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001233
GlennRC289c1b62015-12-12 10:45:43 -08001234 for check in range(main.topoCheck):
1235 time1 = time.time()
1236 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
1237 pool = []
1238 for cli in main.CLIs:
1239 if i >= main.numMNswitches + 1:
1240 break
GlennRC20fc6522015-12-23 23:26:57 -08001241 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001242 t = main.Thread(target = cli.getDevicePortsEnabledCount,
1243 threadID = main.threadID,
1244 name = "getDevicePortsEnabledCount",
1245 args = [dpid])
1246 t.start()
1247 pool.append(t)
1248 i = i + 1
1249 main.threadID = main.threadID + 1
1250 for thread in pool:
1251 thread.join()
1252 portResult = thread.result
1253 #portTemp = re.split( r'\t+', portResult )
1254 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1255 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001256
GlennRC289c1b62015-12-12 10:45:43 -08001257 time2 = time.time()
1258 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
1259 main.log.info (
1260 "Device Enabled ports EXPECTED: %s" %
1261 str( main.devicePortsEnabledCount ) )
1262 main.log.info (
1263 "Device Enabled ports ACTUAL: %s" %
1264 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001265
GlennRC289c1b62015-12-12 10:45:43 -08001266 if ( cmp( main.devicePortsEnabledCount,
1267 devicePortsEnabledCountTemp ) == 0 ):
1268 stepResult1 = main.TRUE
1269 else:
1270 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001271
GlennRC289c1b62015-12-12 10:45:43 -08001272 main.step( "Compare Device active links with reference" )
1273 time1 = time.time()
1274 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
1275 pool = []
1276 for cli in main.CLIs:
1277 if i >= main.numMNswitches + 1:
1278 break
GlennRC20fc6522015-12-23 23:26:57 -08001279 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001280 t = main.Thread(target = cli.getDeviceLinksActiveCount,
1281 threadID = main.threadID,
1282 name = "getDeviceLinksActiveCount",
1283 args = [dpid])
1284 t.start()
1285 pool.append(t)
1286 i = i + 1
1287 main.threadID = main.threadID + 1
1288 for thread in pool:
1289 thread.join()
1290 linkCountResult = thread.result
1291 #linkCountTemp = re.split( r'\t+', linkCountResult )
1292 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1293 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001294
GlennRC289c1b62015-12-12 10:45:43 -08001295 time2 = time.time()
1296 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
1297 main.log.info (
1298 "Device Active links EXPECTED: %s" %
1299 str( main.deviceActiveLinksCount ) )
1300 main.log.info (
1301 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1302 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1303 stepResult2 = main.TRUE
1304 else:
1305 stepResult2 = main.FALSE
1306
1307 """
1308 place holder for comparing devices, hosts, paths and intents if required.
1309 Links and ports data would be incorrect with out devices anyways.
1310 """
1311 caseResult = ( stepResult1 and stepResult2 )
1312
1313 if caseResult:
1314 break
1315 else:
1316 time.sleep( main.topoCheckDelay )
1317 main.log.warn( "Topology check failed. Trying again..." )
1318
1319
1320 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001321 onpass="Compare Topology test PASS",
1322 onfail="Compare Topology test FAIL" )
1323
1324 def CASE60( self ):
1325 """
1326 Install 300 host intents and verify ping all (Att Topology)
1327 """
1328 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1329 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001330 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001331
Hari Krishnac195f3b2015-07-08 20:02:24 -07001332 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001333 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001334 main.intentIds = list(intentIdList)
1335
GlennRCa8d786a2015-09-23 17:40:11 -07001336 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001337 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001338 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1339 onpass="INTENTS INSTALLED",
1340 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001341
1342 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001343 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001344 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1345 onpass="PING ALL PASS",
1346 onfail="PING ALL FAIL" )
1347
GlennRCbddd58f2015-10-01 15:45:25 -07001348 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001349 utilities.assert_equals(
1350 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001351 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001352 onpass="Install 300 Host Intents and Ping All test PASS",
1353 onfail="Install 300 Host Intents and Ping All test FAIL" )
1354
GlennRCfcfdc4f2015-09-30 16:01:57 -07001355 if not intentState:
1356 main.log.debug( "Intents failed to install completely" )
1357 if not pingResult:
1358 main.log.debug( "Pingall failed" )
1359
GlennRCbddd58f2015-10-01 15:45:25 -07001360 if not caseResult and main.failSwitch:
1361 main.log.report("Stopping test")
1362 main.stop( email=main.emailOnStop )
1363
Hari Krishnac195f3b2015-07-08 20:02:24 -07001364 def CASE61( self ):
1365 """
You Wang0779bac2016-01-27 16:32:33 -08001366 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001367 """
You Wang0779bac2016-01-27 16:32:33 -08001368 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001369 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001370 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001371
Hari Krishnac195f3b2015-07-08 20:02:24 -07001372 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001373 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001374 main.intentIds = list(intentIdList)
1375
GlennRCa8d786a2015-09-23 17:40:11 -07001376 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001377 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001378 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1379 onpass="INTENTS INSTALLED",
1380 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001381
1382 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001383 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001384 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1385 onpass="PING ALL PASS",
1386 onfail="PING ALL FAIL" )
1387
GlennRCbddd58f2015-10-01 15:45:25 -07001388 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001389 utilities.assert_equals( expect=main.TRUE,
1390 actual=caseResult,
1391 onpass="Install 300 Host Intents and Ping All test PASS",
1392 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001393
GlennRCfcfdc4f2015-09-30 16:01:57 -07001394 if not intentState:
1395 main.log.debug( "Intents failed to install completely" )
1396 if not pingResult:
1397 main.log.debug( "Pingall failed" )
1398
GlennRCbddd58f2015-10-01 15:45:25 -07001399 if not caseResult and main.failSwitch:
1400 main.log.report("Stopping test")
1401 main.stop( email=main.emailOnStop )
1402
Hari Krishnac195f3b2015-07-08 20:02:24 -07001403 def CASE62( self ):
1404 """
1405 Install 2278 host intents and verify ping all for Spine Topology
1406 """
1407 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1408 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001409 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001410
You Wangb6586542016-02-26 09:25:56 -08001411 main.step( "Add host Intents" )
1412 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001413 main.intentIds = list(intentIdList)
1414
GlennRCa8d786a2015-09-23 17:40:11 -07001415 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001416 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001417 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1418 onpass="INTENTS INSTALLED",
1419 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001420
1421 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001422 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001423 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1424 onpass="PING ALL PASS",
1425 onfail="PING ALL FAIL" )
1426
GlennRCbddd58f2015-10-01 15:45:25 -07001427 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001428 utilities.assert_equals( expect=main.TRUE,
1429 actual=caseResult,
1430 onpass="Install 2278 Host Intents and Ping All test PASS",
1431 onfail="Install 2278 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001432
GlennRCfcfdc4f2015-09-30 16:01:57 -07001433 if not intentState:
1434 main.log.debug( "Intents failed to install completely" )
1435 if not pingResult:
1436 main.log.debug( "Pingall failed" )
1437
GlennRCbddd58f2015-10-01 15:45:25 -07001438 if not caseResult and main.failSwitch:
1439 main.log.report("Stopping test")
1440 main.stop( email=main.emailOnStop )
1441
Hari Krishna4223dbd2015-08-13 16:29:53 -07001442 def CASE160( self ):
1443 """
1444 Verify IPv6 ping across 300 host intents (Att Topology)
1445 """
1446 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1447 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001448 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001449
Hari Krishna4223dbd2015-08-13 16:29:53 -07001450 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001451 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1452 utilities.assert_equals( expect=main.TRUE,
1453 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001454 onpass="PING ALL PASS",
1455 onfail="PING ALL FAIL" )
1456
GlennRCbddd58f2015-10-01 15:45:25 -07001457 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001458 utilities.assert_equals(
1459 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001460 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001461 onpass="IPv6 Ping across 300 host intents test PASS",
1462 onfail="IPv6 Ping across 300 host intents test FAIL" )
1463
You Wangb6586542016-02-26 09:25:56 -08001464 if not caseResult and main.failSwitch:
1465 main.log.report("Stopping test")
1466 main.stop( email=main.emailOnStop )
1467
Hari Krishna4223dbd2015-08-13 16:29:53 -07001468 def CASE161( self ):
1469 """
You Wang0779bac2016-01-27 16:32:33 -08001470 Verify IPv6 ping across 300 host intents (Chordal Topology)
Hari Krishna4223dbd2015-08-13 16:29:53 -07001471 """
You Wang0779bac2016-01-27 16:32:33 -08001472 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001473 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001474 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001475
Hari Krishna4223dbd2015-08-13 16:29:53 -07001476 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001477 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001478 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1479 onpass="PING ALL PASS",
1480 onfail="PING ALL FAIL" )
1481
GlennRCbddd58f2015-10-01 15:45:25 -07001482 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001483 utilities.assert_equals(
1484 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001485 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001486 onpass="IPv6 Ping across 300 host intents test PASS",
1487 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001488
You Wangb6586542016-02-26 09:25:56 -08001489 if not caseResult and main.failSwitch:
1490 main.log.report("Stopping test")
1491 main.stop( email=main.emailOnStop )
1492
Hari Krishna4223dbd2015-08-13 16:29:53 -07001493 def CASE162( self ):
1494 """
1495 Verify IPv6 ping across 2278 host intents (Spine Topology)
1496 """
1497 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1498 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001499 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001500
Hari Krishna4223dbd2015-08-13 16:29:53 -07001501 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001502 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001503 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1504 onpass="PING ALL PASS",
1505 onfail="PING ALL FAIL" )
1506
GlennRCbddd58f2015-10-01 15:45:25 -07001507 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001508 utilities.assert_equals(
1509 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001510 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001511 onpass="IPv6 Ping across 2278 host intents test PASS",
1512 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001513
You Wangb6586542016-02-26 09:25:56 -08001514 if not caseResult and main.failSwitch:
1515 main.log.report("Stopping test")
1516 main.stop( email=main.emailOnStop )
1517
Hari Krishnac195f3b2015-07-08 20:02:24 -07001518 def CASE70( self, main ):
1519 """
1520 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1521 """
1522 import random
1523 main.randomLink1 = []
1524 main.randomLink2 = []
1525 main.randomLink3 = []
1526 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1527 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1528 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1529 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1530 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1531 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1532 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001533
1534 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1535 main.log.report( "___________________________________________________________________________" )
1536 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1537 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1538 if ( int( switchLinksToToggle ) ==
1539 0 or int( switchLinksToToggle ) > 5 ):
1540 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1541 #main.cleanup()
1542 #main.exit()
1543 else:
1544 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1545
1546 main.step( "Cut links on Core devices using user provided range" )
1547 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1548 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1549 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1550 for i in range( int( switchLinksToToggle ) ):
1551 main.Mininet1.link(
1552 END1=link1End1,
1553 END2=main.randomLink1[ i ],
1554 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001555 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001556 main.Mininet1.link(
1557 END1=link2End1,
1558 END2=main.randomLink2[ i ],
1559 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001560 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001561 main.Mininet1.link(
1562 END1=link3End1,
1563 END2=main.randomLink3[ i ],
1564 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001565 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001566
You Wang0779bac2016-01-27 16:32:33 -08001567 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001568 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1569 int( main.numMNlinks ) -
1570 int( switchLinksToToggle ) * 6 )
1571 utilities.assert_equals( expect=main.TRUE,
1572 actual=linkDown,
1573 onpass="Link down discovered properly",
1574 onfail="Link down was not discovered in " +
1575 str( main.linkSleep * main.linkCheck ) +
1576 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001577
GlennRCfcfdc4f2015-09-30 16:01:57 -07001578 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001579 intentState = main.CHOtestFunctions.checkIntents()
1580 utilities.assert_equals( expect=main.TRUE,
1581 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001582 onpass="INTENTS INSTALLED",
1583 onfail="SOME INTENTS NOT INSTALLED" )
1584
Hari Krishnac195f3b2015-07-08 20:02:24 -07001585 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001586 pingResult = main.CHOtestFunctions.checkPingall()
1587 utilities.assert_equals( expect=main.TRUE,
1588 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001589 onpass="PING ALL PASS",
1590 onfail="PING ALL FAIL" )
1591
GlennRCbddd58f2015-10-01 15:45:25 -07001592 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001593 utilities.assert_equals( expect=main.TRUE,
1594 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001595 onpass="Random Link cut Test PASS",
1596 onfail="Random Link cut Test FAIL" )
1597
GlennRCfcfdc4f2015-09-30 16:01:57 -07001598 # Printing what exactly failed
1599 if not linkDown:
1600 main.log.debug( "Link down was not discovered correctly" )
1601 if not pingResult:
1602 main.log.debug( "Pingall failed" )
1603 if not intentState:
1604 main.log.debug( "Intents are not all installed" )
1605
GlennRCbddd58f2015-10-01 15:45:25 -07001606 if not caseResult and main.failSwitch:
1607 main.log.report("Stopping test")
1608 main.stop( email=main.emailOnStop )
1609
Hari Krishnac195f3b2015-07-08 20:02:24 -07001610 def CASE80( self, main ):
1611 """
1612 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1613 """
1614 import random
1615 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1616 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1617 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001618 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001619 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1620
1621 main.log.report(
1622 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1623 main.log.report(
1624 "__________________________________________________________________" )
1625 main.case(
1626 "Host intents - Bring the core links up that are down and verify ping all" )
1627 main.step( "Bring randomly cut links on Core devices up" )
1628 for i in range( int( switchLinksToToggle ) ):
1629 main.Mininet1.link(
1630 END1=link1End1,
1631 END2=main.randomLink1[ i ],
1632 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001633 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001634 main.Mininet1.link(
1635 END1=link2End1,
1636 END2=main.randomLink2[ i ],
1637 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001638 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001639 main.Mininet1.link(
1640 END1=link3End1,
1641 END2=main.randomLink3[ i ],
1642 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001643 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001644
You Wang0779bac2016-01-27 16:32:33 -08001645 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001646 linkUp = main.CHOtestFunctions.checkLinkEvents( "up",
1647 int( main.numMNlinks ) )
1648 utilities.assert_equals( expect=main.TRUE,
1649 actual=linkUp,
1650 onpass="Link up discovered properly",
1651 onfail="Link up was not discovered in " +
1652 str( main.linkSleep * main.linkCheck ) +
1653 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001654
GlennRCfcfdc4f2015-09-30 16:01:57 -07001655 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001656 intentState = main.CHOtestFunctions.checkIntents()
1657 utilities.assert_equals( expect=main.TRUE,
1658 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001659 onpass="INTENTS INSTALLED",
1660 onfail="SOME INTENTS NOT INSTALLED" )
1661
Hari Krishnac195f3b2015-07-08 20:02:24 -07001662 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001663 pingResult = main.CHOtestFunctions.checkPingall()
1664 utilities.assert_equals( expect=main.TRUE,
1665 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001666 onpass="PING ALL PASS",
1667 onfail="PING ALL FAIL" )
1668
GlennRCbddd58f2015-10-01 15:45:25 -07001669 caseResult = linkUp and pingResult
1670 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001671 onpass="Link Up Test PASS",
1672 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001673 # Printing what exactly failed
1674 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001675 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001676 if not pingResult:
1677 main.log.debug( "Pingall failed" )
1678 if not intentState:
1679 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001680
GlennRCbddd58f2015-10-01 15:45:25 -07001681 if not caseResult and main.failSwitch:
1682 main.log.report("Stopping test")
1683 main.stop( email=main.emailOnStop )
1684
Hari Krishnac195f3b2015-07-08 20:02:24 -07001685 def CASE71( self, main ):
1686 """
1687 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1688 """
1689 import random
1690 main.randomLink1 = []
1691 main.randomLink2 = []
1692 main.randomLink3 = []
1693 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1694 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1695 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1696 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1697 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1698 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1699 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
You Wangb6586542016-02-26 09:25:56 -08001700 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001701
1702 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1703 main.log.report( "___________________________________________________________________________" )
1704 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1705 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1706 if ( int( switchLinksToToggle ) ==
1707 0 or int( switchLinksToToggle ) > 5 ):
1708 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1709 #main.cleanup()
1710 #main.exit()
1711 else:
1712 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1713
1714 main.step( "Cut links on Core devices using user provided range" )
1715 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1716 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1717 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1718 for i in range( int( switchLinksToToggle ) ):
1719 main.Mininet1.link(
1720 END1=link1End1,
1721 END2=main.randomLink1[ i ],
1722 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001723 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001724 main.Mininet1.link(
1725 END1=link2End1,
1726 END2=main.randomLink2[ i ],
1727 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001728 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001729 main.Mininet1.link(
1730 END1=link3End1,
1731 END2=main.randomLink3[ i ],
1732 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001733 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001734
You Wang0779bac2016-01-27 16:32:33 -08001735 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001736 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1737 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 )
1738 utilities.assert_equals( expect=main.TRUE,
1739 actual=linkDown,
1740 onpass="Link down discovered properly",
1741 onfail="Link down was not discovered in " +
1742 str( main.linkSleep * main.linkCheck ) +
1743 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001744
GlennRCfcfdc4f2015-09-30 16:01:57 -07001745 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001746 intentState = main.CHOtestFunctions.checkIntents()
1747 utilities.assert_equals( expect=main.TRUE,
1748 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001749 onpass="INTENTS INSTALLED",
1750 onfail="SOME INTENTS NOT INSTALLED" )
1751
Hari Krishnac195f3b2015-07-08 20:02:24 -07001752 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001753 pingResult = main.CHOtestFunctions.checkPingall()
1754 utilities.assert_equals( expect=main.TRUE,
1755 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001756 onpass="PING ALL PASS",
1757 onfail="PING ALL FAIL" )
1758
GlennRCbddd58f2015-10-01 15:45:25 -07001759 caseResult = linkDown and pingResult and intentState
1760 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001761 onpass="Random Link cut Test PASS",
1762 onfail="Random Link cut Test FAIL" )
1763
GlennRCfcfdc4f2015-09-30 16:01:57 -07001764 # Printing what exactly failed
1765 if not linkDown:
1766 main.log.debug( "Link down was not discovered correctly" )
1767 if not pingResult:
1768 main.log.debug( "Pingall failed" )
1769 if not intentState:
1770 main.log.debug( "Intents are not all installed" )
1771
GlennRCbddd58f2015-10-01 15:45:25 -07001772 if not caseResult and main.failSwitch:
1773 main.log.report("Stopping test")
1774 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001775
Hari Krishnac195f3b2015-07-08 20:02:24 -07001776 def CASE81( self, main ):
1777 """
1778 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1779 """
1780 import random
1781 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1782 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1783 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001784 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001785 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1786
1787 main.log.report(
1788 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1789 main.log.report(
1790 "__________________________________________________________________" )
1791 main.case(
1792 "Point intents - Bring the core links up that are down and verify ping all" )
1793 main.step( "Bring randomly cut links on Core devices up" )
1794 for i in range( int( switchLinksToToggle ) ):
1795 main.Mininet1.link(
1796 END1=link1End1,
1797 END2=main.randomLink1[ i ],
1798 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001799 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001800 main.Mininet1.link(
1801 END1=link2End1,
1802 END2=main.randomLink2[ i ],
1803 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001804 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001805 main.Mininet1.link(
1806 END1=link3End1,
1807 END2=main.randomLink3[ i ],
1808 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001809 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001810
You Wang0779bac2016-01-27 16:32:33 -08001811 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001812 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1813 utilities.assert_equals( expect=main.TRUE,
1814 actual=linkUp,
1815 onpass="Link up discovered properly",
1816 onfail="Link up was not discovered in " +
1817 str( main.linkSleep * main.linkCheck ) +
1818 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819
GlennRCfcfdc4f2015-09-30 16:01:57 -07001820 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001821 intentState = main.CHOtestFunctions.checkIntents()
1822 utilities.assert_equals( expect=main.TRUE,
1823 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001824 onpass="INTENTS INSTALLED",
1825 onfail="SOME INTENTS NOT INSTALLED" )
1826
Hari Krishnac195f3b2015-07-08 20:02:24 -07001827 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001828 pingResult = main.CHOtestFunctions.checkPingall()
1829 utilities.assert_equals( expect=main.TRUE,
1830 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001831 onpass="PING ALL PASS",
1832 onfail="PING ALL FAIL" )
1833
GlennRCbddd58f2015-10-01 15:45:25 -07001834 caseResult = linkUp and pingResult
1835 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001836 onpass="Link Up Test PASS",
1837 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001838 # Printing what exactly failed
1839 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001840 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001841 if not pingResult:
1842 main.log.debug( "Pingall failed" )
1843 if not intentState:
1844 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001845
GlennRCbddd58f2015-10-01 15:45:25 -07001846 if not caseResult and main.failSwitch:
1847 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001848 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001849
Hari Krishnac195f3b2015-07-08 20:02:24 -07001850 def CASE72( self, main ):
1851 """
1852 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1853 """
1854 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001855 import itertools
You Wangb6586542016-02-26 09:25:56 -08001856 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001857
Hari Krishnac195f3b2015-07-08 20:02:24 -07001858 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1859 main.log.report( "___________________________________________________________________________" )
1860 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1861 switches = []
1862 switchesComb = []
1863 for i in range( main.numMNswitches ):
1864 switches.append('s%d'%(i+1))
1865 switchesLinksComb = list(itertools.combinations(switches,2))
1866 main.randomLinks = random.sample(switchesLinksComb, 5 )
1867 print main.randomLinks
1868 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001869
Hari Krishnac195f3b2015-07-08 20:02:24 -07001870 for switch in main.randomLinks:
1871 main.Mininet1.link(
1872 END1=switch[0],
1873 END2=switch[1],
1874 OPTION="down")
You Wangb6586542016-02-26 09:25:56 -08001875 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001876
You Wang0779bac2016-01-27 16:32:33 -08001877 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001878 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1879 utilities.assert_equals( expect=main.TRUE,
1880 actual=linkDown,
1881 onpass="Link down discovered properly",
1882 onfail="Link down was not discovered in " +
1883 str( main.linkSleep * main.linkCheck ) +
1884 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001885
GlennRCfcfdc4f2015-09-30 16:01:57 -07001886 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001887 intentState = main.CHOtestFunctions.checkIntents()
1888 utilities.assert_equals( expect=main.TRUE,
1889 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001890 onpass="INTENTS INSTALLED",
1891 onfail="SOME INTENTS NOT INSTALLED" )
1892
Hari Krishnac195f3b2015-07-08 20:02:24 -07001893 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001894 pingResult = main.CHOtestFunctions.checkPingall()
1895 utilities.assert_equals( expect=main.TRUE,
1896 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001897 onpass="PING ALL PASS",
1898 onfail="PING ALL FAIL" )
1899
GlennRCbddd58f2015-10-01 15:45:25 -07001900 caseResult = linkDown and pingResult and intentState
1901 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001902 onpass="Random Link cut Test PASS",
1903 onfail="Random Link cut Test FAIL" )
1904
GlennRCfcfdc4f2015-09-30 16:01:57 -07001905 # Printing what exactly failed
1906 if not linkDown:
1907 main.log.debug( "Link down was not discovered correctly" )
1908 if not pingResult:
1909 main.log.debug( "Pingall failed" )
1910 if not intentState:
1911 main.log.debug( "Intents are not all installed" )
1912
GlennRCbddd58f2015-10-01 15:45:25 -07001913 if not caseResult and main.failSwitch:
1914 main.log.report("Stopping test")
1915 main.stop( email=main.emailOnStop )
1916
Hari Krishnac195f3b2015-07-08 20:02:24 -07001917 def CASE82( self, main ):
1918 """
1919 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1920 """
1921 import random
You Wangb6586542016-02-26 09:25:56 -08001922 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001923
Hari Krishnac195f3b2015-07-08 20:02:24 -07001924 main.log.report(
1925 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1926 main.log.report(
1927 "__________________________________________________________________" )
1928 main.case(
1929 "Host intents - Bring the core links up that are down and verify ping all" )
1930 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001931
Hari Krishnac195f3b2015-07-08 20:02:24 -07001932 for switch in main.randomLinks:
1933 main.Mininet1.link(
1934 END1=switch[0],
1935 END2=switch[1],
1936 OPTION="up")
You Wangb6586542016-02-26 09:25:56 -08001937 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001938
You Wang0779bac2016-01-27 16:32:33 -08001939 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001940 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1941 utilities.assert_equals( expect=main.TRUE,
1942 actual=linkUp,
1943 onpass="Link up discovered properly",
1944 onfail="Link up was not discovered in " +
1945 str( main.linkSleep * main.linkCheck ) +
1946 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001947
GlennRCfcfdc4f2015-09-30 16:01:57 -07001948 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001949 intentState = main.CHOtestFunctions.checkIntents()
1950 utilities.assert_equals( expect=main.TRUE,
1951 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001952 onpass="INTENTS INSTALLED",
1953 onfail="SOME INTENTS NOT INSTALLED" )
1954
Hari Krishnac195f3b2015-07-08 20:02:24 -07001955 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001956 pingResult = main.CHOtestFunctions.checkPingall()
1957 utilities.assert_equals( expect=main.TRUE,
1958 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001959 onpass="PING ALL PASS",
1960 onfail="PING ALL FAIL" )
1961
GlennRCbddd58f2015-10-01 15:45:25 -07001962 caseResult = linkUp and pingResult
1963 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001964 onpass="Link Up Test PASS",
1965 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001966 # Printing what exactly failed
1967 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001968 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001969 if not pingResult:
1970 main.log.debug( "Pingall failed" )
1971 if not intentState:
1972 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001973
GlennRCbddd58f2015-10-01 15:45:25 -07001974 if not caseResult and main.failSwitch:
1975 main.log.report("Stopping test")
1976 main.stop( email=main.emailOnStop )
1977
Hari Krishnac195f3b2015-07-08 20:02:24 -07001978 def CASE73( self, main ):
1979 """
1980 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1981 """
1982 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001983 import itertools
You Wangb6586542016-02-26 09:25:56 -08001984 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001985
Hari Krishnac195f3b2015-07-08 20:02:24 -07001986 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1987 main.log.report( "___________________________________________________________________________" )
1988 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1989 switches = []
1990 switchesComb = []
1991 for i in range( main.numMNswitches ):
1992 switches.append('s%d'%(i+1))
1993 switchesLinksComb = list(itertools.combinations(switches,2))
1994 main.randomLinks = random.sample(switchesLinksComb, 5 )
1995 print main.randomLinks
1996 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001997
Hari Krishnac195f3b2015-07-08 20:02:24 -07001998 for switch in main.randomLinks:
1999 main.Mininet1.link(
2000 END1=switch[0],
2001 END2=switch[1],
2002 OPTION="down")
You Wangb6586542016-02-26 09:25:56 -08002003 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002004
You Wang0779bac2016-01-27 16:32:33 -08002005 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002006 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
2007 utilities.assert_equals( expect=main.TRUE,
2008 actual=linkDown,
2009 onpass="Link down discovered properly",
2010 onfail="Link down was not discovered in " +
2011 str( main.linkSleep * main.linkCheck ) +
2012 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002013
GlennRCfcfdc4f2015-09-30 16:01:57 -07002014 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002015 intentState = main.CHOtestFunctions.checkIntents()
2016 utilities.assert_equals( expect=main.TRUE,
2017 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002018 onpass="INTENTS INSTALLED",
2019 onfail="SOME INTENTS NOT INSTALLED" )
2020
Hari Krishnac195f3b2015-07-08 20:02:24 -07002021 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002022 pingResult = main.CHOtestFunctions.checkPingall()
2023 utilities.assert_equals( expect=main.TRUE,
2024 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002025 onpass="PING ALL PASS",
2026 onfail="PING ALL FAIL" )
2027
GlennRCbddd58f2015-10-01 15:45:25 -07002028 caseResult = linkDown and pingResult and intentState
2029 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030 onpass="Random Link cut Test PASS",
2031 onfail="Random Link cut Test FAIL" )
2032
GlennRCfcfdc4f2015-09-30 16:01:57 -07002033 # Printing what exactly failed
2034 if not linkDown:
2035 main.log.debug( "Link down was not discovered correctly" )
2036 if not pingResult:
2037 main.log.debug( "Pingall failed" )
2038 if not intentState:
2039 main.log.debug( "Intents are not all installed" )
2040
GlennRCbddd58f2015-10-01 15:45:25 -07002041 if not caseResult and main.failSwitch:
2042 main.log.report("Stopping test")
2043 main.stop( email=main.emailOnStop )
2044
Hari Krishnac195f3b2015-07-08 20:02:24 -07002045 def CASE83( self, main ):
2046 """
2047 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2048 """
2049 import random
You Wangb6586542016-02-26 09:25:56 -08002050 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002051
Hari Krishnac195f3b2015-07-08 20:02:24 -07002052 main.log.report(
2053 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2054 main.log.report(
2055 "__________________________________________________________________" )
2056 main.case(
2057 "Point intents - Bring the core links up that are down and verify ping all" )
2058 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002059
Hari Krishnac195f3b2015-07-08 20:02:24 -07002060 for switch in main.randomLinks:
2061 main.Mininet1.link(
2062 END1=switch[0],
2063 END2=switch[1],
2064 OPTION="up")
You Wangb6586542016-02-26 09:25:56 -08002065 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002066
You Wang0779bac2016-01-27 16:32:33 -08002067 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002068 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2069 utilities.assert_equals( expect=main.TRUE,
2070 actual=linkUp,
2071 onpass="Link up discovered properly",
2072 onfail="Link up was not discovered in " +
2073 str( main.linkSleep * main.linkCheck ) +
2074 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002075
GlennRCfcfdc4f2015-09-30 16:01:57 -07002076 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002077 intentState = main.CHOtestFunctions.checkIntents()
2078 utilities.assert_equals( expect=main.TRUE,
2079 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002080 onpass="INTENTS INSTALLED",
2081 onfail="SOME INTENTS NOT INSTALLED" )
2082
Hari Krishnac195f3b2015-07-08 20:02:24 -07002083 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002084 pingResult = main.CHOtestFunctions.checkPingall()
2085 utilities.assert_equals( expect=main.TRUE,
2086 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002087 onpass="PING ALL PASS",
2088 onfail="PING ALL FAIL" )
2089
GlennRCbddd58f2015-10-01 15:45:25 -07002090 caseResult = linkUp and pingResult
2091 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002092 onpass="Link Up Test PASS",
2093 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002094 # Printing what exactly failed
2095 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002096 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002097 if not pingResult:
2098 main.log.debug( "Pingall failed" )
2099 if not intentState:
2100 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002101
GlennRCbddd58f2015-10-01 15:45:25 -07002102 if not caseResult and main.failSwitch:
2103 main.log.report("Stopping test")
2104 main.stop( email=main.emailOnStop )
2105
Hari Krishnac195f3b2015-07-08 20:02:24 -07002106 def CASE74( self, main ):
2107 """
2108 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2109 """
2110 import random
2111 main.randomLink1 = []
2112 main.randomLink2 = []
2113 main.randomLink3 = []
2114 main.randomLink4 = []
2115 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2116 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2117 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2118 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2119 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2120 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002121 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002122
Hari Krishnac195f3b2015-07-08 20:02:24 -07002123 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2124 main.log.report( "___________________________________________________________________________" )
Jon Hall6509dbf2016-06-21 17:01:17 -07002125 main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002126
2127 main.step( "Bring some core links down" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002128 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002129 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002130 linkIndex.remove(linkIndexS9)
2131 linkIndexS10 = random.sample(linkIndex,1)[0]
2132 main.randomLink1 = link1End2top[linkIndexS9]
2133 main.randomLink2 = link2End2top[linkIndexS10]
2134 main.randomLink3 = random.sample(link1End2bot,1)[0]
2135 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002136
2137 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002138 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2139 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2140 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002141 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002142 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002143 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002144
You Wangb6586542016-02-26 09:25:56 -08002145 main.step( "Verify link down is discoverd by onos" )
2146 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2147 utilities.assert_equals( expect=main.TRUE,
2148 actual=linkDown,
2149 onpass="Link down discovered properly",
2150 onfail="Link down was not discovered in " +
2151 str( main.linkSleep * main.linkCheck ) +
2152 " seconds" )
You Wang0779bac2016-01-27 16:32:33 -08002153
You Wangb6586542016-02-26 09:25:56 -08002154 main.step( "Verify intents are installed" )
2155 intentState = main.CHOtestFunctions.checkIntents()
2156 utilities.assert_equals( expect=main.TRUE,
2157 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002158 onpass="INTENTS INSTALLED",
2159 onfail="SOME INTENTS NOT INSTALLED" )
2160
Hari Krishnac195f3b2015-07-08 20:02:24 -07002161 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002162 pingResult = main.CHOtestFunctions.checkPingall()
2163 utilities.assert_equals( expect=main.TRUE,
2164 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002165 onpass="PING ALL PASS",
2166 onfail="PING ALL FAIL" )
2167
GlennRCbddd58f2015-10-01 15:45:25 -07002168 caseResult = linkDown and pingResult and intentState
2169 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002170 onpass="Random Link cut Test PASS",
2171 onfail="Random Link cut Test FAIL" )
2172
GlennRCfcfdc4f2015-09-30 16:01:57 -07002173 # Printing what exactly failed
2174 if not linkDown:
2175 main.log.debug( "Link down was not discovered correctly" )
2176 if not pingResult:
2177 main.log.debug( "Pingall failed" )
2178 if not intentState:
2179 main.log.debug( "Intents are not all installed" )
2180
GlennRCbddd58f2015-10-01 15:45:25 -07002181 if not caseResult and main.failSwitch:
2182 main.log.report("Stopping test")
2183 main.stop( email=main.emailOnStop )
2184
Hari Krishnac195f3b2015-07-08 20:02:24 -07002185 def CASE84( self, main ):
2186 """
2187 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2188 """
2189 import random
2190 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2191 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002192 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002193 main.log.report(
2194 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2195 main.log.report(
2196 "__________________________________________________________________" )
2197 main.case(
2198 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002199
You Wang0779bac2016-01-27 16:32:33 -08002200 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002201 # Work around for link state propagation delay. Added some sleep time.
2202 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2203 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002204 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002205 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002206 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002207 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002208
You Wang0779bac2016-01-27 16:32:33 -08002209 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002210 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2211 utilities.assert_equals( expect=main.TRUE,
2212 actual=linkUp,
2213 onpass="Link up discovered properly",
2214 onfail="Link up was not discovered in " +
2215 str( main.linkSleep * main.linkCheck ) +
2216 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002217
GlennRCfcfdc4f2015-09-30 16:01:57 -07002218 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002219 intentState = main.CHOtestFunctions.checkIntents()
2220 utilities.assert_equals( expect=main.TRUE,
2221 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002222 onpass="INTENTS INSTALLED",
2223 onfail="SOME INTENTS NOT INSTALLED" )
2224
Hari Krishnac195f3b2015-07-08 20:02:24 -07002225 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002226 pingResult = main.CHOtestFunctions.checkPingall()
2227 utilities.assert_equals( expect=main.TRUE,
2228 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002229 onpass="PING ALL PASS",
2230 onfail="PING ALL FAIL" )
2231
GlennRCbddd58f2015-10-01 15:45:25 -07002232 caseResult = linkUp and pingResult
2233 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002234 onpass="Link Up Test PASS",
2235 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002236 # Printing what exactly failed
2237 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002238 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002239 if not pingResult:
2240 main.log.debug( "Pingall failed" )
2241 if not intentState:
2242 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002243
GlennRCbddd58f2015-10-01 15:45:25 -07002244 if not caseResult and main.failSwitch:
2245 main.log.report("Stopping test")
2246 main.stop( email=main.emailOnStop )
2247
Hari Krishnab79d0822015-08-20 09:48:43 -07002248 def CASE75( self, main ):
2249 """
2250 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2251 """
2252 import random
2253 main.randomLink1 = []
2254 main.randomLink2 = []
2255 main.randomLink3 = []
2256 main.randomLink4 = []
2257 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2258 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2259 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2260 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2261 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2262 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002263 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002264
2265 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2266 main.log.report( "___________________________________________________________________________" )
2267 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002268
2269 main.step( "Bring some core links down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002270 linkIndex = range(4)
2271 linkIndexS9 = random.sample(linkIndex,1)[0]
2272 linkIndex.remove(linkIndexS9)
2273 linkIndexS10 = random.sample(linkIndex,1)[0]
2274 main.randomLink1 = link1End2top[linkIndexS9]
2275 main.randomLink2 = link2End2top[linkIndexS10]
2276 main.randomLink3 = random.sample(link1End2bot,1)[0]
2277 main.randomLink4 = random.sample(link2End2bot,1)[0]
2278
2279 # Work around for link state propagation delay. Added some sleep time.
2280 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2281 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2282 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002283 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002284 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002285 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002286
You Wang0779bac2016-01-27 16:32:33 -08002287 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002288 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2289 utilities.assert_equals( expect=main.TRUE,
2290 actual=linkDown,
2291 onpass="Link down discovered properly",
2292 onfail="Link down was not discovered in " +
2293 str( main.linkSleep * main.linkCheck ) +
2294 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002295
GlennRCfcfdc4f2015-09-30 16:01:57 -07002296 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002297 intentState = main.CHOtestFunctions.checkIntents()
2298 utilities.assert_equals( expect=main.TRUE,
2299 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 onpass="INTENTS INSTALLED",
2301 onfail="SOME INTENTS NOT INSTALLED" )
2302
Hari Krishnab79d0822015-08-20 09:48:43 -07002303 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002304 pingResult = main.CHOtestFunctions.checkPingall()
2305 utilities.assert_equals( expect=main.TRUE,
2306 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002307 onpass="PING ALL PASS",
2308 onfail="PING ALL FAIL" )
2309
GlennRCbddd58f2015-10-01 15:45:25 -07002310 caseResult = linkDown and pingResult and intentState
2311 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002312 onpass="Random Link cut Test PASS",
2313 onfail="Random Link cut Test FAIL" )
2314
GlennRCfcfdc4f2015-09-30 16:01:57 -07002315 # Printing what exactly failed
2316 if not linkDown:
2317 main.log.debug( "Link down was not discovered correctly" )
2318 if not pingResult:
2319 main.log.debug( "Pingall failed" )
2320 if not intentState:
2321 main.log.debug( "Intents are not all installed" )
2322
GlennRCbddd58f2015-10-01 15:45:25 -07002323 if not caseResult and main.failSwitch:
2324 main.log.report("Stopping test")
2325 main.stop( email=main.emailOnStop )
2326
Hari Krishnab79d0822015-08-20 09:48:43 -07002327 def CASE85( self, main ):
2328 """
2329 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2330 """
2331 import random
2332 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2333 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002334 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002335 main.log.report(
2336 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2337 main.log.report(
2338 "__________________________________________________________________" )
2339 main.case(
2340 "Point intents - Bring the core links up that are down and verify ping all" )
2341
You Wang0779bac2016-01-27 16:32:33 -08002342 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002343 # Work around for link state propagation delay. Added some sleep time.
2344 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2345 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2346 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002347 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002348 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002349 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002350
You Wang0779bac2016-01-27 16:32:33 -08002351 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002352 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2353 utilities.assert_equals( expect=main.TRUE,
2354 actual=linkUp,
2355 onpass="Link up discovered properly",
2356 onfail="Link up was not discovered in " +
2357 str( main.linkSleep * main.linkCheck ) +
2358 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002359
GlennRCfcfdc4f2015-09-30 16:01:57 -07002360 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002361 intentState = main.CHOtestFunctions.checkIntents()
2362 utilities.assert_equals( expect=main.TRUE,
2363 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002364 onpass="INTENTS INSTALLED",
2365 onfail="SOME INTENTS NOT INSTALLED" )
2366
Hari Krishnab79d0822015-08-20 09:48:43 -07002367 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002368 pingResult = main.CHOtestFunctions.checkPingall()
2369 utilities.assert_equals( expect=main.TRUE,
2370 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002371 onpass="PING ALL PASS",
2372 onfail="PING ALL FAIL" )
2373
GlennRCbddd58f2015-10-01 15:45:25 -07002374 caseResult = linkUp and pingResult
2375 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002376 onpass="Link Up Test PASS",
2377 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002378 # Printing what exactly failed
2379 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002380 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002381 if not pingResult:
2382 main.log.debug( "Pingall failed" )
2383 if not intentState:
2384 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002385
GlennRCbddd58f2015-10-01 15:45:25 -07002386 if not caseResult and main.failSwitch:
2387 main.log.report("Stopping test")
2388 main.stop( email=main.emailOnStop )
2389
Hari Krishna4223dbd2015-08-13 16:29:53 -07002390 def CASE170( self ):
2391 """
2392 IPv6 ping all with some core links down( Host Intents-Att Topo)
2393 """
2394 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2395 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002396 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002397
Hari Krishna4223dbd2015-08-13 16:29:53 -07002398 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002399 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2400 utilities.assert_equals( expect=main.TRUE,
2401 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002402 onpass="PING ALL PASS",
2403 onfail="PING ALL FAIL" )
2404
GlennRCbddd58f2015-10-01 15:45:25 -07002405 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002406 utilities.assert_equals(
2407 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002408 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002409 onpass="IPv6 Ping across 300 host intents test PASS",
2410 onfail="IPv6 Ping across 300 host intents test FAIL" )
2411
You Wangb6586542016-02-26 09:25:56 -08002412 if not caseResult and main.failSwitch:
2413 main.log.report("Stopping test")
2414 main.stop( email=main.emailOnStop )
2415
Hari Krishna4223dbd2015-08-13 16:29:53 -07002416 def CASE180( self ):
2417 """
2418 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2419 """
2420 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2421 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002422 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002423
Hari Krishna4223dbd2015-08-13 16:29:53 -07002424 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002425 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2426 utilities.assert_equals( expect=main.TRUE,
2427 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002428 onpass="PING ALL PASS",
2429 onfail="PING ALL FAIL" )
2430
GlennRCbddd58f2015-10-01 15:45:25 -07002431 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002432 utilities.assert_equals(
2433 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002434 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002435 onpass="IPv6 Ping across 300 host intents test PASS",
2436 onfail="IPv6 Ping across 300 host intents test FAIL" )
2437
You Wangb6586542016-02-26 09:25:56 -08002438 if not caseResult and main.failSwitch:
2439 main.log.report("Stopping test")
2440 main.stop( email=main.emailOnStop )
2441
Hari Krishna4223dbd2015-08-13 16:29:53 -07002442 def CASE171( self ):
2443 """
2444 IPv6 ping all with some core links down( Point Intents-Att Topo)
2445 """
2446 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2447 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002448 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002449
Hari Krishna4223dbd2015-08-13 16:29:53 -07002450 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002451 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2452 utilities.assert_equals( expect=main.TRUE,
2453 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002454 onpass="PING ALL PASS",
2455 onfail="PING ALL FAIL" )
2456
GlennRCbddd58f2015-10-01 15:45:25 -07002457 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002458 utilities.assert_equals(
2459 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002460 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002461 onpass="IPv6 Ping across 600 point intents test PASS",
2462 onfail="IPv6 Ping across 600 point intents test FAIL" )
2463
You Wangb6586542016-02-26 09:25:56 -08002464 if not caseResult and main.failSwitch:
2465 main.log.report("Stopping test")
2466 main.stop( email=main.emailOnStop )
2467
Hari Krishna4223dbd2015-08-13 16:29:53 -07002468 def CASE181( self ):
2469 """
2470 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2471 """
2472 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2473 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002474 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002475
Hari Krishna4223dbd2015-08-13 16:29:53 -07002476 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002477 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2478 utilities.assert_equals( expect=main.TRUE,
2479 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002480 onpass="PING ALL PASS",
2481 onfail="PING ALL FAIL" )
2482
GlennRCbddd58f2015-10-01 15:45:25 -07002483 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002484 utilities.assert_equals(
2485 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002486 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002487 onpass="IPv6 Ping across 600 Point intents test PASS",
2488 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2489
You Wangb6586542016-02-26 09:25:56 -08002490 if not caseResult and main.failSwitch:
2491 main.log.report("Stopping test")
2492 main.stop( email=main.emailOnStop )
2493
Hari Krishna4223dbd2015-08-13 16:29:53 -07002494 def CASE172( self ):
2495 """
2496 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2497 """
2498 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2499 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002500 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002501
Hari Krishna4223dbd2015-08-13 16:29:53 -07002502 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002503 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2504 utilities.assert_equals( expect=main.TRUE,
2505 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002506 onpass="PING ALL PASS",
2507 onfail="PING ALL FAIL" )
2508
GlennRCbddd58f2015-10-01 15:45:25 -07002509 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002510 utilities.assert_equals(
2511 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002512 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002513 onpass="IPv6 Ping across 300 host intents test PASS",
2514 onfail="IPv6 Ping across 300 host intents test FAIL" )
2515
2516 def CASE182( self ):
2517 """
2518 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2519 """
2520 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2521 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002522 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002523
Hari Krishna4223dbd2015-08-13 16:29:53 -07002524 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002525 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2526 utilities.assert_equals( expect=main.TRUE,
2527 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002528 onpass="PING ALL PASS",
2529 onfail="PING ALL FAIL" )
2530
GlennRCbddd58f2015-10-01 15:45:25 -07002531 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002532 utilities.assert_equals(
2533 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002534 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002535 onpass="IPv6 Ping across 300 host intents test PASS",
2536 onfail="IPv6 Ping across 300 host intents test FAIL" )
2537
You Wangb6586542016-02-26 09:25:56 -08002538 if not caseResult and main.failSwitch:
2539 main.log.report("Stopping test")
2540 main.stop( email=main.emailOnStop )
2541
Hari Krishna4223dbd2015-08-13 16:29:53 -07002542 def CASE173( self ):
2543 """
2544 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2545 """
2546 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2547 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002548 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002549
Hari Krishna4223dbd2015-08-13 16:29:53 -07002550 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002551 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2552 utilities.assert_equals( expect=main.TRUE,
2553 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002554 onpass="PING ALL PASS",
2555 onfail="PING ALL FAIL" )
2556
GlennRCbddd58f2015-10-01 15:45:25 -07002557 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002558 utilities.assert_equals(
2559 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002560 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002561 onpass="IPv6 Ping across 600 point intents test PASS",
2562 onfail="IPv6 Ping across 600 point intents test FAIL" )
2563
You Wangb6586542016-02-26 09:25:56 -08002564 if not caseResult and main.failSwitch:
2565 main.log.report("Stopping test")
2566 main.stop( email=main.emailOnStop )
2567
Hari Krishna4223dbd2015-08-13 16:29:53 -07002568 def CASE183( self ):
2569 """
2570 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2571 """
2572 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2573 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002574 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002575
Hari Krishna4223dbd2015-08-13 16:29:53 -07002576 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002577 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2578 utilities.assert_equals( expect=main.TRUE,
2579 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002580 onpass="PING ALL PASS",
2581 onfail="PING ALL FAIL" )
2582
GlennRCbddd58f2015-10-01 15:45:25 -07002583 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002584 utilities.assert_equals(
2585 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002586 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002587 onpass="IPv6 Ping across 600 Point intents test PASS",
2588 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2589
You Wangb6586542016-02-26 09:25:56 -08002590 if not caseResult and main.failSwitch:
2591 main.log.report("Stopping test")
2592 main.stop( email=main.emailOnStop )
2593
Hari Krishna4223dbd2015-08-13 16:29:53 -07002594 def CASE174( self ):
2595 """
2596 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2597 """
2598 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2599 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002600 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002601
Hari Krishna4223dbd2015-08-13 16:29:53 -07002602 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002603 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2604 utilities.assert_equals( expect=main.TRUE,
2605 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002606 onpass="PING ALL PASS",
2607 onfail="PING ALL FAIL" )
2608
GlennRCbddd58f2015-10-01 15:45:25 -07002609 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002610 utilities.assert_equals(
2611 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002612 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002613 onpass="IPv6 Ping across 2278 host intents test PASS",
2614 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2615
You Wangb6586542016-02-26 09:25:56 -08002616 if not caseResult and main.failSwitch:
2617 main.log.report("Stopping test")
2618 main.stop( email=main.emailOnStop )
2619
Hari Krishna4223dbd2015-08-13 16:29:53 -07002620 def CASE184( self ):
2621 """
2622 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2623 """
2624 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2625 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002626 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002627
Hari Krishna4223dbd2015-08-13 16:29:53 -07002628 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002629 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2630 utilities.assert_equals( expect=main.TRUE,
2631 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002632 onpass="PING ALL PASS",
2633 onfail="PING ALL FAIL" )
2634
GlennRCbddd58f2015-10-01 15:45:25 -07002635 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002636 utilities.assert_equals(
2637 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002638 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002639 onpass="IPv6 Ping across 2278 host intents test PASS",
2640 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2641
You Wangb6586542016-02-26 09:25:56 -08002642 if not caseResult and main.failSwitch:
2643 main.log.report("Stopping test")
2644 main.stop( email=main.emailOnStop )
2645
Hari Krishna4223dbd2015-08-13 16:29:53 -07002646 def CASE175( self ):
2647 """
2648 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2649 """
2650 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2651 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002652 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002653
Hari Krishna4223dbd2015-08-13 16:29:53 -07002654 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002655 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2656 utilities.assert_equals( expect=main.TRUE,
2657 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002658 onpass="PING ALL PASS",
2659 onfail="PING ALL FAIL" )
2660
GlennRCbddd58f2015-10-01 15:45:25 -07002661 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002662 utilities.assert_equals(
2663 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002664 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002665 onpass="IPv6 Ping across 4556 point intents test PASS",
2666 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2667
You Wangb6586542016-02-26 09:25:56 -08002668 if not caseResult and main.failSwitch:
2669 main.log.report("Stopping test")
2670 main.stop( email=main.emailOnStop )
2671
Hari Krishna4223dbd2015-08-13 16:29:53 -07002672 def CASE185( self ):
2673 """
2674 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
2675 """
2676 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2677 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002678 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002679
Hari Krishna4223dbd2015-08-13 16:29:53 -07002680 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002681 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2682 utilities.assert_equals( expect=main.TRUE,
2683 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002684 onpass="PING ALL PASS",
2685 onfail="PING ALL FAIL" )
2686
GlennRCbddd58f2015-10-01 15:45:25 -07002687 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002688 utilities.assert_equals(
2689 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002690 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002691 onpass="IPv6 Ping across 4556 Point intents test PASS",
2692 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2693
You Wangb6586542016-02-26 09:25:56 -08002694 if not caseResult and main.failSwitch:
2695 main.log.report("Stopping test")
2696 main.stop( email=main.emailOnStop )
2697
Hari Krishnac195f3b2015-07-08 20:02:24 -07002698 def CASE90( self ):
2699 """
2700 Install 600 point intents and verify ping all (Att Topology)
2701 """
2702 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2703 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002704 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002705
Hari Krishnac195f3b2015-07-08 20:02:24 -07002706 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002707 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002708 main.intentIds = list(intentIdList)
2709
GlennRCa8d786a2015-09-23 17:40:11 -07002710 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002711 intentState = main.CHOtestFunctions.checkIntents()
2712 utilities.assert_equals( expect=main.TRUE,
2713 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002714 onpass="INTENTS INSTALLED",
2715 onfail="SOME INTENTS NOT INSTALLED" )
2716
Hari Krishnac195f3b2015-07-08 20:02:24 -07002717 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002718 pingResult = main.CHOtestFunctions.checkPingall()
2719 utilities.assert_equals( expect=main.TRUE,
2720 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002721 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002722 onfail="PING ALL FAIL" )
2723
GlennRCbddd58f2015-10-01 15:45:25 -07002724 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002725 utilities.assert_equals(
2726 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002727 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002728 onpass="Install 600 point Intents and Ping All test PASS",
2729 onfail="Install 600 point Intents and Ping All test FAIL" )
2730
GlennRCbddd58f2015-10-01 15:45:25 -07002731 if not intentState:
2732 main.log.debug( "Intents failed to install completely" )
2733 if not pingResult:
2734 main.log.debug( "Pingall failed" )
2735
2736 if not caseResult and main.failSwitch:
2737 main.log.report("Stopping test")
2738 main.stop( email=main.emailOnStop )
2739
Hari Krishnac195f3b2015-07-08 20:02:24 -07002740 def CASE91( self ):
2741 """
2742 Install 600 point intents and verify ping all (Chordal Topology)
2743 """
2744 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2745 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002746 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002747
Hari Krishnac195f3b2015-07-08 20:02:24 -07002748 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002749 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002750 main.intentIds = list(intentIdList)
2751
GlennRCa8d786a2015-09-23 17:40:11 -07002752 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002753 intentState = main.CHOtestFunctions.checkIntents()
2754 utilities.assert_equals( expect=main.TRUE,
2755 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002756 onpass="INTENTS INSTALLED",
2757 onfail="SOME INTENTS NOT INSTALLED" )
2758
Hari Krishnac195f3b2015-07-08 20:02:24 -07002759 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002760 pingResult = main.CHOtestFunctions.checkPingall()
2761 utilities.assert_equals( expect=main.TRUE,
2762 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002763 onpass="PING ALL PASS",
2764 onfail="PING ALL FAIL" )
2765
GlennRCbddd58f2015-10-01 15:45:25 -07002766 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002767 utilities.assert_equals(
2768 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002769 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002770 onpass="Install 600 point Intents and Ping All test PASS",
2771 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002772
GlennRCbddd58f2015-10-01 15:45:25 -07002773 if not intentState:
2774 main.log.debug( "Intents failed to install completely" )
2775 if not pingResult:
2776 main.log.debug( "Pingall failed" )
2777
2778 if not caseResult and main.failSwitch:
2779 main.log.report("Stopping test")
2780 main.stop( email=main.emailOnStop )
2781
Hari Krishnac195f3b2015-07-08 20:02:24 -07002782 def CASE92( self ):
2783 """
2784 Install 4556 point intents and verify ping all (Spine Topology)
2785 """
2786 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2787 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002788 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002789
You Wangb6586542016-02-26 09:25:56 -08002790 main.step( "Add point Intents" )
2791 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002792 main.intentIds = list(intentIdList)
2793
GlennRCa8d786a2015-09-23 17:40:11 -07002794 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002795 intentState = main.CHOtestFunctions.checkIntents()
2796 utilities.assert_equals( expect=main.TRUE,
2797 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002798 onpass="INTENTS INSTALLED",
2799 onfail="SOME INTENTS NOT INSTALLED" )
2800
Hari Krishnac195f3b2015-07-08 20:02:24 -07002801 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002802 pingResult = main.CHOtestFunctions.checkPingall()
2803 utilities.assert_equals( expect=main.TRUE,
2804 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002805 onpass="PING ALL PASS",
2806 onfail="PING ALL FAIL" )
2807
GlennRCbddd58f2015-10-01 15:45:25 -07002808 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002809 utilities.assert_equals(
2810 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002811 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002812 onpass="Install 4556 point Intents and Ping All test PASS",
2813 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002814
GlennRCbddd58f2015-10-01 15:45:25 -07002815 if not intentState:
2816 main.log.debug( "Intents failed to install completely" )
2817 if not pingResult:
2818 main.log.debug( "Pingall failed" )
2819
2820 if not caseResult and main.failSwitch:
2821 main.log.report("Stopping test")
2822 main.stop( email=main.emailOnStop )
2823
Hari Krishnac195f3b2015-07-08 20:02:24 -07002824 def CASE93( self ):
2825 """
2826 Install multi-single point intents and verify Ping all works
2827 for att topology
2828 """
2829 import copy
2830 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002831 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002832 main.log.report( "Install multi-single point intents and verify Ping all" )
2833 main.log.report( "___________________________________________" )
2834 main.case( "Install multi-single point intents and Ping all" )
2835 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2836 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2837 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07002838 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002839 time1 = time.time()
2840 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2841 pool = []
2842 for cli in main.CLIs:
2843 egressDevice = deviceDPIDsCopy[i]
2844 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2845 ingressDeviceList.remove(egressDevice)
2846 if i >= len( deviceDPIDsCopy ):
2847 break
2848 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2849 threadID=main.threadID,
2850 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002851 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002852 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002853 t.start()
2854 i = i + 1
2855 main.threadID = main.threadID + 1
2856 for thread in pool:
2857 thread.join()
2858 intentIdList.append(thread.result)
2859 time2 = time.time()
2860 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07002861
GlennRCdb2c8422015-09-29 12:21:59 -07002862 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002863 # Giving onos multiple chances to install intents
2864 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002865 if i != 0:
2866 main.log.warn( "Verification failed. Retrying..." )
2867 main.log.info("Waiting for onos to install intents...")
2868 time.sleep( main.checkIntentsDelay )
2869
2870 intentState = main.TRUE
2871 for e in range(int(main.numCtrls)):
2872 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08002873 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
2874 if not IntentStateIndividual:
2875 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
2876 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002877 if intentState:
2878 break
You Wangb6586542016-02-26 09:25:56 -08002879 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002880 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08002881 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07002882
2883 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2884 onpass="INTENTS INSTALLED",
2885 onfail="SOME INTENTS NOT INSTALLED" )
2886
GlennRCfa69a2a2015-10-02 15:54:06 -07002887 main.step("Verify flows are all added")
2888
2889 for i in range( main.flowCheck ):
2890 if i != 0:
2891 main.log.warn( "verification failed. Retrying..." )
2892 main.log.info( "Waiting for onos to add flows..." )
2893 time.sleep( main.checkFlowsDelay )
2894
2895 flowState = main.TRUE
2896 for cli in main.CLIs:
2897 flowState = cli.checkFlowState()
2898 if not flowState:
2899 main.log.warn( "Not all flows added" )
2900 if flowState:
2901 break
2902 else:
2903 #Dumping summary
2904 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
2905
2906 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2907 onpass="FLOWS INSTALLED",
2908 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002909
Hari Krishnac195f3b2015-07-08 20:02:24 -07002910 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002911 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07002912 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002913 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2914 if not pingResult:
2915 main.log.warn("First pingall failed. Retrying...")
2916 time.sleep(main.pingSleep)
2917 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07002918
Hari Krishnac195f3b2015-07-08 20:02:24 -07002919 time2 = time.time()
2920 timeDiff = round( ( time2 - time1 ), 2 )
2921 main.log.report(
2922 "Time taken for Ping All: " +
2923 str( timeDiff ) +
2924 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002925
GlennRCbddd58f2015-10-01 15:45:25 -07002926 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002927 utilities.assert_equals(
2928 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002929 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002930 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2931 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002932
GlennRCfa69a2a2015-10-02 15:54:06 -07002933 if not intentState:
2934 main.log.debug( "Intents failed to install completely" )
2935 if not pingResult:
2936 main.log.debug( "Pingall failed" )
2937 if not checkFlowsState:
2938 main.log.debug( "Flows failed to add completely" )
2939
2940 if not caseResult and main.failSwitch:
2941 main.log.report("Stopping test")
2942 main.stop( email=main.emailOnStop )
2943
Hari Krishnac195f3b2015-07-08 20:02:24 -07002944 def CASE94( self ):
2945 """
2946 Install multi-single point intents and verify Ping all works
2947 for Chordal topology
2948 """
2949 import copy
2950 import time
2951 main.log.report( "Install multi-single point intents and verify Ping all" )
2952 main.log.report( "___________________________________________" )
2953 main.case( "Install multi-single point intents and Ping all" )
2954 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2955 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2956 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07002957 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002958 time1 = time.time()
2959 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2960 pool = []
2961 for cli in main.CLIs:
2962 egressDevice = deviceDPIDsCopy[i]
2963 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2964 ingressDeviceList.remove(egressDevice)
2965 if i >= len( deviceDPIDsCopy ):
2966 break
2967 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2968 threadID=main.threadID,
2969 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002970 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002971 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002972 t.start()
2973 i = i + 1
2974 main.threadID = main.threadID + 1
2975 for thread in pool:
2976 thread.join()
2977 intentIdList.append(thread.result)
2978 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002979 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07002980
2981 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002982 # Giving onos multiple chances to install intents
2983 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002984 if i != 0:
2985 main.log.warn( "Verification failed. Retrying..." )
2986 main.log.info("Waiting for onos to install intents...")
2987 time.sleep( main.checkIntentsDelay )
2988
2989 intentState = main.TRUE
2990 for e in range(int(main.numCtrls)):
2991 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08002992 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
2993 if not IntentStateIndividual:
2994 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
2995 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002996 if intentState:
2997 break
You Wangb6586542016-02-26 09:25:56 -08002998 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002999 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003000 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003001
GlennRCdb2c8422015-09-29 12:21:59 -07003002 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3003 onpass="INTENTS INSTALLED",
3004 onfail="SOME INTENTS NOT INSTALLED" )
3005
GlennRCfa69a2a2015-10-02 15:54:06 -07003006 main.step("Verify flows are all added")
3007
3008 for i in range( main.flowCheck ):
3009 if i != 0:
3010 main.log.warn( "verification failed. Retrying..." )
3011 main.log.info( "Waiting for onos to add flows..." )
3012 time.sleep( main.checkFlowsDelay )
3013
3014 flowState = main.TRUE
3015 for cli in main.CLIs:
3016 flowState = cli.checkFlowState()
3017 if not flowState:
3018 main.log.warn( "Not all flows added" )
3019 if flowState:
3020 break
3021 else:
3022 #Dumping summary
3023 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3024
3025 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3026 onpass="FLOWS INSTALLED",
3027 onfail="SOME FLOWS NOT ADDED" )
3028
Hari Krishnac195f3b2015-07-08 20:02:24 -07003029 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003030 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003031 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003032 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3033 if not pingResult:
3034 main.log.warn("First pingall failed. Retrying...")
3035 time.sleep(main.pingSleep)
3036 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003037
Hari Krishnac195f3b2015-07-08 20:02:24 -07003038 time2 = time.time()
3039 timeDiff = round( ( time2 - time1 ), 2 )
3040 main.log.report(
3041 "Time taken for Ping All: " +
3042 str( timeDiff ) +
3043 " seconds" )
3044
GlennRCfa69a2a2015-10-02 15:54:06 -07003045 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003046 utilities.assert_equals(
3047 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003048 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003049 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3050 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003051
GlennRCfa69a2a2015-10-02 15:54:06 -07003052 if not intentState:
3053 main.log.debug( "Intents failed to install completely" )
3054 if not pingResult:
3055 main.log.debug( "Pingall failed" )
3056 if not checkFlowsState:
3057 main.log.debug( "Flows failed to add completely" )
3058
3059 if not caseResult and main.failSwitch:
3060 main.log.report("Stopping test")
3061 main.stop( email=main.emailOnStop )
3062
3063 def CASE95( self ):
3064 """
3065 Install multi-single point intents and verify Ping all works
3066 for Spine topology
3067 """
3068 import copy
3069 import time
3070 main.log.report( "Install multi-single point intents and verify Ping all" )
3071 main.log.report( "___________________________________________" )
3072 main.case( "Install multi-single point intents and Ping all" )
3073 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3074 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3075 intentIdList = []
3076 main.log.info( "MACsDict" + str(main.MACsDict) )
3077 time1 = time.time()
3078 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3079 pool = []
3080 for cli in main.CLIs:
3081 egressDevice = deviceDPIDsCopy[i]
3082 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3083 ingressDeviceList.remove(egressDevice)
3084 if i >= len( deviceDPIDsCopy ):
3085 break
3086 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3087 threadID=main.threadID,
3088 name="addMultipointToSinglepointIntent",
3089 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3090 pool.append(t)
3091 t.start()
3092 i = i + 1
3093 main.threadID = main.threadID + 1
3094 for thread in pool:
3095 thread.join()
3096 intentIdList.append(thread.result)
3097 time2 = time.time()
3098 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3099
3100 main.step("Verify intents are installed")
GlennRCfa69a2a2015-10-02 15:54:06 -07003101 # Giving onos multiple chances to install intents
3102 for i in range( main.intentCheck ):
3103 if i != 0:
3104 main.log.warn( "Verification failed. Retrying..." )
3105 main.log.info("Waiting for onos to install intents...")
3106 time.sleep( main.checkIntentsDelay )
3107
3108 intentState = main.TRUE
3109 for e in range(int(main.numCtrls)):
3110 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003111 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3112 if not IntentStateIndividual:
3113 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3114 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003115 if intentState:
3116 break
You Wangb6586542016-02-26 09:25:56 -08003117 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003118 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003119 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003120
3121 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3122 onpass="INTENTS INSTALLED",
3123 onfail="SOME INTENTS NOT INSTALLED" )
3124
3125 main.step("Verify flows are all added")
3126
3127 for i in range( main.flowCheck ):
3128 if i != 0:
3129 main.log.warn( "verification failed. Retrying..." )
3130 main.log.info( "Waiting for onos to add flows..." )
3131 time.sleep( main.checkFlowsDelay )
3132
3133 flowState = main.TRUE
3134 for cli in main.CLIs:
3135 flowState = cli.checkFlowState()
3136 if not flowState:
3137 main.log.warn( "Not all flows added" )
3138 if flowState:
3139 break
3140 else:
3141 #Dumping summary
3142 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3143
3144 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3145 onpass="FLOWS INSTALLED",
3146 onfail="SOME FLOWS NOT ADDED" )
3147
3148 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003149 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003150 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003151 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3152 if not pingResult:
3153 main.log.warn("First pingall failed. Retrying...")
3154 time.sleep(main.pingSleep)
3155 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003156
3157 time2 = time.time()
3158 timeDiff = round( ( time2 - time1 ), 2 )
3159 main.log.report(
3160 "Time taken for Ping All: " +
3161 str( timeDiff ) +
3162 " seconds" )
3163
3164 caseResult = ( checkFlowsState and pingResult and intentState )
3165 utilities.assert_equals(
3166 expect=main.TRUE,
3167 actual=caseResult,
3168 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3169 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3170
3171 if not intentState:
3172 main.log.debug( "Intents failed to install completely" )
3173 if not pingResult:
3174 main.log.debug( "Pingall failed" )
3175 if not checkFlowsState:
3176 main.log.debug( "Flows failed to add completely" )
3177
3178 if not caseResult and main.failSwitch:
3179 main.log.report("Stopping test")
3180 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003181
3182 def CASE96( self ):
3183 """
3184 Install single-multi point intents and verify Ping all works
3185 for att topology
3186 """
3187 import copy
3188 main.log.report( "Install single-multi point intents and verify Ping all" )
3189 main.log.report( "___________________________________________" )
3190 main.case( "Install single-multi point intents and Ping all" )
3191 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3192 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3193 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003194 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003195 time1 = time.time()
3196 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3197 pool = []
3198 for cli in main.CLIs:
3199 ingressDevice = deviceDPIDsCopy[i]
3200 egressDeviceList = copy.copy(deviceDPIDsCopy)
3201 egressDeviceList.remove(ingressDevice)
3202 if i >= len( deviceDPIDsCopy ):
3203 break
3204 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3205 threadID=main.threadID,
3206 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003207 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003208 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003209 t.start()
3210 i = i + 1
3211 main.threadID = main.threadID + 1
3212 for thread in pool:
3213 thread.join()
3214 intentIdList.append(thread.result)
3215 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003216 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003217
3218 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003219 # Giving onos multiple chances to install intents
3220 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003221 if i != 0:
3222 main.log.warn( "Verification failed. Retrying..." )
3223 main.log.info("Waiting for onos to install intents...")
3224 time.sleep( main.checkIntentsDelay )
3225
3226 intentState = main.TRUE
3227 for e in range(int(main.numCtrls)):
3228 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003229 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3230 if not IntentStateIndividual:
3231 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3232 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003233 if intentState:
3234 break
You Wangb6586542016-02-26 09:25:56 -08003235 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003236 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003237 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003238
GlennRCdb2c8422015-09-29 12:21:59 -07003239 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3240 onpass="INTENTS INSTALLED",
3241 onfail="SOME INTENTS NOT INSTALLED" )
3242
GlennRCfa69a2a2015-10-02 15:54:06 -07003243 main.step("Verify flows are all added")
3244
3245 for i in range( main.flowCheck ):
3246 if i != 0:
3247 main.log.warn( "verification failed. Retrying..." )
3248 main.log.info( "Waiting for onos to add flows..." )
3249 time.sleep( main.checkFlowsDelay )
3250
3251 flowState = main.TRUE
3252 for cli in main.CLIs:
3253 flowState = cli.checkFlowState()
3254 if not flowState:
3255 main.log.warn( "Not all flows added" )
3256 if flowState:
3257 break
3258 else:
3259 #Dumping summary
3260 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3261
3262 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3263 onpass="FLOWS INSTALLED",
3264 onfail="SOME FLOWS NOT ADDED" )
3265
Hari Krishnac195f3b2015-07-08 20:02:24 -07003266 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003267 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003268 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003269 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3270 if not pingResult:
3271 main.log.warn("First pingall failed. Retrying...")
3272 time.sleep(main.pingSleep)
3273 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003274
Hari Krishnac195f3b2015-07-08 20:02:24 -07003275 time2 = time.time()
3276 timeDiff = round( ( time2 - time1 ), 2 )
3277 main.log.report(
3278 "Time taken for Ping All: " +
3279 str( timeDiff ) +
3280 " seconds" )
3281
GlennRCfa69a2a2015-10-02 15:54:06 -07003282 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003283 utilities.assert_equals(
3284 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003285 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003286 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3287 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3288
GlennRCfa69a2a2015-10-02 15:54:06 -07003289 if not intentState:
3290 main.log.debug( "Intents failed to install completely" )
3291 if not pingResult:
3292 main.log.debug( "Pingall failed" )
3293 if not checkFlowsState:
3294 main.log.debug( "Flows failed to add completely" )
3295
3296 if not caseResult and main.failSwitch:
3297 main.log.report("Stopping test")
3298 main.stop( email=main.emailOnStop )
3299
Hari Krishnac195f3b2015-07-08 20:02:24 -07003300 def CASE97( self ):
3301 """
3302 Install single-multi point intents and verify Ping all works
3303 for Chordal topology
3304 """
3305 import copy
3306 main.log.report( "Install single-multi point intents and verify Ping all" )
3307 main.log.report( "___________________________________________" )
3308 main.case( "Install single-multi point intents and Ping all" )
3309 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3310 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3311 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003312 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003313 time1 = time.time()
3314 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3315 pool = []
3316 for cli in main.CLIs:
3317 ingressDevice = deviceDPIDsCopy[i]
3318 egressDeviceList = copy.copy(deviceDPIDsCopy)
3319 egressDeviceList.remove(ingressDevice)
3320 if i >= len( deviceDPIDsCopy ):
3321 break
3322 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3323 threadID=main.threadID,
3324 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003325 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003326 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003327 t.start()
3328 i = i + 1
3329 main.threadID = main.threadID + 1
3330 for thread in pool:
3331 thread.join()
3332 intentIdList.append(thread.result)
3333 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003334 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003335
3336 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003337 # Giving onos multiple chances to install intents
3338 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003339 if i != 0:
3340 main.log.warn( "Verification failed. Retrying..." )
3341 main.log.info("Waiting for onos to install intents...")
3342 time.sleep( main.checkIntentsDelay )
3343
3344 intentState = main.TRUE
3345 for e in range(int(main.numCtrls)):
3346 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003347 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3348 if not IntentStateIndividual:
3349 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3350 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003351 if intentState:
3352 break
You Wangb6586542016-02-26 09:25:56 -08003353 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003354 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003355 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003356
GlennRCdb2c8422015-09-29 12:21:59 -07003357 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3358 onpass="INTENTS INSTALLED",
3359 onfail="SOME INTENTS NOT INSTALLED" )
3360
GlennRCfa69a2a2015-10-02 15:54:06 -07003361 main.step("Verify flows are all added")
3362
3363 for i in range( main.flowCheck ):
3364 if i != 0:
3365 main.log.warn( "verification failed. Retrying..." )
3366 main.log.info( "Waiting for onos to add flows..." )
3367 time.sleep( main.checkFlowsDelay )
3368
3369 flowState = main.TRUE
3370 for cli in main.CLIs:
3371 flowState = cli.checkFlowState()
3372 if not flowState:
3373 main.log.warn( "Not all flows added" )
3374 if flowState:
3375 break
3376 else:
3377 #Dumping summary
3378 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3379
3380 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3381 onpass="FLOWS INSTALLED",
3382 onfail="SOME FLOWS NOT ADDED" )
3383
Hari Krishnac195f3b2015-07-08 20:02:24 -07003384 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003385 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003386 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003387 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3388 if not pingResult:
3389 main.log.warn("First pingall failed. Retrying...")
3390 time.sleep(main.pingSleep)
3391 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003392
Hari Krishnac195f3b2015-07-08 20:02:24 -07003393 time2 = time.time()
3394 timeDiff = round( ( time2 - time1 ), 2 )
3395 main.log.report(
3396 "Time taken for Ping All: " +
3397 str( timeDiff ) +
3398 " seconds" )
3399
GlennRCfa69a2a2015-10-02 15:54:06 -07003400 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003401 utilities.assert_equals(
3402 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003403 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003404 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3405 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3406
GlennRCfa69a2a2015-10-02 15:54:06 -07003407 if not intentState:
3408 main.log.debug( "Intents failed to install completely" )
3409 if not pingResult:
3410 main.log.debug( "Pingall failed" )
3411 if not checkFlowsState:
3412 main.log.debug( "Flows failed to add completely" )
3413
3414 if not caseResult and main.failSwitch:
3415 main.log.report("Stopping test")
3416 main.stop( email=main.emailOnStop )
3417
Hari Krishnac195f3b2015-07-08 20:02:24 -07003418 def CASE98( self ):
3419 """
3420 Install single-multi point intents and verify Ping all works
3421 for Spine topology
3422 """
3423 import copy
3424 main.log.report( "Install single-multi point intents and verify Ping all" )
3425 main.log.report( "___________________________________________" )
3426 main.case( "Install single-multi point intents and Ping all" )
3427 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3428 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3429 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3430 intentIdList = []
3431 MACsDictCopy = {}
3432 for i in range( len( deviceDPIDsCopy ) ):
3433 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3434
GlennRCfa69a2a2015-10-02 15:54:06 -07003435 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3436 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003437 time1 = time.time()
3438 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3439 pool = []
3440 for cli in main.CLIs:
3441 if i >= len( deviceDPIDsCopy ):
3442 break
3443 ingressDevice = deviceDPIDsCopy[i]
3444 egressDeviceList = copy.copy(deviceDPIDsCopy)
3445 egressDeviceList.remove(ingressDevice)
3446 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3447 threadID=main.threadID,
3448 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003449 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003450 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003451 t.start()
3452 i = i + 1
3453 main.threadID = main.threadID + 1
3454 for thread in pool:
3455 thread.join()
3456 intentIdList.append(thread.result)
3457 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003458 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003459
3460 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003461 # Giving onos multiple chances to install intents
3462 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003463 if i != 0:
3464 main.log.warn( "Verification failed. Retrying..." )
3465 main.log.info("Waiting for onos to install intents...")
3466 time.sleep( main.checkIntentsDelay )
3467
3468 intentState = main.TRUE
3469 for e in range(int(main.numCtrls)):
3470 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003471 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3472 if not IntentStateIndividual:
3473 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3474 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003475 if intentState:
3476 break
You Wangb6586542016-02-26 09:25:56 -08003477 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003478 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003479 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003480
GlennRCdb2c8422015-09-29 12:21:59 -07003481 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3482 onpass="INTENTS INSTALLED",
3483 onfail="SOME INTENTS NOT INSTALLED" )
3484
GlennRCfa69a2a2015-10-02 15:54:06 -07003485 main.step("Verify flows are all added")
3486
3487 for i in range( main.flowCheck ):
3488 if i != 0:
3489 main.log.warn( "verification failed. Retrying..." )
3490 main.log.info( "Waiting for onos to add flows..." )
3491 time.sleep( main.checkFlowsDelay )
3492
3493 flowState = main.TRUE
3494 for cli in main.CLIs:
3495 flowState = cli.checkFlowState()
3496 if not flowState:
3497 main.log.warn( "Not all flows added" )
3498 if flowState:
3499 break
3500 else:
3501 #Dumping summary
3502 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3503
3504 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3505 onpass="FLOWS INSTALLED",
3506 onfail="SOME FLOWS NOT ADDED" )
3507
Hari Krishnac195f3b2015-07-08 20:02:24 -07003508 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003509 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003510 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003511 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3512 if not pingResult:
3513 main.log.warn("First pingall failed. Retrying...")
3514 time.sleep(main.pingSleep)
3515 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003516
Hari Krishnac195f3b2015-07-08 20:02:24 -07003517 time2 = time.time()
3518 timeDiff = round( ( time2 - time1 ), 2 )
3519 main.log.report(
3520 "Time taken for Ping All: " +
3521 str( timeDiff ) +
3522 " seconds" )
3523
GlennRCfa69a2a2015-10-02 15:54:06 -07003524 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003525 utilities.assert_equals(
3526 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003527 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003528 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3529 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3530
GlennRCfa69a2a2015-10-02 15:54:06 -07003531 if not intentState:
3532 main.log.debug( "Intents failed to install completely" )
3533 if not pingResult:
3534 main.log.debug( "Pingall failed" )
3535 if not checkFlowsState:
3536 main.log.debug( "Flows failed to add completely" )
3537
3538 if not caseResult and main.failSwitch:
3539 main.log.report("Stopping test")
3540 main.stop( email=main.emailOnStop )
3541
Hari Krishna4223dbd2015-08-13 16:29:53 -07003542 def CASE190( self ):
3543 """
3544 Verify IPv6 ping across 600 Point intents (Att Topology)
3545 """
3546 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3547 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003548 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003549
Hari Krishna4223dbd2015-08-13 16:29:53 -07003550 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003551 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3552 utilities.assert_equals( expect=main.TRUE,
3553 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003554 onpass="PING ALL PASS",
3555 onfail="PING ALL FAIL" )
3556
GlennRCbddd58f2015-10-01 15:45:25 -07003557 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003558 utilities.assert_equals(
3559 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003560 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003561 onpass="IPv6 Ping across 600 Point intents test PASS",
3562 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3563
You Wangb6586542016-02-26 09:25:56 -08003564 if not caseResult and main.failSwitch:
3565 main.log.report("Stopping test")
3566 main.stop( email=main.emailOnStop )
3567
Hari Krishna4223dbd2015-08-13 16:29:53 -07003568 def CASE191( self ):
3569 """
3570 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3571 """
3572 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3573 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003574 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003575
Hari Krishna4223dbd2015-08-13 16:29:53 -07003576 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003577 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3578 utilities.assert_equals( expect=main.TRUE,
3579 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003580 onpass="PING ALL PASS",
3581 onfail="PING ALL FAIL" )
3582
GlennRCbddd58f2015-10-01 15:45:25 -07003583 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003584 utilities.assert_equals(
3585 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003586 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003587 onpass="IPv6 Ping across 600 Point intents test PASS",
3588 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3589
You Wangb6586542016-02-26 09:25:56 -08003590 if not caseResult and main.failSwitch:
3591 main.log.report("Stopping test")
3592 main.stop( email=main.emailOnStop )
3593
Hari Krishna4223dbd2015-08-13 16:29:53 -07003594 def CASE192( self ):
3595 """
3596 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3597 """
3598 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3599 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003600 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003601
Hari Krishna4223dbd2015-08-13 16:29:53 -07003602 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003603 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3604 utilities.assert_equals( expect=main.TRUE,
3605 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003606 onpass="PING ALL PASS",
3607 onfail="PING ALL FAIL" )
3608
GlennRCbddd58f2015-10-01 15:45:25 -07003609 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003610 utilities.assert_equals(
3611 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003612 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003613 onpass="IPv6 Ping across 4556 Point intents test PASS",
3614 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003615
You Wangb6586542016-02-26 09:25:56 -08003616 if not caseResult and main.failSwitch:
3617 main.log.report("Stopping test")
3618 main.stop( email=main.emailOnStop )
3619
Hari Krishnac195f3b2015-07-08 20:02:24 -07003620 def CASE10( self ):
3621 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003622 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003623 """
3624 Remove all Intents
3625 """
3626 main.log.report( "Remove all intents that were installed previously" )
3627 main.log.report( "______________________________________________" )
3628 main.log.info( "Remove all intents" )
3629 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003630 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003631 main.step( "Obtain the intent id's first" )
3632 intentsList = main.ONOScli1.getAllIntentIds()
3633 ansi_escape = re.compile( r'\x1b[^m]*m' )
3634 intentsList = ansi_escape.sub( '', intentsList )
3635 intentsList = intentsList.replace(
3636 " onos:intents | grep id=",
3637 "" ).replace(
3638 "id=",
3639 "" ).replace(
3640 "\r\r",
3641 "" )
3642 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003643 intentIdList = []
3644 step1Result = main.TRUE
3645 moreIntents = main.TRUE
3646 removeIntentCount = 0
3647 intentsCount = len(intentsList)
3648 main.log.info ( "Current number of intents: " + str(intentsCount) )
You Wangb6586542016-02-26 09:25:56 -08003649
3650 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003651 if ( len( intentsList ) > 1 ):
3652 results = main.TRUE
3653 main.log.info("Removing intent...")
3654 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003655 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003656 if removeIntentCount == 5:
3657 break
3658 removeIntentCount = removeIntentCount + 1
3659 intentsList1 = main.ONOScli1.getAllIntentIds()
3660 if len( intentsList1 ) == 0:
3661 break
3662 ansi_escape = re.compile( r'\x1b[^m]*m' )
3663 intentsList1 = ansi_escape.sub( '', intentsList1 )
3664 intentsList1 = intentsList1.replace(
3665 " onos:intents | grep id=",
3666 "" ).replace(
3667 " state=",
3668 "" ).replace(
3669 "\r\r",
3670 "" )
3671 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003672 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3673 print intentsList1
3674 intentIdList1 = []
3675 if ( len( intentsList1 ) > 0 ):
3676 moreIntents = main.TRUE
3677 for i in range( len( intentsList1 ) ):
3678 intentsTemp1 = intentsList1[ i ].split( ',' )
3679 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3680 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3681 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3682 time1 = time.time()
3683 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3684 pool = []
3685 for cli in main.CLIs:
3686 if i >= len( intentIdList1 ):
3687 break
3688 t = main.Thread( target=cli.removeIntent,
3689 threadID=main.threadID,
3690 name="removeIntent",
3691 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3692 pool.append(t)
3693 t.start()
3694 i = i + 1
3695 main.threadID = main.threadID + 1
3696 for thread in pool:
3697 thread.join()
3698 intentIdList.append(thread.result)
3699 #time.sleep(2)
3700 time2 = time.time()
3701 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003702 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003703 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003704 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003705 else:
3706 time.sleep(10)
3707 if len( main.ONOScli1.intents()):
3708 continue
3709 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003710 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003711 else:
3712 print "Removed %d intents" %(intentsCount)
3713 step1Result = main.TRUE
3714 else:
3715 print "No Intent IDs found in Intents list: ", intentsList
3716 step1Result = main.FALSE
3717
3718 print main.ONOScli1.intents()
You Wangb6586542016-02-26 09:25:56 -08003719
3720 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003721 caseResult = step1Result
3722 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003723 onpass="Intent removal test successful",
3724 onfail="Intent removal test failed" )
3725
3726 def CASE12( self, main ):
3727 """
3728 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3729 """
3730 import re
3731 import copy
3732 import time
3733
Hari Krishnac195f3b2015-07-08 20:02:24 -07003734 threadID = 0
3735
3736 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3737 main.log.report( "_____________________________________________________" )
3738 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3739 main.step( "Enable intent based Reactive forwarding" )
3740 installResult = main.FALSE
3741 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003742
Hari Krishnac195f3b2015-07-08 20:02:24 -07003743 pool = []
3744 time1 = time.time()
3745 for cli,feature in main.CLIs:
3746 t = main.Thread(target=cli,threadID=threadID,
3747 name="featureInstall",args=[feature])
3748 pool.append(t)
3749 t.start()
3750 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003751
Hari Krishnac195f3b2015-07-08 20:02:24 -07003752 results = []
3753 for thread in pool:
3754 thread.join()
3755 results.append(thread.result)
3756 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003757
Hari Krishnac195f3b2015-07-08 20:02:24 -07003758 if( all(result == main.TRUE for result in results) == False):
3759 main.log.info("Did not install onos-app-ifwd feature properly")
3760 #main.cleanup()
3761 #main.exit()
3762 else:
3763 main.log.info("Successful feature:install onos-app-ifwd")
3764 installResult = main.TRUE
3765 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003766
GlennRC6ac11b12015-10-21 17:41:28 -07003767 main.step( "Verify Ping across all hosts" )
3768 for i in range(main.numPings):
3769 time1 = time.time()
3770 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3771 if not pingResult:
3772 main.log.warn("First pingall failed. Retrying...")
3773 time.sleep(main.pingSleep)
3774 else: break
3775
Hari Krishnac195f3b2015-07-08 20:02:24 -07003776 time2 = time.time()
3777 timeDiff = round( ( time2 - time1 ), 2 )
3778 main.log.report(
3779 "Time taken for Ping All: " +
3780 str( timeDiff ) +
3781 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003782
GlennRC626ba132015-09-18 16:16:31 -07003783 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003784 main.log.report( "Pingall Test in Reactive mode successful" )
3785 else:
3786 main.log.report( "Pingall Test in Reactive mode failed" )
3787
3788 main.step( "Disable Intent based Reactive forwarding" )
3789 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003790
Hari Krishnac195f3b2015-07-08 20:02:24 -07003791 pool = []
3792 time1 = time.time()
3793 for cli,feature in main.CLIs:
3794 t = main.Thread(target=cli,threadID=threadID,
3795 name="featureUninstall",args=[feature])
3796 pool.append(t)
3797 t.start()
3798 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003799
Hari Krishnac195f3b2015-07-08 20:02:24 -07003800 results = []
3801 for thread in pool:
3802 thread.join()
3803 results.append(thread.result)
3804 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003805
Hari Krishnac195f3b2015-07-08 20:02:24 -07003806 if( all(result == main.TRUE for result in results) == False):
3807 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3808 uninstallResult = main.FALSE
3809 #main.cleanup()
3810 #main.exit()
3811 else:
3812 main.log.info("Successful feature:uninstall onos-app-ifwd")
3813 uninstallResult = main.TRUE
3814 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
3815
3816 # Waiting for reative flows to be cleared.
3817 time.sleep( 10 )
3818
GlennRCbddd58f2015-10-01 15:45:25 -07003819 caseResult = installResult and pingResult and uninstallResult
3820 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003821 onpass="Intent based Reactive forwarding Pingall test PASS",
3822 onfail="Intent based Reactive forwarding Pingall test FAIL" )