blob: 2b2d1d979df06e8e3a8911525e29175f8f3fec9a [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
401 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
402 main.step( "Store Device DPIDs" )
403 for i in range( 1, (main.numMNswitches+1) ):
GlennRC186b7362015-12-11 18:20:16 -0800404 main.deviceDPIDs.append( "of:" + str(main.prefix) + "0000000000000%02d" % i )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700405 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
406
407 main.step( "Store Host MACs" )
408 for i in range( 1, ( main.numMNhosts + 1 ) ):
409 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
410 print "Host MACs in Store: \n", str( main.hostMACs )
411 main.MACsDict = {}
412 print "Creating dictionary of DPID and HostMacs"
413 for i in range(len(main.hostMACs)):
414 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
415 print main.MACsDict
416 main.step( "Collect and store all Devices Links" )
417 linksResult = main.ONOScli1.links( jsonFormat=False )
418 ansi_escape = re.compile( r'\x1b[^m]*m' )
419 linksResult = ansi_escape.sub( '', linksResult )
420 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
421 linksResult = linksResult.splitlines()
422 main.deviceLinks = copy.copy( linksResult )
423 print "Device Links Stored: \n", str( main.deviceLinks )
424 # this will be asserted to check with the params provided count of
425 # links
426 print "Length of Links Store", len( main.deviceLinks )
427
428 main.step( "Collect and store each Device ports enabled Count" )
429 time1 = time.time()
430 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
431 pool = []
432 for cli in main.CLIs:
433 if i >= main.numMNswitches + 1:
434 break
GlennRC186b7362015-12-11 18:20:16 -0800435 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
Hari Krishnac195f3b2015-07-08 20:02:24 -0700436 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
437 t.start()
438 pool.append(t)
439 i = i + 1
440 main.threadID = main.threadID + 1
441 for thread in pool:
442 thread.join()
443 portResult = thread.result
444 main.devicePortsEnabledCount.append( portResult )
445 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
446 time2 = time.time()
447 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
448
449 main.step( "Collect and store each Device active links Count" )
450 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700451
Hari Krishnac195f3b2015-07-08 20:02:24 -0700452 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
453 pool = []
454 for cli in main.CLIs:
455 if i >= main.numMNswitches + 1:
456 break
GlennRC186b7362015-12-11 18:20:16 -0800457 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
Hari Krishnac195f3b2015-07-08 20:02:24 -0700458 t = main.Thread( target = cli.getDeviceLinksActiveCount,
459 threadID = main.threadID,
460 name = "getDevicePortsEnabledCount",
461 args = [dpid])
462 t.start()
463 pool.append(t)
464 i = i + 1
465 main.threadID = main.threadID + 1
466 for thread in pool:
467 thread.join()
468 linkCountResult = thread.result
469 main.deviceActiveLinksCount.append( linkCountResult )
470 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
471 time2 = time.time()
472 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
473
474 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700475 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700476 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
477 main.log.info("Devices (actual): %s, Links (actual): %s" %
478 ( numOnosDevices , numOnosLinks ) )
479 main.log.info("Topology does not match, exiting CHO test...")
480 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700481 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700482 main.cleanup()
483 main.exit()
484
485 # just returning TRUE for now as this one just collects data
486 case3Result = topoResult
487 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
488 onpass="Saving ONOS topology data test PASS",
489 onfail="Saving ONOS topology data test FAIL" )
490
GlennRC186b7362015-12-11 18:20:16 -0800491
Hari Krishnac195f3b2015-07-08 20:02:24 -0700492 def CASE40( self, main ):
493 """
494 Verify Reactive forwarding (Att Topology)
495 """
496 import re
497 import copy
498 import time
499 main.log.report( "Verify Reactive forwarding (Att Topology)" )
500 main.log.report( "______________________________________________" )
501 main.case( "Enable Reactive forwarding and Verify ping all" )
502 main.step( "Enable Reactive forwarding" )
503 installResult = main.TRUE
504 # Activate fwd app
505 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
506 appCheck = main.TRUE
507 pool = []
508 for cli in main.CLIs:
509 t = main.Thread( target=cli.appToIDCheck,
510 name="appToIDCheck-" + str( i ),
511 args=[] )
512 pool.append( t )
513 t.start()
514 for t in pool:
515 t.join()
516 appCheck = appCheck and t.result
517 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
518 onpass="App Ids seem to be correct",
519 onfail="Something is wrong with app Ids" )
520 if appCheck != main.TRUE:
521 main.log.warn( main.CLIs[0].apps() )
522 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700523
Hari Krishnac195f3b2015-07-08 20:02:24 -0700524 time.sleep( 10 )
525
GlennRC6ac11b12015-10-21 17:41:28 -0700526 main.step( "Verify Ping across all hosts" )
527 for i in range(main.numPings):
528 time1 = time.time()
529 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
530 if not pingResult:
531 main.log.warn("First pingall failed. Retrying...")
532 time.sleep(main.pingSleep)
533 else: break
534
Hari Krishnac195f3b2015-07-08 20:02:24 -0700535 time2 = time.time()
536 timeDiff = round( ( time2 - time1 ), 2 )
537 main.log.report(
538 "Time taken for Ping All: " +
539 str( timeDiff ) +
540 " seconds" )
541
GlennRC626ba132015-09-18 16:16:31 -0700542 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700543 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700544 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700545 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700546
GlennRCbddd58f2015-10-01 15:45:25 -0700547 caseResult = appCheck and pingResult
548 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700549 onpass="Reactive Mode IPv4 Pingall test PASS",
550 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700551
552 def CASE41( self, main ):
553 """
554 Verify Reactive forwarding (Chordal Topology)
555 """
556 import re
557 import copy
558 import time
559 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
560 main.log.report( "______________________________________________" )
561 main.case( "Enable Reactive forwarding and Verify ping all" )
562 main.step( "Enable Reactive forwarding" )
563 installResult = main.TRUE
564 # Activate fwd app
565 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
566
567 appCheck = main.TRUE
568 pool = []
569 for cli in main.CLIs:
570 t = main.Thread( target=cli.appToIDCheck,
571 name="appToIDCheck-" + str( i ),
572 args=[] )
573 pool.append( t )
574 t.start()
575 for t in pool:
576 t.join()
577 appCheck = appCheck and t.result
578 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
579 onpass="App Ids seem to be correct",
580 onfail="Something is wrong with app Ids" )
581 if appCheck != main.TRUE:
582 main.log.warn( main.CLIs[0].apps() )
583 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700584
Hari Krishnac195f3b2015-07-08 20:02:24 -0700585 time.sleep( 10 )
586
GlennRC6ac11b12015-10-21 17:41:28 -0700587 main.step( "Verify Ping across all hosts" )
588 for i in range(main.numPings):
589 time1 = time.time()
590 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
591 if not pingResult:
592 main.log.warn("First pingall failed. Retrying...")
593 time.sleep(main.pingSleep)
594 else: break
595
Hari Krishnac195f3b2015-07-08 20:02:24 -0700596 time2 = time.time()
597 timeDiff = round( ( time2 - time1 ), 2 )
598 main.log.report(
599 "Time taken for Ping All: " +
600 str( timeDiff ) +
601 " seconds" )
602
GlennRC626ba132015-09-18 16:16:31 -0700603 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700604 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700605 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700606 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700607
GlennRCbddd58f2015-10-01 15:45:25 -0700608 caseResult = appCheck and pingResult
609 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700610 onpass="Reactive Mode IPv4 Pingall test PASS",
611 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700612
613 def CASE42( self, main ):
614 """
615 Verify Reactive forwarding (Spine Topology)
616 """
617 import re
618 import copy
619 import time
620 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
621 main.log.report( "______________________________________________" )
622 main.case( "Enable Reactive forwarding and Verify ping all" )
623 main.step( "Enable Reactive forwarding" )
624 installResult = main.TRUE
625 # Activate fwd app
626 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
627
628 appCheck = main.TRUE
629 pool = []
630 for cli in main.CLIs:
631 t = main.Thread( target=cli.appToIDCheck,
632 name="appToIDCheck-" + str( i ),
633 args=[] )
634 pool.append( t )
635 t.start()
636 for t in pool:
637 t.join()
638 appCheck = appCheck and t.result
639 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
640 onpass="App Ids seem to be correct",
641 onfail="Something is wrong with app Ids" )
642 if appCheck != main.TRUE:
643 main.log.warn( main.CLIs[0].apps() )
644 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700645
Hari Krishnac195f3b2015-07-08 20:02:24 -0700646 time.sleep( 10 )
647
GlennRC6ac11b12015-10-21 17:41:28 -0700648 main.step( "Verify Ping across all hosts" )
649 for i in range(main.numPings):
650 time1 = time.time()
651 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
652 if not pingResult:
653 main.log.warn("First pingall failed. Retrying...")
654 time.sleep(main.pingSleep)
655 else: break
656
Hari Krishnac195f3b2015-07-08 20:02:24 -0700657 time2 = time.time()
658 timeDiff = round( ( time2 - time1 ), 2 )
659 main.log.report(
660 "Time taken for Ping All: " +
661 str( timeDiff ) +
662 " seconds" )
663
GlennRC626ba132015-09-18 16:16:31 -0700664 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700665 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700666 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700667 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
668
GlennRCbddd58f2015-10-01 15:45:25 -0700669 caseResult = appCheck and pingResult
670 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700671 onpass="Reactive Mode IPv4 Pingall test PASS",
672 onfail="Reactive Mode IPv4 Pingall test FAIL" )
673
674 def CASE140( self, main ):
675 """
676 Verify IPv6 Reactive forwarding (Att Topology)
677 """
678 import re
679 import copy
680 import time
681 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
682 main.log.report( "______________________________________________" )
683 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
684 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
685
686 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
687 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
688 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
689 cfgResult = cfgResult1 and cfgResult2
690 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
691 onpass="Reactive mode ipv6Fowarding cfg is set to true",
692 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
693
694 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700695 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700696 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700697 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
698 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700699 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700700 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700701 time2 = time.time()
702 timeDiff = round( ( time2 - time1 ), 2 )
703 main.log.report(
704 "Time taken for IPv6 Ping All: " +
705 str( timeDiff ) +
706 " seconds" )
707
GlennRC626ba132015-09-18 16:16:31 -0700708 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700709 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
710 else:
711 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700712
713 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700714
Hari Krishnac195f3b2015-07-08 20:02:24 -0700715 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700716 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700717 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
718 pool = []
719 for cli in main.CLIs:
720 t = main.Thread( target=cli.appToIDCheck,
721 name="appToIDCheck-" + str( i ),
722 args=[] )
723 pool.append( t )
724 t.start()
725
726 for t in pool:
727 t.join()
728 appCheck = appCheck and t.result
729 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
730 onpass="App Ids seem to be correct",
731 onfail="Something is wrong with app Ids" )
732 if appCheck != main.TRUE:
733 main.log.warn( main.CLIs[0].apps() )
734 main.log.warn( main.CLIs[0].appIDs() )
735
736 # Waiting for reative flows to be cleared.
737 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700738 caseResult = appCheck and cfgResult and pingResult
739 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700740 onpass="Reactive Mode IPv6 Pingall test PASS",
741 onfail="Reactive Mode IPv6 Pingall test FAIL" )
742
743 def CASE141( self, main ):
744 """
745 Verify IPv6 Reactive forwarding (Chordal Topology)
746 """
747 import re
748 import copy
749 import time
750 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
751 main.log.report( "______________________________________________" )
752 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
753 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
754
755 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
756 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
757 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
758 cfgResult = cfgResult1 and cfgResult2
759 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
760 onpass="Reactive mode ipv6Fowarding cfg is set to true",
761 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
762
763 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700764 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700765 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700766 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
767 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700768 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700769 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700770 time2 = time.time()
771 timeDiff = round( ( time2 - time1 ), 2 )
772 main.log.report(
773 "Time taken for IPv6 Ping All: " +
774 str( timeDiff ) +
775 " seconds" )
776
GlennRC626ba132015-09-18 16:16:31 -0700777 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700778 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
779 else:
780 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
781
782 main.step( "Disable Reactive forwarding" )
783
784 main.log.info( "Uninstall reactive forwarding app" )
785 appCheck = main.TRUE
786 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
787 pool = []
788 for cli in main.CLIs:
789 t = main.Thread( target=cli.appToIDCheck,
790 name="appToIDCheck-" + str( i ),
791 args=[] )
792 pool.append( t )
793 t.start()
794
795 for t in pool:
796 t.join()
797 appCheck = appCheck and t.result
798 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
799 onpass="App Ids seem to be correct",
800 onfail="Something is wrong with app Ids" )
801 if appCheck != main.TRUE:
802 main.log.warn( main.CLIs[0].apps() )
803 main.log.warn( main.CLIs[0].appIDs() )
804
805 # Waiting for reative flows to be cleared.
806 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700807 caseResult = appCheck and cfgResult and pingResult
808 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700809 onpass="Reactive Mode IPv6 Pingall test PASS",
810 onfail="Reactive Mode IPv6 Pingall test FAIL" )
811
812 def CASE142( self, main ):
813 """
814 Verify IPv6 Reactive forwarding (Spine Topology)
815 """
816 import re
817 import copy
818 import time
819 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
820 main.log.report( "______________________________________________" )
821 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
822 # Spine topology do not have hosts h1-h10
823 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
824 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
825 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
826 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
827 cfgResult = cfgResult1 and cfgResult2
828 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
829 onpass="Reactive mode ipv6Fowarding cfg is set to true",
830 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
831
832 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700833 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700834 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700835 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
836 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700837 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700838 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700839 time2 = time.time()
840 timeDiff = round( ( time2 - time1 ), 2 )
841 main.log.report(
842 "Time taken for IPv6 Ping All: " +
843 str( timeDiff ) +
844 " seconds" )
845
GlennRC626ba132015-09-18 16:16:31 -0700846 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700847 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
848 else:
849 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
850
851 main.step( "Disable Reactive forwarding" )
852
853 main.log.info( "Uninstall reactive forwarding app" )
854 appCheck = main.TRUE
855 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
856 pool = []
857 for cli in main.CLIs:
858 t = main.Thread( target=cli.appToIDCheck,
859 name="appToIDCheck-" + str( i ),
860 args=[] )
861 pool.append( t )
862 t.start()
863
864 for t in pool:
865 t.join()
866 appCheck = appCheck and t.result
867 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
868 onpass="App Ids seem to be correct",
869 onfail="Something is wrong with app Ids" )
870 if appCheck != main.TRUE:
871 main.log.warn( main.CLIs[0].apps() )
872 main.log.warn( main.CLIs[0].appIDs() )
873
874 # Waiting for reative flows to be cleared.
875 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700876 caseResult = appCheck and cfgResult and pingResult
877 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700878 onpass="Reactive Mode IPv6 Pingall test PASS",
879 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700880
881 def CASE5( self, main ):
882 """
883 Compare current ONOS topology with reference data
884 """
885 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700886
Hari Krishnac195f3b2015-07-08 20:02:24 -0700887 devicesDPIDTemp = []
888 hostMACsTemp = []
889 deviceLinksTemp = []
890 deviceActiveLinksCountTemp = []
891 devicePortsEnabledCountTemp = []
892
893 main.log.report(
894 "Compare ONOS topology with reference data in Stores" )
895 main.log.report( "__________________________________________________" )
896 main.case( "Compare ONOS topology with reference data" )
897
898 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700899
GlennRC289c1b62015-12-12 10:45:43 -0800900 for check in range(main.topoCheck):
901 time1 = time.time()
902 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
903 pool = []
904 for cli in main.CLIs:
905 if i >= main.numMNswitches + 1:
906 break
GlennRC2db29952015-12-14 12:00:29 -0800907 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800908 t = main.Thread(target = cli.getDevicePortsEnabledCount,
909 threadID = main.threadID,
910 name = "getDevicePortsEnabledCount",
911 args = [dpid])
912 t.start()
913 pool.append(t)
914 i = i + 1
915 main.threadID = main.threadID + 1
916 for thread in pool:
917 thread.join()
918 portResult = thread.result
919 #portTemp = re.split( r'\t+', portResult )
920 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
921 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -0700922
GlennRC289c1b62015-12-12 10:45:43 -0800923 time2 = time.time()
924 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
925 main.log.info (
926 "Device Enabled ports EXPECTED: %s" %
927 str( main.devicePortsEnabledCount ) )
928 main.log.info (
929 "Device Enabled ports ACTUAL: %s" %
930 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700931
GlennRC289c1b62015-12-12 10:45:43 -0800932 if ( cmp( main.devicePortsEnabledCount,
933 devicePortsEnabledCountTemp ) == 0 ):
934 stepResult1 = main.TRUE
935 else:
936 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700937
GlennRC289c1b62015-12-12 10:45:43 -0800938 main.step( "Compare Device active links with reference" )
939 time1 = time.time()
940 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
941 pool = []
942 for cli in main.CLIs:
943 if i >= main.numMNswitches + 1:
944 break
GlennRC2db29952015-12-14 12:00:29 -0800945 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800946 t = main.Thread(target = cli.getDeviceLinksActiveCount,
947 threadID = main.threadID,
948 name = "getDeviceLinksActiveCount",
949 args = [dpid])
950 t.start()
951 pool.append(t)
952 i = i + 1
953 main.threadID = main.threadID + 1
954 for thread in pool:
955 thread.join()
956 linkCountResult = thread.result
957 #linkCountTemp = re.split( r'\t+', linkCountResult )
958 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
959 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700960
GlennRC289c1b62015-12-12 10:45:43 -0800961 time2 = time.time()
962 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
963 main.log.info (
964 "Device Active links EXPECTED: %s" %
965 str( main.deviceActiveLinksCount ) )
966 main.log.info (
967 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
968 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
969 stepResult2 = main.TRUE
970 else:
971 stepResult2 = main.FALSE
972
973 """
974 place holder for comparing devices, hosts, paths and intents if required.
975 Links and ports data would be incorrect with out devices anyways.
976 """
977 caseResult = ( stepResult1 and stepResult2 )
978
979 if caseResult:
980 break
981 else:
982 time.sleep( main.topoCheckDelay )
983 main.log.warn( "Topology check failed. Trying again..." )
984
985
986 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700987 onpass="Compare Topology test PASS",
988 onfail="Compare Topology test FAIL" )
989
990 def CASE60( self ):
991 """
992 Install 300 host intents and verify ping all (Att Topology)
993 """
994 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
995 main.log.report( "_______________________________________" )
996 import itertools
997 import time
998 main.case( "Install 300 host intents" )
999 main.step( "Add host Intents" )
1000 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001001 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1002
Hari Krishnac195f3b2015-07-08 20:02:24 -07001003 intentIdList = []
1004 time1 = time.time()
1005 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1006 pool = []
1007 for cli in main.CLIs:
1008 if i >= len( hostCombos ):
1009 break
1010 t = main.Thread( target=cli.addHostIntent,
1011 threadID=main.threadID,
1012 name="addHostIntent",
1013 args=[hostCombos[i][0],hostCombos[i][1]])
1014 pool.append(t)
1015 t.start()
1016 i = i + 1
1017 main.threadID = main.threadID + 1
1018 for thread in pool:
1019 thread.join()
1020 intentIdList.append(thread.result)
1021 time2 = time.time()
1022 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1023
GlennRCfcfdc4f2015-09-30 16:01:57 -07001024 # Saving intent ids to check intents in later cases
1025 main.intentIds = list(intentIdList)
1026
GlennRCa8d786a2015-09-23 17:40:11 -07001027 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001028
GlennRC1dde1712015-10-02 11:03:08 -07001029 # Giving onos multiple chances to install intents
1030 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001031 if i != 0:
1032 main.log.warn( "Verification failed. Retrying..." )
1033 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001034 time.sleep( main.checkIntentsDelay )
1035
1036 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001037 for e in range(int(main.numCtrls)):
1038 main.log.info( "Checking intents on CLI %s" % (e+1) )
1039 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1040 intentState
1041 if not intentState:
1042 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001043 if intentState:
1044 break
GlennRCdb2c8422015-09-29 12:21:59 -07001045 else:
1046 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001047 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001048
GlennRCa8d786a2015-09-23 17:40:11 -07001049
1050 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1051 onpass="INTENTS INSTALLED",
1052 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001053
1054 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001055 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001056 time1 = time.time()
1057 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001058 if not pingResult:
1059 main.log.warn("First pingall failed. Retrying...")
1060 time.sleep(3)
1061 else: break
1062
Hari Krishnac195f3b2015-07-08 20:02:24 -07001063 time2 = time.time()
1064 timeDiff = round( ( time2 - time1 ), 2 )
1065 main.log.report(
1066 "Time taken for Ping All: " +
1067 str( timeDiff ) +
1068 " seconds" )
1069 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1070 onpass="PING ALL PASS",
1071 onfail="PING ALL FAIL" )
1072
GlennRCbddd58f2015-10-01 15:45:25 -07001073 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001074 utilities.assert_equals(
1075 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001076 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001077 onpass="Install 300 Host Intents and Ping All test PASS",
1078 onfail="Install 300 Host Intents and Ping All test FAIL" )
1079
GlennRCfcfdc4f2015-09-30 16:01:57 -07001080 if not intentState:
1081 main.log.debug( "Intents failed to install completely" )
1082 if not pingResult:
1083 main.log.debug( "Pingall failed" )
1084
GlennRCbddd58f2015-10-01 15:45:25 -07001085 if not caseResult and main.failSwitch:
1086 main.log.report("Stopping test")
1087 main.stop( email=main.emailOnStop )
1088
Hari Krishnac195f3b2015-07-08 20:02:24 -07001089 def CASE61( self ):
1090 """
1091 Install 600 host intents and verify ping all for Chordal Topology
1092 """
1093 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1094 main.log.report( "_______________________________________" )
1095 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001096
Hari Krishnac195f3b2015-07-08 20:02:24 -07001097 main.case( "Install 600 host intents" )
1098 main.step( "Add host Intents" )
1099 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001100 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1101
Hari Krishnac195f3b2015-07-08 20:02:24 -07001102 intentIdList = []
1103 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001104
Hari Krishnac195f3b2015-07-08 20:02:24 -07001105 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1106 pool = []
1107 for cli in main.CLIs:
1108 if i >= len( hostCombos ):
1109 break
1110 t = main.Thread( target=cli.addHostIntent,
1111 threadID=main.threadID,
1112 name="addHostIntent",
1113 args=[hostCombos[i][0],hostCombos[i][1]])
1114 pool.append(t)
1115 t.start()
1116 i = i + 1
1117 main.threadID = main.threadID + 1
1118 for thread in pool:
1119 thread.join()
1120 intentIdList.append(thread.result)
1121 time2 = time.time()
1122 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001123
GlennRCfcfdc4f2015-09-30 16:01:57 -07001124 # Saving intent ids to check intents in later cases
1125 main.intentIds = list(intentIdList)
1126
GlennRCa8d786a2015-09-23 17:40:11 -07001127 main.step("Verify intents are installed")
1128
GlennRC1dde1712015-10-02 11:03:08 -07001129 # Giving onos multiple chances to install intents
1130 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001131 if i != 0:
1132 main.log.warn( "Verification failed. Retrying..." )
1133 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001134 time.sleep( main.checkIntentsDelay )
1135
1136 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001137 for e in range(int(main.numCtrls)):
1138 main.log.info( "Checking intents on CLI %s" % (e+1) )
1139 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1140 intentState
1141 if not intentState:
1142 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001143 if intentState:
1144 break
GlennRCdb2c8422015-09-29 12:21:59 -07001145 else:
1146 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001147 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001148
1149 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1150 onpass="INTENTS INSTALLED",
1151 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001152
1153 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001154 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001155 time1 = time.time()
1156 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001157 if not pingResult:
1158 main.log.warn("First pingall failed. Retrying...")
1159 time.sleep(main.pingSleep)
1160 else: break
1161
Hari Krishnac195f3b2015-07-08 20:02:24 -07001162 time2 = time.time()
1163 timeDiff = round( ( time2 - time1 ), 2 )
1164 main.log.report(
1165 "Time taken for Ping All: " +
1166 str( timeDiff ) +
1167 " seconds" )
1168 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1169 onpass="PING ALL PASS",
1170 onfail="PING ALL FAIL" )
1171
GlennRCbddd58f2015-10-01 15:45:25 -07001172 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001173
Hari Krishnac195f3b2015-07-08 20:02:24 -07001174 utilities.assert_equals(
1175 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001176 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001177 onpass="Install 300 Host Intents and Ping All test PASS",
1178 onfail="Install 300 Host Intents and Ping All test FAIL" )
1179
GlennRCfcfdc4f2015-09-30 16:01:57 -07001180 if not intentState:
1181 main.log.debug( "Intents failed to install completely" )
1182 if not pingResult:
1183 main.log.debug( "Pingall failed" )
1184
GlennRCbddd58f2015-10-01 15:45:25 -07001185 if not caseResult and main.failSwitch:
1186 main.log.report("Stopping test")
1187 main.stop( email=main.emailOnStop )
1188
Hari Krishnac195f3b2015-07-08 20:02:24 -07001189 def CASE62( self ):
1190 """
1191 Install 2278 host intents and verify ping all for Spine Topology
1192 """
1193 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1194 main.log.report( "_______________________________________" )
1195 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001196
Hari Krishnac195f3b2015-07-08 20:02:24 -07001197 main.case( "Install 2278 host intents" )
1198 main.step( "Add host Intents" )
1199 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001200 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001201 main.pingTimeout = 300
1202 intentIdList = []
1203 time1 = time.time()
1204 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1205 pool = []
1206 for cli in main.CLIs:
1207 if i >= len( hostCombos ):
1208 break
1209 t = main.Thread( target=cli.addHostIntent,
1210 threadID=main.threadID,
1211 name="addHostIntent",
1212 args=[hostCombos[i][0],hostCombos[i][1]])
1213 pool.append(t)
1214 t.start()
1215 i = i + 1
1216 main.threadID = main.threadID + 1
1217 for thread in pool:
1218 thread.join()
1219 intentIdList.append(thread.result)
1220 time2 = time.time()
1221 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001222
GlennRCfcfdc4f2015-09-30 16:01:57 -07001223 # Saving intent ids to check intents in later cases
1224 main.intentIds = list(intentIdList)
1225
GlennRCa8d786a2015-09-23 17:40:11 -07001226 main.step("Verify intents are installed")
1227
GlennRC1dde1712015-10-02 11:03:08 -07001228 # Giving onos multiple chances to install intents
1229 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001230 if i != 0:
1231 main.log.warn( "Verification failed. Retrying..." )
1232 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001233 time.sleep( main.checkIntentsDelay )
1234
1235 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001236 for e in range(int(main.numCtrls)):
1237 main.log.info( "Checking intents on CLI %s" % (e+1) )
1238 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1239 intentState
1240 if not intentState:
1241 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001242 if intentState:
1243 break
GlennRCdb2c8422015-09-29 12:21:59 -07001244 else:
1245 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001246 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001247
1248 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1249 onpass="INTENTS INSTALLED",
1250 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001251
1252 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001253 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001254 time1 = time.time()
1255 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001256 if not pingResult:
1257 main.log.warn("First pingall failed. Retrying...")
1258 time.sleep(main.pingSleep)
1259 else: break
1260
Hari Krishnac195f3b2015-07-08 20:02:24 -07001261 time2 = time.time()
1262 timeDiff = round( ( time2 - time1 ), 2 )
1263 main.log.report(
1264 "Time taken for Ping All: " +
1265 str( timeDiff ) +
1266 " seconds" )
1267 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1268 onpass="PING ALL PASS",
1269 onfail="PING ALL FAIL" )
1270
GlennRCbddd58f2015-10-01 15:45:25 -07001271 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001272
Hari Krishnac195f3b2015-07-08 20:02:24 -07001273 utilities.assert_equals(
1274 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001275 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001276 onpass="Install 2278 Host Intents and Ping All test PASS",
1277 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1278
GlennRCfcfdc4f2015-09-30 16:01:57 -07001279 if not intentState:
1280 main.log.debug( "Intents failed to install completely" )
1281 if not pingResult:
1282 main.log.debug( "Pingall failed" )
1283
GlennRCbddd58f2015-10-01 15:45:25 -07001284 if not caseResult and main.failSwitch:
1285 main.log.report("Stopping test")
1286 main.stop( email=main.emailOnStop )
1287
Hari Krishna4223dbd2015-08-13 16:29:53 -07001288 def CASE160( self ):
1289 """
1290 Verify IPv6 ping across 300 host intents (Att Topology)
1291 """
1292 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1293 main.log.report( "_________________________________________________" )
1294 import itertools
1295 import time
1296 main.case( "IPv6 ping all 300 host intents" )
1297 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001298 pingResult = main.FALSE
1299 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001300 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001301 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001302 main.log.warn("First pingall failed. Retrying...")
1303 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001304 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001305 time2 = time.time()
1306 timeDiff = round( ( time2 - time1 ), 2 )
1307 main.log.report(
1308 "Time taken for IPv6 Ping All: " +
1309 str( timeDiff ) +
1310 " seconds" )
1311 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1312 onpass="PING ALL PASS",
1313 onfail="PING ALL FAIL" )
1314
GlennRCbddd58f2015-10-01 15:45:25 -07001315 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001316 utilities.assert_equals(
1317 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001318 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001319 onpass="IPv6 Ping across 300 host intents test PASS",
1320 onfail="IPv6 Ping across 300 host intents test FAIL" )
1321
1322 def CASE161( self ):
1323 """
1324 Verify IPv6 ping across 600 host intents (Chordal Topology)
1325 """
1326 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1327 main.log.report( "_________________________________________________" )
1328 import itertools
1329 import time
1330 main.case( "IPv6 ping all 600 host intents" )
1331 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001332 pingResult = main.FALSE
1333 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001334 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001335 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001336 main.log.warn("First pingall failed. Retrying...")
1337 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001338 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001339 time2 = time.time()
1340 timeDiff = round( ( time2 - time1 ), 2 )
1341 main.log.report(
1342 "Time taken for IPv6 Ping All: " +
1343 str( timeDiff ) +
1344 " seconds" )
1345 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1346 onpass="PING ALL PASS",
1347 onfail="PING ALL FAIL" )
1348
GlennRCbddd58f2015-10-01 15:45:25 -07001349 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001350 utilities.assert_equals(
1351 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001352 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001353 onpass="IPv6 Ping across 600 host intents test PASS",
1354 onfail="IPv6 Ping across 600 host intents test FAIL" )
1355
1356 def CASE162( self ):
1357 """
1358 Verify IPv6 ping across 2278 host intents (Spine Topology)
1359 """
1360 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1361 main.log.report( "_________________________________________________" )
1362 import itertools
1363 import time
1364 main.case( "IPv6 ping all 600 host intents" )
1365 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001366 pingResult = main.FALSE
1367 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001368 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001369 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001370 main.log.warn("First pingall failed. Retrying...")
1371 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001372 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001373 time2 = time.time()
1374 timeDiff = round( ( time2 - time1 ), 2 )
1375 main.log.report(
1376 "Time taken for IPv6 Ping All: " +
1377 str( timeDiff ) +
1378 " seconds" )
1379 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1380 onpass="PING ALL PASS",
1381 onfail="PING ALL FAIL" )
1382
GlennRCbddd58f2015-10-01 15:45:25 -07001383 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001384 utilities.assert_equals(
1385 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001386 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001387 onpass="IPv6 Ping across 600 host intents test PASS",
1388 onfail="IPv6 Ping across 600 host intents test FAIL" )
1389
Hari Krishnac195f3b2015-07-08 20:02:24 -07001390 def CASE70( self, main ):
1391 """
1392 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1393 """
1394 import random
1395 main.randomLink1 = []
1396 main.randomLink2 = []
1397 main.randomLink3 = []
1398 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1399 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1400 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1401 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1402 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1403 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1404 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1405 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1406
1407 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1408 main.log.report( "___________________________________________________________________________" )
1409 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1410 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1411 if ( int( switchLinksToToggle ) ==
1412 0 or int( switchLinksToToggle ) > 5 ):
1413 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1414 #main.cleanup()
1415 #main.exit()
1416 else:
1417 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1418
1419 main.step( "Cut links on Core devices using user provided range" )
1420 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1421 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1422 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1423 for i in range( int( switchLinksToToggle ) ):
1424 main.Mininet1.link(
1425 END1=link1End1,
1426 END2=main.randomLink1[ i ],
1427 OPTION="down" )
1428 time.sleep( link_sleep )
1429 main.Mininet1.link(
1430 END1=link2End1,
1431 END2=main.randomLink2[ i ],
1432 OPTION="down" )
1433 time.sleep( link_sleep )
1434 main.Mininet1.link(
1435 END1=link3End1,
1436 END2=main.randomLink3[ i ],
1437 OPTION="down" )
1438 time.sleep( link_sleep )
1439
Hari Krishna6185fc12015-07-13 15:42:31 -07001440 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001441 linkDown = main.ONOSbench.checkStatus(
1442 topology_output, main.numMNswitches, str(
1443 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1444 utilities.assert_equals(
1445 expect=main.TRUE,
1446 actual=linkDown,
1447 onpass="Link Down discovered properly",
1448 onfail="Link down was not discovered in " +
1449 str( link_sleep ) +
1450 " seconds" )
1451
GlennRCfcfdc4f2015-09-30 16:01:57 -07001452 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001453 # Giving onos multiple chances to install intents
1454 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001455 if i != 0:
1456 main.log.warn( "Verification failed. Retrying..." )
1457 main.log.info("Giving onos some time...")
1458 time.sleep( main.checkIntentsDelay )
1459
1460 intentState = main.TRUE
1461 for e in range(int(main.numCtrls)):
1462 main.log.info( "Checking intents on CLI %s" % (e+1) )
1463 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1464 intentState
1465 if not intentState:
1466 main.log.warn( "Not all intents installed" )
1467 if intentState:
1468 break
1469 else:
1470 #Dumping intent summary
1471 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1472
1473
1474 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1475 onpass="INTENTS INSTALLED",
1476 onfail="SOME INTENTS NOT INSTALLED" )
1477
Hari Krishnac195f3b2015-07-08 20:02:24 -07001478 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001479 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001480 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001481 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1482 if not pingResult:
1483 main.log.warn("First pingall failed. Retrying...")
1484 time.sleep(main.pingSleep)
1485 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001486
Hari Krishnac195f3b2015-07-08 20:02:24 -07001487 time2 = time.time()
1488 timeDiff = round( ( time2 - time1 ), 2 )
1489 main.log.report(
1490 "Time taken for Ping All: " +
1491 str( timeDiff ) +
1492 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001493 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001494 onpass="PING ALL PASS",
1495 onfail="PING ALL FAIL" )
1496
GlennRCbddd58f2015-10-01 15:45:25 -07001497 caseResult = linkDown and pingResult and intentState
1498 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001499 onpass="Random Link cut Test PASS",
1500 onfail="Random Link cut Test FAIL" )
1501
GlennRCfcfdc4f2015-09-30 16:01:57 -07001502 # Printing what exactly failed
1503 if not linkDown:
1504 main.log.debug( "Link down was not discovered correctly" )
1505 if not pingResult:
1506 main.log.debug( "Pingall failed" )
1507 if not intentState:
1508 main.log.debug( "Intents are not all installed" )
1509
GlennRCbddd58f2015-10-01 15:45:25 -07001510 if not caseResult and main.failSwitch:
1511 main.log.report("Stopping test")
1512 main.stop( email=main.emailOnStop )
1513
Hari Krishnac195f3b2015-07-08 20:02:24 -07001514 def CASE80( self, main ):
1515 """
1516 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1517 """
1518 import random
1519 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1520 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1521 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1522 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1523 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1524
1525 main.log.report(
1526 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1527 main.log.report(
1528 "__________________________________________________________________" )
1529 main.case(
1530 "Host intents - Bring the core links up that are down and verify ping all" )
1531 main.step( "Bring randomly cut links on Core devices up" )
1532 for i in range( int( switchLinksToToggle ) ):
1533 main.Mininet1.link(
1534 END1=link1End1,
1535 END2=main.randomLink1[ i ],
1536 OPTION="up" )
1537 time.sleep( link_sleep )
1538 main.Mininet1.link(
1539 END1=link2End1,
1540 END2=main.randomLink2[ i ],
1541 OPTION="up" )
1542 time.sleep( link_sleep )
1543 main.Mininet1.link(
1544 END1=link3End1,
1545 END2=main.randomLink3[ i ],
1546 OPTION="up" )
1547 time.sleep( link_sleep )
1548
Hari Krishna6185fc12015-07-13 15:42:31 -07001549 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001550 linkUp = main.ONOSbench.checkStatus(
1551 topology_output,
1552 main.numMNswitches,
1553 str( main.numMNlinks ) )
1554 utilities.assert_equals(
1555 expect=main.TRUE,
1556 actual=linkUp,
1557 onpass="Link up discovered properly",
1558 onfail="Link up was not discovered in " +
1559 str( link_sleep ) +
1560 " seconds" )
1561
GlennRCfcfdc4f2015-09-30 16:01:57 -07001562 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001563 # Giving onos multiple chances to install intents
1564 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001565 if i != 0:
1566 main.log.warn( "Verification failed. Retrying..." )
1567 main.log.info("Giving onos some time...")
1568 time.sleep( main.checkIntentsDelay )
1569
1570 intentState = main.TRUE
1571 for e in range(int(main.numCtrls)):
1572 main.log.info( "Checking intents on CLI %s" % (e+1) )
1573 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1574 intentState
1575 if not intentState:
1576 main.log.warn( "Not all intents installed" )
1577 if intentState:
1578 break
1579 else:
1580 #Dumping intent summary
1581 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1582
1583
1584 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1585 onpass="INTENTS INSTALLED",
1586 onfail="SOME INTENTS NOT INSTALLED" )
1587
Hari Krishnac195f3b2015-07-08 20:02:24 -07001588 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001589 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001590 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001591 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1592 if not pingResult:
1593 main.log.warn("First pingall failed. Retrying...")
1594 time.sleep(main.pingSleep)
1595 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001596
Hari Krishnac195f3b2015-07-08 20:02:24 -07001597 time2 = time.time()
1598 timeDiff = round( ( time2 - time1 ), 2 )
1599 main.log.report(
1600 "Time taken for Ping All: " +
1601 str( timeDiff ) +
1602 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001603 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001604 onpass="PING ALL PASS",
1605 onfail="PING ALL FAIL" )
1606
GlennRCbddd58f2015-10-01 15:45:25 -07001607 caseResult = linkUp and pingResult
1608 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001609 onpass="Link Up Test PASS",
1610 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001611 # Printing what exactly failed
1612 if not linkUp:
1613 main.log.debug( "Link down was not discovered correctly" )
1614 if not pingResult:
1615 main.log.debug( "Pingall failed" )
1616 if not intentState:
1617 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001618
GlennRCbddd58f2015-10-01 15:45:25 -07001619 if not caseResult and main.failSwitch:
1620 main.log.report("Stopping test")
1621 main.stop( email=main.emailOnStop )
1622
Hari Krishnac195f3b2015-07-08 20:02:24 -07001623 def CASE71( self, main ):
1624 """
1625 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1626 """
1627 import random
1628 main.randomLink1 = []
1629 main.randomLink2 = []
1630 main.randomLink3 = []
1631 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1632 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1633 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1634 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1635 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1636 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1637 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1638 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1639
1640 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1641 main.log.report( "___________________________________________________________________________" )
1642 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1643 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1644 if ( int( switchLinksToToggle ) ==
1645 0 or int( switchLinksToToggle ) > 5 ):
1646 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1647 #main.cleanup()
1648 #main.exit()
1649 else:
1650 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1651
1652 main.step( "Cut links on Core devices using user provided range" )
1653 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1654 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1655 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1656 for i in range( int( switchLinksToToggle ) ):
1657 main.Mininet1.link(
1658 END1=link1End1,
1659 END2=main.randomLink1[ i ],
1660 OPTION="down" )
1661 time.sleep( link_sleep )
1662 main.Mininet1.link(
1663 END1=link2End1,
1664 END2=main.randomLink2[ i ],
1665 OPTION="down" )
1666 time.sleep( link_sleep )
1667 main.Mininet1.link(
1668 END1=link3End1,
1669 END2=main.randomLink3[ i ],
1670 OPTION="down" )
1671 time.sleep( link_sleep )
1672
Hari Krishna6185fc12015-07-13 15:42:31 -07001673 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001674 linkDown = main.ONOSbench.checkStatus(
1675 topology_output, main.numMNswitches, str(
1676 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1677 utilities.assert_equals(
1678 expect=main.TRUE,
1679 actual=linkDown,
1680 onpass="Link Down discovered properly",
1681 onfail="Link down was not discovered in " +
1682 str( link_sleep ) +
1683 " seconds" )
1684
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001686 # Giving onos multiple chances to install intents
1687 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001688 if i != 0:
1689 main.log.warn( "Verification failed. Retrying..." )
1690 main.log.info("Giving onos some time...")
1691 time.sleep( main.checkIntentsDelay )
1692
1693 intentState = main.TRUE
1694 for e in range(int(main.numCtrls)):
1695 main.log.info( "Checking intents on CLI %s" % (e+1) )
1696 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1697 intentState
1698 if not intentState:
1699 main.log.warn( "Not all intents installed" )
1700 if intentState:
1701 break
1702 else:
1703 #Dumping intent summary
1704 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1705
1706
1707 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1708 onpass="INTENTS INSTALLED",
1709 onfail="SOME INTENTS NOT INSTALLED" )
1710
Hari Krishnac195f3b2015-07-08 20:02:24 -07001711 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001712 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001713 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001714 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1715 if not pingResult:
1716 main.log.warn("First pingall failed. Retrying...")
1717 time.sleep(main.pingSleep)
1718 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001719
Hari Krishnac195f3b2015-07-08 20:02:24 -07001720 time2 = time.time()
1721 timeDiff = round( ( time2 - time1 ), 2 )
1722 main.log.report(
1723 "Time taken for Ping All: " +
1724 str( timeDiff ) +
1725 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001726 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001727 onpass="PING ALL PASS",
1728 onfail="PING ALL FAIL" )
1729
GlennRCbddd58f2015-10-01 15:45:25 -07001730 caseResult = linkDown and pingResult and intentState
1731 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001732 onpass="Random Link cut Test PASS",
1733 onfail="Random Link cut Test FAIL" )
1734
GlennRCfcfdc4f2015-09-30 16:01:57 -07001735 # Printing what exactly failed
1736 if not linkDown:
1737 main.log.debug( "Link down was not discovered correctly" )
1738 if not pingResult:
1739 main.log.debug( "Pingall failed" )
1740 if not intentState:
1741 main.log.debug( "Intents are not all installed" )
1742
GlennRCbddd58f2015-10-01 15:45:25 -07001743 if not caseResult and main.failSwitch:
1744 main.log.report("Stopping test")
1745 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001746
Hari Krishnac195f3b2015-07-08 20:02:24 -07001747 def CASE81( self, main ):
1748 """
1749 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1750 """
1751 import random
1752 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1753 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1754 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1755 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1756 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1757
1758 main.log.report(
1759 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1760 main.log.report(
1761 "__________________________________________________________________" )
1762 main.case(
1763 "Point intents - Bring the core links up that are down and verify ping all" )
1764 main.step( "Bring randomly cut links on Core devices up" )
1765 for i in range( int( switchLinksToToggle ) ):
1766 main.Mininet1.link(
1767 END1=link1End1,
1768 END2=main.randomLink1[ i ],
1769 OPTION="up" )
1770 time.sleep( link_sleep )
1771 main.Mininet1.link(
1772 END1=link2End1,
1773 END2=main.randomLink2[ i ],
1774 OPTION="up" )
1775 time.sleep( link_sleep )
1776 main.Mininet1.link(
1777 END1=link3End1,
1778 END2=main.randomLink3[ i ],
1779 OPTION="up" )
1780 time.sleep( link_sleep )
1781
Hari Krishna6185fc12015-07-13 15:42:31 -07001782 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001783 linkUp = main.ONOSbench.checkStatus(
1784 topology_output,
1785 main.numMNswitches,
1786 str( main.numMNlinks ) )
1787 utilities.assert_equals(
1788 expect=main.TRUE,
1789 actual=linkUp,
1790 onpass="Link up discovered properly",
1791 onfail="Link up was not discovered in " +
1792 str( link_sleep ) +
1793 " seconds" )
1794
GlennRCfcfdc4f2015-09-30 16:01:57 -07001795 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001796 # Giving onos multiple chances to install intents
1797 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001798 if i != 0:
1799 main.log.warn( "Verification failed. Retrying..." )
1800 main.log.info("Giving onos some time...")
1801 time.sleep( main.checkIntentsDelay )
1802
1803 intentState = main.TRUE
1804 for e in range(int(main.numCtrls)):
1805 main.log.info( "Checking intents on CLI %s" % (e+1) )
1806 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1807 intentState
1808 if not intentState:
1809 main.log.warn( "Not all intents installed" )
1810 if intentState:
1811 break
1812 else:
1813 #Dumping intent summary
1814 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1815
1816
1817 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1818 onpass="INTENTS INSTALLED",
1819 onfail="SOME INTENTS NOT INSTALLED" )
1820
Hari Krishnac195f3b2015-07-08 20:02:24 -07001821 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001822 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001823 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001824 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1825 if not pingResult:
1826 main.log.warn("First pingall failed. Retrying...")
1827 time.sleep(main.pingSleep)
1828 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001829
Hari Krishnac195f3b2015-07-08 20:02:24 -07001830 time2 = time.time()
1831 timeDiff = round( ( time2 - time1 ), 2 )
1832 main.log.report(
1833 "Time taken for Ping All: " +
1834 str( timeDiff ) +
1835 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001836 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001837 onpass="PING ALL PASS",
1838 onfail="PING ALL FAIL" )
1839
GlennRCbddd58f2015-10-01 15:45:25 -07001840 caseResult = linkUp and pingResult
1841 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001842 onpass="Link Up Test PASS",
1843 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001844 # Printing what exactly failed
1845 if not linkUp:
1846 main.log.debug( "Link down was not discovered correctly" )
1847 if not pingResult:
1848 main.log.debug( "Pingall failed" )
1849 if not intentState:
1850 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001851
GlennRCbddd58f2015-10-01 15:45:25 -07001852 if not caseResult and main.failSwitch:
1853 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001854 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001855
Hari Krishnac195f3b2015-07-08 20:02:24 -07001856 def CASE72( self, main ):
1857 """
1858 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1859 """
1860 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001861 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001862 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001863
Hari Krishnac195f3b2015-07-08 20:02:24 -07001864 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1865 main.log.report( "___________________________________________________________________________" )
1866 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1867 switches = []
1868 switchesComb = []
1869 for i in range( main.numMNswitches ):
1870 switches.append('s%d'%(i+1))
1871 switchesLinksComb = list(itertools.combinations(switches,2))
1872 main.randomLinks = random.sample(switchesLinksComb, 5 )
1873 print main.randomLinks
1874 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001875
Hari Krishnac195f3b2015-07-08 20:02:24 -07001876 for switch in main.randomLinks:
1877 main.Mininet1.link(
1878 END1=switch[0],
1879 END2=switch[1],
1880 OPTION="down")
1881 time.sleep( link_sleep )
1882
Hari Krishna6185fc12015-07-13 15:42:31 -07001883 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001884 linkDown = main.ONOSbench.checkStatus(
1885 topology_output, main.numMNswitches, str(
1886 int( main.numMNlinks ) - 5 * 2 ) )
1887 utilities.assert_equals(
1888 expect=main.TRUE,
1889 actual=linkDown,
1890 onpass="Link Down discovered properly",
1891 onfail="Link down was not discovered in " +
1892 str( link_sleep ) +
1893 " seconds" )
1894
GlennRCfcfdc4f2015-09-30 16:01:57 -07001895 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001896 # Giving onos multiple chances to install intents
1897 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001898 if i != 0:
1899 main.log.warn( "Verification failed. Retrying..." )
1900 main.log.info("Giving onos some time...")
1901 time.sleep( main.checkIntentsDelay )
1902
1903 intentState = main.TRUE
1904 for e in range(int(main.numCtrls)):
1905 main.log.info( "Checking intents on CLI %s" % (e+1) )
1906 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1907 intentState
1908 if not intentState:
1909 main.log.warn( "Not all intents installed" )
1910 if intentState:
1911 break
1912 else:
1913 #Dumping intent summary
1914 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1915
1916
1917 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1918 onpass="INTENTS INSTALLED",
1919 onfail="SOME INTENTS NOT INSTALLED" )
1920
Hari Krishnac195f3b2015-07-08 20:02:24 -07001921 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001922 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001923 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001924 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1925 if not pingResult:
1926 main.log.warn("First pingall failed. Retrying...")
1927 time.sleep(main.pingSleep)
1928 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001929
Hari Krishnac195f3b2015-07-08 20:02:24 -07001930 time2 = time.time()
1931 timeDiff = round( ( time2 - time1 ), 2 )
1932 main.log.report(
1933 "Time taken for Ping All: " +
1934 str( timeDiff ) +
1935 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001936 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001937 onpass="PING ALL PASS",
1938 onfail="PING ALL FAIL" )
1939
GlennRCbddd58f2015-10-01 15:45:25 -07001940 caseResult = linkDown and pingResult and intentState
1941 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001942 onpass="Random Link cut Test PASS",
1943 onfail="Random Link cut Test FAIL" )
1944
GlennRCfcfdc4f2015-09-30 16:01:57 -07001945 # Printing what exactly failed
1946 if not linkDown:
1947 main.log.debug( "Link down was not discovered correctly" )
1948 if not pingResult:
1949 main.log.debug( "Pingall failed" )
1950 if not intentState:
1951 main.log.debug( "Intents are not all installed" )
1952
GlennRCbddd58f2015-10-01 15:45:25 -07001953 if not caseResult and main.failSwitch:
1954 main.log.report("Stopping test")
1955 main.stop( email=main.emailOnStop )
1956
Hari Krishnac195f3b2015-07-08 20:02:24 -07001957 def CASE82( self, main ):
1958 """
1959 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1960 """
1961 import random
1962 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001963
Hari Krishnac195f3b2015-07-08 20:02:24 -07001964 main.log.report(
1965 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1966 main.log.report(
1967 "__________________________________________________________________" )
1968 main.case(
1969 "Host intents - Bring the core links up that are down and verify ping all" )
1970 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001971
Hari Krishnac195f3b2015-07-08 20:02:24 -07001972 for switch in main.randomLinks:
1973 main.Mininet1.link(
1974 END1=switch[0],
1975 END2=switch[1],
1976 OPTION="up")
1977 time.sleep( link_sleep )
1978
Hari Krishna6185fc12015-07-13 15:42:31 -07001979 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001980 linkUp = main.ONOSbench.checkStatus(
1981 topology_output,
1982 main.numMNswitches,
1983 str( main.numMNlinks ) )
1984 utilities.assert_equals(
1985 expect=main.TRUE,
1986 actual=linkUp,
1987 onpass="Link up discovered properly",
1988 onfail="Link up was not discovered in " +
1989 str( link_sleep ) +
1990 " seconds" )
1991
GlennRCfcfdc4f2015-09-30 16:01:57 -07001992 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001993 # Giving onos multiple chances to install intents
1994 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001995 if i != 0:
1996 main.log.warn( "Verification failed. Retrying..." )
1997 main.log.info("Giving onos some time...")
1998 time.sleep( main.checkIntentsDelay )
1999
2000 intentState = main.TRUE
2001 for e in range(int(main.numCtrls)):
2002 main.log.info( "Checking intents on CLI %s" % (e+1) )
2003 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2004 intentState
2005 if not intentState:
2006 main.log.warn( "Not all intents installed" )
2007 if intentState:
2008 break
2009 else:
2010 #Dumping intent summary
2011 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2012
2013
2014 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2015 onpass="INTENTS INSTALLED",
2016 onfail="SOME INTENTS NOT INSTALLED" )
2017
Hari Krishnac195f3b2015-07-08 20:02:24 -07002018 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002019 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002020 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002021 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2022 if not pingResult:
2023 main.log.warn("First pingall failed. Retrying...")
2024 time.sleep(main.pingSleep)
2025 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002026
Hari Krishnac195f3b2015-07-08 20:02:24 -07002027 time2 = time.time()
2028 timeDiff = round( ( time2 - time1 ), 2 )
2029 main.log.report(
2030 "Time taken for Ping All: " +
2031 str( timeDiff ) +
2032 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002033 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002034 onpass="PING ALL PASS",
2035 onfail="PING ALL FAIL" )
2036
GlennRCbddd58f2015-10-01 15:45:25 -07002037 caseResult = linkUp and pingResult
2038 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002039 onpass="Link Up Test PASS",
2040 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002041 # Printing what exactly failed
2042 if not linkUp:
2043 main.log.debug( "Link down was not discovered correctly" )
2044 if not pingResult:
2045 main.log.debug( "Pingall failed" )
2046 if not intentState:
2047 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002048
GlennRCbddd58f2015-10-01 15:45:25 -07002049 if not caseResult and main.failSwitch:
2050 main.log.report("Stopping test")
2051 main.stop( email=main.emailOnStop )
2052
Hari Krishnac195f3b2015-07-08 20:02:24 -07002053 def CASE73( self, main ):
2054 """
2055 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2056 """
2057 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002058 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002059 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002060
Hari Krishnac195f3b2015-07-08 20:02:24 -07002061 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2062 main.log.report( "___________________________________________________________________________" )
2063 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2064 switches = []
2065 switchesComb = []
2066 for i in range( main.numMNswitches ):
2067 switches.append('s%d'%(i+1))
2068 switchesLinksComb = list(itertools.combinations(switches,2))
2069 main.randomLinks = random.sample(switchesLinksComb, 5 )
2070 print main.randomLinks
2071 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002072
Hari Krishnac195f3b2015-07-08 20:02:24 -07002073 for switch in main.randomLinks:
2074 main.Mininet1.link(
2075 END1=switch[0],
2076 END2=switch[1],
2077 OPTION="down")
2078 time.sleep( link_sleep )
2079
Hari Krishna6185fc12015-07-13 15:42:31 -07002080 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002081 linkDown = main.ONOSbench.checkStatus(
2082 topology_output, main.numMNswitches, str(
2083 int( main.numMNlinks ) - 5 * 2 ) )
2084 utilities.assert_equals(
2085 expect=main.TRUE,
2086 actual=linkDown,
2087 onpass="Link Down discovered properly",
2088 onfail="Link down was not discovered in " +
2089 str( link_sleep ) +
2090 " seconds" )
2091
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002093 # Giving onos multiple chances to install intents
2094 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002095 if i != 0:
2096 main.log.warn( "Verification failed. Retrying..." )
2097 main.log.info("Giving onos some time...")
2098 time.sleep( main.checkIntentsDelay )
2099
2100 intentState = main.TRUE
2101 for e in range(int(main.numCtrls)):
2102 main.log.info( "Checking intents on CLI %s" % (e+1) )
2103 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2104 intentState
2105 if not intentState:
2106 main.log.warn( "Not all intents installed" )
2107 if intentState:
2108 break
2109 else:
2110 #Dumping intent summary
2111 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2112
2113
2114 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2115 onpass="INTENTS INSTALLED",
2116 onfail="SOME INTENTS NOT INSTALLED" )
2117
Hari Krishnac195f3b2015-07-08 20:02:24 -07002118 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002119 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002120 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002121 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2122 if not pingResult:
2123 main.log.warn("First pingall failed. Retrying...")
2124 time.sleep(main.pingSleep)
2125 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002126
Hari Krishnac195f3b2015-07-08 20:02:24 -07002127 time2 = time.time()
2128 timeDiff = round( ( time2 - time1 ), 2 )
2129 main.log.report(
2130 "Time taken for Ping All: " +
2131 str( timeDiff ) +
2132 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002133 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002134 onpass="PING ALL PASS",
2135 onfail="PING ALL FAIL" )
2136
GlennRCbddd58f2015-10-01 15:45:25 -07002137 caseResult = linkDown and pingResult and intentState
2138 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002139 onpass="Random Link cut Test PASS",
2140 onfail="Random Link cut Test FAIL" )
2141
GlennRCfcfdc4f2015-09-30 16:01:57 -07002142 # Printing what exactly failed
2143 if not linkDown:
2144 main.log.debug( "Link down was not discovered correctly" )
2145 if not pingResult:
2146 main.log.debug( "Pingall failed" )
2147 if not intentState:
2148 main.log.debug( "Intents are not all installed" )
2149
GlennRCbddd58f2015-10-01 15:45:25 -07002150 if not caseResult and main.failSwitch:
2151 main.log.report("Stopping test")
2152 main.stop( email=main.emailOnStop )
2153
Hari Krishnac195f3b2015-07-08 20:02:24 -07002154 def CASE83( self, main ):
2155 """
2156 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2157 """
2158 import random
2159 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002160
Hari Krishnac195f3b2015-07-08 20:02:24 -07002161 main.log.report(
2162 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2163 main.log.report(
2164 "__________________________________________________________________" )
2165 main.case(
2166 "Point intents - Bring the core links up that are down and verify ping all" )
2167 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002168
Hari Krishnac195f3b2015-07-08 20:02:24 -07002169 for switch in main.randomLinks:
2170 main.Mininet1.link(
2171 END1=switch[0],
2172 END2=switch[1],
2173 OPTION="up")
2174 time.sleep( link_sleep )
2175
Hari Krishna6185fc12015-07-13 15:42:31 -07002176 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002177 linkUp = main.ONOSbench.checkStatus(
2178 topology_output,
2179 main.numMNswitches,
2180 str( main.numMNlinks ) )
2181 utilities.assert_equals(
2182 expect=main.TRUE,
2183 actual=linkUp,
2184 onpass="Link up discovered properly",
2185 onfail="Link up was not discovered in " +
2186 str( link_sleep ) +
2187 " seconds" )
2188
GlennRCfcfdc4f2015-09-30 16:01:57 -07002189 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002190 # Giving onos multiple chances to install intents
2191 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002192 if i != 0:
2193 main.log.warn( "Verification failed. Retrying..." )
2194 main.log.info("Giving onos some time...")
2195 time.sleep( main.checkIntentsDelay )
2196
2197 intentState = main.TRUE
2198 for e in range(int(main.numCtrls)):
2199 main.log.info( "Checking intents on CLI %s" % (e+1) )
2200 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2201 intentState
2202 if not intentState:
2203 main.log.warn( "Not all intents installed" )
2204 if intentState:
2205 break
2206 else:
2207 #Dumping intent summary
2208 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2209
2210
2211 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2212 onpass="INTENTS INSTALLED",
2213 onfail="SOME INTENTS NOT INSTALLED" )
2214
Hari Krishnac195f3b2015-07-08 20:02:24 -07002215 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002216 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002217 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002218 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2219 if not pingResult:
2220 main.log.warn("First pingall failed. Retrying...")
2221 time.sleep(main.pingSleep)
2222 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002223
Hari Krishnac195f3b2015-07-08 20:02:24 -07002224 time2 = time.time()
2225 timeDiff = round( ( time2 - time1 ), 2 )
2226 main.log.report(
2227 "Time taken for Ping All: " +
2228 str( timeDiff ) +
2229 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002230 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002231 onpass="PING ALL PASS",
2232 onfail="PING ALL FAIL" )
2233
GlennRCbddd58f2015-10-01 15:45:25 -07002234 caseResult = linkUp and pingResult
2235 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002236 onpass="Link Up Test PASS",
2237 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002238 # Printing what exactly failed
2239 if not linkUp:
2240 main.log.debug( "Link down was not discovered correctly" )
2241 if not pingResult:
2242 main.log.debug( "Pingall failed" )
2243 if not intentState:
2244 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002245
GlennRCbddd58f2015-10-01 15:45:25 -07002246 if not caseResult and main.failSwitch:
2247 main.log.report("Stopping test")
2248 main.stop( email=main.emailOnStop )
2249
Hari Krishnac195f3b2015-07-08 20:02:24 -07002250 def CASE74( self, main ):
2251 """
2252 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2253 """
2254 import random
2255 main.randomLink1 = []
2256 main.randomLink2 = []
2257 main.randomLink3 = []
2258 main.randomLink4 = []
2259 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2260 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2261 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2262 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2263 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2264 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2265 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2266 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002267
Hari Krishnac195f3b2015-07-08 20:02:24 -07002268 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2269 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002270 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002271 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002272 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002273 linkIndex.remove(linkIndexS9)
2274 linkIndexS10 = random.sample(linkIndex,1)[0]
2275 main.randomLink1 = link1End2top[linkIndexS9]
2276 main.randomLink2 = link2End2top[linkIndexS10]
2277 main.randomLink3 = random.sample(link1End2bot,1)[0]
2278 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002279
2280 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002281 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2282 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2283 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2284 time.sleep( link_sleep )
2285 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2286 time.sleep( link_sleep )
2287
Hari Krishna6185fc12015-07-13 15:42:31 -07002288 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002289 linkDown = main.ONOSbench.checkStatus(
2290 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002291 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002292 utilities.assert_equals(
2293 expect=main.TRUE,
2294 actual=linkDown,
2295 onpass="Link Down discovered properly",
2296 onfail="Link down was not discovered in " +
2297 str( link_sleep ) +
2298 " seconds" )
2299
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002301 # Giving onos multiple chances to install intents
2302 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002303 if i != 0:
2304 main.log.warn( "Verification failed. Retrying..." )
2305 main.log.info("Giving onos some time...")
2306 time.sleep( main.checkIntentsDelay )
2307
2308 intentState = main.TRUE
2309 for e in range(int(main.numCtrls)):
2310 main.log.info( "Checking intents on CLI %s" % (e+1) )
2311 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2312 intentState
2313 if not intentState:
2314 main.log.warn( "Not all intents installed" )
2315 if intentState:
2316 break
2317 else:
2318 #Dumping intent summary
2319 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2320
2321
2322 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2323 onpass="INTENTS INSTALLED",
2324 onfail="SOME INTENTS NOT INSTALLED" )
2325
Hari Krishnac195f3b2015-07-08 20:02:24 -07002326 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002327 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002328 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002329 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2330 if not pingResult:
2331 main.log.warn("First pingall failed. Retrying...")
2332 time.sleep(main.pingSleep)
2333 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002334
Hari Krishnac195f3b2015-07-08 20:02:24 -07002335 time2 = time.time()
2336 timeDiff = round( ( time2 - time1 ), 2 )
2337 main.log.report(
2338 "Time taken for Ping All: " +
2339 str( timeDiff ) +
2340 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002341 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002342 onpass="PING ALL PASS",
2343 onfail="PING ALL FAIL" )
2344
GlennRCbddd58f2015-10-01 15:45:25 -07002345 caseResult = linkDown and pingResult and intentState
2346 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002347 onpass="Random Link cut Test PASS",
2348 onfail="Random Link cut Test FAIL" )
2349
GlennRCfcfdc4f2015-09-30 16:01:57 -07002350 # Printing what exactly failed
2351 if not linkDown:
2352 main.log.debug( "Link down was not discovered correctly" )
2353 if not pingResult:
2354 main.log.debug( "Pingall failed" )
2355 if not intentState:
2356 main.log.debug( "Intents are not all installed" )
2357
GlennRCbddd58f2015-10-01 15:45:25 -07002358 if not caseResult and main.failSwitch:
2359 main.log.report("Stopping test")
2360 main.stop( email=main.emailOnStop )
2361
Hari Krishnac195f3b2015-07-08 20:02:24 -07002362 def CASE84( self, main ):
2363 """
2364 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2365 """
2366 import random
2367 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2368 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2369 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2370 main.log.report(
2371 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2372 main.log.report(
2373 "__________________________________________________________________" )
2374 main.case(
2375 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002376
2377 # Work around for link state propagation delay. Added some sleep time.
2378 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2379 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002380 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2381 time.sleep( link_sleep )
2382 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2383 time.sleep( link_sleep )
2384
Hari Krishna6185fc12015-07-13 15:42:31 -07002385 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002386 linkUp = main.ONOSbench.checkStatus(
2387 topology_output,
2388 main.numMNswitches,
2389 str( main.numMNlinks ) )
2390 utilities.assert_equals(
2391 expect=main.TRUE,
2392 actual=linkUp,
2393 onpass="Link up discovered properly",
2394 onfail="Link up was not discovered in " +
2395 str( link_sleep ) +
2396 " seconds" )
2397
GlennRCfcfdc4f2015-09-30 16:01:57 -07002398 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002399 # Giving onos multiple chances to install intents
2400 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002401 if i != 0:
2402 main.log.warn( "Verification failed. Retrying..." )
2403 main.log.info("Giving onos some time...")
2404 time.sleep( main.checkIntentsDelay )
2405
2406 intentState = main.TRUE
2407 for e in range(int(main.numCtrls)):
2408 main.log.info( "Checking intents on CLI %s" % (e+1) )
2409 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2410 intentState
2411 if not intentState:
2412 main.log.warn( "Not all intents installed" )
2413 if intentState:
2414 break
2415 else:
2416 #Dumping intent summary
2417 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2418
2419
2420 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2421 onpass="INTENTS INSTALLED",
2422 onfail="SOME INTENTS NOT INSTALLED" )
2423
Hari Krishnac195f3b2015-07-08 20:02:24 -07002424 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002425 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002426 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002427 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2428 if not pingResult:
2429 main.log.warn("First pingall failed. Retrying...")
2430 time.sleep(main.pingSleep)
2431 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002432
Hari Krishnac195f3b2015-07-08 20:02:24 -07002433 time2 = time.time()
2434 timeDiff = round( ( time2 - time1 ), 2 )
2435 main.log.report(
2436 "Time taken for Ping All: " +
2437 str( timeDiff ) +
2438 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002439 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002440 onpass="PING ALL PASS",
2441 onfail="PING ALL FAIL" )
2442
GlennRCbddd58f2015-10-01 15:45:25 -07002443 caseResult = linkUp and pingResult
2444 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002445 onpass="Link Up Test PASS",
2446 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002447 # Printing what exactly failed
2448 if not linkUp:
2449 main.log.debug( "Link down was not discovered correctly" )
2450 if not pingResult:
2451 main.log.debug( "Pingall failed" )
2452 if not intentState:
2453 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002454
GlennRCbddd58f2015-10-01 15:45:25 -07002455 if not caseResult and main.failSwitch:
2456 main.log.report("Stopping test")
2457 main.stop( email=main.emailOnStop )
2458
Hari Krishnab79d0822015-08-20 09:48:43 -07002459 def CASE75( self, main ):
2460 """
2461 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2462 """
2463 import random
2464 main.randomLink1 = []
2465 main.randomLink2 = []
2466 main.randomLink3 = []
2467 main.randomLink4 = []
2468 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2469 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2470 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2471 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2472 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2473 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2474 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2475 main.pingTimeout = 400
2476
2477 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2478 main.log.report( "___________________________________________________________________________" )
2479 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2480 linkIndex = range(4)
2481 linkIndexS9 = random.sample(linkIndex,1)[0]
2482 linkIndex.remove(linkIndexS9)
2483 linkIndexS10 = random.sample(linkIndex,1)[0]
2484 main.randomLink1 = link1End2top[linkIndexS9]
2485 main.randomLink2 = link2End2top[linkIndexS10]
2486 main.randomLink3 = random.sample(link1End2bot,1)[0]
2487 main.randomLink4 = random.sample(link2End2bot,1)[0]
2488
2489 # Work around for link state propagation delay. Added some sleep time.
2490 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2491 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2492 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2493 time.sleep( link_sleep )
2494 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2495 time.sleep( link_sleep )
2496
2497 topology_output = main.ONOScli1.topology()
2498 linkDown = main.ONOSbench.checkStatus(
2499 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002500 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002501 utilities.assert_equals(
2502 expect=main.TRUE,
2503 actual=linkDown,
2504 onpass="Link Down discovered properly",
2505 onfail="Link down was not discovered in " +
2506 str( link_sleep ) +
2507 " seconds" )
2508
GlennRCfcfdc4f2015-09-30 16:01:57 -07002509 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002510 # Giving onos multiple chances to install intents
2511 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002512 if i != 0:
2513 main.log.warn( "Verification failed. Retrying..." )
2514 main.log.info("Giving onos some time...")
2515 time.sleep( main.checkIntentsDelay )
2516
2517 intentState = main.TRUE
2518 for e in range(int(main.numCtrls)):
2519 main.log.info( "Checking intents on CLI %s" % (e+1) )
2520 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2521 intentState
2522 if not intentState:
2523 main.log.warn( "Not all intents installed" )
2524 if intentState:
2525 break
2526 else:
2527 #Dumping intent summary
2528 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2529
2530
2531 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2532 onpass="INTENTS INSTALLED",
2533 onfail="SOME INTENTS NOT INSTALLED" )
2534
Hari Krishnab79d0822015-08-20 09:48:43 -07002535 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002536 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002537 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002538 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2539 if not pingResult:
2540 main.log.warn("First pingall failed. Retrying...")
2541 time.sleep(main.pingSleep)
2542 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002543
Hari Krishnab79d0822015-08-20 09:48:43 -07002544 time2 = time.time()
2545 timeDiff = round( ( time2 - time1 ), 2 )
2546 main.log.report(
2547 "Time taken for Ping All: " +
2548 str( timeDiff ) +
2549 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002550 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002551 onpass="PING ALL PASS",
2552 onfail="PING ALL FAIL" )
2553
GlennRCbddd58f2015-10-01 15:45:25 -07002554 caseResult = linkDown and pingResult and intentState
2555 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002556 onpass="Random Link cut Test PASS",
2557 onfail="Random Link cut Test FAIL" )
2558
GlennRCfcfdc4f2015-09-30 16:01:57 -07002559 # Printing what exactly failed
2560 if not linkDown:
2561 main.log.debug( "Link down was not discovered correctly" )
2562 if not pingResult:
2563 main.log.debug( "Pingall failed" )
2564 if not intentState:
2565 main.log.debug( "Intents are not all installed" )
2566
GlennRCbddd58f2015-10-01 15:45:25 -07002567 if not caseResult and main.failSwitch:
2568 main.log.report("Stopping test")
2569 main.stop( email=main.emailOnStop )
2570
Hari Krishnab79d0822015-08-20 09:48:43 -07002571 def CASE85( self, main ):
2572 """
2573 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2574 """
2575 import random
2576 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2577 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2578 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2579 main.log.report(
2580 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2581 main.log.report(
2582 "__________________________________________________________________" )
2583 main.case(
2584 "Point intents - Bring the core links up that are down and verify ping all" )
2585
2586 # Work around for link state propagation delay. Added some sleep time.
2587 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2588 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2589 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2590 time.sleep( link_sleep )
2591 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2592 time.sleep( link_sleep )
2593
2594 topology_output = main.ONOScli1.topology()
2595 linkUp = main.ONOSbench.checkStatus(
2596 topology_output,
2597 main.numMNswitches,
2598 str( main.numMNlinks ) )
2599 utilities.assert_equals(
2600 expect=main.TRUE,
2601 actual=linkUp,
2602 onpass="Link up discovered properly",
2603 onfail="Link up was not discovered in " +
2604 str( link_sleep ) +
2605 " seconds" )
2606
GlennRCfcfdc4f2015-09-30 16:01:57 -07002607 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002608 # Giving onos multiple chances to install intents
2609 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002610 if i != 0:
2611 main.log.warn( "Verification failed. Retrying..." )
2612 main.log.info("Giving onos some time...")
2613 time.sleep( main.checkIntentsDelay )
2614
2615 intentState = main.TRUE
2616 for e in range(int(main.numCtrls)):
2617 main.log.info( "Checking intents on CLI %s" % (e+1) )
2618 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2619 intentState
2620 if not intentState:
2621 main.log.warn( "Not all intents installed" )
2622 if intentState:
2623 break
2624 else:
2625 #Dumping intent summary
2626 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2627
2628
2629 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2630 onpass="INTENTS INSTALLED",
2631 onfail="SOME INTENTS NOT INSTALLED" )
2632
Hari Krishnab79d0822015-08-20 09:48:43 -07002633 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002634 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002635 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002636 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2637 if not pingResult:
2638 main.log.warn("First pingall failed. Retrying...")
2639 time.sleep(main.pingSleep)
2640 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002641
Hari Krishnab79d0822015-08-20 09:48:43 -07002642 time2 = time.time()
2643 timeDiff = round( ( time2 - time1 ), 2 )
2644 main.log.report(
2645 "Time taken for Ping All: " +
2646 str( timeDiff ) +
2647 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002648 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002649 onpass="PING ALL PASS",
2650 onfail="PING ALL FAIL" )
2651
GlennRCbddd58f2015-10-01 15:45:25 -07002652 caseResult = linkUp and pingResult
2653 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002654 onpass="Link Up Test PASS",
2655 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002656 # Printing what exactly failed
2657 if not linkUp:
2658 main.log.debug( "Link down was not discovered correctly" )
2659 if not pingResult:
2660 main.log.debug( "Pingall failed" )
2661 if not intentState:
2662 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002663
GlennRCbddd58f2015-10-01 15:45:25 -07002664 if not caseResult and main.failSwitch:
2665 main.log.report("Stopping test")
2666 main.stop( email=main.emailOnStop )
2667
Hari Krishna4223dbd2015-08-13 16:29:53 -07002668 def CASE170( self ):
2669 """
2670 IPv6 ping all with some core links down( Host Intents-Att Topo)
2671 """
2672 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2673 main.log.report( "_________________________________________________" )
2674 import itertools
2675 import time
2676 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2677 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002678 pingResult = main.FALSE
2679 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002680 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002681 if not pingResult:
2682 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002683 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002684 time2 = time.time()
2685 timeDiff = round( ( time2 - time1 ), 2 )
2686 main.log.report(
2687 "Time taken for IPv6 Ping All: " +
2688 str( timeDiff ) +
2689 " seconds" )
2690 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2691 onpass="PING ALL PASS",
2692 onfail="PING ALL FAIL" )
2693
GlennRCbddd58f2015-10-01 15:45:25 -07002694 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002695 utilities.assert_equals(
2696 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002697 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002698 onpass="IPv6 Ping across 300 host intents test PASS",
2699 onfail="IPv6 Ping across 300 host intents test FAIL" )
2700
2701 def CASE180( self ):
2702 """
2703 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2704 """
2705 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2706 main.log.report( "_________________________________________________" )
2707 import itertools
2708 import time
2709 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2710 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002711 pingResult = main.FALSE
2712 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002713 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002714 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002715 main.log.warn("First ping failed. Retrying...")
2716 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002717 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002718 time2 = time.time()
2719 timeDiff = round( ( time2 - time1 ), 2 )
2720 main.log.report(
2721 "Time taken for IPv6 Ping All: " +
2722 str( timeDiff ) +
2723 " seconds" )
2724 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2725 onpass="PING ALL PASS",
2726 onfail="PING ALL FAIL" )
2727
GlennRCbddd58f2015-10-01 15:45:25 -07002728 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002729 utilities.assert_equals(
2730 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002731 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002732 onpass="IPv6 Ping across 300 host intents test PASS",
2733 onfail="IPv6 Ping across 300 host intents test FAIL" )
2734
2735 def CASE171( self ):
2736 """
2737 IPv6 ping all with some core links down( Point Intents-Att Topo)
2738 """
2739 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2740 main.log.report( "_________________________________________________" )
2741 import itertools
2742 import time
2743 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2744 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002745 pingResult = main.FALSE
2746 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002747 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002748 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002749 main.log.warn("First ping failed. Retrying...")
2750 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002751 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002752 time2 = time.time()
2753 timeDiff = round( ( time2 - time1 ), 2 )
2754 main.log.report(
2755 "Time taken for IPv6 Ping All: " +
2756 str( timeDiff ) +
2757 " seconds" )
2758 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2759 onpass="PING ALL PASS",
2760 onfail="PING ALL FAIL" )
2761
GlennRCbddd58f2015-10-01 15:45:25 -07002762 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002763 utilities.assert_equals(
2764 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002765 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002766 onpass="IPv6 Ping across 600 point intents test PASS",
2767 onfail="IPv6 Ping across 600 point intents test FAIL" )
2768
2769 def CASE181( self ):
2770 """
2771 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2772 """
2773 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2774 main.log.report( "_________________________________________________" )
2775 import itertools
2776 import time
2777 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2778 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002779 pingResult = main.FALSE
2780 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002781 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002782 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002783 main.log.warn("First ping failed. Retrying...")
2784 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002785 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002786 time2 = time.time()
2787 timeDiff = round( ( time2 - time1 ), 2 )
2788 main.log.report(
2789 "Time taken for IPv6 Ping All: " +
2790 str( timeDiff ) +
2791 " seconds" )
2792 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2793 onpass="PING ALL PASS",
2794 onfail="PING ALL FAIL" )
2795
GlennRCbddd58f2015-10-01 15:45:25 -07002796 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002797 utilities.assert_equals(
2798 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002799 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002800 onpass="IPv6 Ping across 600 Point intents test PASS",
2801 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2802
2803 def CASE172( self ):
2804 """
2805 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2806 """
2807 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2808 main.log.report( "_________________________________________________" )
2809 import itertools
2810 import time
2811 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2812 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002813 pingResult = main.FALSE
2814 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002815 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002816 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002817 main.log.warn("First ping failed. Retrying...")
2818 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002819 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002820 time2 = time.time()
2821 timeDiff = round( ( time2 - time1 ), 2 )
2822 main.log.report(
2823 "Time taken for IPv6 Ping All: " +
2824 str( timeDiff ) +
2825 " seconds" )
2826 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2827 onpass="PING ALL PASS",
2828 onfail="PING ALL FAIL" )
2829
GlennRCbddd58f2015-10-01 15:45:25 -07002830 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002831 utilities.assert_equals(
2832 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002833 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002834 onpass="IPv6 Ping across 300 host intents test PASS",
2835 onfail="IPv6 Ping across 300 host intents test FAIL" )
2836
2837 def CASE182( self ):
2838 """
2839 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2840 """
2841 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2842 main.log.report( "_________________________________________________" )
2843 import itertools
2844 import time
2845 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2846 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002847 pingResult = main.FALSE
2848 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002849 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002850 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002851 main.log.warn("First ping failed. Retrying...")
2852 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002853 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002854 time2 = time.time()
2855 timeDiff = round( ( time2 - time1 ), 2 )
2856 main.log.report(
2857 "Time taken for IPv6 Ping All: " +
2858 str( timeDiff ) +
2859 " seconds" )
2860 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2861 onpass="PING ALL PASS",
2862 onfail="PING ALL FAIL" )
2863
GlennRCbddd58f2015-10-01 15:45:25 -07002864 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002865 utilities.assert_equals(
2866 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002867 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002868 onpass="IPv6 Ping across 300 host intents test PASS",
2869 onfail="IPv6 Ping across 300 host intents test FAIL" )
2870
2871 def CASE173( self ):
2872 """
2873 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2874 """
2875 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2876 main.log.report( "_________________________________________________" )
2877 import itertools
2878 import time
2879 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2880 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002881 pingResult = main.FALSE
2882 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002883 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002884 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002885 main.log.warn("First ping failed. Retrying...")
2886 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002887 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002888 time2 = time.time()
2889 timeDiff = round( ( time2 - time1 ), 2 )
2890 main.log.report(
2891 "Time taken for IPv6 Ping All: " +
2892 str( timeDiff ) +
2893 " seconds" )
2894 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2895 onpass="PING ALL PASS",
2896 onfail="PING ALL FAIL" )
2897
GlennRCbddd58f2015-10-01 15:45:25 -07002898 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002899 utilities.assert_equals(
2900 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002901 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002902 onpass="IPv6 Ping across 600 point intents test PASS",
2903 onfail="IPv6 Ping across 600 point intents test FAIL" )
2904
2905 def CASE183( self ):
2906 """
2907 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2908 """
2909 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2910 main.log.report( "_________________________________________________" )
2911 import itertools
2912 import time
2913 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2914 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002915 pingResult = main.FALSE
2916 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002917 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002918 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002919 main.log.warn("First ping failed. Retrying...")
2920 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002921 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002922 time2 = time.time()
2923 timeDiff = round( ( time2 - time1 ), 2 )
2924 main.log.report(
2925 "Time taken for IPv6 Ping All: " +
2926 str( timeDiff ) +
2927 " seconds" )
2928 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2929 onpass="PING ALL PASS",
2930 onfail="PING ALL FAIL" )
2931
GlennRCbddd58f2015-10-01 15:45:25 -07002932 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002933 utilities.assert_equals(
2934 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002935 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002936 onpass="IPv6 Ping across 600 Point intents test PASS",
2937 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2938
2939 def CASE174( self ):
2940 """
2941 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2942 """
2943 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2944 main.log.report( "_________________________________________________" )
2945 import itertools
2946 import time
2947 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2948 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002949 pingResult = main.FALSE
2950 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002951 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002952 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002953 main.log.warn("First ping failed. Retrying...")
2954 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002955 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002956 time2 = time.time()
2957 timeDiff = round( ( time2 - time1 ), 2 )
2958 main.log.report(
2959 "Time taken for IPv6 Ping All: " +
2960 str( timeDiff ) +
2961 " seconds" )
2962 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2963 onpass="PING ALL PASS",
2964 onfail="PING ALL FAIL" )
2965
GlennRCbddd58f2015-10-01 15:45:25 -07002966 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002967 utilities.assert_equals(
2968 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002969 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002970 onpass="IPv6 Ping across 2278 host intents test PASS",
2971 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2972
2973 def CASE184( self ):
2974 """
2975 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2976 """
2977 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2978 main.log.report( "_________________________________________________" )
2979 import itertools
2980 import time
2981 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2982 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002983 pingResult = main.FALSE
2984 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002985 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002986 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002987 main.log.warn("First ping failed. Retrying...")
2988 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002989 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002990 time2 = time.time()
2991 timeDiff = round( ( time2 - time1 ), 2 )
2992 main.log.report(
2993 "Time taken for IPv6 Ping All: " +
2994 str( timeDiff ) +
2995 " seconds" )
2996 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2997 onpass="PING ALL PASS",
2998 onfail="PING ALL FAIL" )
2999
GlennRCbddd58f2015-10-01 15:45:25 -07003000 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003001 utilities.assert_equals(
3002 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003003 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003004 onpass="IPv6 Ping across 2278 host intents test PASS",
3005 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3006
3007 def CASE175( self ):
3008 """
3009 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3010 """
3011 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3012 main.log.report( "_________________________________________________" )
3013 import itertools
3014 import time
3015 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3016 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003017 pingResult = main.FALSE
3018 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003019 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003020 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003021 main.log.warn("First ping failed. Retrying...")
3022 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003023 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003024 time2 = time.time()
3025 timeDiff = round( ( time2 - time1 ), 2 )
3026 main.log.report(
3027 "Time taken for IPv6 Ping All: " +
3028 str( timeDiff ) +
3029 " seconds" )
3030 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3031 onpass="PING ALL PASS",
3032 onfail="PING ALL FAIL" )
3033
GlennRCbddd58f2015-10-01 15:45:25 -07003034 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003035 utilities.assert_equals(
3036 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003037 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003038 onpass="IPv6 Ping across 4556 point intents test PASS",
3039 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3040
3041 def CASE185( self ):
3042 """
3043 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3044 """
3045 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3046 main.log.report( "_________________________________________________" )
3047 import itertools
3048 import time
3049 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3050 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003051 pingResult = main.FALSE
3052 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003053 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003054 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003055 main.log.warn("First ping failed. Retrying...")
3056 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003057 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003058 time2 = time.time()
3059 timeDiff = round( ( time2 - time1 ), 2 )
3060 main.log.report(
3061 "Time taken for IPv6 Ping All: " +
3062 str( timeDiff ) +
3063 " seconds" )
3064 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3065 onpass="PING ALL PASS",
3066 onfail="PING ALL FAIL" )
3067
GlennRCbddd58f2015-10-01 15:45:25 -07003068 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003069 utilities.assert_equals(
3070 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003071 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003072 onpass="IPv6 Ping across 4556 Point intents test PASS",
3073 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3074
Hari Krishnac195f3b2015-07-08 20:02:24 -07003075 def CASE90( self ):
3076 """
3077 Install 600 point intents and verify ping all (Att Topology)
3078 """
3079 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3080 main.log.report( "_______________________________________" )
3081 import itertools
3082 import time
3083 main.case( "Install 600 point intents" )
3084 main.step( "Add point Intents" )
3085 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003086 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3087
Hari Krishnac195f3b2015-07-08 20:02:24 -07003088 intentIdList = []
3089 time1 = time.time()
3090 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3091 pool = []
3092 for cli in main.CLIs:
3093 if i >= len( deviceCombos ):
3094 break
3095 t = main.Thread( target=cli.addPointIntent,
3096 threadID=main.threadID,
3097 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003098 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 -07003099 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003100 t.start()
3101 i = i + 1
3102 main.threadID = main.threadID + 1
3103 for thread in pool:
3104 thread.join()
3105 intentIdList.append(thread.result)
3106 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003107 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003108
GlennRCfcfdc4f2015-09-30 16:01:57 -07003109 # Saving intent ids to check intents in later case
3110 main.intentIds = list(intentIdList)
3111
GlennRCa8d786a2015-09-23 17:40:11 -07003112 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003113
GlennRC1dde1712015-10-02 11:03:08 -07003114 # Giving onos multiple chances to install intents
3115 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003116 if i != 0:
3117 main.log.warn( "Verification failed. Retrying..." )
3118 main.log.info("Waiting for onos to install intents...")
3119 time.sleep( main.checkIntentsDelay )
3120
GlennRCa8d786a2015-09-23 17:40:11 -07003121 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003122 for e in range(int(main.numCtrls)):
3123 main.log.info( "Checking intents on CLI %s" % (e+1) )
3124 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3125 intentState
3126 if not intentState:
3127 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003128 if intentState:
3129 break
GlennRCdb2c8422015-09-29 12:21:59 -07003130 else:
3131 #Dumping intent summary
3132 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003133
3134 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3135 onpass="INTENTS INSTALLED",
3136 onfail="SOME INTENTS NOT INSTALLED" )
3137
Hari Krishnac195f3b2015-07-08 20:02:24 -07003138 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003139 for i in range(main.numPings):
3140 time1 = time.time()
3141 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3142 if not pingResult:
3143 main.log.warn("First pingall failed. Retrying...")
3144 time.sleep(main.pingSleep)
3145 else: break
3146
Hari Krishnac195f3b2015-07-08 20:02:24 -07003147 time2 = time.time()
3148 timeDiff = round( ( time2 - time1 ), 2 )
3149 main.log.report(
3150 "Time taken for Ping All: " +
3151 str( timeDiff ) +
3152 " seconds" )
3153 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003154 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003155 onfail="PING ALL FAIL" )
3156
GlennRCbddd58f2015-10-01 15:45:25 -07003157 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003158
Hari Krishnac195f3b2015-07-08 20:02:24 -07003159 utilities.assert_equals(
3160 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003161 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003162 onpass="Install 600 point Intents and Ping All test PASS",
3163 onfail="Install 600 point Intents and Ping All test FAIL" )
3164
GlennRCbddd58f2015-10-01 15:45:25 -07003165 if not intentState:
3166 main.log.debug( "Intents failed to install completely" )
3167 if not pingResult:
3168 main.log.debug( "Pingall failed" )
3169
3170 if not caseResult and main.failSwitch:
3171 main.log.report("Stopping test")
3172 main.stop( email=main.emailOnStop )
3173
Hari Krishnac195f3b2015-07-08 20:02:24 -07003174 def CASE91( self ):
3175 """
3176 Install 600 point intents and verify ping all (Chordal Topology)
3177 """
3178 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3179 main.log.report( "_______________________________________" )
3180 import itertools
3181 import time
3182 main.case( "Install 600 point intents" )
3183 main.step( "Add point Intents" )
3184 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003185 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3186
Hari Krishnac195f3b2015-07-08 20:02:24 -07003187 intentIdList = []
3188 time1 = time.time()
3189 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3190 pool = []
3191 for cli in main.CLIs:
3192 if i >= len( deviceCombos ):
3193 break
3194 t = main.Thread( target=cli.addPointIntent,
3195 threadID=main.threadID,
3196 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003197 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 -07003198 pool.append(t)
3199 #time.sleep(1)
3200 t.start()
3201 i = i + 1
3202 main.threadID = main.threadID + 1
3203 for thread in pool:
3204 thread.join()
3205 intentIdList.append(thread.result)
3206 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003207 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003208
GlennRCfcfdc4f2015-09-30 16:01:57 -07003209 # Saving intent ids to check intents in later case
3210 main.intentIds = list(intentIdList)
3211
GlennRCa8d786a2015-09-23 17:40:11 -07003212 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003213
GlennRC1dde1712015-10-02 11:03:08 -07003214 # Giving onos multiple chances to install intents
3215 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003216 if i != 0:
3217 main.log.warn( "Verification failed. Retrying..." )
3218 main.log.info("Waiting for onos to install intents...")
3219 time.sleep( main.checkIntentsDelay )
3220
GlennRCa8d786a2015-09-23 17:40:11 -07003221 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003222 for e in range(int(main.numCtrls)):
3223 main.log.info( "Checking intents on CLI %s" % (e+1) )
3224 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3225 intentState
3226 if not intentState:
3227 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003228 if intentState:
3229 break
GlennRCdb2c8422015-09-29 12:21:59 -07003230 else:
3231 #Dumping intent summary
3232 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003233
3234 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3235 onpass="INTENTS INSTALLED",
3236 onfail="SOME INTENTS NOT INSTALLED" )
3237
Hari Krishnac195f3b2015-07-08 20:02:24 -07003238 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003239 for i in range(main.numPings):
3240 time1 = time.time()
3241 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3242 if not pingResult:
3243 main.log.warn("First pingall failed. Retrying...")
3244 time.sleep(main.pingSleep)
3245 else: break
3246
Hari Krishnac195f3b2015-07-08 20:02:24 -07003247 time2 = time.time()
3248 timeDiff = round( ( time2 - time1 ), 2 )
3249 main.log.report(
3250 "Time taken for Ping All: " +
3251 str( timeDiff ) +
3252 " seconds" )
3253 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3254 onpass="PING ALL PASS",
3255 onfail="PING ALL FAIL" )
3256
GlennRCbddd58f2015-10-01 15:45:25 -07003257 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003258
Hari Krishnac195f3b2015-07-08 20:02:24 -07003259 utilities.assert_equals(
3260 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003261 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003262 onpass="Install 600 point Intents and Ping All test PASS",
3263 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003264
GlennRCbddd58f2015-10-01 15:45:25 -07003265 if not intentState:
3266 main.log.debug( "Intents failed to install completely" )
3267 if not pingResult:
3268 main.log.debug( "Pingall failed" )
3269
3270 if not caseResult and main.failSwitch:
3271 main.log.report("Stopping test")
3272 main.stop( email=main.emailOnStop )
3273
Hari Krishnac195f3b2015-07-08 20:02:24 -07003274 def CASE92( self ):
3275 """
3276 Install 4556 point intents and verify ping all (Spine Topology)
3277 """
3278 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3279 main.log.report( "_______________________________________" )
3280 import itertools
3281 import time
3282 main.case( "Install 4556 point intents" )
3283 main.step( "Add point Intents" )
3284 intentResult = main.TRUE
3285 main.pingTimeout = 600
3286 for i in range(len(main.hostMACs)):
3287 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3288 print main.MACsDict
3289 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3290 intentIdList = []
3291 time1 = time.time()
3292 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3293 pool = []
3294 for cli in main.CLIs:
3295 if i >= len( deviceCombos ):
3296 break
3297 t = main.Thread( target=cli.addPointIntent,
3298 threadID=main.threadID,
3299 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003300 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 -07003301 pool.append(t)
3302 #time.sleep(1)
3303 t.start()
3304 i = i + 1
3305 main.threadID = main.threadID + 1
3306 for thread in pool:
3307 thread.join()
3308 intentIdList.append(thread.result)
3309 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003310 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003311
GlennRCfcfdc4f2015-09-30 16:01:57 -07003312 # Saving intent ids to check intents in later case
3313 main.intentIds = list(intentIdList)
3314
GlennRCa8d786a2015-09-23 17:40:11 -07003315 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003316
GlennRC1dde1712015-10-02 11:03:08 -07003317 # Giving onos multiple chances to install intents
3318 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003319 if i != 0:
3320 main.log.warn( "Verification failed. Retrying..." )
3321 main.log.info("Waiting for onos to install intents...")
3322 time.sleep( main.checkIntentsDelay )
3323
GlennRCa8d786a2015-09-23 17:40:11 -07003324 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003325 for e in range(int(main.numCtrls)):
3326 main.log.info( "Checking intents on CLI %s" % (e+1) )
3327 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3328 intentState
3329 if not intentState:
3330 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003331 if intentState:
3332 break
GlennRCdb2c8422015-09-29 12:21:59 -07003333 else:
3334 #Dumping intent summary
3335 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003336
3337 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3338 onpass="INTENTS INSTALLED",
3339 onfail="SOME INTENTS NOT INSTALLED" )
3340
Hari Krishnac195f3b2015-07-08 20:02:24 -07003341 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003342 for i in range(main.numPings):
3343 time1 = time.time()
3344 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3345 if not pingResult:
3346 main.log.warn("First pingall failed. Retrying...")
3347 time.sleep(main.pingSleep)
3348 else: break
3349
Hari Krishnac195f3b2015-07-08 20:02:24 -07003350 time2 = time.time()
3351 timeDiff = round( ( time2 - time1 ), 2 )
3352 main.log.report(
3353 "Time taken for Ping All: " +
3354 str( timeDiff ) +
3355 " seconds" )
3356 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3357 onpass="PING ALL PASS",
3358 onfail="PING ALL FAIL" )
3359
GlennRCbddd58f2015-10-01 15:45:25 -07003360 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003361
Hari Krishnac195f3b2015-07-08 20:02:24 -07003362 utilities.assert_equals(
3363 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003364 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003365 onpass="Install 4556 point Intents and Ping All test PASS",
3366 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003367
GlennRCbddd58f2015-10-01 15:45:25 -07003368 if not intentState:
3369 main.log.debug( "Intents failed to install completely" )
3370 if not pingResult:
3371 main.log.debug( "Pingall failed" )
3372
3373 if not caseResult and main.failSwitch:
3374 main.log.report("Stopping test")
3375 main.stop( email=main.emailOnStop )
3376
Hari Krishnac195f3b2015-07-08 20:02:24 -07003377 def CASE93( self ):
3378 """
3379 Install multi-single point intents and verify Ping all works
3380 for att topology
3381 """
3382 import copy
3383 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003384 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003385 main.log.report( "Install multi-single point intents and verify Ping all" )
3386 main.log.report( "___________________________________________" )
3387 main.case( "Install multi-single point intents and Ping all" )
3388 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3389 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3390 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003391 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003392 time1 = time.time()
3393 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3394 pool = []
3395 for cli in main.CLIs:
3396 egressDevice = deviceDPIDsCopy[i]
3397 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3398 ingressDeviceList.remove(egressDevice)
3399 if i >= len( deviceDPIDsCopy ):
3400 break
3401 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3402 threadID=main.threadID,
3403 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003404 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003405 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003406 t.start()
3407 i = i + 1
3408 main.threadID = main.threadID + 1
3409 for thread in pool:
3410 thread.join()
3411 intentIdList.append(thread.result)
3412 time2 = time.time()
3413 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003414
GlennRCdb2c8422015-09-29 12:21:59 -07003415 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003416
GlennRC1dde1712015-10-02 11:03:08 -07003417 # Giving onos multiple chances to install intents
3418 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003419 if i != 0:
3420 main.log.warn( "Verification failed. Retrying..." )
3421 main.log.info("Waiting for onos to install intents...")
3422 time.sleep( main.checkIntentsDelay )
3423
3424 intentState = main.TRUE
3425 for e in range(int(main.numCtrls)):
3426 main.log.info( "Checking intents on CLI %s" % (e+1) )
3427 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3428 intentState
3429 if not intentState:
3430 main.log.warn( "Not all intents installed" )
3431 if intentState:
3432 break
3433 else:
3434 #Dumping intent summary
3435 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3436
3437 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3438 onpass="INTENTS INSTALLED",
3439 onfail="SOME INTENTS NOT INSTALLED" )
3440
GlennRCfa69a2a2015-10-02 15:54:06 -07003441 main.step("Verify flows are all added")
3442
3443 for i in range( main.flowCheck ):
3444 if i != 0:
3445 main.log.warn( "verification failed. Retrying..." )
3446 main.log.info( "Waiting for onos to add flows..." )
3447 time.sleep( main.checkFlowsDelay )
3448
3449 flowState = main.TRUE
3450 for cli in main.CLIs:
3451 flowState = cli.checkFlowState()
3452 if not flowState:
3453 main.log.warn( "Not all flows added" )
3454 if flowState:
3455 break
3456 else:
3457 #Dumping summary
3458 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3459
3460 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3461 onpass="FLOWS INSTALLED",
3462 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003463
Hari Krishnac195f3b2015-07-08 20:02:24 -07003464 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003465 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003466 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003467 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3468 if not pingResult:
3469 main.log.warn("First pingall failed. Retrying...")
3470 time.sleep(main.pingSleep)
3471 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003472
Hari Krishnac195f3b2015-07-08 20:02:24 -07003473 time2 = time.time()
3474 timeDiff = round( ( time2 - time1 ), 2 )
3475 main.log.report(
3476 "Time taken for Ping All: " +
3477 str( timeDiff ) +
3478 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003479
GlennRCbddd58f2015-10-01 15:45:25 -07003480 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003481 utilities.assert_equals(
3482 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003483 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003484 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3485 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003486
GlennRCfa69a2a2015-10-02 15:54:06 -07003487 if not intentState:
3488 main.log.debug( "Intents failed to install completely" )
3489 if not pingResult:
3490 main.log.debug( "Pingall failed" )
3491 if not checkFlowsState:
3492 main.log.debug( "Flows failed to add completely" )
3493
3494 if not caseResult and main.failSwitch:
3495 main.log.report("Stopping test")
3496 main.stop( email=main.emailOnStop )
3497
Hari Krishnac195f3b2015-07-08 20:02:24 -07003498 def CASE94( self ):
3499 """
3500 Install multi-single point intents and verify Ping all works
3501 for Chordal topology
3502 """
3503 import copy
3504 import time
3505 main.log.report( "Install multi-single point intents and verify Ping all" )
3506 main.log.report( "___________________________________________" )
3507 main.case( "Install multi-single point intents and Ping all" )
3508 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3509 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3510 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003511 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003512 time1 = time.time()
3513 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3514 pool = []
3515 for cli in main.CLIs:
3516 egressDevice = deviceDPIDsCopy[i]
3517 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3518 ingressDeviceList.remove(egressDevice)
3519 if i >= len( deviceDPIDsCopy ):
3520 break
3521 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3522 threadID=main.threadID,
3523 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003524 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003525 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003526 t.start()
3527 i = i + 1
3528 main.threadID = main.threadID + 1
3529 for thread in pool:
3530 thread.join()
3531 intentIdList.append(thread.result)
3532 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003533 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003534
3535 main.step("Verify intents are installed")
3536
GlennRC1dde1712015-10-02 11:03:08 -07003537 # Giving onos multiple chances to install intents
3538 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003539 if i != 0:
3540 main.log.warn( "Verification failed. Retrying..." )
3541 main.log.info("Waiting for onos to install intents...")
3542 time.sleep( main.checkIntentsDelay )
3543
3544 intentState = main.TRUE
3545 for e in range(int(main.numCtrls)):
3546 main.log.info( "Checking intents on CLI %s" % (e+1) )
3547 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3548 intentState
3549 if not intentState:
3550 main.log.warn( "Not all intents installed" )
3551 if intentState:
3552 break
3553 else:
3554 #Dumping intent summary
3555 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3556
GlennRCdb2c8422015-09-29 12:21:59 -07003557 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3558 onpass="INTENTS INSTALLED",
3559 onfail="SOME INTENTS NOT INSTALLED" )
3560
GlennRCfa69a2a2015-10-02 15:54:06 -07003561 main.step("Verify flows are all added")
3562
3563 for i in range( main.flowCheck ):
3564 if i != 0:
3565 main.log.warn( "verification failed. Retrying..." )
3566 main.log.info( "Waiting for onos to add flows..." )
3567 time.sleep( main.checkFlowsDelay )
3568
3569 flowState = main.TRUE
3570 for cli in main.CLIs:
3571 flowState = cli.checkFlowState()
3572 if not flowState:
3573 main.log.warn( "Not all flows added" )
3574 if flowState:
3575 break
3576 else:
3577 #Dumping summary
3578 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3579
3580 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3581 onpass="FLOWS INSTALLED",
3582 onfail="SOME FLOWS NOT ADDED" )
3583
Hari Krishnac195f3b2015-07-08 20:02:24 -07003584 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003585 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003586 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003587 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3588 if not pingResult:
3589 main.log.warn("First pingall failed. Retrying...")
3590 time.sleep(main.pingSleep)
3591 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003592
Hari Krishnac195f3b2015-07-08 20:02:24 -07003593 time2 = time.time()
3594 timeDiff = round( ( time2 - time1 ), 2 )
3595 main.log.report(
3596 "Time taken for Ping All: " +
3597 str( timeDiff ) +
3598 " seconds" )
3599
GlennRCfa69a2a2015-10-02 15:54:06 -07003600 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003601 utilities.assert_equals(
3602 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003603 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003604 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3605 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003606
GlennRCfa69a2a2015-10-02 15:54:06 -07003607 if not intentState:
3608 main.log.debug( "Intents failed to install completely" )
3609 if not pingResult:
3610 main.log.debug( "Pingall failed" )
3611 if not checkFlowsState:
3612 main.log.debug( "Flows failed to add completely" )
3613
3614 if not caseResult and main.failSwitch:
3615 main.log.report("Stopping test")
3616 main.stop( email=main.emailOnStop )
3617
3618 def CASE95( self ):
3619 """
3620 Install multi-single point intents and verify Ping all works
3621 for Spine topology
3622 """
3623 import copy
3624 import time
3625 main.log.report( "Install multi-single point intents and verify Ping all" )
3626 main.log.report( "___________________________________________" )
3627 main.case( "Install multi-single point intents and Ping all" )
3628 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3629 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3630 intentIdList = []
3631 main.log.info( "MACsDict" + str(main.MACsDict) )
3632 time1 = time.time()
3633 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3634 pool = []
3635 for cli in main.CLIs:
3636 egressDevice = deviceDPIDsCopy[i]
3637 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3638 ingressDeviceList.remove(egressDevice)
3639 if i >= len( deviceDPIDsCopy ):
3640 break
3641 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3642 threadID=main.threadID,
3643 name="addMultipointToSinglepointIntent",
3644 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3645 pool.append(t)
3646 t.start()
3647 i = i + 1
3648 main.threadID = main.threadID + 1
3649 for thread in pool:
3650 thread.join()
3651 intentIdList.append(thread.result)
3652 time2 = time.time()
3653 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3654
3655 main.step("Verify intents are installed")
3656
3657 # Giving onos multiple chances to install intents
3658 for i in range( main.intentCheck ):
3659 if i != 0:
3660 main.log.warn( "Verification failed. Retrying..." )
3661 main.log.info("Waiting for onos to install intents...")
3662 time.sleep( main.checkIntentsDelay )
3663
3664 intentState = main.TRUE
3665 for e in range(int(main.numCtrls)):
3666 main.log.info( "Checking intents on CLI %s" % (e+1) )
3667 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3668 intentState
3669 if not intentState:
3670 main.log.warn( "Not all intents installed" )
3671 if intentState:
3672 break
3673 else:
3674 #Dumping intent summary
3675 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3676
3677 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3678 onpass="INTENTS INSTALLED",
3679 onfail="SOME INTENTS NOT INSTALLED" )
3680
3681 main.step("Verify flows are all added")
3682
3683 for i in range( main.flowCheck ):
3684 if i != 0:
3685 main.log.warn( "verification failed. Retrying..." )
3686 main.log.info( "Waiting for onos to add flows..." )
3687 time.sleep( main.checkFlowsDelay )
3688
3689 flowState = main.TRUE
3690 for cli in main.CLIs:
3691 flowState = cli.checkFlowState()
3692 if not flowState:
3693 main.log.warn( "Not all flows added" )
3694 if flowState:
3695 break
3696 else:
3697 #Dumping summary
3698 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3699
3700 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3701 onpass="FLOWS INSTALLED",
3702 onfail="SOME FLOWS NOT ADDED" )
3703
3704 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003705 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003706 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003707 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3708 if not pingResult:
3709 main.log.warn("First pingall failed. Retrying...")
3710 time.sleep(main.pingSleep)
3711 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003712
3713 time2 = time.time()
3714 timeDiff = round( ( time2 - time1 ), 2 )
3715 main.log.report(
3716 "Time taken for Ping All: " +
3717 str( timeDiff ) +
3718 " seconds" )
3719
3720 caseResult = ( checkFlowsState and pingResult and intentState )
3721 utilities.assert_equals(
3722 expect=main.TRUE,
3723 actual=caseResult,
3724 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3725 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3726
3727 if not intentState:
3728 main.log.debug( "Intents failed to install completely" )
3729 if not pingResult:
3730 main.log.debug( "Pingall failed" )
3731 if not checkFlowsState:
3732 main.log.debug( "Flows failed to add completely" )
3733
3734 if not caseResult and main.failSwitch:
3735 main.log.report("Stopping test")
3736 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003737
3738 def CASE96( self ):
3739 """
3740 Install single-multi point intents and verify Ping all works
3741 for att topology
3742 """
3743 import copy
3744 main.log.report( "Install single-multi point intents and verify Ping all" )
3745 main.log.report( "___________________________________________" )
3746 main.case( "Install single-multi point intents and Ping all" )
3747 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3748 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3749 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003750 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003751 time1 = time.time()
3752 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3753 pool = []
3754 for cli in main.CLIs:
3755 ingressDevice = deviceDPIDsCopy[i]
3756 egressDeviceList = copy.copy(deviceDPIDsCopy)
3757 egressDeviceList.remove(ingressDevice)
3758 if i >= len( deviceDPIDsCopy ):
3759 break
3760 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3761 threadID=main.threadID,
3762 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003763 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003764 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003765 t.start()
3766 i = i + 1
3767 main.threadID = main.threadID + 1
3768 for thread in pool:
3769 thread.join()
3770 intentIdList.append(thread.result)
3771 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003772 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003773
3774 main.step("Verify intents are installed")
3775
GlennRC1dde1712015-10-02 11:03:08 -07003776 # Giving onos multiple chances to install intents
3777 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003778 if i != 0:
3779 main.log.warn( "Verification failed. Retrying..." )
3780 main.log.info("Waiting for onos to install intents...")
3781 time.sleep( main.checkIntentsDelay )
3782
3783 intentState = main.TRUE
3784 for e in range(int(main.numCtrls)):
3785 main.log.info( "Checking intents on CLI %s" % (e+1) )
3786 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3787 intentState
3788 if not intentState:
3789 main.log.warn( "Not all intents installed" )
3790 if intentState:
3791 break
3792 else:
3793 #Dumping intent summary
3794 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3795
GlennRCdb2c8422015-09-29 12:21:59 -07003796 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3797 onpass="INTENTS INSTALLED",
3798 onfail="SOME INTENTS NOT INSTALLED" )
3799
GlennRCfa69a2a2015-10-02 15:54:06 -07003800 main.step("Verify flows are all added")
3801
3802 for i in range( main.flowCheck ):
3803 if i != 0:
3804 main.log.warn( "verification failed. Retrying..." )
3805 main.log.info( "Waiting for onos to add flows..." )
3806 time.sleep( main.checkFlowsDelay )
3807
3808 flowState = main.TRUE
3809 for cli in main.CLIs:
3810 flowState = cli.checkFlowState()
3811 if not flowState:
3812 main.log.warn( "Not all flows added" )
3813 if flowState:
3814 break
3815 else:
3816 #Dumping summary
3817 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3818
3819 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3820 onpass="FLOWS INSTALLED",
3821 onfail="SOME FLOWS NOT ADDED" )
3822
Hari Krishnac195f3b2015-07-08 20:02:24 -07003823 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003824 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003825 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003826 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3827 if not pingResult:
3828 main.log.warn("First pingall failed. Retrying...")
3829 time.sleep(main.pingSleep)
3830 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003831
Hari Krishnac195f3b2015-07-08 20:02:24 -07003832 time2 = time.time()
3833 timeDiff = round( ( time2 - time1 ), 2 )
3834 main.log.report(
3835 "Time taken for Ping All: " +
3836 str( timeDiff ) +
3837 " seconds" )
3838
GlennRCfa69a2a2015-10-02 15:54:06 -07003839 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003840 utilities.assert_equals(
3841 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003842 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003843 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3844 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3845
GlennRCfa69a2a2015-10-02 15:54:06 -07003846 if not intentState:
3847 main.log.debug( "Intents failed to install completely" )
3848 if not pingResult:
3849 main.log.debug( "Pingall failed" )
3850 if not checkFlowsState:
3851 main.log.debug( "Flows failed to add completely" )
3852
3853 if not caseResult and main.failSwitch:
3854 main.log.report("Stopping test")
3855 main.stop( email=main.emailOnStop )
3856
Hari Krishnac195f3b2015-07-08 20:02:24 -07003857 def CASE97( self ):
3858 """
3859 Install single-multi point intents and verify Ping all works
3860 for Chordal topology
3861 """
3862 import copy
3863 main.log.report( "Install single-multi point intents and verify Ping all" )
3864 main.log.report( "___________________________________________" )
3865 main.case( "Install single-multi point intents and Ping all" )
3866 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3867 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3868 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003869 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003870 time1 = time.time()
3871 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3872 pool = []
3873 for cli in main.CLIs:
3874 ingressDevice = deviceDPIDsCopy[i]
3875 egressDeviceList = copy.copy(deviceDPIDsCopy)
3876 egressDeviceList.remove(ingressDevice)
3877 if i >= len( deviceDPIDsCopy ):
3878 break
3879 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3880 threadID=main.threadID,
3881 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003882 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003883 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003884 t.start()
3885 i = i + 1
3886 main.threadID = main.threadID + 1
3887 for thread in pool:
3888 thread.join()
3889 intentIdList.append(thread.result)
3890 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003891 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003892
3893 main.step("Verify intents are installed")
3894
GlennRC1dde1712015-10-02 11:03:08 -07003895 # Giving onos multiple chances to install intents
3896 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003897 if i != 0:
3898 main.log.warn( "Verification failed. Retrying..." )
3899 main.log.info("Waiting for onos to install intents...")
3900 time.sleep( main.checkIntentsDelay )
3901
3902 intentState = main.TRUE
3903 for e in range(int(main.numCtrls)):
3904 main.log.info( "Checking intents on CLI %s" % (e+1) )
3905 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3906 intentState
3907 if not intentState:
3908 main.log.warn( "Not all intents installed" )
3909 if intentState:
3910 break
3911 else:
3912 #Dumping intent summary
3913 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3914
GlennRCdb2c8422015-09-29 12:21:59 -07003915 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3916 onpass="INTENTS INSTALLED",
3917 onfail="SOME INTENTS NOT INSTALLED" )
3918
GlennRCfa69a2a2015-10-02 15:54:06 -07003919 main.step("Verify flows are all added")
3920
3921 for i in range( main.flowCheck ):
3922 if i != 0:
3923 main.log.warn( "verification failed. Retrying..." )
3924 main.log.info( "Waiting for onos to add flows..." )
3925 time.sleep( main.checkFlowsDelay )
3926
3927 flowState = main.TRUE
3928 for cli in main.CLIs:
3929 flowState = cli.checkFlowState()
3930 if not flowState:
3931 main.log.warn( "Not all flows added" )
3932 if flowState:
3933 break
3934 else:
3935 #Dumping summary
3936 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3937
3938 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3939 onpass="FLOWS INSTALLED",
3940 onfail="SOME FLOWS NOT ADDED" )
3941
Hari Krishnac195f3b2015-07-08 20:02:24 -07003942 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003943 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003944 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003945 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3946 if not pingResult:
3947 main.log.warn("First pingall failed. Retrying...")
3948 time.sleep(main.pingSleep)
3949 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003950
Hari Krishnac195f3b2015-07-08 20:02:24 -07003951 time2 = time.time()
3952 timeDiff = round( ( time2 - time1 ), 2 )
3953 main.log.report(
3954 "Time taken for Ping All: " +
3955 str( timeDiff ) +
3956 " seconds" )
3957
GlennRCfa69a2a2015-10-02 15:54:06 -07003958 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003959 utilities.assert_equals(
3960 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003961 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003962 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3963 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3964
GlennRCfa69a2a2015-10-02 15:54:06 -07003965 if not intentState:
3966 main.log.debug( "Intents failed to install completely" )
3967 if not pingResult:
3968 main.log.debug( "Pingall failed" )
3969 if not checkFlowsState:
3970 main.log.debug( "Flows failed to add completely" )
3971
3972 if not caseResult and main.failSwitch:
3973 main.log.report("Stopping test")
3974 main.stop( email=main.emailOnStop )
3975
Hari Krishnac195f3b2015-07-08 20:02:24 -07003976 def CASE98( self ):
3977 """
3978 Install single-multi point intents and verify Ping all works
3979 for Spine topology
3980 """
3981 import copy
3982 main.log.report( "Install single-multi point intents and verify Ping all" )
3983 main.log.report( "___________________________________________" )
3984 main.case( "Install single-multi point intents and Ping all" )
3985 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3986 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3987 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3988 intentIdList = []
3989 MACsDictCopy = {}
3990 for i in range( len( deviceDPIDsCopy ) ):
3991 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3992
GlennRCfa69a2a2015-10-02 15:54:06 -07003993 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3994 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003995 time1 = time.time()
3996 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3997 pool = []
3998 for cli in main.CLIs:
3999 if i >= len( deviceDPIDsCopy ):
4000 break
4001 ingressDevice = deviceDPIDsCopy[i]
4002 egressDeviceList = copy.copy(deviceDPIDsCopy)
4003 egressDeviceList.remove(ingressDevice)
4004 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4005 threadID=main.threadID,
4006 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004007 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004008 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004009 t.start()
4010 i = i + 1
4011 main.threadID = main.threadID + 1
4012 for thread in pool:
4013 thread.join()
4014 intentIdList.append(thread.result)
4015 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004016 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004017
4018 main.step("Verify intents are installed")
4019
GlennRC1dde1712015-10-02 11:03:08 -07004020 # Giving onos multiple chances to install intents
4021 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004022 if i != 0:
4023 main.log.warn( "Verification failed. Retrying..." )
4024 main.log.info("Waiting for onos to install intents...")
4025 time.sleep( main.checkIntentsDelay )
4026
4027 intentState = main.TRUE
4028 for e in range(int(main.numCtrls)):
4029 main.log.info( "Checking intents on CLI %s" % (e+1) )
4030 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4031 intentState
4032 if not intentState:
4033 main.log.warn( "Not all intents installed" )
4034 if intentState:
4035 break
4036 else:
4037 #Dumping intent summary
4038 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4039
GlennRCdb2c8422015-09-29 12:21:59 -07004040 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4041 onpass="INTENTS INSTALLED",
4042 onfail="SOME INTENTS NOT INSTALLED" )
4043
GlennRCfa69a2a2015-10-02 15:54:06 -07004044 main.step("Verify flows are all added")
4045
4046 for i in range( main.flowCheck ):
4047 if i != 0:
4048 main.log.warn( "verification failed. Retrying..." )
4049 main.log.info( "Waiting for onos to add flows..." )
4050 time.sleep( main.checkFlowsDelay )
4051
4052 flowState = main.TRUE
4053 for cli in main.CLIs:
4054 flowState = cli.checkFlowState()
4055 if not flowState:
4056 main.log.warn( "Not all flows added" )
4057 if flowState:
4058 break
4059 else:
4060 #Dumping summary
4061 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4062
4063 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4064 onpass="FLOWS INSTALLED",
4065 onfail="SOME FLOWS NOT ADDED" )
4066
Hari Krishnac195f3b2015-07-08 20:02:24 -07004067 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004068 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004069 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004070 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4071 if not pingResult:
4072 main.log.warn("First pingall failed. Retrying...")
4073 time.sleep(main.pingSleep)
4074 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004075
Hari Krishnac195f3b2015-07-08 20:02:24 -07004076 time2 = time.time()
4077 timeDiff = round( ( time2 - time1 ), 2 )
4078 main.log.report(
4079 "Time taken for Ping All: " +
4080 str( timeDiff ) +
4081 " seconds" )
4082
GlennRCfa69a2a2015-10-02 15:54:06 -07004083 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004084 utilities.assert_equals(
4085 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004086 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004087 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4088 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4089
GlennRCfa69a2a2015-10-02 15:54:06 -07004090 if not intentState:
4091 main.log.debug( "Intents failed to install completely" )
4092 if not pingResult:
4093 main.log.debug( "Pingall failed" )
4094 if not checkFlowsState:
4095 main.log.debug( "Flows failed to add completely" )
4096
4097 if not caseResult and main.failSwitch:
4098 main.log.report("Stopping test")
4099 main.stop( email=main.emailOnStop )
4100
Hari Krishna4223dbd2015-08-13 16:29:53 -07004101 def CASE190( self ):
4102 """
4103 Verify IPv6 ping across 600 Point intents (Att Topology)
4104 """
4105 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4106 main.log.report( "_________________________________________________" )
4107 import itertools
4108 import time
4109 main.case( "IPv6 ping all 600 Point intents" )
4110 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004111 pingResult = main.FALSE
4112 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004113 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004114 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004115 main.log.warn("First pingall failed. Retrying...")
4116 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004117 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004118 time2 = time.time()
4119 timeDiff = round( ( time2 - time1 ), 2 )
4120 main.log.report(
4121 "Time taken for IPv6 Ping All: " +
4122 str( timeDiff ) +
4123 " seconds" )
4124 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4125 onpass="PING ALL PASS",
4126 onfail="PING ALL FAIL" )
4127
GlennRCbddd58f2015-10-01 15:45:25 -07004128 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004129 utilities.assert_equals(
4130 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004131 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004132 onpass="IPv6 Ping across 600 Point intents test PASS",
4133 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4134
4135 def CASE191( self ):
4136 """
4137 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4138 """
4139 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4140 main.log.report( "_________________________________________________" )
4141 import itertools
4142 import time
4143 main.case( "IPv6 ping all 600 Point intents" )
4144 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004145 pingResult = main.FALSE
4146 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004147 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004148 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004149 main.log.warn("First pingall failed. Retrying...")
4150 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004151 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004152 time2 = time.time()
4153 timeDiff = round( ( time2 - time1 ), 2 )
4154 main.log.report(
4155 "Time taken for IPv6 Ping All: " +
4156 str( timeDiff ) +
4157 " seconds" )
4158 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4159 onpass="PING ALL PASS",
4160 onfail="PING ALL FAIL" )
4161
GlennRCbddd58f2015-10-01 15:45:25 -07004162 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004163 utilities.assert_equals(
4164 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004165 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004166 onpass="IPv6 Ping across 600 Point intents test PASS",
4167 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4168
4169 def CASE192( self ):
4170 """
4171 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4172 """
4173 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4174 main.log.report( "_________________________________________________" )
4175 import itertools
4176 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004177 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004178 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004179 pingResult = main.FALSE
4180 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004181 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004182 if not pingResult:
4183 main.log.warn("First pingall failed. Retrying...")
4184 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004185 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004186 time2 = time.time()
4187 timeDiff = round( ( time2 - time1 ), 2 )
4188 main.log.report(
4189 "Time taken for IPv6 Ping All: " +
4190 str( timeDiff ) +
4191 " seconds" )
4192 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4193 onpass="PING ALL PASS",
4194 onfail="PING ALL FAIL" )
4195
GlennRCbddd58f2015-10-01 15:45:25 -07004196 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004197 utilities.assert_equals(
4198 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004199 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004200 onpass="IPv6 Ping across 4556 Point intents test PASS",
4201 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004202
Hari Krishnac195f3b2015-07-08 20:02:24 -07004203 def CASE10( self ):
4204 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004205 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004206 """
4207 Remove all Intents
4208 """
4209 main.log.report( "Remove all intents that were installed previously" )
4210 main.log.report( "______________________________________________" )
4211 main.log.info( "Remove all intents" )
4212 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004213 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004214 main.step( "Obtain the intent id's first" )
4215 intentsList = main.ONOScli1.getAllIntentIds()
4216 ansi_escape = re.compile( r'\x1b[^m]*m' )
4217 intentsList = ansi_escape.sub( '', intentsList )
4218 intentsList = intentsList.replace(
4219 " onos:intents | grep id=",
4220 "" ).replace(
4221 "id=",
4222 "" ).replace(
4223 "\r\r",
4224 "" )
4225 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004226 intentIdList = []
4227 step1Result = main.TRUE
4228 moreIntents = main.TRUE
4229 removeIntentCount = 0
4230 intentsCount = len(intentsList)
4231 main.log.info ( "Current number of intents: " + str(intentsCount) )
4232 if ( len( intentsList ) > 1 ):
4233 results = main.TRUE
4234 main.log.info("Removing intent...")
4235 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004236 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004237 if removeIntentCount == 5:
4238 break
4239 removeIntentCount = removeIntentCount + 1
4240 intentsList1 = main.ONOScli1.getAllIntentIds()
4241 if len( intentsList1 ) == 0:
4242 break
4243 ansi_escape = re.compile( r'\x1b[^m]*m' )
4244 intentsList1 = ansi_escape.sub( '', intentsList1 )
4245 intentsList1 = intentsList1.replace(
4246 " onos:intents | grep id=",
4247 "" ).replace(
4248 " state=",
4249 "" ).replace(
4250 "\r\r",
4251 "" )
4252 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004253 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4254 print intentsList1
4255 intentIdList1 = []
4256 if ( len( intentsList1 ) > 0 ):
4257 moreIntents = main.TRUE
4258 for i in range( len( intentsList1 ) ):
4259 intentsTemp1 = intentsList1[ i ].split( ',' )
4260 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4261 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4262 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4263 time1 = time.time()
4264 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4265 pool = []
4266 for cli in main.CLIs:
4267 if i >= len( intentIdList1 ):
4268 break
4269 t = main.Thread( target=cli.removeIntent,
4270 threadID=main.threadID,
4271 name="removeIntent",
4272 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4273 pool.append(t)
4274 t.start()
4275 i = i + 1
4276 main.threadID = main.threadID + 1
4277 for thread in pool:
4278 thread.join()
4279 intentIdList.append(thread.result)
4280 #time.sleep(2)
4281 time2 = time.time()
4282 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004283 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004284 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004285 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004286 else:
4287 time.sleep(10)
4288 if len( main.ONOScli1.intents()):
4289 continue
4290 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004291 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004292 else:
4293 print "Removed %d intents" %(intentsCount)
4294 step1Result = main.TRUE
4295 else:
4296 print "No Intent IDs found in Intents list: ", intentsList
4297 step1Result = main.FALSE
4298
4299 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004300 caseResult = step1Result
4301 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004302 onpass="Intent removal test successful",
4303 onfail="Intent removal test failed" )
4304
4305 def CASE12( self, main ):
4306 """
4307 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4308 """
4309 import re
4310 import copy
4311 import time
4312
Hari Krishnac195f3b2015-07-08 20:02:24 -07004313 threadID = 0
4314
4315 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4316 main.log.report( "_____________________________________________________" )
4317 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4318 main.step( "Enable intent based Reactive forwarding" )
4319 installResult = main.FALSE
4320 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004321
Hari Krishnac195f3b2015-07-08 20:02:24 -07004322 pool = []
4323 time1 = time.time()
4324 for cli,feature in main.CLIs:
4325 t = main.Thread(target=cli,threadID=threadID,
4326 name="featureInstall",args=[feature])
4327 pool.append(t)
4328 t.start()
4329 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004330
Hari Krishnac195f3b2015-07-08 20:02:24 -07004331 results = []
4332 for thread in pool:
4333 thread.join()
4334 results.append(thread.result)
4335 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004336
Hari Krishnac195f3b2015-07-08 20:02:24 -07004337 if( all(result == main.TRUE for result in results) == False):
4338 main.log.info("Did not install onos-app-ifwd feature properly")
4339 #main.cleanup()
4340 #main.exit()
4341 else:
4342 main.log.info("Successful feature:install onos-app-ifwd")
4343 installResult = main.TRUE
4344 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004345
GlennRC6ac11b12015-10-21 17:41:28 -07004346 main.step( "Verify Ping across all hosts" )
4347 for i in range(main.numPings):
4348 time1 = time.time()
4349 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4350 if not pingResult:
4351 main.log.warn("First pingall failed. Retrying...")
4352 time.sleep(main.pingSleep)
4353 else: break
4354
Hari Krishnac195f3b2015-07-08 20:02:24 -07004355 time2 = time.time()
4356 timeDiff = round( ( time2 - time1 ), 2 )
4357 main.log.report(
4358 "Time taken for Ping All: " +
4359 str( timeDiff ) +
4360 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004361
GlennRC626ba132015-09-18 16:16:31 -07004362 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004363 main.log.report( "Pingall Test in Reactive mode successful" )
4364 else:
4365 main.log.report( "Pingall Test in Reactive mode failed" )
4366
4367 main.step( "Disable Intent based Reactive forwarding" )
4368 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004369
Hari Krishnac195f3b2015-07-08 20:02:24 -07004370 pool = []
4371 time1 = time.time()
4372 for cli,feature in main.CLIs:
4373 t = main.Thread(target=cli,threadID=threadID,
4374 name="featureUninstall",args=[feature])
4375 pool.append(t)
4376 t.start()
4377 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004378
Hari Krishnac195f3b2015-07-08 20:02:24 -07004379 results = []
4380 for thread in pool:
4381 thread.join()
4382 results.append(thread.result)
4383 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004384
Hari Krishnac195f3b2015-07-08 20:02:24 -07004385 if( all(result == main.TRUE for result in results) == False):
4386 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4387 uninstallResult = main.FALSE
4388 #main.cleanup()
4389 #main.exit()
4390 else:
4391 main.log.info("Successful feature:uninstall onos-app-ifwd")
4392 uninstallResult = main.TRUE
4393 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4394
4395 # Waiting for reative flows to be cleared.
4396 time.sleep( 10 )
4397
GlennRCbddd58f2015-10-01 15:45:25 -07004398 caseResult = installResult and pingResult and uninstallResult
4399 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004400 onpass="Intent based Reactive forwarding Pingall test PASS",
4401 onfail="Intent based Reactive forwarding Pingall test FAIL" )