blob: c4713d06652a0af1fee64e78a260613035e3af12 [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
30 main.pingTimeout = 300
31 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']
Hari Krishnac195f3b2015-07-08 20:02:24 -070035 main.newTopo = ""
36 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070037
38 for i in range( 1, int(main.numCtrls) + 1 ):
39 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070040
41 main.case( "Set up test environment" )
42 main.log.report( "Set up test environment" )
43 main.log.report( "_______________________" )
44
Hari Krishna6185fc12015-07-13 15:42:31 -070045 main.step( "Apply Cell environment for ONOS" )
46 if ( main.onoscell ):
47 cellName = main.onoscell
48 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070049 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
50 onpass="Test step PASS",
51 onfail="Test step FAIL" )
52 else:
53 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
54 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
55 main.clean()
56 main.exit()
57
Hari Krishnac195f3b2015-07-08 20:02:24 -070058 main.step( "Git checkout and pull " + git_branch )
59 if git_pull == 'on':
60 checkout_result = main.ONOSbench.gitCheckout( git_branch )
61 pull_result = main.ONOSbench.gitPull()
62 cp_result = ( checkout_result and pull_result )
63 else:
64 checkout_result = main.TRUE
65 pull_result = main.TRUE
66 main.log.info( "Skipped git checkout and pull" )
67 cp_result = ( checkout_result and pull_result )
68 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
69 onpass="Test step PASS",
70 onfail="Test step FAIL" )
71
72 main.step( "mvn clean & install" )
73 if git_pull == 'on':
74 mvn_result = main.ONOSbench.cleanInstall()
75 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
76 onpass="Test step PASS",
77 onfail="Test step FAIL" )
78 else:
79 mvn_result = main.TRUE
80 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
81
82 main.ONOSbench.getVersion( report=True )
83
Hari Krishnac195f3b2015-07-08 20:02:24 -070084 main.step( "Create ONOS package" )
85 packageResult = main.ONOSbench.onosPackage()
86 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
87 onpass="Test step PASS",
88 onfail="Test step FAIL" )
89
90 main.step( "Uninstall ONOS package on all Nodes" )
91 uninstallResult = main.TRUE
92 for i in range( int( main.numCtrls ) ):
93 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
94 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
95 utilities.assert_equals( expect=main.TRUE, actual=u_result,
96 onpass="Test step PASS",
97 onfail="Test step FAIL" )
98 uninstallResult = ( uninstallResult and u_result )
99
100 main.step( "Install ONOS package on all Nodes" )
101 installResult = main.TRUE
102 for i in range( int( main.numCtrls ) ):
103 main.log.info( "Intsalling package on ONOS Node IP: " + main.onosIPs[i] )
104 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
105 utilities.assert_equals( expect=main.TRUE, actual=i_result,
106 onpass="Test step PASS",
107 onfail="Test step FAIL" )
108 installResult = ( installResult and i_result )
109
110 main.step( "Verify ONOS nodes UP status" )
111 statusResult = main.TRUE
112 for i in range( int( main.numCtrls ) ):
113 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
114 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
115 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
116 onpass="Test step PASS",
117 onfail="Test step FAIL" )
118 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700119
Hari Krishnac195f3b2015-07-08 20:02:24 -0700120 main.step( "Start ONOS CLI on all nodes" )
121 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700122 main.log.step(" Start ONOS cli using thread ")
123 startCliResult = main.TRUE
124 pool = []
125 time1 = time.time()
126 for i in range( int( main.numCtrls) ):
127 t = main.Thread( target=main.CLIs[i].startOnosCli,
128 threadID=main.threadID,
129 name="startOnosCli",
130 args=[ main.onosIPs[i], karafTimeout ] )
131 pool.append(t)
132 t.start()
133 main.threadID = main.threadID + 1
134 for t in pool:
135 t.join()
136 startCliResult = startCliResult and t.result
137 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700138
Hari Krishnac195f3b2015-07-08 20:02:24 -0700139 if not startCliResult:
140 main.log.info("ONOS CLI did not start up properly")
141 main.cleanup()
142 main.exit()
143 else:
144 main.log.info("Successful CLI startup")
145 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700146
147 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
148 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
149 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
150 cfgResult = cfgResult1 and cfgResult2
151 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
152 onpass="ipv6NeighborDiscovery cfg is set to true",
153 onfail="Failed to cfg set ipv6NeighborDiscovery" )
154
155 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700156 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
157 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
158 onpass="Set up test environment PASS",
159 onfail="Set up test environment FAIL" )
160
161 def CASE20( self, main ):
162 """
163 This test script Loads a new Topology (Att) on CHO setup and balances all switches
164 """
165 import re
166 import time
167 import copy
168
169 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
170 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
171 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
172 main.pingTimeout = 300
173 main.log.report(
174 "Load Att topology and Balance all Mininet switches across controllers" )
175 main.log.report(
176 "________________________________________________________________________" )
177 main.case(
178 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700179
Hari Krishnac195f3b2015-07-08 20:02:24 -0700180 main.step( "Stop any previous Mininet network topology" )
181 cliResult = main.TRUE
182 if main.newTopo == main.params['TOPO3']['topo']:
183 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
184
185 main.step( "Start Mininet with Att topology" )
186 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700187 mininetDir = main.Mininet1.home + "/custom/"
188 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
189 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
190 topoPath = mininetDir + main.newTopo
191 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700192
Hari Krishnac195f3b2015-07-08 20:02:24 -0700193 main.step( "Assign switches to controllers" )
194 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
195 main.Mininet1.assignSwController(
196 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700197 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700198
199 switch_mastership = main.TRUE
200 for i in range( 1, ( main.numMNswitches + 1 ) ):
201 response = main.Mininet1.getSwController( "s" + str( i ) )
202 print( "Response is " + str( response ) )
203 if re.search( "tcp:" + main.onosIPs[0], response ):
204 switch_mastership = switch_mastership and main.TRUE
205 else:
206 switch_mastership = main.FALSE
207
208 if switch_mastership == main.TRUE:
209 main.log.report( "Controller assignment successfull" )
210 else:
211 main.log.report( "Controller assignment failed" )
212
213 time.sleep(30) # waiting here to make sure topology converges across all nodes
214
215 main.step( "Balance devices across controllers" )
216 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700217 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700218 time.sleep( 5 )
219
220 topology_output = main.ONOScli1.topology()
221 topology_result = main.ONOSbench.getTopology( topology_output )
222 case2Result = ( switch_mastership and startStatus )
223 utilities.assert_equals(
224 expect=main.TRUE,
225 actual=case2Result,
226 onpass="Starting new Att topology test PASS",
227 onfail="Starting new Att topology test FAIL" )
228
229 def CASE21( self, main ):
230 """
231 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
232 """
233 import re
234 import time
235 import copy
236
237 main.newTopo = main.params['TOPO2']['topo']
238 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
239 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
240 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
241 main.pingTimeout = 300
242 main.log.report(
243 "Load Chordal topology and Balance all Mininet switches across controllers" )
244 main.log.report(
245 "________________________________________________________________________" )
246 main.case(
247 "Assign and Balance all Mininet switches across controllers" )
248
249 main.step( "Stop any previous Mininet network topology" )
250 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
251
GlennRCc6cd2a62015-08-10 16:08:22 -0700252 main.step("Start Mininet with Chordal topology")
253 mininetDir = main.Mininet1.home + "/custom/"
254 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
255 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
256 topoPath = mininetDir + main.newTopo
257 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700258
259 main.step( "Assign switches to controllers" )
260
261 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
262 main.Mininet1.assignSwController(
263 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700264 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265
266 switch_mastership = main.TRUE
267 for i in range( 1, ( main.numMNswitches + 1 ) ):
268 response = main.Mininet1.getSwController( "s" + str( i ) )
269 print( "Response is " + str( response ) )
270 if re.search( "tcp:" + main.onosIPs[0], response ):
271 switch_mastership = switch_mastership and main.TRUE
272 else:
273 switch_mastership = main.FALSE
274
275 if switch_mastership == main.TRUE:
276 main.log.report( "Controller assignment successfull" )
277 else:
278 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700279
Hari Krishnac195f3b2015-07-08 20:02:24 -0700280 main.step( "Balance devices across controllers" )
281 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700282 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700283 time.sleep( 5 )
284
285 case21Result = switch_mastership
286 time.sleep(30)
287 utilities.assert_equals(
288 expect=main.TRUE,
289 actual=case21Result,
290 onpass="Starting new Chordal topology test PASS",
291 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700292
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293 def CASE22( self, main ):
294 """
295 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
296 """
297 import re
298 import time
299 import copy
300
301 main.newTopo = main.params['TOPO3']['topo']
302 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
303 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
304 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
305 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700306
Hari Krishnac195f3b2015-07-08 20:02:24 -0700307 main.log.report(
308 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
309 main.log.report(
310 "________________________________________________________________________" )
311 main.case(
312 "Assign and Balance all Mininet switches across controllers" )
313 main.step( "Stop any previous Mininet network topology" )
314 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700315
316 main.step("Start Mininet with Spine topology")
317 mininetDir = main.Mininet1.home + "/custom/"
318 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
319 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
320 topoPath = mininetDir + main.newTopo
321 startStatus = main.Mininet1.startNet(topoFile = topoPath)
322
Hari Krishnac195f3b2015-07-08 20:02:24 -0700323 time.sleep(60)
324 main.step( "Assign switches to controllers" )
325
326 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
327 main.Mininet1.assignSwController(
328 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700329 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700330
331 switch_mastership = main.TRUE
332 for i in range( 1, ( main.numMNswitches + 1 ) ):
333 response = main.Mininet1.getSwController( "s" + str( i ) )
334 print( "Response is " + str( response ) )
335 if re.search( "tcp:" + main.onosIPs[0], response ):
336 switch_mastership = switch_mastership and main.TRUE
337 else:
338 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700339
Hari Krishnac195f3b2015-07-08 20:02:24 -0700340 if switch_mastership == main.TRUE:
341 main.log.report( "Controller assignment successfull" )
342 else:
343 main.log.report( "Controller assignment failed" )
344 time.sleep( 5 )
345
346 main.step( "Balance devices across controllers" )
347 for i in range( int( main.numCtrls ) ):
348 balanceResult = main.ONOScli1.balanceMasters()
349 # giving some breathing time for ONOS to complete re-balance
350 time.sleep( 3 )
351
352 case22Result = switch_mastership
353 time.sleep(60)
354 utilities.assert_equals(
355 expect=main.TRUE,
356 actual=case22Result,
357 onpass="Starting new Spine topology test PASS",
358 onfail="Starting new Spine topology test FAIL" )
359
360 def CASE3( self, main ):
361 """
362 This Test case will be extended to collect and store more data related
363 ONOS state.
364 """
365 import re
366 import copy
367 main.deviceDPIDs = []
368 main.hostMACs = []
369 main.deviceLinks = []
370 main.deviceActiveLinksCount = []
371 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700372
Hari Krishnac195f3b2015-07-08 20:02:24 -0700373 main.log.report(
374 "Collect and Store topology details from ONOS before running any Tests" )
375 main.log.report(
376 "____________________________________________________________________" )
377 main.case( "Collect and Store Topology Details from ONOS" )
378 main.step( "Collect and store current number of switches and links" )
379 topology_output = main.ONOScli1.topology()
380 topology_result = main.ONOSbench.getTopology( topology_output )
381 numOnosDevices = topology_result[ 'devices' ]
382 numOnosLinks = topology_result[ 'links' ]
383 topoResult = main.TRUE
384
385 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
386 main.step( "Store Device DPIDs" )
387 for i in range( 1, (main.numMNswitches+1) ):
388 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
389 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
390
391 main.step( "Store Host MACs" )
392 for i in range( 1, ( main.numMNhosts + 1 ) ):
393 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
394 print "Host MACs in Store: \n", str( main.hostMACs )
395 main.MACsDict = {}
396 print "Creating dictionary of DPID and HostMacs"
397 for i in range(len(main.hostMACs)):
398 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
399 print main.MACsDict
400 main.step( "Collect and store all Devices Links" )
401 linksResult = main.ONOScli1.links( jsonFormat=False )
402 ansi_escape = re.compile( r'\x1b[^m]*m' )
403 linksResult = ansi_escape.sub( '', linksResult )
404 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
405 linksResult = linksResult.splitlines()
406 main.deviceLinks = copy.copy( linksResult )
407 print "Device Links Stored: \n", str( main.deviceLinks )
408 # this will be asserted to check with the params provided count of
409 # links
410 print "Length of Links Store", len( main.deviceLinks )
411
412 main.step( "Collect and store each Device ports enabled Count" )
413 time1 = time.time()
414 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
415 pool = []
416 for cli in main.CLIs:
417 if i >= main.numMNswitches + 1:
418 break
419 dpid = "of:00000000000000" + format( i,'02x' )
420 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
421 t.start()
422 pool.append(t)
423 i = i + 1
424 main.threadID = main.threadID + 1
425 for thread in pool:
426 thread.join()
427 portResult = thread.result
428 main.devicePortsEnabledCount.append( portResult )
429 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
430 time2 = time.time()
431 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
432
433 main.step( "Collect and store each Device active links Count" )
434 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700435
Hari Krishnac195f3b2015-07-08 20:02:24 -0700436 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
437 pool = []
438 for cli in main.CLIs:
439 if i >= main.numMNswitches + 1:
440 break
441 dpid = "of:00000000000000" + format( i,'02x' )
442 t = main.Thread( target = cli.getDeviceLinksActiveCount,
443 threadID = main.threadID,
444 name = "getDevicePortsEnabledCount",
445 args = [dpid])
446 t.start()
447 pool.append(t)
448 i = i + 1
449 main.threadID = main.threadID + 1
450 for thread in pool:
451 thread.join()
452 linkCountResult = thread.result
453 main.deviceActiveLinksCount.append( linkCountResult )
454 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
455 time2 = time.time()
456 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
457
458 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700459 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700460 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
461 main.log.info("Devices (actual): %s, Links (actual): %s" %
462 ( numOnosDevices , numOnosLinks ) )
463 main.log.info("Topology does not match, exiting CHO test...")
464 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700465 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700466 main.cleanup()
467 main.exit()
468
469 # just returning TRUE for now as this one just collects data
470 case3Result = topoResult
471 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
472 onpass="Saving ONOS topology data test PASS",
473 onfail="Saving ONOS topology data test FAIL" )
474
475 def CASE40( self, main ):
476 """
477 Verify Reactive forwarding (Att Topology)
478 """
479 import re
480 import copy
481 import time
482 main.log.report( "Verify Reactive forwarding (Att Topology)" )
483 main.log.report( "______________________________________________" )
484 main.case( "Enable Reactive forwarding and Verify ping all" )
485 main.step( "Enable Reactive forwarding" )
486 installResult = main.TRUE
487 # Activate fwd app
488 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
489 appCheck = main.TRUE
490 pool = []
491 for cli in main.CLIs:
492 t = main.Thread( target=cli.appToIDCheck,
493 name="appToIDCheck-" + str( i ),
494 args=[] )
495 pool.append( t )
496 t.start()
497 for t in pool:
498 t.join()
499 appCheck = appCheck and t.result
500 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
501 onpass="App Ids seem to be correct",
502 onfail="Something is wrong with app Ids" )
503 if appCheck != main.TRUE:
504 main.log.warn( main.CLIs[0].apps() )
505 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700506
Hari Krishnac195f3b2015-07-08 20:02:24 -0700507 time.sleep( 10 )
508
509 main.step( "Verify Pingall" )
510 ping_result = main.FALSE
511 time1 = time.time()
512 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
513 time2 = time.time()
514 timeDiff = round( ( time2 - time1 ), 2 )
515 main.log.report(
516 "Time taken for Ping All: " +
517 str( timeDiff ) +
518 " seconds" )
519
520 if ping_result == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700521 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700522 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700523 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700524
Hari Krishna4223dbd2015-08-13 16:29:53 -0700525 case40Result = appCheck and ping_result
Hari Krishnac195f3b2015-07-08 20:02:24 -0700526 utilities.assert_equals( expect=main.TRUE, actual=case40Result,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700527 onpass="Reactive Mode IPv4 Pingall test PASS",
528 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700529
530 def CASE41( self, main ):
531 """
532 Verify Reactive forwarding (Chordal Topology)
533 """
534 import re
535 import copy
536 import time
537 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
538 main.log.report( "______________________________________________" )
539 main.case( "Enable Reactive forwarding and Verify ping all" )
540 main.step( "Enable Reactive forwarding" )
541 installResult = main.TRUE
542 # Activate fwd app
543 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
544
545 appCheck = main.TRUE
546 pool = []
547 for cli in main.CLIs:
548 t = main.Thread( target=cli.appToIDCheck,
549 name="appToIDCheck-" + str( i ),
550 args=[] )
551 pool.append( t )
552 t.start()
553 for t in pool:
554 t.join()
555 appCheck = appCheck and t.result
556 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
557 onpass="App Ids seem to be correct",
558 onfail="Something is wrong with app Ids" )
559 if appCheck != main.TRUE:
560 main.log.warn( main.CLIs[0].apps() )
561 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700562
Hari Krishnac195f3b2015-07-08 20:02:24 -0700563 time.sleep( 10 )
564
565 main.step( "Verify Pingall" )
566 ping_result = main.FALSE
567 time1 = time.time()
568 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
569 time2 = time.time()
570 timeDiff = round( ( time2 - time1 ), 2 )
571 main.log.report(
572 "Time taken for Ping All: " +
573 str( timeDiff ) +
574 " seconds" )
575
576 if ping_result == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700577 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700578 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700579 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700580
Hari Krishna4223dbd2015-08-13 16:29:53 -0700581 case41Result = appCheck and ping_result
Hari Krishnac195f3b2015-07-08 20:02:24 -0700582 utilities.assert_equals( expect=main.TRUE, actual=case41Result,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700583 onpass="Reactive Mode IPv4 Pingall test PASS",
584 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700585
586 def CASE42( self, main ):
587 """
588 Verify Reactive forwarding (Spine Topology)
589 """
590 import re
591 import copy
592 import time
593 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
594 main.log.report( "______________________________________________" )
595 main.case( "Enable Reactive forwarding and Verify ping all" )
596 main.step( "Enable Reactive forwarding" )
597 installResult = main.TRUE
598 # Activate fwd app
599 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
600
601 appCheck = main.TRUE
602 pool = []
603 for cli in main.CLIs:
604 t = main.Thread( target=cli.appToIDCheck,
605 name="appToIDCheck-" + str( i ),
606 args=[] )
607 pool.append( t )
608 t.start()
609 for t in pool:
610 t.join()
611 appCheck = appCheck and t.result
612 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
613 onpass="App Ids seem to be correct",
614 onfail="Something is wrong with app Ids" )
615 if appCheck != main.TRUE:
616 main.log.warn( main.CLIs[0].apps() )
617 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700618
Hari Krishnac195f3b2015-07-08 20:02:24 -0700619 time.sleep( 10 )
620
621 main.step( "Verify Pingall" )
622 ping_result = main.FALSE
623 time1 = time.time()
624 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
625 time2 = time.time()
626 timeDiff = round( ( time2 - time1 ), 2 )
627 main.log.report(
628 "Time taken for Ping All: " +
629 str( timeDiff ) +
630 " seconds" )
631
632 if ping_result == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700633 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700634 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700635 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
636
637 case42Result = appCheck and ping_result
638 utilities.assert_equals( expect=main.TRUE, actual=case42Result,
639 onpass="Reactive Mode IPv4 Pingall test PASS",
640 onfail="Reactive Mode IPv4 Pingall test FAIL" )
641
642 def CASE140( self, main ):
643 """
644 Verify IPv6 Reactive forwarding (Att Topology)
645 """
646 import re
647 import copy
648 import time
649 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
650 main.log.report( "______________________________________________" )
651 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
652 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
653
654 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
655 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
656 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
657 cfgResult = cfgResult1 and cfgResult2
658 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
659 onpass="Reactive mode ipv6Fowarding cfg is set to true",
660 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
661
662 main.step( "Verify IPv6 Pingall" )
663 ping_result = main.FALSE
664 time1 = time.time()
665 ping_result = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
666 time2 = time.time()
667 timeDiff = round( ( time2 - time1 ), 2 )
668 main.log.report(
669 "Time taken for IPv6 Ping All: " +
670 str( timeDiff ) +
671 " seconds" )
672
673 if ping_result == main.TRUE:
674 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
675 else:
676 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700677
678 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700679
Hari Krishnac195f3b2015-07-08 20:02:24 -0700680 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700681 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700682 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
683 pool = []
684 for cli in main.CLIs:
685 t = main.Thread( target=cli.appToIDCheck,
686 name="appToIDCheck-" + str( i ),
687 args=[] )
688 pool.append( t )
689 t.start()
690
691 for t in pool:
692 t.join()
693 appCheck = appCheck and t.result
694 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
695 onpass="App Ids seem to be correct",
696 onfail="Something is wrong with app Ids" )
697 if appCheck != main.TRUE:
698 main.log.warn( main.CLIs[0].apps() )
699 main.log.warn( main.CLIs[0].appIDs() )
700
701 # Waiting for reative flows to be cleared.
702 time.sleep( 30 )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700703 case140Result = appCheck and cfgResult and ping_result
704 utilities.assert_equals( expect=main.TRUE, actual=case140Result,
705 onpass="Reactive Mode IPv6 Pingall test PASS",
706 onfail="Reactive Mode IPv6 Pingall test FAIL" )
707
708 def CASE141( self, main ):
709 """
710 Verify IPv6 Reactive forwarding (Chordal Topology)
711 """
712 import re
713 import copy
714 import time
715 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
716 main.log.report( "______________________________________________" )
717 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
718 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
719
720 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
721 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
722 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
723 cfgResult = cfgResult1 and cfgResult2
724 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
725 onpass="Reactive mode ipv6Fowarding cfg is set to true",
726 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
727
728 main.step( "Verify IPv6 Pingall" )
729 ping_result = main.FALSE
730 time1 = time.time()
731 ping_result = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
732 time2 = time.time()
733 timeDiff = round( ( time2 - time1 ), 2 )
734 main.log.report(
735 "Time taken for IPv6 Ping All: " +
736 str( timeDiff ) +
737 " seconds" )
738
739 if ping_result == main.TRUE:
740 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
741 else:
742 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
743
744 main.step( "Disable Reactive forwarding" )
745
746 main.log.info( "Uninstall reactive forwarding app" )
747 appCheck = main.TRUE
748 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
749 pool = []
750 for cli in main.CLIs:
751 t = main.Thread( target=cli.appToIDCheck,
752 name="appToIDCheck-" + str( i ),
753 args=[] )
754 pool.append( t )
755 t.start()
756
757 for t in pool:
758 t.join()
759 appCheck = appCheck and t.result
760 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
761 onpass="App Ids seem to be correct",
762 onfail="Something is wrong with app Ids" )
763 if appCheck != main.TRUE:
764 main.log.warn( main.CLIs[0].apps() )
765 main.log.warn( main.CLIs[0].appIDs() )
766
767 # Waiting for reative flows to be cleared.
768 time.sleep( 30 )
769 case140Result = appCheck and cfgResult and ping_result
770 utilities.assert_equals( expect=main.TRUE, actual=case140Result,
771 onpass="Reactive Mode IPv6 Pingall test PASS",
772 onfail="Reactive Mode IPv6 Pingall test FAIL" )
773
774 def CASE142( self, main ):
775 """
776 Verify IPv6 Reactive forwarding (Spine Topology)
777 """
778 import re
779 import copy
780 import time
781 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
782 main.log.report( "______________________________________________" )
783 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
784 # Spine topology do not have hosts h1-h10
785 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
786 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
787 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
788 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
789 cfgResult = cfgResult1 and cfgResult2
790 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
791 onpass="Reactive mode ipv6Fowarding cfg is set to true",
792 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
793
794 main.step( "Verify IPv6 Pingall" )
795 ping_result = main.FALSE
796 time1 = time.time()
797 ping_result = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
798 time2 = time.time()
799 timeDiff = round( ( time2 - time1 ), 2 )
800 main.log.report(
801 "Time taken for IPv6 Ping All: " +
802 str( timeDiff ) +
803 " seconds" )
804
805 if ping_result == main.TRUE:
806 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
807 else:
808 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
809
810 main.step( "Disable Reactive forwarding" )
811
812 main.log.info( "Uninstall reactive forwarding app" )
813 appCheck = main.TRUE
814 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
815 pool = []
816 for cli in main.CLIs:
817 t = main.Thread( target=cli.appToIDCheck,
818 name="appToIDCheck-" + str( i ),
819 args=[] )
820 pool.append( t )
821 t.start()
822
823 for t in pool:
824 t.join()
825 appCheck = appCheck and t.result
826 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
827 onpass="App Ids seem to be correct",
828 onfail="Something is wrong with app Ids" )
829 if appCheck != main.TRUE:
830 main.log.warn( main.CLIs[0].apps() )
831 main.log.warn( main.CLIs[0].appIDs() )
832
833 # Waiting for reative flows to be cleared.
834 time.sleep( 30 )
835 case142Result = appCheck and cfgResult and ping_result
836 utilities.assert_equals( expect=main.TRUE, actual=case142Result,
837 onpass="Reactive Mode IPv6 Pingall test PASS",
838 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700839
840 def CASE5( self, main ):
841 """
842 Compare current ONOS topology with reference data
843 """
844 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700845
Hari Krishnac195f3b2015-07-08 20:02:24 -0700846 devicesDPIDTemp = []
847 hostMACsTemp = []
848 deviceLinksTemp = []
849 deviceActiveLinksCountTemp = []
850 devicePortsEnabledCountTemp = []
851
852 main.log.report(
853 "Compare ONOS topology with reference data in Stores" )
854 main.log.report( "__________________________________________________" )
855 main.case( "Compare ONOS topology with reference data" )
856
857 main.step( "Compare current Device ports enabled with reference" )
858 time1 = time.time()
859 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
860 pool = []
861 for cli in main.CLIs:
862 if i >= main.numMNswitches + 1:
863 break
864 dpid = "of:00000000000000" + format( i,'02x' )
865 t = main.Thread(target = cli.getDevicePortsEnabledCount,
866 threadID = main.threadID,
867 name = "getDevicePortsEnabledCount",
868 args = [dpid])
869 t.start()
870 pool.append(t)
871 i = i + 1
872 main.threadID = main.threadID + 1
873 for thread in pool:
874 thread.join()
875 portResult = thread.result
876 #portTemp = re.split( r'\t+', portResult )
877 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
878 devicePortsEnabledCountTemp.append( portResult )
879
880 time2 = time.time()
881 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
882 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700883 "Device Enabled ports EXPECTED: %s" %
884 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700885 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700886 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700887 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700888
Hari Krishnac195f3b2015-07-08 20:02:24 -0700889 if ( cmp( main.devicePortsEnabledCount,
890 devicePortsEnabledCountTemp ) == 0 ):
891 stepResult1 = main.TRUE
892 else:
893 stepResult1 = main.FALSE
894
895 main.step( "Compare Device active links with reference" )
896 time1 = time.time()
897 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
898 pool = []
899 for cli in main.CLIs:
900 if i >= main.numMNswitches + 1:
901 break
902 dpid = "of:00000000000000" + format( i,'02x' )
903 t = main.Thread(target = cli.getDeviceLinksActiveCount,
904 threadID = main.threadID,
905 name = "getDeviceLinksActiveCount",
906 args = [dpid])
907 t.start()
908 pool.append(t)
909 i = i + 1
910 main.threadID = main.threadID + 1
911 for thread in pool:
912 thread.join()
913 linkCountResult = thread.result
914 #linkCountTemp = re.split( r'\t+', linkCountResult )
915 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
916 deviceActiveLinksCountTemp.append( linkCountResult )
917
918 time2 = time.time()
919 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
920 main.log.info (
921 "Device Active links EXPECTED: %s" %
922 str( main.deviceActiveLinksCount ) )
923 main.log.info (
924 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
925 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
926 stepResult2 = main.TRUE
927 else:
928 stepResult2 = main.FALSE
929
930 """
931 place holder for comparing devices, hosts, paths and intents if required.
932 Links and ports data would be incorrect with out devices anyways.
933 """
934 case5Result = ( stepResult1 and stepResult2 )
935 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
936 onpass="Compare Topology test PASS",
937 onfail="Compare Topology test FAIL" )
938
939 def CASE60( self ):
940 """
941 Install 300 host intents and verify ping all (Att Topology)
942 """
943 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
944 main.log.report( "_______________________________________" )
945 import itertools
946 import time
947 main.case( "Install 300 host intents" )
948 main.step( "Add host Intents" )
949 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700950 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
951
Hari Krishnac195f3b2015-07-08 20:02:24 -0700952 intentIdList = []
953 time1 = time.time()
954 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
955 pool = []
956 for cli in main.CLIs:
957 if i >= len( hostCombos ):
958 break
959 t = main.Thread( target=cli.addHostIntent,
960 threadID=main.threadID,
961 name="addHostIntent",
962 args=[hostCombos[i][0],hostCombos[i][1]])
963 pool.append(t)
964 t.start()
965 i = i + 1
966 main.threadID = main.threadID + 1
967 for thread in pool:
968 thread.join()
969 intentIdList.append(thread.result)
970 time2 = time.time()
971 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
972
973 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -0700974 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -0700975 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
976 intentsJson = intentsJson)
977 print "len of intent ID", str(len(intentIdList))
978 print "len of intent state results", str(len(getIntentStateResult))
979 print getIntentStateResult
980 # Takes awhile for all the onos to get the intents
981 time.sleep( 30 )
982 """intentState = main.TRUE
983 for i in getIntentStateResult:
984 if getIntentStateResult.get( 'state' ) != 'INSTALLED':
985 """
986
987
988 main.step( "Verify Ping across all hosts" )
989 pingResult = main.FALSE
990 time1 = time.time()
991 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
992 time2 = time.time()
993 timeDiff = round( ( time2 - time1 ), 2 )
994 main.log.report(
995 "Time taken for Ping All: " +
996 str( timeDiff ) +
997 " seconds" )
998 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
999 onpass="PING ALL PASS",
1000 onfail="PING ALL FAIL" )
1001
1002 case60Result = ( intentResult and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001003 utilities.assert_equals(
1004 expect=main.TRUE,
1005 actual=case60Result,
1006 onpass="Install 300 Host Intents and Ping All test PASS",
1007 onfail="Install 300 Host Intents and Ping All test FAIL" )
1008
1009 def CASE61( self ):
1010 """
1011 Install 600 host intents and verify ping all for Chordal Topology
1012 """
1013 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1014 main.log.report( "_______________________________________" )
1015 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001016
Hari Krishnac195f3b2015-07-08 20:02:24 -07001017 main.case( "Install 600 host intents" )
1018 main.step( "Add host Intents" )
1019 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001020 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1021
Hari Krishnac195f3b2015-07-08 20:02:24 -07001022 intentIdList = []
1023 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001024
Hari Krishnac195f3b2015-07-08 20:02:24 -07001025 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1026 pool = []
1027 for cli in main.CLIs:
1028 if i >= len( hostCombos ):
1029 break
1030 t = main.Thread( target=cli.addHostIntent,
1031 threadID=main.threadID,
1032 name="addHostIntent",
1033 args=[hostCombos[i][0],hostCombos[i][1]])
1034 pool.append(t)
1035 t.start()
1036 i = i + 1
1037 main.threadID = main.threadID + 1
1038 for thread in pool:
1039 thread.join()
1040 intentIdList.append(thread.result)
1041 time2 = time.time()
1042 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1043 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07001044 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001045 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1046 intentsJson = intentsJson)
1047 print getIntentStateResult
1048
1049 main.step( "Verify Ping across all hosts" )
1050 pingResult = main.FALSE
1051 time1 = time.time()
1052 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1053 time2 = time.time()
1054 timeDiff = round( ( time2 - time1 ), 2 )
1055 main.log.report(
1056 "Time taken for Ping All: " +
1057 str( timeDiff ) +
1058 " seconds" )
1059 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1060 onpass="PING ALL PASS",
1061 onfail="PING ALL FAIL" )
1062
1063 case14Result = ( intentResult and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001064
Hari Krishnac195f3b2015-07-08 20:02:24 -07001065 utilities.assert_equals(
1066 expect=main.TRUE,
1067 actual=case14Result,
1068 onpass="Install 300 Host Intents and Ping All test PASS",
1069 onfail="Install 300 Host Intents and Ping All test FAIL" )
1070
1071 def CASE62( self ):
1072 """
1073 Install 2278 host intents and verify ping all for Spine Topology
1074 """
1075 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1076 main.log.report( "_______________________________________" )
1077 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001078
Hari Krishnac195f3b2015-07-08 20:02:24 -07001079 main.case( "Install 2278 host intents" )
1080 main.step( "Add host Intents" )
1081 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001082 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001083 main.pingTimeout = 300
1084 intentIdList = []
1085 time1 = time.time()
1086 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1087 pool = []
1088 for cli in main.CLIs:
1089 if i >= len( hostCombos ):
1090 break
1091 t = main.Thread( target=cli.addHostIntent,
1092 threadID=main.threadID,
1093 name="addHostIntent",
1094 args=[hostCombos[i][0],hostCombos[i][1]])
1095 pool.append(t)
1096 t.start()
1097 i = i + 1
1098 main.threadID = main.threadID + 1
1099 for thread in pool:
1100 thread.join()
1101 intentIdList.append(thread.result)
1102 time2 = time.time()
1103 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1104 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07001105 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001106 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1107 intentsJson = intentsJson)
1108 print getIntentStateResult
1109
1110 main.step( "Verify Ping across all hosts" )
1111 pingResult = main.FALSE
1112 time1 = time.time()
1113 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1114 time2 = time.time()
1115 timeDiff = round( ( time2 - time1 ), 2 )
1116 main.log.report(
1117 "Time taken for Ping All: " +
1118 str( timeDiff ) +
1119 " seconds" )
1120 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1121 onpass="PING ALL PASS",
1122 onfail="PING ALL FAIL" )
1123
1124 case15Result = ( intentResult and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001125
Hari Krishnac195f3b2015-07-08 20:02:24 -07001126 utilities.assert_equals(
1127 expect=main.TRUE,
1128 actual=case15Result,
1129 onpass="Install 2278 Host Intents and Ping All test PASS",
1130 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1131
Hari Krishna4223dbd2015-08-13 16:29:53 -07001132 def CASE160( self ):
1133 """
1134 Verify IPv6 ping across 300 host intents (Att Topology)
1135 """
1136 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1137 main.log.report( "_________________________________________________" )
1138 import itertools
1139 import time
1140 main.case( "IPv6 ping all 300 host intents" )
1141 main.step( "Verify IPv6 Ping across all hosts" )
1142 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1143 pingResult = main.FALSE
1144 time1 = time.time()
1145 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
1146 time2 = time.time()
1147 timeDiff = round( ( time2 - time1 ), 2 )
1148 main.log.report(
1149 "Time taken for IPv6 Ping All: " +
1150 str( timeDiff ) +
1151 " seconds" )
1152 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1153 onpass="PING ALL PASS",
1154 onfail="PING ALL FAIL" )
1155
1156 case160Result = pingResult
1157 utilities.assert_equals(
1158 expect=main.TRUE,
1159 actual=case160Result,
1160 onpass="IPv6 Ping across 300 host intents test PASS",
1161 onfail="IPv6 Ping across 300 host intents test FAIL" )
1162
1163 def CASE161( self ):
1164 """
1165 Verify IPv6 ping across 600 host intents (Chordal Topology)
1166 """
1167 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1168 main.log.report( "_________________________________________________" )
1169 import itertools
1170 import time
1171 main.case( "IPv6 ping all 600 host intents" )
1172 main.step( "Verify IPv6 Ping across all hosts" )
1173 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1174 pingResult = main.FALSE
1175 time1 = time.time()
1176 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
1177 time2 = time.time()
1178 timeDiff = round( ( time2 - time1 ), 2 )
1179 main.log.report(
1180 "Time taken for IPv6 Ping All: " +
1181 str( timeDiff ) +
1182 " seconds" )
1183 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1184 onpass="PING ALL PASS",
1185 onfail="PING ALL FAIL" )
1186
1187 case161Result = pingResult
1188 utilities.assert_equals(
1189 expect=main.TRUE,
1190 actual=case161Result,
1191 onpass="IPv6 Ping across 600 host intents test PASS",
1192 onfail="IPv6 Ping across 600 host intents test FAIL" )
1193
1194 def CASE162( self ):
1195 """
1196 Verify IPv6 ping across 2278 host intents (Spine Topology)
1197 """
1198 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1199 main.log.report( "_________________________________________________" )
1200 import itertools
1201 import time
1202 main.case( "IPv6 ping all 600 host intents" )
1203 main.step( "Verify IPv6 Ping across all hosts" )
1204 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
1205 pingResult = main.FALSE
1206 time1 = time.time()
1207 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
1208 time2 = time.time()
1209 timeDiff = round( ( time2 - time1 ), 2 )
1210 main.log.report(
1211 "Time taken for IPv6 Ping All: " +
1212 str( timeDiff ) +
1213 " seconds" )
1214 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1215 onpass="PING ALL PASS",
1216 onfail="PING ALL FAIL" )
1217
1218 case162Result = pingResult
1219 utilities.assert_equals(
1220 expect=main.TRUE,
1221 actual=case162Result,
1222 onpass="IPv6 Ping across 600 host intents test PASS",
1223 onfail="IPv6 Ping across 600 host intents test FAIL" )
1224
Hari Krishnac195f3b2015-07-08 20:02:24 -07001225 def CASE70( self, main ):
1226 """
1227 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1228 """
1229 import random
1230 main.randomLink1 = []
1231 main.randomLink2 = []
1232 main.randomLink3 = []
1233 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1234 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1235 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1236 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1237 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1238 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1239 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1240 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1241
1242 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1243 main.log.report( "___________________________________________________________________________" )
1244 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1245 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1246 if ( int( switchLinksToToggle ) ==
1247 0 or int( switchLinksToToggle ) > 5 ):
1248 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1249 #main.cleanup()
1250 #main.exit()
1251 else:
1252 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1253
1254 main.step( "Cut links on Core devices using user provided range" )
1255 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1256 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1257 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1258 for i in range( int( switchLinksToToggle ) ):
1259 main.Mininet1.link(
1260 END1=link1End1,
1261 END2=main.randomLink1[ i ],
1262 OPTION="down" )
1263 time.sleep( link_sleep )
1264 main.Mininet1.link(
1265 END1=link2End1,
1266 END2=main.randomLink2[ i ],
1267 OPTION="down" )
1268 time.sleep( link_sleep )
1269 main.Mininet1.link(
1270 END1=link3End1,
1271 END2=main.randomLink3[ i ],
1272 OPTION="down" )
1273 time.sleep( link_sleep )
1274
Hari Krishna6185fc12015-07-13 15:42:31 -07001275 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001276 linkDown = main.ONOSbench.checkStatus(
1277 topology_output, main.numMNswitches, str(
1278 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1279 utilities.assert_equals(
1280 expect=main.TRUE,
1281 actual=linkDown,
1282 onpass="Link Down discovered properly",
1283 onfail="Link down was not discovered in " +
1284 str( link_sleep ) +
1285 " seconds" )
1286
1287 main.step( "Verify Ping across all hosts" )
1288 pingResultLinkDown = main.FALSE
1289 time1 = time.time()
1290 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
1291 time2 = time.time()
1292 timeDiff = round( ( time2 - time1 ), 2 )
1293 main.log.report(
1294 "Time taken for Ping All: " +
1295 str( timeDiff ) +
1296 " seconds" )
1297 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1298 onpass="PING ALL PASS",
1299 onfail="PING ALL FAIL" )
1300
1301 caseResult70 = linkDown and pingResultLinkDown
1302 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
1303 onpass="Random Link cut Test PASS",
1304 onfail="Random Link cut Test FAIL" )
1305
1306 def CASE80( self, main ):
1307 """
1308 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1309 """
1310 import random
1311 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1312 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1313 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1314 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1315 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1316
1317 main.log.report(
1318 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1319 main.log.report(
1320 "__________________________________________________________________" )
1321 main.case(
1322 "Host intents - Bring the core links up that are down and verify ping all" )
1323 main.step( "Bring randomly cut links on Core devices up" )
1324 for i in range( int( switchLinksToToggle ) ):
1325 main.Mininet1.link(
1326 END1=link1End1,
1327 END2=main.randomLink1[ i ],
1328 OPTION="up" )
1329 time.sleep( link_sleep )
1330 main.Mininet1.link(
1331 END1=link2End1,
1332 END2=main.randomLink2[ i ],
1333 OPTION="up" )
1334 time.sleep( link_sleep )
1335 main.Mininet1.link(
1336 END1=link3End1,
1337 END2=main.randomLink3[ i ],
1338 OPTION="up" )
1339 time.sleep( link_sleep )
1340
Hari Krishna6185fc12015-07-13 15:42:31 -07001341 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001342 linkUp = main.ONOSbench.checkStatus(
1343 topology_output,
1344 main.numMNswitches,
1345 str( main.numMNlinks ) )
1346 utilities.assert_equals(
1347 expect=main.TRUE,
1348 actual=linkUp,
1349 onpass="Link up discovered properly",
1350 onfail="Link up was not discovered in " +
1351 str( link_sleep ) +
1352 " seconds" )
1353
1354 main.step( "Verify Ping across all hosts" )
1355 pingResultLinkUp = main.FALSE
1356 time1 = time.time()
1357 pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout )
1358 time2 = time.time()
1359 timeDiff = round( ( time2 - time1 ), 2 )
1360 main.log.report(
1361 "Time taken for Ping All: " +
1362 str( timeDiff ) +
1363 " seconds" )
1364 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1365 onpass="PING ALL PASS",
1366 onfail="PING ALL FAIL" )
1367
1368 caseResult80 = linkUp and pingResultLinkUp
1369 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
1370 onpass="Link Up Test PASS",
1371 onfail="Link Up Test FAIL" )
1372
1373 def CASE71( self, main ):
1374 """
1375 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1376 """
1377 import random
1378 main.randomLink1 = []
1379 main.randomLink2 = []
1380 main.randomLink3 = []
1381 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1382 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1383 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1384 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1385 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1386 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1387 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1388 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1389
1390 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1391 main.log.report( "___________________________________________________________________________" )
1392 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1393 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1394 if ( int( switchLinksToToggle ) ==
1395 0 or int( switchLinksToToggle ) > 5 ):
1396 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1397 #main.cleanup()
1398 #main.exit()
1399 else:
1400 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1401
1402 main.step( "Cut links on Core devices using user provided range" )
1403 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1404 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1405 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1406 for i in range( int( switchLinksToToggle ) ):
1407 main.Mininet1.link(
1408 END1=link1End1,
1409 END2=main.randomLink1[ i ],
1410 OPTION="down" )
1411 time.sleep( link_sleep )
1412 main.Mininet1.link(
1413 END1=link2End1,
1414 END2=main.randomLink2[ i ],
1415 OPTION="down" )
1416 time.sleep( link_sleep )
1417 main.Mininet1.link(
1418 END1=link3End1,
1419 END2=main.randomLink3[ i ],
1420 OPTION="down" )
1421 time.sleep( link_sleep )
1422
Hari Krishna6185fc12015-07-13 15:42:31 -07001423 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001424 linkDown = main.ONOSbench.checkStatus(
1425 topology_output, main.numMNswitches, str(
1426 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1427 utilities.assert_equals(
1428 expect=main.TRUE,
1429 actual=linkDown,
1430 onpass="Link Down discovered properly",
1431 onfail="Link down was not discovered in " +
1432 str( link_sleep ) +
1433 " seconds" )
1434
1435 main.step( "Verify Ping across all hosts" )
1436 pingResultLinkDown = main.FALSE
1437 time1 = time.time()
1438 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
1439 time2 = time.time()
1440 timeDiff = round( ( time2 - time1 ), 2 )
1441 main.log.report(
1442 "Time taken for Ping All: " +
1443 str( timeDiff ) +
1444 " seconds" )
1445 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1446 onpass="PING ALL PASS",
1447 onfail="PING ALL FAIL" )
1448
1449 caseResult71 = linkDown and pingResultLinkDown
1450 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1451 onpass="Random Link cut Test PASS",
1452 onfail="Random Link cut Test FAIL" )
1453
1454 def CASE81( self, main ):
1455 """
1456 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1457 """
1458 import random
1459 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1460 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1461 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1462 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1463 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1464
1465 main.log.report(
1466 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1467 main.log.report(
1468 "__________________________________________________________________" )
1469 main.case(
1470 "Point intents - Bring the core links up that are down and verify ping all" )
1471 main.step( "Bring randomly cut links on Core devices up" )
1472 for i in range( int( switchLinksToToggle ) ):
1473 main.Mininet1.link(
1474 END1=link1End1,
1475 END2=main.randomLink1[ i ],
1476 OPTION="up" )
1477 time.sleep( link_sleep )
1478 main.Mininet1.link(
1479 END1=link2End1,
1480 END2=main.randomLink2[ i ],
1481 OPTION="up" )
1482 time.sleep( link_sleep )
1483 main.Mininet1.link(
1484 END1=link3End1,
1485 END2=main.randomLink3[ i ],
1486 OPTION="up" )
1487 time.sleep( link_sleep )
1488
Hari Krishna6185fc12015-07-13 15:42:31 -07001489 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001490 linkUp = main.ONOSbench.checkStatus(
1491 topology_output,
1492 main.numMNswitches,
1493 str( main.numMNlinks ) )
1494 utilities.assert_equals(
1495 expect=main.TRUE,
1496 actual=linkUp,
1497 onpass="Link up discovered properly",
1498 onfail="Link up was not discovered in " +
1499 str( link_sleep ) +
1500 " seconds" )
1501
1502 main.step( "Verify Ping across all hosts" )
1503 pingResultLinkUp = main.FALSE
1504 time1 = time.time()
1505 pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout )
1506 time2 = time.time()
1507 timeDiff = round( ( time2 - time1 ), 2 )
1508 main.log.report(
1509 "Time taken for Ping All: " +
1510 str( timeDiff ) +
1511 " seconds" )
1512 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1513 onpass="PING ALL PASS",
1514 onfail="PING ALL FAIL" )
1515
1516 caseResult81 = linkUp and pingResultLinkUp
1517 utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
1518 onpass="Link Up Test PASS",
1519 onfail="Link Up Test FAIL" )
1520
1521 def CASE72( self, main ):
1522 """
1523 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1524 """
1525 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001526 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001527 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001528
Hari Krishnac195f3b2015-07-08 20:02:24 -07001529 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1530 main.log.report( "___________________________________________________________________________" )
1531 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1532 switches = []
1533 switchesComb = []
1534 for i in range( main.numMNswitches ):
1535 switches.append('s%d'%(i+1))
1536 switchesLinksComb = list(itertools.combinations(switches,2))
1537 main.randomLinks = random.sample(switchesLinksComb, 5 )
1538 print main.randomLinks
1539 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001540
Hari Krishnac195f3b2015-07-08 20:02:24 -07001541 for switch in main.randomLinks:
1542 main.Mininet1.link(
1543 END1=switch[0],
1544 END2=switch[1],
1545 OPTION="down")
1546 time.sleep( link_sleep )
1547
Hari Krishna6185fc12015-07-13 15:42:31 -07001548 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001549 linkDown = main.ONOSbench.checkStatus(
1550 topology_output, main.numMNswitches, str(
1551 int( main.numMNlinks ) - 5 * 2 ) )
1552 utilities.assert_equals(
1553 expect=main.TRUE,
1554 actual=linkDown,
1555 onpass="Link Down discovered properly",
1556 onfail="Link down was not discovered in " +
1557 str( link_sleep ) +
1558 " seconds" )
1559
1560 main.step( "Verify Ping across all hosts" )
1561 pingResultLinkDown = main.FALSE
1562 time1 = time.time()
1563 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1564 time2 = time.time()
1565 timeDiff = round( ( time2 - time1 ), 2 )
1566 main.log.report(
1567 "Time taken for Ping All: " +
1568 str( timeDiff ) +
1569 " seconds" )
1570 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1571 onpass="PING ALL PASS",
1572 onfail="PING ALL FAIL" )
1573
1574 caseResult71 = pingResultLinkDown
1575 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1576 onpass="Random Link cut Test PASS",
1577 onfail="Random Link cut Test FAIL" )
1578
1579 def CASE82( self, main ):
1580 """
1581 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1582 """
1583 import random
1584 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001585
Hari Krishnac195f3b2015-07-08 20:02:24 -07001586 main.log.report(
1587 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1588 main.log.report(
1589 "__________________________________________________________________" )
1590 main.case(
1591 "Host intents - Bring the core links up that are down and verify ping all" )
1592 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001593
Hari Krishnac195f3b2015-07-08 20:02:24 -07001594 for switch in main.randomLinks:
1595 main.Mininet1.link(
1596 END1=switch[0],
1597 END2=switch[1],
1598 OPTION="up")
1599 time.sleep( link_sleep )
1600
Hari Krishna6185fc12015-07-13 15:42:31 -07001601 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001602 linkUp = main.ONOSbench.checkStatus(
1603 topology_output,
1604 main.numMNswitches,
1605 str( main.numMNlinks ) )
1606 utilities.assert_equals(
1607 expect=main.TRUE,
1608 actual=linkUp,
1609 onpass="Link up discovered properly",
1610 onfail="Link up was not discovered in " +
1611 str( link_sleep ) +
1612 " seconds" )
1613
1614 main.step( "Verify Ping across all hosts" )
1615 pingResultLinkUp = main.FALSE
1616 time1 = time.time()
1617 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1618 time2 = time.time()
1619 timeDiff = round( ( time2 - time1 ), 2 )
1620 main.log.report(
1621 "Time taken for Ping All: " +
1622 str( timeDiff ) +
1623 " seconds" )
1624 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1625 onpass="PING ALL PASS",
1626 onfail="PING ALL FAIL" )
1627
1628 caseResult82 = linkUp and pingResultLinkUp
1629 utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
1630 onpass="Link Up Test PASS",
1631 onfail="Link Up Test FAIL" )
1632
1633 def CASE73( self, main ):
1634 """
1635 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1636 """
1637 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001638 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001639 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001640
Hari Krishnac195f3b2015-07-08 20:02:24 -07001641 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1642 main.log.report( "___________________________________________________________________________" )
1643 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1644 switches = []
1645 switchesComb = []
1646 for i in range( main.numMNswitches ):
1647 switches.append('s%d'%(i+1))
1648 switchesLinksComb = list(itertools.combinations(switches,2))
1649 main.randomLinks = random.sample(switchesLinksComb, 5 )
1650 print main.randomLinks
1651 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001652
Hari Krishnac195f3b2015-07-08 20:02:24 -07001653 for switch in main.randomLinks:
1654 main.Mininet1.link(
1655 END1=switch[0],
1656 END2=switch[1],
1657 OPTION="down")
1658 time.sleep( link_sleep )
1659
Hari Krishna6185fc12015-07-13 15:42:31 -07001660 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001661 linkDown = main.ONOSbench.checkStatus(
1662 topology_output, main.numMNswitches, str(
1663 int( main.numMNlinks ) - 5 * 2 ) )
1664 utilities.assert_equals(
1665 expect=main.TRUE,
1666 actual=linkDown,
1667 onpass="Link Down discovered properly",
1668 onfail="Link down was not discovered in " +
1669 str( link_sleep ) +
1670 " seconds" )
1671
1672 main.step( "Verify Ping across all hosts" )
1673 pingResultLinkDown = main.FALSE
1674 time1 = time.time()
1675 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1676 time2 = time.time()
1677 timeDiff = round( ( time2 - time1 ), 2 )
1678 main.log.report(
1679 "Time taken for Ping All: " +
1680 str( timeDiff ) +
1681 " seconds" )
1682 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1683 onpass="PING ALL PASS",
1684 onfail="PING ALL FAIL" )
1685
1686 caseResult73 = pingResultLinkDown
1687 utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
1688 onpass="Random Link cut Test PASS",
1689 onfail="Random Link cut Test FAIL" )
1690
1691 def CASE83( self, main ):
1692 """
1693 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
1694 """
1695 import random
1696 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001697
Hari Krishnac195f3b2015-07-08 20:02:24 -07001698 main.log.report(
1699 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
1700 main.log.report(
1701 "__________________________________________________________________" )
1702 main.case(
1703 "Point intents - Bring the core links up that are down and verify ping all" )
1704 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001705
Hari Krishnac195f3b2015-07-08 20:02:24 -07001706 for switch in main.randomLinks:
1707 main.Mininet1.link(
1708 END1=switch[0],
1709 END2=switch[1],
1710 OPTION="up")
1711 time.sleep( link_sleep )
1712
Hari Krishna6185fc12015-07-13 15:42:31 -07001713 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001714 linkUp = main.ONOSbench.checkStatus(
1715 topology_output,
1716 main.numMNswitches,
1717 str( main.numMNlinks ) )
1718 utilities.assert_equals(
1719 expect=main.TRUE,
1720 actual=linkUp,
1721 onpass="Link up discovered properly",
1722 onfail="Link up was not discovered in " +
1723 str( link_sleep ) +
1724 " seconds" )
1725
1726 main.step( "Verify Ping across all hosts" )
1727 pingResultLinkUp = main.FALSE
1728 time1 = time.time()
1729 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1730 time2 = time.time()
1731 timeDiff = round( ( time2 - time1 ), 2 )
1732 main.log.report(
1733 "Time taken for Ping All: " +
1734 str( timeDiff ) +
1735 " seconds" )
1736 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1737 onpass="PING ALL PASS",
1738 onfail="PING ALL FAIL" )
1739
1740 caseResult83 = linkUp and pingResultLinkUp
1741 utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
1742 onpass="Link Up Test PASS",
1743 onfail="Link Up Test FAIL" )
1744
1745 def CASE74( self, main ):
1746 """
1747 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
1748 """
1749 import random
1750 main.randomLink1 = []
1751 main.randomLink2 = []
1752 main.randomLink3 = []
1753 main.randomLink4 = []
1754 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1755 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
1756 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
1757 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1758 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
1759 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
1760 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1761 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07001762
Hari Krishnac195f3b2015-07-08 20:02:24 -07001763 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
1764 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07001765 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001766 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07001767 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001768 linkIndex.remove(linkIndexS9)
1769 linkIndexS10 = random.sample(linkIndex,1)[0]
1770 main.randomLink1 = link1End2top[linkIndexS9]
1771 main.randomLink2 = link2End2top[linkIndexS10]
1772 main.randomLink3 = random.sample(link1End2bot,1)[0]
1773 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07001774
1775 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07001776 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
1777 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
1778 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
1779 time.sleep( link_sleep )
1780 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
1781 time.sleep( link_sleep )
1782
Hari Krishna6185fc12015-07-13 15:42:31 -07001783 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001784 linkDown = main.ONOSbench.checkStatus(
1785 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07001786 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07001787 utilities.assert_equals(
1788 expect=main.TRUE,
1789 actual=linkDown,
1790 onpass="Link Down discovered properly",
1791 onfail="Link down was not discovered in " +
1792 str( link_sleep ) +
1793 " seconds" )
1794
1795 main.step( "Verify Ping across all hosts" )
1796 pingResultLinkDown = main.FALSE
1797 time1 = time.time()
1798 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1799 time2 = time.time()
1800 timeDiff = round( ( time2 - time1 ), 2 )
1801 main.log.report(
1802 "Time taken for Ping All: " +
1803 str( timeDiff ) +
1804 " seconds" )
1805 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1806 onpass="PING ALL PASS",
1807 onfail="PING ALL FAIL" )
1808
1809 caseResult74 = linkDown and pingResultLinkDown
1810 utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
1811 onpass="Random Link cut Test PASS",
1812 onfail="Random Link cut Test FAIL" )
1813
1814 def CASE84( self, main ):
1815 """
1816 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
1817 """
1818 import random
1819 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1820 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1821 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1822 main.log.report(
1823 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
1824 main.log.report(
1825 "__________________________________________________________________" )
1826 main.case(
1827 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07001828
1829 # Work around for link state propagation delay. Added some sleep time.
1830 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
1831 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001832 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
1833 time.sleep( link_sleep )
1834 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
1835 time.sleep( link_sleep )
1836
Hari Krishna6185fc12015-07-13 15:42:31 -07001837 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001838 linkUp = main.ONOSbench.checkStatus(
1839 topology_output,
1840 main.numMNswitches,
1841 str( main.numMNlinks ) )
1842 utilities.assert_equals(
1843 expect=main.TRUE,
1844 actual=linkUp,
1845 onpass="Link up discovered properly",
1846 onfail="Link up was not discovered in " +
1847 str( link_sleep ) +
1848 " seconds" )
1849
1850 main.step( "Verify Ping across all hosts" )
1851 pingResultLinkUp = main.FALSE
1852 time1 = time.time()
1853 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1854 time2 = time.time()
1855 timeDiff = round( ( time2 - time1 ), 2 )
1856 main.log.report(
1857 "Time taken for Ping All: " +
1858 str( timeDiff ) +
1859 " seconds" )
1860 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1861 onpass="PING ALL PASS",
1862 onfail="PING ALL FAIL" )
1863
1864 caseResult84 = linkUp and pingResultLinkUp
1865 utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
1866 onpass="Link Up Test PASS",
1867 onfail="Link Up Test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001868
Hari Krishnab79d0822015-08-20 09:48:43 -07001869 def CASE75( self, main ):
1870 """
1871 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
1872 """
1873 import random
1874 main.randomLink1 = []
1875 main.randomLink2 = []
1876 main.randomLink3 = []
1877 main.randomLink4 = []
1878 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1879 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
1880 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
1881 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1882 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
1883 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
1884 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1885 main.pingTimeout = 400
1886
1887 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
1888 main.log.report( "___________________________________________________________________________" )
1889 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
1890 linkIndex = range(4)
1891 linkIndexS9 = random.sample(linkIndex,1)[0]
1892 linkIndex.remove(linkIndexS9)
1893 linkIndexS10 = random.sample(linkIndex,1)[0]
1894 main.randomLink1 = link1End2top[linkIndexS9]
1895 main.randomLink2 = link2End2top[linkIndexS10]
1896 main.randomLink3 = random.sample(link1End2bot,1)[0]
1897 main.randomLink4 = random.sample(link2End2bot,1)[0]
1898
1899 # Work around for link state propagation delay. Added some sleep time.
1900 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
1901 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
1902 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
1903 time.sleep( link_sleep )
1904 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
1905 time.sleep( link_sleep )
1906
1907 topology_output = main.ONOScli1.topology()
1908 linkDown = main.ONOSbench.checkStatus(
1909 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07001910 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07001911 utilities.assert_equals(
1912 expect=main.TRUE,
1913 actual=linkDown,
1914 onpass="Link Down discovered properly",
1915 onfail="Link down was not discovered in " +
1916 str( link_sleep ) +
1917 " seconds" )
1918
1919 main.step( "Verify Ping across all hosts" )
1920 pingResultLinkDown = main.FALSE
1921 time1 = time.time()
1922 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1923 time2 = time.time()
1924 timeDiff = round( ( time2 - time1 ), 2 )
1925 main.log.report(
1926 "Time taken for Ping All: " +
1927 str( timeDiff ) +
1928 " seconds" )
1929 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1930 onpass="PING ALL PASS",
1931 onfail="PING ALL FAIL" )
1932
1933 caseResult75 = linkDown and pingResultLinkDown
1934 utilities.assert_equals( expect=main.TRUE, actual=caseResult75,
1935 onpass="Random Link cut Test PASS",
1936 onfail="Random Link cut Test FAIL" )
1937
1938 def CASE85( self, main ):
1939 """
1940 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
1941 """
1942 import random
1943 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1944 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1945 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1946 main.log.report(
1947 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
1948 main.log.report(
1949 "__________________________________________________________________" )
1950 main.case(
1951 "Point intents - Bring the core links up that are down and verify ping all" )
1952
1953 # Work around for link state propagation delay. Added some sleep time.
1954 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
1955 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
1956 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
1957 time.sleep( link_sleep )
1958 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
1959 time.sleep( link_sleep )
1960
1961 topology_output = main.ONOScli1.topology()
1962 linkUp = main.ONOSbench.checkStatus(
1963 topology_output,
1964 main.numMNswitches,
1965 str( main.numMNlinks ) )
1966 utilities.assert_equals(
1967 expect=main.TRUE,
1968 actual=linkUp,
1969 onpass="Link up discovered properly",
1970 onfail="Link up was not discovered in " +
1971 str( link_sleep ) +
1972 " seconds" )
1973
1974 main.step( "Verify Ping across all hosts" )
1975 pingResultLinkUp = main.FALSE
1976 time1 = time.time()
1977 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1978 time2 = time.time()
1979 timeDiff = round( ( time2 - time1 ), 2 )
1980 main.log.report(
1981 "Time taken for Ping All: " +
1982 str( timeDiff ) +
1983 " seconds" )
1984 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1985 onpass="PING ALL PASS",
1986 onfail="PING ALL FAIL" )
1987
1988 caseResult85 = linkUp and pingResultLinkUp
1989 utilities.assert_equals( expect=main.TRUE, actual=caseResult85,
1990 onpass="Link Up Test PASS",
1991 onfail="Link Up Test FAIL" )
1992
Hari Krishna4223dbd2015-08-13 16:29:53 -07001993 def CASE170( self ):
1994 """
1995 IPv6 ping all with some core links down( Host Intents-Att Topo)
1996 """
1997 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
1998 main.log.report( "_________________________________________________" )
1999 import itertools
2000 import time
2001 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2002 main.step( "Verify IPv6 Ping across all hosts" )
2003 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2004 pingResult = main.FALSE
2005 time1 = time.time()
2006 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2007 time2 = time.time()
2008 timeDiff = round( ( time2 - time1 ), 2 )
2009 main.log.report(
2010 "Time taken for IPv6 Ping All: " +
2011 str( timeDiff ) +
2012 " seconds" )
2013 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2014 onpass="PING ALL PASS",
2015 onfail="PING ALL FAIL" )
2016
2017 case170Result = pingResult
2018 utilities.assert_equals(
2019 expect=main.TRUE,
2020 actual=case170Result,
2021 onpass="IPv6 Ping across 300 host intents test PASS",
2022 onfail="IPv6 Ping across 300 host intents test FAIL" )
2023
2024 def CASE180( self ):
2025 """
2026 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2027 """
2028 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2029 main.log.report( "_________________________________________________" )
2030 import itertools
2031 import time
2032 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2033 main.step( "Verify IPv6 Ping across all hosts" )
2034 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2035 pingResult = main.FALSE
2036 time1 = time.time()
2037 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2038 time2 = time.time()
2039 timeDiff = round( ( time2 - time1 ), 2 )
2040 main.log.report(
2041 "Time taken for IPv6 Ping All: " +
2042 str( timeDiff ) +
2043 " seconds" )
2044 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2045 onpass="PING ALL PASS",
2046 onfail="PING ALL FAIL" )
2047
2048 case180Result = pingResult
2049 utilities.assert_equals(
2050 expect=main.TRUE,
2051 actual=case180Result,
2052 onpass="IPv6 Ping across 300 host intents test PASS",
2053 onfail="IPv6 Ping across 300 host intents test FAIL" )
2054
2055 def CASE171( self ):
2056 """
2057 IPv6 ping all with some core links down( Point Intents-Att Topo)
2058 """
2059 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2060 main.log.report( "_________________________________________________" )
2061 import itertools
2062 import time
2063 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2064 main.step( "Verify IPv6 Ping across all hosts" )
2065 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2066 pingResult = main.FALSE
2067 time1 = time.time()
2068 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2069 time2 = time.time()
2070 timeDiff = round( ( time2 - time1 ), 2 )
2071 main.log.report(
2072 "Time taken for IPv6 Ping All: " +
2073 str( timeDiff ) +
2074 " seconds" )
2075 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2076 onpass="PING ALL PASS",
2077 onfail="PING ALL FAIL" )
2078
2079 case171Result = pingResult
2080 utilities.assert_equals(
2081 expect=main.TRUE,
2082 actual=case171Result,
2083 onpass="IPv6 Ping across 600 point intents test PASS",
2084 onfail="IPv6 Ping across 600 point intents test FAIL" )
2085
2086 def CASE181( self ):
2087 """
2088 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2089 """
2090 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2091 main.log.report( "_________________________________________________" )
2092 import itertools
2093 import time
2094 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2095 main.step( "Verify IPv6 Ping across all hosts" )
2096 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2097 pingResult = main.FALSE
2098 time1 = time.time()
2099 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2100 time2 = time.time()
2101 timeDiff = round( ( time2 - time1 ), 2 )
2102 main.log.report(
2103 "Time taken for IPv6 Ping All: " +
2104 str( timeDiff ) +
2105 " seconds" )
2106 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2107 onpass="PING ALL PASS",
2108 onfail="PING ALL FAIL" )
2109
2110 case181Result = pingResult
2111 utilities.assert_equals(
2112 expect=main.TRUE,
2113 actual=case181Result,
2114 onpass="IPv6 Ping across 600 Point intents test PASS",
2115 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2116
2117 def CASE172( self ):
2118 """
2119 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2120 """
2121 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2122 main.log.report( "_________________________________________________" )
2123 import itertools
2124 import time
2125 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2126 main.step( "Verify IPv6 Ping across all hosts" )
2127 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2128 pingResult = main.FALSE
2129 time1 = time.time()
2130 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2131 time2 = time.time()
2132 timeDiff = round( ( time2 - time1 ), 2 )
2133 main.log.report(
2134 "Time taken for IPv6 Ping All: " +
2135 str( timeDiff ) +
2136 " seconds" )
2137 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2138 onpass="PING ALL PASS",
2139 onfail="PING ALL FAIL" )
2140
2141 case172Result = pingResult
2142 utilities.assert_equals(
2143 expect=main.TRUE,
2144 actual=case172Result,
2145 onpass="IPv6 Ping across 300 host intents test PASS",
2146 onfail="IPv6 Ping across 300 host intents test FAIL" )
2147
2148 def CASE182( self ):
2149 """
2150 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2151 """
2152 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2153 main.log.report( "_________________________________________________" )
2154 import itertools
2155 import time
2156 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2157 main.step( "Verify IPv6 Ping across all hosts" )
2158 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2159 pingResult = main.FALSE
2160 time1 = time.time()
2161 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2162 time2 = time.time()
2163 timeDiff = round( ( time2 - time1 ), 2 )
2164 main.log.report(
2165 "Time taken for IPv6 Ping All: " +
2166 str( timeDiff ) +
2167 " seconds" )
2168 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2169 onpass="PING ALL PASS",
2170 onfail="PING ALL FAIL" )
2171
2172 case182Result = pingResult
2173 utilities.assert_equals(
2174 expect=main.TRUE,
2175 actual=case182Result,
2176 onpass="IPv6 Ping across 300 host intents test PASS",
2177 onfail="IPv6 Ping across 300 host intents test FAIL" )
2178
2179 def CASE173( self ):
2180 """
2181 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2182 """
2183 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2184 main.log.report( "_________________________________________________" )
2185 import itertools
2186 import time
2187 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2188 main.step( "Verify IPv6 Ping across all hosts" )
2189 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2190 pingResult = main.FALSE
2191 time1 = time.time()
2192 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2193 time2 = time.time()
2194 timeDiff = round( ( time2 - time1 ), 2 )
2195 main.log.report(
2196 "Time taken for IPv6 Ping All: " +
2197 str( timeDiff ) +
2198 " seconds" )
2199 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2200 onpass="PING ALL PASS",
2201 onfail="PING ALL FAIL" )
2202
2203 case173Result = pingResult
2204 utilities.assert_equals(
2205 expect=main.TRUE,
2206 actual=case173Result,
2207 onpass="IPv6 Ping across 600 point intents test PASS",
2208 onfail="IPv6 Ping across 600 point intents test FAIL" )
2209
2210 def CASE183( self ):
2211 """
2212 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2213 """
2214 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2215 main.log.report( "_________________________________________________" )
2216 import itertools
2217 import time
2218 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2219 main.step( "Verify IPv6 Ping across all hosts" )
2220 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2221 pingResult = main.FALSE
2222 time1 = time.time()
2223 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2224 time2 = time.time()
2225 timeDiff = round( ( time2 - time1 ), 2 )
2226 main.log.report(
2227 "Time taken for IPv6 Ping All: " +
2228 str( timeDiff ) +
2229 " seconds" )
2230 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2231 onpass="PING ALL PASS",
2232 onfail="PING ALL FAIL" )
2233
2234 case183Result = pingResult
2235 utilities.assert_equals(
2236 expect=main.TRUE,
2237 actual=case183Result,
2238 onpass="IPv6 Ping across 600 Point intents test PASS",
2239 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2240
2241 def CASE174( self ):
2242 """
2243 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2244 """
2245 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2246 main.log.report( "_________________________________________________" )
2247 import itertools
2248 import time
2249 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2250 main.step( "Verify IPv6 Ping across all hosts" )
2251 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2252 pingResult = main.FALSE
2253 time1 = time.time()
2254 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2255 time2 = time.time()
2256 timeDiff = round( ( time2 - time1 ), 2 )
2257 main.log.report(
2258 "Time taken for IPv6 Ping All: " +
2259 str( timeDiff ) +
2260 " seconds" )
2261 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2262 onpass="PING ALL PASS",
2263 onfail="PING ALL FAIL" )
2264
2265 case174Result = pingResult
2266 utilities.assert_equals(
2267 expect=main.TRUE,
2268 actual=case174Result,
2269 onpass="IPv6 Ping across 2278 host intents test PASS",
2270 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2271
2272 def CASE184( self ):
2273 """
2274 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2275 """
2276 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2277 main.log.report( "_________________________________________________" )
2278 import itertools
2279 import time
2280 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2281 main.step( "Verify IPv6 Ping across all hosts" )
2282 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2283 pingResult = main.FALSE
2284 time1 = time.time()
2285 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2286 time2 = time.time()
2287 timeDiff = round( ( time2 - time1 ), 2 )
2288 main.log.report(
2289 "Time taken for IPv6 Ping All: " +
2290 str( timeDiff ) +
2291 " seconds" )
2292 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2293 onpass="PING ALL PASS",
2294 onfail="PING ALL FAIL" )
2295
2296 case184Result = pingResult
2297 utilities.assert_equals(
2298 expect=main.TRUE,
2299 actual=case184Result,
2300 onpass="IPv6 Ping across 2278 host intents test PASS",
2301 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2302
2303 def CASE175( self ):
2304 """
2305 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2306 """
2307 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2308 main.log.report( "_________________________________________________" )
2309 import itertools
2310 import time
2311 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2312 main.step( "Verify IPv6 Ping across all hosts" )
2313 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2314 pingResult = main.FALSE
2315 time1 = time.time()
2316 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2317 time2 = time.time()
2318 timeDiff = round( ( time2 - time1 ), 2 )
2319 main.log.report(
2320 "Time taken for IPv6 Ping All: " +
2321 str( timeDiff ) +
2322 " seconds" )
2323 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2324 onpass="PING ALL PASS",
2325 onfail="PING ALL FAIL" )
2326
2327 case175Result = pingResult
2328 utilities.assert_equals(
2329 expect=main.TRUE,
2330 actual=case175Result,
2331 onpass="IPv6 Ping across 4556 point intents test PASS",
2332 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2333
2334 def CASE185( self ):
2335 """
2336 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
2337 """
2338 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2339 main.log.report( "_________________________________________________" )
2340 import itertools
2341 import time
2342 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2343 main.step( "Verify IPv6 Ping across all hosts" )
2344 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2345 pingResult = main.FALSE
2346 time1 = time.time()
2347 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2348 time2 = time.time()
2349 timeDiff = round( ( time2 - time1 ), 2 )
2350 main.log.report(
2351 "Time taken for IPv6 Ping All: " +
2352 str( timeDiff ) +
2353 " seconds" )
2354 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2355 onpass="PING ALL PASS",
2356 onfail="PING ALL FAIL" )
2357
2358 case183Result = pingResult
2359 utilities.assert_equals(
2360 expect=main.TRUE,
2361 actual=case183Result,
2362 onpass="IPv6 Ping across 4556 Point intents test PASS",
2363 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2364
Hari Krishnac195f3b2015-07-08 20:02:24 -07002365 def CASE90( self ):
2366 """
2367 Install 600 point intents and verify ping all (Att Topology)
2368 """
2369 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2370 main.log.report( "_______________________________________" )
2371 import itertools
2372 import time
2373 main.case( "Install 600 point intents" )
2374 main.step( "Add point Intents" )
2375 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07002376 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
2377
Hari Krishnac195f3b2015-07-08 20:02:24 -07002378 intentIdList = []
2379 time1 = time.time()
2380 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
2381 pool = []
2382 for cli in main.CLIs:
2383 if i >= len( deviceCombos ):
2384 break
2385 t = main.Thread( target=cli.addPointIntent,
2386 threadID=main.threadID,
2387 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002388 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 -07002389 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002390 t.start()
2391 i = i + 1
2392 main.threadID = main.threadID + 1
2393 for thread in pool:
2394 thread.join()
2395 intentIdList.append(thread.result)
2396 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07002397 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002398 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07002399 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002400 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2401 intentsJson = intentsJson)
2402 print getIntentStateResult
2403 # Takes awhile for all the onos to get the intents
2404 time.sleep(60)
2405 main.step( "Verify Ping across all hosts" )
2406 pingResult = main.FALSE
2407 time1 = time.time()
2408 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2409 time2 = time.time()
2410 timeDiff = round( ( time2 - time1 ), 2 )
2411 main.log.report(
2412 "Time taken for Ping All: " +
2413 str( timeDiff ) +
2414 " seconds" )
2415 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2416 onpass="PING tALL PASS",
2417 onfail="PING ALL FAIL" )
2418
2419 case90Result = ( intentResult and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002420
Hari Krishnac195f3b2015-07-08 20:02:24 -07002421 utilities.assert_equals(
2422 expect=main.TRUE,
2423 actual=case90Result,
2424 onpass="Install 600 point Intents and Ping All test PASS",
2425 onfail="Install 600 point Intents and Ping All test FAIL" )
2426
2427 def CASE91( self ):
2428 """
2429 Install 600 point intents and verify ping all (Chordal Topology)
2430 """
2431 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2432 main.log.report( "_______________________________________" )
2433 import itertools
2434 import time
2435 main.case( "Install 600 point intents" )
2436 main.step( "Add point Intents" )
2437 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07002438 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
2439
Hari Krishnac195f3b2015-07-08 20:02:24 -07002440 intentIdList = []
2441 time1 = time.time()
2442 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
2443 pool = []
2444 for cli in main.CLIs:
2445 if i >= len( deviceCombos ):
2446 break
2447 t = main.Thread( target=cli.addPointIntent,
2448 threadID=main.threadID,
2449 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002450 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"","",main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002451 pool.append(t)
2452 #time.sleep(1)
2453 t.start()
2454 i = i + 1
2455 main.threadID = main.threadID + 1
2456 for thread in pool:
2457 thread.join()
2458 intentIdList.append(thread.result)
2459 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07002460 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002461 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07002462 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002463 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2464 intentsJson = intentsJson)
2465 print getIntentStateResult
2466 # Takes awhile for all the onos to get the intents
2467 time.sleep(30)
2468 main.step( "Verify Ping across all hosts" )
2469 pingResult = main.FALSE
2470 time1 = time.time()
2471 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2472 time2 = time.time()
2473 timeDiff = round( ( time2 - time1 ), 2 )
2474 main.log.report(
2475 "Time taken for Ping All: " +
2476 str( timeDiff ) +
2477 " seconds" )
2478 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2479 onpass="PING ALL PASS",
2480 onfail="PING ALL FAIL" )
2481
2482 case91Result = ( intentResult and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002483
Hari Krishnac195f3b2015-07-08 20:02:24 -07002484 utilities.assert_equals(
2485 expect=main.TRUE,
2486 actual=case91Result,
2487 onpass="Install 600 point Intents and Ping All test PASS",
2488 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002489
Hari Krishnac195f3b2015-07-08 20:02:24 -07002490 def CASE92( self ):
2491 """
2492 Install 4556 point intents and verify ping all (Spine Topology)
2493 """
2494 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2495 main.log.report( "_______________________________________" )
2496 import itertools
2497 import time
2498 main.case( "Install 4556 point intents" )
2499 main.step( "Add point Intents" )
2500 intentResult = main.TRUE
2501 main.pingTimeout = 600
2502 for i in range(len(main.hostMACs)):
2503 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
2504 print main.MACsDict
2505 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
2506 intentIdList = []
2507 time1 = time.time()
2508 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
2509 pool = []
2510 for cli in main.CLIs:
2511 if i >= len( deviceCombos ):
2512 break
2513 t = main.Thread( target=cli.addPointIntent,
2514 threadID=main.threadID,
2515 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002516 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"","",main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002517 pool.append(t)
2518 #time.sleep(1)
2519 t.start()
2520 i = i + 1
2521 main.threadID = main.threadID + 1
2522 for thread in pool:
2523 thread.join()
2524 intentIdList.append(thread.result)
2525 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07002526 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002527 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07002528 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002529 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2530 intentsJson = intentsJson)
2531 #print getIntentStateResult
2532 # Takes awhile for all the onos to get the intents
2533 time.sleep(60)
2534 main.step( "Verify Ping across all hosts" )
2535 pingResult = main.FALSE
2536 time1 = time.time()
2537 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2538 time2 = time.time()
2539 timeDiff = round( ( time2 - time1 ), 2 )
2540 main.log.report(
2541 "Time taken for Ping All: " +
2542 str( timeDiff ) +
2543 " seconds" )
2544 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2545 onpass="PING ALL PASS",
2546 onfail="PING ALL FAIL" )
2547
2548 case92Result = ( intentResult and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002549
Hari Krishnac195f3b2015-07-08 20:02:24 -07002550 utilities.assert_equals(
2551 expect=main.TRUE,
2552 actual=case92Result,
2553 onpass="Install 4556 point Intents and Ping All test PASS",
2554 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002555
Hari Krishnac195f3b2015-07-08 20:02:24 -07002556 def CASE93( self ):
2557 """
2558 Install multi-single point intents and verify Ping all works
2559 for att topology
2560 """
2561 import copy
2562 import time
2563 main.log.report( "Install multi-single point intents and verify Ping all" )
2564 main.log.report( "___________________________________________" )
2565 main.case( "Install multi-single point intents and Ping all" )
2566 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2567 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2568 intentIdList = []
2569 print "MACsDict", main.MACsDict
2570 time1 = time.time()
2571 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2572 pool = []
2573 for cli in main.CLIs:
2574 egressDevice = deviceDPIDsCopy[i]
2575 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2576 ingressDeviceList.remove(egressDevice)
2577 if i >= len( deviceDPIDsCopy ):
2578 break
2579 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2580 threadID=main.threadID,
2581 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002582 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002583 pool.append(t)
2584 #time.sleep(1)
2585 t.start()
2586 i = i + 1
2587 main.threadID = main.threadID + 1
2588 for thread in pool:
2589 thread.join()
2590 intentIdList.append(thread.result)
2591 time2 = time.time()
2592 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2593 time.sleep(30)
2594 print "getting all intents ID"
2595 intentIdTemp = main.ONOScli1.getAllIntentsId()
2596 print intentIdTemp
2597 print len(intentIdList)
2598 print intentIdList
2599 checkIntentStateResult = main.TRUE
2600 print "Checking intents state"
2601 checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2602 checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2603 checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2604 checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2605 checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
Jon Hall4ba53f02015-07-29 13:07:41 -07002606
Hari Krishnac195f3b2015-07-08 20:02:24 -07002607 if checkIntentStateResult:
2608 main.log.info( "All intents are installed correctly " )
2609
2610 print "Checking flows state "
2611 checkFlowsState = main.ONOScli1.checkFlowsState()
2612 time.sleep(50)
2613 main.step( "Verify Ping across all hosts" )
2614 pingResult = main.FALSE
2615 time1 = time.time()
2616 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2617 time2 = time.time()
2618 timeDiff = round( ( time2 - time1 ), 2 )
2619 main.log.report(
2620 "Time taken for Ping All: " +
2621 str( timeDiff ) +
2622 " seconds" )
2623 checkFlowsState = main.ONOScli1.checkFlowsState()
2624 case93Result = pingResult
2625 utilities.assert_equals(
2626 expect=main.TRUE,
2627 actual=case93Result,
2628 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2629 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002630
Hari Krishnac195f3b2015-07-08 20:02:24 -07002631 def CASE94( self ):
2632 """
2633 Install multi-single point intents and verify Ping all works
2634 for Chordal topology
2635 """
2636 import copy
2637 import time
2638 main.log.report( "Install multi-single point intents and verify Ping all" )
2639 main.log.report( "___________________________________________" )
2640 main.case( "Install multi-single point intents and Ping all" )
2641 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2642 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2643 intentIdList = []
2644 print "MACsDict", main.MACsDict
2645 time1 = time.time()
2646 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2647 pool = []
2648 for cli in main.CLIs:
2649 egressDevice = deviceDPIDsCopy[i]
2650 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2651 ingressDeviceList.remove(egressDevice)
2652 if i >= len( deviceDPIDsCopy ):
2653 break
2654 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2655 threadID=main.threadID,
2656 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002657 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002658 pool.append(t)
2659 #time.sleep(1)
2660 t.start()
2661 i = i + 1
2662 main.threadID = main.threadID + 1
2663 for thread in pool:
2664 thread.join()
2665 intentIdList.append(thread.result)
2666 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002667 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002668 time.sleep(5)
2669 main.step( "Verify Ping across all hosts" )
2670 pingResult = main.FALSE
2671 time1 = time.time()
2672 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2673 time2 = time.time()
2674 timeDiff = round( ( time2 - time1 ), 2 )
2675 main.log.report(
2676 "Time taken for Ping All: " +
2677 str( timeDiff ) +
2678 " seconds" )
2679
2680 case94Result = pingResult
2681 utilities.assert_equals(
2682 expect=main.TRUE,
2683 actual=case94Result,
2684 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2685 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002686
Hari Krishnac195f3b2015-07-08 20:02:24 -07002687 #def CASE95 multi-single point intent for Spine
2688
2689 def CASE96( self ):
2690 """
2691 Install single-multi point intents and verify Ping all works
2692 for att topology
2693 """
2694 import copy
2695 main.log.report( "Install single-multi point intents and verify Ping all" )
2696 main.log.report( "___________________________________________" )
2697 main.case( "Install single-multi point intents and Ping all" )
2698 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2699 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
2700 intentIdList = []
2701 print "MACsDict", main.MACsDict
2702 time1 = time.time()
2703 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2704 pool = []
2705 for cli in main.CLIs:
2706 ingressDevice = deviceDPIDsCopy[i]
2707 egressDeviceList = copy.copy(deviceDPIDsCopy)
2708 egressDeviceList.remove(ingressDevice)
2709 if i >= len( deviceDPIDsCopy ):
2710 break
2711 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2712 threadID=main.threadID,
2713 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002714 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002715 pool.append(t)
2716 #time.sleep(1)
2717 t.start()
2718 i = i + 1
2719 main.threadID = main.threadID + 1
2720 for thread in pool:
2721 thread.join()
2722 intentIdList.append(thread.result)
2723 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002724 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002725 time.sleep(5)
2726 main.step( "Verify Ping across all hosts" )
2727 pingResult = main.FALSE
2728 time1 = time.time()
2729 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2730 time2 = time.time()
2731 timeDiff = round( ( time2 - time1 ), 2 )
2732 main.log.report(
2733 "Time taken for Ping All: " +
2734 str( timeDiff ) +
2735 " seconds" )
2736
2737 case96Result = pingResult
2738 utilities.assert_equals(
2739 expect=main.TRUE,
2740 actual=case96Result,
2741 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2742 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2743
2744 def CASE97( self ):
2745 """
2746 Install single-multi point intents and verify Ping all works
2747 for Chordal topology
2748 """
2749 import copy
2750 main.log.report( "Install single-multi point intents and verify Ping all" )
2751 main.log.report( "___________________________________________" )
2752 main.case( "Install single-multi point intents and Ping all" )
2753 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2754 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
2755 intentIdList = []
2756 print "MACsDict", main.MACsDict
2757 time1 = time.time()
2758 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2759 pool = []
2760 for cli in main.CLIs:
2761 ingressDevice = deviceDPIDsCopy[i]
2762 egressDeviceList = copy.copy(deviceDPIDsCopy)
2763 egressDeviceList.remove(ingressDevice)
2764 if i >= len( deviceDPIDsCopy ):
2765 break
2766 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2767 threadID=main.threadID,
2768 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002769 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002770 pool.append(t)
2771 #time.sleep(1)
2772 t.start()
2773 i = i + 1
2774 main.threadID = main.threadID + 1
2775 for thread in pool:
2776 thread.join()
2777 intentIdList.append(thread.result)
2778 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002779 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002780 time.sleep(5)
2781 main.step( "Verify Ping across all hosts" )
2782 pingResult = main.FALSE
2783 time1 = time.time()
2784 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2785 time2 = time.time()
2786 timeDiff = round( ( time2 - time1 ), 2 )
2787 main.log.report(
2788 "Time taken for Ping All: " +
2789 str( timeDiff ) +
2790 " seconds" )
2791
2792 case97Result = pingResult
2793 utilities.assert_equals(
2794 expect=main.TRUE,
2795 actual=case97Result,
2796 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2797 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2798
2799 def CASE98( self ):
2800 """
2801 Install single-multi point intents and verify Ping all works
2802 for Spine topology
2803 """
2804 import copy
2805 main.log.report( "Install single-multi point intents and verify Ping all" )
2806 main.log.report( "___________________________________________" )
2807 main.case( "Install single-multi point intents and Ping all" )
2808 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2809 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
2810 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
2811 intentIdList = []
2812 MACsDictCopy = {}
2813 for i in range( len( deviceDPIDsCopy ) ):
2814 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
2815
2816 print "deviceDPIDsCopy", deviceDPIDsCopy
2817 print ""
2818 print "MACsDictCopy", MACsDictCopy
2819 time1 = time.time()
2820 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2821 pool = []
2822 for cli in main.CLIs:
2823 if i >= len( deviceDPIDsCopy ):
2824 break
2825 ingressDevice = deviceDPIDsCopy[i]
2826 egressDeviceList = copy.copy(deviceDPIDsCopy)
2827 egressDeviceList.remove(ingressDevice)
2828 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2829 threadID=main.threadID,
2830 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002831 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002832 pool.append(t)
2833 #time.sleep(1)
2834 t.start()
2835 i = i + 1
2836 main.threadID = main.threadID + 1
2837 for thread in pool:
2838 thread.join()
2839 intentIdList.append(thread.result)
2840 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002841 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002842 time.sleep(5)
2843 main.step( "Verify Ping across all hosts" )
2844 pingResult = main.FALSE
2845 time1 = time.time()
2846 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2847 time2 = time.time()
2848 timeDiff = round( ( time2 - time1 ), 2 )
2849 main.log.report(
2850 "Time taken for Ping All: " +
2851 str( timeDiff ) +
2852 " seconds" )
2853
2854 case98Result = pingResult
2855 utilities.assert_equals(
2856 expect=main.TRUE,
2857 actual=case98Result,
2858 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2859 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2860
Hari Krishna4223dbd2015-08-13 16:29:53 -07002861 def CASE190( self ):
2862 """
2863 Verify IPv6 ping across 600 Point intents (Att Topology)
2864 """
2865 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
2866 main.log.report( "_________________________________________________" )
2867 import itertools
2868 import time
2869 main.case( "IPv6 ping all 600 Point intents" )
2870 main.step( "Verify IPv6 Ping across all hosts" )
2871 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2872 pingResult = main.FALSE
2873 time1 = time.time()
2874 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2875 time2 = time.time()
2876 timeDiff = round( ( time2 - time1 ), 2 )
2877 main.log.report(
2878 "Time taken for IPv6 Ping All: " +
2879 str( timeDiff ) +
2880 " seconds" )
2881 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2882 onpass="PING ALL PASS",
2883 onfail="PING ALL FAIL" )
2884
2885 case160Result = pingResult
2886 utilities.assert_equals(
2887 expect=main.TRUE,
2888 actual=case160Result,
2889 onpass="IPv6 Ping across 600 Point intents test PASS",
2890 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2891
2892 def CASE191( self ):
2893 """
2894 Verify IPv6 ping across 600 Point intents (Chordal Topology)
2895 """
2896 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
2897 main.log.report( "_________________________________________________" )
2898 import itertools
2899 import time
2900 main.case( "IPv6 ping all 600 Point intents" )
2901 main.step( "Verify IPv6 Ping across all hosts" )
2902 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2903 pingResult = main.FALSE
2904 time1 = time.time()
2905 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2906 time2 = time.time()
2907 timeDiff = round( ( time2 - time1 ), 2 )
2908 main.log.report(
2909 "Time taken for IPv6 Ping All: " +
2910 str( timeDiff ) +
2911 " seconds" )
2912 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2913 onpass="PING ALL PASS",
2914 onfail="PING ALL FAIL" )
2915
2916 case191Result = pingResult
2917 utilities.assert_equals(
2918 expect=main.TRUE,
2919 actual=case191Result,
2920 onpass="IPv6 Ping across 600 Point intents test PASS",
2921 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2922
2923 def CASE192( self ):
2924 """
2925 Verify IPv6 ping across 4556 Point intents (Spine Topology)
2926 """
2927 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
2928 main.log.report( "_________________________________________________" )
2929 import itertools
2930 import time
2931 main.case( "IPv6 ping all 600 Point intents" )
2932 main.step( "Verify IPv6 Ping across all hosts" )
2933 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2934 pingResult = main.FALSE
2935 time1 = time.time()
2936 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
2937 time2 = time.time()
2938 timeDiff = round( ( time2 - time1 ), 2 )
2939 main.log.report(
2940 "Time taken for IPv6 Ping All: " +
2941 str( timeDiff ) +
2942 " seconds" )
2943 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2944 onpass="PING ALL PASS",
2945 onfail="PING ALL FAIL" )
2946
2947 case192Result = pingResult
2948 utilities.assert_equals(
2949 expect=main.TRUE,
2950 actual=case192Result,
2951 onpass="IPv6 Ping across 600 Point intents test PASS",
2952 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2953
Hari Krishnac195f3b2015-07-08 20:02:24 -07002954 def CASE10( self ):
2955 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07002956 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07002957 """
2958 Remove all Intents
2959 """
2960 main.log.report( "Remove all intents that were installed previously" )
2961 main.log.report( "______________________________________________" )
2962 main.log.info( "Remove all intents" )
2963 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07002964 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002965 main.step( "Obtain the intent id's first" )
2966 intentsList = main.ONOScli1.getAllIntentIds()
2967 ansi_escape = re.compile( r'\x1b[^m]*m' )
2968 intentsList = ansi_escape.sub( '', intentsList )
2969 intentsList = intentsList.replace(
2970 " onos:intents | grep id=",
2971 "" ).replace(
2972 "id=",
2973 "" ).replace(
2974 "\r\r",
2975 "" )
2976 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002977 intentIdList = []
2978 step1Result = main.TRUE
2979 moreIntents = main.TRUE
2980 removeIntentCount = 0
2981 intentsCount = len(intentsList)
2982 main.log.info ( "Current number of intents: " + str(intentsCount) )
2983 if ( len( intentsList ) > 1 ):
2984 results = main.TRUE
2985 main.log.info("Removing intent...")
2986 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07002987 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002988 if removeIntentCount == 5:
2989 break
2990 removeIntentCount = removeIntentCount + 1
2991 intentsList1 = main.ONOScli1.getAllIntentIds()
2992 if len( intentsList1 ) == 0:
2993 break
2994 ansi_escape = re.compile( r'\x1b[^m]*m' )
2995 intentsList1 = ansi_escape.sub( '', intentsList1 )
2996 intentsList1 = intentsList1.replace(
2997 " onos:intents | grep id=",
2998 "" ).replace(
2999 " state=",
3000 "" ).replace(
3001 "\r\r",
3002 "" )
3003 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003004 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3005 print intentsList1
3006 intentIdList1 = []
3007 if ( len( intentsList1 ) > 0 ):
3008 moreIntents = main.TRUE
3009 for i in range( len( intentsList1 ) ):
3010 intentsTemp1 = intentsList1[ i ].split( ',' )
3011 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3012 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3013 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3014 time1 = time.time()
3015 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3016 pool = []
3017 for cli in main.CLIs:
3018 if i >= len( intentIdList1 ):
3019 break
3020 t = main.Thread( target=cli.removeIntent,
3021 threadID=main.threadID,
3022 name="removeIntent",
3023 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3024 pool.append(t)
3025 t.start()
3026 i = i + 1
3027 main.threadID = main.threadID + 1
3028 for thread in pool:
3029 thread.join()
3030 intentIdList.append(thread.result)
3031 #time.sleep(2)
3032 time2 = time.time()
3033 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003034 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003035 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003036 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003037 else:
3038 time.sleep(10)
3039 if len( main.ONOScli1.intents()):
3040 continue
3041 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003042 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003043 else:
3044 print "Removed %d intents" %(intentsCount)
3045 step1Result = main.TRUE
3046 else:
3047 print "No Intent IDs found in Intents list: ", intentsList
3048 step1Result = main.FALSE
3049
3050 print main.ONOScli1.intents()
3051 caseResult10 = step1Result
3052 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
3053 onpass="Intent removal test successful",
3054 onfail="Intent removal test failed" )
3055
3056 def CASE12( self, main ):
3057 """
3058 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3059 """
3060 import re
3061 import copy
3062 import time
3063
Hari Krishnac195f3b2015-07-08 20:02:24 -07003064 threadID = 0
3065
3066 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3067 main.log.report( "_____________________________________________________" )
3068 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3069 main.step( "Enable intent based Reactive forwarding" )
3070 installResult = main.FALSE
3071 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003072
Hari Krishnac195f3b2015-07-08 20:02:24 -07003073 pool = []
3074 time1 = time.time()
3075 for cli,feature in main.CLIs:
3076 t = main.Thread(target=cli,threadID=threadID,
3077 name="featureInstall",args=[feature])
3078 pool.append(t)
3079 t.start()
3080 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003081
Hari Krishnac195f3b2015-07-08 20:02:24 -07003082 results = []
3083 for thread in pool:
3084 thread.join()
3085 results.append(thread.result)
3086 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003087
Hari Krishnac195f3b2015-07-08 20:02:24 -07003088 if( all(result == main.TRUE for result in results) == False):
3089 main.log.info("Did not install onos-app-ifwd feature properly")
3090 #main.cleanup()
3091 #main.exit()
3092 else:
3093 main.log.info("Successful feature:install onos-app-ifwd")
3094 installResult = main.TRUE
3095 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003096
Hari Krishnac195f3b2015-07-08 20:02:24 -07003097 main.step( "Verify Pingall" )
3098 ping_result = main.FALSE
3099 time1 = time.time()
3100 ping_result = main.Mininet1.pingall(timeout=600)
3101 time2 = time.time()
3102 timeDiff = round( ( time2 - time1 ), 2 )
3103 main.log.report(
3104 "Time taken for Ping All: " +
3105 str( timeDiff ) +
3106 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003107
Hari Krishnac195f3b2015-07-08 20:02:24 -07003108 if ping_result == main.TRUE:
3109 main.log.report( "Pingall Test in Reactive mode successful" )
3110 else:
3111 main.log.report( "Pingall Test in Reactive mode failed" )
3112
3113 main.step( "Disable Intent based Reactive forwarding" )
3114 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003115
Hari Krishnac195f3b2015-07-08 20:02:24 -07003116 pool = []
3117 time1 = time.time()
3118 for cli,feature in main.CLIs:
3119 t = main.Thread(target=cli,threadID=threadID,
3120 name="featureUninstall",args=[feature])
3121 pool.append(t)
3122 t.start()
3123 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003124
Hari Krishnac195f3b2015-07-08 20:02:24 -07003125 results = []
3126 for thread in pool:
3127 thread.join()
3128 results.append(thread.result)
3129 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003130
Hari Krishnac195f3b2015-07-08 20:02:24 -07003131 if( all(result == main.TRUE for result in results) == False):
3132 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3133 uninstallResult = main.FALSE
3134 #main.cleanup()
3135 #main.exit()
3136 else:
3137 main.log.info("Successful feature:uninstall onos-app-ifwd")
3138 uninstallResult = main.TRUE
3139 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
3140
3141 # Waiting for reative flows to be cleared.
3142 time.sleep( 10 )
3143
3144 case11Result = installResult and ping_result and uninstallResult
3145 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
3146 onpass="Intent based Reactive forwarding Pingall test PASS",
3147 onfail="Intent based Reactive forwarding Pingall test FAIL" )