blob: fbe51cdab1f03fd9c5cedfb3a2d47593122dae64 [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):
996 intentsJson = main.ONOScli1.intents()
997 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
998 intentsJson = intentsJson)
999 main.log.info("Waiting for onos to get intents...")
1000 time.sleep( main.checkIntentsDelay )
1001
1002 intentState = main.TRUE
1003 failedIntents = 0
1004 for intent in getIntentStateResult:
1005 state = intent.items()[0][1]
1006 if state != 'INSTALLED':
1007 main.log.info("Intent State: " + state)
1008 failedIntents += 1
1009 intentState = main.FALSE
1010 if intentState:
1011 break
1012 main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
1013
1014 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1015 onpass="INTENTS INSTALLED",
1016 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001017
1018 main.step( "Verify Ping across all hosts" )
1019 pingResult = main.FALSE
1020 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001021 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1022 if not pingResult:
1023 main.log.warn("First pingall failed. Retrying...")
1024 time1 = time.time()
1025 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001026 time2 = time.time()
1027 timeDiff = round( ( time2 - time1 ), 2 )
1028 main.log.report(
1029 "Time taken for Ping All: " +
1030 str( timeDiff ) +
1031 " seconds" )
1032 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1033 onpass="PING ALL PASS",
1034 onfail="PING ALL FAIL" )
1035
GlennRCa8d786a2015-09-23 17:40:11 -07001036 case60Result = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001037 utilities.assert_equals(
1038 expect=main.TRUE,
1039 actual=case60Result,
1040 onpass="Install 300 Host Intents and Ping All test PASS",
1041 onfail="Install 300 Host Intents and Ping All test FAIL" )
1042
1043 def CASE61( self ):
1044 """
1045 Install 600 host intents and verify ping all for Chordal Topology
1046 """
1047 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1048 main.log.report( "_______________________________________" )
1049 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001050
Hari Krishnac195f3b2015-07-08 20:02:24 -07001051 main.case( "Install 600 host intents" )
1052 main.step( "Add host Intents" )
1053 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001054 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1055
Hari Krishnac195f3b2015-07-08 20:02:24 -07001056 intentIdList = []
1057 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001058
Hari Krishnac195f3b2015-07-08 20:02:24 -07001059 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1060 pool = []
1061 for cli in main.CLIs:
1062 if i >= len( hostCombos ):
1063 break
1064 t = main.Thread( target=cli.addHostIntent,
1065 threadID=main.threadID,
1066 name="addHostIntent",
1067 args=[hostCombos[i][0],hostCombos[i][1]])
1068 pool.append(t)
1069 t.start()
1070 i = i + 1
1071 main.threadID = main.threadID + 1
1072 for thread in pool:
1073 thread.join()
1074 intentIdList.append(thread.result)
1075 time2 = time.time()
1076 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001077
1078 main.step("Verify intents are installed")
1079
1080 # Giving onos 3 chances to install intents
1081 for i in range(3):
1082 intentsJson = main.ONOScli1.intents()
1083 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1084 intentsJson = intentsJson)
1085 main.log.info("Waiting for onos to get intents...")
1086 time.sleep( main.checkIntentsDelay )
1087
1088 intentState = main.TRUE
1089 failedIntents = 0
1090 for intent in getIntentStateResult:
1091 state = intent.items()[0][1]
1092 if state != 'INSTALLED':
1093 main.log.info("Intent State: " + state)
1094 failedIntents += 1
1095 intentState = main.FALSE
1096 if intentState:
1097 break
1098 main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
1099
1100
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
1167 # Giving onos 5 chances to install intents
1168 for i in range(5):
1169 intentsJson = main.ONOScli1.intents()
1170 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1171 intentsJson = intentsJson)
1172 main.log.info("Waiting for onos to get intents...")
1173 time.sleep( main.checkIntentsDelay )
1174
1175 intentState = main.TRUE
1176 failedIntents = 0
1177 for intent in getIntentStateResult:
1178 state = intent.items()[0][1]
1179 if state != 'INSTALLED':
1180 main.log.info("Intent State: " + state)
1181 failedIntents += 1
1182 intentState = main.FALSE
1183 if intentState:
1184 break
1185 main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
1186
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))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002617 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07002618 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002619 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2620 intentsJson = intentsJson)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002621 # Takes awhile for all the onos to get the intents
2622 time.sleep(60)
GlennRCa8d786a2015-09-23 17:40:11 -07002623
2624 main.step("Verify intents are installed")
2625 for i in range(3):
2626 intentState = main.TRUE
2627 failedIntents = 0
2628 for intent in getIntentStateResult:
2629 state = intent.items()[0][1]
2630 if state != 'INSTALLED':
2631 main.log.info("Intent State: " + state)
2632 failedIntents += 1
2633 intentState = main.FALSE
2634 if intentState:
2635 break
2636 main.log.error("Total: " + str(failedIntents))
2637 time.sleep(5)
2638
2639 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2640 onpass="INTENTS INSTALLED",
2641 onfail="SOME INTENTS NOT INSTALLED" )
2642
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
2658 case90Result = ( intentResult 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) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002700 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07002701 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002702 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2703 intentsJson = intentsJson)
Hari Krishnac195f3b2015-07-08 20:02:24 -07002704 # Takes awhile for all the onos to get the intents
2705 time.sleep(30)
GlennRCa8d786a2015-09-23 17:40:11 -07002706
2707 main.step("Verify intents are installed")
2708 for i in range(3):
2709 intentState = main.TRUE
2710 failedIntents = 0
2711 for intent in getIntentStateResult:
2712 state = intent.items()[0][1]
2713 if state != 'INSTALLED':
2714 main.log.info("Intent State: " + state)
2715 failedIntents += 1
2716 intentState = main.FALSE
2717 if intentState:
2718 break
2719 main.log.error("Total: " + str(failedIntents))
2720 time.sleep(5)
2721
2722 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2723 onpass="INTENTS INSTALLED",
2724 onfail="SOME INTENTS NOT INSTALLED" )
2725
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
2741 case91Result = ( intentResult 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))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002786 intentResult = main.TRUE
Hari Krishna6185fc12015-07-13 15:42:31 -07002787 intentsJson = main.ONOScli1.intents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002788 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2789 intentsJson = intentsJson)
2790 #print getIntentStateResult
2791 # Takes awhile for all the onos to get the intents
2792 time.sleep(60)
GlennRCa8d786a2015-09-23 17:40:11 -07002793
2794 main.step("Verify intents are installed")
2795 for i in range(3):
2796 intentState = main.TRUE
2797 failedIntents = 0
2798 for intent in getIntentStateResult:
2799 state = intent.items()[0][1]
2800 if state != 'INSTALLED':
2801 main.log.info("Intent State: " + state)
2802 failedIntents += 1
2803 intentState = main.FALSE
2804 if intentState:
2805 break
2806 main.log.error("Total: " + str(failedIntents))
2807 time.sleep(5)
2808
2809 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2810 onpass="INTENTS INSTALLED",
2811 onfail="SOME INTENTS NOT INSTALLED" )
2812
2813
Hari Krishnac195f3b2015-07-08 20:02:24 -07002814 main.step( "Verify Ping across all hosts" )
2815 pingResult = main.FALSE
2816 time1 = time.time()
2817 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2818 time2 = time.time()
2819 timeDiff = round( ( time2 - time1 ), 2 )
2820 main.log.report(
2821 "Time taken for Ping All: " +
2822 str( timeDiff ) +
2823 " seconds" )
2824 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2825 onpass="PING ALL PASS",
2826 onfail="PING ALL FAIL" )
2827
2828 case92Result = ( intentResult and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07002829
Hari Krishnac195f3b2015-07-08 20:02:24 -07002830 utilities.assert_equals(
2831 expect=main.TRUE,
2832 actual=case92Result,
2833 onpass="Install 4556 point Intents and Ping All test PASS",
2834 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002835
Hari Krishnac195f3b2015-07-08 20:02:24 -07002836 def CASE93( self ):
2837 """
2838 Install multi-single point intents and verify Ping all works
2839 for att topology
2840 """
2841 import copy
2842 import time
2843 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 = []
2849 print "MACsDict", main.MACsDict
2850 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)
2864 #time.sleep(1)
2865 t.start()
2866 i = i + 1
2867 main.threadID = main.threadID + 1
2868 for thread in pool:
2869 thread.join()
2870 intentIdList.append(thread.result)
2871 time2 = time.time()
2872 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2873 time.sleep(30)
2874 print "getting all intents ID"
2875 intentIdTemp = main.ONOScli1.getAllIntentsId()
2876 print intentIdTemp
2877 print len(intentIdList)
2878 print intentIdList
2879 checkIntentStateResult = main.TRUE
2880 print "Checking intents state"
2881 checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2882 checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2883 checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2884 checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
2885 checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
Jon Hall4ba53f02015-07-29 13:07:41 -07002886
Hari Krishnac195f3b2015-07-08 20:02:24 -07002887 if checkIntentStateResult:
2888 main.log.info( "All intents are installed correctly " )
2889
2890 print "Checking flows state "
2891 checkFlowsState = main.ONOScli1.checkFlowsState()
2892 time.sleep(50)
2893 main.step( "Verify Ping across all hosts" )
2894 pingResult = main.FALSE
2895 time1 = time.time()
2896 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2897 time2 = time.time()
2898 timeDiff = round( ( time2 - time1 ), 2 )
2899 main.log.report(
2900 "Time taken for Ping All: " +
2901 str( timeDiff ) +
2902 " seconds" )
2903 checkFlowsState = main.ONOScli1.checkFlowsState()
2904 case93Result = pingResult
2905 utilities.assert_equals(
2906 expect=main.TRUE,
2907 actual=case93Result,
2908 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2909 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002910
Hari Krishnac195f3b2015-07-08 20:02:24 -07002911 def CASE94( self ):
2912 """
2913 Install multi-single point intents and verify Ping all works
2914 for Chordal topology
2915 """
2916 import copy
2917 import time
2918 main.log.report( "Install multi-single point intents and verify Ping all" )
2919 main.log.report( "___________________________________________" )
2920 main.case( "Install multi-single point intents and Ping all" )
2921 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2922 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
2923 intentIdList = []
2924 print "MACsDict", main.MACsDict
2925 time1 = time.time()
2926 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2927 pool = []
2928 for cli in main.CLIs:
2929 egressDevice = deviceDPIDsCopy[i]
2930 ingressDeviceList = copy.copy(deviceDPIDsCopy)
2931 ingressDeviceList.remove(egressDevice)
2932 if i >= len( deviceDPIDsCopy ):
2933 break
2934 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
2935 threadID=main.threadID,
2936 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002937 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002938 pool.append(t)
2939 #time.sleep(1)
2940 t.start()
2941 i = i + 1
2942 main.threadID = main.threadID + 1
2943 for thread in pool:
2944 thread.join()
2945 intentIdList.append(thread.result)
2946 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07002947 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002948 time.sleep(5)
2949 main.step( "Verify Ping across all hosts" )
2950 pingResult = main.FALSE
2951 time1 = time.time()
2952 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
2953 time2 = time.time()
2954 timeDiff = round( ( time2 - time1 ), 2 )
2955 main.log.report(
2956 "Time taken for Ping All: " +
2957 str( timeDiff ) +
2958 " seconds" )
2959
2960 case94Result = pingResult
2961 utilities.assert_equals(
2962 expect=main.TRUE,
2963 actual=case94Result,
2964 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2965 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002966
Hari Krishnac195f3b2015-07-08 20:02:24 -07002967 #def CASE95 multi-single point intent for Spine
2968
2969 def CASE96( self ):
2970 """
2971 Install single-multi point intents and verify Ping all works
2972 for att topology
2973 """
2974 import copy
2975 main.log.report( "Install single-multi point intents and verify Ping all" )
2976 main.log.report( "___________________________________________" )
2977 main.case( "Install single-multi point intents and Ping all" )
2978 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2979 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
2980 intentIdList = []
2981 print "MACsDict", main.MACsDict
2982 time1 = time.time()
2983 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2984 pool = []
2985 for cli in main.CLIs:
2986 ingressDevice = deviceDPIDsCopy[i]
2987 egressDeviceList = copy.copy(deviceDPIDsCopy)
2988 egressDeviceList.remove(ingressDevice)
2989 if i >= len( deviceDPIDsCopy ):
2990 break
2991 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2992 threadID=main.threadID,
2993 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07002994 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07002995 pool.append(t)
2996 #time.sleep(1)
2997 t.start()
2998 i = i + 1
2999 main.threadID = main.threadID + 1
3000 for thread in pool:
3001 thread.join()
3002 intentIdList.append(thread.result)
3003 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003004 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07003005 time.sleep(5)
3006 main.step( "Verify Ping across all hosts" )
3007 pingResult = main.FALSE
3008 time1 = time.time()
3009 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3010 time2 = time.time()
3011 timeDiff = round( ( time2 - time1 ), 2 )
3012 main.log.report(
3013 "Time taken for Ping All: " +
3014 str( timeDiff ) +
3015 " seconds" )
3016
3017 case96Result = pingResult
3018 utilities.assert_equals(
3019 expect=main.TRUE,
3020 actual=case96Result,
3021 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3022 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3023
3024 def CASE97( self ):
3025 """
3026 Install single-multi point intents and verify Ping all works
3027 for Chordal topology
3028 """
3029 import copy
3030 main.log.report( "Install single-multi point intents and verify Ping all" )
3031 main.log.report( "___________________________________________" )
3032 main.case( "Install single-multi point intents and Ping all" )
3033 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3034 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3035 intentIdList = []
3036 print "MACsDict", main.MACsDict
3037 time1 = time.time()
3038 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3039 pool = []
3040 for cli in main.CLIs:
3041 ingressDevice = deviceDPIDsCopy[i]
3042 egressDeviceList = copy.copy(deviceDPIDsCopy)
3043 egressDeviceList.remove(ingressDevice)
3044 if i >= len( deviceDPIDsCopy ):
3045 break
3046 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3047 threadID=main.threadID,
3048 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003049 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003050 pool.append(t)
3051 #time.sleep(1)
3052 t.start()
3053 i = i + 1
3054 main.threadID = main.threadID + 1
3055 for thread in pool:
3056 thread.join()
3057 intentIdList.append(thread.result)
3058 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003059 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07003060 time.sleep(5)
3061 main.step( "Verify Ping across all hosts" )
3062 pingResult = main.FALSE
3063 time1 = time.time()
3064 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3065 time2 = time.time()
3066 timeDiff = round( ( time2 - time1 ), 2 )
3067 main.log.report(
3068 "Time taken for Ping All: " +
3069 str( timeDiff ) +
3070 " seconds" )
3071
3072 case97Result = pingResult
3073 utilities.assert_equals(
3074 expect=main.TRUE,
3075 actual=case97Result,
3076 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3077 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3078
3079 def CASE98( self ):
3080 """
3081 Install single-multi point intents and verify Ping all works
3082 for Spine topology
3083 """
3084 import copy
3085 main.log.report( "Install single-multi point intents and verify Ping all" )
3086 main.log.report( "___________________________________________" )
3087 main.case( "Install single-multi point intents and Ping all" )
3088 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3089 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3090 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3091 intentIdList = []
3092 MACsDictCopy = {}
3093 for i in range( len( deviceDPIDsCopy ) ):
3094 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3095
3096 print "deviceDPIDsCopy", deviceDPIDsCopy
3097 print ""
3098 print "MACsDictCopy", MACsDictCopy
3099 time1 = time.time()
3100 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3101 pool = []
3102 for cli in main.CLIs:
3103 if i >= len( deviceDPIDsCopy ):
3104 break
3105 ingressDevice = deviceDPIDsCopy[i]
3106 egressDeviceList = copy.copy(deviceDPIDsCopy)
3107 egressDeviceList.remove(ingressDevice)
3108 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3109 threadID=main.threadID,
3110 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003111 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003112 pool.append(t)
3113 #time.sleep(1)
3114 t.start()
3115 i = i + 1
3116 main.threadID = main.threadID + 1
3117 for thread in pool:
3118 thread.join()
3119 intentIdList.append(thread.result)
3120 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003121 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -07003122 time.sleep(5)
3123 main.step( "Verify Ping across all hosts" )
3124 pingResult = main.FALSE
3125 time1 = time.time()
3126 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3127 time2 = time.time()
3128 timeDiff = round( ( time2 - time1 ), 2 )
3129 main.log.report(
3130 "Time taken for Ping All: " +
3131 str( timeDiff ) +
3132 " seconds" )
3133
3134 case98Result = pingResult
3135 utilities.assert_equals(
3136 expect=main.TRUE,
3137 actual=case98Result,
3138 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3139 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3140
Hari Krishna4223dbd2015-08-13 16:29:53 -07003141 def CASE190( self ):
3142 """
3143 Verify IPv6 ping across 600 Point intents (Att Topology)
3144 """
3145 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3146 main.log.report( "_________________________________________________" )
3147 import itertools
3148 import time
3149 main.case( "IPv6 ping all 600 Point intents" )
3150 main.step( "Verify IPv6 Ping across all hosts" )
3151 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3152 pingResult = main.FALSE
3153 time1 = time.time()
3154 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003155 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003156 main.log.warn("First pingall failed. Retrying...")
3157 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003158 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3159
Hari Krishna4223dbd2015-08-13 16:29:53 -07003160 time2 = time.time()
3161 timeDiff = round( ( time2 - time1 ), 2 )
3162 main.log.report(
3163 "Time taken for IPv6 Ping All: " +
3164 str( timeDiff ) +
3165 " seconds" )
3166 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3167 onpass="PING ALL PASS",
3168 onfail="PING ALL FAIL" )
3169
3170 case160Result = pingResult
3171 utilities.assert_equals(
3172 expect=main.TRUE,
3173 actual=case160Result,
3174 onpass="IPv6 Ping across 600 Point intents test PASS",
3175 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3176
3177 def CASE191( self ):
3178 """
3179 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3180 """
3181 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3182 main.log.report( "_________________________________________________" )
3183 import itertools
3184 import time
3185 main.case( "IPv6 ping all 600 Point intents" )
3186 main.step( "Verify IPv6 Ping across all hosts" )
3187 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3188 pingResult = main.FALSE
3189 time1 = time.time()
3190 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003191 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003192 main.log.warn("First pingall failed. Retrying...")
3193 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003194 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003195
Hari Krishna4223dbd2015-08-13 16:29:53 -07003196 time2 = time.time()
3197 timeDiff = round( ( time2 - time1 ), 2 )
3198 main.log.report(
3199 "Time taken for IPv6 Ping All: " +
3200 str( timeDiff ) +
3201 " seconds" )
3202 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3203 onpass="PING ALL PASS",
3204 onfail="PING ALL FAIL" )
3205
3206 case191Result = pingResult
3207 utilities.assert_equals(
3208 expect=main.TRUE,
3209 actual=case191Result,
3210 onpass="IPv6 Ping across 600 Point intents test PASS",
3211 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3212
3213 def CASE192( self ):
3214 """
3215 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3216 """
3217 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3218 main.log.report( "_________________________________________________" )
3219 import itertools
3220 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003221 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003222 main.step( "Verify IPv6 Ping across all hosts" )
3223 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3224 pingResult = main.FALSE
3225 time1 = time.time()
3226 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003227 if not pingResult:
3228 main.log.warn("First pingall failed. Retrying...")
3229 time1 = time.time()
3230 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3231
Hari Krishna4223dbd2015-08-13 16:29:53 -07003232 time2 = time.time()
3233 timeDiff = round( ( time2 - time1 ), 2 )
3234 main.log.report(
3235 "Time taken for IPv6 Ping All: " +
3236 str( timeDiff ) +
3237 " seconds" )
3238 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3239 onpass="PING ALL PASS",
3240 onfail="PING ALL FAIL" )
3241
3242 case192Result = pingResult
3243 utilities.assert_equals(
3244 expect=main.TRUE,
3245 actual=case192Result,
Hari Krishna310efca2015-09-03 09:43:16 -07003246 onpass="IPv6 Ping across 4556 Point intents test PASS",
3247 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003248
Hari Krishnac195f3b2015-07-08 20:02:24 -07003249 def CASE10( self ):
3250 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003251 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003252 """
3253 Remove all Intents
3254 """
3255 main.log.report( "Remove all intents that were installed previously" )
3256 main.log.report( "______________________________________________" )
3257 main.log.info( "Remove all intents" )
3258 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003259 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003260 main.step( "Obtain the intent id's first" )
3261 intentsList = main.ONOScli1.getAllIntentIds()
3262 ansi_escape = re.compile( r'\x1b[^m]*m' )
3263 intentsList = ansi_escape.sub( '', intentsList )
3264 intentsList = intentsList.replace(
3265 " onos:intents | grep id=",
3266 "" ).replace(
3267 "id=",
3268 "" ).replace(
3269 "\r\r",
3270 "" )
3271 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003272 intentIdList = []
3273 step1Result = main.TRUE
3274 moreIntents = main.TRUE
3275 removeIntentCount = 0
3276 intentsCount = len(intentsList)
3277 main.log.info ( "Current number of intents: " + str(intentsCount) )
3278 if ( len( intentsList ) > 1 ):
3279 results = main.TRUE
3280 main.log.info("Removing intent...")
3281 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003282 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003283 if removeIntentCount == 5:
3284 break
3285 removeIntentCount = removeIntentCount + 1
3286 intentsList1 = main.ONOScli1.getAllIntentIds()
3287 if len( intentsList1 ) == 0:
3288 break
3289 ansi_escape = re.compile( r'\x1b[^m]*m' )
3290 intentsList1 = ansi_escape.sub( '', intentsList1 )
3291 intentsList1 = intentsList1.replace(
3292 " onos:intents | grep id=",
3293 "" ).replace(
3294 " state=",
3295 "" ).replace(
3296 "\r\r",
3297 "" )
3298 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003299 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3300 print intentsList1
3301 intentIdList1 = []
3302 if ( len( intentsList1 ) > 0 ):
3303 moreIntents = main.TRUE
3304 for i in range( len( intentsList1 ) ):
3305 intentsTemp1 = intentsList1[ i ].split( ',' )
3306 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3307 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3308 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3309 time1 = time.time()
3310 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3311 pool = []
3312 for cli in main.CLIs:
3313 if i >= len( intentIdList1 ):
3314 break
3315 t = main.Thread( target=cli.removeIntent,
3316 threadID=main.threadID,
3317 name="removeIntent",
3318 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3319 pool.append(t)
3320 t.start()
3321 i = i + 1
3322 main.threadID = main.threadID + 1
3323 for thread in pool:
3324 thread.join()
3325 intentIdList.append(thread.result)
3326 #time.sleep(2)
3327 time2 = time.time()
3328 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003329 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003330 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003331 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003332 else:
3333 time.sleep(10)
3334 if len( main.ONOScli1.intents()):
3335 continue
3336 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003337 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003338 else:
3339 print "Removed %d intents" %(intentsCount)
3340 step1Result = main.TRUE
3341 else:
3342 print "No Intent IDs found in Intents list: ", intentsList
3343 step1Result = main.FALSE
3344
3345 print main.ONOScli1.intents()
3346 caseResult10 = step1Result
3347 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
3348 onpass="Intent removal test successful",
3349 onfail="Intent removal test failed" )
3350
3351 def CASE12( self, main ):
3352 """
3353 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3354 """
3355 import re
3356 import copy
3357 import time
3358
Hari Krishnac195f3b2015-07-08 20:02:24 -07003359 threadID = 0
3360
3361 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3362 main.log.report( "_____________________________________________________" )
3363 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3364 main.step( "Enable intent based Reactive forwarding" )
3365 installResult = main.FALSE
3366 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003367
Hari Krishnac195f3b2015-07-08 20:02:24 -07003368 pool = []
3369 time1 = time.time()
3370 for cli,feature in main.CLIs:
3371 t = main.Thread(target=cli,threadID=threadID,
3372 name="featureInstall",args=[feature])
3373 pool.append(t)
3374 t.start()
3375 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003376
Hari Krishnac195f3b2015-07-08 20:02:24 -07003377 results = []
3378 for thread in pool:
3379 thread.join()
3380 results.append(thread.result)
3381 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003382
Hari Krishnac195f3b2015-07-08 20:02:24 -07003383 if( all(result == main.TRUE for result in results) == False):
3384 main.log.info("Did not install onos-app-ifwd feature properly")
3385 #main.cleanup()
3386 #main.exit()
3387 else:
3388 main.log.info("Successful feature:install onos-app-ifwd")
3389 installResult = main.TRUE
3390 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003391
Hari Krishnac195f3b2015-07-08 20:02:24 -07003392 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07003393 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07003394 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003395 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003396 time2 = time.time()
3397 timeDiff = round( ( time2 - time1 ), 2 )
3398 main.log.report(
3399 "Time taken for Ping All: " +
3400 str( timeDiff ) +
3401 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003402
GlennRC626ba132015-09-18 16:16:31 -07003403 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003404 main.log.report( "Pingall Test in Reactive mode successful" )
3405 else:
3406 main.log.report( "Pingall Test in Reactive mode failed" )
3407
3408 main.step( "Disable Intent based Reactive forwarding" )
3409 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003410
Hari Krishnac195f3b2015-07-08 20:02:24 -07003411 pool = []
3412 time1 = time.time()
3413 for cli,feature in main.CLIs:
3414 t = main.Thread(target=cli,threadID=threadID,
3415 name="featureUninstall",args=[feature])
3416 pool.append(t)
3417 t.start()
3418 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003419
Hari Krishnac195f3b2015-07-08 20:02:24 -07003420 results = []
3421 for thread in pool:
3422 thread.join()
3423 results.append(thread.result)
3424 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003425
Hari Krishnac195f3b2015-07-08 20:02:24 -07003426 if( all(result == main.TRUE for result in results) == False):
3427 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3428 uninstallResult = main.FALSE
3429 #main.cleanup()
3430 #main.exit()
3431 else:
3432 main.log.info("Successful feature:uninstall onos-app-ifwd")
3433 uninstallResult = main.TRUE
3434 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
3435
3436 # Waiting for reative flows to be cleared.
3437 time.sleep( 10 )
3438
GlennRC626ba132015-09-18 16:16:31 -07003439 case11Result = installResult and pingResult and uninstallResult
Hari Krishnac195f3b2015-07-08 20:02:24 -07003440 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
3441 onpass="Intent based Reactive forwarding Pingall test PASS",
3442 onfail="Intent based Reactive forwarding Pingall test FAIL" )