blob: 01a3544903560851945f6274f5ea0cd1f961212d [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']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070036 main.newTopo = ""
37 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070038
39 for i in range( 1, int(main.numCtrls) + 1 ):
40 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070041
42 main.case( "Set up test environment" )
43 main.log.report( "Set up test environment" )
44 main.log.report( "_______________________" )
45
Hari Krishna6185fc12015-07-13 15:42:31 -070046 main.step( "Apply Cell environment for ONOS" )
47 if ( main.onoscell ):
48 cellName = main.onoscell
49 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070050 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
51 onpass="Test step PASS",
52 onfail="Test step FAIL" )
53 else:
54 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
55 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
56 main.clean()
57 main.exit()
58
Hari Krishnac195f3b2015-07-08 20:02:24 -070059 main.step( "Git checkout and pull " + git_branch )
60 if git_pull == 'on':
61 checkout_result = main.ONOSbench.gitCheckout( git_branch )
62 pull_result = main.ONOSbench.gitPull()
63 cp_result = ( checkout_result and pull_result )
64 else:
65 checkout_result = main.TRUE
66 pull_result = main.TRUE
67 main.log.info( "Skipped git checkout and pull" )
68 cp_result = ( checkout_result and pull_result )
69 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
70 onpass="Test step PASS",
71 onfail="Test step FAIL" )
72
73 main.step( "mvn clean & install" )
74 if git_pull == 'on':
75 mvn_result = main.ONOSbench.cleanInstall()
76 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
77 onpass="Test step PASS",
78 onfail="Test step FAIL" )
79 else:
80 mvn_result = main.TRUE
81 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
82
83 main.ONOSbench.getVersion( report=True )
84
Hari Krishnac195f3b2015-07-08 20:02:24 -070085 main.step( "Create ONOS package" )
86 packageResult = main.ONOSbench.onosPackage()
87 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
88 onpass="Test step PASS",
89 onfail="Test step FAIL" )
90
91 main.step( "Uninstall ONOS package on all Nodes" )
92 uninstallResult = main.TRUE
93 for i in range( int( main.numCtrls ) ):
94 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
95 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
96 utilities.assert_equals( expect=main.TRUE, actual=u_result,
97 onpass="Test step PASS",
98 onfail="Test step FAIL" )
99 uninstallResult = ( uninstallResult and u_result )
100
101 main.step( "Install ONOS package on all Nodes" )
102 installResult = main.TRUE
103 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700104 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700105 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
106 utilities.assert_equals( expect=main.TRUE, actual=i_result,
107 onpass="Test step PASS",
108 onfail="Test step FAIL" )
109 installResult = ( installResult and i_result )
110
111 main.step( "Verify ONOS nodes UP status" )
112 statusResult = main.TRUE
113 for i in range( int( main.numCtrls ) ):
114 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
115 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
116 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
117 onpass="Test step PASS",
118 onfail="Test step FAIL" )
119 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700120
Hari Krishnac195f3b2015-07-08 20:02:24 -0700121 main.step( "Start ONOS CLI on all nodes" )
122 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700123 main.log.step(" Start ONOS cli using thread ")
124 startCliResult = main.TRUE
125 pool = []
126 time1 = time.time()
127 for i in range( int( main.numCtrls) ):
128 t = main.Thread( target=main.CLIs[i].startOnosCli,
129 threadID=main.threadID,
130 name="startOnosCli",
131 args=[ main.onosIPs[i], karafTimeout ] )
132 pool.append(t)
133 t.start()
134 main.threadID = main.threadID + 1
135 for t in pool:
136 t.join()
137 startCliResult = startCliResult and t.result
138 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700139
Hari Krishnac195f3b2015-07-08 20:02:24 -0700140 if not startCliResult:
141 main.log.info("ONOS CLI did not start up properly")
142 main.cleanup()
143 main.exit()
144 else:
145 main.log.info("Successful CLI startup")
146 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700147
148 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
149 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
150 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
151 cfgResult = cfgResult1 and cfgResult2
152 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
153 onpass="ipv6NeighborDiscovery cfg is set to true",
154 onfail="Failed to cfg set ipv6NeighborDiscovery" )
155
156 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700157 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
158 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
159 onpass="Set up test environment PASS",
160 onfail="Set up test environment FAIL" )
161
162 def CASE20( self, main ):
163 """
164 This test script Loads a new Topology (Att) on CHO setup and balances all switches
165 """
166 import re
167 import time
168 import copy
169
170 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
171 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
172 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
173 main.pingTimeout = 300
174 main.log.report(
175 "Load Att topology and Balance all Mininet switches across controllers" )
176 main.log.report(
177 "________________________________________________________________________" )
178 main.case(
179 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700180
Hari Krishnac195f3b2015-07-08 20:02:24 -0700181 main.step( "Stop any previous Mininet network topology" )
182 cliResult = main.TRUE
183 if main.newTopo == main.params['TOPO3']['topo']:
184 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
185
186 main.step( "Start Mininet with Att topology" )
187 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700188 mininetDir = main.Mininet1.home + "/custom/"
189 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
190 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
191 topoPath = mininetDir + main.newTopo
192 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700193
Hari Krishnac195f3b2015-07-08 20:02:24 -0700194 main.step( "Assign switches to controllers" )
195 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
196 main.Mininet1.assignSwController(
197 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700198 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700199
200 switch_mastership = main.TRUE
201 for i in range( 1, ( main.numMNswitches + 1 ) ):
202 response = main.Mininet1.getSwController( "s" + str( i ) )
203 print( "Response is " + str( response ) )
204 if re.search( "tcp:" + main.onosIPs[0], response ):
205 switch_mastership = switch_mastership and main.TRUE
206 else:
207 switch_mastership = main.FALSE
208
209 if switch_mastership == main.TRUE:
210 main.log.report( "Controller assignment successfull" )
211 else:
212 main.log.report( "Controller assignment failed" )
213
214 time.sleep(30) # waiting here to make sure topology converges across all nodes
215
216 main.step( "Balance devices across controllers" )
217 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700218 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700219 time.sleep( 5 )
220
221 topology_output = main.ONOScli1.topology()
222 topology_result = main.ONOSbench.getTopology( topology_output )
223 case2Result = ( switch_mastership and startStatus )
224 utilities.assert_equals(
225 expect=main.TRUE,
226 actual=case2Result,
227 onpass="Starting new Att topology test PASS",
228 onfail="Starting new Att topology test FAIL" )
229
230 def CASE21( self, main ):
231 """
232 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
233 """
234 import re
235 import time
236 import copy
237
238 main.newTopo = main.params['TOPO2']['topo']
239 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
240 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
241 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
242 main.pingTimeout = 300
243 main.log.report(
244 "Load Chordal topology and Balance all Mininet switches across controllers" )
245 main.log.report(
246 "________________________________________________________________________" )
247 main.case(
248 "Assign and Balance all Mininet switches across controllers" )
249
250 main.step( "Stop any previous Mininet network topology" )
251 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
252
GlennRCc6cd2a62015-08-10 16:08:22 -0700253 main.step("Start Mininet with Chordal topology")
254 mininetDir = main.Mininet1.home + "/custom/"
255 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
256 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
257 topoPath = mininetDir + main.newTopo
258 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700259
260 main.step( "Assign switches to controllers" )
261
262 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
263 main.Mininet1.assignSwController(
264 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700265 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700266
267 switch_mastership = main.TRUE
268 for i in range( 1, ( main.numMNswitches + 1 ) ):
269 response = main.Mininet1.getSwController( "s" + str( i ) )
270 print( "Response is " + str( response ) )
271 if re.search( "tcp:" + main.onosIPs[0], response ):
272 switch_mastership = switch_mastership and main.TRUE
273 else:
274 switch_mastership = main.FALSE
275
276 if switch_mastership == main.TRUE:
277 main.log.report( "Controller assignment successfull" )
278 else:
279 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700280
Hari Krishnac195f3b2015-07-08 20:02:24 -0700281 main.step( "Balance devices across controllers" )
282 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700283 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700284 time.sleep( 5 )
285
286 case21Result = switch_mastership
287 time.sleep(30)
288 utilities.assert_equals(
289 expect=main.TRUE,
290 actual=case21Result,
291 onpass="Starting new Chordal topology test PASS",
292 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700293
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 def CASE22( self, main ):
295 """
296 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
297 """
298 import re
299 import time
300 import copy
301
302 main.newTopo = main.params['TOPO3']['topo']
303 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
304 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
305 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
306 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700307
Hari Krishnac195f3b2015-07-08 20:02:24 -0700308 main.log.report(
309 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
310 main.log.report(
311 "________________________________________________________________________" )
312 main.case(
313 "Assign and Balance all Mininet switches across controllers" )
314 main.step( "Stop any previous Mininet network topology" )
315 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700316
317 main.step("Start Mininet with Spine topology")
318 mininetDir = main.Mininet1.home + "/custom/"
319 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
320 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
321 topoPath = mininetDir + main.newTopo
322 startStatus = main.Mininet1.startNet(topoFile = topoPath)
323
Hari Krishnac195f3b2015-07-08 20:02:24 -0700324 time.sleep(60)
325 main.step( "Assign switches to controllers" )
326
327 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
328 main.Mininet1.assignSwController(
329 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700330 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700331
332 switch_mastership = main.TRUE
333 for i in range( 1, ( main.numMNswitches + 1 ) ):
334 response = main.Mininet1.getSwController( "s" + str( i ) )
335 print( "Response is " + str( response ) )
336 if re.search( "tcp:" + main.onosIPs[0], response ):
337 switch_mastership = switch_mastership and main.TRUE
338 else:
339 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700340
Hari Krishnac195f3b2015-07-08 20:02:24 -0700341 if switch_mastership == main.TRUE:
342 main.log.report( "Controller assignment successfull" )
343 else:
344 main.log.report( "Controller assignment failed" )
345 time.sleep( 5 )
346
347 main.step( "Balance devices across controllers" )
348 for i in range( int( main.numCtrls ) ):
349 balanceResult = main.ONOScli1.balanceMasters()
350 # giving some breathing time for ONOS to complete re-balance
351 time.sleep( 3 )
352
353 case22Result = switch_mastership
354 time.sleep(60)
355 utilities.assert_equals(
356 expect=main.TRUE,
357 actual=case22Result,
358 onpass="Starting new Spine topology test PASS",
359 onfail="Starting new Spine topology test FAIL" )
360
361 def CASE3( self, main ):
362 """
363 This Test case will be extended to collect and store more data related
364 ONOS state.
365 """
366 import re
367 import copy
368 main.deviceDPIDs = []
369 main.hostMACs = []
370 main.deviceLinks = []
371 main.deviceActiveLinksCount = []
372 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700373
Hari Krishnac195f3b2015-07-08 20:02:24 -0700374 main.log.report(
375 "Collect and Store topology details from ONOS before running any Tests" )
376 main.log.report(
377 "____________________________________________________________________" )
378 main.case( "Collect and Store Topology Details from ONOS" )
379 main.step( "Collect and store current number of switches and links" )
380 topology_output = main.ONOScli1.topology()
381 topology_result = main.ONOSbench.getTopology( topology_output )
382 numOnosDevices = topology_result[ 'devices' ]
383 numOnosLinks = topology_result[ 'links' ]
384 topoResult = main.TRUE
385
386 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
387 main.step( "Store Device DPIDs" )
388 for i in range( 1, (main.numMNswitches+1) ):
389 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
390 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
391
392 main.step( "Store Host MACs" )
393 for i in range( 1, ( main.numMNhosts + 1 ) ):
394 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
395 print "Host MACs in Store: \n", str( main.hostMACs )
396 main.MACsDict = {}
397 print "Creating dictionary of DPID and HostMacs"
398 for i in range(len(main.hostMACs)):
399 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
400 print main.MACsDict
401 main.step( "Collect and store all Devices Links" )
402 linksResult = main.ONOScli1.links( jsonFormat=False )
403 ansi_escape = re.compile( r'\x1b[^m]*m' )
404 linksResult = ansi_escape.sub( '', linksResult )
405 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
406 linksResult = linksResult.splitlines()
407 main.deviceLinks = copy.copy( linksResult )
408 print "Device Links Stored: \n", str( main.deviceLinks )
409 # this will be asserted to check with the params provided count of
410 # links
411 print "Length of Links Store", len( main.deviceLinks )
412
413 main.step( "Collect and store each Device ports enabled Count" )
414 time1 = time.time()
415 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
416 pool = []
417 for cli in main.CLIs:
418 if i >= main.numMNswitches + 1:
419 break
420 dpid = "of:00000000000000" + format( i,'02x' )
421 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
422 t.start()
423 pool.append(t)
424 i = i + 1
425 main.threadID = main.threadID + 1
426 for thread in pool:
427 thread.join()
428 portResult = thread.result
429 main.devicePortsEnabledCount.append( portResult )
430 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
431 time2 = time.time()
432 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
433
434 main.step( "Collect and store each Device active links Count" )
435 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700436
Hari Krishnac195f3b2015-07-08 20:02:24 -0700437 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
438 pool = []
439 for cli in main.CLIs:
440 if i >= main.numMNswitches + 1:
441 break
442 dpid = "of:00000000000000" + format( i,'02x' )
443 t = main.Thread( target = cli.getDeviceLinksActiveCount,
444 threadID = main.threadID,
445 name = "getDevicePortsEnabledCount",
446 args = [dpid])
447 t.start()
448 pool.append(t)
449 i = i + 1
450 main.threadID = main.threadID + 1
451 for thread in pool:
452 thread.join()
453 linkCountResult = thread.result
454 main.deviceActiveLinksCount.append( linkCountResult )
455 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
456 time2 = time.time()
457 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
458
459 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700460 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700461 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
462 main.log.info("Devices (actual): %s, Links (actual): %s" %
463 ( numOnosDevices , numOnosLinks ) )
464 main.log.info("Topology does not match, exiting CHO test...")
465 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700466 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700467 main.cleanup()
468 main.exit()
469
470 # just returning TRUE for now as this one just collects data
471 case3Result = topoResult
472 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
473 onpass="Saving ONOS topology data test PASS",
474 onfail="Saving ONOS topology data test FAIL" )
475
476 def CASE40( self, main ):
477 """
478 Verify Reactive forwarding (Att Topology)
479 """
480 import re
481 import copy
482 import time
483 main.log.report( "Verify Reactive forwarding (Att Topology)" )
484 main.log.report( "______________________________________________" )
485 main.case( "Enable Reactive forwarding and Verify ping all" )
486 main.step( "Enable Reactive forwarding" )
487 installResult = main.TRUE
488 # Activate fwd app
489 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
490 appCheck = main.TRUE
491 pool = []
492 for cli in main.CLIs:
493 t = main.Thread( target=cli.appToIDCheck,
494 name="appToIDCheck-" + str( i ),
495 args=[] )
496 pool.append( t )
497 t.start()
498 for t in pool:
499 t.join()
500 appCheck = appCheck and t.result
501 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
502 onpass="App Ids seem to be correct",
503 onfail="Something is wrong with app Ids" )
504 if appCheck != main.TRUE:
505 main.log.warn( main.CLIs[0].apps() )
506 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700507
Hari Krishnac195f3b2015-07-08 20:02:24 -0700508 time.sleep( 10 )
509
510 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700511 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700512 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700513 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
514 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700515 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700516 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700517 time2 = time.time()
518 timeDiff = round( ( time2 - time1 ), 2 )
519 main.log.report(
520 "Time taken for Ping All: " +
521 str( timeDiff ) +
522 " seconds" )
523
GlennRC626ba132015-09-18 16:16:31 -0700524 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700525 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700526 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700527 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700528
GlennRC626ba132015-09-18 16:16:31 -0700529 case40Result = appCheck and pingResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700530 utilities.assert_equals( expect=main.TRUE, actual=case40Result,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700531 onpass="Reactive Mode IPv4 Pingall test PASS",
532 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700533
534 def CASE41( self, main ):
535 """
536 Verify Reactive forwarding (Chordal Topology)
537 """
538 import re
539 import copy
540 import time
541 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
542 main.log.report( "______________________________________________" )
543 main.case( "Enable Reactive forwarding and Verify ping all" )
544 main.step( "Enable Reactive forwarding" )
545 installResult = main.TRUE
546 # Activate fwd app
547 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
548
549 appCheck = main.TRUE
550 pool = []
551 for cli in main.CLIs:
552 t = main.Thread( target=cli.appToIDCheck,
553 name="appToIDCheck-" + str( i ),
554 args=[] )
555 pool.append( t )
556 t.start()
557 for t in pool:
558 t.join()
559 appCheck = appCheck and t.result
560 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
561 onpass="App Ids seem to be correct",
562 onfail="Something is wrong with app Ids" )
563 if appCheck != main.TRUE:
564 main.log.warn( main.CLIs[0].apps() )
565 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700566
Hari Krishnac195f3b2015-07-08 20:02:24 -0700567 time.sleep( 10 )
568
569 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700570 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700571 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700572 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
573 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700574 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700575 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700576 time2 = time.time()
577 timeDiff = round( ( time2 - time1 ), 2 )
578 main.log.report(
579 "Time taken for Ping All: " +
580 str( timeDiff ) +
581 " seconds" )
582
GlennRC626ba132015-09-18 16:16:31 -0700583 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700584 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700585 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700586 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700587
GlennRC626ba132015-09-18 16:16:31 -0700588 case41Result = appCheck and pingResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700589 utilities.assert_equals( expect=main.TRUE, actual=case41Result,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700590 onpass="Reactive Mode IPv4 Pingall test PASS",
591 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700592
593 def CASE42( self, main ):
594 """
595 Verify Reactive forwarding (Spine Topology)
596 """
597 import re
598 import copy
599 import time
600 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
601 main.log.report( "______________________________________________" )
602 main.case( "Enable Reactive forwarding and Verify ping all" )
603 main.step( "Enable Reactive forwarding" )
604 installResult = main.TRUE
605 # Activate fwd app
606 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
607
608 appCheck = main.TRUE
609 pool = []
610 for cli in main.CLIs:
611 t = main.Thread( target=cli.appToIDCheck,
612 name="appToIDCheck-" + str( i ),
613 args=[] )
614 pool.append( t )
615 t.start()
616 for t in pool:
617 t.join()
618 appCheck = appCheck and t.result
619 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
620 onpass="App Ids seem to be correct",
621 onfail="Something is wrong with app Ids" )
622 if appCheck != main.TRUE:
623 main.log.warn( main.CLIs[0].apps() )
624 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700625
Hari Krishnac195f3b2015-07-08 20:02:24 -0700626 time.sleep( 10 )
627
628 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700629 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700630 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700631 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
632 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700633 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700634 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700635 time2 = time.time()
636 timeDiff = round( ( time2 - time1 ), 2 )
637 main.log.report(
638 "Time taken for Ping All: " +
639 str( timeDiff ) +
640 " seconds" )
641
GlennRC626ba132015-09-18 16:16:31 -0700642 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700643 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700644 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700645 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
646
GlennRC626ba132015-09-18 16:16:31 -0700647 case42Result = appCheck and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700648 utilities.assert_equals( expect=main.TRUE, actual=case42Result,
649 onpass="Reactive Mode IPv4 Pingall test PASS",
650 onfail="Reactive Mode IPv4 Pingall test FAIL" )
651
652 def CASE140( self, main ):
653 """
654 Verify IPv6 Reactive forwarding (Att Topology)
655 """
656 import re
657 import copy
658 import time
659 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
660 main.log.report( "______________________________________________" )
661 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
662 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
663
664 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
665 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
666 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
667 cfgResult = cfgResult1 and cfgResult2
668 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
669 onpass="Reactive mode ipv6Fowarding cfg is set to true",
670 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
671
672 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700673 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700674 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700675 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
676 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700677 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700678 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700679 time2 = time.time()
680 timeDiff = round( ( time2 - time1 ), 2 )
681 main.log.report(
682 "Time taken for IPv6 Ping All: " +
683 str( timeDiff ) +
684 " seconds" )
685
GlennRC626ba132015-09-18 16:16:31 -0700686 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700687 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
688 else:
689 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700690
691 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700692
Hari Krishnac195f3b2015-07-08 20:02:24 -0700693 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700694 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700695 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
696 pool = []
697 for cli in main.CLIs:
698 t = main.Thread( target=cli.appToIDCheck,
699 name="appToIDCheck-" + str( i ),
700 args=[] )
701 pool.append( t )
702 t.start()
703
704 for t in pool:
705 t.join()
706 appCheck = appCheck and t.result
707 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
708 onpass="App Ids seem to be correct",
709 onfail="Something is wrong with app Ids" )
710 if appCheck != main.TRUE:
711 main.log.warn( main.CLIs[0].apps() )
712 main.log.warn( main.CLIs[0].appIDs() )
713
714 # Waiting for reative flows to be cleared.
715 time.sleep( 30 )
GlennRC626ba132015-09-18 16:16:31 -0700716 case140Result = appCheck and cfgResult and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700717 utilities.assert_equals( expect=main.TRUE, actual=case140Result,
718 onpass="Reactive Mode IPv6 Pingall test PASS",
719 onfail="Reactive Mode IPv6 Pingall test FAIL" )
720
721 def CASE141( self, main ):
722 """
723 Verify IPv6 Reactive forwarding (Chordal Topology)
724 """
725 import re
726 import copy
727 import time
728 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
729 main.log.report( "______________________________________________" )
730 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
731 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
732
733 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
734 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
735 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
736 cfgResult = cfgResult1 and cfgResult2
737 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
738 onpass="Reactive mode ipv6Fowarding cfg is set to true",
739 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
740
741 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700742 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700743 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700744 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
745 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700746 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700747 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700748 time2 = time.time()
749 timeDiff = round( ( time2 - time1 ), 2 )
750 main.log.report(
751 "Time taken for IPv6 Ping All: " +
752 str( timeDiff ) +
753 " seconds" )
754
GlennRC626ba132015-09-18 16:16:31 -0700755 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700756 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
757 else:
758 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
759
760 main.step( "Disable Reactive forwarding" )
761
762 main.log.info( "Uninstall reactive forwarding app" )
763 appCheck = main.TRUE
764 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
765 pool = []
766 for cli in main.CLIs:
767 t = main.Thread( target=cli.appToIDCheck,
768 name="appToIDCheck-" + str( i ),
769 args=[] )
770 pool.append( t )
771 t.start()
772
773 for t in pool:
774 t.join()
775 appCheck = appCheck and t.result
776 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
777 onpass="App Ids seem to be correct",
778 onfail="Something is wrong with app Ids" )
779 if appCheck != main.TRUE:
780 main.log.warn( main.CLIs[0].apps() )
781 main.log.warn( main.CLIs[0].appIDs() )
782
783 # Waiting for reative flows to be cleared.
784 time.sleep( 30 )
GlennRC626ba132015-09-18 16:16:31 -0700785 case140Result = appCheck and cfgResult and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700786 utilities.assert_equals( expect=main.TRUE, actual=case140Result,
787 onpass="Reactive Mode IPv6 Pingall test PASS",
788 onfail="Reactive Mode IPv6 Pingall test FAIL" )
789
790 def CASE142( self, main ):
791 """
792 Verify IPv6 Reactive forwarding (Spine Topology)
793 """
794 import re
795 import copy
796 import time
797 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
798 main.log.report( "______________________________________________" )
799 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
800 # Spine topology do not have hosts h1-h10
801 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
802 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
803 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
804 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
805 cfgResult = cfgResult1 and cfgResult2
806 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
807 onpass="Reactive mode ipv6Fowarding cfg is set to true",
808 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
809
810 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700811 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700812 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -0700813 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
814 if not ping_result:
815 main.log.warn("First pingall failed. Trying again...")
816 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700817 time2 = time.time()
818 timeDiff = round( ( time2 - time1 ), 2 )
819 main.log.report(
820 "Time taken for IPv6 Ping All: " +
821 str( timeDiff ) +
822 " seconds" )
823
GlennRC626ba132015-09-18 16:16:31 -0700824 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700825 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
826 else:
827 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
828
829 main.step( "Disable Reactive forwarding" )
830
831 main.log.info( "Uninstall reactive forwarding app" )
832 appCheck = main.TRUE
833 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
834 pool = []
835 for cli in main.CLIs:
836 t = main.Thread( target=cli.appToIDCheck,
837 name="appToIDCheck-" + str( i ),
838 args=[] )
839 pool.append( t )
840 t.start()
841
842 for t in pool:
843 t.join()
844 appCheck = appCheck and t.result
845 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
846 onpass="App Ids seem to be correct",
847 onfail="Something is wrong with app Ids" )
848 if appCheck != main.TRUE:
849 main.log.warn( main.CLIs[0].apps() )
850 main.log.warn( main.CLIs[0].appIDs() )
851
852 # Waiting for reative flows to be cleared.
853 time.sleep( 30 )
GlennRC626ba132015-09-18 16:16:31 -0700854 case142Result = appCheck and cfgResult and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700855 utilities.assert_equals( expect=main.TRUE, actual=case142Result,
856 onpass="Reactive Mode IPv6 Pingall test PASS",
857 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700858
859 def CASE5( self, main ):
860 """
861 Compare current ONOS topology with reference data
862 """
863 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700864
Hari Krishnac195f3b2015-07-08 20:02:24 -0700865 devicesDPIDTemp = []
866 hostMACsTemp = []
867 deviceLinksTemp = []
868 deviceActiveLinksCountTemp = []
869 devicePortsEnabledCountTemp = []
870
871 main.log.report(
872 "Compare ONOS topology with reference data in Stores" )
873 main.log.report( "__________________________________________________" )
874 main.case( "Compare ONOS topology with reference data" )
875
876 main.step( "Compare current Device ports enabled with reference" )
877 time1 = time.time()
878 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
879 pool = []
880 for cli in main.CLIs:
881 if i >= main.numMNswitches + 1:
882 break
883 dpid = "of:00000000000000" + format( i,'02x' )
884 t = main.Thread(target = cli.getDevicePortsEnabledCount,
885 threadID = main.threadID,
886 name = "getDevicePortsEnabledCount",
887 args = [dpid])
888 t.start()
889 pool.append(t)
890 i = i + 1
891 main.threadID = main.threadID + 1
892 for thread in pool:
893 thread.join()
894 portResult = thread.result
895 #portTemp = re.split( r'\t+', portResult )
896 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
897 devicePortsEnabledCountTemp.append( portResult )
898
899 time2 = time.time()
900 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
901 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700902 "Device Enabled ports EXPECTED: %s" %
903 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700904 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700905 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700906 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700907
Hari Krishnac195f3b2015-07-08 20:02:24 -0700908 if ( cmp( main.devicePortsEnabledCount,
909 devicePortsEnabledCountTemp ) == 0 ):
910 stepResult1 = main.TRUE
911 else:
912 stepResult1 = main.FALSE
913
914 main.step( "Compare Device active links with reference" )
915 time1 = time.time()
916 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
917 pool = []
918 for cli in main.CLIs:
919 if i >= main.numMNswitches + 1:
920 break
921 dpid = "of:00000000000000" + format( i,'02x' )
922 t = main.Thread(target = cli.getDeviceLinksActiveCount,
923 threadID = main.threadID,
924 name = "getDeviceLinksActiveCount",
925 args = [dpid])
926 t.start()
927 pool.append(t)
928 i = i + 1
929 main.threadID = main.threadID + 1
930 for thread in pool:
931 thread.join()
932 linkCountResult = thread.result
933 #linkCountTemp = re.split( r'\t+', linkCountResult )
934 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
935 deviceActiveLinksCountTemp.append( linkCountResult )
936
937 time2 = time.time()
938 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
939 main.log.info (
940 "Device Active links EXPECTED: %s" %
941 str( main.deviceActiveLinksCount ) )
942 main.log.info (
943 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
944 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
945 stepResult2 = main.TRUE
946 else:
947 stepResult2 = main.FALSE
948
949 """
950 place holder for comparing devices, hosts, paths and intents if required.
951 Links and ports data would be incorrect with out devices anyways.
952 """
953 case5Result = ( stepResult1 and stepResult2 )
954 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
955 onpass="Compare Topology test PASS",
956 onfail="Compare Topology test FAIL" )
957
958 def CASE60( self ):
959 """
960 Install 300 host intents and verify ping all (Att Topology)
961 """
962 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
963 main.log.report( "_______________________________________" )
964 import itertools
965 import time
966 main.case( "Install 300 host intents" )
967 main.step( "Add host Intents" )
968 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700969 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
970
Hari Krishnac195f3b2015-07-08 20:02:24 -0700971 intentIdList = []
972 time1 = time.time()
973 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
974 pool = []
975 for cli in main.CLIs:
976 if i >= len( hostCombos ):
977 break
978 t = main.Thread( target=cli.addHostIntent,
979 threadID=main.threadID,
980 name="addHostIntent",
981 args=[hostCombos[i][0],hostCombos[i][1]])
982 pool.append(t)
983 t.start()
984 i = i + 1
985 main.threadID = main.threadID + 1
986 for thread in pool:
987 thread.join()
988 intentIdList.append(thread.result)
989 time2 = time.time()
990 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
991
GlennRCa8d786a2015-09-23 17:40:11 -0700992 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700993
GlennRCa8d786a2015-09-23 17:40:11 -0700994 # Giving onos 3 chances to install intents
995 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -0700996 if i != 0:
997 main.log.warn( "Verification failed. Retrying..." )
998 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -0700999 time.sleep( main.checkIntentsDelay )
1000
1001 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001002 for e in range(int(main.numCtrls)):
1003 main.log.info( "Checking intents on CLI %s" % (e+1) )
1004 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1005 intentState
1006 if not intentState:
1007 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001008 if intentState:
1009 break
GlennRCdb2c8422015-09-29 12:21:59 -07001010 else:
1011 #Dumping intent summary
1012 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
1013
GlennRCa8d786a2015-09-23 17:40:11 -07001014
1015 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1016 onpass="INTENTS INSTALLED",
1017 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001018
1019 main.step( "Verify Ping across all hosts" )
1020 pingResult = main.FALSE
1021 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001022 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1023 if not pingResult:
1024 main.log.warn("First pingall failed. Retrying...")
1025 time1 = time.time()
1026 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001027 time2 = time.time()
1028 timeDiff = round( ( time2 - time1 ), 2 )
1029 main.log.report(
1030 "Time taken for Ping All: " +
1031 str( timeDiff ) +
1032 " seconds" )
1033 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1034 onpass="PING ALL PASS",
1035 onfail="PING ALL FAIL" )
1036
GlennRCa8d786a2015-09-23 17:40:11 -07001037 case60Result = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001038 utilities.assert_equals(
1039 expect=main.TRUE,
1040 actual=case60Result,
1041 onpass="Install 300 Host Intents and Ping All test PASS",
1042 onfail="Install 300 Host Intents and Ping All test FAIL" )
1043
1044 def CASE61( self ):
1045 """
1046 Install 600 host intents and verify ping all for Chordal Topology
1047 """
1048 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1049 main.log.report( "_______________________________________" )
1050 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001051
Hari Krishnac195f3b2015-07-08 20:02:24 -07001052 main.case( "Install 600 host intents" )
1053 main.step( "Add host Intents" )
1054 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001055 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1056
Hari Krishnac195f3b2015-07-08 20:02:24 -07001057 intentIdList = []
1058 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001059
Hari Krishnac195f3b2015-07-08 20:02:24 -07001060 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1061 pool = []
1062 for cli in main.CLIs:
1063 if i >= len( hostCombos ):
1064 break
1065 t = main.Thread( target=cli.addHostIntent,
1066 threadID=main.threadID,
1067 name="addHostIntent",
1068 args=[hostCombos[i][0],hostCombos[i][1]])
1069 pool.append(t)
1070 t.start()
1071 i = i + 1
1072 main.threadID = main.threadID + 1
1073 for thread in pool:
1074 thread.join()
1075 intentIdList.append(thread.result)
1076 time2 = time.time()
1077 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001078
1079 main.step("Verify intents are installed")
1080
1081 # Giving onos 3 chances to install intents
1082 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07001083 if i != 0:
1084 main.log.warn( "Verification failed. Retrying..." )
1085 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001086 time.sleep( main.checkIntentsDelay )
1087
1088 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001089 for e in range(int(main.numCtrls)):
1090 main.log.info( "Checking intents on CLI %s" % (e+1) )
1091 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1092 intentState
1093 if not intentState:
1094 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001095 if intentState:
1096 break
GlennRCdb2c8422015-09-29 12:21:59 -07001097 else:
1098 #Dumping intent summary
1099 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07001100
1101 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1102 onpass="INTENTS INSTALLED",
1103 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001104
1105 main.step( "Verify Ping across all hosts" )
1106 pingResult = main.FALSE
1107 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001108 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1109 if not pingResult:
1110 main.log.warn("First pingall failed. Retrying...")
1111 time1 = time.time()
1112 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001113 time2 = time.time()
1114 timeDiff = round( ( time2 - time1 ), 2 )
1115 main.log.report(
1116 "Time taken for Ping All: " +
1117 str( timeDiff ) +
1118 " seconds" )
1119 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1120 onpass="PING ALL PASS",
1121 onfail="PING ALL FAIL" )
1122
GlennRCa8d786a2015-09-23 17:40:11 -07001123 case14Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001124
Hari Krishnac195f3b2015-07-08 20:02:24 -07001125 utilities.assert_equals(
1126 expect=main.TRUE,
1127 actual=case14Result,
1128 onpass="Install 300 Host Intents and Ping All test PASS",
1129 onfail="Install 300 Host Intents and Ping All test FAIL" )
1130
1131 def CASE62( self ):
1132 """
1133 Install 2278 host intents and verify ping all for Spine Topology
1134 """
1135 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1136 main.log.report( "_______________________________________" )
1137 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001138
Hari Krishnac195f3b2015-07-08 20:02:24 -07001139 main.case( "Install 2278 host intents" )
1140 main.step( "Add host Intents" )
1141 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001142 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001143 main.pingTimeout = 300
1144 intentIdList = []
1145 time1 = time.time()
1146 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1147 pool = []
1148 for cli in main.CLIs:
1149 if i >= len( hostCombos ):
1150 break
1151 t = main.Thread( target=cli.addHostIntent,
1152 threadID=main.threadID,
1153 name="addHostIntent",
1154 args=[hostCombos[i][0],hostCombos[i][1]])
1155 pool.append(t)
1156 t.start()
1157 i = i + 1
1158 main.threadID = main.threadID + 1
1159 for thread in pool:
1160 thread.join()
1161 intentIdList.append(thread.result)
1162 time2 = time.time()
1163 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001164
1165 main.step("Verify intents are installed")
1166
GlennRCdb2c8422015-09-29 12:21:59 -07001167 # Giving onos 3 chances to install intents
1168 for i in range(3):
1169 if i != 0:
1170 main.log.warn( "Verification failed. Retrying..." )
1171 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001172 time.sleep( main.checkIntentsDelay )
1173
1174 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001175 for e in range(int(main.numCtrls)):
1176 main.log.info( "Checking intents on CLI %s" % (e+1) )
1177 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1178 intentState
1179 if not intentState:
1180 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001181 if intentState:
1182 break
GlennRCdb2c8422015-09-29 12:21:59 -07001183 else:
1184 #Dumping intent summary
1185 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07001186
1187 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1188 onpass="INTENTS INSTALLED",
1189 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001190
1191 main.step( "Verify Ping across all hosts" )
1192 pingResult = main.FALSE
1193 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001194 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1195 if not pingResult:
1196 main.log.warn("First pingall failed. Retrying...")
1197 time1 = time.time()
1198 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001199 time2 = time.time()
1200 timeDiff = round( ( time2 - time1 ), 2 )
1201 main.log.report(
1202 "Time taken for Ping All: " +
1203 str( timeDiff ) +
1204 " seconds" )
1205 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1206 onpass="PING ALL PASS",
1207 onfail="PING ALL FAIL" )
1208
GlennRCa8d786a2015-09-23 17:40:11 -07001209 case15Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001210
Hari Krishnac195f3b2015-07-08 20:02:24 -07001211 utilities.assert_equals(
1212 expect=main.TRUE,
1213 actual=case15Result,
1214 onpass="Install 2278 Host Intents and Ping All test PASS",
1215 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1216
Hari Krishna4223dbd2015-08-13 16:29:53 -07001217 def CASE160( self ):
1218 """
1219 Verify IPv6 ping across 300 host intents (Att Topology)
1220 """
1221 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1222 main.log.report( "_________________________________________________" )
1223 import itertools
1224 import time
1225 main.case( "IPv6 ping all 300 host intents" )
1226 main.step( "Verify IPv6 Ping across all hosts" )
1227 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1228 pingResult = main.FALSE
1229 time1 = time.time()
1230 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001231 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001232 main.log.warn("First pingall failed. Retrying...")
1233 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001234 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001235 time2 = time.time()
1236 timeDiff = round( ( time2 - time1 ), 2 )
1237 main.log.report(
1238 "Time taken for IPv6 Ping All: " +
1239 str( timeDiff ) +
1240 " seconds" )
1241 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1242 onpass="PING ALL PASS",
1243 onfail="PING ALL FAIL" )
1244
1245 case160Result = pingResult
1246 utilities.assert_equals(
1247 expect=main.TRUE,
1248 actual=case160Result,
1249 onpass="IPv6 Ping across 300 host intents test PASS",
1250 onfail="IPv6 Ping across 300 host intents test FAIL" )
1251
1252 def CASE161( self ):
1253 """
1254 Verify IPv6 ping across 600 host intents (Chordal Topology)
1255 """
1256 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1257 main.log.report( "_________________________________________________" )
1258 import itertools
1259 import time
1260 main.case( "IPv6 ping all 600 host intents" )
1261 main.step( "Verify IPv6 Ping across all hosts" )
1262 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1263 pingResult = main.FALSE
1264 time1 = time.time()
1265 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001266 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001267 main.log.warn("First pingall failed. Retrying...")
1268 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001269 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001270
Hari Krishna4223dbd2015-08-13 16:29:53 -07001271 time2 = time.time()
1272 timeDiff = round( ( time2 - time1 ), 2 )
1273 main.log.report(
1274 "Time taken for IPv6 Ping All: " +
1275 str( timeDiff ) +
1276 " seconds" )
1277 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1278 onpass="PING ALL PASS",
1279 onfail="PING ALL FAIL" )
1280
1281 case161Result = pingResult
1282 utilities.assert_equals(
1283 expect=main.TRUE,
1284 actual=case161Result,
1285 onpass="IPv6 Ping across 600 host intents test PASS",
1286 onfail="IPv6 Ping across 600 host intents test FAIL" )
1287
1288 def CASE162( self ):
1289 """
1290 Verify IPv6 ping across 2278 host intents (Spine Topology)
1291 """
1292 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1293 main.log.report( "_________________________________________________" )
1294 import itertools
1295 import time
1296 main.case( "IPv6 ping all 600 host intents" )
1297 main.step( "Verify IPv6 Ping across all hosts" )
1298 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
1299 pingResult = main.FALSE
1300 time1 = time.time()
1301 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001302 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001303 main.log.warn("First pingall failed. Retrying...")
1304 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001305 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001306
Hari Krishna4223dbd2015-08-13 16:29:53 -07001307 time2 = time.time()
1308 timeDiff = round( ( time2 - time1 ), 2 )
1309 main.log.report(
1310 "Time taken for IPv6 Ping All: " +
1311 str( timeDiff ) +
1312 " seconds" )
1313 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1314 onpass="PING ALL PASS",
1315 onfail="PING ALL FAIL" )
1316
1317 case162Result = pingResult
1318 utilities.assert_equals(
1319 expect=main.TRUE,
1320 actual=case162Result,
1321 onpass="IPv6 Ping across 600 host intents test PASS",
1322 onfail="IPv6 Ping across 600 host intents test FAIL" )
1323
Hari Krishnac195f3b2015-07-08 20:02:24 -07001324 def CASE70( self, main ):
1325 """
1326 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1327 """
1328 import random
1329 main.randomLink1 = []
1330 main.randomLink2 = []
1331 main.randomLink3 = []
1332 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1333 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1334 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1335 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1336 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1337 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1338 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1339 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1340
1341 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1342 main.log.report( "___________________________________________________________________________" )
1343 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1344 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1345 if ( int( switchLinksToToggle ) ==
1346 0 or int( switchLinksToToggle ) > 5 ):
1347 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1348 #main.cleanup()
1349 #main.exit()
1350 else:
1351 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1352
1353 main.step( "Cut links on Core devices using user provided range" )
1354 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1355 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1356 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1357 for i in range( int( switchLinksToToggle ) ):
1358 main.Mininet1.link(
1359 END1=link1End1,
1360 END2=main.randomLink1[ i ],
1361 OPTION="down" )
1362 time.sleep( link_sleep )
1363 main.Mininet1.link(
1364 END1=link2End1,
1365 END2=main.randomLink2[ i ],
1366 OPTION="down" )
1367 time.sleep( link_sleep )
1368 main.Mininet1.link(
1369 END1=link3End1,
1370 END2=main.randomLink3[ i ],
1371 OPTION="down" )
1372 time.sleep( link_sleep )
1373
Hari Krishna6185fc12015-07-13 15:42:31 -07001374 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001375 linkDown = main.ONOSbench.checkStatus(
1376 topology_output, main.numMNswitches, str(
1377 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1378 utilities.assert_equals(
1379 expect=main.TRUE,
1380 actual=linkDown,
1381 onpass="Link Down discovered properly",
1382 onfail="Link down was not discovered in " +
1383 str( link_sleep ) +
1384 " seconds" )
1385
1386 main.step( "Verify Ping across all hosts" )
1387 pingResultLinkDown = main.FALSE
1388 time1 = time.time()
1389 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001390 if not pingResultLinkDown:
1391 main.log.warn("First pingall failed. Retrying...")
1392 time1 = time.time()
1393 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
1394
Hari Krishnac195f3b2015-07-08 20:02:24 -07001395 time2 = time.time()
1396 timeDiff = round( ( time2 - time1 ), 2 )
1397 main.log.report(
1398 "Time taken for Ping All: " +
1399 str( timeDiff ) +
1400 " seconds" )
1401 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1402 onpass="PING ALL PASS",
1403 onfail="PING ALL FAIL" )
1404
1405 caseResult70 = linkDown and pingResultLinkDown
1406 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
1407 onpass="Random Link cut Test PASS",
1408 onfail="Random Link cut Test FAIL" )
1409
1410 def CASE80( self, main ):
1411 """
1412 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1413 """
1414 import random
1415 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1416 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1417 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1418 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1419 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1420
1421 main.log.report(
1422 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1423 main.log.report(
1424 "__________________________________________________________________" )
1425 main.case(
1426 "Host intents - Bring the core links up that are down and verify ping all" )
1427 main.step( "Bring randomly cut links on Core devices up" )
1428 for i in range( int( switchLinksToToggle ) ):
1429 main.Mininet1.link(
1430 END1=link1End1,
1431 END2=main.randomLink1[ i ],
1432 OPTION="up" )
1433 time.sleep( link_sleep )
1434 main.Mininet1.link(
1435 END1=link2End1,
1436 END2=main.randomLink2[ i ],
1437 OPTION="up" )
1438 time.sleep( link_sleep )
1439 main.Mininet1.link(
1440 END1=link3End1,
1441 END2=main.randomLink3[ i ],
1442 OPTION="up" )
1443 time.sleep( link_sleep )
1444
Hari Krishna6185fc12015-07-13 15:42:31 -07001445 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001446 linkUp = main.ONOSbench.checkStatus(
1447 topology_output,
1448 main.numMNswitches,
1449 str( main.numMNlinks ) )
1450 utilities.assert_equals(
1451 expect=main.TRUE,
1452 actual=linkUp,
1453 onpass="Link up discovered properly",
1454 onfail="Link up was not discovered in " +
1455 str( link_sleep ) +
1456 " seconds" )
1457
1458 main.step( "Verify Ping across all hosts" )
1459 pingResultLinkUp = main.FALSE
1460 time1 = time.time()
1461 pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001462 if not pingResultLinkUp:
1463 main.log.warn("First pingall failed. Retrying...")
1464 time1 = time.time()
1465 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout )
1466
Hari Krishnac195f3b2015-07-08 20:02:24 -07001467 time2 = time.time()
1468 timeDiff = round( ( time2 - time1 ), 2 )
1469 main.log.report(
1470 "Time taken for Ping All: " +
1471 str( timeDiff ) +
1472 " seconds" )
1473 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1474 onpass="PING ALL PASS",
1475 onfail="PING ALL FAIL" )
1476
1477 caseResult80 = linkUp and pingResultLinkUp
1478 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
1479 onpass="Link Up Test PASS",
1480 onfail="Link Up Test FAIL" )
1481
1482 def CASE71( self, main ):
1483 """
1484 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1485 """
1486 import random
1487 main.randomLink1 = []
1488 main.randomLink2 = []
1489 main.randomLink3 = []
1490 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1491 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1492 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1493 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1494 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1495 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1496 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1497 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1498
1499 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1500 main.log.report( "___________________________________________________________________________" )
1501 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1502 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1503 if ( int( switchLinksToToggle ) ==
1504 0 or int( switchLinksToToggle ) > 5 ):
1505 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1506 #main.cleanup()
1507 #main.exit()
1508 else:
1509 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1510
1511 main.step( "Cut links on Core devices using user provided range" )
1512 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1513 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1514 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1515 for i in range( int( switchLinksToToggle ) ):
1516 main.Mininet1.link(
1517 END1=link1End1,
1518 END2=main.randomLink1[ i ],
1519 OPTION="down" )
1520 time.sleep( link_sleep )
1521 main.Mininet1.link(
1522 END1=link2End1,
1523 END2=main.randomLink2[ i ],
1524 OPTION="down" )
1525 time.sleep( link_sleep )
1526 main.Mininet1.link(
1527 END1=link3End1,
1528 END2=main.randomLink3[ i ],
1529 OPTION="down" )
1530 time.sleep( link_sleep )
1531
Hari Krishna6185fc12015-07-13 15:42:31 -07001532 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001533 linkDown = main.ONOSbench.checkStatus(
1534 topology_output, main.numMNswitches, str(
1535 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1536 utilities.assert_equals(
1537 expect=main.TRUE,
1538 actual=linkDown,
1539 onpass="Link Down discovered properly",
1540 onfail="Link down was not discovered in " +
1541 str( link_sleep ) +
1542 " seconds" )
1543
1544 main.step( "Verify Ping across all hosts" )
1545 pingResultLinkDown = main.FALSE
1546 time1 = time.time()
1547 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCa8d786a2015-09-23 17:40:11 -07001548 if not pingResultLinkDown:
1549 main.log.warn("First pingall failed. Retrying...")
1550 time1 = time.time()
1551 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
1552
Hari Krishnac195f3b2015-07-08 20:02:24 -07001553 time2 = time.time()
1554 timeDiff = round( ( time2 - time1 ), 2 )
1555 main.log.report(
1556 "Time taken for Ping All: " +
1557 str( timeDiff ) +
1558 " seconds" )
1559 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1560 onpass="PING ALL PASS",
1561 onfail="PING ALL FAIL" )
1562
1563 caseResult71 = linkDown and pingResultLinkDown
1564 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1565 onpass="Random Link cut Test PASS",
1566 onfail="Random Link cut Test FAIL" )
1567
1568 def CASE81( self, main ):
1569 """
1570 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1571 """
1572 import random
1573 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1574 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1575 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1576 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1577 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1578
1579 main.log.report(
1580 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1581 main.log.report(
1582 "__________________________________________________________________" )
1583 main.case(
1584 "Point intents - Bring the core links up that are down and verify ping all" )
1585 main.step( "Bring randomly cut links on Core devices up" )
1586 for i in range( int( switchLinksToToggle ) ):
1587 main.Mininet1.link(
1588 END1=link1End1,
1589 END2=main.randomLink1[ i ],
1590 OPTION="up" )
1591 time.sleep( link_sleep )
1592 main.Mininet1.link(
1593 END1=link2End1,
1594 END2=main.randomLink2[ i ],
1595 OPTION="up" )
1596 time.sleep( link_sleep )
1597 main.Mininet1.link(
1598 END1=link3End1,
1599 END2=main.randomLink3[ i ],
1600 OPTION="up" )
1601 time.sleep( link_sleep )
1602
Hari Krishna6185fc12015-07-13 15:42:31 -07001603 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001604 linkUp = main.ONOSbench.checkStatus(
1605 topology_output,
1606 main.numMNswitches,
1607 str( main.numMNlinks ) )
1608 utilities.assert_equals(
1609 expect=main.TRUE,
1610 actual=linkUp,
1611 onpass="Link up discovered properly",
1612 onfail="Link up was not discovered in " +
1613 str( link_sleep ) +
1614 " seconds" )
1615
1616 main.step( "Verify Ping across all hosts" )
1617 pingResultLinkUp = main.FALSE
1618 time1 = time.time()
1619 pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001620 if not pingResultLinkUp:
1621 main.log.warn("First pingall failed. Retrying...")
1622 time1 = time.time()
1623 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout )
1624
Hari Krishnac195f3b2015-07-08 20:02:24 -07001625 time2 = time.time()
1626 timeDiff = round( ( time2 - time1 ), 2 )
1627 main.log.report(
1628 "Time taken for Ping All: " +
1629 str( timeDiff ) +
1630 " seconds" )
1631 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1632 onpass="PING ALL PASS",
1633 onfail="PING ALL FAIL" )
1634
1635 caseResult81 = linkUp and pingResultLinkUp
1636 utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
1637 onpass="Link Up Test PASS",
1638 onfail="Link Up Test FAIL" )
1639
1640 def CASE72( self, main ):
1641 """
1642 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1643 """
1644 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001645 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001646 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001647
Hari Krishnac195f3b2015-07-08 20:02:24 -07001648 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1649 main.log.report( "___________________________________________________________________________" )
1650 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1651 switches = []
1652 switchesComb = []
1653 for i in range( main.numMNswitches ):
1654 switches.append('s%d'%(i+1))
1655 switchesLinksComb = list(itertools.combinations(switches,2))
1656 main.randomLinks = random.sample(switchesLinksComb, 5 )
1657 print main.randomLinks
1658 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001659
Hari Krishnac195f3b2015-07-08 20:02:24 -07001660 for switch in main.randomLinks:
1661 main.Mininet1.link(
1662 END1=switch[0],
1663 END2=switch[1],
1664 OPTION="down")
1665 time.sleep( link_sleep )
1666
Hari Krishna6185fc12015-07-13 15:42:31 -07001667 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001668 linkDown = main.ONOSbench.checkStatus(
1669 topology_output, main.numMNswitches, str(
1670 int( main.numMNlinks ) - 5 * 2 ) )
1671 utilities.assert_equals(
1672 expect=main.TRUE,
1673 actual=linkDown,
1674 onpass="Link Down discovered properly",
1675 onfail="Link down was not discovered in " +
1676 str( link_sleep ) +
1677 " seconds" )
1678
1679 main.step( "Verify Ping across all hosts" )
1680 pingResultLinkDown = main.FALSE
1681 time1 = time.time()
1682 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07001683 if not pingResultLinkDown:
1684 main.log.warn("First pingall failed. Retrying...")
1685 time1 = time.time()
1686 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1687
1688
Hari Krishnac195f3b2015-07-08 20:02:24 -07001689 time2 = time.time()
1690 timeDiff = round( ( time2 - time1 ), 2 )
1691 main.log.report(
1692 "Time taken for Ping All: " +
1693 str( timeDiff ) +
1694 " seconds" )
1695 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1696 onpass="PING ALL PASS",
1697 onfail="PING ALL FAIL" )
1698
1699 caseResult71 = pingResultLinkDown
1700 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1701 onpass="Random Link cut Test PASS",
1702 onfail="Random Link cut Test FAIL" )
1703
1704 def CASE82( self, main ):
1705 """
1706 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1707 """
1708 import random
1709 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001710
Hari Krishnac195f3b2015-07-08 20:02:24 -07001711 main.log.report(
1712 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1713 main.log.report(
1714 "__________________________________________________________________" )
1715 main.case(
1716 "Host intents - Bring the core links up that are down and verify ping all" )
1717 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001718
Hari Krishnac195f3b2015-07-08 20:02:24 -07001719 for switch in main.randomLinks:
1720 main.Mininet1.link(
1721 END1=switch[0],
1722 END2=switch[1],
1723 OPTION="up")
1724 time.sleep( link_sleep )
1725
Hari Krishna6185fc12015-07-13 15:42:31 -07001726 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001727 linkUp = main.ONOSbench.checkStatus(
1728 topology_output,
1729 main.numMNswitches,
1730 str( main.numMNlinks ) )
1731 utilities.assert_equals(
1732 expect=main.TRUE,
1733 actual=linkUp,
1734 onpass="Link up discovered properly",
1735 onfail="Link up was not discovered in " +
1736 str( link_sleep ) +
1737 " seconds" )
1738
1739 main.step( "Verify Ping across all hosts" )
1740 pingResultLinkUp = main.FALSE
1741 time1 = time.time()
1742 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07001743 if not pingResultLinkUp:
1744 main.log.warn("First pingall failed. Retrying...")
1745 time1 = time.time()
1746 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1747
1748
Hari Krishnac195f3b2015-07-08 20:02:24 -07001749 time2 = time.time()
1750 timeDiff = round( ( time2 - time1 ), 2 )
1751 main.log.report(
1752 "Time taken for Ping All: " +
1753 str( timeDiff ) +
1754 " seconds" )
1755 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1756 onpass="PING ALL PASS",
1757 onfail="PING ALL FAIL" )
1758
1759 caseResult82 = linkUp and pingResultLinkUp
1760 utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
1761 onpass="Link Up Test PASS",
1762 onfail="Link Up Test FAIL" )
1763
1764 def CASE73( self, main ):
1765 """
1766 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1767 """
1768 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001769 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001770 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001771
Hari Krishnac195f3b2015-07-08 20:02:24 -07001772 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1773 main.log.report( "___________________________________________________________________________" )
1774 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1775 switches = []
1776 switchesComb = []
1777 for i in range( main.numMNswitches ):
1778 switches.append('s%d'%(i+1))
1779 switchesLinksComb = list(itertools.combinations(switches,2))
1780 main.randomLinks = random.sample(switchesLinksComb, 5 )
1781 print main.randomLinks
1782 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001783
Hari Krishnac195f3b2015-07-08 20:02:24 -07001784 for switch in main.randomLinks:
1785 main.Mininet1.link(
1786 END1=switch[0],
1787 END2=switch[1],
1788 OPTION="down")
1789 time.sleep( link_sleep )
1790
Hari Krishna6185fc12015-07-13 15:42:31 -07001791 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001792 linkDown = main.ONOSbench.checkStatus(
1793 topology_output, main.numMNswitches, str(
1794 int( main.numMNlinks ) - 5 * 2 ) )
1795 utilities.assert_equals(
1796 expect=main.TRUE,
1797 actual=linkDown,
1798 onpass="Link Down discovered properly",
1799 onfail="Link down was not discovered in " +
1800 str( link_sleep ) +
1801 " seconds" )
1802
1803 main.step( "Verify Ping across all hosts" )
1804 pingResultLinkDown = main.FALSE
1805 time1 = time.time()
1806 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07001807 if not pingResultLinkDown:
1808 main.log.warn("First pingall failed. Retrying...")
1809 time1 = time.time()
1810 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1811
Hari Krishnac195f3b2015-07-08 20:02:24 -07001812 time2 = time.time()
1813 timeDiff = round( ( time2 - time1 ), 2 )
1814 main.log.report(
1815 "Time taken for Ping All: " +
1816 str( timeDiff ) +
1817 " seconds" )
1818 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1819 onpass="PING ALL PASS",
1820 onfail="PING ALL FAIL" )
1821
1822 caseResult73 = pingResultLinkDown
1823 utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
1824 onpass="Random Link cut Test PASS",
1825 onfail="Random Link cut Test FAIL" )
1826
1827 def CASE83( self, main ):
1828 """
1829 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
1830 """
1831 import random
1832 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001833
Hari Krishnac195f3b2015-07-08 20:02:24 -07001834 main.log.report(
1835 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
1836 main.log.report(
1837 "__________________________________________________________________" )
1838 main.case(
1839 "Point intents - Bring the core links up that are down and verify ping all" )
1840 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001841
Hari Krishnac195f3b2015-07-08 20:02:24 -07001842 for switch in main.randomLinks:
1843 main.Mininet1.link(
1844 END1=switch[0],
1845 END2=switch[1],
1846 OPTION="up")
1847 time.sleep( link_sleep )
1848
Hari Krishna6185fc12015-07-13 15:42:31 -07001849 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001850 linkUp = main.ONOSbench.checkStatus(
1851 topology_output,
1852 main.numMNswitches,
1853 str( main.numMNlinks ) )
1854 utilities.assert_equals(
1855 expect=main.TRUE,
1856 actual=linkUp,
1857 onpass="Link up discovered properly",
1858 onfail="Link up was not discovered in " +
1859 str( link_sleep ) +
1860 " seconds" )
1861
1862 main.step( "Verify Ping across all hosts" )
1863 pingResultLinkUp = main.FALSE
1864 time1 = time.time()
1865 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07001866 if not pingResultLinkUp:
1867 main.log.warn("First pingall failed. Retrying...")
1868 time1 = time.time()
1869 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1870
Hari Krishnac195f3b2015-07-08 20:02:24 -07001871 time2 = time.time()
1872 timeDiff = round( ( time2 - time1 ), 2 )
1873 main.log.report(
1874 "Time taken for Ping All: " +
1875 str( timeDiff ) +
1876 " seconds" )
1877 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1878 onpass="PING ALL PASS",
1879 onfail="PING ALL FAIL" )
1880
1881 caseResult83 = linkUp and pingResultLinkUp
1882 utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
1883 onpass="Link Up Test PASS",
1884 onfail="Link Up Test FAIL" )
1885
1886 def CASE74( self, main ):
1887 """
1888 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
1889 """
1890 import random
1891 main.randomLink1 = []
1892 main.randomLink2 = []
1893 main.randomLink3 = []
1894 main.randomLink4 = []
1895 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1896 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
1897 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
1898 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1899 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
1900 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
1901 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1902 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07001903
Hari Krishnac195f3b2015-07-08 20:02:24 -07001904 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
1905 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07001906 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001907 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07001908 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001909 linkIndex.remove(linkIndexS9)
1910 linkIndexS10 = random.sample(linkIndex,1)[0]
1911 main.randomLink1 = link1End2top[linkIndexS9]
1912 main.randomLink2 = link2End2top[linkIndexS10]
1913 main.randomLink3 = random.sample(link1End2bot,1)[0]
1914 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07001915
1916 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07001917 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
1918 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
1919 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
1920 time.sleep( link_sleep )
1921 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
1922 time.sleep( link_sleep )
1923
Hari Krishna6185fc12015-07-13 15:42:31 -07001924 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001925 linkDown = main.ONOSbench.checkStatus(
1926 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07001927 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07001928 utilities.assert_equals(
1929 expect=main.TRUE,
1930 actual=linkDown,
1931 onpass="Link Down discovered properly",
1932 onfail="Link down was not discovered in " +
1933 str( link_sleep ) +
1934 " seconds" )
1935
1936 main.step( "Verify Ping across all hosts" )
1937 pingResultLinkDown = main.FALSE
1938 time1 = time.time()
1939 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07001940 if not pingResultLinkDown:
1941 main.log.warn("First pingall failed. Retrying...")
1942 time1 = time.time()
1943 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
1944
Hari Krishnac195f3b2015-07-08 20:02:24 -07001945 time2 = time.time()
1946 timeDiff = round( ( time2 - time1 ), 2 )
1947 main.log.report(
1948 "Time taken for Ping All: " +
1949 str( timeDiff ) +
1950 " seconds" )
1951 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1952 onpass="PING ALL PASS",
1953 onfail="PING ALL FAIL" )
1954
1955 caseResult74 = linkDown and pingResultLinkDown
1956 utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
1957 onpass="Random Link cut Test PASS",
1958 onfail="Random Link cut Test FAIL" )
1959
1960 def CASE84( self, main ):
1961 """
1962 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
1963 """
1964 import random
1965 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1966 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1967 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1968 main.log.report(
1969 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
1970 main.log.report(
1971 "__________________________________________________________________" )
1972 main.case(
1973 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07001974
1975 # Work around for link state propagation delay. Added some sleep time.
1976 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
1977 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001978 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
1979 time.sleep( link_sleep )
1980 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
1981 time.sleep( link_sleep )
1982
Hari Krishna6185fc12015-07-13 15:42:31 -07001983 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001984 linkUp = main.ONOSbench.checkStatus(
1985 topology_output,
1986 main.numMNswitches,
1987 str( main.numMNlinks ) )
1988 utilities.assert_equals(
1989 expect=main.TRUE,
1990 actual=linkUp,
1991 onpass="Link up discovered properly",
1992 onfail="Link up was not discovered in " +
1993 str( link_sleep ) +
1994 " seconds" )
1995
1996 main.step( "Verify Ping across all hosts" )
1997 pingResultLinkUp = main.FALSE
1998 time1 = time.time()
1999 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07002000 if not pingResultLinkUp:
2001 main.log.warn("First pingall failed. Retrying...")
2002 time1 = time.time()
2003 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2004
Hari Krishnac195f3b2015-07-08 20:02:24 -07002005 time2 = time.time()
2006 timeDiff = round( ( time2 - time1 ), 2 )
2007 main.log.report(
2008 "Time taken for Ping All: " +
2009 str( timeDiff ) +
2010 " seconds" )
2011 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
2012 onpass="PING ALL PASS",
2013 onfail="PING ALL FAIL" )
2014
2015 caseResult84 = linkUp and pingResultLinkUp
2016 utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
2017 onpass="Link Up Test PASS",
2018 onfail="Link Up Test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002019
Hari Krishnab79d0822015-08-20 09:48:43 -07002020 def CASE75( self, main ):
2021 """
2022 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2023 """
2024 import random
2025 main.randomLink1 = []
2026 main.randomLink2 = []
2027 main.randomLink3 = []
2028 main.randomLink4 = []
2029 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2030 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2031 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2032 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2033 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2034 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2035 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2036 main.pingTimeout = 400
2037
2038 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2039 main.log.report( "___________________________________________________________________________" )
2040 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2041 linkIndex = range(4)
2042 linkIndexS9 = random.sample(linkIndex,1)[0]
2043 linkIndex.remove(linkIndexS9)
2044 linkIndexS10 = random.sample(linkIndex,1)[0]
2045 main.randomLink1 = link1End2top[linkIndexS9]
2046 main.randomLink2 = link2End2top[linkIndexS10]
2047 main.randomLink3 = random.sample(link1End2bot,1)[0]
2048 main.randomLink4 = random.sample(link2End2bot,1)[0]
2049
2050 # Work around for link state propagation delay. Added some sleep time.
2051 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2052 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2053 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2054 time.sleep( link_sleep )
2055 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2056 time.sleep( link_sleep )
2057
2058 topology_output = main.ONOScli1.topology()
2059 linkDown = main.ONOSbench.checkStatus(
2060 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002061 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002062 utilities.assert_equals(
2063 expect=main.TRUE,
2064 actual=linkDown,
2065 onpass="Link Down discovered properly",
2066 onfail="Link down was not discovered in " +
2067 str( link_sleep ) +
2068 " seconds" )
2069
2070 main.step( "Verify Ping across all hosts" )
2071 pingResultLinkDown = main.FALSE
2072 time1 = time.time()
2073 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07002074 if not pingResultLinkDown:
2075 main.log.warn("First pingall failed. Retrying...")
2076 time1 = time.time()
2077 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2078
Hari Krishnab79d0822015-08-20 09:48:43 -07002079 time2 = time.time()
2080 timeDiff = round( ( time2 - time1 ), 2 )
2081 main.log.report(
2082 "Time taken for Ping All: " +
2083 str( timeDiff ) +
2084 " seconds" )
2085 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
2086 onpass="PING ALL PASS",
2087 onfail="PING ALL FAIL" )
2088
2089 caseResult75 = linkDown and pingResultLinkDown
2090 utilities.assert_equals( expect=main.TRUE, actual=caseResult75,
2091 onpass="Random Link cut Test PASS",
2092 onfail="Random Link cut Test FAIL" )
2093
2094 def CASE85( self, main ):
2095 """
2096 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2097 """
2098 import random
2099 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2100 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2101 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2102 main.log.report(
2103 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2104 main.log.report(
2105 "__________________________________________________________________" )
2106 main.case(
2107 "Point intents - Bring the core links up that are down and verify ping all" )
2108
2109 # Work around for link state propagation delay. Added some sleep time.
2110 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2111 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2112 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2113 time.sleep( link_sleep )
2114 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2115 time.sleep( link_sleep )
2116
2117 topology_output = main.ONOScli1.topology()
2118 linkUp = main.ONOSbench.checkStatus(
2119 topology_output,
2120 main.numMNswitches,
2121 str( main.numMNlinks ) )
2122 utilities.assert_equals(
2123 expect=main.TRUE,
2124 actual=linkUp,
2125 onpass="Link up discovered properly",
2126 onfail="Link up was not discovered in " +
2127 str( link_sleep ) +
2128 " seconds" )
2129
2130 main.step( "Verify Ping across all hosts" )
2131 pingResultLinkUp = main.FALSE
2132 time1 = time.time()
2133 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
GlennRCa8d786a2015-09-23 17:40:11 -07002134 if not pingResultLinkUp:
2135 main.log.warn("First pingall failed. Retrying...")
2136 time1 = time.time()
2137 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2138
Hari Krishnab79d0822015-08-20 09:48:43 -07002139 time2 = time.time()
2140 timeDiff = round( ( time2 - time1 ), 2 )
2141 main.log.report(
2142 "Time taken for Ping All: " +
2143 str( timeDiff ) +
2144 " seconds" )
2145 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
2146 onpass="PING ALL PASS",
2147 onfail="PING ALL FAIL" )
2148
2149 caseResult85 = linkUp and pingResultLinkUp
2150 utilities.assert_equals( expect=main.TRUE, actual=caseResult85,
2151 onpass="Link Up Test PASS",
2152 onfail="Link Up Test FAIL" )
2153
Hari Krishna4223dbd2015-08-13 16:29:53 -07002154 def CASE170( self ):
2155 """
2156 IPv6 ping all with some core links down( Host Intents-Att Topo)
2157 """
2158 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2159 main.log.report( "_________________________________________________" )
2160 import itertools
2161 import time
2162 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2163 main.step( "Verify IPv6 Ping across all hosts" )
2164 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2165 pingResult = main.FALSE
2166 time1 = time.time()
2167 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002168 if not pingResult:
2169 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
2170 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002171 time2 = time.time()
2172 timeDiff = round( ( time2 - time1 ), 2 )
2173 main.log.report(
2174 "Time taken for IPv6 Ping All: " +
2175 str( timeDiff ) +
2176 " seconds" )
2177 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2178 onpass="PING ALL PASS",
2179 onfail="PING ALL FAIL" )
2180
2181 case170Result = pingResult
2182 utilities.assert_equals(
2183 expect=main.TRUE,
2184 actual=case170Result,
2185 onpass="IPv6 Ping across 300 host intents test PASS",
2186 onfail="IPv6 Ping across 300 host intents test FAIL" )
2187
2188 def CASE180( self ):
2189 """
2190 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2191 """
2192 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2193 main.log.report( "_________________________________________________" )
2194 import itertools
2195 import time
2196 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2197 main.step( "Verify IPv6 Ping across all hosts" )
2198 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2199 pingResult = main.FALSE
2200 time1 = time.time()
2201 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002202 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002203 main.log.warn("First ping failed. Retrying...")
2204 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002205 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002206
Hari Krishna4223dbd2015-08-13 16:29:53 -07002207 time2 = time.time()
2208 timeDiff = round( ( time2 - time1 ), 2 )
2209 main.log.report(
2210 "Time taken for IPv6 Ping All: " +
2211 str( timeDiff ) +
2212 " seconds" )
2213 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2214 onpass="PING ALL PASS",
2215 onfail="PING ALL FAIL" )
2216
2217 case180Result = pingResult
2218 utilities.assert_equals(
2219 expect=main.TRUE,
2220 actual=case180Result,
2221 onpass="IPv6 Ping across 300 host intents test PASS",
2222 onfail="IPv6 Ping across 300 host intents test FAIL" )
2223
2224 def CASE171( self ):
2225 """
2226 IPv6 ping all with some core links down( Point Intents-Att Topo)
2227 """
2228 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2229 main.log.report( "_________________________________________________" )
2230 import itertools
2231 import time
2232 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2233 main.step( "Verify IPv6 Ping across all hosts" )
2234 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2235 pingResult = main.FALSE
2236 time1 = time.time()
2237 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002238 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002239 main.log.warn("First ping failed. Retrying...")
2240 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002241 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002242
Hari Krishna4223dbd2015-08-13 16:29:53 -07002243 time2 = time.time()
2244 timeDiff = round( ( time2 - time1 ), 2 )
2245 main.log.report(
2246 "Time taken for IPv6 Ping All: " +
2247 str( timeDiff ) +
2248 " seconds" )
2249 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2250 onpass="PING ALL PASS",
2251 onfail="PING ALL FAIL" )
2252
2253 case171Result = pingResult
2254 utilities.assert_equals(
2255 expect=main.TRUE,
2256 actual=case171Result,
2257 onpass="IPv6 Ping across 600 point intents test PASS",
2258 onfail="IPv6 Ping across 600 point intents test FAIL" )
2259
2260 def CASE181( self ):
2261 """
2262 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2263 """
2264 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2265 main.log.report( "_________________________________________________" )
2266 import itertools
2267 import time
2268 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2269 main.step( "Verify IPv6 Ping across all hosts" )
2270 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2271 pingResult = main.FALSE
2272 time1 = time.time()
2273 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002274 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002275 main.log.warn("First ping failed. Retrying...")
2276 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002277 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002278
Hari Krishna4223dbd2015-08-13 16:29:53 -07002279 time2 = time.time()
2280 timeDiff = round( ( time2 - time1 ), 2 )
2281 main.log.report(
2282 "Time taken for IPv6 Ping All: " +
2283 str( timeDiff ) +
2284 " seconds" )
2285 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2286 onpass="PING ALL PASS",
2287 onfail="PING ALL FAIL" )
2288
2289 case181Result = pingResult
2290 utilities.assert_equals(
2291 expect=main.TRUE,
2292 actual=case181Result,
2293 onpass="IPv6 Ping across 600 Point intents test PASS",
2294 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2295
2296 def CASE172( self ):
2297 """
2298 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2299 """
2300 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2301 main.log.report( "_________________________________________________" )
2302 import itertools
2303 import time
2304 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2305 main.step( "Verify IPv6 Ping across all hosts" )
2306 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2307 pingResult = main.FALSE
2308 time1 = time.time()
2309 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002310 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002311 main.log.warn("First ping failed. Retrying...")
2312 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002313 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002314
Hari Krishna4223dbd2015-08-13 16:29:53 -07002315 time2 = time.time()
2316 timeDiff = round( ( time2 - time1 ), 2 )
2317 main.log.report(
2318 "Time taken for IPv6 Ping All: " +
2319 str( timeDiff ) +
2320 " seconds" )
2321 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2322 onpass="PING ALL PASS",
2323 onfail="PING ALL FAIL" )
2324
2325 case172Result = pingResult
2326 utilities.assert_equals(
2327 expect=main.TRUE,
2328 actual=case172Result,
2329 onpass="IPv6 Ping across 300 host intents test PASS",
2330 onfail="IPv6 Ping across 300 host intents test FAIL" )
2331
2332 def CASE182( self ):
2333 """
2334 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2335 """
2336 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2337 main.log.report( "_________________________________________________" )
2338 import itertools
2339 import time
2340 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2341 main.step( "Verify IPv6 Ping across all hosts" )
2342 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2343 pingResult = main.FALSE
2344 time1 = time.time()
2345 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002346 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002347 main.log.warn("First ping failed. Retrying...")
2348 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002349 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002350
Hari Krishna4223dbd2015-08-13 16:29:53 -07002351 time2 = time.time()
2352 timeDiff = round( ( time2 - time1 ), 2 )
2353 main.log.report(
2354 "Time taken for IPv6 Ping All: " +
2355 str( timeDiff ) +
2356 " seconds" )
2357 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2358 onpass="PING ALL PASS",
2359 onfail="PING ALL FAIL" )
2360
2361 case182Result = pingResult
2362 utilities.assert_equals(
2363 expect=main.TRUE,
2364 actual=case182Result,
2365 onpass="IPv6 Ping across 300 host intents test PASS",
2366 onfail="IPv6 Ping across 300 host intents test FAIL" )
2367
2368 def CASE173( self ):
2369 """
2370 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2371 """
2372 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2373 main.log.report( "_________________________________________________" )
2374 import itertools
2375 import time
2376 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2377 main.step( "Verify IPv6 Ping across all hosts" )
2378 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2379 pingResult = main.FALSE
2380 time1 = time.time()
2381 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002382 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002383 main.log.warn("First ping failed. Retrying...")
2384 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002385 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002386
Hari Krishna4223dbd2015-08-13 16:29:53 -07002387 time2 = time.time()
2388 timeDiff = round( ( time2 - time1 ), 2 )
2389 main.log.report(
2390 "Time taken for IPv6 Ping All: " +
2391 str( timeDiff ) +
2392 " seconds" )
2393 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2394 onpass="PING ALL PASS",
2395 onfail="PING ALL FAIL" )
2396
2397 case173Result = pingResult
2398 utilities.assert_equals(
2399 expect=main.TRUE,
2400 actual=case173Result,
2401 onpass="IPv6 Ping across 600 point intents test PASS",
2402 onfail="IPv6 Ping across 600 point intents test FAIL" )
2403
2404 def CASE183( self ):
2405 """
2406 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2407 """
2408 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2409 main.log.report( "_________________________________________________" )
2410 import itertools
2411 import time
2412 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2413 main.step( "Verify IPv6 Ping across all hosts" )
2414 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2415 pingResult = main.FALSE
2416 time1 = time.time()
2417 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002418 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002419 main.log.warn("First ping failed. Retrying...")
2420 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002421 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002422
Hari Krishna4223dbd2015-08-13 16:29:53 -07002423 time2 = time.time()
2424 timeDiff = round( ( time2 - time1 ), 2 )
2425 main.log.report(
2426 "Time taken for IPv6 Ping All: " +
2427 str( timeDiff ) +
2428 " seconds" )
2429 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2430 onpass="PING ALL PASS",
2431 onfail="PING ALL FAIL" )
2432
2433 case183Result = pingResult
2434 utilities.assert_equals(
2435 expect=main.TRUE,
2436 actual=case183Result,
2437 onpass="IPv6 Ping across 600 Point intents test PASS",
2438 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2439
2440 def CASE174( self ):
2441 """
2442 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2443 """
2444 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2445 main.log.report( "_________________________________________________" )
2446 import itertools
2447 import time
2448 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2449 main.step( "Verify IPv6 Ping across all hosts" )
2450 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2451 pingResult = main.FALSE
2452 time1 = time.time()
2453 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002454 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002455 main.log.warn("First ping failed. Retrying...")
2456 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002457 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002458
Hari Krishna4223dbd2015-08-13 16:29:53 -07002459 time2 = time.time()
2460 timeDiff = round( ( time2 - time1 ), 2 )
2461 main.log.report(
2462 "Time taken for IPv6 Ping All: " +
2463 str( timeDiff ) +
2464 " seconds" )
2465 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2466 onpass="PING ALL PASS",
2467 onfail="PING ALL FAIL" )
2468
2469 case174Result = pingResult
2470 utilities.assert_equals(
2471 expect=main.TRUE,
2472 actual=case174Result,
2473 onpass="IPv6 Ping across 2278 host intents test PASS",
2474 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2475
2476 def CASE184( self ):
2477 """
2478 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2479 """
2480 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2481 main.log.report( "_________________________________________________" )
2482 import itertools
2483 import time
2484 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2485 main.step( "Verify IPv6 Ping across all hosts" )
2486 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2487 pingResult = main.FALSE
2488 time1 = time.time()
2489 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002490 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002491 main.log.warn("First ping failed. Retrying...")
2492 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002493 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002494
Hari Krishna4223dbd2015-08-13 16:29:53 -07002495 time2 = time.time()
2496 timeDiff = round( ( time2 - time1 ), 2 )
2497 main.log.report(
2498 "Time taken for IPv6 Ping All: " +
2499 str( timeDiff ) +
2500 " seconds" )
2501 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2502 onpass="PING ALL PASS",
2503 onfail="PING ALL FAIL" )
2504
2505 case184Result = pingResult
2506 utilities.assert_equals(
2507 expect=main.TRUE,
2508 actual=case184Result,
2509 onpass="IPv6 Ping across 2278 host intents test PASS",
2510 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2511
2512 def CASE175( self ):
2513 """
2514 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2515 """
2516 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2517 main.log.report( "_________________________________________________" )
2518 import itertools
2519 import time
2520 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2521 main.step( "Verify IPv6 Ping across all hosts" )
2522 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2523 pingResult = main.FALSE
2524 time1 = time.time()
2525 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002526 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002527 main.log.warn("First ping failed. Retrying...")
2528 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002529 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002530
Hari Krishna4223dbd2015-08-13 16:29:53 -07002531 time2 = time.time()
2532 timeDiff = round( ( time2 - time1 ), 2 )
2533 main.log.report(
2534 "Time taken for IPv6 Ping All: " +
2535 str( timeDiff ) +
2536 " seconds" )
2537 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2538 onpass="PING ALL PASS",
2539 onfail="PING ALL FAIL" )
2540
2541 case175Result = pingResult
2542 utilities.assert_equals(
2543 expect=main.TRUE,
2544 actual=case175Result,
2545 onpass="IPv6 Ping across 4556 point intents test PASS",
2546 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2547
2548 def CASE185( self ):
2549 """
2550 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
2551 """
2552 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2553 main.log.report( "_________________________________________________" )
2554 import itertools
2555 import time
2556 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2557 main.step( "Verify IPv6 Ping across all hosts" )
2558 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2559 pingResult = main.FALSE
2560 time1 = time.time()
2561 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002562 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002563 main.log.warn("First ping failed. Retrying...")
2564 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002565 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002566
Hari Krishna4223dbd2015-08-13 16:29:53 -07002567 time2 = time.time()
2568 timeDiff = round( ( time2 - time1 ), 2 )
2569 main.log.report(
2570 "Time taken for IPv6 Ping All: " +
2571 str( timeDiff ) +
2572 " seconds" )
2573 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2574 onpass="PING ALL PASS",
2575 onfail="PING ALL FAIL" )
2576
2577 case183Result = pingResult
2578 utilities.assert_equals(
2579 expect=main.TRUE,
2580 actual=case183Result,
2581 onpass="IPv6 Ping across 4556 Point intents test PASS",
2582 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2583
Hari Krishnac195f3b2015-07-08 20:02:24 -07002584 def CASE90( self ):
2585 """
2586 Install 600 point intents and verify ping all (Att Topology)
2587 """
2588 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2589 main.log.report( "_______________________________________" )
2590 import itertools
2591 import time
2592 main.case( "Install 600 point intents" )
2593 main.step( "Add point Intents" )
2594 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07002595 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
2596
Hari Krishnac195f3b2015-07-08 20:02:24 -07002597 intentIdList = []
2598 time1 = time.time()
2599 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
2600 pool = []
2601 for cli in main.CLIs:
2602 if i >= len( deviceCombos ):
2603 break
2604 t = main.Thread( target=cli.addPointIntent,
2605 threadID=main.threadID,
2606 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002607 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 -07002608 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002609 t.start()
2610 i = i + 1
2611 main.threadID = main.threadID + 1
2612 for thread in pool:
2613 thread.join()
2614 intentIdList.append(thread.result)
2615 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07002616 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07002617
2618 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07002619
2620 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07002621 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07002622 if i != 0:
2623 main.log.warn( "Verification failed. Retrying..." )
2624 main.log.info("Waiting for onos to install intents...")
2625 time.sleep( main.checkIntentsDelay )
2626
GlennRCa8d786a2015-09-23 17:40:11 -07002627 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07002628 for e in range(int(main.numCtrls)):
2629 main.log.info( "Checking intents on CLI %s" % (e+1) )
2630 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
2631 intentState
2632 if not intentState:
2633 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07002634 if intentState:
2635 break
GlennRCdb2c8422015-09-29 12:21:59 -07002636 else:
2637 #Dumping intent summary
2638 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07002639
2640 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2641 onpass="INTENTS INSTALLED",
2642 onfail="SOME INTENTS NOT INSTALLED" )
2643
Hari Krishnac195f3b2015-07-08 20:02:24 -07002644 main.step( "Verify Ping across all hosts" )
2645 pingResult = main.FALSE
2646 time1 = time.time()
2647 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2648 time2 = time.time()
2649 timeDiff = round( ( time2 - time1 ), 2 )
2650 main.log.report(
2651 "Time taken for Ping All: " +
2652 str( timeDiff ) +
2653 " seconds" )
2654 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2655 onpass="PING tALL PASS",
2656 onfail="PING ALL FAIL" )
2657
GlennRCdb2c8422015-09-29 12:21:59 -07002658 case90Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002659
Hari Krishnac195f3b2015-07-08 20:02:24 -07002660 utilities.assert_equals(
2661 expect=main.TRUE,
2662 actual=case90Result,
2663 onpass="Install 600 point Intents and Ping All test PASS",
2664 onfail="Install 600 point Intents and Ping All test FAIL" )
2665
2666 def CASE91( self ):
2667 """
2668 Install 600 point intents and verify ping all (Chordal Topology)
2669 """
2670 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2671 main.log.report( "_______________________________________" )
2672 import itertools
2673 import time
2674 main.case( "Install 600 point intents" )
2675 main.step( "Add point Intents" )
2676 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07002677 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
2678
Hari Krishnac195f3b2015-07-08 20:02:24 -07002679 intentIdList = []
2680 time1 = time.time()
2681 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
2682 pool = []
2683 for cli in main.CLIs:
2684 if i >= len( deviceCombos ):
2685 break
2686 t = main.Thread( target=cli.addPointIntent,
2687 threadID=main.threadID,
2688 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07002689 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 -07002690 pool.append(t)
2691 #time.sleep(1)
2692 t.start()
2693 i = i + 1
2694 main.threadID = main.threadID + 1
2695 for thread in pool:
2696 thread.join()
2697 intentIdList.append(thread.result)
2698 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07002699 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07002700
2701 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07002702
2703 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07002704 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07002705 if i != 0:
2706 main.log.warn( "Verification failed. Retrying..." )
2707 main.log.info("Waiting for onos to install intents...")
2708 time.sleep( main.checkIntentsDelay )
2709
GlennRCa8d786a2015-09-23 17:40:11 -07002710 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07002711 for e in range(int(main.numCtrls)):
2712 main.log.info( "Checking intents on CLI %s" % (e+1) )
2713 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
2714 intentState
2715 if not intentState:
2716 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07002717 if intentState:
2718 break
GlennRCdb2c8422015-09-29 12:21:59 -07002719 else:
2720 #Dumping intent summary
2721 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07002722
2723 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2724 onpass="INTENTS INSTALLED",
2725 onfail="SOME INTENTS NOT INSTALLED" )
2726
Hari Krishnac195f3b2015-07-08 20:02:24 -07002727 main.step( "Verify Ping across all hosts" )
2728 pingResult = main.FALSE
2729 time1 = time.time()
2730 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2731 time2 = time.time()
2732 timeDiff = round( ( time2 - time1 ), 2 )
2733 main.log.report(
2734 "Time taken for Ping All: " +
2735 str( timeDiff ) +
2736 " seconds" )
2737 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2738 onpass="PING ALL PASS",
2739 onfail="PING ALL FAIL" )
2740
GlennRCdb2c8422015-09-29 12:21:59 -07002741 case91Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002742
Hari Krishnac195f3b2015-07-08 20:02:24 -07002743 utilities.assert_equals(
2744 expect=main.TRUE,
2745 actual=case91Result,
2746 onpass="Install 600 point Intents and Ping All test PASS",
2747 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002748
Hari Krishnac195f3b2015-07-08 20:02:24 -07002749 def CASE92( self ):
2750 """
2751 Install 4556 point intents and verify ping all (Spine Topology)
2752 """
2753 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2754 main.log.report( "_______________________________________" )
2755 import itertools
2756 import time
2757 main.case( "Install 4556 point intents" )
2758 main.step( "Add point Intents" )
2759 intentResult = main.TRUE
2760 main.pingTimeout = 600
2761 for i in range(len(main.hostMACs)):
2762 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
2763 print main.MACsDict
2764 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
2765 intentIdList = []
2766 time1 = time.time()
2767 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
2768 pool = []
2769 for cli in main.CLIs:
2770 if i >= len( deviceCombos ):
2771 break
2772 t = main.Thread( target=cli.addPointIntent,
2773 threadID=main.threadID,
2774 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07002775 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 -07002776 pool.append(t)
2777 #time.sleep(1)
2778 t.start()
2779 i = i + 1
2780 main.threadID = main.threadID + 1
2781 for thread in pool:
2782 thread.join()
2783 intentIdList.append(thread.result)
2784 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07002785 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07002786
2787 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07002788
2789 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07002790 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07002791 if i != 0:
2792 main.log.warn( "Verification failed. Retrying..." )
2793 main.log.info("Waiting for onos to install intents...")
2794 time.sleep( main.checkIntentsDelay )
2795
GlennRCa8d786a2015-09-23 17:40:11 -07002796 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07002797 for e in range(int(main.numCtrls)):
2798 main.log.info( "Checking intents on CLI %s" % (e+1) )
2799 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
2800 intentState
2801 if not intentState:
2802 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07002803 if intentState:
2804 break
GlennRCdb2c8422015-09-29 12:21:59 -07002805 else:
2806 #Dumping intent summary
2807 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07002808
2809 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2810 onpass="INTENTS INSTALLED",
2811 onfail="SOME INTENTS NOT INSTALLED" )
2812
Hari Krishnac195f3b2015-07-08 20:02:24 -07002813 main.step( "Verify Ping across all hosts" )
2814 pingResult = main.FALSE
2815 time1 = time.time()
2816 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2817 time2 = time.time()
2818 timeDiff = round( ( time2 - time1 ), 2 )
2819 main.log.report(
2820 "Time taken for Ping All: " +
2821 str( timeDiff ) +
2822 " seconds" )
2823 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2824 onpass="PING ALL PASS",
2825 onfail="PING ALL FAIL" )
2826
GlennRCdb2c8422015-09-29 12:21:59 -07002827 case92Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002828
Hari Krishnac195f3b2015-07-08 20:02:24 -07002829 utilities.assert_equals(
2830 expect=main.TRUE,
2831 actual=case92Result,
2832 onpass="Install 4556 point Intents and Ping All test PASS",
2833 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002834
Hari Krishnac195f3b2015-07-08 20:02:24 -07002835 def CASE93( self ):
2836 """
2837 Install multi-single point intents and verify Ping all works
2838 for att topology
2839 """
2840 import copy
2841 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002842 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002843 main.log.report( "Install multi-single point intents and verify Ping all" )
2844 main.log.report( "___________________________________________" )
2845 main.case( "Install multi-single point intents and Ping all" )
2846 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2847 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2848 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07002849 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002850 time1 = time.time()
2851 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2852 pool = []
2853 for cli in main.CLIs:
2854 egressDevice = deviceDPIDsCopy[i]
2855 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2856 ingressDeviceList.remove(egressDevice)
2857 if i >= len( deviceDPIDsCopy ):
2858 break
2859 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2860 threadID=main.threadID,
2861 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002862 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002863 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002864 t.start()
2865 i = i + 1
2866 main.threadID = main.threadID + 1
2867 for thread in pool:
2868 thread.join()
2869 intentIdList.append(thread.result)
2870 time2 = time.time()
2871 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07002872
GlennRCdb2c8422015-09-29 12:21:59 -07002873 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07002874
GlennRCdb2c8422015-09-29 12:21:59 -07002875 # Giving onos 3 chances to install intents
2876 for i in range(3):
2877 if i != 0:
2878 main.log.warn( "Verification failed. Retrying..." )
2879 main.log.info("Waiting for onos to install intents...")
2880 time.sleep( main.checkIntentsDelay )
2881
2882 intentState = main.TRUE
2883 for e in range(int(main.numCtrls)):
2884 main.log.info( "Checking intents on CLI %s" % (e+1) )
2885 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
2886 intentState
2887 if not intentState:
2888 main.log.warn( "Not all intents installed" )
2889 if intentState:
2890 break
2891 else:
2892 #Dumping intent summary
2893 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
2894
2895 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2896 onpass="INTENTS INSTALLED",
2897 onfail="SOME INTENTS NOT INSTALLED" )
2898
2899 main.log.info( "Checking flows state" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002900 checkFlowsState = main.ONOScli1.checkFlowsState()
GlennRCdb2c8422015-09-29 12:21:59 -07002901 # Giving onos time to return the state of the flows
Hari Krishnac195f3b2015-07-08 20:02:24 -07002902 time.sleep(50)
GlennRCdb2c8422015-09-29 12:21:59 -07002903
Hari Krishnac195f3b2015-07-08 20:02:24 -07002904 main.step( "Verify Ping across all hosts" )
2905 pingResult = main.FALSE
2906 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07002907 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2908 if not pingResult:
2909 time1 = time.time()
2910 main.log.warn("First pingall failed. Retrying")
2911 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2912
Hari Krishnac195f3b2015-07-08 20:02:24 -07002913 time2 = time.time()
2914 timeDiff = round( ( time2 - time1 ), 2 )
2915 main.log.report(
2916 "Time taken for Ping All: " +
2917 str( timeDiff ) +
2918 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002919
2920 case93Result = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002921 utilities.assert_equals(
2922 expect=main.TRUE,
2923 actual=case93Result,
2924 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2925 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002926
Hari Krishnac195f3b2015-07-08 20:02:24 -07002927 def CASE94( self ):
2928 """
2929 Install multi-single point intents and verify Ping all works
2930 for Chordal topology
2931 """
2932 import copy
2933 import time
2934 main.log.report( "Install multi-single point intents and verify Ping all" )
2935 main.log.report( "___________________________________________" )
2936 main.case( "Install multi-single point intents and Ping all" )
2937 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2938 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2939 intentIdList = []
2940 print "MACsDict", main.MACsDict
2941 time1 = time.time()
2942 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2943 pool = []
2944 for cli in main.CLIs:
2945 egressDevice = deviceDPIDsCopy[i]
2946 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2947 ingressDeviceList.remove(egressDevice)
2948 if i >= len( deviceDPIDsCopy ):
2949 break
2950 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2951 threadID=main.threadID,
2952 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002953 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002954 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002955 t.start()
2956 i = i + 1
2957 main.threadID = main.threadID + 1
2958 for thread in pool:
2959 thread.join()
2960 intentIdList.append(thread.result)
2961 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002962 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07002963
2964 main.step("Verify intents are installed")
2965
2966 # Giving onos 3 chances to install intents
2967 for i in range(3):
2968 if i != 0:
2969 main.log.warn( "Verification failed. Retrying..." )
2970 main.log.info("Waiting for onos to install intents...")
2971 time.sleep( main.checkIntentsDelay )
2972
2973 intentState = main.TRUE
2974 for e in range(int(main.numCtrls)):
2975 main.log.info( "Checking intents on CLI %s" % (e+1) )
2976 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
2977 intentState
2978 if not intentState:
2979 main.log.warn( "Not all intents installed" )
2980 if intentState:
2981 break
2982 else:
2983 #Dumping intent summary
2984 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
2985
2986
2987 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2988 onpass="INTENTS INSTALLED",
2989 onfail="SOME INTENTS NOT INSTALLED" )
2990
Hari Krishnac195f3b2015-07-08 20:02:24 -07002991 main.step( "Verify Ping across all hosts" )
2992 pingResult = main.FALSE
2993 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07002994 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2995 if not pingResult:
2996 main.log.info( "First pingall failed. Retrying..." )
2997 time1 = time.time()
2998 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002999 time2 = time.time()
3000 timeDiff = round( ( time2 - time1 ), 2 )
3001 main.log.report(
3002 "Time taken for Ping All: " +
3003 str( timeDiff ) +
3004 " seconds" )
3005
GlennRCdb2c8422015-09-29 12:21:59 -07003006
3007 case94Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003008 utilities.assert_equals(
3009 expect=main.TRUE,
3010 actual=case94Result,
3011 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3012 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003013
Hari Krishnac195f3b2015-07-08 20:02:24 -07003014 #def CASE95 multi-single point intent for Spine
3015
3016 def CASE96( self ):
3017 """
3018 Install single-multi point intents and verify Ping all works
3019 for att topology
3020 """
3021 import copy
3022 main.log.report( "Install single-multi point intents and verify Ping all" )
3023 main.log.report( "___________________________________________" )
3024 main.case( "Install single-multi point intents and Ping all" )
3025 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3026 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3027 intentIdList = []
3028 print "MACsDict", main.MACsDict
3029 time1 = time.time()
3030 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3031 pool = []
3032 for cli in main.CLIs:
3033 ingressDevice = deviceDPIDsCopy[i]
3034 egressDeviceList = copy.copy(deviceDPIDsCopy)
3035 egressDeviceList.remove(ingressDevice)
3036 if i >= len( deviceDPIDsCopy ):
3037 break
3038 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3039 threadID=main.threadID,
3040 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003041 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003042 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003043 t.start()
3044 i = i + 1
3045 main.threadID = main.threadID + 1
3046 for thread in pool:
3047 thread.join()
3048 intentIdList.append(thread.result)
3049 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003050 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003051
3052 main.step("Verify intents are installed")
3053
3054 # Giving onos 3 chances to install intents
3055 for i in range(3):
3056 if i != 0:
3057 main.log.warn( "Verification failed. Retrying..." )
3058 main.log.info("Waiting for onos to install intents...")
3059 time.sleep( main.checkIntentsDelay )
3060
3061 intentState = main.TRUE
3062 for e in range(int(main.numCtrls)):
3063 main.log.info( "Checking intents on CLI %s" % (e+1) )
3064 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3065 intentState
3066 if not intentState:
3067 main.log.warn( "Not all intents installed" )
3068 if intentState:
3069 break
3070 else:
3071 #Dumping intent summary
3072 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3073
3074
3075 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3076 onpass="INTENTS INSTALLED",
3077 onfail="SOME INTENTS NOT INSTALLED" )
3078
Hari Krishnac195f3b2015-07-08 20:02:24 -07003079 main.step( "Verify Ping across all hosts" )
3080 pingResult = main.FALSE
3081 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003082 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3083 if not pingResult:
3084 main.log.info( "First pingall failed. Retrying..." )
3085 time1 = time.time()
3086 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003087 time2 = time.time()
3088 timeDiff = round( ( time2 - time1 ), 2 )
3089 main.log.report(
3090 "Time taken for Ping All: " +
3091 str( timeDiff ) +
3092 " seconds" )
3093
GlennRCdb2c8422015-09-29 12:21:59 -07003094 case96Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003095 utilities.assert_equals(
3096 expect=main.TRUE,
3097 actual=case96Result,
3098 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3099 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3100
3101 def CASE97( self ):
3102 """
3103 Install single-multi point intents and verify Ping all works
3104 for Chordal topology
3105 """
3106 import copy
3107 main.log.report( "Install single-multi point intents and verify Ping all" )
3108 main.log.report( "___________________________________________" )
3109 main.case( "Install single-multi point intents and Ping all" )
3110 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3111 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3112 intentIdList = []
3113 print "MACsDict", main.MACsDict
3114 time1 = time.time()
3115 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3116 pool = []
3117 for cli in main.CLIs:
3118 ingressDevice = deviceDPIDsCopy[i]
3119 egressDeviceList = copy.copy(deviceDPIDsCopy)
3120 egressDeviceList.remove(ingressDevice)
3121 if i >= len( deviceDPIDsCopy ):
3122 break
3123 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3124 threadID=main.threadID,
3125 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003126 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003127 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003128 t.start()
3129 i = i + 1
3130 main.threadID = main.threadID + 1
3131 for thread in pool:
3132 thread.join()
3133 intentIdList.append(thread.result)
3134 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003135 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003136
3137 main.step("Verify intents are installed")
3138
3139 # Giving onos 3 chances to install intents
3140 for i in range(3):
3141 if i != 0:
3142 main.log.warn( "Verification failed. Retrying..." )
3143 main.log.info("Waiting for onos to install intents...")
3144 time.sleep( main.checkIntentsDelay )
3145
3146 intentState = main.TRUE
3147 for e in range(int(main.numCtrls)):
3148 main.log.info( "Checking intents on CLI %s" % (e+1) )
3149 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3150 intentState
3151 if not intentState:
3152 main.log.warn( "Not all intents installed" )
3153 if intentState:
3154 break
3155 else:
3156 #Dumping intent summary
3157 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3158
3159
3160 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3161 onpass="INTENTS INSTALLED",
3162 onfail="SOME INTENTS NOT INSTALLED" )
3163
Hari Krishnac195f3b2015-07-08 20:02:24 -07003164 main.step( "Verify Ping across all hosts" )
3165 pingResult = main.FALSE
3166 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003167 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3168 if not pingResult:
3169 main.log.info( "First pingall failed. Retrying..." )
3170 time1 = time.time()
3171 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003172 time2 = time.time()
3173 timeDiff = round( ( time2 - time1 ), 2 )
3174 main.log.report(
3175 "Time taken for Ping All: " +
3176 str( timeDiff ) +
3177 " seconds" )
3178
GlennRCdb2c8422015-09-29 12:21:59 -07003179 case97Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003180 utilities.assert_equals(
3181 expect=main.TRUE,
3182 actual=case97Result,
3183 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3184 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3185
3186 def CASE98( self ):
3187 """
3188 Install single-multi point intents and verify Ping all works
3189 for Spine topology
3190 """
3191 import copy
3192 main.log.report( "Install single-multi point intents and verify Ping all" )
3193 main.log.report( "___________________________________________" )
3194 main.case( "Install single-multi point intents and Ping all" )
3195 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3196 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3197 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3198 intentIdList = []
3199 MACsDictCopy = {}
3200 for i in range( len( deviceDPIDsCopy ) ):
3201 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3202
3203 print "deviceDPIDsCopy", deviceDPIDsCopy
3204 print ""
3205 print "MACsDictCopy", MACsDictCopy
3206 time1 = time.time()
3207 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3208 pool = []
3209 for cli in main.CLIs:
3210 if i >= len( deviceDPIDsCopy ):
3211 break
3212 ingressDevice = deviceDPIDsCopy[i]
3213 egressDeviceList = copy.copy(deviceDPIDsCopy)
3214 egressDeviceList.remove(ingressDevice)
3215 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3216 threadID=main.threadID,
3217 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003218 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003219 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 t.start()
3221 i = i + 1
3222 main.threadID = main.threadID + 1
3223 for thread in pool:
3224 thread.join()
3225 intentIdList.append(thread.result)
3226 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003227 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003228
3229 main.step("Verify intents are installed")
3230
3231 # Giving onos 3 chances to install intents
3232 for i in range(3):
3233 if i != 0:
3234 main.log.warn( "Verification failed. Retrying..." )
3235 main.log.info("Waiting for onos to install intents...")
3236 time.sleep( main.checkIntentsDelay )
3237
3238 intentState = main.TRUE
3239 for e in range(int(main.numCtrls)):
3240 main.log.info( "Checking intents on CLI %s" % (e+1) )
3241 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3242 intentState
3243 if not intentState:
3244 main.log.warn( "Not all intents installed" )
3245 if intentState:
3246 break
3247 else:
3248 #Dumping intent summary
3249 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3250
3251
3252 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3253 onpass="INTENTS INSTALLED",
3254 onfail="SOME INTENTS NOT INSTALLED" )
3255
Hari Krishnac195f3b2015-07-08 20:02:24 -07003256 main.step( "Verify Ping across all hosts" )
3257 pingResult = main.FALSE
3258 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003259 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3260 if not pingResult:
3261 main.log.info( "First pingall failed. Retrying..." )
3262 time1 = time.time()
3263 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003264 time2 = time.time()
3265 timeDiff = round( ( time2 - time1 ), 2 )
3266 main.log.report(
3267 "Time taken for Ping All: " +
3268 str( timeDiff ) +
3269 " seconds" )
3270
GlennRCdb2c8422015-09-29 12:21:59 -07003271 case98Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003272 utilities.assert_equals(
3273 expect=main.TRUE,
3274 actual=case98Result,
3275 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3276 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3277
Hari Krishna4223dbd2015-08-13 16:29:53 -07003278 def CASE190( self ):
3279 """
3280 Verify IPv6 ping across 600 Point intents (Att Topology)
3281 """
3282 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3283 main.log.report( "_________________________________________________" )
3284 import itertools
3285 import time
3286 main.case( "IPv6 ping all 600 Point intents" )
3287 main.step( "Verify IPv6 Ping across all hosts" )
3288 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3289 pingResult = main.FALSE
3290 time1 = time.time()
3291 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003292 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003293 main.log.warn("First pingall failed. Retrying...")
3294 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003295 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3296
Hari Krishna4223dbd2015-08-13 16:29:53 -07003297 time2 = time.time()
3298 timeDiff = round( ( time2 - time1 ), 2 )
3299 main.log.report(
3300 "Time taken for IPv6 Ping All: " +
3301 str( timeDiff ) +
3302 " seconds" )
3303 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3304 onpass="PING ALL PASS",
3305 onfail="PING ALL FAIL" )
3306
3307 case160Result = pingResult
3308 utilities.assert_equals(
3309 expect=main.TRUE,
3310 actual=case160Result,
3311 onpass="IPv6 Ping across 600 Point intents test PASS",
3312 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3313
3314 def CASE191( self ):
3315 """
3316 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3317 """
3318 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3319 main.log.report( "_________________________________________________" )
3320 import itertools
3321 import time
3322 main.case( "IPv6 ping all 600 Point intents" )
3323 main.step( "Verify IPv6 Ping across all hosts" )
3324 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3325 pingResult = main.FALSE
3326 time1 = time.time()
3327 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003328 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003329 main.log.warn("First pingall failed. Retrying...")
3330 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003331 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003332
Hari Krishna4223dbd2015-08-13 16:29:53 -07003333 time2 = time.time()
3334 timeDiff = round( ( time2 - time1 ), 2 )
3335 main.log.report(
3336 "Time taken for IPv6 Ping All: " +
3337 str( timeDiff ) +
3338 " seconds" )
3339 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3340 onpass="PING ALL PASS",
3341 onfail="PING ALL FAIL" )
3342
3343 case191Result = pingResult
3344 utilities.assert_equals(
3345 expect=main.TRUE,
3346 actual=case191Result,
3347 onpass="IPv6 Ping across 600 Point intents test PASS",
3348 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3349
3350 def CASE192( self ):
3351 """
3352 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3353 """
3354 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3355 main.log.report( "_________________________________________________" )
3356 import itertools
3357 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003358 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003359 main.step( "Verify IPv6 Ping across all hosts" )
3360 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3361 pingResult = main.FALSE
3362 time1 = time.time()
3363 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003364 if not pingResult:
3365 main.log.warn("First pingall failed. Retrying...")
3366 time1 = time.time()
3367 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3368
Hari Krishna4223dbd2015-08-13 16:29:53 -07003369 time2 = time.time()
3370 timeDiff = round( ( time2 - time1 ), 2 )
3371 main.log.report(
3372 "Time taken for IPv6 Ping All: " +
3373 str( timeDiff ) +
3374 " seconds" )
3375 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3376 onpass="PING ALL PASS",
3377 onfail="PING ALL FAIL" )
3378
3379 case192Result = pingResult
3380 utilities.assert_equals(
3381 expect=main.TRUE,
3382 actual=case192Result,
Hari Krishna310efca2015-09-03 09:43:16 -07003383 onpass="IPv6 Ping across 4556 Point intents test PASS",
3384 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003385
Hari Krishnac195f3b2015-07-08 20:02:24 -07003386 def CASE10( self ):
3387 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003388 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003389 """
3390 Remove all Intents
3391 """
3392 main.log.report( "Remove all intents that were installed previously" )
3393 main.log.report( "______________________________________________" )
3394 main.log.info( "Remove all intents" )
3395 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003396 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003397 main.step( "Obtain the intent id's first" )
3398 intentsList = main.ONOScli1.getAllIntentIds()
3399 ansi_escape = re.compile( r'\x1b[^m]*m' )
3400 intentsList = ansi_escape.sub( '', intentsList )
3401 intentsList = intentsList.replace(
3402 " onos:intents | grep id=",
3403 "" ).replace(
3404 "id=",
3405 "" ).replace(
3406 "\r\r",
3407 "" )
3408 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003409 intentIdList = []
3410 step1Result = main.TRUE
3411 moreIntents = main.TRUE
3412 removeIntentCount = 0
3413 intentsCount = len(intentsList)
3414 main.log.info ( "Current number of intents: " + str(intentsCount) )
3415 if ( len( intentsList ) > 1 ):
3416 results = main.TRUE
3417 main.log.info("Removing intent...")
3418 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003419 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003420 if removeIntentCount == 5:
3421 break
3422 removeIntentCount = removeIntentCount + 1
3423 intentsList1 = main.ONOScli1.getAllIntentIds()
3424 if len( intentsList1 ) == 0:
3425 break
3426 ansi_escape = re.compile( r'\x1b[^m]*m' )
3427 intentsList1 = ansi_escape.sub( '', intentsList1 )
3428 intentsList1 = intentsList1.replace(
3429 " onos:intents | grep id=",
3430 "" ).replace(
3431 " state=",
3432 "" ).replace(
3433 "\r\r",
3434 "" )
3435 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003436 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3437 print intentsList1
3438 intentIdList1 = []
3439 if ( len( intentsList1 ) > 0 ):
3440 moreIntents = main.TRUE
3441 for i in range( len( intentsList1 ) ):
3442 intentsTemp1 = intentsList1[ i ].split( ',' )
3443 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3444 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3445 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3446 time1 = time.time()
3447 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3448 pool = []
3449 for cli in main.CLIs:
3450 if i >= len( intentIdList1 ):
3451 break
3452 t = main.Thread( target=cli.removeIntent,
3453 threadID=main.threadID,
3454 name="removeIntent",
3455 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3456 pool.append(t)
3457 t.start()
3458 i = i + 1
3459 main.threadID = main.threadID + 1
3460 for thread in pool:
3461 thread.join()
3462 intentIdList.append(thread.result)
3463 #time.sleep(2)
3464 time2 = time.time()
3465 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003466 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003467 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003468 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003469 else:
3470 time.sleep(10)
3471 if len( main.ONOScli1.intents()):
3472 continue
3473 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003474 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003475 else:
3476 print "Removed %d intents" %(intentsCount)
3477 step1Result = main.TRUE
3478 else:
3479 print "No Intent IDs found in Intents list: ", intentsList
3480 step1Result = main.FALSE
3481
3482 print main.ONOScli1.intents()
3483 caseResult10 = step1Result
3484 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
3485 onpass="Intent removal test successful",
3486 onfail="Intent removal test failed" )
3487
3488 def CASE12( self, main ):
3489 """
3490 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3491 """
3492 import re
3493 import copy
3494 import time
3495
Hari Krishnac195f3b2015-07-08 20:02:24 -07003496 threadID = 0
3497
3498 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3499 main.log.report( "_____________________________________________________" )
3500 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3501 main.step( "Enable intent based Reactive forwarding" )
3502 installResult = main.FALSE
3503 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003504
Hari Krishnac195f3b2015-07-08 20:02:24 -07003505 pool = []
3506 time1 = time.time()
3507 for cli,feature in main.CLIs:
3508 t = main.Thread(target=cli,threadID=threadID,
3509 name="featureInstall",args=[feature])
3510 pool.append(t)
3511 t.start()
3512 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003513
Hari Krishnac195f3b2015-07-08 20:02:24 -07003514 results = []
3515 for thread in pool:
3516 thread.join()
3517 results.append(thread.result)
3518 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003519
Hari Krishnac195f3b2015-07-08 20:02:24 -07003520 if( all(result == main.TRUE for result in results) == False):
3521 main.log.info("Did not install onos-app-ifwd feature properly")
3522 #main.cleanup()
3523 #main.exit()
3524 else:
3525 main.log.info("Successful feature:install onos-app-ifwd")
3526 installResult = main.TRUE
3527 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003528
Hari Krishnac195f3b2015-07-08 20:02:24 -07003529 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07003530 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07003531 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003532 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003533 time2 = time.time()
3534 timeDiff = round( ( time2 - time1 ), 2 )
3535 main.log.report(
3536 "Time taken for Ping All: " +
3537 str( timeDiff ) +
3538 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003539
GlennRC626ba132015-09-18 16:16:31 -07003540 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003541 main.log.report( "Pingall Test in Reactive mode successful" )
3542 else:
3543 main.log.report( "Pingall Test in Reactive mode failed" )
3544
3545 main.step( "Disable Intent based Reactive forwarding" )
3546 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003547
Hari Krishnac195f3b2015-07-08 20:02:24 -07003548 pool = []
3549 time1 = time.time()
3550 for cli,feature in main.CLIs:
3551 t = main.Thread(target=cli,threadID=threadID,
3552 name="featureUninstall",args=[feature])
3553 pool.append(t)
3554 t.start()
3555 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003556
Hari Krishnac195f3b2015-07-08 20:02:24 -07003557 results = []
3558 for thread in pool:
3559 thread.join()
3560 results.append(thread.result)
3561 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003562
Hari Krishnac195f3b2015-07-08 20:02:24 -07003563 if( all(result == main.TRUE for result in results) == False):
3564 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3565 uninstallResult = main.FALSE
3566 #main.cleanup()
3567 #main.exit()
3568 else:
3569 main.log.info("Successful feature:uninstall onos-app-ifwd")
3570 uninstallResult = main.TRUE
3571 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
3572
3573 # Waiting for reative flows to be cleared.
3574 time.sleep( 10 )
3575
GlennRC626ba132015-09-18 16:16:31 -07003576 case11Result = installResult and pingResult and uninstallResult
Hari Krishnac195f3b2015-07-08 20:02:24 -07003577 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
3578 onpass="Intent based Reactive forwarding Pingall test PASS",
3579 onfail="Intent based Reactive forwarding Pingall test FAIL" )