blob: be409b8d173afb3dd5b0aed775448cfb7f117cd3 [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'] )
GlennRCbddd58f2015-10-01 15:45:25 -070036 main.failSwitch = bool( main.params['TEST']['fail_switch'] )
37 main.emailOnStop = bool( main.params['TEST']['email'] )
GlennRC1dde1712015-10-02 11:03:08 -070038 main.intentCheck = int( main.params['TEST']['intent_check'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070039 main.newTopo = ""
40 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070041
42 for i in range( 1, int(main.numCtrls) + 1 ):
43 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070044
45 main.case( "Set up test environment" )
46 main.log.report( "Set up test environment" )
47 main.log.report( "_______________________" )
48
Hari Krishna6185fc12015-07-13 15:42:31 -070049 main.step( "Apply Cell environment for ONOS" )
50 if ( main.onoscell ):
51 cellName = main.onoscell
52 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070053 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
54 onpass="Test step PASS",
55 onfail="Test step FAIL" )
56 else:
57 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
58 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
59 main.clean()
60 main.exit()
61
Hari Krishnac195f3b2015-07-08 20:02:24 -070062 main.step( "Git checkout and pull " + git_branch )
63 if git_pull == 'on':
64 checkout_result = main.ONOSbench.gitCheckout( git_branch )
65 pull_result = main.ONOSbench.gitPull()
66 cp_result = ( checkout_result and pull_result )
67 else:
68 checkout_result = main.TRUE
69 pull_result = main.TRUE
70 main.log.info( "Skipped git checkout and pull" )
71 cp_result = ( checkout_result and pull_result )
72 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
73 onpass="Test step PASS",
74 onfail="Test step FAIL" )
75
76 main.step( "mvn clean & install" )
77 if git_pull == 'on':
78 mvn_result = main.ONOSbench.cleanInstall()
79 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
80 onpass="Test step PASS",
81 onfail="Test step FAIL" )
82 else:
83 mvn_result = main.TRUE
84 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
85
86 main.ONOSbench.getVersion( report=True )
87
Hari Krishnac195f3b2015-07-08 20:02:24 -070088 main.step( "Create ONOS package" )
89 packageResult = main.ONOSbench.onosPackage()
90 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
91 onpass="Test step PASS",
92 onfail="Test step FAIL" )
93
94 main.step( "Uninstall ONOS package on all Nodes" )
95 uninstallResult = main.TRUE
96 for i in range( int( main.numCtrls ) ):
97 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
98 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
99 utilities.assert_equals( expect=main.TRUE, actual=u_result,
100 onpass="Test step PASS",
101 onfail="Test step FAIL" )
102 uninstallResult = ( uninstallResult and u_result )
103
104 main.step( "Install ONOS package on all Nodes" )
105 installResult = main.TRUE
106 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700107 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700108 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
109 utilities.assert_equals( expect=main.TRUE, actual=i_result,
110 onpass="Test step PASS",
111 onfail="Test step FAIL" )
112 installResult = ( installResult and i_result )
113
114 main.step( "Verify ONOS nodes UP status" )
115 statusResult = main.TRUE
116 for i in range( int( main.numCtrls ) ):
117 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
118 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
119 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
120 onpass="Test step PASS",
121 onfail="Test step FAIL" )
122 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700123
Hari Krishnac195f3b2015-07-08 20:02:24 -0700124 main.step( "Start ONOS CLI on all nodes" )
125 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700126 main.log.step(" Start ONOS cli using thread ")
127 startCliResult = main.TRUE
128 pool = []
129 time1 = time.time()
130 for i in range( int( main.numCtrls) ):
131 t = main.Thread( target=main.CLIs[i].startOnosCli,
132 threadID=main.threadID,
133 name="startOnosCli",
134 args=[ main.onosIPs[i], karafTimeout ] )
135 pool.append(t)
136 t.start()
137 main.threadID = main.threadID + 1
138 for t in pool:
139 t.join()
140 startCliResult = startCliResult and t.result
141 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700142
Hari Krishnac195f3b2015-07-08 20:02:24 -0700143 if not startCliResult:
144 main.log.info("ONOS CLI did not start up properly")
145 main.cleanup()
146 main.exit()
147 else:
148 main.log.info("Successful CLI startup")
149 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700150
151 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
152 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
153 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
154 cfgResult = cfgResult1 and cfgResult2
155 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
156 onpass="ipv6NeighborDiscovery cfg is set to true",
157 onfail="Failed to cfg set ipv6NeighborDiscovery" )
158
159 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700160 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
161 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
162 onpass="Set up test environment PASS",
163 onfail="Set up test environment FAIL" )
164
165 def CASE20( self, main ):
166 """
167 This test script Loads a new Topology (Att) on CHO setup and balances all switches
168 """
169 import re
170 import time
171 import copy
172
173 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
174 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
175 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
176 main.pingTimeout = 300
177 main.log.report(
178 "Load Att topology and Balance all Mininet switches across controllers" )
179 main.log.report(
180 "________________________________________________________________________" )
181 main.case(
182 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700183
Hari Krishnac195f3b2015-07-08 20:02:24 -0700184 main.step( "Stop any previous Mininet network topology" )
185 cliResult = main.TRUE
186 if main.newTopo == main.params['TOPO3']['topo']:
187 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
188
189 main.step( "Start Mininet with Att topology" )
190 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700191 mininetDir = main.Mininet1.home + "/custom/"
192 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
193 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
194 topoPath = mininetDir + main.newTopo
195 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700196
Hari Krishnac195f3b2015-07-08 20:02:24 -0700197 main.step( "Assign switches to controllers" )
198 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
199 main.Mininet1.assignSwController(
200 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700201 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700202
203 switch_mastership = main.TRUE
204 for i in range( 1, ( main.numMNswitches + 1 ) ):
205 response = main.Mininet1.getSwController( "s" + str( i ) )
206 print( "Response is " + str( response ) )
207 if re.search( "tcp:" + main.onosIPs[0], response ):
208 switch_mastership = switch_mastership and main.TRUE
209 else:
210 switch_mastership = main.FALSE
211
212 if switch_mastership == main.TRUE:
213 main.log.report( "Controller assignment successfull" )
214 else:
215 main.log.report( "Controller assignment failed" )
216
217 time.sleep(30) # waiting here to make sure topology converges across all nodes
218
219 main.step( "Balance devices across controllers" )
220 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700221 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700222 time.sleep( 5 )
223
224 topology_output = main.ONOScli1.topology()
225 topology_result = main.ONOSbench.getTopology( topology_output )
226 case2Result = ( switch_mastership and startStatus )
227 utilities.assert_equals(
228 expect=main.TRUE,
229 actual=case2Result,
230 onpass="Starting new Att topology test PASS",
231 onfail="Starting new Att topology test FAIL" )
232
233 def CASE21( self, main ):
234 """
235 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
236 """
237 import re
238 import time
239 import copy
240
241 main.newTopo = main.params['TOPO2']['topo']
242 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
243 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
244 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
245 main.pingTimeout = 300
246 main.log.report(
247 "Load Chordal topology and Balance all Mininet switches across controllers" )
248 main.log.report(
249 "________________________________________________________________________" )
250 main.case(
251 "Assign and Balance all Mininet switches across controllers" )
252
253 main.step( "Stop any previous Mininet network topology" )
254 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
255
GlennRCc6cd2a62015-08-10 16:08:22 -0700256 main.step("Start Mininet with Chordal topology")
257 mininetDir = main.Mininet1.home + "/custom/"
258 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
259 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
260 topoPath = mininetDir + main.newTopo
261 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700262
263 main.step( "Assign switches to controllers" )
264
265 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
266 main.Mininet1.assignSwController(
267 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700268 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700269
270 switch_mastership = main.TRUE
271 for i in range( 1, ( main.numMNswitches + 1 ) ):
272 response = main.Mininet1.getSwController( "s" + str( i ) )
273 print( "Response is " + str( response ) )
274 if re.search( "tcp:" + main.onosIPs[0], response ):
275 switch_mastership = switch_mastership and main.TRUE
276 else:
277 switch_mastership = main.FALSE
278
279 if switch_mastership == main.TRUE:
280 main.log.report( "Controller assignment successfull" )
281 else:
282 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700283
Hari Krishnac195f3b2015-07-08 20:02:24 -0700284 main.step( "Balance devices across controllers" )
285 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700286 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700287 time.sleep( 5 )
288
GlennRCbddd58f2015-10-01 15:45:25 -0700289 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290 time.sleep(30)
291 utilities.assert_equals(
292 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700293 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 onpass="Starting new Chordal topology test PASS",
295 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700296
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297 def CASE22( self, main ):
298 """
299 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
300 """
301 import re
302 import time
303 import copy
304
305 main.newTopo = main.params['TOPO3']['topo']
306 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
307 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
308 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
309 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700310
Hari Krishnac195f3b2015-07-08 20:02:24 -0700311 main.log.report(
312 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
313 main.log.report(
314 "________________________________________________________________________" )
315 main.case(
316 "Assign and Balance all Mininet switches across controllers" )
317 main.step( "Stop any previous Mininet network topology" )
318 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700319
320 main.step("Start Mininet with Spine topology")
321 mininetDir = main.Mininet1.home + "/custom/"
322 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
323 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
324 topoPath = mininetDir + main.newTopo
325 startStatus = main.Mininet1.startNet(topoFile = topoPath)
326
Hari Krishnac195f3b2015-07-08 20:02:24 -0700327 time.sleep(60)
328 main.step( "Assign switches to controllers" )
329
330 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
331 main.Mininet1.assignSwController(
332 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700333 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700334
335 switch_mastership = main.TRUE
336 for i in range( 1, ( main.numMNswitches + 1 ) ):
337 response = main.Mininet1.getSwController( "s" + str( i ) )
338 print( "Response is " + str( response ) )
339 if re.search( "tcp:" + main.onosIPs[0], response ):
340 switch_mastership = switch_mastership and main.TRUE
341 else:
342 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700343
Hari Krishnac195f3b2015-07-08 20:02:24 -0700344 if switch_mastership == main.TRUE:
345 main.log.report( "Controller assignment successfull" )
346 else:
347 main.log.report( "Controller assignment failed" )
348 time.sleep( 5 )
349
350 main.step( "Balance devices across controllers" )
351 for i in range( int( main.numCtrls ) ):
352 balanceResult = main.ONOScli1.balanceMasters()
353 # giving some breathing time for ONOS to complete re-balance
354 time.sleep( 3 )
355
GlennRCbddd58f2015-10-01 15:45:25 -0700356 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700357 time.sleep(60)
358 utilities.assert_equals(
359 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700360 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700361 onpass="Starting new Spine topology test PASS",
362 onfail="Starting new Spine topology test FAIL" )
363
364 def CASE3( self, main ):
365 """
366 This Test case will be extended to collect and store more data related
367 ONOS state.
368 """
369 import re
370 import copy
371 main.deviceDPIDs = []
372 main.hostMACs = []
373 main.deviceLinks = []
374 main.deviceActiveLinksCount = []
375 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700376
Hari Krishnac195f3b2015-07-08 20:02:24 -0700377 main.log.report(
378 "Collect and Store topology details from ONOS before running any Tests" )
379 main.log.report(
380 "____________________________________________________________________" )
381 main.case( "Collect and Store Topology Details from ONOS" )
382 main.step( "Collect and store current number of switches and links" )
383 topology_output = main.ONOScli1.topology()
384 topology_result = main.ONOSbench.getTopology( topology_output )
385 numOnosDevices = topology_result[ 'devices' ]
386 numOnosLinks = topology_result[ 'links' ]
387 topoResult = main.TRUE
388
389 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
390 main.step( "Store Device DPIDs" )
391 for i in range( 1, (main.numMNswitches+1) ):
392 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
393 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
394
395 main.step( "Store Host MACs" )
396 for i in range( 1, ( main.numMNhosts + 1 ) ):
397 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
398 print "Host MACs in Store: \n", str( main.hostMACs )
399 main.MACsDict = {}
400 print "Creating dictionary of DPID and HostMacs"
401 for i in range(len(main.hostMACs)):
402 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
403 print main.MACsDict
404 main.step( "Collect and store all Devices Links" )
405 linksResult = main.ONOScli1.links( jsonFormat=False )
406 ansi_escape = re.compile( r'\x1b[^m]*m' )
407 linksResult = ansi_escape.sub( '', linksResult )
408 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
409 linksResult = linksResult.splitlines()
410 main.deviceLinks = copy.copy( linksResult )
411 print "Device Links Stored: \n", str( main.deviceLinks )
412 # this will be asserted to check with the params provided count of
413 # links
414 print "Length of Links Store", len( main.deviceLinks )
415
416 main.step( "Collect and store each Device ports enabled Count" )
417 time1 = time.time()
418 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
419 pool = []
420 for cli in main.CLIs:
421 if i >= main.numMNswitches + 1:
422 break
423 dpid = "of:00000000000000" + format( i,'02x' )
424 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
425 t.start()
426 pool.append(t)
427 i = i + 1
428 main.threadID = main.threadID + 1
429 for thread in pool:
430 thread.join()
431 portResult = thread.result
432 main.devicePortsEnabledCount.append( portResult )
433 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
434 time2 = time.time()
435 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
436
437 main.step( "Collect and store each Device active links Count" )
438 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700439
Hari Krishnac195f3b2015-07-08 20:02:24 -0700440 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
441 pool = []
442 for cli in main.CLIs:
443 if i >= main.numMNswitches + 1:
444 break
445 dpid = "of:00000000000000" + format( i,'02x' )
446 t = main.Thread( target = cli.getDeviceLinksActiveCount,
447 threadID = main.threadID,
448 name = "getDevicePortsEnabledCount",
449 args = [dpid])
450 t.start()
451 pool.append(t)
452 i = i + 1
453 main.threadID = main.threadID + 1
454 for thread in pool:
455 thread.join()
456 linkCountResult = thread.result
457 main.deviceActiveLinksCount.append( linkCountResult )
458 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
459 time2 = time.time()
460 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
461
462 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700463 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700464 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
465 main.log.info("Devices (actual): %s, Links (actual): %s" %
466 ( numOnosDevices , numOnosLinks ) )
467 main.log.info("Topology does not match, exiting CHO test...")
468 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700469 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700470 main.cleanup()
471 main.exit()
472
473 # just returning TRUE for now as this one just collects data
474 case3Result = topoResult
475 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
476 onpass="Saving ONOS topology data test PASS",
477 onfail="Saving ONOS topology data test FAIL" )
478
479 def CASE40( self, main ):
480 """
481 Verify Reactive forwarding (Att Topology)
482 """
483 import re
484 import copy
485 import time
486 main.log.report( "Verify Reactive forwarding (Att Topology)" )
487 main.log.report( "______________________________________________" )
488 main.case( "Enable Reactive forwarding and Verify ping all" )
489 main.step( "Enable Reactive forwarding" )
490 installResult = main.TRUE
491 # Activate fwd app
492 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
493 appCheck = main.TRUE
494 pool = []
495 for cli in main.CLIs:
496 t = main.Thread( target=cli.appToIDCheck,
497 name="appToIDCheck-" + str( i ),
498 args=[] )
499 pool.append( t )
500 t.start()
501 for t in pool:
502 t.join()
503 appCheck = appCheck and t.result
504 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
505 onpass="App Ids seem to be correct",
506 onfail="Something is wrong with app Ids" )
507 if appCheck != main.TRUE:
508 main.log.warn( main.CLIs[0].apps() )
509 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700510
Hari Krishnac195f3b2015-07-08 20:02:24 -0700511 time.sleep( 10 )
512
513 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700514 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700515 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700516 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
517 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700518 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700519 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700520 time2 = time.time()
521 timeDiff = round( ( time2 - time1 ), 2 )
522 main.log.report(
523 "Time taken for Ping All: " +
524 str( timeDiff ) +
525 " seconds" )
526
GlennRC626ba132015-09-18 16:16:31 -0700527 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700528 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700529 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700530 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700531
GlennRCbddd58f2015-10-01 15:45:25 -0700532 caseResult = appCheck and pingResult
533 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700534 onpass="Reactive Mode IPv4 Pingall test PASS",
535 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700536
537 def CASE41( self, main ):
538 """
539 Verify Reactive forwarding (Chordal Topology)
540 """
541 import re
542 import copy
543 import time
544 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
545 main.log.report( "______________________________________________" )
546 main.case( "Enable Reactive forwarding and Verify ping all" )
547 main.step( "Enable Reactive forwarding" )
548 installResult = main.TRUE
549 # Activate fwd app
550 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
551
552 appCheck = main.TRUE
553 pool = []
554 for cli in main.CLIs:
555 t = main.Thread( target=cli.appToIDCheck,
556 name="appToIDCheck-" + str( i ),
557 args=[] )
558 pool.append( t )
559 t.start()
560 for t in pool:
561 t.join()
562 appCheck = appCheck and t.result
563 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
564 onpass="App Ids seem to be correct",
565 onfail="Something is wrong with app Ids" )
566 if appCheck != main.TRUE:
567 main.log.warn( main.CLIs[0].apps() )
568 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700569
Hari Krishnac195f3b2015-07-08 20:02:24 -0700570 time.sleep( 10 )
571
572 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700573 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700574 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700575 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
576 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700577 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700578 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700579 time2 = time.time()
580 timeDiff = round( ( time2 - time1 ), 2 )
581 main.log.report(
582 "Time taken for Ping All: " +
583 str( timeDiff ) +
584 " seconds" )
585
GlennRC626ba132015-09-18 16:16:31 -0700586 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700587 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700588 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700589 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700590
GlennRCbddd58f2015-10-01 15:45:25 -0700591 caseResult = appCheck and pingResult
592 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700593 onpass="Reactive Mode IPv4 Pingall test PASS",
594 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700595
596 def CASE42( self, main ):
597 """
598 Verify Reactive forwarding (Spine Topology)
599 """
600 import re
601 import copy
602 import time
603 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
604 main.log.report( "______________________________________________" )
605 main.case( "Enable Reactive forwarding and Verify ping all" )
606 main.step( "Enable Reactive forwarding" )
607 installResult = main.TRUE
608 # Activate fwd app
609 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
610
611 appCheck = main.TRUE
612 pool = []
613 for cli in main.CLIs:
614 t = main.Thread( target=cli.appToIDCheck,
615 name="appToIDCheck-" + str( i ),
616 args=[] )
617 pool.append( t )
618 t.start()
619 for t in pool:
620 t.join()
621 appCheck = appCheck and t.result
622 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
623 onpass="App Ids seem to be correct",
624 onfail="Something is wrong with app Ids" )
625 if appCheck != main.TRUE:
626 main.log.warn( main.CLIs[0].apps() )
627 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700628
Hari Krishnac195f3b2015-07-08 20:02:24 -0700629 time.sleep( 10 )
630
631 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700632 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700633 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700634 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
635 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700636 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700637 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700638 time2 = time.time()
639 timeDiff = round( ( time2 - time1 ), 2 )
640 main.log.report(
641 "Time taken for Ping All: " +
642 str( timeDiff ) +
643 " seconds" )
644
GlennRC626ba132015-09-18 16:16:31 -0700645 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700646 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700647 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700648 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
649
GlennRCbddd58f2015-10-01 15:45:25 -0700650 caseResult = appCheck and pingResult
651 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700652 onpass="Reactive Mode IPv4 Pingall test PASS",
653 onfail="Reactive Mode IPv4 Pingall test FAIL" )
654
655 def CASE140( self, main ):
656 """
657 Verify IPv6 Reactive forwarding (Att Topology)
658 """
659 import re
660 import copy
661 import time
662 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
663 main.log.report( "______________________________________________" )
664 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
665 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
666
667 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
668 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
669 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
670 cfgResult = cfgResult1 and cfgResult2
671 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
672 onpass="Reactive mode ipv6Fowarding cfg is set to true",
673 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
674
675 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700676 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700677 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700678 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
679 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700680 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700681 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700682 time2 = time.time()
683 timeDiff = round( ( time2 - time1 ), 2 )
684 main.log.report(
685 "Time taken for IPv6 Ping All: " +
686 str( timeDiff ) +
687 " seconds" )
688
GlennRC626ba132015-09-18 16:16:31 -0700689 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700690 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
691 else:
692 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700693
694 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700695
Hari Krishnac195f3b2015-07-08 20:02:24 -0700696 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700697 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700698 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
699 pool = []
700 for cli in main.CLIs:
701 t = main.Thread( target=cli.appToIDCheck,
702 name="appToIDCheck-" + str( i ),
703 args=[] )
704 pool.append( t )
705 t.start()
706
707 for t in pool:
708 t.join()
709 appCheck = appCheck and t.result
710 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
711 onpass="App Ids seem to be correct",
712 onfail="Something is wrong with app Ids" )
713 if appCheck != main.TRUE:
714 main.log.warn( main.CLIs[0].apps() )
715 main.log.warn( main.CLIs[0].appIDs() )
716
717 # Waiting for reative flows to be cleared.
718 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700719 caseResult = appCheck and cfgResult and pingResult
720 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700721 onpass="Reactive Mode IPv6 Pingall test PASS",
722 onfail="Reactive Mode IPv6 Pingall test FAIL" )
723
724 def CASE141( self, main ):
725 """
726 Verify IPv6 Reactive forwarding (Chordal Topology)
727 """
728 import re
729 import copy
730 import time
731 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
732 main.log.report( "______________________________________________" )
733 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
734 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
735
736 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
737 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
738 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
739 cfgResult = cfgResult1 and cfgResult2
740 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
741 onpass="Reactive mode ipv6Fowarding cfg is set to true",
742 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
743
744 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700745 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700746 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700747 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
748 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700749 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700750 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700751 time2 = time.time()
752 timeDiff = round( ( time2 - time1 ), 2 )
753 main.log.report(
754 "Time taken for IPv6 Ping All: " +
755 str( timeDiff ) +
756 " seconds" )
757
GlennRC626ba132015-09-18 16:16:31 -0700758 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700759 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
760 else:
761 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
762
763 main.step( "Disable Reactive forwarding" )
764
765 main.log.info( "Uninstall reactive forwarding app" )
766 appCheck = main.TRUE
767 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
768 pool = []
769 for cli in main.CLIs:
770 t = main.Thread( target=cli.appToIDCheck,
771 name="appToIDCheck-" + str( i ),
772 args=[] )
773 pool.append( t )
774 t.start()
775
776 for t in pool:
777 t.join()
778 appCheck = appCheck and t.result
779 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
780 onpass="App Ids seem to be correct",
781 onfail="Something is wrong with app Ids" )
782 if appCheck != main.TRUE:
783 main.log.warn( main.CLIs[0].apps() )
784 main.log.warn( main.CLIs[0].appIDs() )
785
786 # Waiting for reative flows to be cleared.
787 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700788 caseResult = appCheck and cfgResult and pingResult
789 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700790 onpass="Reactive Mode IPv6 Pingall test PASS",
791 onfail="Reactive Mode IPv6 Pingall test FAIL" )
792
793 def CASE142( self, main ):
794 """
795 Verify IPv6 Reactive forwarding (Spine Topology)
796 """
797 import re
798 import copy
799 import time
800 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
801 main.log.report( "______________________________________________" )
802 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
803 # Spine topology do not have hosts h1-h10
804 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
805 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
806 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
807 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
808 cfgResult = cfgResult1 and cfgResult2
809 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
810 onpass="Reactive mode ipv6Fowarding cfg is set to true",
811 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
812
813 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700814 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700815 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -0700816 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
817 if not ping_result:
818 main.log.warn("First pingall failed. Trying again...")
819 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700820 time2 = time.time()
821 timeDiff = round( ( time2 - time1 ), 2 )
822 main.log.report(
823 "Time taken for IPv6 Ping All: " +
824 str( timeDiff ) +
825 " seconds" )
826
GlennRC626ba132015-09-18 16:16:31 -0700827 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700828 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
829 else:
830 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
831
832 main.step( "Disable Reactive forwarding" )
833
834 main.log.info( "Uninstall reactive forwarding app" )
835 appCheck = main.TRUE
836 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
837 pool = []
838 for cli in main.CLIs:
839 t = main.Thread( target=cli.appToIDCheck,
840 name="appToIDCheck-" + str( i ),
841 args=[] )
842 pool.append( t )
843 t.start()
844
845 for t in pool:
846 t.join()
847 appCheck = appCheck and t.result
848 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
849 onpass="App Ids seem to be correct",
850 onfail="Something is wrong with app Ids" )
851 if appCheck != main.TRUE:
852 main.log.warn( main.CLIs[0].apps() )
853 main.log.warn( main.CLIs[0].appIDs() )
854
855 # Waiting for reative flows to be cleared.
856 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700857 caseResult = appCheck and cfgResult and pingResult
858 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700859 onpass="Reactive Mode IPv6 Pingall test PASS",
860 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700861
862 def CASE5( self, main ):
863 """
864 Compare current ONOS topology with reference data
865 """
866 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700867
Hari Krishnac195f3b2015-07-08 20:02:24 -0700868 devicesDPIDTemp = []
869 hostMACsTemp = []
870 deviceLinksTemp = []
871 deviceActiveLinksCountTemp = []
872 devicePortsEnabledCountTemp = []
873
874 main.log.report(
875 "Compare ONOS topology with reference data in Stores" )
876 main.log.report( "__________________________________________________" )
877 main.case( "Compare ONOS topology with reference data" )
878
879 main.step( "Compare current Device ports enabled with reference" )
880 time1 = time.time()
881 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
882 pool = []
883 for cli in main.CLIs:
884 if i >= main.numMNswitches + 1:
885 break
886 dpid = "of:00000000000000" + format( i,'02x' )
887 t = main.Thread(target = cli.getDevicePortsEnabledCount,
888 threadID = main.threadID,
889 name = "getDevicePortsEnabledCount",
890 args = [dpid])
891 t.start()
892 pool.append(t)
893 i = i + 1
894 main.threadID = main.threadID + 1
895 for thread in pool:
896 thread.join()
897 portResult = thread.result
898 #portTemp = re.split( r'\t+', portResult )
899 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
900 devicePortsEnabledCountTemp.append( portResult )
901
902 time2 = time.time()
903 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
904 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700905 "Device Enabled ports EXPECTED: %s" %
906 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700907 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700908 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700909 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700910
Hari Krishnac195f3b2015-07-08 20:02:24 -0700911 if ( cmp( main.devicePortsEnabledCount,
912 devicePortsEnabledCountTemp ) == 0 ):
913 stepResult1 = main.TRUE
914 else:
915 stepResult1 = main.FALSE
916
917 main.step( "Compare Device active links with reference" )
918 time1 = time.time()
919 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
920 pool = []
921 for cli in main.CLIs:
922 if i >= main.numMNswitches + 1:
923 break
924 dpid = "of:00000000000000" + format( i,'02x' )
925 t = main.Thread(target = cli.getDeviceLinksActiveCount,
926 threadID = main.threadID,
927 name = "getDeviceLinksActiveCount",
928 args = [dpid])
929 t.start()
930 pool.append(t)
931 i = i + 1
932 main.threadID = main.threadID + 1
933 for thread in pool:
934 thread.join()
935 linkCountResult = thread.result
936 #linkCountTemp = re.split( r'\t+', linkCountResult )
937 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
938 deviceActiveLinksCountTemp.append( linkCountResult )
939
940 time2 = time.time()
941 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
942 main.log.info (
943 "Device Active links EXPECTED: %s" %
944 str( main.deviceActiveLinksCount ) )
945 main.log.info (
946 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
947 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
948 stepResult2 = main.TRUE
949 else:
950 stepResult2 = main.FALSE
951
952 """
953 place holder for comparing devices, hosts, paths and intents if required.
954 Links and ports data would be incorrect with out devices anyways.
955 """
956 case5Result = ( stepResult1 and stepResult2 )
957 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
958 onpass="Compare Topology test PASS",
959 onfail="Compare Topology test FAIL" )
960
961 def CASE60( self ):
962 """
963 Install 300 host intents and verify ping all (Att Topology)
964 """
965 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
966 main.log.report( "_______________________________________" )
967 import itertools
968 import time
969 main.case( "Install 300 host intents" )
970 main.step( "Add host Intents" )
971 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700972 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
973
Hari Krishnac195f3b2015-07-08 20:02:24 -0700974 intentIdList = []
975 time1 = time.time()
976 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
977 pool = []
978 for cli in main.CLIs:
979 if i >= len( hostCombos ):
980 break
981 t = main.Thread( target=cli.addHostIntent,
982 threadID=main.threadID,
983 name="addHostIntent",
984 args=[hostCombos[i][0],hostCombos[i][1]])
985 pool.append(t)
986 t.start()
987 i = i + 1
988 main.threadID = main.threadID + 1
989 for thread in pool:
990 thread.join()
991 intentIdList.append(thread.result)
992 time2 = time.time()
993 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
994
GlennRCfcfdc4f2015-09-30 16:01:57 -0700995 # Saving intent ids to check intents in later cases
996 main.intentIds = list(intentIdList)
997
GlennRCa8d786a2015-09-23 17:40:11 -0700998 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700999
GlennRC1dde1712015-10-02 11:03:08 -07001000 # Giving onos multiple chances to install intents
1001 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001002 if i != 0:
1003 main.log.warn( "Verification failed. Retrying..." )
1004 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001005 time.sleep( main.checkIntentsDelay )
1006
1007 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001008 for e in range(int(main.numCtrls)):
1009 main.log.info( "Checking intents on CLI %s" % (e+1) )
1010 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1011 intentState
1012 if not intentState:
1013 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001014 if intentState:
1015 break
GlennRCdb2c8422015-09-29 12:21:59 -07001016 else:
1017 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001018 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001019
GlennRCa8d786a2015-09-23 17:40:11 -07001020
1021 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1022 onpass="INTENTS INSTALLED",
1023 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001024
1025 main.step( "Verify Ping across all hosts" )
1026 pingResult = main.FALSE
1027 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001028 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1029 if not pingResult:
1030 main.log.warn("First pingall failed. Retrying...")
1031 time1 = time.time()
1032 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001033 time2 = time.time()
1034 timeDiff = round( ( time2 - time1 ), 2 )
1035 main.log.report(
1036 "Time taken for Ping All: " +
1037 str( timeDiff ) +
1038 " seconds" )
1039 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1040 onpass="PING ALL PASS",
1041 onfail="PING ALL FAIL" )
1042
GlennRCbddd58f2015-10-01 15:45:25 -07001043 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001044 utilities.assert_equals(
1045 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001046 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001047 onpass="Install 300 Host Intents and Ping All test PASS",
1048 onfail="Install 300 Host Intents and Ping All test FAIL" )
1049
GlennRCfcfdc4f2015-09-30 16:01:57 -07001050 if not intentState:
1051 main.log.debug( "Intents failed to install completely" )
1052 if not pingResult:
1053 main.log.debug( "Pingall failed" )
1054
GlennRCbddd58f2015-10-01 15:45:25 -07001055 if not caseResult and main.failSwitch:
1056 main.log.report("Stopping test")
1057 main.stop( email=main.emailOnStop )
1058
Hari Krishnac195f3b2015-07-08 20:02:24 -07001059 def CASE61( self ):
1060 """
1061 Install 600 host intents and verify ping all for Chordal Topology
1062 """
1063 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1064 main.log.report( "_______________________________________" )
1065 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001066
Hari Krishnac195f3b2015-07-08 20:02:24 -07001067 main.case( "Install 600 host intents" )
1068 main.step( "Add host Intents" )
1069 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001070 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1071
Hari Krishnac195f3b2015-07-08 20:02:24 -07001072 intentIdList = []
1073 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001074
Hari Krishnac195f3b2015-07-08 20:02:24 -07001075 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1076 pool = []
1077 for cli in main.CLIs:
1078 if i >= len( hostCombos ):
1079 break
1080 t = main.Thread( target=cli.addHostIntent,
1081 threadID=main.threadID,
1082 name="addHostIntent",
1083 args=[hostCombos[i][0],hostCombos[i][1]])
1084 pool.append(t)
1085 t.start()
1086 i = i + 1
1087 main.threadID = main.threadID + 1
1088 for thread in pool:
1089 thread.join()
1090 intentIdList.append(thread.result)
1091 time2 = time.time()
1092 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001093
GlennRCfcfdc4f2015-09-30 16:01:57 -07001094 # Saving intent ids to check intents in later cases
1095 main.intentIds = list(intentIdList)
1096
GlennRCa8d786a2015-09-23 17:40:11 -07001097 main.step("Verify intents are installed")
1098
GlennRC1dde1712015-10-02 11:03:08 -07001099 # Giving onos multiple chances to install intents
1100 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001101 if i != 0:
1102 main.log.warn( "Verification failed. Retrying..." )
1103 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001104 time.sleep( main.checkIntentsDelay )
1105
1106 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001107 for e in range(int(main.numCtrls)):
1108 main.log.info( "Checking intents on CLI %s" % (e+1) )
1109 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1110 intentState
1111 if not intentState:
1112 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001113 if intentState:
1114 break
GlennRCdb2c8422015-09-29 12:21:59 -07001115 else:
1116 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001117 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001118
1119 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1120 onpass="INTENTS INSTALLED",
1121 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001122
1123 main.step( "Verify Ping across all hosts" )
1124 pingResult = main.FALSE
1125 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001126 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1127 if not pingResult:
1128 main.log.warn("First pingall failed. Retrying...")
1129 time1 = time.time()
1130 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001131 time2 = time.time()
1132 timeDiff = round( ( time2 - time1 ), 2 )
1133 main.log.report(
1134 "Time taken for Ping All: " +
1135 str( timeDiff ) +
1136 " seconds" )
1137 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1138 onpass="PING ALL PASS",
1139 onfail="PING ALL FAIL" )
1140
GlennRCbddd58f2015-10-01 15:45:25 -07001141 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001142
Hari Krishnac195f3b2015-07-08 20:02:24 -07001143 utilities.assert_equals(
1144 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001145 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001146 onpass="Install 300 Host Intents and Ping All test PASS",
1147 onfail="Install 300 Host Intents and Ping All test FAIL" )
1148
GlennRCfcfdc4f2015-09-30 16:01:57 -07001149 if not intentState:
1150 main.log.debug( "Intents failed to install completely" )
1151 if not pingResult:
1152 main.log.debug( "Pingall failed" )
1153
GlennRCbddd58f2015-10-01 15:45:25 -07001154 if not caseResult and main.failSwitch:
1155 main.log.report("Stopping test")
1156 main.stop( email=main.emailOnStop )
1157
Hari Krishnac195f3b2015-07-08 20:02:24 -07001158 def CASE62( self ):
1159 """
1160 Install 2278 host intents and verify ping all for Spine Topology
1161 """
1162 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1163 main.log.report( "_______________________________________" )
1164 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001165
Hari Krishnac195f3b2015-07-08 20:02:24 -07001166 main.case( "Install 2278 host intents" )
1167 main.step( "Add host Intents" )
1168 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001169 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001170 main.pingTimeout = 300
1171 intentIdList = []
1172 time1 = time.time()
1173 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1174 pool = []
1175 for cli in main.CLIs:
1176 if i >= len( hostCombos ):
1177 break
1178 t = main.Thread( target=cli.addHostIntent,
1179 threadID=main.threadID,
1180 name="addHostIntent",
1181 args=[hostCombos[i][0],hostCombos[i][1]])
1182 pool.append(t)
1183 t.start()
1184 i = i + 1
1185 main.threadID = main.threadID + 1
1186 for thread in pool:
1187 thread.join()
1188 intentIdList.append(thread.result)
1189 time2 = time.time()
1190 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001191
GlennRCfcfdc4f2015-09-30 16:01:57 -07001192 # Saving intent ids to check intents in later cases
1193 main.intentIds = list(intentIdList)
1194
GlennRCa8d786a2015-09-23 17:40:11 -07001195 main.step("Verify intents are installed")
1196
GlennRC1dde1712015-10-02 11:03:08 -07001197 # Giving onos multiple chances to install intents
1198 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001199 if i != 0:
1200 main.log.warn( "Verification failed. Retrying..." )
1201 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001202 time.sleep( main.checkIntentsDelay )
1203
1204 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001205 for e in range(int(main.numCtrls)):
1206 main.log.info( "Checking intents on CLI %s" % (e+1) )
1207 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1208 intentState
1209 if not intentState:
1210 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001211 if intentState:
1212 break
GlennRCdb2c8422015-09-29 12:21:59 -07001213 else:
1214 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001215 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001216
1217 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1218 onpass="INTENTS INSTALLED",
1219 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001220
1221 main.step( "Verify Ping across all hosts" )
1222 pingResult = main.FALSE
1223 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001224 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1225 if not pingResult:
1226 main.log.warn("First pingall failed. Retrying...")
1227 time1 = time.time()
1228 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001229 time2 = time.time()
1230 timeDiff = round( ( time2 - time1 ), 2 )
1231 main.log.report(
1232 "Time taken for Ping All: " +
1233 str( timeDiff ) +
1234 " seconds" )
1235 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1236 onpass="PING ALL PASS",
1237 onfail="PING ALL FAIL" )
1238
GlennRCbddd58f2015-10-01 15:45:25 -07001239 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001240
Hari Krishnac195f3b2015-07-08 20:02:24 -07001241 utilities.assert_equals(
1242 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001243 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001244 onpass="Install 2278 Host Intents and Ping All test PASS",
1245 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1246
GlennRCfcfdc4f2015-09-30 16:01:57 -07001247 if not intentState:
1248 main.log.debug( "Intents failed to install completely" )
1249 if not pingResult:
1250 main.log.debug( "Pingall failed" )
1251
GlennRCbddd58f2015-10-01 15:45:25 -07001252 if not caseResult and main.failSwitch:
1253 main.log.report("Stopping test")
1254 main.stop( email=main.emailOnStop )
1255
Hari Krishna4223dbd2015-08-13 16:29:53 -07001256 def CASE160( self ):
1257 """
1258 Verify IPv6 ping across 300 host intents (Att Topology)
1259 """
1260 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1261 main.log.report( "_________________________________________________" )
1262 import itertools
1263 import time
1264 main.case( "IPv6 ping all 300 host intents" )
1265 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001266 pingResult = main.FALSE
1267 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001268 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001269 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001270 main.log.warn("First pingall failed. Retrying...")
1271 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001272 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001273 time2 = time.time()
1274 timeDiff = round( ( time2 - time1 ), 2 )
1275 main.log.report(
1276 "Time taken for IPv6 Ping All: " +
1277 str( timeDiff ) +
1278 " seconds" )
1279 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1280 onpass="PING ALL PASS",
1281 onfail="PING ALL FAIL" )
1282
GlennRCbddd58f2015-10-01 15:45:25 -07001283 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001284 utilities.assert_equals(
1285 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001286 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001287 onpass="IPv6 Ping across 300 host intents test PASS",
1288 onfail="IPv6 Ping across 300 host intents test FAIL" )
1289
1290 def CASE161( self ):
1291 """
1292 Verify IPv6 ping across 600 host intents (Chordal Topology)
1293 """
1294 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1295 main.log.report( "_________________________________________________" )
1296 import itertools
1297 import time
1298 main.case( "IPv6 ping all 600 host intents" )
1299 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001300 pingResult = main.FALSE
1301 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001302 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001303 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001304 main.log.warn("First pingall failed. Retrying...")
1305 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001306 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001307 time2 = time.time()
1308 timeDiff = round( ( time2 - time1 ), 2 )
1309 main.log.report(
1310 "Time taken for IPv6 Ping All: " +
1311 str( timeDiff ) +
1312 " seconds" )
1313 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1314 onpass="PING ALL PASS",
1315 onfail="PING ALL FAIL" )
1316
GlennRCbddd58f2015-10-01 15:45:25 -07001317 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001318 utilities.assert_equals(
1319 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001320 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001321 onpass="IPv6 Ping across 600 host intents test PASS",
1322 onfail="IPv6 Ping across 600 host intents test FAIL" )
1323
1324 def CASE162( self ):
1325 """
1326 Verify IPv6 ping across 2278 host intents (Spine Topology)
1327 """
1328 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1329 main.log.report( "_________________________________________________" )
1330 import itertools
1331 import time
1332 main.case( "IPv6 ping all 600 host intents" )
1333 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001334 pingResult = main.FALSE
1335 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001336 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001337 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001338 main.log.warn("First pingall failed. Retrying...")
1339 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001340 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001341 time2 = time.time()
1342 timeDiff = round( ( time2 - time1 ), 2 )
1343 main.log.report(
1344 "Time taken for IPv6 Ping All: " +
1345 str( timeDiff ) +
1346 " seconds" )
1347 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1348 onpass="PING ALL PASS",
1349 onfail="PING ALL FAIL" )
1350
GlennRCbddd58f2015-10-01 15:45:25 -07001351 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001352 utilities.assert_equals(
1353 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001354 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001355 onpass="IPv6 Ping across 600 host intents test PASS",
1356 onfail="IPv6 Ping across 600 host intents test FAIL" )
1357
Hari Krishnac195f3b2015-07-08 20:02:24 -07001358 def CASE70( self, main ):
1359 """
1360 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1361 """
1362 import random
1363 main.randomLink1 = []
1364 main.randomLink2 = []
1365 main.randomLink3 = []
1366 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1367 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1368 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1369 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1370 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1371 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1372 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1373 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1374
1375 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1376 main.log.report( "___________________________________________________________________________" )
1377 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1378 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1379 if ( int( switchLinksToToggle ) ==
1380 0 or int( switchLinksToToggle ) > 5 ):
1381 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1382 #main.cleanup()
1383 #main.exit()
1384 else:
1385 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1386
1387 main.step( "Cut links on Core devices using user provided range" )
1388 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1389 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1390 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1391 for i in range( int( switchLinksToToggle ) ):
1392 main.Mininet1.link(
1393 END1=link1End1,
1394 END2=main.randomLink1[ i ],
1395 OPTION="down" )
1396 time.sleep( link_sleep )
1397 main.Mininet1.link(
1398 END1=link2End1,
1399 END2=main.randomLink2[ i ],
1400 OPTION="down" )
1401 time.sleep( link_sleep )
1402 main.Mininet1.link(
1403 END1=link3End1,
1404 END2=main.randomLink3[ i ],
1405 OPTION="down" )
1406 time.sleep( link_sleep )
1407
Hari Krishna6185fc12015-07-13 15:42:31 -07001408 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001409 linkDown = main.ONOSbench.checkStatus(
1410 topology_output, main.numMNswitches, str(
1411 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1412 utilities.assert_equals(
1413 expect=main.TRUE,
1414 actual=linkDown,
1415 onpass="Link Down discovered properly",
1416 onfail="Link down was not discovered in " +
1417 str( link_sleep ) +
1418 " seconds" )
1419
GlennRCfcfdc4f2015-09-30 16:01:57 -07001420 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001421 # Giving onos multiple chances to install intents
1422 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001423 if i != 0:
1424 main.log.warn( "Verification failed. Retrying..." )
1425 main.log.info("Giving onos some time...")
1426 time.sleep( main.checkIntentsDelay )
1427
1428 intentState = main.TRUE
1429 for e in range(int(main.numCtrls)):
1430 main.log.info( "Checking intents on CLI %s" % (e+1) )
1431 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1432 intentState
1433 if not intentState:
1434 main.log.warn( "Not all intents installed" )
1435 if intentState:
1436 break
1437 else:
1438 #Dumping intent summary
1439 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1440
1441
1442 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1443 onpass="INTENTS INSTALLED",
1444 onfail="SOME INTENTS NOT INSTALLED" )
1445
Hari Krishnac195f3b2015-07-08 20:02:24 -07001446 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001447 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001448 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001449 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1450 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001451 main.log.warn("First pingall failed. Retrying...")
1452 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001453 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001454
Hari Krishnac195f3b2015-07-08 20:02:24 -07001455 time2 = time.time()
1456 timeDiff = round( ( time2 - time1 ), 2 )
1457 main.log.report(
1458 "Time taken for Ping All: " +
1459 str( timeDiff ) +
1460 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001461 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001462 onpass="PING ALL PASS",
1463 onfail="PING ALL FAIL" )
1464
GlennRCbddd58f2015-10-01 15:45:25 -07001465 caseResult = linkDown and pingResult and intentState
1466 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001467 onpass="Random Link cut Test PASS",
1468 onfail="Random Link cut Test FAIL" )
1469
GlennRCfcfdc4f2015-09-30 16:01:57 -07001470 # Printing what exactly failed
1471 if not linkDown:
1472 main.log.debug( "Link down was not discovered correctly" )
1473 if not pingResult:
1474 main.log.debug( "Pingall failed" )
1475 if not intentState:
1476 main.log.debug( "Intents are not all installed" )
1477
GlennRCbddd58f2015-10-01 15:45:25 -07001478 if not caseResult and main.failSwitch:
1479 main.log.report("Stopping test")
1480 main.stop( email=main.emailOnStop )
1481
Hari Krishnac195f3b2015-07-08 20:02:24 -07001482 def CASE80( self, main ):
1483 """
1484 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1485 """
1486 import random
1487 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1488 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1489 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1490 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1491 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1492
1493 main.log.report(
1494 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1495 main.log.report(
1496 "__________________________________________________________________" )
1497 main.case(
1498 "Host intents - Bring the core links up that are down and verify ping all" )
1499 main.step( "Bring randomly cut links on Core devices up" )
1500 for i in range( int( switchLinksToToggle ) ):
1501 main.Mininet1.link(
1502 END1=link1End1,
1503 END2=main.randomLink1[ i ],
1504 OPTION="up" )
1505 time.sleep( link_sleep )
1506 main.Mininet1.link(
1507 END1=link2End1,
1508 END2=main.randomLink2[ i ],
1509 OPTION="up" )
1510 time.sleep( link_sleep )
1511 main.Mininet1.link(
1512 END1=link3End1,
1513 END2=main.randomLink3[ i ],
1514 OPTION="up" )
1515 time.sleep( link_sleep )
1516
Hari Krishna6185fc12015-07-13 15:42:31 -07001517 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001518 linkUp = main.ONOSbench.checkStatus(
1519 topology_output,
1520 main.numMNswitches,
1521 str( main.numMNlinks ) )
1522 utilities.assert_equals(
1523 expect=main.TRUE,
1524 actual=linkUp,
1525 onpass="Link up discovered properly",
1526 onfail="Link up was not discovered in " +
1527 str( link_sleep ) +
1528 " seconds" )
1529
GlennRCfcfdc4f2015-09-30 16:01:57 -07001530 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001531 # Giving onos multiple chances to install intents
1532 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001533 if i != 0:
1534 main.log.warn( "Verification failed. Retrying..." )
1535 main.log.info("Giving onos some time...")
1536 time.sleep( main.checkIntentsDelay )
1537
1538 intentState = main.TRUE
1539 for e in range(int(main.numCtrls)):
1540 main.log.info( "Checking intents on CLI %s" % (e+1) )
1541 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1542 intentState
1543 if not intentState:
1544 main.log.warn( "Not all intents installed" )
1545 if intentState:
1546 break
1547 else:
1548 #Dumping intent summary
1549 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1550
1551
1552 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1553 onpass="INTENTS INSTALLED",
1554 onfail="SOME INTENTS NOT INSTALLED" )
1555
Hari Krishnac195f3b2015-07-08 20:02:24 -07001556 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001557 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001558 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001559 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1560 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001561 main.log.warn("First pingall failed. Retrying...")
1562 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001563 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001564
Hari Krishnac195f3b2015-07-08 20:02:24 -07001565 time2 = time.time()
1566 timeDiff = round( ( time2 - time1 ), 2 )
1567 main.log.report(
1568 "Time taken for Ping All: " +
1569 str( timeDiff ) +
1570 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001571 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001572 onpass="PING ALL PASS",
1573 onfail="PING ALL FAIL" )
1574
GlennRCbddd58f2015-10-01 15:45:25 -07001575 caseResult = linkUp and pingResult
1576 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001577 onpass="Link Up Test PASS",
1578 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001579 # Printing what exactly failed
1580 if not linkUp:
1581 main.log.debug( "Link down was not discovered correctly" )
1582 if not pingResult:
1583 main.log.debug( "Pingall failed" )
1584 if not intentState:
1585 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001586
GlennRCbddd58f2015-10-01 15:45:25 -07001587 if not caseResult and main.failSwitch:
1588 main.log.report("Stopping test")
1589 main.stop( email=main.emailOnStop )
1590
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591 def CASE71( self, main ):
1592 """
1593 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1594 """
1595 import random
1596 main.randomLink1 = []
1597 main.randomLink2 = []
1598 main.randomLink3 = []
1599 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1600 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1601 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1602 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1603 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1604 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1605 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1606 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1607
1608 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1609 main.log.report( "___________________________________________________________________________" )
1610 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1611 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1612 if ( int( switchLinksToToggle ) ==
1613 0 or int( switchLinksToToggle ) > 5 ):
1614 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1615 #main.cleanup()
1616 #main.exit()
1617 else:
1618 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1619
1620 main.step( "Cut links on Core devices using user provided range" )
1621 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1622 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1623 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1624 for i in range( int( switchLinksToToggle ) ):
1625 main.Mininet1.link(
1626 END1=link1End1,
1627 END2=main.randomLink1[ i ],
1628 OPTION="down" )
1629 time.sleep( link_sleep )
1630 main.Mininet1.link(
1631 END1=link2End1,
1632 END2=main.randomLink2[ i ],
1633 OPTION="down" )
1634 time.sleep( link_sleep )
1635 main.Mininet1.link(
1636 END1=link3End1,
1637 END2=main.randomLink3[ i ],
1638 OPTION="down" )
1639 time.sleep( link_sleep )
1640
Hari Krishna6185fc12015-07-13 15:42:31 -07001641 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001642 linkDown = main.ONOSbench.checkStatus(
1643 topology_output, main.numMNswitches, str(
1644 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1645 utilities.assert_equals(
1646 expect=main.TRUE,
1647 actual=linkDown,
1648 onpass="Link Down discovered properly",
1649 onfail="Link down was not discovered in " +
1650 str( link_sleep ) +
1651 " seconds" )
1652
GlennRCfcfdc4f2015-09-30 16:01:57 -07001653 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001654 # Giving onos multiple chances to install intents
1655 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001656 if i != 0:
1657 main.log.warn( "Verification failed. Retrying..." )
1658 main.log.info("Giving onos some time...")
1659 time.sleep( main.checkIntentsDelay )
1660
1661 intentState = main.TRUE
1662 for e in range(int(main.numCtrls)):
1663 main.log.info( "Checking intents on CLI %s" % (e+1) )
1664 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1665 intentState
1666 if not intentState:
1667 main.log.warn( "Not all intents installed" )
1668 if intentState:
1669 break
1670 else:
1671 #Dumping intent summary
1672 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1673
1674
1675 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1676 onpass="INTENTS INSTALLED",
1677 onfail="SOME INTENTS NOT INSTALLED" )
1678
Hari Krishnac195f3b2015-07-08 20:02:24 -07001679 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001680 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001681 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001682 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1683 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001684 main.log.warn("First pingall failed. Retrying...")
1685 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001686 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001687
Hari Krishnac195f3b2015-07-08 20:02:24 -07001688 time2 = time.time()
1689 timeDiff = round( ( time2 - time1 ), 2 )
1690 main.log.report(
1691 "Time taken for Ping All: " +
1692 str( timeDiff ) +
1693 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001694 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001695 onpass="PING ALL PASS",
1696 onfail="PING ALL FAIL" )
1697
GlennRCbddd58f2015-10-01 15:45:25 -07001698 caseResult = linkDown and pingResult and intentState
1699 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001700 onpass="Random Link cut Test PASS",
1701 onfail="Random Link cut Test FAIL" )
1702
GlennRCfcfdc4f2015-09-30 16:01:57 -07001703 # Printing what exactly failed
1704 if not linkDown:
1705 main.log.debug( "Link down was not discovered correctly" )
1706 if not pingResult:
1707 main.log.debug( "Pingall failed" )
1708 if not intentState:
1709 main.log.debug( "Intents are not all installed" )
1710
GlennRCbddd58f2015-10-01 15:45:25 -07001711 if not caseResult and main.failSwitch:
1712 main.log.report("Stopping test")
1713 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001714
Hari Krishnac195f3b2015-07-08 20:02:24 -07001715 def CASE81( self, main ):
1716 """
1717 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1718 """
1719 import random
1720 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1721 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1722 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1723 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1724 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1725
1726 main.log.report(
1727 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1728 main.log.report(
1729 "__________________________________________________________________" )
1730 main.case(
1731 "Point intents - Bring the core links up that are down and verify ping all" )
1732 main.step( "Bring randomly cut links on Core devices up" )
1733 for i in range( int( switchLinksToToggle ) ):
1734 main.Mininet1.link(
1735 END1=link1End1,
1736 END2=main.randomLink1[ i ],
1737 OPTION="up" )
1738 time.sleep( link_sleep )
1739 main.Mininet1.link(
1740 END1=link2End1,
1741 END2=main.randomLink2[ i ],
1742 OPTION="up" )
1743 time.sleep( link_sleep )
1744 main.Mininet1.link(
1745 END1=link3End1,
1746 END2=main.randomLink3[ i ],
1747 OPTION="up" )
1748 time.sleep( link_sleep )
1749
Hari Krishna6185fc12015-07-13 15:42:31 -07001750 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001751 linkUp = main.ONOSbench.checkStatus(
1752 topology_output,
1753 main.numMNswitches,
1754 str( main.numMNlinks ) )
1755 utilities.assert_equals(
1756 expect=main.TRUE,
1757 actual=linkUp,
1758 onpass="Link up discovered properly",
1759 onfail="Link up was not discovered in " +
1760 str( link_sleep ) +
1761 " seconds" )
1762
GlennRCfcfdc4f2015-09-30 16:01:57 -07001763 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001764 # Giving onos multiple chances to install intents
1765 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001766 if i != 0:
1767 main.log.warn( "Verification failed. Retrying..." )
1768 main.log.info("Giving onos some time...")
1769 time.sleep( main.checkIntentsDelay )
1770
1771 intentState = main.TRUE
1772 for e in range(int(main.numCtrls)):
1773 main.log.info( "Checking intents on CLI %s" % (e+1) )
1774 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1775 intentState
1776 if not intentState:
1777 main.log.warn( "Not all intents installed" )
1778 if intentState:
1779 break
1780 else:
1781 #Dumping intent summary
1782 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1783
1784
1785 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1786 onpass="INTENTS INSTALLED",
1787 onfail="SOME INTENTS NOT INSTALLED" )
1788
Hari Krishnac195f3b2015-07-08 20:02:24 -07001789 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001790 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001791 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001792 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1793 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001794 main.log.warn("First pingall failed. Retrying...")
1795 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001796 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001797
Hari Krishnac195f3b2015-07-08 20:02:24 -07001798 time2 = time.time()
1799 timeDiff = round( ( time2 - time1 ), 2 )
1800 main.log.report(
1801 "Time taken for Ping All: " +
1802 str( timeDiff ) +
1803 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001804 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001805 onpass="PING ALL PASS",
1806 onfail="PING ALL FAIL" )
1807
GlennRCbddd58f2015-10-01 15:45:25 -07001808 caseResult = linkUp and pingResult
1809 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001810 onpass="Link Up Test PASS",
1811 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001812 # Printing what exactly failed
1813 if not linkUp:
1814 main.log.debug( "Link down was not discovered correctly" )
1815 if not pingResult:
1816 main.log.debug( "Pingall failed" )
1817 if not intentState:
1818 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819
GlennRCbddd58f2015-10-01 15:45:25 -07001820 if not caseResult and main.failSwitch:
1821 main.log.report("Stopping test")
1822 main.stop( email=main.emailOnStop )
1823
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824 def CASE72( self, main ):
1825 """
1826 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1827 """
1828 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001829 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001830 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001831
Hari Krishnac195f3b2015-07-08 20:02:24 -07001832 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1833 main.log.report( "___________________________________________________________________________" )
1834 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1835 switches = []
1836 switchesComb = []
1837 for i in range( main.numMNswitches ):
1838 switches.append('s%d'%(i+1))
1839 switchesLinksComb = list(itertools.combinations(switches,2))
1840 main.randomLinks = random.sample(switchesLinksComb, 5 )
1841 print main.randomLinks
1842 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001843
Hari Krishnac195f3b2015-07-08 20:02:24 -07001844 for switch in main.randomLinks:
1845 main.Mininet1.link(
1846 END1=switch[0],
1847 END2=switch[1],
1848 OPTION="down")
1849 time.sleep( link_sleep )
1850
Hari Krishna6185fc12015-07-13 15:42:31 -07001851 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001852 linkDown = main.ONOSbench.checkStatus(
1853 topology_output, main.numMNswitches, str(
1854 int( main.numMNlinks ) - 5 * 2 ) )
1855 utilities.assert_equals(
1856 expect=main.TRUE,
1857 actual=linkDown,
1858 onpass="Link Down discovered properly",
1859 onfail="Link down was not discovered in " +
1860 str( link_sleep ) +
1861 " seconds" )
1862
GlennRCfcfdc4f2015-09-30 16:01:57 -07001863 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001864 # Giving onos multiple chances to install intents
1865 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001866 if i != 0:
1867 main.log.warn( "Verification failed. Retrying..." )
1868 main.log.info("Giving onos some time...")
1869 time.sleep( main.checkIntentsDelay )
1870
1871 intentState = main.TRUE
1872 for e in range(int(main.numCtrls)):
1873 main.log.info( "Checking intents on CLI %s" % (e+1) )
1874 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1875 intentState
1876 if not intentState:
1877 main.log.warn( "Not all intents installed" )
1878 if intentState:
1879 break
1880 else:
1881 #Dumping intent summary
1882 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1883
1884
1885 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1886 onpass="INTENTS INSTALLED",
1887 onfail="SOME INTENTS NOT INSTALLED" )
1888
Hari Krishnac195f3b2015-07-08 20:02:24 -07001889 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001890 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001891 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001892 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1893 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001894 main.log.warn("First pingall failed. Retrying...")
1895 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001896 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001897
Hari Krishnac195f3b2015-07-08 20:02:24 -07001898 time2 = time.time()
1899 timeDiff = round( ( time2 - time1 ), 2 )
1900 main.log.report(
1901 "Time taken for Ping All: " +
1902 str( timeDiff ) +
1903 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001904 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001905 onpass="PING ALL PASS",
1906 onfail="PING ALL FAIL" )
1907
GlennRCbddd58f2015-10-01 15:45:25 -07001908 caseResult = linkDown and pingResult and intentState
1909 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001910 onpass="Random Link cut Test PASS",
1911 onfail="Random Link cut Test FAIL" )
1912
GlennRCfcfdc4f2015-09-30 16:01:57 -07001913 # Printing what exactly failed
1914 if not linkDown:
1915 main.log.debug( "Link down was not discovered correctly" )
1916 if not pingResult:
1917 main.log.debug( "Pingall failed" )
1918 if not intentState:
1919 main.log.debug( "Intents are not all installed" )
1920
GlennRCbddd58f2015-10-01 15:45:25 -07001921 if not caseResult and main.failSwitch:
1922 main.log.report("Stopping test")
1923 main.stop( email=main.emailOnStop )
1924
Hari Krishnac195f3b2015-07-08 20:02:24 -07001925 def CASE82( self, main ):
1926 """
1927 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1928 """
1929 import random
1930 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001931
Hari Krishnac195f3b2015-07-08 20:02:24 -07001932 main.log.report(
1933 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1934 main.log.report(
1935 "__________________________________________________________________" )
1936 main.case(
1937 "Host intents - Bring the core links up that are down and verify ping all" )
1938 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001939
Hari Krishnac195f3b2015-07-08 20:02:24 -07001940 for switch in main.randomLinks:
1941 main.Mininet1.link(
1942 END1=switch[0],
1943 END2=switch[1],
1944 OPTION="up")
1945 time.sleep( link_sleep )
1946
Hari Krishna6185fc12015-07-13 15:42:31 -07001947 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001948 linkUp = main.ONOSbench.checkStatus(
1949 topology_output,
1950 main.numMNswitches,
1951 str( main.numMNlinks ) )
1952 utilities.assert_equals(
1953 expect=main.TRUE,
1954 actual=linkUp,
1955 onpass="Link up discovered properly",
1956 onfail="Link up was not discovered in " +
1957 str( link_sleep ) +
1958 " seconds" )
1959
GlennRCfcfdc4f2015-09-30 16:01:57 -07001960 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001961 # Giving onos multiple chances to install intents
1962 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001963 if i != 0:
1964 main.log.warn( "Verification failed. Retrying..." )
1965 main.log.info("Giving onos some time...")
1966 time.sleep( main.checkIntentsDelay )
1967
1968 intentState = main.TRUE
1969 for e in range(int(main.numCtrls)):
1970 main.log.info( "Checking intents on CLI %s" % (e+1) )
1971 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1972 intentState
1973 if not intentState:
1974 main.log.warn( "Not all intents installed" )
1975 if intentState:
1976 break
1977 else:
1978 #Dumping intent summary
1979 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1980
1981
1982 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1983 onpass="INTENTS INSTALLED",
1984 onfail="SOME INTENTS NOT INSTALLED" )
1985
Hari Krishnac195f3b2015-07-08 20:02:24 -07001986 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001987 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001988 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001989 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1990 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001991 main.log.warn("First pingall failed. Retrying...")
1992 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001993 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001994
Hari Krishnac195f3b2015-07-08 20:02:24 -07001995 time2 = time.time()
1996 timeDiff = round( ( time2 - time1 ), 2 )
1997 main.log.report(
1998 "Time taken for Ping All: " +
1999 str( timeDiff ) +
2000 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002001 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002002 onpass="PING ALL PASS",
2003 onfail="PING ALL FAIL" )
2004
GlennRCbddd58f2015-10-01 15:45:25 -07002005 caseResult = linkUp and pingResult
2006 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002007 onpass="Link Up Test PASS",
2008 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002009 # Printing what exactly failed
2010 if not linkUp:
2011 main.log.debug( "Link down was not discovered correctly" )
2012 if not pingResult:
2013 main.log.debug( "Pingall failed" )
2014 if not intentState:
2015 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002016
GlennRCbddd58f2015-10-01 15:45:25 -07002017 if not caseResult and main.failSwitch:
2018 main.log.report("Stopping test")
2019 main.stop( email=main.emailOnStop )
2020
Hari Krishnac195f3b2015-07-08 20:02:24 -07002021 def CASE73( self, main ):
2022 """
2023 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2024 """
2025 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002026 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002027 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002028
Hari Krishnac195f3b2015-07-08 20:02:24 -07002029 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2030 main.log.report( "___________________________________________________________________________" )
2031 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2032 switches = []
2033 switchesComb = []
2034 for i in range( main.numMNswitches ):
2035 switches.append('s%d'%(i+1))
2036 switchesLinksComb = list(itertools.combinations(switches,2))
2037 main.randomLinks = random.sample(switchesLinksComb, 5 )
2038 print main.randomLinks
2039 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002040
Hari Krishnac195f3b2015-07-08 20:02:24 -07002041 for switch in main.randomLinks:
2042 main.Mininet1.link(
2043 END1=switch[0],
2044 END2=switch[1],
2045 OPTION="down")
2046 time.sleep( link_sleep )
2047
Hari Krishna6185fc12015-07-13 15:42:31 -07002048 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002049 linkDown = main.ONOSbench.checkStatus(
2050 topology_output, main.numMNswitches, str(
2051 int( main.numMNlinks ) - 5 * 2 ) )
2052 utilities.assert_equals(
2053 expect=main.TRUE,
2054 actual=linkDown,
2055 onpass="Link Down discovered properly",
2056 onfail="Link down was not discovered in " +
2057 str( link_sleep ) +
2058 " seconds" )
2059
GlennRCfcfdc4f2015-09-30 16:01:57 -07002060 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002061 # Giving onos multiple chances to install intents
2062 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002063 if i != 0:
2064 main.log.warn( "Verification failed. Retrying..." )
2065 main.log.info("Giving onos some time...")
2066 time.sleep( main.checkIntentsDelay )
2067
2068 intentState = main.TRUE
2069 for e in range(int(main.numCtrls)):
2070 main.log.info( "Checking intents on CLI %s" % (e+1) )
2071 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2072 intentState
2073 if not intentState:
2074 main.log.warn( "Not all intents installed" )
2075 if intentState:
2076 break
2077 else:
2078 #Dumping intent summary
2079 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2080
2081
2082 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2083 onpass="INTENTS INSTALLED",
2084 onfail="SOME INTENTS NOT INSTALLED" )
2085
Hari Krishnac195f3b2015-07-08 20:02:24 -07002086 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002087 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002088 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002089 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2090 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002091 main.log.warn("First pingall failed. Retrying...")
2092 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002093 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002094
Hari Krishnac195f3b2015-07-08 20:02:24 -07002095 time2 = time.time()
2096 timeDiff = round( ( time2 - time1 ), 2 )
2097 main.log.report(
2098 "Time taken for Ping All: " +
2099 str( timeDiff ) +
2100 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002101 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002102 onpass="PING ALL PASS",
2103 onfail="PING ALL FAIL" )
2104
GlennRCbddd58f2015-10-01 15:45:25 -07002105 caseResult = linkDown and pingResult and intentState
2106 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002107 onpass="Random Link cut Test PASS",
2108 onfail="Random Link cut Test FAIL" )
2109
GlennRCfcfdc4f2015-09-30 16:01:57 -07002110 # Printing what exactly failed
2111 if not linkDown:
2112 main.log.debug( "Link down was not discovered correctly" )
2113 if not pingResult:
2114 main.log.debug( "Pingall failed" )
2115 if not intentState:
2116 main.log.debug( "Intents are not all installed" )
2117
GlennRCbddd58f2015-10-01 15:45:25 -07002118 if not caseResult and main.failSwitch:
2119 main.log.report("Stopping test")
2120 main.stop( email=main.emailOnStop )
2121
Hari Krishnac195f3b2015-07-08 20:02:24 -07002122 def CASE83( self, main ):
2123 """
2124 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2125 """
2126 import random
2127 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002128
Hari Krishnac195f3b2015-07-08 20:02:24 -07002129 main.log.report(
2130 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2131 main.log.report(
2132 "__________________________________________________________________" )
2133 main.case(
2134 "Point intents - Bring the core links up that are down and verify ping all" )
2135 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002136
Hari Krishnac195f3b2015-07-08 20:02:24 -07002137 for switch in main.randomLinks:
2138 main.Mininet1.link(
2139 END1=switch[0],
2140 END2=switch[1],
2141 OPTION="up")
2142 time.sleep( link_sleep )
2143
Hari Krishna6185fc12015-07-13 15:42:31 -07002144 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002145 linkUp = main.ONOSbench.checkStatus(
2146 topology_output,
2147 main.numMNswitches,
2148 str( main.numMNlinks ) )
2149 utilities.assert_equals(
2150 expect=main.TRUE,
2151 actual=linkUp,
2152 onpass="Link up discovered properly",
2153 onfail="Link up was not discovered in " +
2154 str( link_sleep ) +
2155 " seconds" )
2156
GlennRCfcfdc4f2015-09-30 16:01:57 -07002157 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002158 # Giving onos multiple chances to install intents
2159 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002160 if i != 0:
2161 main.log.warn( "Verification failed. Retrying..." )
2162 main.log.info("Giving onos some time...")
2163 time.sleep( main.checkIntentsDelay )
2164
2165 intentState = main.TRUE
2166 for e in range(int(main.numCtrls)):
2167 main.log.info( "Checking intents on CLI %s" % (e+1) )
2168 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2169 intentState
2170 if not intentState:
2171 main.log.warn( "Not all intents installed" )
2172 if intentState:
2173 break
2174 else:
2175 #Dumping intent summary
2176 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2177
2178
2179 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2180 onpass="INTENTS INSTALLED",
2181 onfail="SOME INTENTS NOT INSTALLED" )
2182
Hari Krishnac195f3b2015-07-08 20:02:24 -07002183 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002184 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002185 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002186 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2187 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002188 main.log.warn("First pingall failed. Retrying...")
2189 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002190 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002191
Hari Krishnac195f3b2015-07-08 20:02:24 -07002192 time2 = time.time()
2193 timeDiff = round( ( time2 - time1 ), 2 )
2194 main.log.report(
2195 "Time taken for Ping All: " +
2196 str( timeDiff ) +
2197 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002198 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002199 onpass="PING ALL PASS",
2200 onfail="PING ALL FAIL" )
2201
GlennRCbddd58f2015-10-01 15:45:25 -07002202 caseResult = linkUp and pingResult
2203 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002204 onpass="Link Up Test PASS",
2205 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002206 # Printing what exactly failed
2207 if not linkUp:
2208 main.log.debug( "Link down was not discovered correctly" )
2209 if not pingResult:
2210 main.log.debug( "Pingall failed" )
2211 if not intentState:
2212 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002213
GlennRCbddd58f2015-10-01 15:45:25 -07002214 if not caseResult and main.failSwitch:
2215 main.log.report("Stopping test")
2216 main.stop( email=main.emailOnStop )
2217
Hari Krishnac195f3b2015-07-08 20:02:24 -07002218 def CASE74( self, main ):
2219 """
2220 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2221 """
2222 import random
2223 main.randomLink1 = []
2224 main.randomLink2 = []
2225 main.randomLink3 = []
2226 main.randomLink4 = []
2227 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2228 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2229 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2230 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2231 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2232 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2233 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2234 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002235
Hari Krishnac195f3b2015-07-08 20:02:24 -07002236 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2237 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002238 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002239 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002240 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002241 linkIndex.remove(linkIndexS9)
2242 linkIndexS10 = random.sample(linkIndex,1)[0]
2243 main.randomLink1 = link1End2top[linkIndexS9]
2244 main.randomLink2 = link2End2top[linkIndexS10]
2245 main.randomLink3 = random.sample(link1End2bot,1)[0]
2246 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002247
2248 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002249 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2250 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2251 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2252 time.sleep( link_sleep )
2253 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2254 time.sleep( link_sleep )
2255
Hari Krishna6185fc12015-07-13 15:42:31 -07002256 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002257 linkDown = main.ONOSbench.checkStatus(
2258 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002259 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002260 utilities.assert_equals(
2261 expect=main.TRUE,
2262 actual=linkDown,
2263 onpass="Link Down discovered properly",
2264 onfail="Link down was not discovered in " +
2265 str( link_sleep ) +
2266 " seconds" )
2267
GlennRCfcfdc4f2015-09-30 16:01:57 -07002268 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002269 # Giving onos multiple chances to install intents
2270 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002271 if i != 0:
2272 main.log.warn( "Verification failed. Retrying..." )
2273 main.log.info("Giving onos some time...")
2274 time.sleep( main.checkIntentsDelay )
2275
2276 intentState = main.TRUE
2277 for e in range(int(main.numCtrls)):
2278 main.log.info( "Checking intents on CLI %s" % (e+1) )
2279 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2280 intentState
2281 if not intentState:
2282 main.log.warn( "Not all intents installed" )
2283 if intentState:
2284 break
2285 else:
2286 #Dumping intent summary
2287 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2288
2289
2290 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2291 onpass="INTENTS INSTALLED",
2292 onfail="SOME INTENTS NOT INSTALLED" )
2293
Hari Krishnac195f3b2015-07-08 20:02:24 -07002294 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002295 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002296 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002297 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2298 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002299 main.log.warn("First pingall failed. Retrying...")
2300 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002301 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002302
Hari Krishnac195f3b2015-07-08 20:02:24 -07002303 time2 = time.time()
2304 timeDiff = round( ( time2 - time1 ), 2 )
2305 main.log.report(
2306 "Time taken for Ping All: " +
2307 str( timeDiff ) +
2308 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002309 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002310 onpass="PING ALL PASS",
2311 onfail="PING ALL FAIL" )
2312
GlennRCbddd58f2015-10-01 15:45:25 -07002313 caseResult = linkDown and pingResult and intentState
2314 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002315 onpass="Random Link cut Test PASS",
2316 onfail="Random Link cut Test FAIL" )
2317
GlennRCfcfdc4f2015-09-30 16:01:57 -07002318 # Printing what exactly failed
2319 if not linkDown:
2320 main.log.debug( "Link down was not discovered correctly" )
2321 if not pingResult:
2322 main.log.debug( "Pingall failed" )
2323 if not intentState:
2324 main.log.debug( "Intents are not all installed" )
2325
GlennRCbddd58f2015-10-01 15:45:25 -07002326 if not caseResult and main.failSwitch:
2327 main.log.report("Stopping test")
2328 main.stop( email=main.emailOnStop )
2329
Hari Krishnac195f3b2015-07-08 20:02:24 -07002330 def CASE84( self, main ):
2331 """
2332 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2333 """
2334 import random
2335 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2336 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2337 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2338 main.log.report(
2339 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2340 main.log.report(
2341 "__________________________________________________________________" )
2342 main.case(
2343 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002344
2345 # Work around for link state propagation delay. Added some sleep time.
2346 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2347 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002348 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2349 time.sleep( link_sleep )
2350 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2351 time.sleep( link_sleep )
2352
Hari Krishna6185fc12015-07-13 15:42:31 -07002353 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002354 linkUp = main.ONOSbench.checkStatus(
2355 topology_output,
2356 main.numMNswitches,
2357 str( main.numMNlinks ) )
2358 utilities.assert_equals(
2359 expect=main.TRUE,
2360 actual=linkUp,
2361 onpass="Link up discovered properly",
2362 onfail="Link up was not discovered in " +
2363 str( link_sleep ) +
2364 " seconds" )
2365
GlennRCfcfdc4f2015-09-30 16:01:57 -07002366 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002367 # Giving onos multiple chances to install intents
2368 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002369 if i != 0:
2370 main.log.warn( "Verification failed. Retrying..." )
2371 main.log.info("Giving onos some time...")
2372 time.sleep( main.checkIntentsDelay )
2373
2374 intentState = main.TRUE
2375 for e in range(int(main.numCtrls)):
2376 main.log.info( "Checking intents on CLI %s" % (e+1) )
2377 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2378 intentState
2379 if not intentState:
2380 main.log.warn( "Not all intents installed" )
2381 if intentState:
2382 break
2383 else:
2384 #Dumping intent summary
2385 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2386
2387
2388 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2389 onpass="INTENTS INSTALLED",
2390 onfail="SOME INTENTS NOT INSTALLED" )
2391
Hari Krishnac195f3b2015-07-08 20:02:24 -07002392 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002393 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002394 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002395 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2396 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002397 main.log.warn("First pingall failed. Retrying...")
2398 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002399 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002400
Hari Krishnac195f3b2015-07-08 20:02:24 -07002401 time2 = time.time()
2402 timeDiff = round( ( time2 - time1 ), 2 )
2403 main.log.report(
2404 "Time taken for Ping All: " +
2405 str( timeDiff ) +
2406 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002407 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002408 onpass="PING ALL PASS",
2409 onfail="PING ALL FAIL" )
2410
GlennRCbddd58f2015-10-01 15:45:25 -07002411 caseResult = linkUp and pingResult
2412 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002413 onpass="Link Up Test PASS",
2414 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002415 # Printing what exactly failed
2416 if not linkUp:
2417 main.log.debug( "Link down was not discovered correctly" )
2418 if not pingResult:
2419 main.log.debug( "Pingall failed" )
2420 if not intentState:
2421 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002422
GlennRCbddd58f2015-10-01 15:45:25 -07002423 if not caseResult and main.failSwitch:
2424 main.log.report("Stopping test")
2425 main.stop( email=main.emailOnStop )
2426
Hari Krishnab79d0822015-08-20 09:48:43 -07002427 def CASE75( self, main ):
2428 """
2429 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2430 """
2431 import random
2432 main.randomLink1 = []
2433 main.randomLink2 = []
2434 main.randomLink3 = []
2435 main.randomLink4 = []
2436 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2437 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2438 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2439 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2440 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2441 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2442 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2443 main.pingTimeout = 400
2444
2445 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2446 main.log.report( "___________________________________________________________________________" )
2447 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2448 linkIndex = range(4)
2449 linkIndexS9 = random.sample(linkIndex,1)[0]
2450 linkIndex.remove(linkIndexS9)
2451 linkIndexS10 = random.sample(linkIndex,1)[0]
2452 main.randomLink1 = link1End2top[linkIndexS9]
2453 main.randomLink2 = link2End2top[linkIndexS10]
2454 main.randomLink3 = random.sample(link1End2bot,1)[0]
2455 main.randomLink4 = random.sample(link2End2bot,1)[0]
2456
2457 # Work around for link state propagation delay. Added some sleep time.
2458 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2459 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2460 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2461 time.sleep( link_sleep )
2462 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2463 time.sleep( link_sleep )
2464
2465 topology_output = main.ONOScli1.topology()
2466 linkDown = main.ONOSbench.checkStatus(
2467 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002468 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002469 utilities.assert_equals(
2470 expect=main.TRUE,
2471 actual=linkDown,
2472 onpass="Link Down discovered properly",
2473 onfail="Link down was not discovered in " +
2474 str( link_sleep ) +
2475 " seconds" )
2476
GlennRCfcfdc4f2015-09-30 16:01:57 -07002477 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002478 # Giving onos multiple chances to install intents
2479 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002480 if i != 0:
2481 main.log.warn( "Verification failed. Retrying..." )
2482 main.log.info("Giving onos some time...")
2483 time.sleep( main.checkIntentsDelay )
2484
2485 intentState = main.TRUE
2486 for e in range(int(main.numCtrls)):
2487 main.log.info( "Checking intents on CLI %s" % (e+1) )
2488 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2489 intentState
2490 if not intentState:
2491 main.log.warn( "Not all intents installed" )
2492 if intentState:
2493 break
2494 else:
2495 #Dumping intent summary
2496 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2497
2498
2499 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2500 onpass="INTENTS INSTALLED",
2501 onfail="SOME INTENTS NOT INSTALLED" )
2502
Hari Krishnab79d0822015-08-20 09:48:43 -07002503 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002504 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002505 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002506 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2507 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002508 main.log.warn("First pingall failed. Retrying...")
2509 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002510 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002511
Hari Krishnab79d0822015-08-20 09:48:43 -07002512 time2 = time.time()
2513 timeDiff = round( ( time2 - time1 ), 2 )
2514 main.log.report(
2515 "Time taken for Ping All: " +
2516 str( timeDiff ) +
2517 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002518 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002519 onpass="PING ALL PASS",
2520 onfail="PING ALL FAIL" )
2521
GlennRCbddd58f2015-10-01 15:45:25 -07002522 caseResult = linkDown and pingResult and intentState
2523 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002524 onpass="Random Link cut Test PASS",
2525 onfail="Random Link cut Test FAIL" )
2526
GlennRCfcfdc4f2015-09-30 16:01:57 -07002527 # Printing what exactly failed
2528 if not linkDown:
2529 main.log.debug( "Link down was not discovered correctly" )
2530 if not pingResult:
2531 main.log.debug( "Pingall failed" )
2532 if not intentState:
2533 main.log.debug( "Intents are not all installed" )
2534
GlennRCbddd58f2015-10-01 15:45:25 -07002535 if not caseResult and main.failSwitch:
2536 main.log.report("Stopping test")
2537 main.stop( email=main.emailOnStop )
2538
Hari Krishnab79d0822015-08-20 09:48:43 -07002539 def CASE85( self, main ):
2540 """
2541 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2542 """
2543 import random
2544 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2545 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2546 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2547 main.log.report(
2548 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2549 main.log.report(
2550 "__________________________________________________________________" )
2551 main.case(
2552 "Point intents - Bring the core links up that are down and verify ping all" )
2553
2554 # Work around for link state propagation delay. Added some sleep time.
2555 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2556 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2557 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2558 time.sleep( link_sleep )
2559 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2560 time.sleep( link_sleep )
2561
2562 topology_output = main.ONOScli1.topology()
2563 linkUp = main.ONOSbench.checkStatus(
2564 topology_output,
2565 main.numMNswitches,
2566 str( main.numMNlinks ) )
2567 utilities.assert_equals(
2568 expect=main.TRUE,
2569 actual=linkUp,
2570 onpass="Link up discovered properly",
2571 onfail="Link up was not discovered in " +
2572 str( link_sleep ) +
2573 " seconds" )
2574
GlennRCfcfdc4f2015-09-30 16:01:57 -07002575 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002576 # Giving onos multiple chances to install intents
2577 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002578 if i != 0:
2579 main.log.warn( "Verification failed. Retrying..." )
2580 main.log.info("Giving onos some time...")
2581 time.sleep( main.checkIntentsDelay )
2582
2583 intentState = main.TRUE
2584 for e in range(int(main.numCtrls)):
2585 main.log.info( "Checking intents on CLI %s" % (e+1) )
2586 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2587 intentState
2588 if not intentState:
2589 main.log.warn( "Not all intents installed" )
2590 if intentState:
2591 break
2592 else:
2593 #Dumping intent summary
2594 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2595
2596
2597 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2598 onpass="INTENTS INSTALLED",
2599 onfail="SOME INTENTS NOT INSTALLED" )
2600
Hari Krishnab79d0822015-08-20 09:48:43 -07002601 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002602 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002603 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002604 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2605 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002606 main.log.warn("First pingall failed. Retrying...")
2607 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002608 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002609
Hari Krishnab79d0822015-08-20 09:48:43 -07002610 time2 = time.time()
2611 timeDiff = round( ( time2 - time1 ), 2 )
2612 main.log.report(
2613 "Time taken for Ping All: " +
2614 str( timeDiff ) +
2615 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002616 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002617 onpass="PING ALL PASS",
2618 onfail="PING ALL FAIL" )
2619
GlennRCbddd58f2015-10-01 15:45:25 -07002620 caseResult = linkUp and pingResult
2621 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002622 onpass="Link Up Test PASS",
2623 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002624 # Printing what exactly failed
2625 if not linkUp:
2626 main.log.debug( "Link down was not discovered correctly" )
2627 if not pingResult:
2628 main.log.debug( "Pingall failed" )
2629 if not intentState:
2630 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002631
GlennRCbddd58f2015-10-01 15:45:25 -07002632 if not caseResult and main.failSwitch:
2633 main.log.report("Stopping test")
2634 main.stop( email=main.emailOnStop )
2635
Hari Krishna4223dbd2015-08-13 16:29:53 -07002636 def CASE170( self ):
2637 """
2638 IPv6 ping all with some core links down( Host Intents-Att Topo)
2639 """
2640 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2641 main.log.report( "_________________________________________________" )
2642 import itertools
2643 import time
2644 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2645 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002646 pingResult = main.FALSE
2647 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002648 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002649 if not pingResult:
2650 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002651 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002652 time2 = time.time()
2653 timeDiff = round( ( time2 - time1 ), 2 )
2654 main.log.report(
2655 "Time taken for IPv6 Ping All: " +
2656 str( timeDiff ) +
2657 " seconds" )
2658 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2659 onpass="PING ALL PASS",
2660 onfail="PING ALL FAIL" )
2661
GlennRCbddd58f2015-10-01 15:45:25 -07002662 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002663 utilities.assert_equals(
2664 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002665 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002666 onpass="IPv6 Ping across 300 host intents test PASS",
2667 onfail="IPv6 Ping across 300 host intents test FAIL" )
2668
2669 def CASE180( self ):
2670 """
2671 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2672 """
2673 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2674 main.log.report( "_________________________________________________" )
2675 import itertools
2676 import time
2677 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2678 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002679 pingResult = main.FALSE
2680 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002681 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002682 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002683 main.log.warn("First ping failed. Retrying...")
2684 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002685 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002686 time2 = time.time()
2687 timeDiff = round( ( time2 - time1 ), 2 )
2688 main.log.report(
2689 "Time taken for IPv6 Ping All: " +
2690 str( timeDiff ) +
2691 " seconds" )
2692 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2693 onpass="PING ALL PASS",
2694 onfail="PING ALL FAIL" )
2695
GlennRCbddd58f2015-10-01 15:45:25 -07002696 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002697 utilities.assert_equals(
2698 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002699 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002700 onpass="IPv6 Ping across 300 host intents test PASS",
2701 onfail="IPv6 Ping across 300 host intents test FAIL" )
2702
2703 def CASE171( self ):
2704 """
2705 IPv6 ping all with some core links down( Point Intents-Att Topo)
2706 """
2707 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2708 main.log.report( "_________________________________________________" )
2709 import itertools
2710 import time
2711 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2712 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002713 pingResult = main.FALSE
2714 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002715 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002716 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002717 main.log.warn("First ping failed. Retrying...")
2718 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002719 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002720 time2 = time.time()
2721 timeDiff = round( ( time2 - time1 ), 2 )
2722 main.log.report(
2723 "Time taken for IPv6 Ping All: " +
2724 str( timeDiff ) +
2725 " seconds" )
2726 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2727 onpass="PING ALL PASS",
2728 onfail="PING ALL FAIL" )
2729
GlennRCbddd58f2015-10-01 15:45:25 -07002730 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002731 utilities.assert_equals(
2732 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002733 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002734 onpass="IPv6 Ping across 600 point intents test PASS",
2735 onfail="IPv6 Ping across 600 point intents test FAIL" )
2736
2737 def CASE181( self ):
2738 """
2739 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2740 """
2741 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2742 main.log.report( "_________________________________________________" )
2743 import itertools
2744 import time
2745 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2746 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002747 pingResult = main.FALSE
2748 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002749 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002750 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002751 main.log.warn("First ping failed. Retrying...")
2752 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002753 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002754 time2 = time.time()
2755 timeDiff = round( ( time2 - time1 ), 2 )
2756 main.log.report(
2757 "Time taken for IPv6 Ping All: " +
2758 str( timeDiff ) +
2759 " seconds" )
2760 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2761 onpass="PING ALL PASS",
2762 onfail="PING ALL FAIL" )
2763
GlennRCbddd58f2015-10-01 15:45:25 -07002764 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002765 utilities.assert_equals(
2766 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002767 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002768 onpass="IPv6 Ping across 600 Point intents test PASS",
2769 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2770
2771 def CASE172( self ):
2772 """
2773 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2774 """
2775 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2776 main.log.report( "_________________________________________________" )
2777 import itertools
2778 import time
2779 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2780 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002781 pingResult = main.FALSE
2782 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002783 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002784 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002785 main.log.warn("First ping failed. Retrying...")
2786 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002787 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002788 time2 = time.time()
2789 timeDiff = round( ( time2 - time1 ), 2 )
2790 main.log.report(
2791 "Time taken for IPv6 Ping All: " +
2792 str( timeDiff ) +
2793 " seconds" )
2794 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2795 onpass="PING ALL PASS",
2796 onfail="PING ALL FAIL" )
2797
GlennRCbddd58f2015-10-01 15:45:25 -07002798 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002799 utilities.assert_equals(
2800 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002801 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002802 onpass="IPv6 Ping across 300 host intents test PASS",
2803 onfail="IPv6 Ping across 300 host intents test FAIL" )
2804
2805 def CASE182( self ):
2806 """
2807 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2808 """
2809 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2810 main.log.report( "_________________________________________________" )
2811 import itertools
2812 import time
2813 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2814 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002815 pingResult = main.FALSE
2816 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002817 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002818 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002819 main.log.warn("First ping failed. Retrying...")
2820 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002821 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002822 time2 = time.time()
2823 timeDiff = round( ( time2 - time1 ), 2 )
2824 main.log.report(
2825 "Time taken for IPv6 Ping All: " +
2826 str( timeDiff ) +
2827 " seconds" )
2828 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2829 onpass="PING ALL PASS",
2830 onfail="PING ALL FAIL" )
2831
GlennRCbddd58f2015-10-01 15:45:25 -07002832 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002833 utilities.assert_equals(
2834 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002835 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002836 onpass="IPv6 Ping across 300 host intents test PASS",
2837 onfail="IPv6 Ping across 300 host intents test FAIL" )
2838
2839 def CASE173( self ):
2840 """
2841 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2842 """
2843 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2844 main.log.report( "_________________________________________________" )
2845 import itertools
2846 import time
2847 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2848 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002849 pingResult = main.FALSE
2850 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002851 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002852 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002853 main.log.warn("First ping failed. Retrying...")
2854 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002855 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002856 time2 = time.time()
2857 timeDiff = round( ( time2 - time1 ), 2 )
2858 main.log.report(
2859 "Time taken for IPv6 Ping All: " +
2860 str( timeDiff ) +
2861 " seconds" )
2862 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2863 onpass="PING ALL PASS",
2864 onfail="PING ALL FAIL" )
2865
GlennRCbddd58f2015-10-01 15:45:25 -07002866 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002867 utilities.assert_equals(
2868 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002869 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002870 onpass="IPv6 Ping across 600 point intents test PASS",
2871 onfail="IPv6 Ping across 600 point intents test FAIL" )
2872
2873 def CASE183( self ):
2874 """
2875 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2876 """
2877 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2878 main.log.report( "_________________________________________________" )
2879 import itertools
2880 import time
2881 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2882 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002883 pingResult = main.FALSE
2884 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002885 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002886 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002887 main.log.warn("First ping failed. Retrying...")
2888 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002889 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002890 time2 = time.time()
2891 timeDiff = round( ( time2 - time1 ), 2 )
2892 main.log.report(
2893 "Time taken for IPv6 Ping All: " +
2894 str( timeDiff ) +
2895 " seconds" )
2896 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2897 onpass="PING ALL PASS",
2898 onfail="PING ALL FAIL" )
2899
GlennRCbddd58f2015-10-01 15:45:25 -07002900 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002901 utilities.assert_equals(
2902 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002903 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002904 onpass="IPv6 Ping across 600 Point intents test PASS",
2905 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2906
2907 def CASE174( self ):
2908 """
2909 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2910 """
2911 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2912 main.log.report( "_________________________________________________" )
2913 import itertools
2914 import time
2915 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2916 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002917 pingResult = main.FALSE
2918 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002919 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002920 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002921 main.log.warn("First ping failed. Retrying...")
2922 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002923 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002924 time2 = time.time()
2925 timeDiff = round( ( time2 - time1 ), 2 )
2926 main.log.report(
2927 "Time taken for IPv6 Ping All: " +
2928 str( timeDiff ) +
2929 " seconds" )
2930 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2931 onpass="PING ALL PASS",
2932 onfail="PING ALL FAIL" )
2933
GlennRCbddd58f2015-10-01 15:45:25 -07002934 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002935 utilities.assert_equals(
2936 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002937 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002938 onpass="IPv6 Ping across 2278 host intents test PASS",
2939 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2940
2941 def CASE184( self ):
2942 """
2943 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2944 """
2945 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2946 main.log.report( "_________________________________________________" )
2947 import itertools
2948 import time
2949 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2950 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002951 pingResult = main.FALSE
2952 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002953 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002954 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002955 main.log.warn("First ping failed. Retrying...")
2956 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002957 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002958 time2 = time.time()
2959 timeDiff = round( ( time2 - time1 ), 2 )
2960 main.log.report(
2961 "Time taken for IPv6 Ping All: " +
2962 str( timeDiff ) +
2963 " seconds" )
2964 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2965 onpass="PING ALL PASS",
2966 onfail="PING ALL FAIL" )
2967
GlennRCbddd58f2015-10-01 15:45:25 -07002968 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002969 utilities.assert_equals(
2970 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002971 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002972 onpass="IPv6 Ping across 2278 host intents test PASS",
2973 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2974
2975 def CASE175( self ):
2976 """
2977 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2978 """
2979 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2980 main.log.report( "_________________________________________________" )
2981 import itertools
2982 import time
2983 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2984 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002985 pingResult = main.FALSE
2986 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002987 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002988 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002989 main.log.warn("First ping failed. Retrying...")
2990 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002991 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002992 time2 = time.time()
2993 timeDiff = round( ( time2 - time1 ), 2 )
2994 main.log.report(
2995 "Time taken for IPv6 Ping All: " +
2996 str( timeDiff ) +
2997 " seconds" )
2998 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2999 onpass="PING ALL PASS",
3000 onfail="PING ALL FAIL" )
3001
GlennRCbddd58f2015-10-01 15:45:25 -07003002 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003003 utilities.assert_equals(
3004 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003005 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003006 onpass="IPv6 Ping across 4556 point intents test PASS",
3007 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3008
3009 def CASE185( self ):
3010 """
3011 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3012 """
3013 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3014 main.log.report( "_________________________________________________" )
3015 import itertools
3016 import time
3017 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3018 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003019 pingResult = main.FALSE
3020 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003021 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003022 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003023 main.log.warn("First ping failed. Retrying...")
3024 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003025 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003026 time2 = time.time()
3027 timeDiff = round( ( time2 - time1 ), 2 )
3028 main.log.report(
3029 "Time taken for IPv6 Ping All: " +
3030 str( timeDiff ) +
3031 " seconds" )
3032 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3033 onpass="PING ALL PASS",
3034 onfail="PING ALL FAIL" )
3035
GlennRCbddd58f2015-10-01 15:45:25 -07003036 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003037 utilities.assert_equals(
3038 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003039 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003040 onpass="IPv6 Ping across 4556 Point intents test PASS",
3041 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3042
Hari Krishnac195f3b2015-07-08 20:02:24 -07003043 def CASE90( self ):
3044 """
3045 Install 600 point intents and verify ping all (Att Topology)
3046 """
3047 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3048 main.log.report( "_______________________________________" )
3049 import itertools
3050 import time
3051 main.case( "Install 600 point intents" )
3052 main.step( "Add point Intents" )
3053 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003054 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3055
Hari Krishnac195f3b2015-07-08 20:02:24 -07003056 intentIdList = []
3057 time1 = time.time()
3058 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3059 pool = []
3060 for cli in main.CLIs:
3061 if i >= len( deviceCombos ):
3062 break
3063 t = main.Thread( target=cli.addPointIntent,
3064 threadID=main.threadID,
3065 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003066 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 -07003067 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003068 t.start()
3069 i = i + 1
3070 main.threadID = main.threadID + 1
3071 for thread in pool:
3072 thread.join()
3073 intentIdList.append(thread.result)
3074 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003075 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003076
GlennRCfcfdc4f2015-09-30 16:01:57 -07003077 # Saving intent ids to check intents in later case
3078 main.intentIds = list(intentIdList)
3079
GlennRCa8d786a2015-09-23 17:40:11 -07003080 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003081
GlennRC1dde1712015-10-02 11:03:08 -07003082 # Giving onos multiple chances to install intents
3083 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003084 if i != 0:
3085 main.log.warn( "Verification failed. Retrying..." )
3086 main.log.info("Waiting for onos to install intents...")
3087 time.sleep( main.checkIntentsDelay )
3088
GlennRCa8d786a2015-09-23 17:40:11 -07003089 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003090 for e in range(int(main.numCtrls)):
3091 main.log.info( "Checking intents on CLI %s" % (e+1) )
3092 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3093 intentState
3094 if not intentState:
3095 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003096 if intentState:
3097 break
GlennRCdb2c8422015-09-29 12:21:59 -07003098 else:
3099 #Dumping intent summary
3100 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003101
3102 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3103 onpass="INTENTS INSTALLED",
3104 onfail="SOME INTENTS NOT INSTALLED" )
3105
Hari Krishnac195f3b2015-07-08 20:02:24 -07003106 main.step( "Verify Ping across all hosts" )
3107 pingResult = main.FALSE
3108 time1 = time.time()
3109 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3110 time2 = time.time()
3111 timeDiff = round( ( time2 - time1 ), 2 )
3112 main.log.report(
3113 "Time taken for Ping All: " +
3114 str( timeDiff ) +
3115 " seconds" )
3116 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3117 onpass="PING tALL PASS",
3118 onfail="PING ALL FAIL" )
3119
GlennRCbddd58f2015-10-01 15:45:25 -07003120 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003121
Hari Krishnac195f3b2015-07-08 20:02:24 -07003122 utilities.assert_equals(
3123 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003124 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003125 onpass="Install 600 point Intents and Ping All test PASS",
3126 onfail="Install 600 point Intents and Ping All test FAIL" )
3127
GlennRCbddd58f2015-10-01 15:45:25 -07003128 if not intentState:
3129 main.log.debug( "Intents failed to install completely" )
3130 if not pingResult:
3131 main.log.debug( "Pingall failed" )
3132
3133 if not caseResult and main.failSwitch:
3134 main.log.report("Stopping test")
3135 main.stop( email=main.emailOnStop )
3136
Hari Krishnac195f3b2015-07-08 20:02:24 -07003137 def CASE91( self ):
3138 """
3139 Install 600 point intents and verify ping all (Chordal Topology)
3140 """
3141 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3142 main.log.report( "_______________________________________" )
3143 import itertools
3144 import time
3145 main.case( "Install 600 point intents" )
3146 main.step( "Add point Intents" )
3147 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003148 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3149
Hari Krishnac195f3b2015-07-08 20:02:24 -07003150 intentIdList = []
3151 time1 = time.time()
3152 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3153 pool = []
3154 for cli in main.CLIs:
3155 if i >= len( deviceCombos ):
3156 break
3157 t = main.Thread( target=cli.addPointIntent,
3158 threadID=main.threadID,
3159 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003160 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 -07003161 pool.append(t)
3162 #time.sleep(1)
3163 t.start()
3164 i = i + 1
3165 main.threadID = main.threadID + 1
3166 for thread in pool:
3167 thread.join()
3168 intentIdList.append(thread.result)
3169 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003170 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003171
GlennRCfcfdc4f2015-09-30 16:01:57 -07003172 # Saving intent ids to check intents in later case
3173 main.intentIds = list(intentIdList)
3174
GlennRCa8d786a2015-09-23 17:40:11 -07003175 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003176
GlennRC1dde1712015-10-02 11:03:08 -07003177 # Giving onos multiple chances to install intents
3178 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003179 if i != 0:
3180 main.log.warn( "Verification failed. Retrying..." )
3181 main.log.info("Waiting for onos to install intents...")
3182 time.sleep( main.checkIntentsDelay )
3183
GlennRCa8d786a2015-09-23 17:40:11 -07003184 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003185 for e in range(int(main.numCtrls)):
3186 main.log.info( "Checking intents on CLI %s" % (e+1) )
3187 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3188 intentState
3189 if not intentState:
3190 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003191 if intentState:
3192 break
GlennRCdb2c8422015-09-29 12:21:59 -07003193 else:
3194 #Dumping intent summary
3195 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003196
3197 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3198 onpass="INTENTS INSTALLED",
3199 onfail="SOME INTENTS NOT INSTALLED" )
3200
Hari Krishnac195f3b2015-07-08 20:02:24 -07003201 main.step( "Verify Ping across all hosts" )
3202 pingResult = main.FALSE
3203 time1 = time.time()
3204 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3205 time2 = time.time()
3206 timeDiff = round( ( time2 - time1 ), 2 )
3207 main.log.report(
3208 "Time taken for Ping All: " +
3209 str( timeDiff ) +
3210 " seconds" )
3211 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3212 onpass="PING ALL PASS",
3213 onfail="PING ALL FAIL" )
3214
GlennRCbddd58f2015-10-01 15:45:25 -07003215 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003216
Hari Krishnac195f3b2015-07-08 20:02:24 -07003217 utilities.assert_equals(
3218 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003219 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 onpass="Install 600 point Intents and Ping All test PASS",
3221 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003222
GlennRCbddd58f2015-10-01 15:45:25 -07003223 if not intentState:
3224 main.log.debug( "Intents failed to install completely" )
3225 if not pingResult:
3226 main.log.debug( "Pingall failed" )
3227
3228 if not caseResult and main.failSwitch:
3229 main.log.report("Stopping test")
3230 main.stop( email=main.emailOnStop )
3231
Hari Krishnac195f3b2015-07-08 20:02:24 -07003232 def CASE92( self ):
3233 """
3234 Install 4556 point intents and verify ping all (Spine Topology)
3235 """
3236 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3237 main.log.report( "_______________________________________" )
3238 import itertools
3239 import time
3240 main.case( "Install 4556 point intents" )
3241 main.step( "Add point Intents" )
3242 intentResult = main.TRUE
3243 main.pingTimeout = 600
3244 for i in range(len(main.hostMACs)):
3245 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3246 print main.MACsDict
3247 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3248 intentIdList = []
3249 time1 = time.time()
3250 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3251 pool = []
3252 for cli in main.CLIs:
3253 if i >= len( deviceCombos ):
3254 break
3255 t = main.Thread( target=cli.addPointIntent,
3256 threadID=main.threadID,
3257 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003258 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 -07003259 pool.append(t)
3260 #time.sleep(1)
3261 t.start()
3262 i = i + 1
3263 main.threadID = main.threadID + 1
3264 for thread in pool:
3265 thread.join()
3266 intentIdList.append(thread.result)
3267 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003268 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003269
GlennRCfcfdc4f2015-09-30 16:01:57 -07003270 # Saving intent ids to check intents in later case
3271 main.intentIds = list(intentIdList)
3272
GlennRCa8d786a2015-09-23 17:40:11 -07003273 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003274
GlennRC1dde1712015-10-02 11:03:08 -07003275 # Giving onos multiple chances to install intents
3276 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003277 if i != 0:
3278 main.log.warn( "Verification failed. Retrying..." )
3279 main.log.info("Waiting for onos to install intents...")
3280 time.sleep( main.checkIntentsDelay )
3281
GlennRCa8d786a2015-09-23 17:40:11 -07003282 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003283 for e in range(int(main.numCtrls)):
3284 main.log.info( "Checking intents on CLI %s" % (e+1) )
3285 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3286 intentState
3287 if not intentState:
3288 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003289 if intentState:
3290 break
GlennRCdb2c8422015-09-29 12:21:59 -07003291 else:
3292 #Dumping intent summary
3293 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003294
3295 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3296 onpass="INTENTS INSTALLED",
3297 onfail="SOME INTENTS NOT INSTALLED" )
3298
Hari Krishnac195f3b2015-07-08 20:02:24 -07003299 main.step( "Verify Ping across all hosts" )
3300 pingResult = main.FALSE
3301 time1 = time.time()
3302 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3303 time2 = time.time()
3304 timeDiff = round( ( time2 - time1 ), 2 )
3305 main.log.report(
3306 "Time taken for Ping All: " +
3307 str( timeDiff ) +
3308 " seconds" )
3309 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3310 onpass="PING ALL PASS",
3311 onfail="PING ALL FAIL" )
3312
GlennRCbddd58f2015-10-01 15:45:25 -07003313 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003314
Hari Krishnac195f3b2015-07-08 20:02:24 -07003315 utilities.assert_equals(
3316 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003317 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003318 onpass="Install 4556 point Intents and Ping All test PASS",
3319 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003320
GlennRCbddd58f2015-10-01 15:45:25 -07003321 if not intentState:
3322 main.log.debug( "Intents failed to install completely" )
3323 if not pingResult:
3324 main.log.debug( "Pingall failed" )
3325
3326 if not caseResult and main.failSwitch:
3327 main.log.report("Stopping test")
3328 main.stop( email=main.emailOnStop )
3329
Hari Krishnac195f3b2015-07-08 20:02:24 -07003330 def CASE93( self ):
3331 """
3332 Install multi-single point intents and verify Ping all works
3333 for att topology
3334 """
3335 import copy
3336 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003337 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003338 main.log.report( "Install multi-single point intents and verify Ping all" )
3339 main.log.report( "___________________________________________" )
3340 main.case( "Install multi-single point intents and Ping all" )
3341 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3342 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3343 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003344 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003345 time1 = time.time()
3346 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3347 pool = []
3348 for cli in main.CLIs:
3349 egressDevice = deviceDPIDsCopy[i]
3350 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3351 ingressDeviceList.remove(egressDevice)
3352 if i >= len( deviceDPIDsCopy ):
3353 break
3354 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3355 threadID=main.threadID,
3356 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003357 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003358 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003359 t.start()
3360 i = i + 1
3361 main.threadID = main.threadID + 1
3362 for thread in pool:
3363 thread.join()
3364 intentIdList.append(thread.result)
3365 time2 = time.time()
3366 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003367
GlennRCdb2c8422015-09-29 12:21:59 -07003368 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003369
GlennRC1dde1712015-10-02 11:03:08 -07003370 # Giving onos multiple chances to install intents
3371 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003372 if i != 0:
3373 main.log.warn( "Verification failed. Retrying..." )
3374 main.log.info("Waiting for onos to install intents...")
3375 time.sleep( main.checkIntentsDelay )
3376
3377 intentState = main.TRUE
3378 for e in range(int(main.numCtrls)):
3379 main.log.info( "Checking intents on CLI %s" % (e+1) )
3380 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3381 intentState
3382 if not intentState:
3383 main.log.warn( "Not all intents installed" )
3384 if intentState:
3385 break
3386 else:
3387 #Dumping intent summary
3388 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3389
3390 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3391 onpass="INTENTS INSTALLED",
3392 onfail="SOME INTENTS NOT INSTALLED" )
3393
3394 main.log.info( "Checking flows state" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003395 checkFlowsState = main.ONOScli1.checkFlowsState()
GlennRCdb2c8422015-09-29 12:21:59 -07003396 # Giving onos time to return the state of the flows
Hari Krishnac195f3b2015-07-08 20:02:24 -07003397 time.sleep(50)
GlennRCdb2c8422015-09-29 12:21:59 -07003398
Hari Krishnac195f3b2015-07-08 20:02:24 -07003399 main.step( "Verify Ping across all hosts" )
3400 pingResult = main.FALSE
3401 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003402 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3403 if not pingResult:
3404 time1 = time.time()
3405 main.log.warn("First pingall failed. Retrying")
3406 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3407
Hari Krishnac195f3b2015-07-08 20:02:24 -07003408 time2 = time.time()
3409 timeDiff = round( ( time2 - time1 ), 2 )
3410 main.log.report(
3411 "Time taken for Ping All: " +
3412 str( timeDiff ) +
3413 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003414
GlennRCbddd58f2015-10-01 15:45:25 -07003415 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003416 utilities.assert_equals(
3417 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003418 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003419 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3420 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003421
Hari Krishnac195f3b2015-07-08 20:02:24 -07003422 def CASE94( self ):
3423 """
3424 Install multi-single point intents and verify Ping all works
3425 for Chordal topology
3426 """
3427 import copy
3428 import time
3429 main.log.report( "Install multi-single point intents and verify Ping all" )
3430 main.log.report( "___________________________________________" )
3431 main.case( "Install multi-single point intents and Ping all" )
3432 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3433 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3434 intentIdList = []
3435 print "MACsDict", main.MACsDict
3436 time1 = time.time()
3437 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3438 pool = []
3439 for cli in main.CLIs:
3440 egressDevice = deviceDPIDsCopy[i]
3441 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3442 ingressDeviceList.remove(egressDevice)
3443 if i >= len( deviceDPIDsCopy ):
3444 break
3445 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3446 threadID=main.threadID,
3447 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003448 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003449 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003450 t.start()
3451 i = i + 1
3452 main.threadID = main.threadID + 1
3453 for thread in pool:
3454 thread.join()
3455 intentIdList.append(thread.result)
3456 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003457 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003458
3459 main.step("Verify intents are installed")
3460
GlennRC1dde1712015-10-02 11:03:08 -07003461 # Giving onos multiple chances to install intents
3462 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003463 if i != 0:
3464 main.log.warn( "Verification failed. Retrying..." )
3465 main.log.info("Waiting for onos to install intents...")
3466 time.sleep( main.checkIntentsDelay )
3467
3468 intentState = main.TRUE
3469 for e in range(int(main.numCtrls)):
3470 main.log.info( "Checking intents on CLI %s" % (e+1) )
3471 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3472 intentState
3473 if not intentState:
3474 main.log.warn( "Not all intents installed" )
3475 if intentState:
3476 break
3477 else:
3478 #Dumping intent summary
3479 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3480
3481
3482 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3483 onpass="INTENTS INSTALLED",
3484 onfail="SOME INTENTS NOT INSTALLED" )
3485
Hari Krishnac195f3b2015-07-08 20:02:24 -07003486 main.step( "Verify Ping across all hosts" )
3487 pingResult = main.FALSE
3488 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003489 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3490 if not pingResult:
3491 main.log.info( "First pingall failed. Retrying..." )
3492 time1 = time.time()
3493 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003494 time2 = time.time()
3495 timeDiff = round( ( time2 - time1 ), 2 )
3496 main.log.report(
3497 "Time taken for Ping All: " +
3498 str( timeDiff ) +
3499 " seconds" )
3500
GlennRCdb2c8422015-09-29 12:21:59 -07003501
GlennRCbddd58f2015-10-01 15:45:25 -07003502 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003503 utilities.assert_equals(
3504 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003505 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003506 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3507 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003508
Hari Krishnac195f3b2015-07-08 20:02:24 -07003509 #def CASE95 multi-single point intent for Spine
3510
3511 def CASE96( self ):
3512 """
3513 Install single-multi point intents and verify Ping all works
3514 for att topology
3515 """
3516 import copy
3517 main.log.report( "Install single-multi point intents and verify Ping all" )
3518 main.log.report( "___________________________________________" )
3519 main.case( "Install single-multi point intents and Ping all" )
3520 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3521 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3522 intentIdList = []
3523 print "MACsDict", main.MACsDict
3524 time1 = time.time()
3525 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3526 pool = []
3527 for cli in main.CLIs:
3528 ingressDevice = deviceDPIDsCopy[i]
3529 egressDeviceList = copy.copy(deviceDPIDsCopy)
3530 egressDeviceList.remove(ingressDevice)
3531 if i >= len( deviceDPIDsCopy ):
3532 break
3533 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3534 threadID=main.threadID,
3535 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003536 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003537 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003538 t.start()
3539 i = i + 1
3540 main.threadID = main.threadID + 1
3541 for thread in pool:
3542 thread.join()
3543 intentIdList.append(thread.result)
3544 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003545 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003546
3547 main.step("Verify intents are installed")
3548
GlennRC1dde1712015-10-02 11:03:08 -07003549 # Giving onos multiple chances to install intents
3550 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003551 if i != 0:
3552 main.log.warn( "Verification failed. Retrying..." )
3553 main.log.info("Waiting for onos to install intents...")
3554 time.sleep( main.checkIntentsDelay )
3555
3556 intentState = main.TRUE
3557 for e in range(int(main.numCtrls)):
3558 main.log.info( "Checking intents on CLI %s" % (e+1) )
3559 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3560 intentState
3561 if not intentState:
3562 main.log.warn( "Not all intents installed" )
3563 if intentState:
3564 break
3565 else:
3566 #Dumping intent summary
3567 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3568
3569
3570 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3571 onpass="INTENTS INSTALLED",
3572 onfail="SOME INTENTS NOT INSTALLED" )
3573
Hari Krishnac195f3b2015-07-08 20:02:24 -07003574 main.step( "Verify Ping across all hosts" )
3575 pingResult = main.FALSE
3576 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003577 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3578 if not pingResult:
3579 main.log.info( "First pingall failed. Retrying..." )
3580 time1 = time.time()
3581 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003582 time2 = time.time()
3583 timeDiff = round( ( time2 - time1 ), 2 )
3584 main.log.report(
3585 "Time taken for Ping All: " +
3586 str( timeDiff ) +
3587 " seconds" )
3588
GlennRCbddd58f2015-10-01 15:45:25 -07003589 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003590 utilities.assert_equals(
3591 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003592 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003593 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3594 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3595
3596 def CASE97( self ):
3597 """
3598 Install single-multi point intents and verify Ping all works
3599 for Chordal topology
3600 """
3601 import copy
3602 main.log.report( "Install single-multi point intents and verify Ping all" )
3603 main.log.report( "___________________________________________" )
3604 main.case( "Install single-multi point intents and Ping all" )
3605 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3606 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3607 intentIdList = []
3608 print "MACsDict", main.MACsDict
3609 time1 = time.time()
3610 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3611 pool = []
3612 for cli in main.CLIs:
3613 ingressDevice = deviceDPIDsCopy[i]
3614 egressDeviceList = copy.copy(deviceDPIDsCopy)
3615 egressDeviceList.remove(ingressDevice)
3616 if i >= len( deviceDPIDsCopy ):
3617 break
3618 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3619 threadID=main.threadID,
3620 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003621 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003622 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003623 t.start()
3624 i = i + 1
3625 main.threadID = main.threadID + 1
3626 for thread in pool:
3627 thread.join()
3628 intentIdList.append(thread.result)
3629 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003630 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003631
3632 main.step("Verify intents are installed")
3633
GlennRC1dde1712015-10-02 11:03:08 -07003634 # Giving onos multiple chances to install intents
3635 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003636 if i != 0:
3637 main.log.warn( "Verification failed. Retrying..." )
3638 main.log.info("Waiting for onos to install intents...")
3639 time.sleep( main.checkIntentsDelay )
3640
3641 intentState = main.TRUE
3642 for e in range(int(main.numCtrls)):
3643 main.log.info( "Checking intents on CLI %s" % (e+1) )
3644 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3645 intentState
3646 if not intentState:
3647 main.log.warn( "Not all intents installed" )
3648 if intentState:
3649 break
3650 else:
3651 #Dumping intent summary
3652 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3653
3654
3655 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3656 onpass="INTENTS INSTALLED",
3657 onfail="SOME INTENTS NOT INSTALLED" )
3658
Hari Krishnac195f3b2015-07-08 20:02:24 -07003659 main.step( "Verify Ping across all hosts" )
3660 pingResult = main.FALSE
3661 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003662 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3663 if not pingResult:
3664 main.log.info( "First pingall failed. Retrying..." )
3665 time1 = time.time()
3666 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003667 time2 = time.time()
3668 timeDiff = round( ( time2 - time1 ), 2 )
3669 main.log.report(
3670 "Time taken for Ping All: " +
3671 str( timeDiff ) +
3672 " seconds" )
3673
GlennRCbddd58f2015-10-01 15:45:25 -07003674 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003675 utilities.assert_equals(
3676 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003677 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003678 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3679 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3680
3681 def CASE98( self ):
3682 """
3683 Install single-multi point intents and verify Ping all works
3684 for Spine topology
3685 """
3686 import copy
3687 main.log.report( "Install single-multi point intents and verify Ping all" )
3688 main.log.report( "___________________________________________" )
3689 main.case( "Install single-multi point intents and Ping all" )
3690 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3691 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3692 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3693 intentIdList = []
3694 MACsDictCopy = {}
3695 for i in range( len( deviceDPIDsCopy ) ):
3696 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3697
3698 print "deviceDPIDsCopy", deviceDPIDsCopy
3699 print ""
3700 print "MACsDictCopy", MACsDictCopy
3701 time1 = time.time()
3702 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3703 pool = []
3704 for cli in main.CLIs:
3705 if i >= len( deviceDPIDsCopy ):
3706 break
3707 ingressDevice = deviceDPIDsCopy[i]
3708 egressDeviceList = copy.copy(deviceDPIDsCopy)
3709 egressDeviceList.remove(ingressDevice)
3710 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3711 threadID=main.threadID,
3712 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003713 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003714 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003715 t.start()
3716 i = i + 1
3717 main.threadID = main.threadID + 1
3718 for thread in pool:
3719 thread.join()
3720 intentIdList.append(thread.result)
3721 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003722 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003723
3724 main.step("Verify intents are installed")
3725
GlennRC1dde1712015-10-02 11:03:08 -07003726 # Giving onos multiple chances to install intents
3727 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003728 if i != 0:
3729 main.log.warn( "Verification failed. Retrying..." )
3730 main.log.info("Waiting for onos to install intents...")
3731 time.sleep( main.checkIntentsDelay )
3732
3733 intentState = main.TRUE
3734 for e in range(int(main.numCtrls)):
3735 main.log.info( "Checking intents on CLI %s" % (e+1) )
3736 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3737 intentState
3738 if not intentState:
3739 main.log.warn( "Not all intents installed" )
3740 if intentState:
3741 break
3742 else:
3743 #Dumping intent summary
3744 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3745
3746
3747 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3748 onpass="INTENTS INSTALLED",
3749 onfail="SOME INTENTS NOT INSTALLED" )
3750
Hari Krishnac195f3b2015-07-08 20:02:24 -07003751 main.step( "Verify Ping across all hosts" )
3752 pingResult = main.FALSE
3753 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003754 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3755 if not pingResult:
3756 main.log.info( "First pingall failed. Retrying..." )
3757 time1 = time.time()
3758 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003759 time2 = time.time()
3760 timeDiff = round( ( time2 - time1 ), 2 )
3761 main.log.report(
3762 "Time taken for Ping All: " +
3763 str( timeDiff ) +
3764 " seconds" )
3765
GlennRCbddd58f2015-10-01 15:45:25 -07003766 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003767 utilities.assert_equals(
3768 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003769 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003770 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3771 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3772
Hari Krishna4223dbd2015-08-13 16:29:53 -07003773 def CASE190( self ):
3774 """
3775 Verify IPv6 ping across 600 Point intents (Att Topology)
3776 """
3777 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3778 main.log.report( "_________________________________________________" )
3779 import itertools
3780 import time
3781 main.case( "IPv6 ping all 600 Point intents" )
3782 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003783 pingResult = main.FALSE
3784 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003785 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003786 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003787 main.log.warn("First pingall failed. Retrying...")
3788 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003789 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003790 time2 = time.time()
3791 timeDiff = round( ( time2 - time1 ), 2 )
3792 main.log.report(
3793 "Time taken for IPv6 Ping All: " +
3794 str( timeDiff ) +
3795 " seconds" )
3796 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3797 onpass="PING ALL PASS",
3798 onfail="PING ALL FAIL" )
3799
GlennRCbddd58f2015-10-01 15:45:25 -07003800 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003801 utilities.assert_equals(
3802 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003803 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003804 onpass="IPv6 Ping across 600 Point intents test PASS",
3805 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3806
3807 def CASE191( self ):
3808 """
3809 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3810 """
3811 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3812 main.log.report( "_________________________________________________" )
3813 import itertools
3814 import time
3815 main.case( "IPv6 ping all 600 Point intents" )
3816 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003817 pingResult = main.FALSE
3818 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003819 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003820 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003821 main.log.warn("First pingall failed. Retrying...")
3822 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003823 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003824 time2 = time.time()
3825 timeDiff = round( ( time2 - time1 ), 2 )
3826 main.log.report(
3827 "Time taken for IPv6 Ping All: " +
3828 str( timeDiff ) +
3829 " seconds" )
3830 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3831 onpass="PING ALL PASS",
3832 onfail="PING ALL FAIL" )
3833
GlennRCbddd58f2015-10-01 15:45:25 -07003834 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003835 utilities.assert_equals(
3836 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003837 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003838 onpass="IPv6 Ping across 600 Point intents test PASS",
3839 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3840
3841 def CASE192( self ):
3842 """
3843 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3844 """
3845 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3846 main.log.report( "_________________________________________________" )
3847 import itertools
3848 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003849 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003850 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003851 pingResult = main.FALSE
3852 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003853 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07003854 if not pingResult:
3855 main.log.warn("First pingall failed. Retrying...")
3856 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003857 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003858 time2 = time.time()
3859 timeDiff = round( ( time2 - time1 ), 2 )
3860 main.log.report(
3861 "Time taken for IPv6 Ping All: " +
3862 str( timeDiff ) +
3863 " seconds" )
3864 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3865 onpass="PING ALL PASS",
3866 onfail="PING ALL FAIL" )
3867
GlennRCbddd58f2015-10-01 15:45:25 -07003868 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003869 utilities.assert_equals(
3870 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003871 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003872 onpass="IPv6 Ping across 4556 Point intents test PASS",
3873 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003874
Hari Krishnac195f3b2015-07-08 20:02:24 -07003875 def CASE10( self ):
3876 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003877 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003878 """
3879 Remove all Intents
3880 """
3881 main.log.report( "Remove all intents that were installed previously" )
3882 main.log.report( "______________________________________________" )
3883 main.log.info( "Remove all intents" )
3884 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003885 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003886 main.step( "Obtain the intent id's first" )
3887 intentsList = main.ONOScli1.getAllIntentIds()
3888 ansi_escape = re.compile( r'\x1b[^m]*m' )
3889 intentsList = ansi_escape.sub( '', intentsList )
3890 intentsList = intentsList.replace(
3891 " onos:intents | grep id=",
3892 "" ).replace(
3893 "id=",
3894 "" ).replace(
3895 "\r\r",
3896 "" )
3897 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003898 intentIdList = []
3899 step1Result = main.TRUE
3900 moreIntents = main.TRUE
3901 removeIntentCount = 0
3902 intentsCount = len(intentsList)
3903 main.log.info ( "Current number of intents: " + str(intentsCount) )
3904 if ( len( intentsList ) > 1 ):
3905 results = main.TRUE
3906 main.log.info("Removing intent...")
3907 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003908 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003909 if removeIntentCount == 5:
3910 break
3911 removeIntentCount = removeIntentCount + 1
3912 intentsList1 = main.ONOScli1.getAllIntentIds()
3913 if len( intentsList1 ) == 0:
3914 break
3915 ansi_escape = re.compile( r'\x1b[^m]*m' )
3916 intentsList1 = ansi_escape.sub( '', intentsList1 )
3917 intentsList1 = intentsList1.replace(
3918 " onos:intents | grep id=",
3919 "" ).replace(
3920 " state=",
3921 "" ).replace(
3922 "\r\r",
3923 "" )
3924 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003925 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3926 print intentsList1
3927 intentIdList1 = []
3928 if ( len( intentsList1 ) > 0 ):
3929 moreIntents = main.TRUE
3930 for i in range( len( intentsList1 ) ):
3931 intentsTemp1 = intentsList1[ i ].split( ',' )
3932 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3933 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3934 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3935 time1 = time.time()
3936 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3937 pool = []
3938 for cli in main.CLIs:
3939 if i >= len( intentIdList1 ):
3940 break
3941 t = main.Thread( target=cli.removeIntent,
3942 threadID=main.threadID,
3943 name="removeIntent",
3944 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3945 pool.append(t)
3946 t.start()
3947 i = i + 1
3948 main.threadID = main.threadID + 1
3949 for thread in pool:
3950 thread.join()
3951 intentIdList.append(thread.result)
3952 #time.sleep(2)
3953 time2 = time.time()
3954 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003955 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003956 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003957 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003958 else:
3959 time.sleep(10)
3960 if len( main.ONOScli1.intents()):
3961 continue
3962 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003963 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003964 else:
3965 print "Removed %d intents" %(intentsCount)
3966 step1Result = main.TRUE
3967 else:
3968 print "No Intent IDs found in Intents list: ", intentsList
3969 step1Result = main.FALSE
3970
3971 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07003972 caseResult = step1Result
3973 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003974 onpass="Intent removal test successful",
3975 onfail="Intent removal test failed" )
3976
3977 def CASE12( self, main ):
3978 """
3979 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3980 """
3981 import re
3982 import copy
3983 import time
3984
Hari Krishnac195f3b2015-07-08 20:02:24 -07003985 threadID = 0
3986
3987 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3988 main.log.report( "_____________________________________________________" )
3989 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3990 main.step( "Enable intent based Reactive forwarding" )
3991 installResult = main.FALSE
3992 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003993
Hari Krishnac195f3b2015-07-08 20:02:24 -07003994 pool = []
3995 time1 = time.time()
3996 for cli,feature in main.CLIs:
3997 t = main.Thread(target=cli,threadID=threadID,
3998 name="featureInstall",args=[feature])
3999 pool.append(t)
4000 t.start()
4001 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004002
Hari Krishnac195f3b2015-07-08 20:02:24 -07004003 results = []
4004 for thread in pool:
4005 thread.join()
4006 results.append(thread.result)
4007 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004008
Hari Krishnac195f3b2015-07-08 20:02:24 -07004009 if( all(result == main.TRUE for result in results) == False):
4010 main.log.info("Did not install onos-app-ifwd feature properly")
4011 #main.cleanup()
4012 #main.exit()
4013 else:
4014 main.log.info("Successful feature:install onos-app-ifwd")
4015 installResult = main.TRUE
4016 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004017
Hari Krishnac195f3b2015-07-08 20:02:24 -07004018 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07004019 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07004020 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07004021 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004022 time2 = time.time()
4023 timeDiff = round( ( time2 - time1 ), 2 )
4024 main.log.report(
4025 "Time taken for Ping All: " +
4026 str( timeDiff ) +
4027 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004028
GlennRC626ba132015-09-18 16:16:31 -07004029 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004030 main.log.report( "Pingall Test in Reactive mode successful" )
4031 else:
4032 main.log.report( "Pingall Test in Reactive mode failed" )
4033
4034 main.step( "Disable Intent based Reactive forwarding" )
4035 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004036
Hari Krishnac195f3b2015-07-08 20:02:24 -07004037 pool = []
4038 time1 = time.time()
4039 for cli,feature in main.CLIs:
4040 t = main.Thread(target=cli,threadID=threadID,
4041 name="featureUninstall",args=[feature])
4042 pool.append(t)
4043 t.start()
4044 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004045
Hari Krishnac195f3b2015-07-08 20:02:24 -07004046 results = []
4047 for thread in pool:
4048 thread.join()
4049 results.append(thread.result)
4050 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004051
Hari Krishnac195f3b2015-07-08 20:02:24 -07004052 if( all(result == main.TRUE for result in results) == False):
4053 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4054 uninstallResult = main.FALSE
4055 #main.cleanup()
4056 #main.exit()
4057 else:
4058 main.log.info("Successful feature:uninstall onos-app-ifwd")
4059 uninstallResult = main.TRUE
4060 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4061
4062 # Waiting for reative flows to be cleared.
4063 time.sleep( 10 )
4064
GlennRCbddd58f2015-10-01 15:45:25 -07004065 caseResult = installResult and pingResult and uninstallResult
4066 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004067 onpass="Intent based Reactive forwarding Pingall test PASS",
4068 onfail="Intent based Reactive forwarding Pingall test FAIL" )