blob: 8c92c20b18a6d9ed1f82174c6be715284004a85a [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" )
112 packageResult = main.ONOSbench.onosPackage()
113 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
Hari Krishnac195f3b2015-07-08 20:02:24 -0700147 main.step( "Start ONOS CLI on all nodes" )
148 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700149 main.log.step(" Start ONOS cli using thread ")
150 startCliResult = main.TRUE
151 pool = []
152 time1 = time.time()
153 for i in range( int( main.numCtrls) ):
154 t = main.Thread( target=main.CLIs[i].startOnosCli,
155 threadID=main.threadID,
156 name="startOnosCli",
157 args=[ main.onosIPs[i], karafTimeout ] )
158 pool.append(t)
159 t.start()
160 main.threadID = main.threadID + 1
161 for t in pool:
162 t.join()
163 startCliResult = startCliResult and t.result
164 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700165
Hari Krishnac195f3b2015-07-08 20:02:24 -0700166 if not startCliResult:
167 main.log.info("ONOS CLI did not start up properly")
168 main.cleanup()
169 main.exit()
170 else:
171 main.log.info("Successful CLI startup")
172 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700173
174 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
You Wangb6586542016-02-26 09:25:56 -0800175 time.sleep(30)
Hari Krishna4223dbd2015-08-13 16:29:53 -0700176 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
177 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
178 cfgResult = cfgResult1 and cfgResult2
179 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
180 onpass="ipv6NeighborDiscovery cfg is set to true",
181 onfail="Failed to cfg set ipv6NeighborDiscovery" )
182
183 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700184 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
185 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
186 onpass="Set up test environment PASS",
187 onfail="Set up test environment FAIL" )
188
189 def CASE20( self, main ):
190 """
191 This test script Loads a new Topology (Att) on CHO setup and balances all switches
192 """
193 import re
194 import time
195 import copy
196
GlennRC3de72232015-12-16 10:48:35 -0800197 main.prefix = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -0700198 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
199 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
200 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800201 main.pingTimeout = main.pingTimeoutSmallTopo
202
Hari Krishnac195f3b2015-07-08 20:02:24 -0700203 main.log.report(
204 "Load Att topology and Balance all Mininet switches across controllers" )
205 main.log.report(
206 "________________________________________________________________________" )
207 main.case(
208 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700209
Hari Krishnac195f3b2015-07-08 20:02:24 -0700210 main.step( "Start Mininet with Att topology" )
211 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700212 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700213 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700214 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
215 topoPath = mininetDir + main.newTopo
216 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700217
Hari Krishnac195f3b2015-07-08 20:02:24 -0700218 main.step( "Assign switches to controllers" )
219 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
220 main.Mininet1.assignSwController(
221 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700222 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700223
224 switch_mastership = main.TRUE
225 for i in range( 1, ( main.numMNswitches + 1 ) ):
226 response = main.Mininet1.getSwController( "s" + str( i ) )
227 print( "Response is " + str( response ) )
228 if re.search( "tcp:" + main.onosIPs[0], response ):
229 switch_mastership = switch_mastership and main.TRUE
230 else:
231 switch_mastership = main.FALSE
232
233 if switch_mastership == main.TRUE:
234 main.log.report( "Controller assignment successfull" )
235 else:
236 main.log.report( "Controller assignment failed" )
237
238 time.sleep(30) # waiting here to make sure topology converges across all nodes
239
240 main.step( "Balance devices across controllers" )
241 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700242 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700243 time.sleep( 5 )
244
245 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700246 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700247 case2Result = ( switch_mastership and startStatus )
248 utilities.assert_equals(
249 expect=main.TRUE,
250 actual=case2Result,
251 onpass="Starting new Att topology test PASS",
252 onfail="Starting new Att topology test FAIL" )
253
254 def CASE21( self, main ):
255 """
256 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
257 """
258 import re
259 import time
260 import copy
261
GlennRC3de72232015-12-16 10:48:35 -0800262 main.prefix = 1
Hari Krishnac195f3b2015-07-08 20:02:24 -0700263 main.newTopo = main.params['TOPO2']['topo']
264 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
265 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
266 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800267 main.pingTimeout = main.pingTimeoutSmallTopo
268
Hari Krishnac195f3b2015-07-08 20:02:24 -0700269 main.log.report(
270 "Load Chordal topology and Balance all Mininet switches across controllers" )
271 main.log.report(
272 "________________________________________________________________________" )
273 main.case(
274 "Assign and Balance all Mininet switches across controllers" )
275
GlennRCc6cd2a62015-08-10 16:08:22 -0700276 main.step("Start Mininet with Chordal topology")
277 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700278 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700279 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
280 topoPath = mininetDir + main.newTopo
281 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700282
283 main.step( "Assign switches to controllers" )
284
285 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
286 main.Mininet1.assignSwController(
287 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700288 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700289
290 switch_mastership = main.TRUE
291 for i in range( 1, ( main.numMNswitches + 1 ) ):
292 response = main.Mininet1.getSwController( "s" + str( i ) )
293 print( "Response is " + str( response ) )
294 if re.search( "tcp:" + main.onosIPs[0], response ):
295 switch_mastership = switch_mastership and main.TRUE
296 else:
297 switch_mastership = main.FALSE
298
299 if switch_mastership == main.TRUE:
300 main.log.report( "Controller assignment successfull" )
301 else:
302 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700303
Hari Krishnac195f3b2015-07-08 20:02:24 -0700304 main.step( "Balance devices across controllers" )
305 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700306 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700307 time.sleep( 5 )
308
GlennRCbddd58f2015-10-01 15:45:25 -0700309 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700310 time.sleep(30)
311 utilities.assert_equals(
312 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700313 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700314 onpass="Starting new Chordal topology test PASS",
315 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700316
Hari Krishnac195f3b2015-07-08 20:02:24 -0700317 def CASE22( self, main ):
318 """
319 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
320 """
321 import re
322 import time
323 import copy
324
GlennRC3de72232015-12-16 10:48:35 -0800325 main.prefix = 2
Hari Krishnac195f3b2015-07-08 20:02:24 -0700326 main.newTopo = main.params['TOPO3']['topo']
327 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
328 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
329 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800330 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700331
Hari Krishnac195f3b2015-07-08 20:02:24 -0700332 main.log.report(
333 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
334 main.log.report(
335 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800336 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700337
338 main.step("Start Mininet with Spine topology")
339 mininetDir = main.Mininet1.home + "/custom/"
Jon Hall53c5e662016-04-13 16:06:56 -0700340 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
GlennRCc6cd2a62015-08-10 16:08:22 -0700341 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
342 topoPath = mininetDir + main.newTopo
343 startStatus = main.Mininet1.startNet(topoFile = topoPath)
344
Hari Krishnac195f3b2015-07-08 20:02:24 -0700345 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
346 main.Mininet1.assignSwController(
347 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700348 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700349
350 switch_mastership = main.TRUE
351 for i in range( 1, ( main.numMNswitches + 1 ) ):
352 response = main.Mininet1.getSwController( "s" + str( i ) )
353 print( "Response is " + str( response ) )
354 if re.search( "tcp:" + main.onosIPs[0], response ):
355 switch_mastership = switch_mastership and main.TRUE
356 else:
357 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700358
Hari Krishnac195f3b2015-07-08 20:02:24 -0700359 if switch_mastership == main.TRUE:
360 main.log.report( "Controller assignment successfull" )
361 else:
362 main.log.report( "Controller assignment failed" )
363 time.sleep( 5 )
364
365 main.step( "Balance devices across controllers" )
366 for i in range( int( main.numCtrls ) ):
367 balanceResult = main.ONOScli1.balanceMasters()
368 # giving some breathing time for ONOS to complete re-balance
369 time.sleep( 3 )
370
GlennRCbddd58f2015-10-01 15:45:25 -0700371 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700372 time.sleep(60)
373 utilities.assert_equals(
374 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700375 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700376 onpass="Starting new Spine topology test PASS",
377 onfail="Starting new Spine topology test FAIL" )
378
379 def CASE3( self, main ):
380 """
381 This Test case will be extended to collect and store more data related
382 ONOS state.
383 """
384 import re
385 import copy
386 main.deviceDPIDs = []
387 main.hostMACs = []
388 main.deviceLinks = []
389 main.deviceActiveLinksCount = []
390 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700391
Hari Krishnac195f3b2015-07-08 20:02:24 -0700392 main.log.report(
393 "Collect and Store topology details from ONOS before running any Tests" )
394 main.log.report(
395 "____________________________________________________________________" )
396 main.case( "Collect and Store Topology Details from ONOS" )
397 main.step( "Collect and store current number of switches and links" )
398 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700399 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700400 numOnosDevices = topology_result[ 'devices' ]
401 numOnosLinks = topology_result[ 'links' ]
402 topoResult = main.TRUE
403
GlennRCee8f3bf2015-12-14 16:18:39 -0800404 for check in range(main.topoCheck):
405 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
406 main.step( "Store Device DPIDs" )
407 for i in range( 1, (main.numMNswitches+1) ):
GlennRC20fc6522015-12-23 23:26:57 -0800408 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800409 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700410
GlennRCee8f3bf2015-12-14 16:18:39 -0800411 main.step( "Store Host MACs" )
412 for i in range( 1, ( main.numMNhosts + 1 ) ):
413 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
414 print "Host MACs in Store: \n", str( main.hostMACs )
415 main.MACsDict = {}
416 print "Creating dictionary of DPID and HostMacs"
417 for i in range(len(main.hostMACs)):
418 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
419 print main.MACsDict
420 main.step( "Collect and store all Devices Links" )
421 linksResult = main.ONOScli1.links( jsonFormat=False )
422 ansi_escape = re.compile( r'\x1b[^m]*m' )
423 linksResult = ansi_escape.sub( '', linksResult )
424 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
425 linksResult = linksResult.splitlines()
426 main.deviceLinks = copy.copy( linksResult )
427 print "Device Links Stored: \n", str( main.deviceLinks )
428 # this will be asserted to check with the params provided count of
429 # links
430 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700431
GlennRCee8f3bf2015-12-14 16:18:39 -0800432 main.step( "Collect and store each Device ports enabled Count" )
433 time1 = time.time()
434 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
435 pool = []
436 for cli in main.CLIs:
437 if i >= main.numMNswitches + 1:
438 break
GlennRC20fc6522015-12-23 23:26:57 -0800439 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800440 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
441 t.start()
442 pool.append(t)
443 i = i + 1
444 main.threadID = main.threadID + 1
445 for thread in pool:
446 thread.join()
447 portResult = thread.result
448 main.devicePortsEnabledCount.append( portResult )
449 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
450 time2 = time.time()
451 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700452
GlennRCee8f3bf2015-12-14 16:18:39 -0800453 main.step( "Collect and store each Device active links Count" )
454 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700455
GlennRCee8f3bf2015-12-14 16:18:39 -0800456 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
457 pool = []
458 for cli in main.CLIs:
459 if i >= main.numMNswitches + 1:
460 break
GlennRC20fc6522015-12-23 23:26:57 -0800461 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800462 t = main.Thread( target = cli.getDeviceLinksActiveCount,
463 threadID = main.threadID,
464 name = "getDevicePortsEnabledCount",
465 args = [dpid])
466 t.start()
467 pool.append(t)
468 i = i + 1
469 main.threadID = main.threadID + 1
470 for thread in pool:
471 thread.join()
472 linkCountResult = thread.result
473 main.deviceActiveLinksCount.append( linkCountResult )
474 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
475 time2 = time.time()
476 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700477
GlennRCee8f3bf2015-12-14 16:18:39 -0800478 # Exit out of the topo check loop
479 break
480
481 else:
482 main.log.info("Devices (expected): %s, Links (expected): %s" %
483 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
484 main.log.info("Devices (actual): %s, Links (actual): %s" %
485 ( numOnosDevices , numOnosLinks ) )
486 main.log.info("Topology does not match, trying again...")
487 topoResult = main.FALSE
488 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700489
490 # just returning TRUE for now as this one just collects data
491 case3Result = topoResult
492 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
493 onpass="Saving ONOS topology data test PASS",
494 onfail="Saving ONOS topology data test FAIL" )
495
GlennRC186b7362015-12-11 18:20:16 -0800496
GlennRC20fc6522015-12-23 23:26:57 -0800497
498 def CASE200( self, main ):
499
500 import time
501 main.log.report( "Clean up ONOS" )
502 main.log.case( "Stop topology and remove hosts and devices" )
503
504 main.step( "Stop Topology" )
505 stopStatus = main.Mininet1.stopNet()
506 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
507 onpass="Stopped mininet",
508 onfail="Failed to stop mininet" )
509
510
511 main.log.info( "Constructing host id list" )
512 hosts = []
513 for i in range( main.numMNhosts ):
514 hosts.append( "h" + str(i+1) )
515
516 main.step( "Getting host ids" )
517 hostList = main.CLIs[0].getHostsId( hosts )
518 hostIdResult = True if hostList else False
519 utilities.assert_equals( expect=True, actual=hostIdResult,
520 onpass="Successfully obtained the host ids.",
521 onfail="Failed to obtain the host ids" )
522
523 main.step( "Removing hosts" )
524 hostResult = main.CLIs[0].removeHost( hostList )
525 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
526 onpass="Successfully removed hosts",
527 onfail="Failed remove hosts" )
528
529 time.sleep( main.remHostDelay )
530
531 main.log.info( "Constructing device uri list" )
532 deviceList = []
533 for i in range( main.numMNswitches ):
534 deviceList.append( "of:00000000000000" + format( i+1, "02x" ) )
535
536 main.step( "Removing devices" )
537 deviceResult = main.CLIs[0].removeDevice( deviceList )
538 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
539 onpass="Successfully removed devices",
540 onfail="Failed remove devices" )
541
542 time.sleep( main.remDevDelay )
543
544 main.log.info( "Summary\n{}".format( main.CLIs[0].summary( jsonFormat=False ) ) )
545
546
Hari Krishnac195f3b2015-07-08 20:02:24 -0700547 def CASE40( self, main ):
548 """
GlennRC15d164c2015-12-15 17:12:25 -0800549 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700550 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700551 import time
GlennRC15d164c2015-12-15 17:12:25 -0800552 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700553 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800554 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700555
GlennRC15d164c2015-12-15 17:12:25 -0800556 main.step( "Enable Reactive forwarding" )
557 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
558 utilities.assert_equals( expect=main.TRUE, actual=appResult,
559 onpass="Successfully install fwd app",
560 onfail="Failed to install fwd app" )
561
Hari Krishnac195f3b2015-07-08 20:02:24 -0700562
GlennRC6ac11b12015-10-21 17:41:28 -0700563 main.step( "Verify Ping across all hosts" )
564 for i in range(main.numPings):
565 time1 = time.time()
566 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
567 if not pingResult:
568 main.log.warn("First pingall failed. Retrying...")
569 time.sleep(main.pingSleep)
GlennRC15d164c2015-12-15 17:12:25 -0800570 else:
571 break
GlennRC6ac11b12015-10-21 17:41:28 -0700572
Hari Krishnac195f3b2015-07-08 20:02:24 -0700573 time2 = time.time()
574 timeDiff = round( ( time2 - time1 ), 2 )
575 main.log.report(
576 "Time taken for Ping All: " +
577 str( timeDiff ) +
578 " seconds" )
579
GlennRC15d164c2015-12-15 17:12:25 -0800580 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700581 onpass="Reactive Mode IPv4 Pingall test PASS",
582 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700583
You Wangb6586542016-02-26 09:25:56 -0800584 if not pingResult and main.failSwitch:
585 main.log.report("Stopping test")
586 main.stop( email=main.emailOnStop )
587
GlennRC15d164c2015-12-15 17:12:25 -0800588 main.step( "Disable Reactive forwarding" )
589 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
590 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800591 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800592 onfail="Failed to deactivate fwd app" )
593
Hari Krishnac195f3b2015-07-08 20:02:24 -0700594 def CASE41( self, main ):
595 """
596 Verify Reactive forwarding (Chordal Topology)
597 """
598 import re
599 import copy
600 import time
601 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
602 main.log.report( "______________________________________________" )
603 main.case( "Enable Reactive forwarding and Verify ping all" )
604 main.step( "Enable Reactive forwarding" )
605 installResult = main.TRUE
606 # Activate fwd app
607 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
608
609 appCheck = main.TRUE
610 pool = []
611 for cli in main.CLIs:
612 t = main.Thread( target=cli.appToIDCheck,
613 name="appToIDCheck-" + str( i ),
614 args=[] )
615 pool.append( t )
616 t.start()
617 for t in pool:
618 t.join()
619 appCheck = appCheck and t.result
620 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
621 onpass="App Ids seem to be correct",
622 onfail="Something is wrong with app Ids" )
623 if appCheck != main.TRUE:
624 main.log.warn( main.CLIs[0].apps() )
625 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700626
Hari Krishnac195f3b2015-07-08 20:02:24 -0700627 time.sleep( 10 )
628
GlennRC6ac11b12015-10-21 17:41:28 -0700629 main.step( "Verify Ping across all hosts" )
630 for i in range(main.numPings):
631 time1 = time.time()
632 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
633 if not pingResult:
634 main.log.warn("First pingall failed. Retrying...")
635 time.sleep(main.pingSleep)
636 else: break
637
Hari Krishnac195f3b2015-07-08 20:02:24 -0700638 time2 = time.time()
639 timeDiff = round( ( time2 - time1 ), 2 )
640 main.log.report(
641 "Time taken for Ping All: " +
642 str( timeDiff ) +
643 " seconds" )
644
You Wangb6586542016-02-26 09:25:56 -0800645 if not pingResult and main.failSwitch:
646 main.log.report("Stopping test")
647 main.stop( email=main.emailOnStop )
648
GlennRC626ba132015-09-18 16:16:31 -0700649 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700650 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700651 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700652 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700653
GlennRCbddd58f2015-10-01 15:45:25 -0700654 caseResult = appCheck and pingResult
655 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700656 onpass="Reactive Mode IPv4 Pingall test PASS",
657 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700658
659 def CASE42( self, main ):
660 """
661 Verify Reactive forwarding (Spine Topology)
662 """
663 import re
664 import copy
665 import time
666 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
667 main.log.report( "______________________________________________" )
668 main.case( "Enable Reactive forwarding and Verify ping all" )
669 main.step( "Enable Reactive forwarding" )
670 installResult = main.TRUE
671 # Activate fwd app
672 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
673
674 appCheck = main.TRUE
675 pool = []
676 for cli in main.CLIs:
677 t = main.Thread( target=cli.appToIDCheck,
678 name="appToIDCheck-" + str( i ),
679 args=[] )
680 pool.append( t )
681 t.start()
682 for t in pool:
683 t.join()
684 appCheck = appCheck and t.result
685 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
686 onpass="App Ids seem to be correct",
687 onfail="Something is wrong with app Ids" )
688 if appCheck != main.TRUE:
689 main.log.warn( main.CLIs[0].apps() )
690 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700691
Hari Krishnac195f3b2015-07-08 20:02:24 -0700692 time.sleep( 10 )
693
GlennRC6ac11b12015-10-21 17:41:28 -0700694 main.step( "Verify Ping across all hosts" )
695 for i in range(main.numPings):
696 time1 = time.time()
697 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
698 if not pingResult:
699 main.log.warn("First pingall failed. Retrying...")
700 time.sleep(main.pingSleep)
701 else: break
702
Hari Krishnac195f3b2015-07-08 20:02:24 -0700703 time2 = time.time()
704 timeDiff = round( ( time2 - time1 ), 2 )
705 main.log.report(
706 "Time taken for Ping All: " +
707 str( timeDiff ) +
708 " seconds" )
709
You Wangb6586542016-02-26 09:25:56 -0800710 if not pingResult and main.failSwitch:
711 main.log.report("Stopping test")
712 main.stop( email=main.emailOnStop )
713
GlennRC626ba132015-09-18 16:16:31 -0700714 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700715 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700716 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700717 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
718
GlennRCbddd58f2015-10-01 15:45:25 -0700719 caseResult = appCheck and pingResult
720 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700721 onpass="Reactive Mode IPv4 Pingall test PASS",
722 onfail="Reactive Mode IPv4 Pingall test FAIL" )
723
GlennRC026dba62016-01-07 18:42:33 -0800724 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800725 """
726 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
727 """
GlennRC026dba62016-01-07 18:42:33 -0800728 import time
You Wang0779bac2016-01-27 16:32:33 -0800729 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800730 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800731 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800732
733 main.step( "Enable Reactive forwarding" )
734 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
735 utilities.assert_equals( expect=main.TRUE, actual=appResult,
736 onpass="Successfully install fwd app",
737 onfail="Failed to install fwd app" )
738
739 numHosts = int( main.params['TOPO1']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800740
741 for i in range(numHosts):
742 src = "h1"
743 dest = "h" + str(i+1)
744 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
745 main.Mininet1.handle.expect( "mininet>" )
746 main.log.info( main.Mininet1.handle.before )
747
748 hosts = main.CLIs[0].hosts( jsonFormat=False )
749
750 main.log.info( hosts )
751
752 main.step( "Disable Reactive forwarding" )
753 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
754 utilities.assert_equals( expect=main.TRUE, actual=appResult,
755 onpass="Successfully deactivated fwd app",
756 onfail="Failed to deactivate fwd app" )
757
758 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800759 """
760 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
761 """
GlennRC026dba62016-01-07 18:42:33 -0800762 import time
You Wang0779bac2016-01-27 16:32:33 -0800763 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800764 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800765 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800766
767 main.step( "Enable Reactive forwarding" )
768 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
769 utilities.assert_equals( expect=main.TRUE, actual=appResult,
770 onpass="Successfully install fwd app",
771 onfail="Failed to install fwd app" )
772
773 numHosts = int( main.params['TOPO2']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800774
775 for i in range(numHosts):
776 src = "h1"
777 dest = "h" + str(i+1)
778 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
779 main.Mininet1.handle.expect( "mininet>" )
780 main.log.info( main.Mininet1.handle.before )
781
782 hosts = main.CLIs[0].hosts( jsonFormat=False )
783
784 main.log.info( hosts )
785
786 main.step( "Disable Reactive forwarding" )
787 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
788 utilities.assert_equals( expect=main.TRUE, actual=appResult,
789 onpass="Successfully deactivated fwd app",
790 onfail="Failed to deactivate fwd app" )
791
792 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800793 """
794 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
795 """
GlennRC026dba62016-01-07 18:42:33 -0800796 import time
You Wang0779bac2016-01-27 16:32:33 -0800797 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800798 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800799 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800800
801 main.step( "Enable Reactive forwarding" )
802 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
803 utilities.assert_equals( expect=main.TRUE, actual=appResult,
804 onpass="Successfully install fwd app",
805 onfail="Failed to install fwd app" )
806
807 numHosts = int( main.params['TOPO3']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800808
You Wang0779bac2016-01-27 16:32:33 -0800809 for i in range(11, numHosts+10):
GlennRC026dba62016-01-07 18:42:33 -0800810 src = "h11"
You Wang0779bac2016-01-27 16:32:33 -0800811 dest = "h" + str(i+1)
GlennRC026dba62016-01-07 18:42:33 -0800812 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
813 main.Mininet1.handle.expect( "mininet>" )
814 main.log.info( main.Mininet1.handle.before )
815
816 hosts = main.CLIs[0].hosts( jsonFormat=False )
817
818 main.log.info( hosts )
819
820 main.step( "Disable Reactive forwarding" )
821 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
822 utilities.assert_equals( expect=main.TRUE, actual=appResult,
823 onpass="Successfully deactivated fwd app",
824 onfail="Failed to deactivate fwd app" )
825
Hari Krishna4223dbd2015-08-13 16:29:53 -0700826 def CASE140( self, main ):
827 """
828 Verify IPv6 Reactive forwarding (Att Topology)
829 """
830 import re
831 import copy
832 import time
833 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
834 main.log.report( "______________________________________________" )
835 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
836 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
837
838 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
839 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
840 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
841 cfgResult = cfgResult1 and cfgResult2
842 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
843 onpass="Reactive mode ipv6Fowarding cfg is set to true",
844 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
845
846 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700847 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700848 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700849 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
850 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700851 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700852 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700853 time2 = time.time()
854 timeDiff = round( ( time2 - time1 ), 2 )
855 main.log.report(
856 "Time taken for IPv6 Ping All: " +
857 str( timeDiff ) +
858 " seconds" )
859
GlennRC626ba132015-09-18 16:16:31 -0700860 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700861 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
862 else:
863 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700864
Jon Hall4ba53f02015-07-29 13:07:41 -0700865
GlennRC15d164c2015-12-15 17:12:25 -0800866 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700867 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700868 onpass="Reactive Mode IPv6 Pingall test PASS",
869 onfail="Reactive Mode IPv6 Pingall test FAIL" )
870
871 def CASE141( self, main ):
872 """
873 Verify IPv6 Reactive forwarding (Chordal Topology)
874 """
875 import re
876 import copy
877 import time
878 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
879 main.log.report( "______________________________________________" )
880 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
881 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
882
883 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
884 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
885 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
886 cfgResult = cfgResult1 and cfgResult2
887 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
888 onpass="Reactive mode ipv6Fowarding cfg is set to true",
889 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
890
891 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700892 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700893 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700894 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
895 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700896 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700897 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700898 time2 = time.time()
899 timeDiff = round( ( time2 - time1 ), 2 )
900 main.log.report(
901 "Time taken for IPv6 Ping All: " +
902 str( timeDiff ) +
903 " seconds" )
904
GlennRC626ba132015-09-18 16:16:31 -0700905 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700906 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
907 else:
908 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
909
910 main.step( "Disable Reactive forwarding" )
911
912 main.log.info( "Uninstall reactive forwarding app" )
913 appCheck = main.TRUE
914 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
915 pool = []
916 for cli in main.CLIs:
917 t = main.Thread( target=cli.appToIDCheck,
918 name="appToIDCheck-" + str( i ),
919 args=[] )
920 pool.append( t )
921 t.start()
922
923 for t in pool:
924 t.join()
925 appCheck = appCheck and t.result
926 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
927 onpass="App Ids seem to be correct",
928 onfail="Something is wrong with app Ids" )
929 if appCheck != main.TRUE:
930 main.log.warn( main.CLIs[0].apps() )
931 main.log.warn( main.CLIs[0].appIDs() )
932
933 # Waiting for reative flows to be cleared.
934 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700935 caseResult = appCheck and cfgResult and pingResult
936 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700937 onpass="Reactive Mode IPv6 Pingall test PASS",
938 onfail="Reactive Mode IPv6 Pingall test FAIL" )
939
940 def CASE142( self, main ):
941 """
942 Verify IPv6 Reactive forwarding (Spine Topology)
943 """
944 import re
945 import copy
946 import time
947 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
948 main.log.report( "______________________________________________" )
949 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
950 # Spine topology do not have hosts h1-h10
951 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
952 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
953 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
954 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
955 cfgResult = cfgResult1 and cfgResult2
956 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
957 onpass="Reactive mode ipv6Fowarding cfg is set to true",
958 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
959
960 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700961 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700962 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700963 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
964 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700965 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700966 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700967 time2 = time.time()
968 timeDiff = round( ( time2 - time1 ), 2 )
969 main.log.report(
970 "Time taken for IPv6 Ping All: " +
971 str( timeDiff ) +
972 " seconds" )
973
GlennRC626ba132015-09-18 16:16:31 -0700974 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700975 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
976 else:
977 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
978
979 main.step( "Disable Reactive forwarding" )
980
981 main.log.info( "Uninstall reactive forwarding app" )
982 appCheck = main.TRUE
983 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
984 pool = []
985 for cli in main.CLIs:
986 t = main.Thread( target=cli.appToIDCheck,
987 name="appToIDCheck-" + str( i ),
988 args=[] )
989 pool.append( t )
990 t.start()
991
992 for t in pool:
993 t.join()
994 appCheck = appCheck and t.result
995 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
996 onpass="App Ids seem to be correct",
997 onfail="Something is wrong with app Ids" )
998 if appCheck != main.TRUE:
999 main.log.warn( main.CLIs[0].apps() )
1000 main.log.warn( main.CLIs[0].appIDs() )
1001
1002 # Waiting for reative flows to be cleared.
1003 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -07001004 caseResult = appCheck and cfgResult and pingResult
1005 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001006 onpass="Reactive Mode IPv6 Pingall test PASS",
1007 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001008
You Wang0779bac2016-01-27 16:32:33 -08001009 def CASE147( self, main ):
1010 """
1011 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
1012 """
1013 import time
1014 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
1015 main.log.report( "______________________________________________" )
1016 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1017
1018 main.step( "Enable IPv4 Reactive forwarding" )
1019 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1020 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1021 onpass="Successfully install fwd app",
1022 onfail="Failed to install fwd app" )
1023
1024 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1025 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1026 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1027 cfgResult = cfgResult1 and cfgResult2
1028 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1029 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1030 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1031
You Wangb6586542016-02-26 09:25:56 -08001032 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001033 numHosts = int( main.params['TOPO1']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001034 for i in range(numHosts):
1035 src = "h1"
1036 dest = "1000::" + str(i+1)
1037 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1038 main.Mininet1.handle.expect( "mininet>" )
1039 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001040 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001041 main.log.info( hosts )
1042
1043 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001044 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1045 appCheck = main.TRUE
1046 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1047 pool = []
1048 for cli in main.CLIs:
1049 t = main.Thread( target=cli.appToIDCheck,
1050 name="appToIDCheck-" + str( i ),
1051 args=[] )
1052 pool.append( t )
1053 t.start()
1054
1055 for t in pool:
1056 t.join()
1057 appCheck = appCheck and t.result
1058 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1059 onpass="App Ids seem to be correct",
1060 onfail="Something is wrong with app Ids" )
1061
1062 if appCheck != main.TRUE:
1063 main.log.warn( main.CLIs[0].apps() )
1064 main.log.warn( main.CLIs[0].appIDs() )
1065
1066 # Waiting for reative flows to be cleared.
1067 time.sleep( 30 )
1068
1069 main.step( "Disable IPv4 Reactive forwarding" )
1070 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1071 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1072 onpass="Successfully deactivated IPv4 fwd app",
1073 onfail="Failed to deactivate IPv4 fwd app" )
1074
1075 def CASE148( self, main ):
1076 """
1077 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1078 """
1079 import time
1080 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1081 main.log.report( "______________________________________________" )
1082 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1083
1084 main.step( "Enable IPv4 Reactive forwarding" )
1085 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1086 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1087 onpass="Successfully install fwd app",
1088 onfail="Failed to install fwd app" )
1089
1090 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1091 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1092 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1093 cfgResult = cfgResult1 and cfgResult2
1094 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1095 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1096 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1097
You Wangb6586542016-02-26 09:25:56 -08001098 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001099 numHosts = int( main.params['TOPO2']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001100 for i in range(numHosts):
1101 src = "h1"
1102 dest = "1000::" + str(i+1)
1103 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1104 main.Mininet1.handle.expect( "mininet>" )
1105 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001106 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001107 main.log.info( hosts )
1108
1109 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001110 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1111 appCheck = main.TRUE
1112 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1113 pool = []
1114 for cli in main.CLIs:
1115 t = main.Thread( target=cli.appToIDCheck,
1116 name="appToIDCheck-" + str( i ),
1117 args=[] )
1118 pool.append( t )
1119 t.start()
1120
1121 for t in pool:
1122 t.join()
1123 appCheck = appCheck and t.result
1124 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1125 onpass="App Ids seem to be correct",
1126 onfail="Something is wrong with app Ids" )
1127
1128 if appCheck != main.TRUE:
1129 main.log.warn( main.CLIs[0].apps() )
1130 main.log.warn( main.CLIs[0].appIDs() )
1131
1132 # Waiting for reative flows to be cleared.
1133 time.sleep( 30 )
1134
1135 main.step( "Disable IPv4 Reactive forwarding" )
1136 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1137 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1138 onpass="Successfully deactivated IPv4 fwd app",
1139 onfail="Failed to deactivate IPv4 fwd app" )
1140
1141 def CASE149( self, main ):
1142 """
1143 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1144 """
1145 import time
1146 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1147 main.log.report( "______________________________________________" )
1148 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1149
1150 main.step( "Enable IPv4 Reactive forwarding" )
1151 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1152 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1153 onpass="Successfully install fwd app",
1154 onfail="Failed to install fwd app" )
1155
1156 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1157 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1158 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1159 cfgResult = cfgResult1 and cfgResult2
1160 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1161 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1162 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1163
You Wangb6586542016-02-26 09:25:56 -08001164 main.step( "Discover hosts using ping" )
You Wang0779bac2016-01-27 16:32:33 -08001165 numHosts = int( main.params['TOPO3']['numHosts'] )
You Wang0779bac2016-01-27 16:32:33 -08001166 for i in range(11, numHosts+10):
1167 src = "h11"
1168 dest = "1000::" + str(i+1)
1169 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1170 main.Mininet1.handle.expect( "mininet>" )
1171 main.log.info( main.Mininet1.handle.before )
You Wang0779bac2016-01-27 16:32:33 -08001172 hosts = main.CLIs[0].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001173 main.log.info( hosts )
1174
1175 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001176 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1177 appCheck = main.TRUE
1178 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1179 pool = []
1180 for cli in main.CLIs:
1181 t = main.Thread( target=cli.appToIDCheck,
1182 name="appToIDCheck-" + str( i ),
1183 args=[] )
1184 pool.append( t )
1185 t.start()
1186
1187 for t in pool:
1188 t.join()
1189 appCheck = appCheck and t.result
1190 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1191 onpass="App Ids seem to be correct",
1192 onfail="Something is wrong with app Ids" )
1193
1194 if appCheck != main.TRUE:
1195 main.log.warn( main.CLIs[0].apps() )
1196 main.log.warn( main.CLIs[0].appIDs() )
1197
1198 # Waiting for reative flows to be cleared.
1199 time.sleep( 30 )
1200
1201 main.step( "Disable IPv4 Reactive forwarding" )
1202 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1203 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1204 onpass="Successfully deactivated IPv4 fwd app",
1205 onfail="Failed to deactivate IPv4 fwd app" )
1206
Hari Krishnac195f3b2015-07-08 20:02:24 -07001207 def CASE5( self, main ):
1208 """
1209 Compare current ONOS topology with reference data
1210 """
1211 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001212
Hari Krishnac195f3b2015-07-08 20:02:24 -07001213 devicesDPIDTemp = []
1214 hostMACsTemp = []
1215 deviceLinksTemp = []
1216 deviceActiveLinksCountTemp = []
1217 devicePortsEnabledCountTemp = []
1218
1219 main.log.report(
1220 "Compare ONOS topology with reference data in Stores" )
1221 main.log.report( "__________________________________________________" )
1222 main.case( "Compare ONOS topology with reference data" )
1223
1224 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001225
GlennRC289c1b62015-12-12 10:45:43 -08001226 for check in range(main.topoCheck):
1227 time1 = time.time()
1228 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
1229 pool = []
1230 for cli in main.CLIs:
1231 if i >= main.numMNswitches + 1:
1232 break
GlennRC20fc6522015-12-23 23:26:57 -08001233 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001234 t = main.Thread(target = cli.getDevicePortsEnabledCount,
1235 threadID = main.threadID,
1236 name = "getDevicePortsEnabledCount",
1237 args = [dpid])
1238 t.start()
1239 pool.append(t)
1240 i = i + 1
1241 main.threadID = main.threadID + 1
1242 for thread in pool:
1243 thread.join()
1244 portResult = thread.result
1245 #portTemp = re.split( r'\t+', portResult )
1246 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1247 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001248
GlennRC289c1b62015-12-12 10:45:43 -08001249 time2 = time.time()
1250 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
1251 main.log.info (
1252 "Device Enabled ports EXPECTED: %s" %
1253 str( main.devicePortsEnabledCount ) )
1254 main.log.info (
1255 "Device Enabled ports ACTUAL: %s" %
1256 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001257
GlennRC289c1b62015-12-12 10:45:43 -08001258 if ( cmp( main.devicePortsEnabledCount,
1259 devicePortsEnabledCountTemp ) == 0 ):
1260 stepResult1 = main.TRUE
1261 else:
1262 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001263
GlennRC289c1b62015-12-12 10:45:43 -08001264 main.step( "Compare Device active links with reference" )
1265 time1 = time.time()
1266 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
1267 pool = []
1268 for cli in main.CLIs:
1269 if i >= main.numMNswitches + 1:
1270 break
GlennRC20fc6522015-12-23 23:26:57 -08001271 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001272 t = main.Thread(target = cli.getDeviceLinksActiveCount,
1273 threadID = main.threadID,
1274 name = "getDeviceLinksActiveCount",
1275 args = [dpid])
1276 t.start()
1277 pool.append(t)
1278 i = i + 1
1279 main.threadID = main.threadID + 1
1280 for thread in pool:
1281 thread.join()
1282 linkCountResult = thread.result
1283 #linkCountTemp = re.split( r'\t+', linkCountResult )
1284 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1285 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001286
GlennRC289c1b62015-12-12 10:45:43 -08001287 time2 = time.time()
1288 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
1289 main.log.info (
1290 "Device Active links EXPECTED: %s" %
1291 str( main.deviceActiveLinksCount ) )
1292 main.log.info (
1293 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1294 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1295 stepResult2 = main.TRUE
1296 else:
1297 stepResult2 = main.FALSE
1298
1299 """
1300 place holder for comparing devices, hosts, paths and intents if required.
1301 Links and ports data would be incorrect with out devices anyways.
1302 """
1303 caseResult = ( stepResult1 and stepResult2 )
1304
1305 if caseResult:
1306 break
1307 else:
1308 time.sleep( main.topoCheckDelay )
1309 main.log.warn( "Topology check failed. Trying again..." )
1310
1311
1312 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001313 onpass="Compare Topology test PASS",
1314 onfail="Compare Topology test FAIL" )
1315
1316 def CASE60( self ):
1317 """
1318 Install 300 host intents and verify ping all (Att Topology)
1319 """
1320 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1321 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001322 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001323
Hari Krishnac195f3b2015-07-08 20:02:24 -07001324 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001325 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001326 main.intentIds = list(intentIdList)
1327
GlennRCa8d786a2015-09-23 17:40:11 -07001328 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001329 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001330 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1331 onpass="INTENTS INSTALLED",
1332 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001333
1334 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001335 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001336 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1337 onpass="PING ALL PASS",
1338 onfail="PING ALL FAIL" )
1339
GlennRCbddd58f2015-10-01 15:45:25 -07001340 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001341 utilities.assert_equals(
1342 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001343 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001344 onpass="Install 300 Host Intents and Ping All test PASS",
1345 onfail="Install 300 Host Intents and Ping All test FAIL" )
1346
GlennRCfcfdc4f2015-09-30 16:01:57 -07001347 if not intentState:
1348 main.log.debug( "Intents failed to install completely" )
1349 if not pingResult:
1350 main.log.debug( "Pingall failed" )
1351
GlennRCbddd58f2015-10-01 15:45:25 -07001352 if not caseResult and main.failSwitch:
1353 main.log.report("Stopping test")
1354 main.stop( email=main.emailOnStop )
1355
Hari Krishnac195f3b2015-07-08 20:02:24 -07001356 def CASE61( self ):
1357 """
You Wang0779bac2016-01-27 16:32:33 -08001358 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001359 """
You Wang0779bac2016-01-27 16:32:33 -08001360 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001361 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001362 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001363
Hari Krishnac195f3b2015-07-08 20:02:24 -07001364 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001365 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001366 main.intentIds = list(intentIdList)
1367
GlennRCa8d786a2015-09-23 17:40:11 -07001368 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001369 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001370 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1371 onpass="INTENTS INSTALLED",
1372 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001373
1374 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001375 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001376 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1377 onpass="PING ALL PASS",
1378 onfail="PING ALL FAIL" )
1379
GlennRCbddd58f2015-10-01 15:45:25 -07001380 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001381 utilities.assert_equals( expect=main.TRUE,
1382 actual=caseResult,
1383 onpass="Install 300 Host Intents and Ping All test PASS",
1384 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001385
GlennRCfcfdc4f2015-09-30 16:01:57 -07001386 if not intentState:
1387 main.log.debug( "Intents failed to install completely" )
1388 if not pingResult:
1389 main.log.debug( "Pingall failed" )
1390
GlennRCbddd58f2015-10-01 15:45:25 -07001391 if not caseResult and main.failSwitch:
1392 main.log.report("Stopping test")
1393 main.stop( email=main.emailOnStop )
1394
Hari Krishnac195f3b2015-07-08 20:02:24 -07001395 def CASE62( self ):
1396 """
1397 Install 2278 host intents and verify ping all for Spine Topology
1398 """
1399 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1400 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001401 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001402
You Wangb6586542016-02-26 09:25:56 -08001403 main.step( "Add host Intents" )
1404 intentIdList = main.CHOtestFunctions.installHostIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001405 main.intentIds = list(intentIdList)
1406
GlennRCa8d786a2015-09-23 17:40:11 -07001407 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001408 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001409 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1410 onpass="INTENTS INSTALLED",
1411 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001412
1413 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001414 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001415 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1416 onpass="PING ALL PASS",
1417 onfail="PING ALL FAIL" )
1418
GlennRCbddd58f2015-10-01 15:45:25 -07001419 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001420 utilities.assert_equals( expect=main.TRUE,
1421 actual=caseResult,
1422 onpass="Install 2278 Host Intents and Ping All test PASS",
1423 onfail="Install 2278 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001424
GlennRCfcfdc4f2015-09-30 16:01:57 -07001425 if not intentState:
1426 main.log.debug( "Intents failed to install completely" )
1427 if not pingResult:
1428 main.log.debug( "Pingall failed" )
1429
GlennRCbddd58f2015-10-01 15:45:25 -07001430 if not caseResult and main.failSwitch:
1431 main.log.report("Stopping test")
1432 main.stop( email=main.emailOnStop )
1433
Hari Krishna4223dbd2015-08-13 16:29:53 -07001434 def CASE160( self ):
1435 """
1436 Verify IPv6 ping across 300 host intents (Att Topology)
1437 """
1438 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1439 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001440 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001441
Hari Krishna4223dbd2015-08-13 16:29:53 -07001442 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001443 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1444 utilities.assert_equals( expect=main.TRUE,
1445 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001446 onpass="PING ALL PASS",
1447 onfail="PING ALL FAIL" )
1448
GlennRCbddd58f2015-10-01 15:45:25 -07001449 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001450 utilities.assert_equals(
1451 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001452 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001453 onpass="IPv6 Ping across 300 host intents test PASS",
1454 onfail="IPv6 Ping across 300 host intents test FAIL" )
1455
You Wangb6586542016-02-26 09:25:56 -08001456 if not caseResult and main.failSwitch:
1457 main.log.report("Stopping test")
1458 main.stop( email=main.emailOnStop )
1459
Hari Krishna4223dbd2015-08-13 16:29:53 -07001460 def CASE161( self ):
1461 """
You Wang0779bac2016-01-27 16:32:33 -08001462 Verify IPv6 ping across 300 host intents (Chordal Topology)
Hari Krishna4223dbd2015-08-13 16:29:53 -07001463 """
You Wang0779bac2016-01-27 16:32:33 -08001464 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001465 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001466 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001467
Hari Krishna4223dbd2015-08-13 16:29:53 -07001468 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001469 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001470 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1471 onpass="PING ALL PASS",
1472 onfail="PING ALL FAIL" )
1473
GlennRCbddd58f2015-10-01 15:45:25 -07001474 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001475 utilities.assert_equals(
1476 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001477 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001478 onpass="IPv6 Ping across 300 host intents test PASS",
1479 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001480
You Wangb6586542016-02-26 09:25:56 -08001481 if not caseResult and main.failSwitch:
1482 main.log.report("Stopping test")
1483 main.stop( email=main.emailOnStop )
1484
Hari Krishna4223dbd2015-08-13 16:29:53 -07001485 def CASE162( self ):
1486 """
1487 Verify IPv6 ping across 2278 host intents (Spine Topology)
1488 """
1489 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1490 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001491 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001492
Hari Krishna4223dbd2015-08-13 16:29:53 -07001493 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001494 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001495 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1496 onpass="PING ALL PASS",
1497 onfail="PING ALL FAIL" )
1498
GlennRCbddd58f2015-10-01 15:45:25 -07001499 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001500 utilities.assert_equals(
1501 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001502 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001503 onpass="IPv6 Ping across 2278 host intents test PASS",
1504 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001505
You Wangb6586542016-02-26 09:25:56 -08001506 if not caseResult and main.failSwitch:
1507 main.log.report("Stopping test")
1508 main.stop( email=main.emailOnStop )
1509
Hari Krishnac195f3b2015-07-08 20:02:24 -07001510 def CASE70( self, main ):
1511 """
1512 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1513 """
1514 import random
1515 main.randomLink1 = []
1516 main.randomLink2 = []
1517 main.randomLink3 = []
1518 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1519 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1520 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1521 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1522 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1523 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1524 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001525
1526 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1527 main.log.report( "___________________________________________________________________________" )
1528 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1529 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1530 if ( int( switchLinksToToggle ) ==
1531 0 or int( switchLinksToToggle ) > 5 ):
1532 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1533 #main.cleanup()
1534 #main.exit()
1535 else:
1536 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1537
1538 main.step( "Cut links on Core devices using user provided range" )
1539 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1540 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1541 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1542 for i in range( int( switchLinksToToggle ) ):
1543 main.Mininet1.link(
1544 END1=link1End1,
1545 END2=main.randomLink1[ i ],
1546 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001547 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001548 main.Mininet1.link(
1549 END1=link2End1,
1550 END2=main.randomLink2[ i ],
1551 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001552 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001553 main.Mininet1.link(
1554 END1=link3End1,
1555 END2=main.randomLink3[ i ],
1556 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001557 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001558
You Wang0779bac2016-01-27 16:32:33 -08001559 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001560 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1561 int( main.numMNlinks ) -
1562 int( switchLinksToToggle ) * 6 )
1563 utilities.assert_equals( expect=main.TRUE,
1564 actual=linkDown,
1565 onpass="Link down discovered properly",
1566 onfail="Link down was not discovered in " +
1567 str( main.linkSleep * main.linkCheck ) +
1568 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001569
GlennRCfcfdc4f2015-09-30 16:01:57 -07001570 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001571 intentState = main.CHOtestFunctions.checkIntents()
1572 utilities.assert_equals( expect=main.TRUE,
1573 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001574 onpass="INTENTS INSTALLED",
1575 onfail="SOME INTENTS NOT INSTALLED" )
1576
Hari Krishnac195f3b2015-07-08 20:02:24 -07001577 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001578 pingResult = main.CHOtestFunctions.checkPingall()
1579 utilities.assert_equals( expect=main.TRUE,
1580 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001581 onpass="PING ALL PASS",
1582 onfail="PING ALL FAIL" )
1583
GlennRCbddd58f2015-10-01 15:45:25 -07001584 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001585 utilities.assert_equals( expect=main.TRUE,
1586 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001587 onpass="Random Link cut Test PASS",
1588 onfail="Random Link cut Test FAIL" )
1589
GlennRCfcfdc4f2015-09-30 16:01:57 -07001590 # Printing what exactly failed
1591 if not linkDown:
1592 main.log.debug( "Link down was not discovered correctly" )
1593 if not pingResult:
1594 main.log.debug( "Pingall failed" )
1595 if not intentState:
1596 main.log.debug( "Intents are not all installed" )
1597
GlennRCbddd58f2015-10-01 15:45:25 -07001598 if not caseResult and main.failSwitch:
1599 main.log.report("Stopping test")
1600 main.stop( email=main.emailOnStop )
1601
Hari Krishnac195f3b2015-07-08 20:02:24 -07001602 def CASE80( self, main ):
1603 """
1604 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1605 """
1606 import random
1607 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1608 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1609 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001610 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001611 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1612
1613 main.log.report(
1614 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1615 main.log.report(
1616 "__________________________________________________________________" )
1617 main.case(
1618 "Host intents - Bring the core links up that are down and verify ping all" )
1619 main.step( "Bring randomly cut links on Core devices up" )
1620 for i in range( int( switchLinksToToggle ) ):
1621 main.Mininet1.link(
1622 END1=link1End1,
1623 END2=main.randomLink1[ i ],
1624 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001625 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001626 main.Mininet1.link(
1627 END1=link2End1,
1628 END2=main.randomLink2[ i ],
1629 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001630 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001631 main.Mininet1.link(
1632 END1=link3End1,
1633 END2=main.randomLink3[ i ],
1634 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001635 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001636
You Wang0779bac2016-01-27 16:32:33 -08001637 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001638 linkUp = main.CHOtestFunctions.checkLinkEvents( "up",
1639 int( main.numMNlinks ) )
1640 utilities.assert_equals( expect=main.TRUE,
1641 actual=linkUp,
1642 onpass="Link up discovered properly",
1643 onfail="Link up was not discovered in " +
1644 str( main.linkSleep * main.linkCheck ) +
1645 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001646
GlennRCfcfdc4f2015-09-30 16:01:57 -07001647 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001648 intentState = main.CHOtestFunctions.checkIntents()
1649 utilities.assert_equals( expect=main.TRUE,
1650 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001651 onpass="INTENTS INSTALLED",
1652 onfail="SOME INTENTS NOT INSTALLED" )
1653
Hari Krishnac195f3b2015-07-08 20:02:24 -07001654 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001655 pingResult = main.CHOtestFunctions.checkPingall()
1656 utilities.assert_equals( expect=main.TRUE,
1657 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001658 onpass="PING ALL PASS",
1659 onfail="PING ALL FAIL" )
1660
GlennRCbddd58f2015-10-01 15:45:25 -07001661 caseResult = linkUp and pingResult
1662 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001663 onpass="Link Up Test PASS",
1664 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001665 # Printing what exactly failed
1666 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001667 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001668 if not pingResult:
1669 main.log.debug( "Pingall failed" )
1670 if not intentState:
1671 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001672
GlennRCbddd58f2015-10-01 15:45:25 -07001673 if not caseResult and main.failSwitch:
1674 main.log.report("Stopping test")
1675 main.stop( email=main.emailOnStop )
1676
Hari Krishnac195f3b2015-07-08 20:02:24 -07001677 def CASE71( self, main ):
1678 """
1679 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1680 """
1681 import random
1682 main.randomLink1 = []
1683 main.randomLink2 = []
1684 main.randomLink3 = []
1685 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1686 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1687 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1688 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1689 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1690 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1691 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
You Wangb6586542016-02-26 09:25:56 -08001692 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001693
1694 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1695 main.log.report( "___________________________________________________________________________" )
1696 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1697 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1698 if ( int( switchLinksToToggle ) ==
1699 0 or int( switchLinksToToggle ) > 5 ):
1700 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1701 #main.cleanup()
1702 #main.exit()
1703 else:
1704 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1705
1706 main.step( "Cut links on Core devices using user provided range" )
1707 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1708 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1709 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1710 for i in range( int( switchLinksToToggle ) ):
1711 main.Mininet1.link(
1712 END1=link1End1,
1713 END2=main.randomLink1[ i ],
1714 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001715 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001716 main.Mininet1.link(
1717 END1=link2End1,
1718 END2=main.randomLink2[ i ],
1719 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001720 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001721 main.Mininet1.link(
1722 END1=link3End1,
1723 END2=main.randomLink3[ i ],
1724 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001725 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001726
You Wang0779bac2016-01-27 16:32:33 -08001727 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001728 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1729 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 )
1730 utilities.assert_equals( expect=main.TRUE,
1731 actual=linkDown,
1732 onpass="Link down discovered properly",
1733 onfail="Link down was not discovered in " +
1734 str( main.linkSleep * main.linkCheck ) +
1735 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001736
GlennRCfcfdc4f2015-09-30 16:01:57 -07001737 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001738 intentState = main.CHOtestFunctions.checkIntents()
1739 utilities.assert_equals( expect=main.TRUE,
1740 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001741 onpass="INTENTS INSTALLED",
1742 onfail="SOME INTENTS NOT INSTALLED" )
1743
Hari Krishnac195f3b2015-07-08 20:02:24 -07001744 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001745 pingResult = main.CHOtestFunctions.checkPingall()
1746 utilities.assert_equals( expect=main.TRUE,
1747 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001748 onpass="PING ALL PASS",
1749 onfail="PING ALL FAIL" )
1750
GlennRCbddd58f2015-10-01 15:45:25 -07001751 caseResult = linkDown and pingResult and intentState
1752 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001753 onpass="Random Link cut Test PASS",
1754 onfail="Random Link cut Test FAIL" )
1755
GlennRCfcfdc4f2015-09-30 16:01:57 -07001756 # Printing what exactly failed
1757 if not linkDown:
1758 main.log.debug( "Link down was not discovered correctly" )
1759 if not pingResult:
1760 main.log.debug( "Pingall failed" )
1761 if not intentState:
1762 main.log.debug( "Intents are not all installed" )
1763
GlennRCbddd58f2015-10-01 15:45:25 -07001764 if not caseResult and main.failSwitch:
1765 main.log.report("Stopping test")
1766 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001767
Hari Krishnac195f3b2015-07-08 20:02:24 -07001768 def CASE81( self, main ):
1769 """
1770 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1771 """
1772 import random
1773 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1774 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1775 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001776 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001777 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1778
1779 main.log.report(
1780 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1781 main.log.report(
1782 "__________________________________________________________________" )
1783 main.case(
1784 "Point intents - Bring the core links up that are down and verify ping all" )
1785 main.step( "Bring randomly cut links on Core devices up" )
1786 for i in range( int( switchLinksToToggle ) ):
1787 main.Mininet1.link(
1788 END1=link1End1,
1789 END2=main.randomLink1[ i ],
1790 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001791 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001792 main.Mininet1.link(
1793 END1=link2End1,
1794 END2=main.randomLink2[ i ],
1795 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001796 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001797 main.Mininet1.link(
1798 END1=link3End1,
1799 END2=main.randomLink3[ i ],
1800 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001801 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001802
You Wang0779bac2016-01-27 16:32:33 -08001803 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001804 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1805 utilities.assert_equals( expect=main.TRUE,
1806 actual=linkUp,
1807 onpass="Link up discovered properly",
1808 onfail="Link up was not discovered in " +
1809 str( main.linkSleep * main.linkCheck ) +
1810 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001811
GlennRCfcfdc4f2015-09-30 16:01:57 -07001812 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001813 intentState = main.CHOtestFunctions.checkIntents()
1814 utilities.assert_equals( expect=main.TRUE,
1815 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001816 onpass="INTENTS INSTALLED",
1817 onfail="SOME INTENTS NOT INSTALLED" )
1818
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001820 pingResult = main.CHOtestFunctions.checkPingall()
1821 utilities.assert_equals( expect=main.TRUE,
1822 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001823 onpass="PING ALL PASS",
1824 onfail="PING ALL FAIL" )
1825
GlennRCbddd58f2015-10-01 15:45:25 -07001826 caseResult = linkUp and pingResult
1827 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001828 onpass="Link Up Test PASS",
1829 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001830 # Printing what exactly failed
1831 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001832 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001833 if not pingResult:
1834 main.log.debug( "Pingall failed" )
1835 if not intentState:
1836 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001837
GlennRCbddd58f2015-10-01 15:45:25 -07001838 if not caseResult and main.failSwitch:
1839 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001840 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001841
Hari Krishnac195f3b2015-07-08 20:02:24 -07001842 def CASE72( self, main ):
1843 """
1844 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1845 """
1846 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001847 import itertools
You Wangb6586542016-02-26 09:25:56 -08001848 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001849
Hari Krishnac195f3b2015-07-08 20:02:24 -07001850 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1851 main.log.report( "___________________________________________________________________________" )
1852 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1853 switches = []
1854 switchesComb = []
1855 for i in range( main.numMNswitches ):
1856 switches.append('s%d'%(i+1))
1857 switchesLinksComb = list(itertools.combinations(switches,2))
1858 main.randomLinks = random.sample(switchesLinksComb, 5 )
1859 print main.randomLinks
1860 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001861
Hari Krishnac195f3b2015-07-08 20:02:24 -07001862 for switch in main.randomLinks:
1863 main.Mininet1.link(
1864 END1=switch[0],
1865 END2=switch[1],
1866 OPTION="down")
You Wangb6586542016-02-26 09:25:56 -08001867 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001868
You Wang0779bac2016-01-27 16:32:33 -08001869 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001870 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1871 utilities.assert_equals( expect=main.TRUE,
1872 actual=linkDown,
1873 onpass="Link down discovered properly",
1874 onfail="Link down was not discovered in " +
1875 str( main.linkSleep * main.linkCheck ) +
1876 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001877
GlennRCfcfdc4f2015-09-30 16:01:57 -07001878 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001879 intentState = main.CHOtestFunctions.checkIntents()
1880 utilities.assert_equals( expect=main.TRUE,
1881 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001882 onpass="INTENTS INSTALLED",
1883 onfail="SOME INTENTS NOT INSTALLED" )
1884
Hari Krishnac195f3b2015-07-08 20:02:24 -07001885 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001886 pingResult = main.CHOtestFunctions.checkPingall()
1887 utilities.assert_equals( expect=main.TRUE,
1888 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001889 onpass="PING ALL PASS",
1890 onfail="PING ALL FAIL" )
1891
GlennRCbddd58f2015-10-01 15:45:25 -07001892 caseResult = linkDown and pingResult and intentState
1893 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894 onpass="Random Link cut Test PASS",
1895 onfail="Random Link cut Test FAIL" )
1896
GlennRCfcfdc4f2015-09-30 16:01:57 -07001897 # Printing what exactly failed
1898 if not linkDown:
1899 main.log.debug( "Link down was not discovered correctly" )
1900 if not pingResult:
1901 main.log.debug( "Pingall failed" )
1902 if not intentState:
1903 main.log.debug( "Intents are not all installed" )
1904
GlennRCbddd58f2015-10-01 15:45:25 -07001905 if not caseResult and main.failSwitch:
1906 main.log.report("Stopping test")
1907 main.stop( email=main.emailOnStop )
1908
Hari Krishnac195f3b2015-07-08 20:02:24 -07001909 def CASE82( self, main ):
1910 """
1911 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1912 """
1913 import random
You Wangb6586542016-02-26 09:25:56 -08001914 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001915
Hari Krishnac195f3b2015-07-08 20:02:24 -07001916 main.log.report(
1917 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1918 main.log.report(
1919 "__________________________________________________________________" )
1920 main.case(
1921 "Host intents - Bring the core links up that are down and verify ping all" )
1922 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001923
Hari Krishnac195f3b2015-07-08 20:02:24 -07001924 for switch in main.randomLinks:
1925 main.Mininet1.link(
1926 END1=switch[0],
1927 END2=switch[1],
1928 OPTION="up")
You Wangb6586542016-02-26 09:25:56 -08001929 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001930
You Wang0779bac2016-01-27 16:32:33 -08001931 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001932 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1933 utilities.assert_equals( expect=main.TRUE,
1934 actual=linkUp,
1935 onpass="Link up discovered properly",
1936 onfail="Link up was not discovered in " +
1937 str( main.linkSleep * main.linkCheck ) +
1938 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001939
GlennRCfcfdc4f2015-09-30 16:01:57 -07001940 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08001941 intentState = main.CHOtestFunctions.checkIntents()
1942 utilities.assert_equals( expect=main.TRUE,
1943 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001944 onpass="INTENTS INSTALLED",
1945 onfail="SOME INTENTS NOT INSTALLED" )
1946
Hari Krishnac195f3b2015-07-08 20:02:24 -07001947 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001948 pingResult = main.CHOtestFunctions.checkPingall()
1949 utilities.assert_equals( expect=main.TRUE,
1950 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001951 onpass="PING ALL PASS",
1952 onfail="PING ALL FAIL" )
1953
GlennRCbddd58f2015-10-01 15:45:25 -07001954 caseResult = linkUp and pingResult
1955 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001956 onpass="Link Up Test PASS",
1957 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001958 # Printing what exactly failed
1959 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001960 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001961 if not pingResult:
1962 main.log.debug( "Pingall failed" )
1963 if not intentState:
1964 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001965
GlennRCbddd58f2015-10-01 15:45:25 -07001966 if not caseResult and main.failSwitch:
1967 main.log.report("Stopping test")
1968 main.stop( email=main.emailOnStop )
1969
Hari Krishnac195f3b2015-07-08 20:02:24 -07001970 def CASE73( self, main ):
1971 """
1972 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1973 """
1974 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001975 import itertools
You Wangb6586542016-02-26 09:25:56 -08001976 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001977
Hari Krishnac195f3b2015-07-08 20:02:24 -07001978 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1979 main.log.report( "___________________________________________________________________________" )
1980 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1981 switches = []
1982 switchesComb = []
1983 for i in range( main.numMNswitches ):
1984 switches.append('s%d'%(i+1))
1985 switchesLinksComb = list(itertools.combinations(switches,2))
1986 main.randomLinks = random.sample(switchesLinksComb, 5 )
1987 print main.randomLinks
1988 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001989
Hari Krishnac195f3b2015-07-08 20:02:24 -07001990 for switch in main.randomLinks:
1991 main.Mininet1.link(
1992 END1=switch[0],
1993 END2=switch[1],
1994 OPTION="down")
You Wangb6586542016-02-26 09:25:56 -08001995 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001996
You Wang0779bac2016-01-27 16:32:33 -08001997 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08001998 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1999 utilities.assert_equals( expect=main.TRUE,
2000 actual=linkDown,
2001 onpass="Link down discovered properly",
2002 onfail="Link down was not discovered in " +
2003 str( main.linkSleep * main.linkCheck ) +
2004 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002005
GlennRCfcfdc4f2015-09-30 16:01:57 -07002006 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002007 intentState = main.CHOtestFunctions.checkIntents()
2008 utilities.assert_equals( expect=main.TRUE,
2009 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002010 onpass="INTENTS INSTALLED",
2011 onfail="SOME INTENTS NOT INSTALLED" )
2012
Hari Krishnac195f3b2015-07-08 20:02:24 -07002013 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002014 pingResult = main.CHOtestFunctions.checkPingall()
2015 utilities.assert_equals( expect=main.TRUE,
2016 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002017 onpass="PING ALL PASS",
2018 onfail="PING ALL FAIL" )
2019
GlennRCbddd58f2015-10-01 15:45:25 -07002020 caseResult = linkDown and pingResult and intentState
2021 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002022 onpass="Random Link cut Test PASS",
2023 onfail="Random Link cut Test FAIL" )
2024
GlennRCfcfdc4f2015-09-30 16:01:57 -07002025 # Printing what exactly failed
2026 if not linkDown:
2027 main.log.debug( "Link down was not discovered correctly" )
2028 if not pingResult:
2029 main.log.debug( "Pingall failed" )
2030 if not intentState:
2031 main.log.debug( "Intents are not all installed" )
2032
GlennRCbddd58f2015-10-01 15:45:25 -07002033 if not caseResult and main.failSwitch:
2034 main.log.report("Stopping test")
2035 main.stop( email=main.emailOnStop )
2036
Hari Krishnac195f3b2015-07-08 20:02:24 -07002037 def CASE83( self, main ):
2038 """
2039 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2040 """
2041 import random
You Wangb6586542016-02-26 09:25:56 -08002042 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002043
Hari Krishnac195f3b2015-07-08 20:02:24 -07002044 main.log.report(
2045 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2046 main.log.report(
2047 "__________________________________________________________________" )
2048 main.case(
2049 "Point intents - Bring the core links up that are down and verify ping all" )
2050 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002051
Hari Krishnac195f3b2015-07-08 20:02:24 -07002052 for switch in main.randomLinks:
2053 main.Mininet1.link(
2054 END1=switch[0],
2055 END2=switch[1],
2056 OPTION="up")
You Wangb6586542016-02-26 09:25:56 -08002057 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002058
You Wang0779bac2016-01-27 16:32:33 -08002059 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002060 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2061 utilities.assert_equals( expect=main.TRUE,
2062 actual=linkUp,
2063 onpass="Link up discovered properly",
2064 onfail="Link up was not discovered in " +
2065 str( main.linkSleep * main.linkCheck ) +
2066 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002067
GlennRCfcfdc4f2015-09-30 16:01:57 -07002068 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002069 intentState = main.CHOtestFunctions.checkIntents()
2070 utilities.assert_equals( expect=main.TRUE,
2071 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002072 onpass="INTENTS INSTALLED",
2073 onfail="SOME INTENTS NOT INSTALLED" )
2074
Hari Krishnac195f3b2015-07-08 20:02:24 -07002075 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002076 pingResult = main.CHOtestFunctions.checkPingall()
2077 utilities.assert_equals( expect=main.TRUE,
2078 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002079 onpass="PING ALL PASS",
2080 onfail="PING ALL FAIL" )
2081
GlennRCbddd58f2015-10-01 15:45:25 -07002082 caseResult = linkUp and pingResult
2083 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002084 onpass="Link Up Test PASS",
2085 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002086 # Printing what exactly failed
2087 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002088 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002089 if not pingResult:
2090 main.log.debug( "Pingall failed" )
2091 if not intentState:
2092 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002093
GlennRCbddd58f2015-10-01 15:45:25 -07002094 if not caseResult and main.failSwitch:
2095 main.log.report("Stopping test")
2096 main.stop( email=main.emailOnStop )
2097
Hari Krishnac195f3b2015-07-08 20:02:24 -07002098 def CASE74( self, main ):
2099 """
2100 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2101 """
2102 import random
2103 main.randomLink1 = []
2104 main.randomLink2 = []
2105 main.randomLink3 = []
2106 main.randomLink4 = []
2107 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2108 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2109 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2110 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2111 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2112 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002113 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002114
Hari Krishnac195f3b2015-07-08 20:02:24 -07002115 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2116 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002117 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002118
2119 main.step( "Bring some core links down" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002120 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002121 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002122 linkIndex.remove(linkIndexS9)
2123 linkIndexS10 = random.sample(linkIndex,1)[0]
2124 main.randomLink1 = link1End2top[linkIndexS9]
2125 main.randomLink2 = link2End2top[linkIndexS10]
2126 main.randomLink3 = random.sample(link1End2bot,1)[0]
2127 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002128
2129 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002130 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2131 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2132 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002133 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002134 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002135 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002136
You Wangb6586542016-02-26 09:25:56 -08002137 main.step( "Verify link down is discoverd by onos" )
2138 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2139 utilities.assert_equals( expect=main.TRUE,
2140 actual=linkDown,
2141 onpass="Link down discovered properly",
2142 onfail="Link down was not discovered in " +
2143 str( main.linkSleep * main.linkCheck ) +
2144 " seconds" )
You Wang0779bac2016-01-27 16:32:33 -08002145
You Wangb6586542016-02-26 09:25:56 -08002146 main.step( "Verify intents are installed" )
2147 intentState = main.CHOtestFunctions.checkIntents()
2148 utilities.assert_equals( expect=main.TRUE,
2149 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002150 onpass="INTENTS INSTALLED",
2151 onfail="SOME INTENTS NOT INSTALLED" )
2152
Hari Krishnac195f3b2015-07-08 20:02:24 -07002153 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002154 pingResult = main.CHOtestFunctions.checkPingall()
2155 utilities.assert_equals( expect=main.TRUE,
2156 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002157 onpass="PING ALL PASS",
2158 onfail="PING ALL FAIL" )
2159
GlennRCbddd58f2015-10-01 15:45:25 -07002160 caseResult = linkDown and pingResult and intentState
2161 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002162 onpass="Random Link cut Test PASS",
2163 onfail="Random Link cut Test FAIL" )
2164
GlennRCfcfdc4f2015-09-30 16:01:57 -07002165 # Printing what exactly failed
2166 if not linkDown:
2167 main.log.debug( "Link down was not discovered correctly" )
2168 if not pingResult:
2169 main.log.debug( "Pingall failed" )
2170 if not intentState:
2171 main.log.debug( "Intents are not all installed" )
2172
GlennRCbddd58f2015-10-01 15:45:25 -07002173 if not caseResult and main.failSwitch:
2174 main.log.report("Stopping test")
2175 main.stop( email=main.emailOnStop )
2176
Hari Krishnac195f3b2015-07-08 20:02:24 -07002177 def CASE84( self, main ):
2178 """
2179 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2180 """
2181 import random
2182 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2183 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002184 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002185 main.log.report(
2186 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2187 main.log.report(
2188 "__________________________________________________________________" )
2189 main.case(
2190 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002191
You Wang0779bac2016-01-27 16:32:33 -08002192 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002193 # Work around for link state propagation delay. Added some sleep time.
2194 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2195 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002196 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002197 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002198 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002199 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002200
You Wang0779bac2016-01-27 16:32:33 -08002201 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002202 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2203 utilities.assert_equals( expect=main.TRUE,
2204 actual=linkUp,
2205 onpass="Link up discovered properly",
2206 onfail="Link up was not discovered in " +
2207 str( main.linkSleep * main.linkCheck ) +
2208 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002209
GlennRCfcfdc4f2015-09-30 16:01:57 -07002210 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002211 intentState = main.CHOtestFunctions.checkIntents()
2212 utilities.assert_equals( expect=main.TRUE,
2213 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002214 onpass="INTENTS INSTALLED",
2215 onfail="SOME INTENTS NOT INSTALLED" )
2216
Hari Krishnac195f3b2015-07-08 20:02:24 -07002217 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002218 pingResult = main.CHOtestFunctions.checkPingall()
2219 utilities.assert_equals( expect=main.TRUE,
2220 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002221 onpass="PING ALL PASS",
2222 onfail="PING ALL FAIL" )
2223
GlennRCbddd58f2015-10-01 15:45:25 -07002224 caseResult = linkUp and pingResult
2225 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002226 onpass="Link Up Test PASS",
2227 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002228 # Printing what exactly failed
2229 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002230 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002231 if not pingResult:
2232 main.log.debug( "Pingall failed" )
2233 if not intentState:
2234 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002235
GlennRCbddd58f2015-10-01 15:45:25 -07002236 if not caseResult and main.failSwitch:
2237 main.log.report("Stopping test")
2238 main.stop( email=main.emailOnStop )
2239
Hari Krishnab79d0822015-08-20 09:48:43 -07002240 def CASE75( self, main ):
2241 """
2242 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2243 """
2244 import random
2245 main.randomLink1 = []
2246 main.randomLink2 = []
2247 main.randomLink3 = []
2248 main.randomLink4 = []
2249 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2250 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2251 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2252 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2253 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2254 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002255 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002256
2257 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2258 main.log.report( "___________________________________________________________________________" )
2259 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002260
2261 main.step( "Bring some core links down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002262 linkIndex = range(4)
2263 linkIndexS9 = random.sample(linkIndex,1)[0]
2264 linkIndex.remove(linkIndexS9)
2265 linkIndexS10 = random.sample(linkIndex,1)[0]
2266 main.randomLink1 = link1End2top[linkIndexS9]
2267 main.randomLink2 = link2End2top[linkIndexS10]
2268 main.randomLink3 = random.sample(link1End2bot,1)[0]
2269 main.randomLink4 = random.sample(link2End2bot,1)[0]
2270
2271 # Work around for link state propagation delay. Added some sleep time.
2272 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2273 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2274 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002275 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002276 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002277 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002278
You Wang0779bac2016-01-27 16:32:33 -08002279 main.step("Verify link down is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002280 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2281 utilities.assert_equals( expect=main.TRUE,
2282 actual=linkDown,
2283 onpass="Link down discovered properly",
2284 onfail="Link down was not discovered in " +
2285 str( main.linkSleep * main.linkCheck ) +
2286 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002287
GlennRCfcfdc4f2015-09-30 16:01:57 -07002288 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002289 intentState = main.CHOtestFunctions.checkIntents()
2290 utilities.assert_equals( expect=main.TRUE,
2291 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002292 onpass="INTENTS INSTALLED",
2293 onfail="SOME INTENTS NOT INSTALLED" )
2294
Hari Krishnab79d0822015-08-20 09:48:43 -07002295 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002296 pingResult = main.CHOtestFunctions.checkPingall()
2297 utilities.assert_equals( expect=main.TRUE,
2298 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002299 onpass="PING ALL PASS",
2300 onfail="PING ALL FAIL" )
2301
GlennRCbddd58f2015-10-01 15:45:25 -07002302 caseResult = linkDown and pingResult and intentState
2303 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002304 onpass="Random Link cut Test PASS",
2305 onfail="Random Link cut Test FAIL" )
2306
GlennRCfcfdc4f2015-09-30 16:01:57 -07002307 # Printing what exactly failed
2308 if not linkDown:
2309 main.log.debug( "Link down was not discovered correctly" )
2310 if not pingResult:
2311 main.log.debug( "Pingall failed" )
2312 if not intentState:
2313 main.log.debug( "Intents are not all installed" )
2314
GlennRCbddd58f2015-10-01 15:45:25 -07002315 if not caseResult and main.failSwitch:
2316 main.log.report("Stopping test")
2317 main.stop( email=main.emailOnStop )
2318
Hari Krishnab79d0822015-08-20 09:48:43 -07002319 def CASE85( self, main ):
2320 """
2321 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2322 """
2323 import random
2324 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2325 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002326 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002327 main.log.report(
2328 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2329 main.log.report(
2330 "__________________________________________________________________" )
2331 main.case(
2332 "Point intents - Bring the core links up that are down and verify ping all" )
2333
You Wang0779bac2016-01-27 16:32:33 -08002334 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002335 # Work around for link state propagation delay. Added some sleep time.
2336 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2337 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2338 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002339 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002340 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002341 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002342
You Wang0779bac2016-01-27 16:32:33 -08002343 main.step("Verify link up is discoverd by onos")
You Wangb6586542016-02-26 09:25:56 -08002344 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2345 utilities.assert_equals( expect=main.TRUE,
2346 actual=linkUp,
2347 onpass="Link up discovered properly",
2348 onfail="Link up was not discovered in " +
2349 str( main.linkSleep * main.linkCheck ) +
2350 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002351
GlennRCfcfdc4f2015-09-30 16:01:57 -07002352 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002353 intentState = main.CHOtestFunctions.checkIntents()
2354 utilities.assert_equals( expect=main.TRUE,
2355 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002356 onpass="INTENTS INSTALLED",
2357 onfail="SOME INTENTS NOT INSTALLED" )
2358
Hari Krishnab79d0822015-08-20 09:48:43 -07002359 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002360 pingResult = main.CHOtestFunctions.checkPingall()
2361 utilities.assert_equals( expect=main.TRUE,
2362 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002363 onpass="PING ALL PASS",
2364 onfail="PING ALL FAIL" )
2365
GlennRCbddd58f2015-10-01 15:45:25 -07002366 caseResult = linkUp and pingResult
2367 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002368 onpass="Link Up Test PASS",
2369 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002370 # Printing what exactly failed
2371 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002372 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002373 if not pingResult:
2374 main.log.debug( "Pingall failed" )
2375 if not intentState:
2376 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002377
GlennRCbddd58f2015-10-01 15:45:25 -07002378 if not caseResult and main.failSwitch:
2379 main.log.report("Stopping test")
2380 main.stop( email=main.emailOnStop )
2381
Hari Krishna4223dbd2015-08-13 16:29:53 -07002382 def CASE170( self ):
2383 """
2384 IPv6 ping all with some core links down( Host Intents-Att Topo)
2385 """
2386 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2387 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002388 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002389
Hari Krishna4223dbd2015-08-13 16:29:53 -07002390 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002391 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2392 utilities.assert_equals( expect=main.TRUE,
2393 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002394 onpass="PING ALL PASS",
2395 onfail="PING ALL FAIL" )
2396
GlennRCbddd58f2015-10-01 15:45:25 -07002397 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002398 utilities.assert_equals(
2399 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002400 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002401 onpass="IPv6 Ping across 300 host intents test PASS",
2402 onfail="IPv6 Ping across 300 host intents test FAIL" )
2403
You Wangb6586542016-02-26 09:25:56 -08002404 if not caseResult and main.failSwitch:
2405 main.log.report("Stopping test")
2406 main.stop( email=main.emailOnStop )
2407
Hari Krishna4223dbd2015-08-13 16:29:53 -07002408 def CASE180( self ):
2409 """
2410 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2411 """
2412 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2413 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002414 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002415
Hari Krishna4223dbd2015-08-13 16:29:53 -07002416 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002417 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2418 utilities.assert_equals( expect=main.TRUE,
2419 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002420 onpass="PING ALL PASS",
2421 onfail="PING ALL FAIL" )
2422
GlennRCbddd58f2015-10-01 15:45:25 -07002423 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002424 utilities.assert_equals(
2425 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002426 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002427 onpass="IPv6 Ping across 300 host intents test PASS",
2428 onfail="IPv6 Ping across 300 host intents test FAIL" )
2429
You Wangb6586542016-02-26 09:25:56 -08002430 if not caseResult and main.failSwitch:
2431 main.log.report("Stopping test")
2432 main.stop( email=main.emailOnStop )
2433
Hari Krishna4223dbd2015-08-13 16:29:53 -07002434 def CASE171( self ):
2435 """
2436 IPv6 ping all with some core links down( Point Intents-Att Topo)
2437 """
2438 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2439 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002440 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002441
Hari Krishna4223dbd2015-08-13 16:29:53 -07002442 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002443 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2444 utilities.assert_equals( expect=main.TRUE,
2445 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002446 onpass="PING ALL PASS",
2447 onfail="PING ALL FAIL" )
2448
GlennRCbddd58f2015-10-01 15:45:25 -07002449 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002450 utilities.assert_equals(
2451 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002452 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002453 onpass="IPv6 Ping across 600 point intents test PASS",
2454 onfail="IPv6 Ping across 600 point intents test FAIL" )
2455
You Wangb6586542016-02-26 09:25:56 -08002456 if not caseResult and main.failSwitch:
2457 main.log.report("Stopping test")
2458 main.stop( email=main.emailOnStop )
2459
Hari Krishna4223dbd2015-08-13 16:29:53 -07002460 def CASE181( self ):
2461 """
2462 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2463 """
2464 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2465 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002466 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002467
Hari Krishna4223dbd2015-08-13 16:29:53 -07002468 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002469 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2470 utilities.assert_equals( expect=main.TRUE,
2471 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002472 onpass="PING ALL PASS",
2473 onfail="PING ALL FAIL" )
2474
GlennRCbddd58f2015-10-01 15:45:25 -07002475 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002476 utilities.assert_equals(
2477 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002478 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002479 onpass="IPv6 Ping across 600 Point intents test PASS",
2480 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2481
You Wangb6586542016-02-26 09:25:56 -08002482 if not caseResult and main.failSwitch:
2483 main.log.report("Stopping test")
2484 main.stop( email=main.emailOnStop )
2485
Hari Krishna4223dbd2015-08-13 16:29:53 -07002486 def CASE172( self ):
2487 """
2488 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2489 """
2490 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2491 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002492 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002493
Hari Krishna4223dbd2015-08-13 16:29:53 -07002494 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002495 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2496 utilities.assert_equals( expect=main.TRUE,
2497 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002498 onpass="PING ALL PASS",
2499 onfail="PING ALL FAIL" )
2500
GlennRCbddd58f2015-10-01 15:45:25 -07002501 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002502 utilities.assert_equals(
2503 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002504 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002505 onpass="IPv6 Ping across 300 host intents test PASS",
2506 onfail="IPv6 Ping across 300 host intents test FAIL" )
2507
2508 def CASE182( self ):
2509 """
2510 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2511 """
2512 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2513 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002514 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002515
Hari Krishna4223dbd2015-08-13 16:29:53 -07002516 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002517 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2518 utilities.assert_equals( expect=main.TRUE,
2519 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002520 onpass="PING ALL PASS",
2521 onfail="PING ALL FAIL" )
2522
GlennRCbddd58f2015-10-01 15:45:25 -07002523 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002524 utilities.assert_equals(
2525 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002526 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002527 onpass="IPv6 Ping across 300 host intents test PASS",
2528 onfail="IPv6 Ping across 300 host intents test FAIL" )
2529
You Wangb6586542016-02-26 09:25:56 -08002530 if not caseResult and main.failSwitch:
2531 main.log.report("Stopping test")
2532 main.stop( email=main.emailOnStop )
2533
Hari Krishna4223dbd2015-08-13 16:29:53 -07002534 def CASE173( self ):
2535 """
2536 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2537 """
2538 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2539 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002540 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002541
Hari Krishna4223dbd2015-08-13 16:29:53 -07002542 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002543 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2544 utilities.assert_equals( expect=main.TRUE,
2545 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002546 onpass="PING ALL PASS",
2547 onfail="PING ALL FAIL" )
2548
GlennRCbddd58f2015-10-01 15:45:25 -07002549 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002550 utilities.assert_equals(
2551 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002552 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002553 onpass="IPv6 Ping across 600 point intents test PASS",
2554 onfail="IPv6 Ping across 600 point intents test FAIL" )
2555
You Wangb6586542016-02-26 09:25:56 -08002556 if not caseResult and main.failSwitch:
2557 main.log.report("Stopping test")
2558 main.stop( email=main.emailOnStop )
2559
Hari Krishna4223dbd2015-08-13 16:29:53 -07002560 def CASE183( self ):
2561 """
2562 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2563 """
2564 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2565 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002566 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002567
Hari Krishna4223dbd2015-08-13 16:29:53 -07002568 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002569 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2570 utilities.assert_equals( expect=main.TRUE,
2571 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002572 onpass="PING ALL PASS",
2573 onfail="PING ALL FAIL" )
2574
GlennRCbddd58f2015-10-01 15:45:25 -07002575 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002576 utilities.assert_equals(
2577 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002578 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002579 onpass="IPv6 Ping across 600 Point intents test PASS",
2580 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2581
You Wangb6586542016-02-26 09:25:56 -08002582 if not caseResult and main.failSwitch:
2583 main.log.report("Stopping test")
2584 main.stop( email=main.emailOnStop )
2585
Hari Krishna4223dbd2015-08-13 16:29:53 -07002586 def CASE174( self ):
2587 """
2588 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2589 """
2590 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2591 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002592 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002593
Hari Krishna4223dbd2015-08-13 16:29:53 -07002594 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002595 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2596 utilities.assert_equals( expect=main.TRUE,
2597 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002598 onpass="PING ALL PASS",
2599 onfail="PING ALL FAIL" )
2600
GlennRCbddd58f2015-10-01 15:45:25 -07002601 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002602 utilities.assert_equals(
2603 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002604 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002605 onpass="IPv6 Ping across 2278 host intents test PASS",
2606 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2607
You Wangb6586542016-02-26 09:25:56 -08002608 if not caseResult and main.failSwitch:
2609 main.log.report("Stopping test")
2610 main.stop( email=main.emailOnStop )
2611
Hari Krishna4223dbd2015-08-13 16:29:53 -07002612 def CASE184( self ):
2613 """
2614 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2615 """
2616 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2617 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002618 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002619
Hari Krishna4223dbd2015-08-13 16:29:53 -07002620 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002621 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2622 utilities.assert_equals( expect=main.TRUE,
2623 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002624 onpass="PING ALL PASS",
2625 onfail="PING ALL FAIL" )
2626
GlennRCbddd58f2015-10-01 15:45:25 -07002627 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002628 utilities.assert_equals(
2629 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002630 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002631 onpass="IPv6 Ping across 2278 host intents test PASS",
2632 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2633
You Wangb6586542016-02-26 09:25:56 -08002634 if not caseResult and main.failSwitch:
2635 main.log.report("Stopping test")
2636 main.stop( email=main.emailOnStop )
2637
Hari Krishna4223dbd2015-08-13 16:29:53 -07002638 def CASE175( self ):
2639 """
2640 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2641 """
2642 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2643 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002644 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002645
Hari Krishna4223dbd2015-08-13 16:29:53 -07002646 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002647 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2648 utilities.assert_equals( expect=main.TRUE,
2649 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002650 onpass="PING ALL PASS",
2651 onfail="PING ALL FAIL" )
2652
GlennRCbddd58f2015-10-01 15:45:25 -07002653 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002654 utilities.assert_equals(
2655 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002656 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002657 onpass="IPv6 Ping across 4556 point intents test PASS",
2658 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2659
You Wangb6586542016-02-26 09:25:56 -08002660 if not caseResult and main.failSwitch:
2661 main.log.report("Stopping test")
2662 main.stop( email=main.emailOnStop )
2663
Hari Krishna4223dbd2015-08-13 16:29:53 -07002664 def CASE185( self ):
2665 """
2666 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
2667 """
2668 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2669 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002670 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002671
Hari Krishna4223dbd2015-08-13 16:29:53 -07002672 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002673 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2674 utilities.assert_equals( expect=main.TRUE,
2675 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002676 onpass="PING ALL PASS",
2677 onfail="PING ALL FAIL" )
2678
GlennRCbddd58f2015-10-01 15:45:25 -07002679 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002680 utilities.assert_equals(
2681 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002682 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002683 onpass="IPv6 Ping across 4556 Point intents test PASS",
2684 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2685
You Wangb6586542016-02-26 09:25:56 -08002686 if not caseResult and main.failSwitch:
2687 main.log.report("Stopping test")
2688 main.stop( email=main.emailOnStop )
2689
Hari Krishnac195f3b2015-07-08 20:02:24 -07002690 def CASE90( self ):
2691 """
2692 Install 600 point intents and verify ping all (Att Topology)
2693 """
2694 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2695 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002696 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002697
Hari Krishnac195f3b2015-07-08 20:02:24 -07002698 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002699 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002700 main.intentIds = list(intentIdList)
2701
GlennRCa8d786a2015-09-23 17:40:11 -07002702 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002703 intentState = main.CHOtestFunctions.checkIntents()
2704 utilities.assert_equals( expect=main.TRUE,
2705 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002706 onpass="INTENTS INSTALLED",
2707 onfail="SOME INTENTS NOT INSTALLED" )
2708
Hari Krishnac195f3b2015-07-08 20:02:24 -07002709 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002710 pingResult = main.CHOtestFunctions.checkPingall()
2711 utilities.assert_equals( expect=main.TRUE,
2712 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002713 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002714 onfail="PING ALL FAIL" )
2715
GlennRCbddd58f2015-10-01 15:45:25 -07002716 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002717 utilities.assert_equals(
2718 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002719 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002720 onpass="Install 600 point Intents and Ping All test PASS",
2721 onfail="Install 600 point Intents and Ping All test FAIL" )
2722
GlennRCbddd58f2015-10-01 15:45:25 -07002723 if not intentState:
2724 main.log.debug( "Intents failed to install completely" )
2725 if not pingResult:
2726 main.log.debug( "Pingall failed" )
2727
2728 if not caseResult and main.failSwitch:
2729 main.log.report("Stopping test")
2730 main.stop( email=main.emailOnStop )
2731
Hari Krishnac195f3b2015-07-08 20:02:24 -07002732 def CASE91( self ):
2733 """
2734 Install 600 point intents and verify ping all (Chordal Topology)
2735 """
2736 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2737 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002738 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002739
Hari Krishnac195f3b2015-07-08 20:02:24 -07002740 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002741 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002742 main.intentIds = list(intentIdList)
2743
GlennRCa8d786a2015-09-23 17:40:11 -07002744 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002745 intentState = main.CHOtestFunctions.checkIntents()
2746 utilities.assert_equals( expect=main.TRUE,
2747 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002748 onpass="INTENTS INSTALLED",
2749 onfail="SOME INTENTS NOT INSTALLED" )
2750
Hari Krishnac195f3b2015-07-08 20:02:24 -07002751 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002752 pingResult = main.CHOtestFunctions.checkPingall()
2753 utilities.assert_equals( expect=main.TRUE,
2754 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002755 onpass="PING ALL PASS",
2756 onfail="PING ALL FAIL" )
2757
GlennRCbddd58f2015-10-01 15:45:25 -07002758 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002759 utilities.assert_equals(
2760 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002761 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002762 onpass="Install 600 point Intents and Ping All test PASS",
2763 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002764
GlennRCbddd58f2015-10-01 15:45:25 -07002765 if not intentState:
2766 main.log.debug( "Intents failed to install completely" )
2767 if not pingResult:
2768 main.log.debug( "Pingall failed" )
2769
2770 if not caseResult and main.failSwitch:
2771 main.log.report("Stopping test")
2772 main.stop( email=main.emailOnStop )
2773
Hari Krishnac195f3b2015-07-08 20:02:24 -07002774 def CASE92( self ):
2775 """
2776 Install 4556 point intents and verify ping all (Spine Topology)
2777 """
2778 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2779 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002780 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002781
You Wangb6586542016-02-26 09:25:56 -08002782 main.step( "Add point Intents" )
2783 intentIdList = main.CHOtestFunctions.installPointIntents()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002784 main.intentIds = list(intentIdList)
2785
GlennRCa8d786a2015-09-23 17:40:11 -07002786 main.step("Verify intents are installed")
You Wangb6586542016-02-26 09:25:56 -08002787 intentState = main.CHOtestFunctions.checkIntents()
2788 utilities.assert_equals( expect=main.TRUE,
2789 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002790 onpass="INTENTS INSTALLED",
2791 onfail="SOME INTENTS NOT INSTALLED" )
2792
Hari Krishnac195f3b2015-07-08 20:02:24 -07002793 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002794 pingResult = main.CHOtestFunctions.checkPingall()
2795 utilities.assert_equals( expect=main.TRUE,
2796 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002797 onpass="PING ALL PASS",
2798 onfail="PING ALL FAIL" )
2799
GlennRCbddd58f2015-10-01 15:45:25 -07002800 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002801 utilities.assert_equals(
2802 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002803 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002804 onpass="Install 4556 point Intents and Ping All test PASS",
2805 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002806
GlennRCbddd58f2015-10-01 15:45:25 -07002807 if not intentState:
2808 main.log.debug( "Intents failed to install completely" )
2809 if not pingResult:
2810 main.log.debug( "Pingall failed" )
2811
2812 if not caseResult and main.failSwitch:
2813 main.log.report("Stopping test")
2814 main.stop( email=main.emailOnStop )
2815
Hari Krishnac195f3b2015-07-08 20:02:24 -07002816 def CASE93( self ):
2817 """
2818 Install multi-single point intents and verify Ping all works
2819 for att topology
2820 """
2821 import copy
2822 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002823 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002824 main.log.report( "Install multi-single point intents and verify Ping all" )
2825 main.log.report( "___________________________________________" )
2826 main.case( "Install multi-single point intents and Ping all" )
2827 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2828 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2829 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07002830 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002831 time1 = time.time()
2832 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2833 pool = []
2834 for cli in main.CLIs:
2835 egressDevice = deviceDPIDsCopy[i]
2836 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2837 ingressDeviceList.remove(egressDevice)
2838 if i >= len( deviceDPIDsCopy ):
2839 break
2840 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2841 threadID=main.threadID,
2842 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002843 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002844 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002845 t.start()
2846 i = i + 1
2847 main.threadID = main.threadID + 1
2848 for thread in pool:
2849 thread.join()
2850 intentIdList.append(thread.result)
2851 time2 = time.time()
2852 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07002853
GlennRCdb2c8422015-09-29 12:21:59 -07002854 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002855 # Giving onos multiple chances to install intents
2856 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002857 if i != 0:
2858 main.log.warn( "Verification failed. Retrying..." )
2859 main.log.info("Waiting for onos to install intents...")
2860 time.sleep( main.checkIntentsDelay )
2861
2862 intentState = main.TRUE
2863 for e in range(int(main.numCtrls)):
2864 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08002865 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
2866 if not IntentStateIndividual:
2867 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
2868 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002869 if intentState:
2870 break
You Wangb6586542016-02-26 09:25:56 -08002871 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002872 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08002873 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07002874
2875 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2876 onpass="INTENTS INSTALLED",
2877 onfail="SOME INTENTS NOT INSTALLED" )
2878
GlennRCfa69a2a2015-10-02 15:54:06 -07002879 main.step("Verify flows are all added")
2880
2881 for i in range( main.flowCheck ):
2882 if i != 0:
2883 main.log.warn( "verification failed. Retrying..." )
2884 main.log.info( "Waiting for onos to add flows..." )
2885 time.sleep( main.checkFlowsDelay )
2886
2887 flowState = main.TRUE
2888 for cli in main.CLIs:
2889 flowState = cli.checkFlowState()
2890 if not flowState:
2891 main.log.warn( "Not all flows added" )
2892 if flowState:
2893 break
2894 else:
2895 #Dumping summary
2896 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
2897
2898 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2899 onpass="FLOWS INSTALLED",
2900 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002901
Hari Krishnac195f3b2015-07-08 20:02:24 -07002902 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002903 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07002904 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002905 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2906 if not pingResult:
2907 main.log.warn("First pingall failed. Retrying...")
2908 time.sleep(main.pingSleep)
2909 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07002910
Hari Krishnac195f3b2015-07-08 20:02:24 -07002911 time2 = time.time()
2912 timeDiff = round( ( time2 - time1 ), 2 )
2913 main.log.report(
2914 "Time taken for Ping All: " +
2915 str( timeDiff ) +
2916 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002917
GlennRCbddd58f2015-10-01 15:45:25 -07002918 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002919 utilities.assert_equals(
2920 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002921 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002922 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2923 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002924
GlennRCfa69a2a2015-10-02 15:54:06 -07002925 if not intentState:
2926 main.log.debug( "Intents failed to install completely" )
2927 if not pingResult:
2928 main.log.debug( "Pingall failed" )
2929 if not checkFlowsState:
2930 main.log.debug( "Flows failed to add completely" )
2931
2932 if not caseResult and main.failSwitch:
2933 main.log.report("Stopping test")
2934 main.stop( email=main.emailOnStop )
2935
Hari Krishnac195f3b2015-07-08 20:02:24 -07002936 def CASE94( self ):
2937 """
2938 Install multi-single point intents and verify Ping all works
2939 for Chordal topology
2940 """
2941 import copy
2942 import time
2943 main.log.report( "Install multi-single point intents and verify Ping all" )
2944 main.log.report( "___________________________________________" )
2945 main.case( "Install multi-single point intents and Ping all" )
2946 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2947 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2948 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07002949 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002950 time1 = time.time()
2951 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2952 pool = []
2953 for cli in main.CLIs:
2954 egressDevice = deviceDPIDsCopy[i]
2955 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2956 ingressDeviceList.remove(egressDevice)
2957 if i >= len( deviceDPIDsCopy ):
2958 break
2959 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2960 threadID=main.threadID,
2961 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002962 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002963 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002964 t.start()
2965 i = i + 1
2966 main.threadID = main.threadID + 1
2967 for thread in pool:
2968 thread.join()
2969 intentIdList.append(thread.result)
2970 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002971 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07002972
2973 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002974 # Giving onos multiple chances to install intents
2975 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002976 if i != 0:
2977 main.log.warn( "Verification failed. Retrying..." )
2978 main.log.info("Waiting for onos to install intents...")
2979 time.sleep( main.checkIntentsDelay )
2980
2981 intentState = main.TRUE
2982 for e in range(int(main.numCtrls)):
2983 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08002984 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
2985 if not IntentStateIndividual:
2986 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
2987 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002988 if intentState:
2989 break
You Wangb6586542016-02-26 09:25:56 -08002990 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002991 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08002992 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07002993
GlennRCdb2c8422015-09-29 12:21:59 -07002994 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2995 onpass="INTENTS INSTALLED",
2996 onfail="SOME INTENTS NOT INSTALLED" )
2997
GlennRCfa69a2a2015-10-02 15:54:06 -07002998 main.step("Verify flows are all added")
2999
3000 for i in range( main.flowCheck ):
3001 if i != 0:
3002 main.log.warn( "verification failed. Retrying..." )
3003 main.log.info( "Waiting for onos to add flows..." )
3004 time.sleep( main.checkFlowsDelay )
3005
3006 flowState = main.TRUE
3007 for cli in main.CLIs:
3008 flowState = cli.checkFlowState()
3009 if not flowState:
3010 main.log.warn( "Not all flows added" )
3011 if flowState:
3012 break
3013 else:
3014 #Dumping summary
3015 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3016
3017 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3018 onpass="FLOWS INSTALLED",
3019 onfail="SOME FLOWS NOT ADDED" )
3020
Hari Krishnac195f3b2015-07-08 20:02:24 -07003021 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003022 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003023 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003024 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3025 if not pingResult:
3026 main.log.warn("First pingall failed. Retrying...")
3027 time.sleep(main.pingSleep)
3028 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003029
Hari Krishnac195f3b2015-07-08 20:02:24 -07003030 time2 = time.time()
3031 timeDiff = round( ( time2 - time1 ), 2 )
3032 main.log.report(
3033 "Time taken for Ping All: " +
3034 str( timeDiff ) +
3035 " seconds" )
3036
GlennRCfa69a2a2015-10-02 15:54:06 -07003037 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003038 utilities.assert_equals(
3039 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003040 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003041 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3042 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003043
GlennRCfa69a2a2015-10-02 15:54:06 -07003044 if not intentState:
3045 main.log.debug( "Intents failed to install completely" )
3046 if not pingResult:
3047 main.log.debug( "Pingall failed" )
3048 if not checkFlowsState:
3049 main.log.debug( "Flows failed to add completely" )
3050
3051 if not caseResult and main.failSwitch:
3052 main.log.report("Stopping test")
3053 main.stop( email=main.emailOnStop )
3054
3055 def CASE95( self ):
3056 """
3057 Install multi-single point intents and verify Ping all works
3058 for Spine topology
3059 """
3060 import copy
3061 import time
3062 main.log.report( "Install multi-single point intents and verify Ping all" )
3063 main.log.report( "___________________________________________" )
3064 main.case( "Install multi-single point intents and Ping all" )
3065 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3066 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3067 intentIdList = []
3068 main.log.info( "MACsDict" + str(main.MACsDict) )
3069 time1 = time.time()
3070 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3071 pool = []
3072 for cli in main.CLIs:
3073 egressDevice = deviceDPIDsCopy[i]
3074 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3075 ingressDeviceList.remove(egressDevice)
3076 if i >= len( deviceDPIDsCopy ):
3077 break
3078 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3079 threadID=main.threadID,
3080 name="addMultipointToSinglepointIntent",
3081 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3082 pool.append(t)
3083 t.start()
3084 i = i + 1
3085 main.threadID = main.threadID + 1
3086 for thread in pool:
3087 thread.join()
3088 intentIdList.append(thread.result)
3089 time2 = time.time()
3090 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3091
3092 main.step("Verify intents are installed")
GlennRCfa69a2a2015-10-02 15:54:06 -07003093 # Giving onos multiple chances to install intents
3094 for i in range( main.intentCheck ):
3095 if i != 0:
3096 main.log.warn( "Verification failed. Retrying..." )
3097 main.log.info("Waiting for onos to install intents...")
3098 time.sleep( main.checkIntentsDelay )
3099
3100 intentState = main.TRUE
3101 for e in range(int(main.numCtrls)):
3102 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003103 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3104 if not IntentStateIndividual:
3105 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3106 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003107 if intentState:
3108 break
You Wangb6586542016-02-26 09:25:56 -08003109 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003110 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003111 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003112
3113 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3114 onpass="INTENTS INSTALLED",
3115 onfail="SOME INTENTS NOT INSTALLED" )
3116
3117 main.step("Verify flows are all added")
3118
3119 for i in range( main.flowCheck ):
3120 if i != 0:
3121 main.log.warn( "verification failed. Retrying..." )
3122 main.log.info( "Waiting for onos to add flows..." )
3123 time.sleep( main.checkFlowsDelay )
3124
3125 flowState = main.TRUE
3126 for cli in main.CLIs:
3127 flowState = cli.checkFlowState()
3128 if not flowState:
3129 main.log.warn( "Not all flows added" )
3130 if flowState:
3131 break
3132 else:
3133 #Dumping summary
3134 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3135
3136 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3137 onpass="FLOWS INSTALLED",
3138 onfail="SOME FLOWS NOT ADDED" )
3139
3140 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003141 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003142 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003143 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3144 if not pingResult:
3145 main.log.warn("First pingall failed. Retrying...")
3146 time.sleep(main.pingSleep)
3147 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003148
3149 time2 = time.time()
3150 timeDiff = round( ( time2 - time1 ), 2 )
3151 main.log.report(
3152 "Time taken for Ping All: " +
3153 str( timeDiff ) +
3154 " seconds" )
3155
3156 caseResult = ( checkFlowsState and pingResult and intentState )
3157 utilities.assert_equals(
3158 expect=main.TRUE,
3159 actual=caseResult,
3160 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3161 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3162
3163 if not intentState:
3164 main.log.debug( "Intents failed to install completely" )
3165 if not pingResult:
3166 main.log.debug( "Pingall failed" )
3167 if not checkFlowsState:
3168 main.log.debug( "Flows failed to add completely" )
3169
3170 if not caseResult and main.failSwitch:
3171 main.log.report("Stopping test")
3172 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003173
3174 def CASE96( self ):
3175 """
3176 Install single-multi point intents and verify Ping all works
3177 for att topology
3178 """
3179 import copy
3180 main.log.report( "Install single-multi point intents and verify Ping all" )
3181 main.log.report( "___________________________________________" )
3182 main.case( "Install single-multi point intents and Ping all" )
3183 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3184 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3185 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003186 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003187 time1 = time.time()
3188 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3189 pool = []
3190 for cli in main.CLIs:
3191 ingressDevice = deviceDPIDsCopy[i]
3192 egressDeviceList = copy.copy(deviceDPIDsCopy)
3193 egressDeviceList.remove(ingressDevice)
3194 if i >= len( deviceDPIDsCopy ):
3195 break
3196 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3197 threadID=main.threadID,
3198 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003199 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003200 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003201 t.start()
3202 i = i + 1
3203 main.threadID = main.threadID + 1
3204 for thread in pool:
3205 thread.join()
3206 intentIdList.append(thread.result)
3207 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003208 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003209
3210 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003211 # Giving onos multiple chances to install intents
3212 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003213 if i != 0:
3214 main.log.warn( "Verification failed. Retrying..." )
3215 main.log.info("Waiting for onos to install intents...")
3216 time.sleep( main.checkIntentsDelay )
3217
3218 intentState = main.TRUE
3219 for e in range(int(main.numCtrls)):
3220 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003221 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3222 if not IntentStateIndividual:
3223 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3224 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003225 if intentState:
3226 break
You Wangb6586542016-02-26 09:25:56 -08003227 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003228 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003229 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003230
GlennRCdb2c8422015-09-29 12:21:59 -07003231 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3232 onpass="INTENTS INSTALLED",
3233 onfail="SOME INTENTS NOT INSTALLED" )
3234
GlennRCfa69a2a2015-10-02 15:54:06 -07003235 main.step("Verify flows are all added")
3236
3237 for i in range( main.flowCheck ):
3238 if i != 0:
3239 main.log.warn( "verification failed. Retrying..." )
3240 main.log.info( "Waiting for onos to add flows..." )
3241 time.sleep( main.checkFlowsDelay )
3242
3243 flowState = main.TRUE
3244 for cli in main.CLIs:
3245 flowState = cli.checkFlowState()
3246 if not flowState:
3247 main.log.warn( "Not all flows added" )
3248 if flowState:
3249 break
3250 else:
3251 #Dumping summary
3252 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3253
3254 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3255 onpass="FLOWS INSTALLED",
3256 onfail="SOME FLOWS NOT ADDED" )
3257
Hari Krishnac195f3b2015-07-08 20:02:24 -07003258 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003259 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003260 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003261 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3262 if not pingResult:
3263 main.log.warn("First pingall failed. Retrying...")
3264 time.sleep(main.pingSleep)
3265 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003266
Hari Krishnac195f3b2015-07-08 20:02:24 -07003267 time2 = time.time()
3268 timeDiff = round( ( time2 - time1 ), 2 )
3269 main.log.report(
3270 "Time taken for Ping All: " +
3271 str( timeDiff ) +
3272 " seconds" )
3273
GlennRCfa69a2a2015-10-02 15:54:06 -07003274 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003275 utilities.assert_equals(
3276 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003277 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003278 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3279 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3280
GlennRCfa69a2a2015-10-02 15:54:06 -07003281 if not intentState:
3282 main.log.debug( "Intents failed to install completely" )
3283 if not pingResult:
3284 main.log.debug( "Pingall failed" )
3285 if not checkFlowsState:
3286 main.log.debug( "Flows failed to add completely" )
3287
3288 if not caseResult and main.failSwitch:
3289 main.log.report("Stopping test")
3290 main.stop( email=main.emailOnStop )
3291
Hari Krishnac195f3b2015-07-08 20:02:24 -07003292 def CASE97( self ):
3293 """
3294 Install single-multi point intents and verify Ping all works
3295 for Chordal topology
3296 """
3297 import copy
3298 main.log.report( "Install single-multi point intents and verify Ping all" )
3299 main.log.report( "___________________________________________" )
3300 main.case( "Install single-multi point intents and Ping all" )
3301 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3302 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3303 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003304 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003305 time1 = time.time()
3306 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3307 pool = []
3308 for cli in main.CLIs:
3309 ingressDevice = deviceDPIDsCopy[i]
3310 egressDeviceList = copy.copy(deviceDPIDsCopy)
3311 egressDeviceList.remove(ingressDevice)
3312 if i >= len( deviceDPIDsCopy ):
3313 break
3314 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3315 threadID=main.threadID,
3316 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003317 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003318 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003319 t.start()
3320 i = i + 1
3321 main.threadID = main.threadID + 1
3322 for thread in pool:
3323 thread.join()
3324 intentIdList.append(thread.result)
3325 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003326 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003327
3328 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003329 # Giving onos multiple chances to install intents
3330 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003331 if i != 0:
3332 main.log.warn( "Verification failed. Retrying..." )
3333 main.log.info("Waiting for onos to install intents...")
3334 time.sleep( main.checkIntentsDelay )
3335
3336 intentState = main.TRUE
3337 for e in range(int(main.numCtrls)):
3338 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003339 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3340 if not IntentStateIndividual:
3341 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3342 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003343 if intentState:
3344 break
You Wangb6586542016-02-26 09:25:56 -08003345 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003346 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003347 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003348
GlennRCdb2c8422015-09-29 12:21:59 -07003349 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3350 onpass="INTENTS INSTALLED",
3351 onfail="SOME INTENTS NOT INSTALLED" )
3352
GlennRCfa69a2a2015-10-02 15:54:06 -07003353 main.step("Verify flows are all added")
3354
3355 for i in range( main.flowCheck ):
3356 if i != 0:
3357 main.log.warn( "verification failed. Retrying..." )
3358 main.log.info( "Waiting for onos to add flows..." )
3359 time.sleep( main.checkFlowsDelay )
3360
3361 flowState = main.TRUE
3362 for cli in main.CLIs:
3363 flowState = cli.checkFlowState()
3364 if not flowState:
3365 main.log.warn( "Not all flows added" )
3366 if flowState:
3367 break
3368 else:
3369 #Dumping summary
3370 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3371
3372 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3373 onpass="FLOWS INSTALLED",
3374 onfail="SOME FLOWS NOT ADDED" )
3375
Hari Krishnac195f3b2015-07-08 20:02:24 -07003376 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003377 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003378 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003379 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3380 if not pingResult:
3381 main.log.warn("First pingall failed. Retrying...")
3382 time.sleep(main.pingSleep)
3383 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003384
Hari Krishnac195f3b2015-07-08 20:02:24 -07003385 time2 = time.time()
3386 timeDiff = round( ( time2 - time1 ), 2 )
3387 main.log.report(
3388 "Time taken for Ping All: " +
3389 str( timeDiff ) +
3390 " seconds" )
3391
GlennRCfa69a2a2015-10-02 15:54:06 -07003392 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003393 utilities.assert_equals(
3394 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003395 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003396 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3397 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3398
GlennRCfa69a2a2015-10-02 15:54:06 -07003399 if not intentState:
3400 main.log.debug( "Intents failed to install completely" )
3401 if not pingResult:
3402 main.log.debug( "Pingall failed" )
3403 if not checkFlowsState:
3404 main.log.debug( "Flows failed to add completely" )
3405
3406 if not caseResult and main.failSwitch:
3407 main.log.report("Stopping test")
3408 main.stop( email=main.emailOnStop )
3409
Hari Krishnac195f3b2015-07-08 20:02:24 -07003410 def CASE98( self ):
3411 """
3412 Install single-multi point intents and verify Ping all works
3413 for Spine topology
3414 """
3415 import copy
3416 main.log.report( "Install single-multi point intents and verify Ping all" )
3417 main.log.report( "___________________________________________" )
3418 main.case( "Install single-multi point intents and Ping all" )
3419 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3420 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3421 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3422 intentIdList = []
3423 MACsDictCopy = {}
3424 for i in range( len( deviceDPIDsCopy ) ):
3425 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3426
GlennRCfa69a2a2015-10-02 15:54:06 -07003427 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3428 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003429 time1 = time.time()
3430 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3431 pool = []
3432 for cli in main.CLIs:
3433 if i >= len( deviceDPIDsCopy ):
3434 break
3435 ingressDevice = deviceDPIDsCopy[i]
3436 egressDeviceList = copy.copy(deviceDPIDsCopy)
3437 egressDeviceList.remove(ingressDevice)
3438 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3439 threadID=main.threadID,
3440 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003441 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003442 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003443 t.start()
3444 i = i + 1
3445 main.threadID = main.threadID + 1
3446 for thread in pool:
3447 thread.join()
3448 intentIdList.append(thread.result)
3449 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003450 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003451
3452 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003453 # Giving onos multiple chances to install intents
3454 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003455 if i != 0:
3456 main.log.warn( "Verification failed. Retrying..." )
3457 main.log.info("Waiting for onos to install intents...")
3458 time.sleep( main.checkIntentsDelay )
3459
3460 intentState = main.TRUE
3461 for e in range(int(main.numCtrls)):
3462 main.log.info( "Checking intents on CLI %s" % (e+1) )
You Wangb6586542016-02-26 09:25:56 -08003463 IntentStateIndividual = main.CLIs[e].checkIntentState( intentsId=intentIdList )
3464 if not IntentStateIndividual:
3465 main.log.warn( "Not all intents installed on ONOS%s" % (e+1) )
3466 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003467 if intentState:
3468 break
You Wangb6586542016-02-26 09:25:56 -08003469 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003470 #Dumping intent summary
You Wangb6586542016-02-26 09:25:56 -08003471 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07003472
GlennRCdb2c8422015-09-29 12:21:59 -07003473 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3474 onpass="INTENTS INSTALLED",
3475 onfail="SOME INTENTS NOT INSTALLED" )
3476
GlennRCfa69a2a2015-10-02 15:54:06 -07003477 main.step("Verify flows are all added")
3478
3479 for i in range( main.flowCheck ):
3480 if i != 0:
3481 main.log.warn( "verification failed. Retrying..." )
3482 main.log.info( "Waiting for onos to add flows..." )
3483 time.sleep( main.checkFlowsDelay )
3484
3485 flowState = main.TRUE
3486 for cli in main.CLIs:
3487 flowState = cli.checkFlowState()
3488 if not flowState:
3489 main.log.warn( "Not all flows added" )
3490 if flowState:
3491 break
3492 else:
3493 #Dumping summary
3494 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3495
3496 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3497 onpass="FLOWS INSTALLED",
3498 onfail="SOME FLOWS NOT ADDED" )
3499
Hari Krishnac195f3b2015-07-08 20:02:24 -07003500 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003501 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003502 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003503 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3504 if not pingResult:
3505 main.log.warn("First pingall failed. Retrying...")
3506 time.sleep(main.pingSleep)
3507 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003508
Hari Krishnac195f3b2015-07-08 20:02:24 -07003509 time2 = time.time()
3510 timeDiff = round( ( time2 - time1 ), 2 )
3511 main.log.report(
3512 "Time taken for Ping All: " +
3513 str( timeDiff ) +
3514 " seconds" )
3515
GlennRCfa69a2a2015-10-02 15:54:06 -07003516 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003517 utilities.assert_equals(
3518 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003519 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003520 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3521 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3522
GlennRCfa69a2a2015-10-02 15:54:06 -07003523 if not intentState:
3524 main.log.debug( "Intents failed to install completely" )
3525 if not pingResult:
3526 main.log.debug( "Pingall failed" )
3527 if not checkFlowsState:
3528 main.log.debug( "Flows failed to add completely" )
3529
3530 if not caseResult and main.failSwitch:
3531 main.log.report("Stopping test")
3532 main.stop( email=main.emailOnStop )
3533
Hari Krishna4223dbd2015-08-13 16:29:53 -07003534 def CASE190( self ):
3535 """
3536 Verify IPv6 ping across 600 Point intents (Att Topology)
3537 """
3538 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3539 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003540 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003541
Hari Krishna4223dbd2015-08-13 16:29:53 -07003542 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003543 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3544 utilities.assert_equals( expect=main.TRUE,
3545 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003546 onpass="PING ALL PASS",
3547 onfail="PING ALL FAIL" )
3548
GlennRCbddd58f2015-10-01 15:45:25 -07003549 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003550 utilities.assert_equals(
3551 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003552 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003553 onpass="IPv6 Ping across 600 Point intents test PASS",
3554 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3555
You Wangb6586542016-02-26 09:25:56 -08003556 if not caseResult and main.failSwitch:
3557 main.log.report("Stopping test")
3558 main.stop( email=main.emailOnStop )
3559
Hari Krishna4223dbd2015-08-13 16:29:53 -07003560 def CASE191( self ):
3561 """
3562 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3563 """
3564 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3565 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003566 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003567
Hari Krishna4223dbd2015-08-13 16:29:53 -07003568 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003569 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3570 utilities.assert_equals( expect=main.TRUE,
3571 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003572 onpass="PING ALL PASS",
3573 onfail="PING ALL FAIL" )
3574
GlennRCbddd58f2015-10-01 15:45:25 -07003575 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003576 utilities.assert_equals(
3577 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003578 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003579 onpass="IPv6 Ping across 600 Point intents test PASS",
3580 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3581
You Wangb6586542016-02-26 09:25:56 -08003582 if not caseResult and main.failSwitch:
3583 main.log.report("Stopping test")
3584 main.stop( email=main.emailOnStop )
3585
Hari Krishna4223dbd2015-08-13 16:29:53 -07003586 def CASE192( self ):
3587 """
3588 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3589 """
3590 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3591 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003592 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003593
Hari Krishna4223dbd2015-08-13 16:29:53 -07003594 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003595 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3596 utilities.assert_equals( expect=main.TRUE,
3597 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003598 onpass="PING ALL PASS",
3599 onfail="PING ALL FAIL" )
3600
GlennRCbddd58f2015-10-01 15:45:25 -07003601 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003602 utilities.assert_equals(
3603 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003604 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003605 onpass="IPv6 Ping across 4556 Point intents test PASS",
3606 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003607
You Wangb6586542016-02-26 09:25:56 -08003608 if not caseResult and main.failSwitch:
3609 main.log.report("Stopping test")
3610 main.stop( email=main.emailOnStop )
3611
Hari Krishnac195f3b2015-07-08 20:02:24 -07003612 def CASE10( self ):
3613 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003614 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003615 """
3616 Remove all Intents
3617 """
3618 main.log.report( "Remove all intents that were installed previously" )
3619 main.log.report( "______________________________________________" )
3620 main.log.info( "Remove all intents" )
3621 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003622 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003623 main.step( "Obtain the intent id's first" )
3624 intentsList = main.ONOScli1.getAllIntentIds()
3625 ansi_escape = re.compile( r'\x1b[^m]*m' )
3626 intentsList = ansi_escape.sub( '', intentsList )
3627 intentsList = intentsList.replace(
3628 " onos:intents | grep id=",
3629 "" ).replace(
3630 "id=",
3631 "" ).replace(
3632 "\r\r",
3633 "" )
3634 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003635 intentIdList = []
3636 step1Result = main.TRUE
3637 moreIntents = main.TRUE
3638 removeIntentCount = 0
3639 intentsCount = len(intentsList)
3640 main.log.info ( "Current number of intents: " + str(intentsCount) )
You Wangb6586542016-02-26 09:25:56 -08003641
3642 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003643 if ( len( intentsList ) > 1 ):
3644 results = main.TRUE
3645 main.log.info("Removing intent...")
3646 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003647 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003648 if removeIntentCount == 5:
3649 break
3650 removeIntentCount = removeIntentCount + 1
3651 intentsList1 = main.ONOScli1.getAllIntentIds()
3652 if len( intentsList1 ) == 0:
3653 break
3654 ansi_escape = re.compile( r'\x1b[^m]*m' )
3655 intentsList1 = ansi_escape.sub( '', intentsList1 )
3656 intentsList1 = intentsList1.replace(
3657 " onos:intents | grep id=",
3658 "" ).replace(
3659 " state=",
3660 "" ).replace(
3661 "\r\r",
3662 "" )
3663 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003664 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3665 print intentsList1
3666 intentIdList1 = []
3667 if ( len( intentsList1 ) > 0 ):
3668 moreIntents = main.TRUE
3669 for i in range( len( intentsList1 ) ):
3670 intentsTemp1 = intentsList1[ i ].split( ',' )
3671 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3672 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3673 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3674 time1 = time.time()
3675 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3676 pool = []
3677 for cli in main.CLIs:
3678 if i >= len( intentIdList1 ):
3679 break
3680 t = main.Thread( target=cli.removeIntent,
3681 threadID=main.threadID,
3682 name="removeIntent",
3683 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3684 pool.append(t)
3685 t.start()
3686 i = i + 1
3687 main.threadID = main.threadID + 1
3688 for thread in pool:
3689 thread.join()
3690 intentIdList.append(thread.result)
3691 #time.sleep(2)
3692 time2 = time.time()
3693 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003694 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003695 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003696 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003697 else:
3698 time.sleep(10)
3699 if len( main.ONOScli1.intents()):
3700 continue
3701 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003702 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003703 else:
3704 print "Removed %d intents" %(intentsCount)
3705 step1Result = main.TRUE
3706 else:
3707 print "No Intent IDs found in Intents list: ", intentsList
3708 step1Result = main.FALSE
3709
3710 print main.ONOScli1.intents()
You Wangb6586542016-02-26 09:25:56 -08003711
3712 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003713 caseResult = step1Result
3714 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003715 onpass="Intent removal test successful",
3716 onfail="Intent removal test failed" )
3717
3718 def CASE12( self, main ):
3719 """
3720 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3721 """
3722 import re
3723 import copy
3724 import time
3725
Hari Krishnac195f3b2015-07-08 20:02:24 -07003726 threadID = 0
3727
3728 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3729 main.log.report( "_____________________________________________________" )
3730 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3731 main.step( "Enable intent based Reactive forwarding" )
3732 installResult = main.FALSE
3733 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003734
Hari Krishnac195f3b2015-07-08 20:02:24 -07003735 pool = []
3736 time1 = time.time()
3737 for cli,feature in main.CLIs:
3738 t = main.Thread(target=cli,threadID=threadID,
3739 name="featureInstall",args=[feature])
3740 pool.append(t)
3741 t.start()
3742 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003743
Hari Krishnac195f3b2015-07-08 20:02:24 -07003744 results = []
3745 for thread in pool:
3746 thread.join()
3747 results.append(thread.result)
3748 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003749
Hari Krishnac195f3b2015-07-08 20:02:24 -07003750 if( all(result == main.TRUE for result in results) == False):
3751 main.log.info("Did not install onos-app-ifwd feature properly")
3752 #main.cleanup()
3753 #main.exit()
3754 else:
3755 main.log.info("Successful feature:install onos-app-ifwd")
3756 installResult = main.TRUE
3757 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003758
GlennRC6ac11b12015-10-21 17:41:28 -07003759 main.step( "Verify Ping across all hosts" )
3760 for i in range(main.numPings):
3761 time1 = time.time()
3762 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3763 if not pingResult:
3764 main.log.warn("First pingall failed. Retrying...")
3765 time.sleep(main.pingSleep)
3766 else: break
3767
Hari Krishnac195f3b2015-07-08 20:02:24 -07003768 time2 = time.time()
3769 timeDiff = round( ( time2 - time1 ), 2 )
3770 main.log.report(
3771 "Time taken for Ping All: " +
3772 str( timeDiff ) +
3773 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003774
GlennRC626ba132015-09-18 16:16:31 -07003775 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003776 main.log.report( "Pingall Test in Reactive mode successful" )
3777 else:
3778 main.log.report( "Pingall Test in Reactive mode failed" )
3779
3780 main.step( "Disable Intent based Reactive forwarding" )
3781 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003782
Hari Krishnac195f3b2015-07-08 20:02:24 -07003783 pool = []
3784 time1 = time.time()
3785 for cli,feature in main.CLIs:
3786 t = main.Thread(target=cli,threadID=threadID,
3787 name="featureUninstall",args=[feature])
3788 pool.append(t)
3789 t.start()
3790 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003791
Hari Krishnac195f3b2015-07-08 20:02:24 -07003792 results = []
3793 for thread in pool:
3794 thread.join()
3795 results.append(thread.result)
3796 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003797
Hari Krishnac195f3b2015-07-08 20:02:24 -07003798 if( all(result == main.TRUE for result in results) == False):
3799 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3800 uninstallResult = main.FALSE
3801 #main.cleanup()
3802 #main.exit()
3803 else:
3804 main.log.info("Successful feature:uninstall onos-app-ifwd")
3805 uninstallResult = main.TRUE
3806 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
3807
3808 # Waiting for reative flows to be cleared.
3809 time.sleep( 10 )
3810
GlennRCbddd58f2015-10-01 15:45:25 -07003811 caseResult = installResult and pingResult and uninstallResult
3812 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003813 onpass="Intent based Reactive forwarding Pingall test PASS",
3814 onfail="Intent based Reactive forwarding Pingall test FAIL" )