blob: 43e9b0a0294c5c8cab4776602e46fdc2ad717dae [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
27
28 global intentState
29 main.threadID = 0
GlennRCef344fc2015-12-11 17:56:57 -080030 main.pingTimeout = 600
Hari Krishnac195f3b2015-07-08 20:02:24 -070031 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070032 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
33 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070034 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070036 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070037 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070038 main.intentCheck = int( main.params['TEST']['intentChecks'] )
GlennRC289c1b62015-12-12 10:45:43 -080039 main.topoCheck = int( main.params['TEST']['topoChecks'] )
GlennRCf7be6632015-10-20 13:04:07 -070040 main.numPings = int( main.params['TEST']['numPings'] )
GlennRC6ac11b12015-10-21 17:41:28 -070041 main.pingSleep = int( main.params['timers']['pingSleep'] )
GlennRC289c1b62015-12-12 10:45:43 -080042 main.topoCheckDelay = int( main.params['timers']['topoCheckDelay'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070043 main.newTopo = ""
44 main.CLIs = []
GlennRC186b7362015-12-11 18:20:16 -080045 main.prefix = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -070046
GlennRC9e7465e2015-10-02 13:50:36 -070047 main.failSwitch = True if main.failSwitch == "on" else False
48 main.emailOnStop = True if main.emailOnStop == "on" else False
49
Hari Krishnac195f3b2015-07-08 20:02:24 -070050 for i in range( 1, int(main.numCtrls) + 1 ):
51 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070052
53 main.case( "Set up test environment" )
54 main.log.report( "Set up test environment" )
55 main.log.report( "_______________________" )
56
Hari Krishna6185fc12015-07-13 15:42:31 -070057 main.step( "Apply Cell environment for ONOS" )
58 if ( main.onoscell ):
59 cellName = main.onoscell
60 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070061 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
62 onpass="Test step PASS",
63 onfail="Test step FAIL" )
64 else:
65 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
66 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080067 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070068 main.exit()
69
Hari Krishnac195f3b2015-07-08 20:02:24 -070070 main.step( "Git checkout and pull " + git_branch )
71 if git_pull == 'on':
72 checkout_result = main.ONOSbench.gitCheckout( git_branch )
73 pull_result = main.ONOSbench.gitPull()
74 cp_result = ( checkout_result and pull_result )
75 else:
76 checkout_result = main.TRUE
77 pull_result = main.TRUE
78 main.log.info( "Skipped git checkout and pull" )
79 cp_result = ( checkout_result and pull_result )
80 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
81 onpass="Test step PASS",
82 onfail="Test step FAIL" )
83
84 main.step( "mvn clean & install" )
85 if git_pull == 'on':
86 mvn_result = main.ONOSbench.cleanInstall()
87 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
88 onpass="Test step PASS",
89 onfail="Test step FAIL" )
90 else:
91 mvn_result = main.TRUE
92 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
93
94 main.ONOSbench.getVersion( report=True )
95
Hari Krishnac195f3b2015-07-08 20:02:24 -070096 main.step( "Create ONOS package" )
97 packageResult = main.ONOSbench.onosPackage()
98 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
99 onpass="Test step PASS",
100 onfail="Test step FAIL" )
101
102 main.step( "Uninstall ONOS package on all Nodes" )
103 uninstallResult = main.TRUE
104 for i in range( int( main.numCtrls ) ):
105 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
106 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
107 utilities.assert_equals( expect=main.TRUE, actual=u_result,
108 onpass="Test step PASS",
109 onfail="Test step FAIL" )
110 uninstallResult = ( uninstallResult and u_result )
111
112 main.step( "Install ONOS package on all Nodes" )
113 installResult = main.TRUE
114 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700115 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700116 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
117 utilities.assert_equals( expect=main.TRUE, actual=i_result,
118 onpass="Test step PASS",
119 onfail="Test step FAIL" )
120 installResult = ( installResult and i_result )
121
122 main.step( "Verify ONOS nodes UP status" )
123 statusResult = main.TRUE
124 for i in range( int( main.numCtrls ) ):
125 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
126 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
127 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
128 onpass="Test step PASS",
129 onfail="Test step FAIL" )
130 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700131
Hari Krishnac195f3b2015-07-08 20:02:24 -0700132 main.step( "Start ONOS CLI on all nodes" )
133 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700134 main.log.step(" Start ONOS cli using thread ")
135 startCliResult = main.TRUE
136 pool = []
137 time1 = time.time()
138 for i in range( int( main.numCtrls) ):
139 t = main.Thread( target=main.CLIs[i].startOnosCli,
140 threadID=main.threadID,
141 name="startOnosCli",
142 args=[ main.onosIPs[i], karafTimeout ] )
143 pool.append(t)
144 t.start()
145 main.threadID = main.threadID + 1
146 for t in pool:
147 t.join()
148 startCliResult = startCliResult and t.result
149 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700150
Hari Krishnac195f3b2015-07-08 20:02:24 -0700151 if not startCliResult:
152 main.log.info("ONOS CLI did not start up properly")
153 main.cleanup()
154 main.exit()
155 else:
156 main.log.info("Successful CLI startup")
157 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700158
159 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
160 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
161 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
162 cfgResult = cfgResult1 and cfgResult2
163 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
164 onpass="ipv6NeighborDiscovery cfg is set to true",
165 onfail="Failed to cfg set ipv6NeighborDiscovery" )
166
167 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700168 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
169 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
170 onpass="Set up test environment PASS",
171 onfail="Set up test environment FAIL" )
172
173 def CASE20( self, main ):
174 """
175 This test script Loads a new Topology (Att) on CHO setup and balances all switches
176 """
177 import re
178 import time
179 import copy
180
181 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
182 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
183 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
184 main.pingTimeout = 300
185 main.log.report(
186 "Load Att topology and Balance all Mininet switches across controllers" )
187 main.log.report(
188 "________________________________________________________________________" )
189 main.case(
190 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700191
Hari Krishnac195f3b2015-07-08 20:02:24 -0700192 main.step( "Stop any previous Mininet network topology" )
193 cliResult = main.TRUE
194 if main.newTopo == main.params['TOPO3']['topo']:
195 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
196
197 main.step( "Start Mininet with Att topology" )
198 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700199 mininetDir = main.Mininet1.home + "/custom/"
200 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
201 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
202 topoPath = mininetDir + main.newTopo
203 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700204
Hari Krishnac195f3b2015-07-08 20:02:24 -0700205 main.step( "Assign switches to controllers" )
206 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
207 main.Mininet1.assignSwController(
208 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700209 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700210
211 switch_mastership = main.TRUE
212 for i in range( 1, ( main.numMNswitches + 1 ) ):
213 response = main.Mininet1.getSwController( "s" + str( i ) )
214 print( "Response is " + str( response ) )
215 if re.search( "tcp:" + main.onosIPs[0], response ):
216 switch_mastership = switch_mastership and main.TRUE
217 else:
218 switch_mastership = main.FALSE
219
220 if switch_mastership == main.TRUE:
221 main.log.report( "Controller assignment successfull" )
222 else:
223 main.log.report( "Controller assignment failed" )
224
225 time.sleep(30) # waiting here to make sure topology converges across all nodes
226
227 main.step( "Balance devices across controllers" )
228 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700229 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700230 time.sleep( 5 )
231
232 topology_output = main.ONOScli1.topology()
233 topology_result = main.ONOSbench.getTopology( topology_output )
234 case2Result = ( switch_mastership and startStatus )
235 utilities.assert_equals(
236 expect=main.TRUE,
237 actual=case2Result,
238 onpass="Starting new Att topology test PASS",
239 onfail="Starting new Att topology test FAIL" )
240
241 def CASE21( self, main ):
242 """
243 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
244 """
245 import re
246 import time
247 import copy
248
GlennRC2db29952015-12-14 12:00:29 -0800249 main.prefix += 1
250
Hari Krishnac195f3b2015-07-08 20:02:24 -0700251 main.newTopo = main.params['TOPO2']['topo']
252 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
253 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
254 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
255 main.pingTimeout = 300
256 main.log.report(
257 "Load Chordal topology and Balance all Mininet switches across controllers" )
258 main.log.report(
259 "________________________________________________________________________" )
260 main.case(
261 "Assign and Balance all Mininet switches across controllers" )
262
263 main.step( "Stop any previous Mininet network topology" )
264 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
265
GlennRCc6cd2a62015-08-10 16:08:22 -0700266 main.step("Start Mininet with Chordal topology")
267 mininetDir = main.Mininet1.home + "/custom/"
268 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
269 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
270 topoPath = mininetDir + main.newTopo
271 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700272
273 main.step( "Assign switches to controllers" )
274
275 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
276 main.Mininet1.assignSwController(
277 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700278 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700279
280 switch_mastership = main.TRUE
281 for i in range( 1, ( main.numMNswitches + 1 ) ):
282 response = main.Mininet1.getSwController( "s" + str( i ) )
283 print( "Response is " + str( response ) )
284 if re.search( "tcp:" + main.onosIPs[0], response ):
285 switch_mastership = switch_mastership and main.TRUE
286 else:
287 switch_mastership = main.FALSE
288
289 if switch_mastership == main.TRUE:
290 main.log.report( "Controller assignment successfull" )
291 else:
292 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700293
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 main.step( "Balance devices across controllers" )
295 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700296 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297 time.sleep( 5 )
298
GlennRCbddd58f2015-10-01 15:45:25 -0700299 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300 time.sleep(30)
301 utilities.assert_equals(
302 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700303 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700304 onpass="Starting new Chordal topology test PASS",
305 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700306
Hari Krishnac195f3b2015-07-08 20:02:24 -0700307 def CASE22( self, main ):
308 """
309 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
310 """
311 import re
312 import time
313 import copy
314
GlennRC2db29952015-12-14 12:00:29 -0800315 main.prefix += 1
316
Hari Krishnac195f3b2015-07-08 20:02:24 -0700317 main.newTopo = main.params['TOPO3']['topo']
318 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
319 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
320 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
321 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700322
Hari Krishnac195f3b2015-07-08 20:02:24 -0700323 main.log.report(
324 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
325 main.log.report(
326 "________________________________________________________________________" )
327 main.case(
328 "Assign and Balance all Mininet switches across controllers" )
329 main.step( "Stop any previous Mininet network topology" )
330 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700331
332 main.step("Start Mininet with Spine topology")
333 mininetDir = main.Mininet1.home + "/custom/"
334 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
335 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
336 topoPath = mininetDir + main.newTopo
337 startStatus = main.Mininet1.startNet(topoFile = topoPath)
338
Hari Krishnac195f3b2015-07-08 20:02:24 -0700339 time.sleep(60)
340 main.step( "Assign switches to controllers" )
341
342 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
343 main.Mininet1.assignSwController(
344 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700345 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700346
347 switch_mastership = main.TRUE
348 for i in range( 1, ( main.numMNswitches + 1 ) ):
349 response = main.Mininet1.getSwController( "s" + str( i ) )
350 print( "Response is " + str( response ) )
351 if re.search( "tcp:" + main.onosIPs[0], response ):
352 switch_mastership = switch_mastership and main.TRUE
353 else:
354 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700355
Hari Krishnac195f3b2015-07-08 20:02:24 -0700356 if switch_mastership == main.TRUE:
357 main.log.report( "Controller assignment successfull" )
358 else:
359 main.log.report( "Controller assignment failed" )
360 time.sleep( 5 )
361
362 main.step( "Balance devices across controllers" )
363 for i in range( int( main.numCtrls ) ):
364 balanceResult = main.ONOScli1.balanceMasters()
365 # giving some breathing time for ONOS to complete re-balance
366 time.sleep( 3 )
367
GlennRCbddd58f2015-10-01 15:45:25 -0700368 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700369 time.sleep(60)
370 utilities.assert_equals(
371 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700372 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700373 onpass="Starting new Spine topology test PASS",
374 onfail="Starting new Spine topology test FAIL" )
375
376 def CASE3( self, main ):
377 """
378 This Test case will be extended to collect and store more data related
379 ONOS state.
380 """
381 import re
382 import copy
383 main.deviceDPIDs = []
384 main.hostMACs = []
385 main.deviceLinks = []
386 main.deviceActiveLinksCount = []
387 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700388
Hari Krishnac195f3b2015-07-08 20:02:24 -0700389 main.log.report(
390 "Collect and Store topology details from ONOS before running any Tests" )
391 main.log.report(
392 "____________________________________________________________________" )
393 main.case( "Collect and Store Topology Details from ONOS" )
394 main.step( "Collect and store current number of switches and links" )
395 topology_output = main.ONOScli1.topology()
396 topology_result = main.ONOSbench.getTopology( topology_output )
397 numOnosDevices = topology_result[ 'devices' ]
398 numOnosLinks = topology_result[ 'links' ]
399 topoResult = main.TRUE
400
GlennRCee8f3bf2015-12-14 16:18:39 -0800401 for check in range(main.topoCheck):
402 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
403 main.step( "Store Device DPIDs" )
404 for i in range( 1, (main.numMNswitches+1) ):
405 main.deviceDPIDs.append( "of:" + str(main.prefix) + "0000000000000%02d" % i )
406 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700407
GlennRCee8f3bf2015-12-14 16:18:39 -0800408 main.step( "Store Host MACs" )
409 for i in range( 1, ( main.numMNhosts + 1 ) ):
410 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
411 print "Host MACs in Store: \n", str( main.hostMACs )
412 main.MACsDict = {}
413 print "Creating dictionary of DPID and HostMacs"
414 for i in range(len(main.hostMACs)):
415 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
416 print main.MACsDict
417 main.step( "Collect and store all Devices Links" )
418 linksResult = main.ONOScli1.links( jsonFormat=False )
419 ansi_escape = re.compile( r'\x1b[^m]*m' )
420 linksResult = ansi_escape.sub( '', linksResult )
421 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
422 linksResult = linksResult.splitlines()
423 main.deviceLinks = copy.copy( linksResult )
424 print "Device Links Stored: \n", str( main.deviceLinks )
425 # this will be asserted to check with the params provided count of
426 # links
427 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700428
GlennRCee8f3bf2015-12-14 16:18:39 -0800429 main.step( "Collect and store each Device ports enabled Count" )
430 time1 = time.time()
431 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
432 pool = []
433 for cli in main.CLIs:
434 if i >= main.numMNswitches + 1:
435 break
436 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
437 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
438 t.start()
439 pool.append(t)
440 i = i + 1
441 main.threadID = main.threadID + 1
442 for thread in pool:
443 thread.join()
444 portResult = thread.result
445 main.devicePortsEnabledCount.append( portResult )
446 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
447 time2 = time.time()
448 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700449
GlennRCee8f3bf2015-12-14 16:18:39 -0800450 main.step( "Collect and store each Device active links Count" )
451 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700452
GlennRCee8f3bf2015-12-14 16:18:39 -0800453 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
454 pool = []
455 for cli in main.CLIs:
456 if i >= main.numMNswitches + 1:
457 break
458 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
459 t = main.Thread( target = cli.getDeviceLinksActiveCount,
460 threadID = main.threadID,
461 name = "getDevicePortsEnabledCount",
462 args = [dpid])
463 t.start()
464 pool.append(t)
465 i = i + 1
466 main.threadID = main.threadID + 1
467 for thread in pool:
468 thread.join()
469 linkCountResult = thread.result
470 main.deviceActiveLinksCount.append( linkCountResult )
471 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
472 time2 = time.time()
473 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700474
GlennRCee8f3bf2015-12-14 16:18:39 -0800475 # Exit out of the topo check loop
476 break
477
478 else:
479 main.log.info("Devices (expected): %s, Links (expected): %s" %
480 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
481 main.log.info("Devices (actual): %s, Links (actual): %s" %
482 ( numOnosDevices , numOnosLinks ) )
483 main.log.info("Topology does not match, trying again...")
484 topoResult = main.FALSE
485 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700486
487 # just returning TRUE for now as this one just collects data
488 case3Result = topoResult
489 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
490 onpass="Saving ONOS topology data test PASS",
491 onfail="Saving ONOS topology data test FAIL" )
492
GlennRC186b7362015-12-11 18:20:16 -0800493
Hari Krishnac195f3b2015-07-08 20:02:24 -0700494 def CASE40( self, main ):
495 """
496 Verify Reactive forwarding (Att Topology)
497 """
498 import re
499 import copy
500 import time
501 main.log.report( "Verify Reactive forwarding (Att Topology)" )
502 main.log.report( "______________________________________________" )
503 main.case( "Enable Reactive forwarding and Verify ping all" )
504 main.step( "Enable Reactive forwarding" )
505 installResult = main.TRUE
506 # Activate fwd app
507 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
508 appCheck = main.TRUE
509 pool = []
510 for cli in main.CLIs:
511 t = main.Thread( target=cli.appToIDCheck,
512 name="appToIDCheck-" + str( i ),
513 args=[] )
514 pool.append( t )
515 t.start()
516 for t in pool:
517 t.join()
518 appCheck = appCheck and t.result
519 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
520 onpass="App Ids seem to be correct",
521 onfail="Something is wrong with app Ids" )
522 if appCheck != main.TRUE:
523 main.log.warn( main.CLIs[0].apps() )
524 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700525
Hari Krishnac195f3b2015-07-08 20:02:24 -0700526 time.sleep( 10 )
527
GlennRC6ac11b12015-10-21 17:41:28 -0700528 main.step( "Verify Ping across all hosts" )
529 for i in range(main.numPings):
530 time1 = time.time()
531 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
532 if not pingResult:
533 main.log.warn("First pingall failed. Retrying...")
534 time.sleep(main.pingSleep)
535 else: break
536
Hari Krishnac195f3b2015-07-08 20:02:24 -0700537 time2 = time.time()
538 timeDiff = round( ( time2 - time1 ), 2 )
539 main.log.report(
540 "Time taken for Ping All: " +
541 str( timeDiff ) +
542 " seconds" )
543
GlennRC626ba132015-09-18 16:16:31 -0700544 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700545 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700546 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700547 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700548
GlennRCbddd58f2015-10-01 15:45:25 -0700549 caseResult = appCheck and pingResult
550 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700551 onpass="Reactive Mode IPv4 Pingall test PASS",
552 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700553
554 def CASE41( self, main ):
555 """
556 Verify Reactive forwarding (Chordal Topology)
557 """
558 import re
559 import copy
560 import time
561 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
562 main.log.report( "______________________________________________" )
563 main.case( "Enable Reactive forwarding and Verify ping all" )
564 main.step( "Enable Reactive forwarding" )
565 installResult = main.TRUE
566 # Activate fwd app
567 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
568
569 appCheck = main.TRUE
570 pool = []
571 for cli in main.CLIs:
572 t = main.Thread( target=cli.appToIDCheck,
573 name="appToIDCheck-" + str( i ),
574 args=[] )
575 pool.append( t )
576 t.start()
577 for t in pool:
578 t.join()
579 appCheck = appCheck and t.result
580 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
581 onpass="App Ids seem to be correct",
582 onfail="Something is wrong with app Ids" )
583 if appCheck != main.TRUE:
584 main.log.warn( main.CLIs[0].apps() )
585 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700586
Hari Krishnac195f3b2015-07-08 20:02:24 -0700587 time.sleep( 10 )
588
GlennRC6ac11b12015-10-21 17:41:28 -0700589 main.step( "Verify Ping across all hosts" )
590 for i in range(main.numPings):
591 time1 = time.time()
592 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
593 if not pingResult:
594 main.log.warn("First pingall failed. Retrying...")
595 time.sleep(main.pingSleep)
596 else: break
597
Hari Krishnac195f3b2015-07-08 20:02:24 -0700598 time2 = time.time()
599 timeDiff = round( ( time2 - time1 ), 2 )
600 main.log.report(
601 "Time taken for Ping All: " +
602 str( timeDiff ) +
603 " seconds" )
604
GlennRC626ba132015-09-18 16:16:31 -0700605 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700606 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700607 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700608 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700609
GlennRCbddd58f2015-10-01 15:45:25 -0700610 caseResult = appCheck and pingResult
611 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700612 onpass="Reactive Mode IPv4 Pingall test PASS",
613 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700614
615 def CASE42( self, main ):
616 """
617 Verify Reactive forwarding (Spine Topology)
618 """
619 import re
620 import copy
621 import time
622 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
623 main.log.report( "______________________________________________" )
624 main.case( "Enable Reactive forwarding and Verify ping all" )
625 main.step( "Enable Reactive forwarding" )
626 installResult = main.TRUE
627 # Activate fwd app
628 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
629
630 appCheck = main.TRUE
631 pool = []
632 for cli in main.CLIs:
633 t = main.Thread( target=cli.appToIDCheck,
634 name="appToIDCheck-" + str( i ),
635 args=[] )
636 pool.append( t )
637 t.start()
638 for t in pool:
639 t.join()
640 appCheck = appCheck and t.result
641 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
642 onpass="App Ids seem to be correct",
643 onfail="Something is wrong with app Ids" )
644 if appCheck != main.TRUE:
645 main.log.warn( main.CLIs[0].apps() )
646 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700647
Hari Krishnac195f3b2015-07-08 20:02:24 -0700648 time.sleep( 10 )
649
GlennRC6ac11b12015-10-21 17:41:28 -0700650 main.step( "Verify Ping across all hosts" )
651 for i in range(main.numPings):
652 time1 = time.time()
653 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
654 if not pingResult:
655 main.log.warn("First pingall failed. Retrying...")
656 time.sleep(main.pingSleep)
657 else: break
658
Hari Krishnac195f3b2015-07-08 20:02:24 -0700659 time2 = time.time()
660 timeDiff = round( ( time2 - time1 ), 2 )
661 main.log.report(
662 "Time taken for Ping All: " +
663 str( timeDiff ) +
664 " seconds" )
665
GlennRC626ba132015-09-18 16:16:31 -0700666 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700667 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700668 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700669 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
670
GlennRCbddd58f2015-10-01 15:45:25 -0700671 caseResult = appCheck and pingResult
672 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700673 onpass="Reactive Mode IPv4 Pingall test PASS",
674 onfail="Reactive Mode IPv4 Pingall test FAIL" )
675
676 def CASE140( self, main ):
677 """
678 Verify IPv6 Reactive forwarding (Att Topology)
679 """
680 import re
681 import copy
682 import time
683 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
684 main.log.report( "______________________________________________" )
685 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
686 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
687
688 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
689 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
690 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
691 cfgResult = cfgResult1 and cfgResult2
692 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
693 onpass="Reactive mode ipv6Fowarding cfg is set to true",
694 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
695
696 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700697 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700698 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700699 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
700 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700701 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700702 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700703 time2 = time.time()
704 timeDiff = round( ( time2 - time1 ), 2 )
705 main.log.report(
706 "Time taken for IPv6 Ping All: " +
707 str( timeDiff ) +
708 " seconds" )
709
GlennRC626ba132015-09-18 16:16:31 -0700710 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700711 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
712 else:
713 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700714
715 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700716
Hari Krishnac195f3b2015-07-08 20:02:24 -0700717 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700718 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700719 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
720 pool = []
721 for cli in main.CLIs:
722 t = main.Thread( target=cli.appToIDCheck,
723 name="appToIDCheck-" + str( i ),
724 args=[] )
725 pool.append( t )
726 t.start()
727
728 for t in pool:
729 t.join()
730 appCheck = appCheck and t.result
731 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
732 onpass="App Ids seem to be correct",
733 onfail="Something is wrong with app Ids" )
734 if appCheck != main.TRUE:
735 main.log.warn( main.CLIs[0].apps() )
736 main.log.warn( main.CLIs[0].appIDs() )
737
738 # Waiting for reative flows to be cleared.
739 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700740 caseResult = appCheck and cfgResult and pingResult
741 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700742 onpass="Reactive Mode IPv6 Pingall test PASS",
743 onfail="Reactive Mode IPv6 Pingall test FAIL" )
744
745 def CASE141( self, main ):
746 """
747 Verify IPv6 Reactive forwarding (Chordal Topology)
748 """
749 import re
750 import copy
751 import time
752 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
753 main.log.report( "______________________________________________" )
754 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
755 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
756
757 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
758 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
759 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
760 cfgResult = cfgResult1 and cfgResult2
761 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
762 onpass="Reactive mode ipv6Fowarding cfg is set to true",
763 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
764
765 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700766 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700767 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700768 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
769 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700770 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700771 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700772 time2 = time.time()
773 timeDiff = round( ( time2 - time1 ), 2 )
774 main.log.report(
775 "Time taken for IPv6 Ping All: " +
776 str( timeDiff ) +
777 " seconds" )
778
GlennRC626ba132015-09-18 16:16:31 -0700779 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700780 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
781 else:
782 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
783
784 main.step( "Disable Reactive forwarding" )
785
786 main.log.info( "Uninstall reactive forwarding app" )
787 appCheck = main.TRUE
788 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
789 pool = []
790 for cli in main.CLIs:
791 t = main.Thread( target=cli.appToIDCheck,
792 name="appToIDCheck-" + str( i ),
793 args=[] )
794 pool.append( t )
795 t.start()
796
797 for t in pool:
798 t.join()
799 appCheck = appCheck and t.result
800 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
801 onpass="App Ids seem to be correct",
802 onfail="Something is wrong with app Ids" )
803 if appCheck != main.TRUE:
804 main.log.warn( main.CLIs[0].apps() )
805 main.log.warn( main.CLIs[0].appIDs() )
806
807 # Waiting for reative flows to be cleared.
808 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700809 caseResult = appCheck and cfgResult and pingResult
810 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700811 onpass="Reactive Mode IPv6 Pingall test PASS",
812 onfail="Reactive Mode IPv6 Pingall test FAIL" )
813
814 def CASE142( self, main ):
815 """
816 Verify IPv6 Reactive forwarding (Spine Topology)
817 """
818 import re
819 import copy
820 import time
821 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
822 main.log.report( "______________________________________________" )
823 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
824 # Spine topology do not have hosts h1-h10
825 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
826 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
827 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
828 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
829 cfgResult = cfgResult1 and cfgResult2
830 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
831 onpass="Reactive mode ipv6Fowarding cfg is set to true",
832 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
833
834 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700835 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700836 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700837 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
838 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700839 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700840 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700841 time2 = time.time()
842 timeDiff = round( ( time2 - time1 ), 2 )
843 main.log.report(
844 "Time taken for IPv6 Ping All: " +
845 str( timeDiff ) +
846 " seconds" )
847
GlennRC626ba132015-09-18 16:16:31 -0700848 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700849 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
850 else:
851 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
852
853 main.step( "Disable Reactive forwarding" )
854
855 main.log.info( "Uninstall reactive forwarding app" )
856 appCheck = main.TRUE
857 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
858 pool = []
859 for cli in main.CLIs:
860 t = main.Thread( target=cli.appToIDCheck,
861 name="appToIDCheck-" + str( i ),
862 args=[] )
863 pool.append( t )
864 t.start()
865
866 for t in pool:
867 t.join()
868 appCheck = appCheck and t.result
869 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
870 onpass="App Ids seem to be correct",
871 onfail="Something is wrong with app Ids" )
872 if appCheck != main.TRUE:
873 main.log.warn( main.CLIs[0].apps() )
874 main.log.warn( main.CLIs[0].appIDs() )
875
876 # Waiting for reative flows to be cleared.
877 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700878 caseResult = appCheck and cfgResult and pingResult
879 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700880 onpass="Reactive Mode IPv6 Pingall test PASS",
881 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700882
883 def CASE5( self, main ):
884 """
885 Compare current ONOS topology with reference data
886 """
887 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700888
Hari Krishnac195f3b2015-07-08 20:02:24 -0700889 devicesDPIDTemp = []
890 hostMACsTemp = []
891 deviceLinksTemp = []
892 deviceActiveLinksCountTemp = []
893 devicePortsEnabledCountTemp = []
894
895 main.log.report(
896 "Compare ONOS topology with reference data in Stores" )
897 main.log.report( "__________________________________________________" )
898 main.case( "Compare ONOS topology with reference data" )
899
900 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700901
GlennRC289c1b62015-12-12 10:45:43 -0800902 for check in range(main.topoCheck):
903 time1 = time.time()
904 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
905 pool = []
906 for cli in main.CLIs:
907 if i >= main.numMNswitches + 1:
908 break
GlennRC2db29952015-12-14 12:00:29 -0800909 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800910 t = main.Thread(target = cli.getDevicePortsEnabledCount,
911 threadID = main.threadID,
912 name = "getDevicePortsEnabledCount",
913 args = [dpid])
914 t.start()
915 pool.append(t)
916 i = i + 1
917 main.threadID = main.threadID + 1
918 for thread in pool:
919 thread.join()
920 portResult = thread.result
921 #portTemp = re.split( r'\t+', portResult )
922 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
923 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -0700924
GlennRC289c1b62015-12-12 10:45:43 -0800925 time2 = time.time()
926 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
927 main.log.info (
928 "Device Enabled ports EXPECTED: %s" %
929 str( main.devicePortsEnabledCount ) )
930 main.log.info (
931 "Device Enabled ports ACTUAL: %s" %
932 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700933
GlennRC289c1b62015-12-12 10:45:43 -0800934 if ( cmp( main.devicePortsEnabledCount,
935 devicePortsEnabledCountTemp ) == 0 ):
936 stepResult1 = main.TRUE
937 else:
938 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700939
GlennRC289c1b62015-12-12 10:45:43 -0800940 main.step( "Compare Device active links with reference" )
941 time1 = time.time()
942 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
943 pool = []
944 for cli in main.CLIs:
945 if i >= main.numMNswitches + 1:
946 break
GlennRC2db29952015-12-14 12:00:29 -0800947 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800948 t = main.Thread(target = cli.getDeviceLinksActiveCount,
949 threadID = main.threadID,
950 name = "getDeviceLinksActiveCount",
951 args = [dpid])
952 t.start()
953 pool.append(t)
954 i = i + 1
955 main.threadID = main.threadID + 1
956 for thread in pool:
957 thread.join()
958 linkCountResult = thread.result
959 #linkCountTemp = re.split( r'\t+', linkCountResult )
960 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
961 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700962
GlennRC289c1b62015-12-12 10:45:43 -0800963 time2 = time.time()
964 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
965 main.log.info (
966 "Device Active links EXPECTED: %s" %
967 str( main.deviceActiveLinksCount ) )
968 main.log.info (
969 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
970 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
971 stepResult2 = main.TRUE
972 else:
973 stepResult2 = main.FALSE
974
975 """
976 place holder for comparing devices, hosts, paths and intents if required.
977 Links and ports data would be incorrect with out devices anyways.
978 """
979 caseResult = ( stepResult1 and stepResult2 )
980
981 if caseResult:
982 break
983 else:
984 time.sleep( main.topoCheckDelay )
985 main.log.warn( "Topology check failed. Trying again..." )
986
987
988 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700989 onpass="Compare Topology test PASS",
990 onfail="Compare Topology test FAIL" )
991
992 def CASE60( self ):
993 """
994 Install 300 host intents and verify ping all (Att Topology)
995 """
996 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
997 main.log.report( "_______________________________________" )
998 import itertools
999 import time
1000 main.case( "Install 300 host intents" )
1001 main.step( "Add host Intents" )
1002 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001003 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1004
Hari Krishnac195f3b2015-07-08 20:02:24 -07001005 intentIdList = []
1006 time1 = time.time()
1007 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1008 pool = []
1009 for cli in main.CLIs:
1010 if i >= len( hostCombos ):
1011 break
1012 t = main.Thread( target=cli.addHostIntent,
1013 threadID=main.threadID,
1014 name="addHostIntent",
1015 args=[hostCombos[i][0],hostCombos[i][1]])
1016 pool.append(t)
1017 t.start()
1018 i = i + 1
1019 main.threadID = main.threadID + 1
1020 for thread in pool:
1021 thread.join()
1022 intentIdList.append(thread.result)
1023 time2 = time.time()
1024 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1025
GlennRCfcfdc4f2015-09-30 16:01:57 -07001026 # Saving intent ids to check intents in later cases
1027 main.intentIds = list(intentIdList)
1028
GlennRCa8d786a2015-09-23 17:40:11 -07001029 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001030
GlennRC1dde1712015-10-02 11:03:08 -07001031 # Giving onos multiple chances to install intents
1032 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001033 if i != 0:
1034 main.log.warn( "Verification failed. Retrying..." )
1035 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001036 time.sleep( main.checkIntentsDelay )
1037
1038 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001039 for e in range(int(main.numCtrls)):
1040 main.log.info( "Checking intents on CLI %s" % (e+1) )
1041 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1042 intentState
1043 if not intentState:
1044 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001045 if intentState:
1046 break
GlennRCdb2c8422015-09-29 12:21:59 -07001047 else:
1048 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001049 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001050
GlennRCa8d786a2015-09-23 17:40:11 -07001051
1052 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1053 onpass="INTENTS INSTALLED",
1054 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001055
1056 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001057 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001058 time1 = time.time()
1059 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001060 if not pingResult:
1061 main.log.warn("First pingall failed. Retrying...")
1062 time.sleep(3)
1063 else: break
1064
Hari Krishnac195f3b2015-07-08 20:02:24 -07001065 time2 = time.time()
1066 timeDiff = round( ( time2 - time1 ), 2 )
1067 main.log.report(
1068 "Time taken for Ping All: " +
1069 str( timeDiff ) +
1070 " seconds" )
1071 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1072 onpass="PING ALL PASS",
1073 onfail="PING ALL FAIL" )
1074
GlennRCbddd58f2015-10-01 15:45:25 -07001075 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001076 utilities.assert_equals(
1077 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001078 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001079 onpass="Install 300 Host Intents and Ping All test PASS",
1080 onfail="Install 300 Host Intents and Ping All test FAIL" )
1081
GlennRCfcfdc4f2015-09-30 16:01:57 -07001082 if not intentState:
1083 main.log.debug( "Intents failed to install completely" )
1084 if not pingResult:
1085 main.log.debug( "Pingall failed" )
1086
GlennRCbddd58f2015-10-01 15:45:25 -07001087 if not caseResult and main.failSwitch:
1088 main.log.report("Stopping test")
1089 main.stop( email=main.emailOnStop )
1090
Hari Krishnac195f3b2015-07-08 20:02:24 -07001091 def CASE61( self ):
1092 """
1093 Install 600 host intents and verify ping all for Chordal Topology
1094 """
1095 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1096 main.log.report( "_______________________________________" )
1097 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001098
Hari Krishnac195f3b2015-07-08 20:02:24 -07001099 main.case( "Install 600 host intents" )
1100 main.step( "Add host Intents" )
1101 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001102 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1103
Hari Krishnac195f3b2015-07-08 20:02:24 -07001104 intentIdList = []
1105 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001106
Hari Krishnac195f3b2015-07-08 20:02:24 -07001107 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1108 pool = []
1109 for cli in main.CLIs:
1110 if i >= len( hostCombos ):
1111 break
1112 t = main.Thread( target=cli.addHostIntent,
1113 threadID=main.threadID,
1114 name="addHostIntent",
1115 args=[hostCombos[i][0],hostCombos[i][1]])
1116 pool.append(t)
1117 t.start()
1118 i = i + 1
1119 main.threadID = main.threadID + 1
1120 for thread in pool:
1121 thread.join()
1122 intentIdList.append(thread.result)
1123 time2 = time.time()
1124 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001125
GlennRCfcfdc4f2015-09-30 16:01:57 -07001126 # Saving intent ids to check intents in later cases
1127 main.intentIds = list(intentIdList)
1128
GlennRCa8d786a2015-09-23 17:40:11 -07001129 main.step("Verify intents are installed")
1130
GlennRC1dde1712015-10-02 11:03:08 -07001131 # Giving onos multiple chances to install intents
1132 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001133 if i != 0:
1134 main.log.warn( "Verification failed. Retrying..." )
1135 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001136 time.sleep( main.checkIntentsDelay )
1137
1138 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001139 for e in range(int(main.numCtrls)):
1140 main.log.info( "Checking intents on CLI %s" % (e+1) )
1141 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1142 intentState
1143 if not intentState:
1144 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001145 if intentState:
1146 break
GlennRCdb2c8422015-09-29 12:21:59 -07001147 else:
1148 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001149 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001150
1151 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1152 onpass="INTENTS INSTALLED",
1153 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001154
1155 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001156 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001157 time1 = time.time()
1158 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001159 if not pingResult:
1160 main.log.warn("First pingall failed. Retrying...")
1161 time.sleep(main.pingSleep)
1162 else: break
1163
Hari Krishnac195f3b2015-07-08 20:02:24 -07001164 time2 = time.time()
1165 timeDiff = round( ( time2 - time1 ), 2 )
1166 main.log.report(
1167 "Time taken for Ping All: " +
1168 str( timeDiff ) +
1169 " seconds" )
1170 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1171 onpass="PING ALL PASS",
1172 onfail="PING ALL FAIL" )
1173
GlennRCbddd58f2015-10-01 15:45:25 -07001174 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001175
Hari Krishnac195f3b2015-07-08 20:02:24 -07001176 utilities.assert_equals(
1177 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001178 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001179 onpass="Install 300 Host Intents and Ping All test PASS",
1180 onfail="Install 300 Host Intents and Ping All test FAIL" )
1181
GlennRCfcfdc4f2015-09-30 16:01:57 -07001182 if not intentState:
1183 main.log.debug( "Intents failed to install completely" )
1184 if not pingResult:
1185 main.log.debug( "Pingall failed" )
1186
GlennRCbddd58f2015-10-01 15:45:25 -07001187 if not caseResult and main.failSwitch:
1188 main.log.report("Stopping test")
1189 main.stop( email=main.emailOnStop )
1190
Hari Krishnac195f3b2015-07-08 20:02:24 -07001191 def CASE62( self ):
1192 """
1193 Install 2278 host intents and verify ping all for Spine Topology
1194 """
1195 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1196 main.log.report( "_______________________________________" )
1197 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001198
Hari Krishnac195f3b2015-07-08 20:02:24 -07001199 main.case( "Install 2278 host intents" )
1200 main.step( "Add host Intents" )
1201 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001202 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001203 main.pingTimeout = 300
1204 intentIdList = []
1205 time1 = time.time()
1206 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1207 pool = []
1208 for cli in main.CLIs:
1209 if i >= len( hostCombos ):
1210 break
1211 t = main.Thread( target=cli.addHostIntent,
1212 threadID=main.threadID,
1213 name="addHostIntent",
1214 args=[hostCombos[i][0],hostCombos[i][1]])
1215 pool.append(t)
1216 t.start()
1217 i = i + 1
1218 main.threadID = main.threadID + 1
1219 for thread in pool:
1220 thread.join()
1221 intentIdList.append(thread.result)
1222 time2 = time.time()
1223 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001224
GlennRCfcfdc4f2015-09-30 16:01:57 -07001225 # Saving intent ids to check intents in later cases
1226 main.intentIds = list(intentIdList)
1227
GlennRCa8d786a2015-09-23 17:40:11 -07001228 main.step("Verify intents are installed")
1229
GlennRC1dde1712015-10-02 11:03:08 -07001230 # Giving onos multiple chances to install intents
1231 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001232 if i != 0:
1233 main.log.warn( "Verification failed. Retrying..." )
1234 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001235 time.sleep( main.checkIntentsDelay )
1236
1237 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001238 for e in range(int(main.numCtrls)):
1239 main.log.info( "Checking intents on CLI %s" % (e+1) )
1240 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1241 intentState
1242 if not intentState:
1243 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001244 if intentState:
1245 break
GlennRCdb2c8422015-09-29 12:21:59 -07001246 else:
1247 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001248 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001249
1250 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1251 onpass="INTENTS INSTALLED",
1252 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001253
1254 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001255 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001256 time1 = time.time()
1257 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001258 if not pingResult:
1259 main.log.warn("First pingall failed. Retrying...")
1260 time.sleep(main.pingSleep)
1261 else: break
1262
Hari Krishnac195f3b2015-07-08 20:02:24 -07001263 time2 = time.time()
1264 timeDiff = round( ( time2 - time1 ), 2 )
1265 main.log.report(
1266 "Time taken for Ping All: " +
1267 str( timeDiff ) +
1268 " seconds" )
1269 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1270 onpass="PING ALL PASS",
1271 onfail="PING ALL FAIL" )
1272
GlennRCbddd58f2015-10-01 15:45:25 -07001273 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001274
Hari Krishnac195f3b2015-07-08 20:02:24 -07001275 utilities.assert_equals(
1276 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001277 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001278 onpass="Install 2278 Host Intents and Ping All test PASS",
1279 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1280
GlennRCfcfdc4f2015-09-30 16:01:57 -07001281 if not intentState:
1282 main.log.debug( "Intents failed to install completely" )
1283 if not pingResult:
1284 main.log.debug( "Pingall failed" )
1285
GlennRCbddd58f2015-10-01 15:45:25 -07001286 if not caseResult and main.failSwitch:
1287 main.log.report("Stopping test")
1288 main.stop( email=main.emailOnStop )
1289
Hari Krishna4223dbd2015-08-13 16:29:53 -07001290 def CASE160( self ):
1291 """
1292 Verify IPv6 ping across 300 host intents (Att Topology)
1293 """
1294 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1295 main.log.report( "_________________________________________________" )
1296 import itertools
1297 import time
1298 main.case( "IPv6 ping all 300 host intents" )
1299 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001300 pingResult = main.FALSE
1301 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001302 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001303 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001304 main.log.warn("First pingall failed. Retrying...")
1305 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001306 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001307 time2 = time.time()
1308 timeDiff = round( ( time2 - time1 ), 2 )
1309 main.log.report(
1310 "Time taken for IPv6 Ping All: " +
1311 str( timeDiff ) +
1312 " seconds" )
1313 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1314 onpass="PING ALL PASS",
1315 onfail="PING ALL FAIL" )
1316
GlennRCbddd58f2015-10-01 15:45:25 -07001317 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001318 utilities.assert_equals(
1319 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001320 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001321 onpass="IPv6 Ping across 300 host intents test PASS",
1322 onfail="IPv6 Ping across 300 host intents test FAIL" )
1323
1324 def CASE161( self ):
1325 """
1326 Verify IPv6 ping across 600 host intents (Chordal Topology)
1327 """
1328 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1329 main.log.report( "_________________________________________________" )
1330 import itertools
1331 import time
1332 main.case( "IPv6 ping all 600 host intents" )
1333 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001334 pingResult = main.FALSE
1335 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001336 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001337 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001338 main.log.warn("First pingall failed. Retrying...")
1339 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001340 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001341 time2 = time.time()
1342 timeDiff = round( ( time2 - time1 ), 2 )
1343 main.log.report(
1344 "Time taken for IPv6 Ping All: " +
1345 str( timeDiff ) +
1346 " seconds" )
1347 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1348 onpass="PING ALL PASS",
1349 onfail="PING ALL FAIL" )
1350
GlennRCbddd58f2015-10-01 15:45:25 -07001351 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001352 utilities.assert_equals(
1353 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001354 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001355 onpass="IPv6 Ping across 600 host intents test PASS",
1356 onfail="IPv6 Ping across 600 host intents test FAIL" )
1357
1358 def CASE162( self ):
1359 """
1360 Verify IPv6 ping across 2278 host intents (Spine Topology)
1361 """
1362 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1363 main.log.report( "_________________________________________________" )
1364 import itertools
1365 import time
1366 main.case( "IPv6 ping all 600 host intents" )
1367 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001368 pingResult = main.FALSE
1369 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001370 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001371 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001372 main.log.warn("First pingall failed. Retrying...")
1373 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001374 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001375 time2 = time.time()
1376 timeDiff = round( ( time2 - time1 ), 2 )
1377 main.log.report(
1378 "Time taken for IPv6 Ping All: " +
1379 str( timeDiff ) +
1380 " seconds" )
1381 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1382 onpass="PING ALL PASS",
1383 onfail="PING ALL FAIL" )
1384
GlennRCbddd58f2015-10-01 15:45:25 -07001385 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001386 utilities.assert_equals(
1387 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001388 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001389 onpass="IPv6 Ping across 600 host intents test PASS",
1390 onfail="IPv6 Ping across 600 host intents test FAIL" )
1391
Hari Krishnac195f3b2015-07-08 20:02:24 -07001392 def CASE70( self, main ):
1393 """
1394 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1395 """
1396 import random
1397 main.randomLink1 = []
1398 main.randomLink2 = []
1399 main.randomLink3 = []
1400 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1401 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1402 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1403 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1404 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1405 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1406 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1407 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1408
1409 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1410 main.log.report( "___________________________________________________________________________" )
1411 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1412 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1413 if ( int( switchLinksToToggle ) ==
1414 0 or int( switchLinksToToggle ) > 5 ):
1415 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1416 #main.cleanup()
1417 #main.exit()
1418 else:
1419 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1420
1421 main.step( "Cut links on Core devices using user provided range" )
1422 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1423 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1424 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1425 for i in range( int( switchLinksToToggle ) ):
1426 main.Mininet1.link(
1427 END1=link1End1,
1428 END2=main.randomLink1[ i ],
1429 OPTION="down" )
1430 time.sleep( link_sleep )
1431 main.Mininet1.link(
1432 END1=link2End1,
1433 END2=main.randomLink2[ i ],
1434 OPTION="down" )
1435 time.sleep( link_sleep )
1436 main.Mininet1.link(
1437 END1=link3End1,
1438 END2=main.randomLink3[ i ],
1439 OPTION="down" )
1440 time.sleep( link_sleep )
1441
Hari Krishna6185fc12015-07-13 15:42:31 -07001442 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001443 linkDown = main.ONOSbench.checkStatus(
1444 topology_output, main.numMNswitches, str(
1445 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1446 utilities.assert_equals(
1447 expect=main.TRUE,
1448 actual=linkDown,
1449 onpass="Link Down discovered properly",
1450 onfail="Link down was not discovered in " +
1451 str( link_sleep ) +
1452 " seconds" )
1453
GlennRCfcfdc4f2015-09-30 16:01:57 -07001454 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001455 # Giving onos multiple chances to install intents
1456 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001457 if i != 0:
1458 main.log.warn( "Verification failed. Retrying..." )
1459 main.log.info("Giving onos some time...")
1460 time.sleep( main.checkIntentsDelay )
1461
1462 intentState = main.TRUE
1463 for e in range(int(main.numCtrls)):
1464 main.log.info( "Checking intents on CLI %s" % (e+1) )
1465 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1466 intentState
1467 if not intentState:
1468 main.log.warn( "Not all intents installed" )
1469 if intentState:
1470 break
1471 else:
1472 #Dumping intent summary
1473 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1474
1475
1476 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1477 onpass="INTENTS INSTALLED",
1478 onfail="SOME INTENTS NOT INSTALLED" )
1479
Hari Krishnac195f3b2015-07-08 20:02:24 -07001480 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001481 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001482 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001483 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1484 if not pingResult:
1485 main.log.warn("First pingall failed. Retrying...")
1486 time.sleep(main.pingSleep)
1487 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001488
Hari Krishnac195f3b2015-07-08 20:02:24 -07001489 time2 = time.time()
1490 timeDiff = round( ( time2 - time1 ), 2 )
1491 main.log.report(
1492 "Time taken for Ping All: " +
1493 str( timeDiff ) +
1494 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001495 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001496 onpass="PING ALL PASS",
1497 onfail="PING ALL FAIL" )
1498
GlennRCbddd58f2015-10-01 15:45:25 -07001499 caseResult = linkDown and pingResult and intentState
1500 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001501 onpass="Random Link cut Test PASS",
1502 onfail="Random Link cut Test FAIL" )
1503
GlennRCfcfdc4f2015-09-30 16:01:57 -07001504 # Printing what exactly failed
1505 if not linkDown:
1506 main.log.debug( "Link down was not discovered correctly" )
1507 if not pingResult:
1508 main.log.debug( "Pingall failed" )
1509 if not intentState:
1510 main.log.debug( "Intents are not all installed" )
1511
GlennRCbddd58f2015-10-01 15:45:25 -07001512 if not caseResult and main.failSwitch:
1513 main.log.report("Stopping test")
1514 main.stop( email=main.emailOnStop )
1515
Hari Krishnac195f3b2015-07-08 20:02:24 -07001516 def CASE80( self, main ):
1517 """
1518 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1519 """
1520 import random
1521 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1522 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1523 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1524 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1525 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1526
1527 main.log.report(
1528 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1529 main.log.report(
1530 "__________________________________________________________________" )
1531 main.case(
1532 "Host intents - Bring the core links up that are down and verify ping all" )
1533 main.step( "Bring randomly cut links on Core devices up" )
1534 for i in range( int( switchLinksToToggle ) ):
1535 main.Mininet1.link(
1536 END1=link1End1,
1537 END2=main.randomLink1[ i ],
1538 OPTION="up" )
1539 time.sleep( link_sleep )
1540 main.Mininet1.link(
1541 END1=link2End1,
1542 END2=main.randomLink2[ i ],
1543 OPTION="up" )
1544 time.sleep( link_sleep )
1545 main.Mininet1.link(
1546 END1=link3End1,
1547 END2=main.randomLink3[ i ],
1548 OPTION="up" )
1549 time.sleep( link_sleep )
1550
Hari Krishna6185fc12015-07-13 15:42:31 -07001551 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001552 linkUp = main.ONOSbench.checkStatus(
1553 topology_output,
1554 main.numMNswitches,
1555 str( main.numMNlinks ) )
1556 utilities.assert_equals(
1557 expect=main.TRUE,
1558 actual=linkUp,
1559 onpass="Link up discovered properly",
1560 onfail="Link up was not discovered in " +
1561 str( link_sleep ) +
1562 " seconds" )
1563
GlennRCfcfdc4f2015-09-30 16:01:57 -07001564 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001565 # Giving onos multiple chances to install intents
1566 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001567 if i != 0:
1568 main.log.warn( "Verification failed. Retrying..." )
1569 main.log.info("Giving onos some time...")
1570 time.sleep( main.checkIntentsDelay )
1571
1572 intentState = main.TRUE
1573 for e in range(int(main.numCtrls)):
1574 main.log.info( "Checking intents on CLI %s" % (e+1) )
1575 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1576 intentState
1577 if not intentState:
1578 main.log.warn( "Not all intents installed" )
1579 if intentState:
1580 break
1581 else:
1582 #Dumping intent summary
1583 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1584
1585
1586 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1587 onpass="INTENTS INSTALLED",
1588 onfail="SOME INTENTS NOT INSTALLED" )
1589
Hari Krishnac195f3b2015-07-08 20:02:24 -07001590 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001591 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001592 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001593 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1594 if not pingResult:
1595 main.log.warn("First pingall failed. Retrying...")
1596 time.sleep(main.pingSleep)
1597 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001598
Hari Krishnac195f3b2015-07-08 20:02:24 -07001599 time2 = time.time()
1600 timeDiff = round( ( time2 - time1 ), 2 )
1601 main.log.report(
1602 "Time taken for Ping All: " +
1603 str( timeDiff ) +
1604 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001605 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001606 onpass="PING ALL PASS",
1607 onfail="PING ALL FAIL" )
1608
GlennRCbddd58f2015-10-01 15:45:25 -07001609 caseResult = linkUp and pingResult
1610 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001611 onpass="Link Up Test PASS",
1612 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001613 # Printing what exactly failed
1614 if not linkUp:
1615 main.log.debug( "Link down was not discovered correctly" )
1616 if not pingResult:
1617 main.log.debug( "Pingall failed" )
1618 if not intentState:
1619 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001620
GlennRCbddd58f2015-10-01 15:45:25 -07001621 if not caseResult and main.failSwitch:
1622 main.log.report("Stopping test")
1623 main.stop( email=main.emailOnStop )
1624
Hari Krishnac195f3b2015-07-08 20:02:24 -07001625 def CASE71( self, main ):
1626 """
1627 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1628 """
1629 import random
1630 main.randomLink1 = []
1631 main.randomLink2 = []
1632 main.randomLink3 = []
1633 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1634 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1635 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1636 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1637 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1638 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1639 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1640 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1641
1642 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1643 main.log.report( "___________________________________________________________________________" )
1644 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1645 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1646 if ( int( switchLinksToToggle ) ==
1647 0 or int( switchLinksToToggle ) > 5 ):
1648 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1649 #main.cleanup()
1650 #main.exit()
1651 else:
1652 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1653
1654 main.step( "Cut links on Core devices using user provided range" )
1655 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1656 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1657 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1658 for i in range( int( switchLinksToToggle ) ):
1659 main.Mininet1.link(
1660 END1=link1End1,
1661 END2=main.randomLink1[ i ],
1662 OPTION="down" )
1663 time.sleep( link_sleep )
1664 main.Mininet1.link(
1665 END1=link2End1,
1666 END2=main.randomLink2[ i ],
1667 OPTION="down" )
1668 time.sleep( link_sleep )
1669 main.Mininet1.link(
1670 END1=link3End1,
1671 END2=main.randomLink3[ i ],
1672 OPTION="down" )
1673 time.sleep( link_sleep )
1674
Hari Krishna6185fc12015-07-13 15:42:31 -07001675 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001676 linkDown = main.ONOSbench.checkStatus(
1677 topology_output, main.numMNswitches, str(
1678 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1679 utilities.assert_equals(
1680 expect=main.TRUE,
1681 actual=linkDown,
1682 onpass="Link Down discovered properly",
1683 onfail="Link down was not discovered in " +
1684 str( link_sleep ) +
1685 " seconds" )
1686
GlennRCfcfdc4f2015-09-30 16:01:57 -07001687 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001688 # Giving onos multiple chances to install intents
1689 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001690 if i != 0:
1691 main.log.warn( "Verification failed. Retrying..." )
1692 main.log.info("Giving onos some time...")
1693 time.sleep( main.checkIntentsDelay )
1694
1695 intentState = main.TRUE
1696 for e in range(int(main.numCtrls)):
1697 main.log.info( "Checking intents on CLI %s" % (e+1) )
1698 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1699 intentState
1700 if not intentState:
1701 main.log.warn( "Not all intents installed" )
1702 if intentState:
1703 break
1704 else:
1705 #Dumping intent summary
1706 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1707
1708
1709 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1710 onpass="INTENTS INSTALLED",
1711 onfail="SOME INTENTS NOT INSTALLED" )
1712
Hari Krishnac195f3b2015-07-08 20:02:24 -07001713 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001714 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001715 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001716 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1717 if not pingResult:
1718 main.log.warn("First pingall failed. Retrying...")
1719 time.sleep(main.pingSleep)
1720 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001721
Hari Krishnac195f3b2015-07-08 20:02:24 -07001722 time2 = time.time()
1723 timeDiff = round( ( time2 - time1 ), 2 )
1724 main.log.report(
1725 "Time taken for Ping All: " +
1726 str( timeDiff ) +
1727 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001728 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001729 onpass="PING ALL PASS",
1730 onfail="PING ALL FAIL" )
1731
GlennRCbddd58f2015-10-01 15:45:25 -07001732 caseResult = linkDown and pingResult and intentState
1733 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001734 onpass="Random Link cut Test PASS",
1735 onfail="Random Link cut Test FAIL" )
1736
GlennRCfcfdc4f2015-09-30 16:01:57 -07001737 # Printing what exactly failed
1738 if not linkDown:
1739 main.log.debug( "Link down was not discovered correctly" )
1740 if not pingResult:
1741 main.log.debug( "Pingall failed" )
1742 if not intentState:
1743 main.log.debug( "Intents are not all installed" )
1744
GlennRCbddd58f2015-10-01 15:45:25 -07001745 if not caseResult and main.failSwitch:
1746 main.log.report("Stopping test")
1747 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001748
Hari Krishnac195f3b2015-07-08 20:02:24 -07001749 def CASE81( self, main ):
1750 """
1751 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1752 """
1753 import random
1754 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1755 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1756 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1757 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1758 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1759
1760 main.log.report(
1761 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1762 main.log.report(
1763 "__________________________________________________________________" )
1764 main.case(
1765 "Point intents - Bring the core links up that are down and verify ping all" )
1766 main.step( "Bring randomly cut links on Core devices up" )
1767 for i in range( int( switchLinksToToggle ) ):
1768 main.Mininet1.link(
1769 END1=link1End1,
1770 END2=main.randomLink1[ i ],
1771 OPTION="up" )
1772 time.sleep( link_sleep )
1773 main.Mininet1.link(
1774 END1=link2End1,
1775 END2=main.randomLink2[ i ],
1776 OPTION="up" )
1777 time.sleep( link_sleep )
1778 main.Mininet1.link(
1779 END1=link3End1,
1780 END2=main.randomLink3[ i ],
1781 OPTION="up" )
1782 time.sleep( link_sleep )
1783
Hari Krishna6185fc12015-07-13 15:42:31 -07001784 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001785 linkUp = main.ONOSbench.checkStatus(
1786 topology_output,
1787 main.numMNswitches,
1788 str( main.numMNlinks ) )
1789 utilities.assert_equals(
1790 expect=main.TRUE,
1791 actual=linkUp,
1792 onpass="Link up discovered properly",
1793 onfail="Link up was not discovered in " +
1794 str( link_sleep ) +
1795 " seconds" )
1796
GlennRCfcfdc4f2015-09-30 16:01:57 -07001797 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001798 # Giving onos multiple chances to install intents
1799 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001800 if i != 0:
1801 main.log.warn( "Verification failed. Retrying..." )
1802 main.log.info("Giving onos some time...")
1803 time.sleep( main.checkIntentsDelay )
1804
1805 intentState = main.TRUE
1806 for e in range(int(main.numCtrls)):
1807 main.log.info( "Checking intents on CLI %s" % (e+1) )
1808 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1809 intentState
1810 if not intentState:
1811 main.log.warn( "Not all intents installed" )
1812 if intentState:
1813 break
1814 else:
1815 #Dumping intent summary
1816 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1817
1818
1819 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1820 onpass="INTENTS INSTALLED",
1821 onfail="SOME INTENTS NOT INSTALLED" )
1822
Hari Krishnac195f3b2015-07-08 20:02:24 -07001823 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001824 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001825 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001826 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1827 if not pingResult:
1828 main.log.warn("First pingall failed. Retrying...")
1829 time.sleep(main.pingSleep)
1830 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001831
Hari Krishnac195f3b2015-07-08 20:02:24 -07001832 time2 = time.time()
1833 timeDiff = round( ( time2 - time1 ), 2 )
1834 main.log.report(
1835 "Time taken for Ping All: " +
1836 str( timeDiff ) +
1837 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001838 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001839 onpass="PING ALL PASS",
1840 onfail="PING ALL FAIL" )
1841
GlennRCbddd58f2015-10-01 15:45:25 -07001842 caseResult = linkUp and pingResult
1843 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001844 onpass="Link Up Test PASS",
1845 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001846 # Printing what exactly failed
1847 if not linkUp:
1848 main.log.debug( "Link down was not discovered correctly" )
1849 if not pingResult:
1850 main.log.debug( "Pingall failed" )
1851 if not intentState:
1852 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001853
GlennRCbddd58f2015-10-01 15:45:25 -07001854 if not caseResult and main.failSwitch:
1855 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001856 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001857
Hari Krishnac195f3b2015-07-08 20:02:24 -07001858 def CASE72( self, main ):
1859 """
1860 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1861 """
1862 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001863 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001864 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001865
Hari Krishnac195f3b2015-07-08 20:02:24 -07001866 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1867 main.log.report( "___________________________________________________________________________" )
1868 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1869 switches = []
1870 switchesComb = []
1871 for i in range( main.numMNswitches ):
1872 switches.append('s%d'%(i+1))
1873 switchesLinksComb = list(itertools.combinations(switches,2))
1874 main.randomLinks = random.sample(switchesLinksComb, 5 )
1875 print main.randomLinks
1876 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001877
Hari Krishnac195f3b2015-07-08 20:02:24 -07001878 for switch in main.randomLinks:
1879 main.Mininet1.link(
1880 END1=switch[0],
1881 END2=switch[1],
1882 OPTION="down")
1883 time.sleep( link_sleep )
1884
Hari Krishna6185fc12015-07-13 15:42:31 -07001885 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001886 linkDown = main.ONOSbench.checkStatus(
1887 topology_output, main.numMNswitches, str(
1888 int( main.numMNlinks ) - 5 * 2 ) )
1889 utilities.assert_equals(
1890 expect=main.TRUE,
1891 actual=linkDown,
1892 onpass="Link Down discovered properly",
1893 onfail="Link down was not discovered in " +
1894 str( link_sleep ) +
1895 " seconds" )
1896
GlennRCfcfdc4f2015-09-30 16:01:57 -07001897 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001898 # Giving onos multiple chances to install intents
1899 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001900 if i != 0:
1901 main.log.warn( "Verification failed. Retrying..." )
1902 main.log.info("Giving onos some time...")
1903 time.sleep( main.checkIntentsDelay )
1904
1905 intentState = main.TRUE
1906 for e in range(int(main.numCtrls)):
1907 main.log.info( "Checking intents on CLI %s" % (e+1) )
1908 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1909 intentState
1910 if not intentState:
1911 main.log.warn( "Not all intents installed" )
1912 if intentState:
1913 break
1914 else:
1915 #Dumping intent summary
1916 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1917
1918
1919 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1920 onpass="INTENTS INSTALLED",
1921 onfail="SOME INTENTS NOT INSTALLED" )
1922
Hari Krishnac195f3b2015-07-08 20:02:24 -07001923 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001924 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001925 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001926 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1927 if not pingResult:
1928 main.log.warn("First pingall failed. Retrying...")
1929 time.sleep(main.pingSleep)
1930 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001931
Hari Krishnac195f3b2015-07-08 20:02:24 -07001932 time2 = time.time()
1933 timeDiff = round( ( time2 - time1 ), 2 )
1934 main.log.report(
1935 "Time taken for Ping All: " +
1936 str( timeDiff ) +
1937 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001938 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001939 onpass="PING ALL PASS",
1940 onfail="PING ALL FAIL" )
1941
GlennRCbddd58f2015-10-01 15:45:25 -07001942 caseResult = linkDown and pingResult and intentState
1943 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001944 onpass="Random Link cut Test PASS",
1945 onfail="Random Link cut Test FAIL" )
1946
GlennRCfcfdc4f2015-09-30 16:01:57 -07001947 # Printing what exactly failed
1948 if not linkDown:
1949 main.log.debug( "Link down was not discovered correctly" )
1950 if not pingResult:
1951 main.log.debug( "Pingall failed" )
1952 if not intentState:
1953 main.log.debug( "Intents are not all installed" )
1954
GlennRCbddd58f2015-10-01 15:45:25 -07001955 if not caseResult and main.failSwitch:
1956 main.log.report("Stopping test")
1957 main.stop( email=main.emailOnStop )
1958
Hari Krishnac195f3b2015-07-08 20:02:24 -07001959 def CASE82( self, main ):
1960 """
1961 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1962 """
1963 import random
1964 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001965
Hari Krishnac195f3b2015-07-08 20:02:24 -07001966 main.log.report(
1967 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1968 main.log.report(
1969 "__________________________________________________________________" )
1970 main.case(
1971 "Host intents - Bring the core links up that are down and verify ping all" )
1972 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001973
Hari Krishnac195f3b2015-07-08 20:02:24 -07001974 for switch in main.randomLinks:
1975 main.Mininet1.link(
1976 END1=switch[0],
1977 END2=switch[1],
1978 OPTION="up")
1979 time.sleep( link_sleep )
1980
Hari Krishna6185fc12015-07-13 15:42:31 -07001981 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001982 linkUp = main.ONOSbench.checkStatus(
1983 topology_output,
1984 main.numMNswitches,
1985 str( main.numMNlinks ) )
1986 utilities.assert_equals(
1987 expect=main.TRUE,
1988 actual=linkUp,
1989 onpass="Link up discovered properly",
1990 onfail="Link up was not discovered in " +
1991 str( link_sleep ) +
1992 " seconds" )
1993
GlennRCfcfdc4f2015-09-30 16:01:57 -07001994 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001995 # Giving onos multiple chances to install intents
1996 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001997 if i != 0:
1998 main.log.warn( "Verification failed. Retrying..." )
1999 main.log.info("Giving onos some time...")
2000 time.sleep( main.checkIntentsDelay )
2001
2002 intentState = main.TRUE
2003 for e in range(int(main.numCtrls)):
2004 main.log.info( "Checking intents on CLI %s" % (e+1) )
2005 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2006 intentState
2007 if not intentState:
2008 main.log.warn( "Not all intents installed" )
2009 if intentState:
2010 break
2011 else:
2012 #Dumping intent summary
2013 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2014
2015
2016 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2017 onpass="INTENTS INSTALLED",
2018 onfail="SOME INTENTS NOT INSTALLED" )
2019
Hari Krishnac195f3b2015-07-08 20:02:24 -07002020 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002021 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002022 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002023 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2024 if not pingResult:
2025 main.log.warn("First pingall failed. Retrying...")
2026 time.sleep(main.pingSleep)
2027 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002028
Hari Krishnac195f3b2015-07-08 20:02:24 -07002029 time2 = time.time()
2030 timeDiff = round( ( time2 - time1 ), 2 )
2031 main.log.report(
2032 "Time taken for Ping All: " +
2033 str( timeDiff ) +
2034 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002035 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002036 onpass="PING ALL PASS",
2037 onfail="PING ALL FAIL" )
2038
GlennRCbddd58f2015-10-01 15:45:25 -07002039 caseResult = linkUp and pingResult
2040 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002041 onpass="Link Up Test PASS",
2042 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002043 # Printing what exactly failed
2044 if not linkUp:
2045 main.log.debug( "Link down was not discovered correctly" )
2046 if not pingResult:
2047 main.log.debug( "Pingall failed" )
2048 if not intentState:
2049 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002050
GlennRCbddd58f2015-10-01 15:45:25 -07002051 if not caseResult and main.failSwitch:
2052 main.log.report("Stopping test")
2053 main.stop( email=main.emailOnStop )
2054
Hari Krishnac195f3b2015-07-08 20:02:24 -07002055 def CASE73( self, main ):
2056 """
2057 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2058 """
2059 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002060 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002061 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002062
Hari Krishnac195f3b2015-07-08 20:02:24 -07002063 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2064 main.log.report( "___________________________________________________________________________" )
2065 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2066 switches = []
2067 switchesComb = []
2068 for i in range( main.numMNswitches ):
2069 switches.append('s%d'%(i+1))
2070 switchesLinksComb = list(itertools.combinations(switches,2))
2071 main.randomLinks = random.sample(switchesLinksComb, 5 )
2072 print main.randomLinks
2073 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002074
Hari Krishnac195f3b2015-07-08 20:02:24 -07002075 for switch in main.randomLinks:
2076 main.Mininet1.link(
2077 END1=switch[0],
2078 END2=switch[1],
2079 OPTION="down")
2080 time.sleep( link_sleep )
2081
Hari Krishna6185fc12015-07-13 15:42:31 -07002082 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002083 linkDown = main.ONOSbench.checkStatus(
2084 topology_output, main.numMNswitches, str(
2085 int( main.numMNlinks ) - 5 * 2 ) )
2086 utilities.assert_equals(
2087 expect=main.TRUE,
2088 actual=linkDown,
2089 onpass="Link Down discovered properly",
2090 onfail="Link down was not discovered in " +
2091 str( link_sleep ) +
2092 " seconds" )
2093
GlennRCfcfdc4f2015-09-30 16:01:57 -07002094 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002095 # Giving onos multiple chances to install intents
2096 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002097 if i != 0:
2098 main.log.warn( "Verification failed. Retrying..." )
2099 main.log.info("Giving onos some time...")
2100 time.sleep( main.checkIntentsDelay )
2101
2102 intentState = main.TRUE
2103 for e in range(int(main.numCtrls)):
2104 main.log.info( "Checking intents on CLI %s" % (e+1) )
2105 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2106 intentState
2107 if not intentState:
2108 main.log.warn( "Not all intents installed" )
2109 if intentState:
2110 break
2111 else:
2112 #Dumping intent summary
2113 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2114
2115
2116 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2117 onpass="INTENTS INSTALLED",
2118 onfail="SOME INTENTS NOT INSTALLED" )
2119
Hari Krishnac195f3b2015-07-08 20:02:24 -07002120 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002121 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002122 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002123 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2124 if not pingResult:
2125 main.log.warn("First pingall failed. Retrying...")
2126 time.sleep(main.pingSleep)
2127 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002128
Hari Krishnac195f3b2015-07-08 20:02:24 -07002129 time2 = time.time()
2130 timeDiff = round( ( time2 - time1 ), 2 )
2131 main.log.report(
2132 "Time taken for Ping All: " +
2133 str( timeDiff ) +
2134 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002135 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002136 onpass="PING ALL PASS",
2137 onfail="PING ALL FAIL" )
2138
GlennRCbddd58f2015-10-01 15:45:25 -07002139 caseResult = linkDown and pingResult and intentState
2140 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002141 onpass="Random Link cut Test PASS",
2142 onfail="Random Link cut Test FAIL" )
2143
GlennRCfcfdc4f2015-09-30 16:01:57 -07002144 # Printing what exactly failed
2145 if not linkDown:
2146 main.log.debug( "Link down was not discovered correctly" )
2147 if not pingResult:
2148 main.log.debug( "Pingall failed" )
2149 if not intentState:
2150 main.log.debug( "Intents are not all installed" )
2151
GlennRCbddd58f2015-10-01 15:45:25 -07002152 if not caseResult and main.failSwitch:
2153 main.log.report("Stopping test")
2154 main.stop( email=main.emailOnStop )
2155
Hari Krishnac195f3b2015-07-08 20:02:24 -07002156 def CASE83( self, main ):
2157 """
2158 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2159 """
2160 import random
2161 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002162
Hari Krishnac195f3b2015-07-08 20:02:24 -07002163 main.log.report(
2164 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2165 main.log.report(
2166 "__________________________________________________________________" )
2167 main.case(
2168 "Point intents - Bring the core links up that are down and verify ping all" )
2169 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002170
Hari Krishnac195f3b2015-07-08 20:02:24 -07002171 for switch in main.randomLinks:
2172 main.Mininet1.link(
2173 END1=switch[0],
2174 END2=switch[1],
2175 OPTION="up")
2176 time.sleep( link_sleep )
2177
Hari Krishna6185fc12015-07-13 15:42:31 -07002178 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002179 linkUp = main.ONOSbench.checkStatus(
2180 topology_output,
2181 main.numMNswitches,
2182 str( main.numMNlinks ) )
2183 utilities.assert_equals(
2184 expect=main.TRUE,
2185 actual=linkUp,
2186 onpass="Link up discovered properly",
2187 onfail="Link up was not discovered in " +
2188 str( link_sleep ) +
2189 " seconds" )
2190
GlennRCfcfdc4f2015-09-30 16:01:57 -07002191 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002192 # Giving onos multiple chances to install intents
2193 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002194 if i != 0:
2195 main.log.warn( "Verification failed. Retrying..." )
2196 main.log.info("Giving onos some time...")
2197 time.sleep( main.checkIntentsDelay )
2198
2199 intentState = main.TRUE
2200 for e in range(int(main.numCtrls)):
2201 main.log.info( "Checking intents on CLI %s" % (e+1) )
2202 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2203 intentState
2204 if not intentState:
2205 main.log.warn( "Not all intents installed" )
2206 if intentState:
2207 break
2208 else:
2209 #Dumping intent summary
2210 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2211
2212
2213 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2214 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" )
GlennRC6ac11b12015-10-21 17:41:28 -07002218 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002219 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002220 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2221 if not pingResult:
2222 main.log.warn("First pingall failed. Retrying...")
2223 time.sleep(main.pingSleep)
2224 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002225
Hari Krishnac195f3b2015-07-08 20:02:24 -07002226 time2 = time.time()
2227 timeDiff = round( ( time2 - time1 ), 2 )
2228 main.log.report(
2229 "Time taken for Ping All: " +
2230 str( timeDiff ) +
2231 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002232 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002233 onpass="PING ALL PASS",
2234 onfail="PING ALL FAIL" )
2235
GlennRCbddd58f2015-10-01 15:45:25 -07002236 caseResult = linkUp and pingResult
2237 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002238 onpass="Link Up Test PASS",
2239 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002240 # Printing what exactly failed
2241 if not linkUp:
2242 main.log.debug( "Link down was not discovered correctly" )
2243 if not pingResult:
2244 main.log.debug( "Pingall failed" )
2245 if not intentState:
2246 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002247
GlennRCbddd58f2015-10-01 15:45:25 -07002248 if not caseResult and main.failSwitch:
2249 main.log.report("Stopping test")
2250 main.stop( email=main.emailOnStop )
2251
Hari Krishnac195f3b2015-07-08 20:02:24 -07002252 def CASE74( self, main ):
2253 """
2254 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2255 """
2256 import random
2257 main.randomLink1 = []
2258 main.randomLink2 = []
2259 main.randomLink3 = []
2260 main.randomLink4 = []
2261 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2262 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2263 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2264 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2265 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2266 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2267 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2268 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002269
Hari Krishnac195f3b2015-07-08 20:02:24 -07002270 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2271 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002272 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002273 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002274 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002275 linkIndex.remove(linkIndexS9)
2276 linkIndexS10 = random.sample(linkIndex,1)[0]
2277 main.randomLink1 = link1End2top[linkIndexS9]
2278 main.randomLink2 = link2End2top[linkIndexS10]
2279 main.randomLink3 = random.sample(link1End2bot,1)[0]
2280 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002281
2282 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002283 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2284 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2285 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2286 time.sleep( link_sleep )
2287 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2288 time.sleep( link_sleep )
2289
Hari Krishna6185fc12015-07-13 15:42:31 -07002290 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002291 linkDown = main.ONOSbench.checkStatus(
2292 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002293 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002294 utilities.assert_equals(
2295 expect=main.TRUE,
2296 actual=linkDown,
2297 onpass="Link Down discovered properly",
2298 onfail="Link down was not discovered in " +
2299 str( link_sleep ) +
2300 " seconds" )
2301
GlennRCfcfdc4f2015-09-30 16:01:57 -07002302 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002303 # Giving onos multiple chances to install intents
2304 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002305 if i != 0:
2306 main.log.warn( "Verification failed. Retrying..." )
2307 main.log.info("Giving onos some time...")
2308 time.sleep( main.checkIntentsDelay )
2309
2310 intentState = main.TRUE
2311 for e in range(int(main.numCtrls)):
2312 main.log.info( "Checking intents on CLI %s" % (e+1) )
2313 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2314 intentState
2315 if not intentState:
2316 main.log.warn( "Not all intents installed" )
2317 if intentState:
2318 break
2319 else:
2320 #Dumping intent summary
2321 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2322
2323
2324 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2325 onpass="INTENTS INSTALLED",
2326 onfail="SOME INTENTS NOT INSTALLED" )
2327
Hari Krishnac195f3b2015-07-08 20:02:24 -07002328 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002329 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002330 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002331 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2332 if not pingResult:
2333 main.log.warn("First pingall failed. Retrying...")
2334 time.sleep(main.pingSleep)
2335 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002336
Hari Krishnac195f3b2015-07-08 20:02:24 -07002337 time2 = time.time()
2338 timeDiff = round( ( time2 - time1 ), 2 )
2339 main.log.report(
2340 "Time taken for Ping All: " +
2341 str( timeDiff ) +
2342 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002343 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002344 onpass="PING ALL PASS",
2345 onfail="PING ALL FAIL" )
2346
GlennRCbddd58f2015-10-01 15:45:25 -07002347 caseResult = linkDown and pingResult and intentState
2348 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002349 onpass="Random Link cut Test PASS",
2350 onfail="Random Link cut Test FAIL" )
2351
GlennRCfcfdc4f2015-09-30 16:01:57 -07002352 # Printing what exactly failed
2353 if not linkDown:
2354 main.log.debug( "Link down was not discovered correctly" )
2355 if not pingResult:
2356 main.log.debug( "Pingall failed" )
2357 if not intentState:
2358 main.log.debug( "Intents are not all installed" )
2359
GlennRCbddd58f2015-10-01 15:45:25 -07002360 if not caseResult and main.failSwitch:
2361 main.log.report("Stopping test")
2362 main.stop( email=main.emailOnStop )
2363
Hari Krishnac195f3b2015-07-08 20:02:24 -07002364 def CASE84( self, main ):
2365 """
2366 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2367 """
2368 import random
2369 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2370 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2371 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2372 main.log.report(
2373 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2374 main.log.report(
2375 "__________________________________________________________________" )
2376 main.case(
2377 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002378
2379 # Work around for link state propagation delay. Added some sleep time.
2380 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2381 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002382 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2383 time.sleep( link_sleep )
2384 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2385 time.sleep( link_sleep )
2386
Hari Krishna6185fc12015-07-13 15:42:31 -07002387 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002388 linkUp = main.ONOSbench.checkStatus(
2389 topology_output,
2390 main.numMNswitches,
2391 str( main.numMNlinks ) )
2392 utilities.assert_equals(
2393 expect=main.TRUE,
2394 actual=linkUp,
2395 onpass="Link up discovered properly",
2396 onfail="Link up was not discovered in " +
2397 str( link_sleep ) +
2398 " seconds" )
2399
GlennRCfcfdc4f2015-09-30 16:01:57 -07002400 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002401 # Giving onos multiple chances to install intents
2402 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002403 if i != 0:
2404 main.log.warn( "Verification failed. Retrying..." )
2405 main.log.info("Giving onos some time...")
2406 time.sleep( main.checkIntentsDelay )
2407
2408 intentState = main.TRUE
2409 for e in range(int(main.numCtrls)):
2410 main.log.info( "Checking intents on CLI %s" % (e+1) )
2411 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2412 intentState
2413 if not intentState:
2414 main.log.warn( "Not all intents installed" )
2415 if intentState:
2416 break
2417 else:
2418 #Dumping intent summary
2419 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2420
2421
2422 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2423 onpass="INTENTS INSTALLED",
2424 onfail="SOME INTENTS NOT INSTALLED" )
2425
Hari Krishnac195f3b2015-07-08 20:02:24 -07002426 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002427 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002428 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002429 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2430 if not pingResult:
2431 main.log.warn("First pingall failed. Retrying...")
2432 time.sleep(main.pingSleep)
2433 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002434
Hari Krishnac195f3b2015-07-08 20:02:24 -07002435 time2 = time.time()
2436 timeDiff = round( ( time2 - time1 ), 2 )
2437 main.log.report(
2438 "Time taken for Ping All: " +
2439 str( timeDiff ) +
2440 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002441 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002442 onpass="PING ALL PASS",
2443 onfail="PING ALL FAIL" )
2444
GlennRCbddd58f2015-10-01 15:45:25 -07002445 caseResult = linkUp and pingResult
2446 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002447 onpass="Link Up Test PASS",
2448 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002449 # Printing what exactly failed
2450 if not linkUp:
2451 main.log.debug( "Link down was not discovered correctly" )
2452 if not pingResult:
2453 main.log.debug( "Pingall failed" )
2454 if not intentState:
2455 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002456
GlennRCbddd58f2015-10-01 15:45:25 -07002457 if not caseResult and main.failSwitch:
2458 main.log.report("Stopping test")
2459 main.stop( email=main.emailOnStop )
2460
Hari Krishnab79d0822015-08-20 09:48:43 -07002461 def CASE75( self, main ):
2462 """
2463 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2464 """
2465 import random
2466 main.randomLink1 = []
2467 main.randomLink2 = []
2468 main.randomLink3 = []
2469 main.randomLink4 = []
2470 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2471 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2472 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2473 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2474 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2475 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2476 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2477 main.pingTimeout = 400
2478
2479 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2480 main.log.report( "___________________________________________________________________________" )
2481 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2482 linkIndex = range(4)
2483 linkIndexS9 = random.sample(linkIndex,1)[0]
2484 linkIndex.remove(linkIndexS9)
2485 linkIndexS10 = random.sample(linkIndex,1)[0]
2486 main.randomLink1 = link1End2top[linkIndexS9]
2487 main.randomLink2 = link2End2top[linkIndexS10]
2488 main.randomLink3 = random.sample(link1End2bot,1)[0]
2489 main.randomLink4 = random.sample(link2End2bot,1)[0]
2490
2491 # Work around for link state propagation delay. Added some sleep time.
2492 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2493 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2494 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2495 time.sleep( link_sleep )
2496 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2497 time.sleep( link_sleep )
2498
2499 topology_output = main.ONOScli1.topology()
2500 linkDown = main.ONOSbench.checkStatus(
2501 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002502 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002503 utilities.assert_equals(
2504 expect=main.TRUE,
2505 actual=linkDown,
2506 onpass="Link Down discovered properly",
2507 onfail="Link down was not discovered in " +
2508 str( link_sleep ) +
2509 " seconds" )
2510
GlennRCfcfdc4f2015-09-30 16:01:57 -07002511 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002512 # Giving onos multiple chances to install intents
2513 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002514 if i != 0:
2515 main.log.warn( "Verification failed. Retrying..." )
2516 main.log.info("Giving onos some time...")
2517 time.sleep( main.checkIntentsDelay )
2518
2519 intentState = main.TRUE
2520 for e in range(int(main.numCtrls)):
2521 main.log.info( "Checking intents on CLI %s" % (e+1) )
2522 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2523 intentState
2524 if not intentState:
2525 main.log.warn( "Not all intents installed" )
2526 if intentState:
2527 break
2528 else:
2529 #Dumping intent summary
2530 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2531
2532
2533 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2534 onpass="INTENTS INSTALLED",
2535 onfail="SOME INTENTS NOT INSTALLED" )
2536
Hari Krishnab79d0822015-08-20 09:48:43 -07002537 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002538 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002539 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002540 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2541 if not pingResult:
2542 main.log.warn("First pingall failed. Retrying...")
2543 time.sleep(main.pingSleep)
2544 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002545
Hari Krishnab79d0822015-08-20 09:48:43 -07002546 time2 = time.time()
2547 timeDiff = round( ( time2 - time1 ), 2 )
2548 main.log.report(
2549 "Time taken for Ping All: " +
2550 str( timeDiff ) +
2551 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002552 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002553 onpass="PING ALL PASS",
2554 onfail="PING ALL FAIL" )
2555
GlennRCbddd58f2015-10-01 15:45:25 -07002556 caseResult = linkDown and pingResult and intentState
2557 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002558 onpass="Random Link cut Test PASS",
2559 onfail="Random Link cut Test FAIL" )
2560
GlennRCfcfdc4f2015-09-30 16:01:57 -07002561 # Printing what exactly failed
2562 if not linkDown:
2563 main.log.debug( "Link down was not discovered correctly" )
2564 if not pingResult:
2565 main.log.debug( "Pingall failed" )
2566 if not intentState:
2567 main.log.debug( "Intents are not all installed" )
2568
GlennRCbddd58f2015-10-01 15:45:25 -07002569 if not caseResult and main.failSwitch:
2570 main.log.report("Stopping test")
2571 main.stop( email=main.emailOnStop )
2572
Hari Krishnab79d0822015-08-20 09:48:43 -07002573 def CASE85( self, main ):
2574 """
2575 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2576 """
2577 import random
2578 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2579 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2580 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2581 main.log.report(
2582 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2583 main.log.report(
2584 "__________________________________________________________________" )
2585 main.case(
2586 "Point intents - Bring the core links up that are down and verify ping all" )
2587
2588 # Work around for link state propagation delay. Added some sleep time.
2589 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2590 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2591 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2592 time.sleep( link_sleep )
2593 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2594 time.sleep( link_sleep )
2595
2596 topology_output = main.ONOScli1.topology()
2597 linkUp = main.ONOSbench.checkStatus(
2598 topology_output,
2599 main.numMNswitches,
2600 str( main.numMNlinks ) )
2601 utilities.assert_equals(
2602 expect=main.TRUE,
2603 actual=linkUp,
2604 onpass="Link up discovered properly",
2605 onfail="Link up was not discovered in " +
2606 str( link_sleep ) +
2607 " seconds" )
2608
GlennRCfcfdc4f2015-09-30 16:01:57 -07002609 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002610 # Giving onos multiple chances to install intents
2611 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002612 if i != 0:
2613 main.log.warn( "Verification failed. Retrying..." )
2614 main.log.info("Giving onos some time...")
2615 time.sleep( main.checkIntentsDelay )
2616
2617 intentState = main.TRUE
2618 for e in range(int(main.numCtrls)):
2619 main.log.info( "Checking intents on CLI %s" % (e+1) )
2620 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2621 intentState
2622 if not intentState:
2623 main.log.warn( "Not all intents installed" )
2624 if intentState:
2625 break
2626 else:
2627 #Dumping intent summary
2628 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2629
2630
2631 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2632 onpass="INTENTS INSTALLED",
2633 onfail="SOME INTENTS NOT INSTALLED" )
2634
Hari Krishnab79d0822015-08-20 09:48:43 -07002635 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002636 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002637 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002638 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2639 if not pingResult:
2640 main.log.warn("First pingall failed. Retrying...")
2641 time.sleep(main.pingSleep)
2642 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002643
Hari Krishnab79d0822015-08-20 09:48:43 -07002644 time2 = time.time()
2645 timeDiff = round( ( time2 - time1 ), 2 )
2646 main.log.report(
2647 "Time taken for Ping All: " +
2648 str( timeDiff ) +
2649 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002650 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002651 onpass="PING ALL PASS",
2652 onfail="PING ALL FAIL" )
2653
GlennRCbddd58f2015-10-01 15:45:25 -07002654 caseResult = linkUp and pingResult
2655 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002656 onpass="Link Up Test PASS",
2657 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002658 # Printing what exactly failed
2659 if not linkUp:
2660 main.log.debug( "Link down was not discovered correctly" )
2661 if not pingResult:
2662 main.log.debug( "Pingall failed" )
2663 if not intentState:
2664 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002665
GlennRCbddd58f2015-10-01 15:45:25 -07002666 if not caseResult and main.failSwitch:
2667 main.log.report("Stopping test")
2668 main.stop( email=main.emailOnStop )
2669
Hari Krishna4223dbd2015-08-13 16:29:53 -07002670 def CASE170( self ):
2671 """
2672 IPv6 ping all with some core links down( Host Intents-Att Topo)
2673 """
2674 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2675 main.log.report( "_________________________________________________" )
2676 import itertools
2677 import time
2678 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2679 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002680 pingResult = main.FALSE
2681 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002682 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002683 if not pingResult:
2684 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002685 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002686 time2 = time.time()
2687 timeDiff = round( ( time2 - time1 ), 2 )
2688 main.log.report(
2689 "Time taken for IPv6 Ping All: " +
2690 str( timeDiff ) +
2691 " seconds" )
2692 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2693 onpass="PING ALL PASS",
2694 onfail="PING ALL FAIL" )
2695
GlennRCbddd58f2015-10-01 15:45:25 -07002696 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002697 utilities.assert_equals(
2698 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002699 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002700 onpass="IPv6 Ping across 300 host intents test PASS",
2701 onfail="IPv6 Ping across 300 host intents test FAIL" )
2702
2703 def CASE180( self ):
2704 """
2705 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2706 """
2707 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2708 main.log.report( "_________________________________________________" )
2709 import itertools
2710 import time
2711 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2712 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002713 pingResult = main.FALSE
2714 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002715 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002716 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002717 main.log.warn("First ping failed. Retrying...")
2718 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002719 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002720 time2 = time.time()
2721 timeDiff = round( ( time2 - time1 ), 2 )
2722 main.log.report(
2723 "Time taken for IPv6 Ping All: " +
2724 str( timeDiff ) +
2725 " seconds" )
2726 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2727 onpass="PING ALL PASS",
2728 onfail="PING ALL FAIL" )
2729
GlennRCbddd58f2015-10-01 15:45:25 -07002730 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002731 utilities.assert_equals(
2732 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002733 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002734 onpass="IPv6 Ping across 300 host intents test PASS",
2735 onfail="IPv6 Ping across 300 host intents test FAIL" )
2736
2737 def CASE171( self ):
2738 """
2739 IPv6 ping all with some core links down( Point Intents-Att Topo)
2740 """
2741 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2742 main.log.report( "_________________________________________________" )
2743 import itertools
2744 import time
2745 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2746 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002747 pingResult = main.FALSE
2748 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002749 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002750 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002751 main.log.warn("First ping failed. Retrying...")
2752 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002753 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002754 time2 = time.time()
2755 timeDiff = round( ( time2 - time1 ), 2 )
2756 main.log.report(
2757 "Time taken for IPv6 Ping All: " +
2758 str( timeDiff ) +
2759 " seconds" )
2760 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2761 onpass="PING ALL PASS",
2762 onfail="PING ALL FAIL" )
2763
GlennRCbddd58f2015-10-01 15:45:25 -07002764 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002765 utilities.assert_equals(
2766 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002767 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002768 onpass="IPv6 Ping across 600 point intents test PASS",
2769 onfail="IPv6 Ping across 600 point intents test FAIL" )
2770
2771 def CASE181( self ):
2772 """
2773 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2774 """
2775 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2776 main.log.report( "_________________________________________________" )
2777 import itertools
2778 import time
2779 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2780 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002781 pingResult = main.FALSE
2782 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002783 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002784 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002785 main.log.warn("First ping failed. Retrying...")
2786 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002787 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002788 time2 = time.time()
2789 timeDiff = round( ( time2 - time1 ), 2 )
2790 main.log.report(
2791 "Time taken for IPv6 Ping All: " +
2792 str( timeDiff ) +
2793 " seconds" )
2794 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2795 onpass="PING ALL PASS",
2796 onfail="PING ALL FAIL" )
2797
GlennRCbddd58f2015-10-01 15:45:25 -07002798 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002799 utilities.assert_equals(
2800 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002801 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002802 onpass="IPv6 Ping across 600 Point intents test PASS",
2803 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2804
2805 def CASE172( self ):
2806 """
2807 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2808 """
2809 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2810 main.log.report( "_________________________________________________" )
2811 import itertools
2812 import time
2813 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2814 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002815 pingResult = main.FALSE
2816 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002817 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002818 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002819 main.log.warn("First ping failed. Retrying...")
2820 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002821 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002822 time2 = time.time()
2823 timeDiff = round( ( time2 - time1 ), 2 )
2824 main.log.report(
2825 "Time taken for IPv6 Ping All: " +
2826 str( timeDiff ) +
2827 " seconds" )
2828 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2829 onpass="PING ALL PASS",
2830 onfail="PING ALL FAIL" )
2831
GlennRCbddd58f2015-10-01 15:45:25 -07002832 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002833 utilities.assert_equals(
2834 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002835 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002836 onpass="IPv6 Ping across 300 host intents test PASS",
2837 onfail="IPv6 Ping across 300 host intents test FAIL" )
2838
2839 def CASE182( self ):
2840 """
2841 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2842 """
2843 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2844 main.log.report( "_________________________________________________" )
2845 import itertools
2846 import time
2847 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2848 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002849 pingResult = main.FALSE
2850 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002851 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002852 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002853 main.log.warn("First ping failed. Retrying...")
2854 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002855 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002856 time2 = time.time()
2857 timeDiff = round( ( time2 - time1 ), 2 )
2858 main.log.report(
2859 "Time taken for IPv6 Ping All: " +
2860 str( timeDiff ) +
2861 " seconds" )
2862 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2863 onpass="PING ALL PASS",
2864 onfail="PING ALL FAIL" )
2865
GlennRCbddd58f2015-10-01 15:45:25 -07002866 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002867 utilities.assert_equals(
2868 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002869 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002870 onpass="IPv6 Ping across 300 host intents test PASS",
2871 onfail="IPv6 Ping across 300 host intents test FAIL" )
2872
2873 def CASE173( self ):
2874 """
2875 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2876 """
2877 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2878 main.log.report( "_________________________________________________" )
2879 import itertools
2880 import time
2881 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2882 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002883 pingResult = main.FALSE
2884 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002885 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002886 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002887 main.log.warn("First ping failed. Retrying...")
2888 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002889 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002890 time2 = time.time()
2891 timeDiff = round( ( time2 - time1 ), 2 )
2892 main.log.report(
2893 "Time taken for IPv6 Ping All: " +
2894 str( timeDiff ) +
2895 " seconds" )
2896 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2897 onpass="PING ALL PASS",
2898 onfail="PING ALL FAIL" )
2899
GlennRCbddd58f2015-10-01 15:45:25 -07002900 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002901 utilities.assert_equals(
2902 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002903 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002904 onpass="IPv6 Ping across 600 point intents test PASS",
2905 onfail="IPv6 Ping across 600 point intents test FAIL" )
2906
2907 def CASE183( self ):
2908 """
2909 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2910 """
2911 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2912 main.log.report( "_________________________________________________" )
2913 import itertools
2914 import time
2915 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2916 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002917 pingResult = main.FALSE
2918 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002919 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002920 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002921 main.log.warn("First ping failed. Retrying...")
2922 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002923 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002924 time2 = time.time()
2925 timeDiff = round( ( time2 - time1 ), 2 )
2926 main.log.report(
2927 "Time taken for IPv6 Ping All: " +
2928 str( timeDiff ) +
2929 " seconds" )
2930 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2931 onpass="PING ALL PASS",
2932 onfail="PING ALL FAIL" )
2933
GlennRCbddd58f2015-10-01 15:45:25 -07002934 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002935 utilities.assert_equals(
2936 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002937 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002938 onpass="IPv6 Ping across 600 Point intents test PASS",
2939 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2940
2941 def CASE174( self ):
2942 """
2943 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2944 """
2945 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2946 main.log.report( "_________________________________________________" )
2947 import itertools
2948 import time
2949 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2950 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002951 pingResult = main.FALSE
2952 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002953 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002954 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002955 main.log.warn("First ping failed. Retrying...")
2956 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002957 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002958 time2 = time.time()
2959 timeDiff = round( ( time2 - time1 ), 2 )
2960 main.log.report(
2961 "Time taken for IPv6 Ping All: " +
2962 str( timeDiff ) +
2963 " seconds" )
2964 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2965 onpass="PING ALL PASS",
2966 onfail="PING ALL FAIL" )
2967
GlennRCbddd58f2015-10-01 15:45:25 -07002968 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002969 utilities.assert_equals(
2970 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002971 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002972 onpass="IPv6 Ping across 2278 host intents test PASS",
2973 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2974
2975 def CASE184( self ):
2976 """
2977 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2978 """
2979 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2980 main.log.report( "_________________________________________________" )
2981 import itertools
2982 import time
2983 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2984 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002985 pingResult = main.FALSE
2986 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002987 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002988 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002989 main.log.warn("First ping failed. Retrying...")
2990 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002991 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002992 time2 = time.time()
2993 timeDiff = round( ( time2 - time1 ), 2 )
2994 main.log.report(
2995 "Time taken for IPv6 Ping All: " +
2996 str( timeDiff ) +
2997 " seconds" )
2998 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2999 onpass="PING ALL PASS",
3000 onfail="PING ALL FAIL" )
3001
GlennRCbddd58f2015-10-01 15:45:25 -07003002 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003003 utilities.assert_equals(
3004 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003005 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003006 onpass="IPv6 Ping across 2278 host intents test PASS",
3007 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3008
3009 def CASE175( self ):
3010 """
3011 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3012 """
3013 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3014 main.log.report( "_________________________________________________" )
3015 import itertools
3016 import time
3017 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3018 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003019 pingResult = main.FALSE
3020 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003021 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003022 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003023 main.log.warn("First ping failed. Retrying...")
3024 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003025 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003026 time2 = time.time()
3027 timeDiff = round( ( time2 - time1 ), 2 )
3028 main.log.report(
3029 "Time taken for IPv6 Ping All: " +
3030 str( timeDiff ) +
3031 " seconds" )
3032 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3033 onpass="PING ALL PASS",
3034 onfail="PING ALL FAIL" )
3035
GlennRCbddd58f2015-10-01 15:45:25 -07003036 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003037 utilities.assert_equals(
3038 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003039 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003040 onpass="IPv6 Ping across 4556 point intents test PASS",
3041 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3042
3043 def CASE185( self ):
3044 """
3045 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3046 """
3047 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3048 main.log.report( "_________________________________________________" )
3049 import itertools
3050 import time
3051 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3052 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003053 pingResult = main.FALSE
3054 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003055 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003056 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003057 main.log.warn("First ping failed. Retrying...")
3058 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003059 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003060 time2 = time.time()
3061 timeDiff = round( ( time2 - time1 ), 2 )
3062 main.log.report(
3063 "Time taken for IPv6 Ping All: " +
3064 str( timeDiff ) +
3065 " seconds" )
3066 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3067 onpass="PING ALL PASS",
3068 onfail="PING ALL FAIL" )
3069
GlennRCbddd58f2015-10-01 15:45:25 -07003070 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003071 utilities.assert_equals(
3072 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003073 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003074 onpass="IPv6 Ping across 4556 Point intents test PASS",
3075 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3076
Hari Krishnac195f3b2015-07-08 20:02:24 -07003077 def CASE90( self ):
3078 """
3079 Install 600 point intents and verify ping all (Att Topology)
3080 """
3081 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3082 main.log.report( "_______________________________________" )
3083 import itertools
3084 import time
3085 main.case( "Install 600 point intents" )
3086 main.step( "Add point Intents" )
3087 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003088 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3089
Hari Krishnac195f3b2015-07-08 20:02:24 -07003090 intentIdList = []
3091 time1 = time.time()
3092 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3093 pool = []
3094 for cli in main.CLIs:
3095 if i >= len( deviceCombos ):
3096 break
3097 t = main.Thread( target=cli.addPointIntent,
3098 threadID=main.threadID,
3099 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003100 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003101 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003102 t.start()
3103 i = i + 1
3104 main.threadID = main.threadID + 1
3105 for thread in pool:
3106 thread.join()
3107 intentIdList.append(thread.result)
3108 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003109 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003110
GlennRCfcfdc4f2015-09-30 16:01:57 -07003111 # Saving intent ids to check intents in later case
3112 main.intentIds = list(intentIdList)
3113
GlennRCa8d786a2015-09-23 17:40:11 -07003114 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003115
GlennRC1dde1712015-10-02 11:03:08 -07003116 # Giving onos multiple chances to install intents
3117 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003118 if i != 0:
3119 main.log.warn( "Verification failed. Retrying..." )
3120 main.log.info("Waiting for onos to install intents...")
3121 time.sleep( main.checkIntentsDelay )
3122
GlennRCa8d786a2015-09-23 17:40:11 -07003123 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003124 for e in range(int(main.numCtrls)):
3125 main.log.info( "Checking intents on CLI %s" % (e+1) )
3126 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3127 intentState
3128 if not intentState:
3129 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003130 if intentState:
3131 break
GlennRCdb2c8422015-09-29 12:21:59 -07003132 else:
3133 #Dumping intent summary
3134 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003135
3136 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3137 onpass="INTENTS INSTALLED",
3138 onfail="SOME INTENTS NOT INSTALLED" )
3139
Hari Krishnac195f3b2015-07-08 20:02:24 -07003140 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003141 for i in range(main.numPings):
3142 time1 = time.time()
3143 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
3148
Hari Krishnac195f3b2015-07-08 20:02:24 -07003149 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 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003156 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003157 onfail="PING ALL FAIL" )
3158
GlennRCbddd58f2015-10-01 15:45:25 -07003159 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003160
Hari Krishnac195f3b2015-07-08 20:02:24 -07003161 utilities.assert_equals(
3162 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003163 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003164 onpass="Install 600 point Intents and Ping All test PASS",
3165 onfail="Install 600 point Intents and Ping All test FAIL" )
3166
GlennRCbddd58f2015-10-01 15:45:25 -07003167 if not intentState:
3168 main.log.debug( "Intents failed to install completely" )
3169 if not pingResult:
3170 main.log.debug( "Pingall failed" )
3171
3172 if not caseResult and main.failSwitch:
3173 main.log.report("Stopping test")
3174 main.stop( email=main.emailOnStop )
3175
Hari Krishnac195f3b2015-07-08 20:02:24 -07003176 def CASE91( self ):
3177 """
3178 Install 600 point intents and verify ping all (Chordal Topology)
3179 """
3180 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3181 main.log.report( "_______________________________________" )
3182 import itertools
3183 import time
3184 main.case( "Install 600 point intents" )
3185 main.step( "Add point Intents" )
3186 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003187 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3188
Hari Krishnac195f3b2015-07-08 20:02:24 -07003189 intentIdList = []
3190 time1 = time.time()
3191 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3192 pool = []
3193 for cli in main.CLIs:
3194 if i >= len( deviceCombos ):
3195 break
3196 t = main.Thread( target=cli.addPointIntent,
3197 threadID=main.threadID,
3198 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003199 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003200 pool.append(t)
3201 #time.sleep(1)
3202 t.start()
3203 i = i + 1
3204 main.threadID = main.threadID + 1
3205 for thread in pool:
3206 thread.join()
3207 intentIdList.append(thread.result)
3208 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003209 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003210
GlennRCfcfdc4f2015-09-30 16:01:57 -07003211 # Saving intent ids to check intents in later case
3212 main.intentIds = list(intentIdList)
3213
GlennRCa8d786a2015-09-23 17:40:11 -07003214 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003215
GlennRC1dde1712015-10-02 11:03:08 -07003216 # Giving onos multiple chances to install intents
3217 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003218 if i != 0:
3219 main.log.warn( "Verification failed. Retrying..." )
3220 main.log.info("Waiting for onos to install intents...")
3221 time.sleep( main.checkIntentsDelay )
3222
GlennRCa8d786a2015-09-23 17:40:11 -07003223 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003224 for e in range(int(main.numCtrls)):
3225 main.log.info( "Checking intents on CLI %s" % (e+1) )
3226 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3227 intentState
3228 if not intentState:
3229 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003230 if intentState:
3231 break
GlennRCdb2c8422015-09-29 12:21:59 -07003232 else:
3233 #Dumping intent summary
3234 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003235
3236 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3237 onpass="INTENTS INSTALLED",
3238 onfail="SOME INTENTS NOT INSTALLED" )
3239
Hari Krishnac195f3b2015-07-08 20:02:24 -07003240 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003241 for i in range(main.numPings):
3242 time1 = time.time()
3243 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3244 if not pingResult:
3245 main.log.warn("First pingall failed. Retrying...")
3246 time.sleep(main.pingSleep)
3247 else: break
3248
Hari Krishnac195f3b2015-07-08 20:02:24 -07003249 time2 = time.time()
3250 timeDiff = round( ( time2 - time1 ), 2 )
3251 main.log.report(
3252 "Time taken for Ping All: " +
3253 str( timeDiff ) +
3254 " seconds" )
3255 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3256 onpass="PING ALL PASS",
3257 onfail="PING ALL FAIL" )
3258
GlennRCbddd58f2015-10-01 15:45:25 -07003259 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003260
Hari Krishnac195f3b2015-07-08 20:02:24 -07003261 utilities.assert_equals(
3262 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003263 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003264 onpass="Install 600 point Intents and Ping All test PASS",
3265 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003266
GlennRCbddd58f2015-10-01 15:45:25 -07003267 if not intentState:
3268 main.log.debug( "Intents failed to install completely" )
3269 if not pingResult:
3270 main.log.debug( "Pingall failed" )
3271
3272 if not caseResult and main.failSwitch:
3273 main.log.report("Stopping test")
3274 main.stop( email=main.emailOnStop )
3275
Hari Krishnac195f3b2015-07-08 20:02:24 -07003276 def CASE92( self ):
3277 """
3278 Install 4556 point intents and verify ping all (Spine Topology)
3279 """
3280 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3281 main.log.report( "_______________________________________" )
3282 import itertools
3283 import time
3284 main.case( "Install 4556 point intents" )
3285 main.step( "Add point Intents" )
3286 intentResult = main.TRUE
3287 main.pingTimeout = 600
3288 for i in range(len(main.hostMACs)):
3289 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3290 print main.MACsDict
3291 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3292 intentIdList = []
3293 time1 = time.time()
3294 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3295 pool = []
3296 for cli in main.CLIs:
3297 if i >= len( deviceCombos ):
3298 break
3299 t = main.Thread( target=cli.addPointIntent,
3300 threadID=main.threadID,
3301 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003302 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003303 pool.append(t)
3304 #time.sleep(1)
3305 t.start()
3306 i = i + 1
3307 main.threadID = main.threadID + 1
3308 for thread in pool:
3309 thread.join()
3310 intentIdList.append(thread.result)
3311 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003312 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003313
GlennRCfcfdc4f2015-09-30 16:01:57 -07003314 # Saving intent ids to check intents in later case
3315 main.intentIds = list(intentIdList)
3316
GlennRCa8d786a2015-09-23 17:40:11 -07003317 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003318
GlennRC1dde1712015-10-02 11:03:08 -07003319 # Giving onos multiple chances to install intents
3320 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003321 if i != 0:
3322 main.log.warn( "Verification failed. Retrying..." )
3323 main.log.info("Waiting for onos to install intents...")
3324 time.sleep( main.checkIntentsDelay )
3325
GlennRCa8d786a2015-09-23 17:40:11 -07003326 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003327 for e in range(int(main.numCtrls)):
3328 main.log.info( "Checking intents on CLI %s" % (e+1) )
3329 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3330 intentState
3331 if not intentState:
3332 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003333 if intentState:
3334 break
GlennRCdb2c8422015-09-29 12:21:59 -07003335 else:
3336 #Dumping intent summary
3337 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003338
3339 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3340 onpass="INTENTS INSTALLED",
3341 onfail="SOME INTENTS NOT INSTALLED" )
3342
Hari Krishnac195f3b2015-07-08 20:02:24 -07003343 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003344 for i in range(main.numPings):
3345 time1 = time.time()
3346 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3347 if not pingResult:
3348 main.log.warn("First pingall failed. Retrying...")
3349 time.sleep(main.pingSleep)
3350 else: break
3351
Hari Krishnac195f3b2015-07-08 20:02:24 -07003352 time2 = time.time()
3353 timeDiff = round( ( time2 - time1 ), 2 )
3354 main.log.report(
3355 "Time taken for Ping All: " +
3356 str( timeDiff ) +
3357 " seconds" )
3358 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3359 onpass="PING ALL PASS",
3360 onfail="PING ALL FAIL" )
3361
GlennRCbddd58f2015-10-01 15:45:25 -07003362 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003363
Hari Krishnac195f3b2015-07-08 20:02:24 -07003364 utilities.assert_equals(
3365 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003366 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003367 onpass="Install 4556 point Intents and Ping All test PASS",
3368 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003369
GlennRCbddd58f2015-10-01 15:45:25 -07003370 if not intentState:
3371 main.log.debug( "Intents failed to install completely" )
3372 if not pingResult:
3373 main.log.debug( "Pingall failed" )
3374
3375 if not caseResult and main.failSwitch:
3376 main.log.report("Stopping test")
3377 main.stop( email=main.emailOnStop )
3378
Hari Krishnac195f3b2015-07-08 20:02:24 -07003379 def CASE93( self ):
3380 """
3381 Install multi-single point intents and verify Ping all works
3382 for att topology
3383 """
3384 import copy
3385 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003386 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003387 main.log.report( "Install multi-single point intents and verify Ping all" )
3388 main.log.report( "___________________________________________" )
3389 main.case( "Install multi-single point intents and Ping all" )
3390 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3391 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3392 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003393 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003394 time1 = time.time()
3395 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3396 pool = []
3397 for cli in main.CLIs:
3398 egressDevice = deviceDPIDsCopy[i]
3399 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3400 ingressDeviceList.remove(egressDevice)
3401 if i >= len( deviceDPIDsCopy ):
3402 break
3403 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3404 threadID=main.threadID,
3405 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003406 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003407 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003408 t.start()
3409 i = i + 1
3410 main.threadID = main.threadID + 1
3411 for thread in pool:
3412 thread.join()
3413 intentIdList.append(thread.result)
3414 time2 = time.time()
3415 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003416
GlennRCdb2c8422015-09-29 12:21:59 -07003417 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003418
GlennRC1dde1712015-10-02 11:03:08 -07003419 # Giving onos multiple chances to install intents
3420 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003421 if i != 0:
3422 main.log.warn( "Verification failed. Retrying..." )
3423 main.log.info("Waiting for onos to install intents...")
3424 time.sleep( main.checkIntentsDelay )
3425
3426 intentState = main.TRUE
3427 for e in range(int(main.numCtrls)):
3428 main.log.info( "Checking intents on CLI %s" % (e+1) )
3429 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3430 intentState
3431 if not intentState:
3432 main.log.warn( "Not all intents installed" )
3433 if intentState:
3434 break
3435 else:
3436 #Dumping intent summary
3437 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3438
3439 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3440 onpass="INTENTS INSTALLED",
3441 onfail="SOME INTENTS NOT INSTALLED" )
3442
GlennRCfa69a2a2015-10-02 15:54:06 -07003443 main.step("Verify flows are all added")
3444
3445 for i in range( main.flowCheck ):
3446 if i != 0:
3447 main.log.warn( "verification failed. Retrying..." )
3448 main.log.info( "Waiting for onos to add flows..." )
3449 time.sleep( main.checkFlowsDelay )
3450
3451 flowState = main.TRUE
3452 for cli in main.CLIs:
3453 flowState = cli.checkFlowState()
3454 if not flowState:
3455 main.log.warn( "Not all flows added" )
3456 if flowState:
3457 break
3458 else:
3459 #Dumping summary
3460 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3461
3462 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3463 onpass="FLOWS INSTALLED",
3464 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003465
Hari Krishnac195f3b2015-07-08 20:02:24 -07003466 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003467 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003468 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003469 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3470 if not pingResult:
3471 main.log.warn("First pingall failed. Retrying...")
3472 time.sleep(main.pingSleep)
3473 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003474
Hari Krishnac195f3b2015-07-08 20:02:24 -07003475 time2 = time.time()
3476 timeDiff = round( ( time2 - time1 ), 2 )
3477 main.log.report(
3478 "Time taken for Ping All: " +
3479 str( timeDiff ) +
3480 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003481
GlennRCbddd58f2015-10-01 15:45:25 -07003482 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003483 utilities.assert_equals(
3484 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003485 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003486 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3487 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003488
GlennRCfa69a2a2015-10-02 15:54:06 -07003489 if not intentState:
3490 main.log.debug( "Intents failed to install completely" )
3491 if not pingResult:
3492 main.log.debug( "Pingall failed" )
3493 if not checkFlowsState:
3494 main.log.debug( "Flows failed to add completely" )
3495
3496 if not caseResult and main.failSwitch:
3497 main.log.report("Stopping test")
3498 main.stop( email=main.emailOnStop )
3499
Hari Krishnac195f3b2015-07-08 20:02:24 -07003500 def CASE94( self ):
3501 """
3502 Install multi-single point intents and verify Ping all works
3503 for Chordal topology
3504 """
3505 import copy
3506 import time
3507 main.log.report( "Install multi-single point intents and verify Ping all" )
3508 main.log.report( "___________________________________________" )
3509 main.case( "Install multi-single point intents and Ping all" )
3510 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3511 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3512 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003513 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003514 time1 = time.time()
3515 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3516 pool = []
3517 for cli in main.CLIs:
3518 egressDevice = deviceDPIDsCopy[i]
3519 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3520 ingressDeviceList.remove(egressDevice)
3521 if i >= len( deviceDPIDsCopy ):
3522 break
3523 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3524 threadID=main.threadID,
3525 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003526 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003527 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003528 t.start()
3529 i = i + 1
3530 main.threadID = main.threadID + 1
3531 for thread in pool:
3532 thread.join()
3533 intentIdList.append(thread.result)
3534 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003535 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003536
3537 main.step("Verify intents are installed")
3538
GlennRC1dde1712015-10-02 11:03:08 -07003539 # Giving onos multiple chances to install intents
3540 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003541 if i != 0:
3542 main.log.warn( "Verification failed. Retrying..." )
3543 main.log.info("Waiting for onos to install intents...")
3544 time.sleep( main.checkIntentsDelay )
3545
3546 intentState = main.TRUE
3547 for e in range(int(main.numCtrls)):
3548 main.log.info( "Checking intents on CLI %s" % (e+1) )
3549 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3550 intentState
3551 if not intentState:
3552 main.log.warn( "Not all intents installed" )
3553 if intentState:
3554 break
3555 else:
3556 #Dumping intent summary
3557 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3558
GlennRCdb2c8422015-09-29 12:21:59 -07003559 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3560 onpass="INTENTS INSTALLED",
3561 onfail="SOME INTENTS NOT INSTALLED" )
3562
GlennRCfa69a2a2015-10-02 15:54:06 -07003563 main.step("Verify flows are all added")
3564
3565 for i in range( main.flowCheck ):
3566 if i != 0:
3567 main.log.warn( "verification failed. Retrying..." )
3568 main.log.info( "Waiting for onos to add flows..." )
3569 time.sleep( main.checkFlowsDelay )
3570
3571 flowState = main.TRUE
3572 for cli in main.CLIs:
3573 flowState = cli.checkFlowState()
3574 if not flowState:
3575 main.log.warn( "Not all flows added" )
3576 if flowState:
3577 break
3578 else:
3579 #Dumping summary
3580 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3581
3582 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3583 onpass="FLOWS INSTALLED",
3584 onfail="SOME FLOWS NOT ADDED" )
3585
Hari Krishnac195f3b2015-07-08 20:02:24 -07003586 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003587 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003588 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003589 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3590 if not pingResult:
3591 main.log.warn("First pingall failed. Retrying...")
3592 time.sleep(main.pingSleep)
3593 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003594
Hari Krishnac195f3b2015-07-08 20:02:24 -07003595 time2 = time.time()
3596 timeDiff = round( ( time2 - time1 ), 2 )
3597 main.log.report(
3598 "Time taken for Ping All: " +
3599 str( timeDiff ) +
3600 " seconds" )
3601
GlennRCfa69a2a2015-10-02 15:54:06 -07003602 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003603 utilities.assert_equals(
3604 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003605 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003606 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3607 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003608
GlennRCfa69a2a2015-10-02 15:54:06 -07003609 if not intentState:
3610 main.log.debug( "Intents failed to install completely" )
3611 if not pingResult:
3612 main.log.debug( "Pingall failed" )
3613 if not checkFlowsState:
3614 main.log.debug( "Flows failed to add completely" )
3615
3616 if not caseResult and main.failSwitch:
3617 main.log.report("Stopping test")
3618 main.stop( email=main.emailOnStop )
3619
3620 def CASE95( self ):
3621 """
3622 Install multi-single point intents and verify Ping all works
3623 for Spine topology
3624 """
3625 import copy
3626 import time
3627 main.log.report( "Install multi-single point intents and verify Ping all" )
3628 main.log.report( "___________________________________________" )
3629 main.case( "Install multi-single point intents and Ping all" )
3630 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3631 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3632 intentIdList = []
3633 main.log.info( "MACsDict" + str(main.MACsDict) )
3634 time1 = time.time()
3635 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3636 pool = []
3637 for cli in main.CLIs:
3638 egressDevice = deviceDPIDsCopy[i]
3639 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3640 ingressDeviceList.remove(egressDevice)
3641 if i >= len( deviceDPIDsCopy ):
3642 break
3643 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3644 threadID=main.threadID,
3645 name="addMultipointToSinglepointIntent",
3646 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3647 pool.append(t)
3648 t.start()
3649 i = i + 1
3650 main.threadID = main.threadID + 1
3651 for thread in pool:
3652 thread.join()
3653 intentIdList.append(thread.result)
3654 time2 = time.time()
3655 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3656
3657 main.step("Verify intents are installed")
3658
3659 # Giving onos multiple chances to install intents
3660 for i in range( main.intentCheck ):
3661 if i != 0:
3662 main.log.warn( "Verification failed. Retrying..." )
3663 main.log.info("Waiting for onos to install intents...")
3664 time.sleep( main.checkIntentsDelay )
3665
3666 intentState = main.TRUE
3667 for e in range(int(main.numCtrls)):
3668 main.log.info( "Checking intents on CLI %s" % (e+1) )
3669 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3670 intentState
3671 if not intentState:
3672 main.log.warn( "Not all intents installed" )
3673 if intentState:
3674 break
3675 else:
3676 #Dumping intent summary
3677 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3678
3679 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3680 onpass="INTENTS INSTALLED",
3681 onfail="SOME INTENTS NOT INSTALLED" )
3682
3683 main.step("Verify flows are all added")
3684
3685 for i in range( main.flowCheck ):
3686 if i != 0:
3687 main.log.warn( "verification failed. Retrying..." )
3688 main.log.info( "Waiting for onos to add flows..." )
3689 time.sleep( main.checkFlowsDelay )
3690
3691 flowState = main.TRUE
3692 for cli in main.CLIs:
3693 flowState = cli.checkFlowState()
3694 if not flowState:
3695 main.log.warn( "Not all flows added" )
3696 if flowState:
3697 break
3698 else:
3699 #Dumping summary
3700 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3701
3702 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3703 onpass="FLOWS INSTALLED",
3704 onfail="SOME FLOWS NOT ADDED" )
3705
3706 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003707 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003708 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003709 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3710 if not pingResult:
3711 main.log.warn("First pingall failed. Retrying...")
3712 time.sleep(main.pingSleep)
3713 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003714
3715 time2 = time.time()
3716 timeDiff = round( ( time2 - time1 ), 2 )
3717 main.log.report(
3718 "Time taken for Ping All: " +
3719 str( timeDiff ) +
3720 " seconds" )
3721
3722 caseResult = ( checkFlowsState and pingResult and intentState )
3723 utilities.assert_equals(
3724 expect=main.TRUE,
3725 actual=caseResult,
3726 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3727 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3728
3729 if not intentState:
3730 main.log.debug( "Intents failed to install completely" )
3731 if not pingResult:
3732 main.log.debug( "Pingall failed" )
3733 if not checkFlowsState:
3734 main.log.debug( "Flows failed to add completely" )
3735
3736 if not caseResult and main.failSwitch:
3737 main.log.report("Stopping test")
3738 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003739
3740 def CASE96( self ):
3741 """
3742 Install single-multi point intents and verify Ping all works
3743 for att topology
3744 """
3745 import copy
3746 main.log.report( "Install single-multi point intents and verify Ping all" )
3747 main.log.report( "___________________________________________" )
3748 main.case( "Install single-multi point intents and Ping all" )
3749 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3750 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3751 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003752 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003753 time1 = time.time()
3754 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3755 pool = []
3756 for cli in main.CLIs:
3757 ingressDevice = deviceDPIDsCopy[i]
3758 egressDeviceList = copy.copy(deviceDPIDsCopy)
3759 egressDeviceList.remove(ingressDevice)
3760 if i >= len( deviceDPIDsCopy ):
3761 break
3762 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3763 threadID=main.threadID,
3764 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003765 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003766 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003767 t.start()
3768 i = i + 1
3769 main.threadID = main.threadID + 1
3770 for thread in pool:
3771 thread.join()
3772 intentIdList.append(thread.result)
3773 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003774 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003775
3776 main.step("Verify intents are installed")
3777
GlennRC1dde1712015-10-02 11:03:08 -07003778 # Giving onos multiple chances to install intents
3779 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003780 if i != 0:
3781 main.log.warn( "Verification failed. Retrying..." )
3782 main.log.info("Waiting for onos to install intents...")
3783 time.sleep( main.checkIntentsDelay )
3784
3785 intentState = main.TRUE
3786 for e in range(int(main.numCtrls)):
3787 main.log.info( "Checking intents on CLI %s" % (e+1) )
3788 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3789 intentState
3790 if not intentState:
3791 main.log.warn( "Not all intents installed" )
3792 if intentState:
3793 break
3794 else:
3795 #Dumping intent summary
3796 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3797
GlennRCdb2c8422015-09-29 12:21:59 -07003798 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3799 onpass="INTENTS INSTALLED",
3800 onfail="SOME INTENTS NOT INSTALLED" )
3801
GlennRCfa69a2a2015-10-02 15:54:06 -07003802 main.step("Verify flows are all added")
3803
3804 for i in range( main.flowCheck ):
3805 if i != 0:
3806 main.log.warn( "verification failed. Retrying..." )
3807 main.log.info( "Waiting for onos to add flows..." )
3808 time.sleep( main.checkFlowsDelay )
3809
3810 flowState = main.TRUE
3811 for cli in main.CLIs:
3812 flowState = cli.checkFlowState()
3813 if not flowState:
3814 main.log.warn( "Not all flows added" )
3815 if flowState:
3816 break
3817 else:
3818 #Dumping summary
3819 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3820
3821 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3822 onpass="FLOWS INSTALLED",
3823 onfail="SOME FLOWS NOT ADDED" )
3824
Hari Krishnac195f3b2015-07-08 20:02:24 -07003825 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003826 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003827 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003828 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3829 if not pingResult:
3830 main.log.warn("First pingall failed. Retrying...")
3831 time.sleep(main.pingSleep)
3832 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003833
Hari Krishnac195f3b2015-07-08 20:02:24 -07003834 time2 = time.time()
3835 timeDiff = round( ( time2 - time1 ), 2 )
3836 main.log.report(
3837 "Time taken for Ping All: " +
3838 str( timeDiff ) +
3839 " seconds" )
3840
GlennRCfa69a2a2015-10-02 15:54:06 -07003841 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003842 utilities.assert_equals(
3843 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003844 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003845 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3846 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3847
GlennRCfa69a2a2015-10-02 15:54:06 -07003848 if not intentState:
3849 main.log.debug( "Intents failed to install completely" )
3850 if not pingResult:
3851 main.log.debug( "Pingall failed" )
3852 if not checkFlowsState:
3853 main.log.debug( "Flows failed to add completely" )
3854
3855 if not caseResult and main.failSwitch:
3856 main.log.report("Stopping test")
3857 main.stop( email=main.emailOnStop )
3858
Hari Krishnac195f3b2015-07-08 20:02:24 -07003859 def CASE97( self ):
3860 """
3861 Install single-multi point intents and verify Ping all works
3862 for Chordal topology
3863 """
3864 import copy
3865 main.log.report( "Install single-multi point intents and verify Ping all" )
3866 main.log.report( "___________________________________________" )
3867 main.case( "Install single-multi point intents and Ping all" )
3868 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3869 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3870 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003871 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003872 time1 = time.time()
3873 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3874 pool = []
3875 for cli in main.CLIs:
3876 ingressDevice = deviceDPIDsCopy[i]
3877 egressDeviceList = copy.copy(deviceDPIDsCopy)
3878 egressDeviceList.remove(ingressDevice)
3879 if i >= len( deviceDPIDsCopy ):
3880 break
3881 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3882 threadID=main.threadID,
3883 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003884 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003885 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003886 t.start()
3887 i = i + 1
3888 main.threadID = main.threadID + 1
3889 for thread in pool:
3890 thread.join()
3891 intentIdList.append(thread.result)
3892 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003893 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003894
3895 main.step("Verify intents are installed")
3896
GlennRC1dde1712015-10-02 11:03:08 -07003897 # Giving onos multiple chances to install intents
3898 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003899 if i != 0:
3900 main.log.warn( "Verification failed. Retrying..." )
3901 main.log.info("Waiting for onos to install intents...")
3902 time.sleep( main.checkIntentsDelay )
3903
3904 intentState = main.TRUE
3905 for e in range(int(main.numCtrls)):
3906 main.log.info( "Checking intents on CLI %s" % (e+1) )
3907 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3908 intentState
3909 if not intentState:
3910 main.log.warn( "Not all intents installed" )
3911 if intentState:
3912 break
3913 else:
3914 #Dumping intent summary
3915 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3916
GlennRCdb2c8422015-09-29 12:21:59 -07003917 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3918 onpass="INTENTS INSTALLED",
3919 onfail="SOME INTENTS NOT INSTALLED" )
3920
GlennRCfa69a2a2015-10-02 15:54:06 -07003921 main.step("Verify flows are all added")
3922
3923 for i in range( main.flowCheck ):
3924 if i != 0:
3925 main.log.warn( "verification failed. Retrying..." )
3926 main.log.info( "Waiting for onos to add flows..." )
3927 time.sleep( main.checkFlowsDelay )
3928
3929 flowState = main.TRUE
3930 for cli in main.CLIs:
3931 flowState = cli.checkFlowState()
3932 if not flowState:
3933 main.log.warn( "Not all flows added" )
3934 if flowState:
3935 break
3936 else:
3937 #Dumping summary
3938 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3939
3940 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3941 onpass="FLOWS INSTALLED",
3942 onfail="SOME FLOWS NOT ADDED" )
3943
Hari Krishnac195f3b2015-07-08 20:02:24 -07003944 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003945 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003946 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003947 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3948 if not pingResult:
3949 main.log.warn("First pingall failed. Retrying...")
3950 time.sleep(main.pingSleep)
3951 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003952
Hari Krishnac195f3b2015-07-08 20:02:24 -07003953 time2 = time.time()
3954 timeDiff = round( ( time2 - time1 ), 2 )
3955 main.log.report(
3956 "Time taken for Ping All: " +
3957 str( timeDiff ) +
3958 " seconds" )
3959
GlennRCfa69a2a2015-10-02 15:54:06 -07003960 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003961 utilities.assert_equals(
3962 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003963 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003964 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3965 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3966
GlennRCfa69a2a2015-10-02 15:54:06 -07003967 if not intentState:
3968 main.log.debug( "Intents failed to install completely" )
3969 if not pingResult:
3970 main.log.debug( "Pingall failed" )
3971 if not checkFlowsState:
3972 main.log.debug( "Flows failed to add completely" )
3973
3974 if not caseResult and main.failSwitch:
3975 main.log.report("Stopping test")
3976 main.stop( email=main.emailOnStop )
3977
Hari Krishnac195f3b2015-07-08 20:02:24 -07003978 def CASE98( self ):
3979 """
3980 Install single-multi point intents and verify Ping all works
3981 for Spine topology
3982 """
3983 import copy
3984 main.log.report( "Install single-multi point intents and verify Ping all" )
3985 main.log.report( "___________________________________________" )
3986 main.case( "Install single-multi point intents and Ping all" )
3987 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3988 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3989 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3990 intentIdList = []
3991 MACsDictCopy = {}
3992 for i in range( len( deviceDPIDsCopy ) ):
3993 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3994
GlennRCfa69a2a2015-10-02 15:54:06 -07003995 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3996 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003997 time1 = time.time()
3998 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3999 pool = []
4000 for cli in main.CLIs:
4001 if i >= len( deviceDPIDsCopy ):
4002 break
4003 ingressDevice = deviceDPIDsCopy[i]
4004 egressDeviceList = copy.copy(deviceDPIDsCopy)
4005 egressDeviceList.remove(ingressDevice)
4006 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4007 threadID=main.threadID,
4008 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004009 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004010 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004011 t.start()
4012 i = i + 1
4013 main.threadID = main.threadID + 1
4014 for thread in pool:
4015 thread.join()
4016 intentIdList.append(thread.result)
4017 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004018 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004019
4020 main.step("Verify intents are installed")
4021
GlennRC1dde1712015-10-02 11:03:08 -07004022 # Giving onos multiple chances to install intents
4023 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004024 if i != 0:
4025 main.log.warn( "Verification failed. Retrying..." )
4026 main.log.info("Waiting for onos to install intents...")
4027 time.sleep( main.checkIntentsDelay )
4028
4029 intentState = main.TRUE
4030 for e in range(int(main.numCtrls)):
4031 main.log.info( "Checking intents on CLI %s" % (e+1) )
4032 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4033 intentState
4034 if not intentState:
4035 main.log.warn( "Not all intents installed" )
4036 if intentState:
4037 break
4038 else:
4039 #Dumping intent summary
4040 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4041
GlennRCdb2c8422015-09-29 12:21:59 -07004042 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4043 onpass="INTENTS INSTALLED",
4044 onfail="SOME INTENTS NOT INSTALLED" )
4045
GlennRCfa69a2a2015-10-02 15:54:06 -07004046 main.step("Verify flows are all added")
4047
4048 for i in range( main.flowCheck ):
4049 if i != 0:
4050 main.log.warn( "verification failed. Retrying..." )
4051 main.log.info( "Waiting for onos to add flows..." )
4052 time.sleep( main.checkFlowsDelay )
4053
4054 flowState = main.TRUE
4055 for cli in main.CLIs:
4056 flowState = cli.checkFlowState()
4057 if not flowState:
4058 main.log.warn( "Not all flows added" )
4059 if flowState:
4060 break
4061 else:
4062 #Dumping summary
4063 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4064
4065 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4066 onpass="FLOWS INSTALLED",
4067 onfail="SOME FLOWS NOT ADDED" )
4068
Hari Krishnac195f3b2015-07-08 20:02:24 -07004069 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004070 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004071 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004072 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4073 if not pingResult:
4074 main.log.warn("First pingall failed. Retrying...")
4075 time.sleep(main.pingSleep)
4076 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004077
Hari Krishnac195f3b2015-07-08 20:02:24 -07004078 time2 = time.time()
4079 timeDiff = round( ( time2 - time1 ), 2 )
4080 main.log.report(
4081 "Time taken for Ping All: " +
4082 str( timeDiff ) +
4083 " seconds" )
4084
GlennRCfa69a2a2015-10-02 15:54:06 -07004085 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004086 utilities.assert_equals(
4087 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004088 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004089 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4090 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4091
GlennRCfa69a2a2015-10-02 15:54:06 -07004092 if not intentState:
4093 main.log.debug( "Intents failed to install completely" )
4094 if not pingResult:
4095 main.log.debug( "Pingall failed" )
4096 if not checkFlowsState:
4097 main.log.debug( "Flows failed to add completely" )
4098
4099 if not caseResult and main.failSwitch:
4100 main.log.report("Stopping test")
4101 main.stop( email=main.emailOnStop )
4102
Hari Krishna4223dbd2015-08-13 16:29:53 -07004103 def CASE190( self ):
4104 """
4105 Verify IPv6 ping across 600 Point intents (Att Topology)
4106 """
4107 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4108 main.log.report( "_________________________________________________" )
4109 import itertools
4110 import time
4111 main.case( "IPv6 ping all 600 Point intents" )
4112 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004113 pingResult = main.FALSE
4114 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004115 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004116 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004117 main.log.warn("First pingall failed. Retrying...")
4118 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004119 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004120 time2 = time.time()
4121 timeDiff = round( ( time2 - time1 ), 2 )
4122 main.log.report(
4123 "Time taken for IPv6 Ping All: " +
4124 str( timeDiff ) +
4125 " seconds" )
4126 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4127 onpass="PING ALL PASS",
4128 onfail="PING ALL FAIL" )
4129
GlennRCbddd58f2015-10-01 15:45:25 -07004130 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004131 utilities.assert_equals(
4132 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004133 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004134 onpass="IPv6 Ping across 600 Point intents test PASS",
4135 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4136
4137 def CASE191( self ):
4138 """
4139 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4140 """
4141 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4142 main.log.report( "_________________________________________________" )
4143 import itertools
4144 import time
4145 main.case( "IPv6 ping all 600 Point intents" )
4146 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004147 pingResult = main.FALSE
4148 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004149 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004150 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004151 main.log.warn("First pingall failed. Retrying...")
4152 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004153 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004154 time2 = time.time()
4155 timeDiff = round( ( time2 - time1 ), 2 )
4156 main.log.report(
4157 "Time taken for IPv6 Ping All: " +
4158 str( timeDiff ) +
4159 " seconds" )
4160 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4161 onpass="PING ALL PASS",
4162 onfail="PING ALL FAIL" )
4163
GlennRCbddd58f2015-10-01 15:45:25 -07004164 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004165 utilities.assert_equals(
4166 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004167 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004168 onpass="IPv6 Ping across 600 Point intents test PASS",
4169 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4170
4171 def CASE192( self ):
4172 """
4173 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4174 """
4175 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4176 main.log.report( "_________________________________________________" )
4177 import itertools
4178 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004179 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004180 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004181 pingResult = main.FALSE
4182 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004183 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004184 if not pingResult:
4185 main.log.warn("First pingall failed. Retrying...")
4186 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004187 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004188 time2 = time.time()
4189 timeDiff = round( ( time2 - time1 ), 2 )
4190 main.log.report(
4191 "Time taken for IPv6 Ping All: " +
4192 str( timeDiff ) +
4193 " seconds" )
4194 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4195 onpass="PING ALL PASS",
4196 onfail="PING ALL FAIL" )
4197
GlennRCbddd58f2015-10-01 15:45:25 -07004198 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004199 utilities.assert_equals(
4200 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004201 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004202 onpass="IPv6 Ping across 4556 Point intents test PASS",
4203 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004204
Hari Krishnac195f3b2015-07-08 20:02:24 -07004205 def CASE10( self ):
4206 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004207 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004208 """
4209 Remove all Intents
4210 """
4211 main.log.report( "Remove all intents that were installed previously" )
4212 main.log.report( "______________________________________________" )
4213 main.log.info( "Remove all intents" )
4214 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004215 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004216 main.step( "Obtain the intent id's first" )
4217 intentsList = main.ONOScli1.getAllIntentIds()
4218 ansi_escape = re.compile( r'\x1b[^m]*m' )
4219 intentsList = ansi_escape.sub( '', intentsList )
4220 intentsList = intentsList.replace(
4221 " onos:intents | grep id=",
4222 "" ).replace(
4223 "id=",
4224 "" ).replace(
4225 "\r\r",
4226 "" )
4227 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004228 intentIdList = []
4229 step1Result = main.TRUE
4230 moreIntents = main.TRUE
4231 removeIntentCount = 0
4232 intentsCount = len(intentsList)
4233 main.log.info ( "Current number of intents: " + str(intentsCount) )
4234 if ( len( intentsList ) > 1 ):
4235 results = main.TRUE
4236 main.log.info("Removing intent...")
4237 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004238 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004239 if removeIntentCount == 5:
4240 break
4241 removeIntentCount = removeIntentCount + 1
4242 intentsList1 = main.ONOScli1.getAllIntentIds()
4243 if len( intentsList1 ) == 0:
4244 break
4245 ansi_escape = re.compile( r'\x1b[^m]*m' )
4246 intentsList1 = ansi_escape.sub( '', intentsList1 )
4247 intentsList1 = intentsList1.replace(
4248 " onos:intents | grep id=",
4249 "" ).replace(
4250 " state=",
4251 "" ).replace(
4252 "\r\r",
4253 "" )
4254 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004255 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4256 print intentsList1
4257 intentIdList1 = []
4258 if ( len( intentsList1 ) > 0 ):
4259 moreIntents = main.TRUE
4260 for i in range( len( intentsList1 ) ):
4261 intentsTemp1 = intentsList1[ i ].split( ',' )
4262 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4263 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4264 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4265 time1 = time.time()
4266 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4267 pool = []
4268 for cli in main.CLIs:
4269 if i >= len( intentIdList1 ):
4270 break
4271 t = main.Thread( target=cli.removeIntent,
4272 threadID=main.threadID,
4273 name="removeIntent",
4274 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4275 pool.append(t)
4276 t.start()
4277 i = i + 1
4278 main.threadID = main.threadID + 1
4279 for thread in pool:
4280 thread.join()
4281 intentIdList.append(thread.result)
4282 #time.sleep(2)
4283 time2 = time.time()
4284 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004285 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004286 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004287 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004288 else:
4289 time.sleep(10)
4290 if len( main.ONOScli1.intents()):
4291 continue
4292 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004293 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004294 else:
4295 print "Removed %d intents" %(intentsCount)
4296 step1Result = main.TRUE
4297 else:
4298 print "No Intent IDs found in Intents list: ", intentsList
4299 step1Result = main.FALSE
4300
4301 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004302 caseResult = step1Result
4303 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004304 onpass="Intent removal test successful",
4305 onfail="Intent removal test failed" )
4306
4307 def CASE12( self, main ):
4308 """
4309 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4310 """
4311 import re
4312 import copy
4313 import time
4314
Hari Krishnac195f3b2015-07-08 20:02:24 -07004315 threadID = 0
4316
4317 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4318 main.log.report( "_____________________________________________________" )
4319 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4320 main.step( "Enable intent based Reactive forwarding" )
4321 installResult = main.FALSE
4322 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004323
Hari Krishnac195f3b2015-07-08 20:02:24 -07004324 pool = []
4325 time1 = time.time()
4326 for cli,feature in main.CLIs:
4327 t = main.Thread(target=cli,threadID=threadID,
4328 name="featureInstall",args=[feature])
4329 pool.append(t)
4330 t.start()
4331 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004332
Hari Krishnac195f3b2015-07-08 20:02:24 -07004333 results = []
4334 for thread in pool:
4335 thread.join()
4336 results.append(thread.result)
4337 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004338
Hari Krishnac195f3b2015-07-08 20:02:24 -07004339 if( all(result == main.TRUE for result in results) == False):
4340 main.log.info("Did not install onos-app-ifwd feature properly")
4341 #main.cleanup()
4342 #main.exit()
4343 else:
4344 main.log.info("Successful feature:install onos-app-ifwd")
4345 installResult = main.TRUE
4346 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004347
GlennRC6ac11b12015-10-21 17:41:28 -07004348 main.step( "Verify Ping across all hosts" )
4349 for i in range(main.numPings):
4350 time1 = time.time()
4351 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4352 if not pingResult:
4353 main.log.warn("First pingall failed. Retrying...")
4354 time.sleep(main.pingSleep)
4355 else: break
4356
Hari Krishnac195f3b2015-07-08 20:02:24 -07004357 time2 = time.time()
4358 timeDiff = round( ( time2 - time1 ), 2 )
4359 main.log.report(
4360 "Time taken for Ping All: " +
4361 str( timeDiff ) +
4362 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004363
GlennRC626ba132015-09-18 16:16:31 -07004364 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004365 main.log.report( "Pingall Test in Reactive mode successful" )
4366 else:
4367 main.log.report( "Pingall Test in Reactive mode failed" )
4368
4369 main.step( "Disable Intent based Reactive forwarding" )
4370 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004371
Hari Krishnac195f3b2015-07-08 20:02:24 -07004372 pool = []
4373 time1 = time.time()
4374 for cli,feature in main.CLIs:
4375 t = main.Thread(target=cli,threadID=threadID,
4376 name="featureUninstall",args=[feature])
4377 pool.append(t)
4378 t.start()
4379 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004380
Hari Krishnac195f3b2015-07-08 20:02:24 -07004381 results = []
4382 for thread in pool:
4383 thread.join()
4384 results.append(thread.result)
4385 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004386
Hari Krishnac195f3b2015-07-08 20:02:24 -07004387 if( all(result == main.TRUE for result in results) == False):
4388 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4389 uninstallResult = main.FALSE
4390 #main.cleanup()
4391 #main.exit()
4392 else:
4393 main.log.info("Successful feature:uninstall onos-app-ifwd")
4394 uninstallResult = main.TRUE
4395 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4396
4397 # Waiting for reative flows to be cleared.
4398 time.sleep( 10 )
4399
GlennRCbddd58f2015-10-01 15:45:25 -07004400 caseResult = installResult and pingResult and uninstallResult
4401 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004402 onpass="Intent based Reactive forwarding Pingall test PASS",
4403 onfail="Intent based Reactive forwarding Pingall test FAIL" )