blob: 417ccc5cb302ff7825a176e97e661c587bfeadb6 [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" )
1266 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1267 pingResult = main.FALSE
1268 time1 = time.time()
1269 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001270 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001271 main.log.warn("First pingall failed. Retrying...")
1272 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001273 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001274 time2 = time.time()
1275 timeDiff = round( ( time2 - time1 ), 2 )
1276 main.log.report(
1277 "Time taken for IPv6 Ping All: " +
1278 str( timeDiff ) +
1279 " seconds" )
1280 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1281 onpass="PING ALL PASS",
1282 onfail="PING ALL FAIL" )
1283
GlennRCbddd58f2015-10-01 15:45:25 -07001284 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001285 utilities.assert_equals(
1286 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001287 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001288 onpass="IPv6 Ping across 300 host intents test PASS",
1289 onfail="IPv6 Ping across 300 host intents test FAIL" )
1290
1291 def CASE161( self ):
1292 """
1293 Verify IPv6 ping across 600 host intents (Chordal Topology)
1294 """
1295 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1296 main.log.report( "_________________________________________________" )
1297 import itertools
1298 import time
1299 main.case( "IPv6 ping all 600 host intents" )
1300 main.step( "Verify IPv6 Ping across all hosts" )
1301 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1302 pingResult = main.FALSE
1303 time1 = time.time()
1304 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001305 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001306 main.log.warn("First pingall failed. Retrying...")
1307 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001308 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001309
Hari Krishna4223dbd2015-08-13 16:29:53 -07001310 time2 = time.time()
1311 timeDiff = round( ( time2 - time1 ), 2 )
1312 main.log.report(
1313 "Time taken for IPv6 Ping All: " +
1314 str( timeDiff ) +
1315 " seconds" )
1316 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1317 onpass="PING ALL PASS",
1318 onfail="PING ALL FAIL" )
1319
GlennRCbddd58f2015-10-01 15:45:25 -07001320 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001321 utilities.assert_equals(
1322 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001323 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001324 onpass="IPv6 Ping across 600 host intents test PASS",
1325 onfail="IPv6 Ping across 600 host intents test FAIL" )
1326
1327 def CASE162( self ):
1328 """
1329 Verify IPv6 ping across 2278 host intents (Spine Topology)
1330 """
1331 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1332 main.log.report( "_________________________________________________" )
1333 import itertools
1334 import time
1335 main.case( "IPv6 ping all 600 host intents" )
1336 main.step( "Verify IPv6 Ping across all hosts" )
1337 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
1338 pingResult = main.FALSE
1339 time1 = time.time()
1340 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001341 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001342 main.log.warn("First pingall failed. Retrying...")
1343 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001344 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001345
Hari Krishna4223dbd2015-08-13 16:29:53 -07001346 time2 = time.time()
1347 timeDiff = round( ( time2 - time1 ), 2 )
1348 main.log.report(
1349 "Time taken for IPv6 Ping All: " +
1350 str( timeDiff ) +
1351 " seconds" )
1352 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1353 onpass="PING ALL PASS",
1354 onfail="PING ALL FAIL" )
1355
GlennRCbddd58f2015-10-01 15:45:25 -07001356 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001357 utilities.assert_equals(
1358 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001359 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001360 onpass="IPv6 Ping across 600 host intents test PASS",
1361 onfail="IPv6 Ping across 600 host intents test FAIL" )
1362
Hari Krishnac195f3b2015-07-08 20:02:24 -07001363 def CASE70( self, main ):
1364 """
1365 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1366 """
1367 import random
1368 main.randomLink1 = []
1369 main.randomLink2 = []
1370 main.randomLink3 = []
1371 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1372 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1373 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1374 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1375 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1376 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1377 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1378 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1379
1380 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1381 main.log.report( "___________________________________________________________________________" )
1382 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1383 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1384 if ( int( switchLinksToToggle ) ==
1385 0 or int( switchLinksToToggle ) > 5 ):
1386 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1387 #main.cleanup()
1388 #main.exit()
1389 else:
1390 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1391
1392 main.step( "Cut links on Core devices using user provided range" )
1393 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1394 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1395 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1396 for i in range( int( switchLinksToToggle ) ):
1397 main.Mininet1.link(
1398 END1=link1End1,
1399 END2=main.randomLink1[ i ],
1400 OPTION="down" )
1401 time.sleep( link_sleep )
1402 main.Mininet1.link(
1403 END1=link2End1,
1404 END2=main.randomLink2[ i ],
1405 OPTION="down" )
1406 time.sleep( link_sleep )
1407 main.Mininet1.link(
1408 END1=link3End1,
1409 END2=main.randomLink3[ i ],
1410 OPTION="down" )
1411 time.sleep( link_sleep )
1412
Hari Krishna6185fc12015-07-13 15:42:31 -07001413 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001414 linkDown = main.ONOSbench.checkStatus(
1415 topology_output, main.numMNswitches, str(
1416 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1417 utilities.assert_equals(
1418 expect=main.TRUE,
1419 actual=linkDown,
1420 onpass="Link Down discovered properly",
1421 onfail="Link down was not discovered in " +
1422 str( link_sleep ) +
1423 " seconds" )
1424
GlennRCfcfdc4f2015-09-30 16:01:57 -07001425 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001426 # Giving onos multiple chances to install intents
1427 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001428 if i != 0:
1429 main.log.warn( "Verification failed. Retrying..." )
1430 main.log.info("Giving onos some time...")
1431 time.sleep( main.checkIntentsDelay )
1432
1433 intentState = main.TRUE
1434 for e in range(int(main.numCtrls)):
1435 main.log.info( "Checking intents on CLI %s" % (e+1) )
1436 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1437 intentState
1438 if not intentState:
1439 main.log.warn( "Not all intents installed" )
1440 if intentState:
1441 break
1442 else:
1443 #Dumping intent summary
1444 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1445
1446
1447 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1448 onpass="INTENTS INSTALLED",
1449 onfail="SOME INTENTS NOT INSTALLED" )
1450
Hari Krishnac195f3b2015-07-08 20:02:24 -07001451 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001452 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001453 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001454 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1455 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001456 main.log.warn("First pingall failed. Retrying...")
1457 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001458 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001459
Hari Krishnac195f3b2015-07-08 20:02:24 -07001460 time2 = time.time()
1461 timeDiff = round( ( time2 - time1 ), 2 )
1462 main.log.report(
1463 "Time taken for Ping All: " +
1464 str( timeDiff ) +
1465 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001466 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001467 onpass="PING ALL PASS",
1468 onfail="PING ALL FAIL" )
1469
GlennRCbddd58f2015-10-01 15:45:25 -07001470 caseResult = linkDown and pingResult and intentState
1471 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001472 onpass="Random Link cut Test PASS",
1473 onfail="Random Link cut Test FAIL" )
1474
GlennRCfcfdc4f2015-09-30 16:01:57 -07001475 # Printing what exactly failed
1476 if not linkDown:
1477 main.log.debug( "Link down was not discovered correctly" )
1478 if not pingResult:
1479 main.log.debug( "Pingall failed" )
1480 if not intentState:
1481 main.log.debug( "Intents are not all installed" )
1482
GlennRCbddd58f2015-10-01 15:45:25 -07001483 if not caseResult and main.failSwitch:
1484 main.log.report("Stopping test")
1485 main.stop( email=main.emailOnStop )
1486
Hari Krishnac195f3b2015-07-08 20:02:24 -07001487 def CASE80( self, main ):
1488 """
1489 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1490 """
1491 import random
1492 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1493 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1494 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1495 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1496 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1497
1498 main.log.report(
1499 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1500 main.log.report(
1501 "__________________________________________________________________" )
1502 main.case(
1503 "Host intents - Bring the core links up that are down and verify ping all" )
1504 main.step( "Bring randomly cut links on Core devices up" )
1505 for i in range( int( switchLinksToToggle ) ):
1506 main.Mininet1.link(
1507 END1=link1End1,
1508 END2=main.randomLink1[ i ],
1509 OPTION="up" )
1510 time.sleep( link_sleep )
1511 main.Mininet1.link(
1512 END1=link2End1,
1513 END2=main.randomLink2[ i ],
1514 OPTION="up" )
1515 time.sleep( link_sleep )
1516 main.Mininet1.link(
1517 END1=link3End1,
1518 END2=main.randomLink3[ i ],
1519 OPTION="up" )
1520 time.sleep( link_sleep )
1521
Hari Krishna6185fc12015-07-13 15:42:31 -07001522 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001523 linkUp = main.ONOSbench.checkStatus(
1524 topology_output,
1525 main.numMNswitches,
1526 str( main.numMNlinks ) )
1527 utilities.assert_equals(
1528 expect=main.TRUE,
1529 actual=linkUp,
1530 onpass="Link up discovered properly",
1531 onfail="Link up was not discovered in " +
1532 str( link_sleep ) +
1533 " seconds" )
1534
GlennRCfcfdc4f2015-09-30 16:01:57 -07001535 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001536 # Giving onos multiple chances to install intents
1537 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001538 if i != 0:
1539 main.log.warn( "Verification failed. Retrying..." )
1540 main.log.info("Giving onos some time...")
1541 time.sleep( main.checkIntentsDelay )
1542
1543 intentState = main.TRUE
1544 for e in range(int(main.numCtrls)):
1545 main.log.info( "Checking intents on CLI %s" % (e+1) )
1546 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1547 intentState
1548 if not intentState:
1549 main.log.warn( "Not all intents installed" )
1550 if intentState:
1551 break
1552 else:
1553 #Dumping intent summary
1554 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1555
1556
1557 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1558 onpass="INTENTS INSTALLED",
1559 onfail="SOME INTENTS NOT INSTALLED" )
1560
Hari Krishnac195f3b2015-07-08 20:02:24 -07001561 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001562 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001563 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001564 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1565 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001566 main.log.warn("First pingall failed. Retrying...")
1567 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001568 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001569
Hari Krishnac195f3b2015-07-08 20:02:24 -07001570 time2 = time.time()
1571 timeDiff = round( ( time2 - time1 ), 2 )
1572 main.log.report(
1573 "Time taken for Ping All: " +
1574 str( timeDiff ) +
1575 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001576 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001577 onpass="PING ALL PASS",
1578 onfail="PING ALL FAIL" )
1579
GlennRCbddd58f2015-10-01 15:45:25 -07001580 caseResult = linkUp and pingResult
1581 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001582 onpass="Link Up Test PASS",
1583 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001584 # Printing what exactly failed
1585 if not linkUp:
1586 main.log.debug( "Link down was not discovered correctly" )
1587 if not pingResult:
1588 main.log.debug( "Pingall failed" )
1589 if not intentState:
1590 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591
GlennRCbddd58f2015-10-01 15:45:25 -07001592 if not caseResult and main.failSwitch:
1593 main.log.report("Stopping test")
1594 main.stop( email=main.emailOnStop )
1595
Hari Krishnac195f3b2015-07-08 20:02:24 -07001596 def CASE71( self, main ):
1597 """
1598 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1599 """
1600 import random
1601 main.randomLink1 = []
1602 main.randomLink2 = []
1603 main.randomLink3 = []
1604 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1605 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1606 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1607 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1608 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1609 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1610 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1611 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1612
1613 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1614 main.log.report( "___________________________________________________________________________" )
1615 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1616 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1617 if ( int( switchLinksToToggle ) ==
1618 0 or int( switchLinksToToggle ) > 5 ):
1619 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1620 #main.cleanup()
1621 #main.exit()
1622 else:
1623 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1624
1625 main.step( "Cut links on Core devices using user provided range" )
1626 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1627 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1628 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1629 for i in range( int( switchLinksToToggle ) ):
1630 main.Mininet1.link(
1631 END1=link1End1,
1632 END2=main.randomLink1[ i ],
1633 OPTION="down" )
1634 time.sleep( link_sleep )
1635 main.Mininet1.link(
1636 END1=link2End1,
1637 END2=main.randomLink2[ i ],
1638 OPTION="down" )
1639 time.sleep( link_sleep )
1640 main.Mininet1.link(
1641 END1=link3End1,
1642 END2=main.randomLink3[ i ],
1643 OPTION="down" )
1644 time.sleep( link_sleep )
1645
Hari Krishna6185fc12015-07-13 15:42:31 -07001646 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001647 linkDown = main.ONOSbench.checkStatus(
1648 topology_output, main.numMNswitches, str(
1649 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1650 utilities.assert_equals(
1651 expect=main.TRUE,
1652 actual=linkDown,
1653 onpass="Link Down discovered properly",
1654 onfail="Link down was not discovered in " +
1655 str( link_sleep ) +
1656 " seconds" )
1657
GlennRCfcfdc4f2015-09-30 16:01:57 -07001658 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001659 # Giving onos multiple chances to install intents
1660 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001661 if i != 0:
1662 main.log.warn( "Verification failed. Retrying..." )
1663 main.log.info("Giving onos some time...")
1664 time.sleep( main.checkIntentsDelay )
1665
1666 intentState = main.TRUE
1667 for e in range(int(main.numCtrls)):
1668 main.log.info( "Checking intents on CLI %s" % (e+1) )
1669 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1670 intentState
1671 if not intentState:
1672 main.log.warn( "Not all intents installed" )
1673 if intentState:
1674 break
1675 else:
1676 #Dumping intent summary
1677 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1678
1679
1680 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1681 onpass="INTENTS INSTALLED",
1682 onfail="SOME INTENTS NOT INSTALLED" )
1683
Hari Krishnac195f3b2015-07-08 20:02:24 -07001684 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001686 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001687 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1688 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001689 main.log.warn("First pingall failed. Retrying...")
1690 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001691 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001692
Hari Krishnac195f3b2015-07-08 20:02:24 -07001693 time2 = time.time()
1694 timeDiff = round( ( time2 - time1 ), 2 )
1695 main.log.report(
1696 "Time taken for Ping All: " +
1697 str( timeDiff ) +
1698 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001699 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001700 onpass="PING ALL PASS",
1701 onfail="PING ALL FAIL" )
1702
GlennRCbddd58f2015-10-01 15:45:25 -07001703 caseResult = linkDown and pingResult and intentState
1704 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001705 onpass="Random Link cut Test PASS",
1706 onfail="Random Link cut Test FAIL" )
1707
GlennRCfcfdc4f2015-09-30 16:01:57 -07001708 # Printing what exactly failed
1709 if not linkDown:
1710 main.log.debug( "Link down was not discovered correctly" )
1711 if not pingResult:
1712 main.log.debug( "Pingall failed" )
1713 if not intentState:
1714 main.log.debug( "Intents are not all installed" )
1715
GlennRCbddd58f2015-10-01 15:45:25 -07001716 if not caseResult and main.failSwitch:
1717 main.log.report("Stopping test")
1718 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001719
Hari Krishnac195f3b2015-07-08 20:02:24 -07001720 def CASE81( self, main ):
1721 """
1722 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1723 """
1724 import random
1725 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1726 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1727 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1728 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1729 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1730
1731 main.log.report(
1732 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1733 main.log.report(
1734 "__________________________________________________________________" )
1735 main.case(
1736 "Point intents - Bring the core links up that are down and verify ping all" )
1737 main.step( "Bring randomly cut links on Core devices up" )
1738 for i in range( int( switchLinksToToggle ) ):
1739 main.Mininet1.link(
1740 END1=link1End1,
1741 END2=main.randomLink1[ i ],
1742 OPTION="up" )
1743 time.sleep( link_sleep )
1744 main.Mininet1.link(
1745 END1=link2End1,
1746 END2=main.randomLink2[ i ],
1747 OPTION="up" )
1748 time.sleep( link_sleep )
1749 main.Mininet1.link(
1750 END1=link3End1,
1751 END2=main.randomLink3[ i ],
1752 OPTION="up" )
1753 time.sleep( link_sleep )
1754
Hari Krishna6185fc12015-07-13 15:42:31 -07001755 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001756 linkUp = main.ONOSbench.checkStatus(
1757 topology_output,
1758 main.numMNswitches,
1759 str( main.numMNlinks ) )
1760 utilities.assert_equals(
1761 expect=main.TRUE,
1762 actual=linkUp,
1763 onpass="Link up discovered properly",
1764 onfail="Link up was not discovered in " +
1765 str( link_sleep ) +
1766 " seconds" )
1767
GlennRCfcfdc4f2015-09-30 16:01:57 -07001768 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001769 # Giving onos multiple chances to install intents
1770 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001771 if i != 0:
1772 main.log.warn( "Verification failed. Retrying..." )
1773 main.log.info("Giving onos some time...")
1774 time.sleep( main.checkIntentsDelay )
1775
1776 intentState = main.TRUE
1777 for e in range(int(main.numCtrls)):
1778 main.log.info( "Checking intents on CLI %s" % (e+1) )
1779 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1780 intentState
1781 if not intentState:
1782 main.log.warn( "Not all intents installed" )
1783 if intentState:
1784 break
1785 else:
1786 #Dumping intent summary
1787 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1788
1789
1790 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1791 onpass="INTENTS INSTALLED",
1792 onfail="SOME INTENTS NOT INSTALLED" )
1793
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001795 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001796 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001797 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1798 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001799 main.log.warn("First pingall failed. Retrying...")
1800 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001801 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001802
Hari Krishnac195f3b2015-07-08 20:02:24 -07001803 time2 = time.time()
1804 timeDiff = round( ( time2 - time1 ), 2 )
1805 main.log.report(
1806 "Time taken for Ping All: " +
1807 str( timeDiff ) +
1808 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001809 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001810 onpass="PING ALL PASS",
1811 onfail="PING ALL FAIL" )
1812
GlennRCbddd58f2015-10-01 15:45:25 -07001813 caseResult = linkUp and pingResult
1814 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001815 onpass="Link Up Test PASS",
1816 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001817 # Printing what exactly failed
1818 if not linkUp:
1819 main.log.debug( "Link down was not discovered correctly" )
1820 if not pingResult:
1821 main.log.debug( "Pingall failed" )
1822 if not intentState:
1823 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824
GlennRCbddd58f2015-10-01 15:45:25 -07001825 if not caseResult and main.failSwitch:
1826 main.log.report("Stopping test")
1827 main.stop( email=main.emailOnStop )
1828
Hari Krishnac195f3b2015-07-08 20:02:24 -07001829 def CASE72( self, main ):
1830 """
1831 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1832 """
1833 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001834 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001835 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001836
Hari Krishnac195f3b2015-07-08 20:02:24 -07001837 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1838 main.log.report( "___________________________________________________________________________" )
1839 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1840 switches = []
1841 switchesComb = []
1842 for i in range( main.numMNswitches ):
1843 switches.append('s%d'%(i+1))
1844 switchesLinksComb = list(itertools.combinations(switches,2))
1845 main.randomLinks = random.sample(switchesLinksComb, 5 )
1846 print main.randomLinks
1847 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001848
Hari Krishnac195f3b2015-07-08 20:02:24 -07001849 for switch in main.randomLinks:
1850 main.Mininet1.link(
1851 END1=switch[0],
1852 END2=switch[1],
1853 OPTION="down")
1854 time.sleep( link_sleep )
1855
Hari Krishna6185fc12015-07-13 15:42:31 -07001856 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001857 linkDown = main.ONOSbench.checkStatus(
1858 topology_output, main.numMNswitches, str(
1859 int( main.numMNlinks ) - 5 * 2 ) )
1860 utilities.assert_equals(
1861 expect=main.TRUE,
1862 actual=linkDown,
1863 onpass="Link Down discovered properly",
1864 onfail="Link down was not discovered in " +
1865 str( link_sleep ) +
1866 " seconds" )
1867
GlennRCfcfdc4f2015-09-30 16:01:57 -07001868 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001869 # Giving onos multiple chances to install intents
1870 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001871 if i != 0:
1872 main.log.warn( "Verification failed. Retrying..." )
1873 main.log.info("Giving onos some time...")
1874 time.sleep( main.checkIntentsDelay )
1875
1876 intentState = main.TRUE
1877 for e in range(int(main.numCtrls)):
1878 main.log.info( "Checking intents on CLI %s" % (e+1) )
1879 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1880 intentState
1881 if not intentState:
1882 main.log.warn( "Not all intents installed" )
1883 if intentState:
1884 break
1885 else:
1886 #Dumping intent summary
1887 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1888
1889
1890 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1891 onpass="INTENTS INSTALLED",
1892 onfail="SOME INTENTS NOT INSTALLED" )
1893
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001895 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001896 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001897 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1898 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001899 main.log.warn("First pingall failed. Retrying...")
1900 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001901 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001902
Hari Krishnac195f3b2015-07-08 20:02:24 -07001903 time2 = time.time()
1904 timeDiff = round( ( time2 - time1 ), 2 )
1905 main.log.report(
1906 "Time taken for Ping All: " +
1907 str( timeDiff ) +
1908 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001909 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001910 onpass="PING ALL PASS",
1911 onfail="PING ALL FAIL" )
1912
GlennRCbddd58f2015-10-01 15:45:25 -07001913 caseResult = linkDown and pingResult and intentState
1914 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001915 onpass="Random Link cut Test PASS",
1916 onfail="Random Link cut Test FAIL" )
1917
GlennRCfcfdc4f2015-09-30 16:01:57 -07001918 # Printing what exactly failed
1919 if not linkDown:
1920 main.log.debug( "Link down was not discovered correctly" )
1921 if not pingResult:
1922 main.log.debug( "Pingall failed" )
1923 if not intentState:
1924 main.log.debug( "Intents are not all installed" )
1925
GlennRCbddd58f2015-10-01 15:45:25 -07001926 if not caseResult and main.failSwitch:
1927 main.log.report("Stopping test")
1928 main.stop( email=main.emailOnStop )
1929
Hari Krishnac195f3b2015-07-08 20:02:24 -07001930 def CASE82( self, main ):
1931 """
1932 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1933 """
1934 import random
1935 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001936
Hari Krishnac195f3b2015-07-08 20:02:24 -07001937 main.log.report(
1938 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1939 main.log.report(
1940 "__________________________________________________________________" )
1941 main.case(
1942 "Host intents - Bring the core links up that are down and verify ping all" )
1943 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001944
Hari Krishnac195f3b2015-07-08 20:02:24 -07001945 for switch in main.randomLinks:
1946 main.Mininet1.link(
1947 END1=switch[0],
1948 END2=switch[1],
1949 OPTION="up")
1950 time.sleep( link_sleep )
1951
Hari Krishna6185fc12015-07-13 15:42:31 -07001952 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001953 linkUp = main.ONOSbench.checkStatus(
1954 topology_output,
1955 main.numMNswitches,
1956 str( main.numMNlinks ) )
1957 utilities.assert_equals(
1958 expect=main.TRUE,
1959 actual=linkUp,
1960 onpass="Link up discovered properly",
1961 onfail="Link up was not discovered in " +
1962 str( link_sleep ) +
1963 " seconds" )
1964
GlennRCfcfdc4f2015-09-30 16:01:57 -07001965 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001966 # Giving onos multiple chances to install intents
1967 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001968 if i != 0:
1969 main.log.warn( "Verification failed. Retrying..." )
1970 main.log.info("Giving onos some time...")
1971 time.sleep( main.checkIntentsDelay )
1972
1973 intentState = main.TRUE
1974 for e in range(int(main.numCtrls)):
1975 main.log.info( "Checking intents on CLI %s" % (e+1) )
1976 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1977 intentState
1978 if not intentState:
1979 main.log.warn( "Not all intents installed" )
1980 if intentState:
1981 break
1982 else:
1983 #Dumping intent summary
1984 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1985
1986
1987 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1988 onpass="INTENTS INSTALLED",
1989 onfail="SOME INTENTS NOT INSTALLED" )
1990
Hari Krishnac195f3b2015-07-08 20:02:24 -07001991 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001992 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001993 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001994 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1995 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001996 main.log.warn("First pingall failed. Retrying...")
1997 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001998 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001999
Hari Krishnac195f3b2015-07-08 20:02:24 -07002000 time2 = time.time()
2001 timeDiff = round( ( time2 - time1 ), 2 )
2002 main.log.report(
2003 "Time taken for Ping All: " +
2004 str( timeDiff ) +
2005 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002006 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002007 onpass="PING ALL PASS",
2008 onfail="PING ALL FAIL" )
2009
GlennRCbddd58f2015-10-01 15:45:25 -07002010 caseResult = linkUp and pingResult
2011 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002012 onpass="Link Up Test PASS",
2013 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002014 # Printing what exactly failed
2015 if not linkUp:
2016 main.log.debug( "Link down was not discovered correctly" )
2017 if not pingResult:
2018 main.log.debug( "Pingall failed" )
2019 if not intentState:
2020 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002021
GlennRCbddd58f2015-10-01 15:45:25 -07002022 if not caseResult and main.failSwitch:
2023 main.log.report("Stopping test")
2024 main.stop( email=main.emailOnStop )
2025
Hari Krishnac195f3b2015-07-08 20:02:24 -07002026 def CASE73( self, main ):
2027 """
2028 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2029 """
2030 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002031 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002032 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002033
Hari Krishnac195f3b2015-07-08 20:02:24 -07002034 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2035 main.log.report( "___________________________________________________________________________" )
2036 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2037 switches = []
2038 switchesComb = []
2039 for i in range( main.numMNswitches ):
2040 switches.append('s%d'%(i+1))
2041 switchesLinksComb = list(itertools.combinations(switches,2))
2042 main.randomLinks = random.sample(switchesLinksComb, 5 )
2043 print main.randomLinks
2044 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002045
Hari Krishnac195f3b2015-07-08 20:02:24 -07002046 for switch in main.randomLinks:
2047 main.Mininet1.link(
2048 END1=switch[0],
2049 END2=switch[1],
2050 OPTION="down")
2051 time.sleep( link_sleep )
2052
Hari Krishna6185fc12015-07-13 15:42:31 -07002053 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002054 linkDown = main.ONOSbench.checkStatus(
2055 topology_output, main.numMNswitches, str(
2056 int( main.numMNlinks ) - 5 * 2 ) )
2057 utilities.assert_equals(
2058 expect=main.TRUE,
2059 actual=linkDown,
2060 onpass="Link Down discovered properly",
2061 onfail="Link down was not discovered in " +
2062 str( link_sleep ) +
2063 " seconds" )
2064
GlennRCfcfdc4f2015-09-30 16:01:57 -07002065 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002066 # Giving onos multiple chances to install intents
2067 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002068 if i != 0:
2069 main.log.warn( "Verification failed. Retrying..." )
2070 main.log.info("Giving onos some time...")
2071 time.sleep( main.checkIntentsDelay )
2072
2073 intentState = main.TRUE
2074 for e in range(int(main.numCtrls)):
2075 main.log.info( "Checking intents on CLI %s" % (e+1) )
2076 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2077 intentState
2078 if not intentState:
2079 main.log.warn( "Not all intents installed" )
2080 if intentState:
2081 break
2082 else:
2083 #Dumping intent summary
2084 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2085
2086
2087 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2088 onpass="INTENTS INSTALLED",
2089 onfail="SOME INTENTS NOT INSTALLED" )
2090
Hari Krishnac195f3b2015-07-08 20:02:24 -07002091 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002093 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002094 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2095 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002096 main.log.warn("First pingall failed. Retrying...")
2097 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002098 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002099
Hari Krishnac195f3b2015-07-08 20:02:24 -07002100 time2 = time.time()
2101 timeDiff = round( ( time2 - time1 ), 2 )
2102 main.log.report(
2103 "Time taken for Ping All: " +
2104 str( timeDiff ) +
2105 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002106 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002107 onpass="PING ALL PASS",
2108 onfail="PING ALL FAIL" )
2109
GlennRCbddd58f2015-10-01 15:45:25 -07002110 caseResult = linkDown and pingResult and intentState
2111 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002112 onpass="Random Link cut Test PASS",
2113 onfail="Random Link cut Test FAIL" )
2114
GlennRCfcfdc4f2015-09-30 16:01:57 -07002115 # Printing what exactly failed
2116 if not linkDown:
2117 main.log.debug( "Link down was not discovered correctly" )
2118 if not pingResult:
2119 main.log.debug( "Pingall failed" )
2120 if not intentState:
2121 main.log.debug( "Intents are not all installed" )
2122
GlennRCbddd58f2015-10-01 15:45:25 -07002123 if not caseResult and main.failSwitch:
2124 main.log.report("Stopping test")
2125 main.stop( email=main.emailOnStop )
2126
Hari Krishnac195f3b2015-07-08 20:02:24 -07002127 def CASE83( self, main ):
2128 """
2129 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2130 """
2131 import random
2132 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002133
Hari Krishnac195f3b2015-07-08 20:02:24 -07002134 main.log.report(
2135 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2136 main.log.report(
2137 "__________________________________________________________________" )
2138 main.case(
2139 "Point intents - Bring the core links up that are down and verify ping all" )
2140 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002141
Hari Krishnac195f3b2015-07-08 20:02:24 -07002142 for switch in main.randomLinks:
2143 main.Mininet1.link(
2144 END1=switch[0],
2145 END2=switch[1],
2146 OPTION="up")
2147 time.sleep( link_sleep )
2148
Hari Krishna6185fc12015-07-13 15:42:31 -07002149 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002150 linkUp = main.ONOSbench.checkStatus(
2151 topology_output,
2152 main.numMNswitches,
2153 str( main.numMNlinks ) )
2154 utilities.assert_equals(
2155 expect=main.TRUE,
2156 actual=linkUp,
2157 onpass="Link up discovered properly",
2158 onfail="Link up was not discovered in " +
2159 str( link_sleep ) +
2160 " seconds" )
2161
GlennRCfcfdc4f2015-09-30 16:01:57 -07002162 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002163 # Giving onos multiple chances to install intents
2164 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002165 if i != 0:
2166 main.log.warn( "Verification failed. Retrying..." )
2167 main.log.info("Giving onos some time...")
2168 time.sleep( main.checkIntentsDelay )
2169
2170 intentState = main.TRUE
2171 for e in range(int(main.numCtrls)):
2172 main.log.info( "Checking intents on CLI %s" % (e+1) )
2173 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2174 intentState
2175 if not intentState:
2176 main.log.warn( "Not all intents installed" )
2177 if intentState:
2178 break
2179 else:
2180 #Dumping intent summary
2181 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2182
2183
2184 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2185 onpass="INTENTS INSTALLED",
2186 onfail="SOME INTENTS NOT INSTALLED" )
2187
Hari Krishnac195f3b2015-07-08 20:02:24 -07002188 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002189 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002190 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002191 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2192 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002193 main.log.warn("First pingall failed. Retrying...")
2194 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002195 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002196
Hari Krishnac195f3b2015-07-08 20:02:24 -07002197 time2 = time.time()
2198 timeDiff = round( ( time2 - time1 ), 2 )
2199 main.log.report(
2200 "Time taken for Ping All: " +
2201 str( timeDiff ) +
2202 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002203 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002204 onpass="PING ALL PASS",
2205 onfail="PING ALL FAIL" )
2206
GlennRCbddd58f2015-10-01 15:45:25 -07002207 caseResult = linkUp and pingResult
2208 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002209 onpass="Link Up Test PASS",
2210 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002211 # Printing what exactly failed
2212 if not linkUp:
2213 main.log.debug( "Link down was not discovered correctly" )
2214 if not pingResult:
2215 main.log.debug( "Pingall failed" )
2216 if not intentState:
2217 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002218
GlennRCbddd58f2015-10-01 15:45:25 -07002219 if not caseResult and main.failSwitch:
2220 main.log.report("Stopping test")
2221 main.stop( email=main.emailOnStop )
2222
Hari Krishnac195f3b2015-07-08 20:02:24 -07002223 def CASE74( self, main ):
2224 """
2225 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2226 """
2227 import random
2228 main.randomLink1 = []
2229 main.randomLink2 = []
2230 main.randomLink3 = []
2231 main.randomLink4 = []
2232 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2233 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2234 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2235 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2236 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2237 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2238 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2239 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002240
Hari Krishnac195f3b2015-07-08 20:02:24 -07002241 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2242 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002243 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002244 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002245 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002246 linkIndex.remove(linkIndexS9)
2247 linkIndexS10 = random.sample(linkIndex,1)[0]
2248 main.randomLink1 = link1End2top[linkIndexS9]
2249 main.randomLink2 = link2End2top[linkIndexS10]
2250 main.randomLink3 = random.sample(link1End2bot,1)[0]
2251 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002252
2253 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002254 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2255 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2256 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2257 time.sleep( link_sleep )
2258 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2259 time.sleep( link_sleep )
2260
Hari Krishna6185fc12015-07-13 15:42:31 -07002261 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002262 linkDown = main.ONOSbench.checkStatus(
2263 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002264 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002265 utilities.assert_equals(
2266 expect=main.TRUE,
2267 actual=linkDown,
2268 onpass="Link Down discovered properly",
2269 onfail="Link down was not discovered in " +
2270 str( link_sleep ) +
2271 " seconds" )
2272
GlennRCfcfdc4f2015-09-30 16:01:57 -07002273 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002274 # Giving onos multiple chances to install intents
2275 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002276 if i != 0:
2277 main.log.warn( "Verification failed. Retrying..." )
2278 main.log.info("Giving onos some time...")
2279 time.sleep( main.checkIntentsDelay )
2280
2281 intentState = main.TRUE
2282 for e in range(int(main.numCtrls)):
2283 main.log.info( "Checking intents on CLI %s" % (e+1) )
2284 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2285 intentState
2286 if not intentState:
2287 main.log.warn( "Not all intents installed" )
2288 if intentState:
2289 break
2290 else:
2291 #Dumping intent summary
2292 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2293
2294
2295 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2296 onpass="INTENTS INSTALLED",
2297 onfail="SOME INTENTS NOT INSTALLED" )
2298
Hari Krishnac195f3b2015-07-08 20:02:24 -07002299 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002301 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002302 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2303 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002304 main.log.warn("First pingall failed. Retrying...")
2305 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002306 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002307
Hari Krishnac195f3b2015-07-08 20:02:24 -07002308 time2 = time.time()
2309 timeDiff = round( ( time2 - time1 ), 2 )
2310 main.log.report(
2311 "Time taken for Ping All: " +
2312 str( timeDiff ) +
2313 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002314 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002315 onpass="PING ALL PASS",
2316 onfail="PING ALL FAIL" )
2317
GlennRCbddd58f2015-10-01 15:45:25 -07002318 caseResult = linkDown and pingResult and intentState
2319 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002320 onpass="Random Link cut Test PASS",
2321 onfail="Random Link cut Test FAIL" )
2322
GlennRCfcfdc4f2015-09-30 16:01:57 -07002323 # Printing what exactly failed
2324 if not linkDown:
2325 main.log.debug( "Link down was not discovered correctly" )
2326 if not pingResult:
2327 main.log.debug( "Pingall failed" )
2328 if not intentState:
2329 main.log.debug( "Intents are not all installed" )
2330
GlennRCbddd58f2015-10-01 15:45:25 -07002331 if not caseResult and main.failSwitch:
2332 main.log.report("Stopping test")
2333 main.stop( email=main.emailOnStop )
2334
Hari Krishnac195f3b2015-07-08 20:02:24 -07002335 def CASE84( self, main ):
2336 """
2337 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2338 """
2339 import random
2340 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2341 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2342 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2343 main.log.report(
2344 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2345 main.log.report(
2346 "__________________________________________________________________" )
2347 main.case(
2348 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002349
2350 # Work around for link state propagation delay. Added some sleep time.
2351 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2352 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002353 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2354 time.sleep( link_sleep )
2355 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2356 time.sleep( link_sleep )
2357
Hari Krishna6185fc12015-07-13 15:42:31 -07002358 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002359 linkUp = main.ONOSbench.checkStatus(
2360 topology_output,
2361 main.numMNswitches,
2362 str( main.numMNlinks ) )
2363 utilities.assert_equals(
2364 expect=main.TRUE,
2365 actual=linkUp,
2366 onpass="Link up discovered properly",
2367 onfail="Link up was not discovered in " +
2368 str( link_sleep ) +
2369 " seconds" )
2370
GlennRCfcfdc4f2015-09-30 16:01:57 -07002371 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002372 # Giving onos multiple chances to install intents
2373 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002374 if i != 0:
2375 main.log.warn( "Verification failed. Retrying..." )
2376 main.log.info("Giving onos some time...")
2377 time.sleep( main.checkIntentsDelay )
2378
2379 intentState = main.TRUE
2380 for e in range(int(main.numCtrls)):
2381 main.log.info( "Checking intents on CLI %s" % (e+1) )
2382 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2383 intentState
2384 if not intentState:
2385 main.log.warn( "Not all intents installed" )
2386 if intentState:
2387 break
2388 else:
2389 #Dumping intent summary
2390 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2391
2392
2393 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2394 onpass="INTENTS INSTALLED",
2395 onfail="SOME INTENTS NOT INSTALLED" )
2396
Hari Krishnac195f3b2015-07-08 20:02:24 -07002397 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002398 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002399 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002400 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2401 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002402 main.log.warn("First pingall failed. Retrying...")
2403 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002404 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002405
Hari Krishnac195f3b2015-07-08 20:02:24 -07002406 time2 = time.time()
2407 timeDiff = round( ( time2 - time1 ), 2 )
2408 main.log.report(
2409 "Time taken for Ping All: " +
2410 str( timeDiff ) +
2411 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002412 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002413 onpass="PING ALL PASS",
2414 onfail="PING ALL FAIL" )
2415
GlennRCbddd58f2015-10-01 15:45:25 -07002416 caseResult = linkUp and pingResult
2417 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002418 onpass="Link Up Test PASS",
2419 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002420 # Printing what exactly failed
2421 if not linkUp:
2422 main.log.debug( "Link down was not discovered correctly" )
2423 if not pingResult:
2424 main.log.debug( "Pingall failed" )
2425 if not intentState:
2426 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002427
GlennRCbddd58f2015-10-01 15:45:25 -07002428 if not caseResult and main.failSwitch:
2429 main.log.report("Stopping test")
2430 main.stop( email=main.emailOnStop )
2431
Hari Krishnab79d0822015-08-20 09:48:43 -07002432 def CASE75( self, main ):
2433 """
2434 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2435 """
2436 import random
2437 main.randomLink1 = []
2438 main.randomLink2 = []
2439 main.randomLink3 = []
2440 main.randomLink4 = []
2441 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2442 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2443 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2444 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2445 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2446 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2447 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2448 main.pingTimeout = 400
2449
2450 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2451 main.log.report( "___________________________________________________________________________" )
2452 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2453 linkIndex = range(4)
2454 linkIndexS9 = random.sample(linkIndex,1)[0]
2455 linkIndex.remove(linkIndexS9)
2456 linkIndexS10 = random.sample(linkIndex,1)[0]
2457 main.randomLink1 = link1End2top[linkIndexS9]
2458 main.randomLink2 = link2End2top[linkIndexS10]
2459 main.randomLink3 = random.sample(link1End2bot,1)[0]
2460 main.randomLink4 = random.sample(link2End2bot,1)[0]
2461
2462 # Work around for link state propagation delay. Added some sleep time.
2463 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2464 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2465 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2466 time.sleep( link_sleep )
2467 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2468 time.sleep( link_sleep )
2469
2470 topology_output = main.ONOScli1.topology()
2471 linkDown = main.ONOSbench.checkStatus(
2472 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002473 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002474 utilities.assert_equals(
2475 expect=main.TRUE,
2476 actual=linkDown,
2477 onpass="Link Down discovered properly",
2478 onfail="Link down was not discovered in " +
2479 str( link_sleep ) +
2480 " seconds" )
2481
GlennRCfcfdc4f2015-09-30 16:01:57 -07002482 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002483 # Giving onos multiple chances to install intents
2484 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002485 if i != 0:
2486 main.log.warn( "Verification failed. Retrying..." )
2487 main.log.info("Giving onos some time...")
2488 time.sleep( main.checkIntentsDelay )
2489
2490 intentState = main.TRUE
2491 for e in range(int(main.numCtrls)):
2492 main.log.info( "Checking intents on CLI %s" % (e+1) )
2493 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2494 intentState
2495 if not intentState:
2496 main.log.warn( "Not all intents installed" )
2497 if intentState:
2498 break
2499 else:
2500 #Dumping intent summary
2501 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2502
2503
2504 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2505 onpass="INTENTS INSTALLED",
2506 onfail="SOME INTENTS NOT INSTALLED" )
2507
Hari Krishnab79d0822015-08-20 09:48:43 -07002508 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002509 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002510 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002511 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2512 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002513 main.log.warn("First pingall failed. Retrying...")
2514 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002515 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002516
Hari Krishnab79d0822015-08-20 09:48:43 -07002517 time2 = time.time()
2518 timeDiff = round( ( time2 - time1 ), 2 )
2519 main.log.report(
2520 "Time taken for Ping All: " +
2521 str( timeDiff ) +
2522 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002523 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002524 onpass="PING ALL PASS",
2525 onfail="PING ALL FAIL" )
2526
GlennRCbddd58f2015-10-01 15:45:25 -07002527 caseResult = linkDown and pingResult and intentState
2528 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002529 onpass="Random Link cut Test PASS",
2530 onfail="Random Link cut Test FAIL" )
2531
GlennRCfcfdc4f2015-09-30 16:01:57 -07002532 # Printing what exactly failed
2533 if not linkDown:
2534 main.log.debug( "Link down was not discovered correctly" )
2535 if not pingResult:
2536 main.log.debug( "Pingall failed" )
2537 if not intentState:
2538 main.log.debug( "Intents are not all installed" )
2539
GlennRCbddd58f2015-10-01 15:45:25 -07002540 if not caseResult and main.failSwitch:
2541 main.log.report("Stopping test")
2542 main.stop( email=main.emailOnStop )
2543
Hari Krishnab79d0822015-08-20 09:48:43 -07002544 def CASE85( self, main ):
2545 """
2546 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2547 """
2548 import random
2549 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2550 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2551 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2552 main.log.report(
2553 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2554 main.log.report(
2555 "__________________________________________________________________" )
2556 main.case(
2557 "Point intents - Bring the core links up that are down and verify ping all" )
2558
2559 # Work around for link state propagation delay. Added some sleep time.
2560 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2561 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2562 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2563 time.sleep( link_sleep )
2564 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2565 time.sleep( link_sleep )
2566
2567 topology_output = main.ONOScli1.topology()
2568 linkUp = main.ONOSbench.checkStatus(
2569 topology_output,
2570 main.numMNswitches,
2571 str( main.numMNlinks ) )
2572 utilities.assert_equals(
2573 expect=main.TRUE,
2574 actual=linkUp,
2575 onpass="Link up discovered properly",
2576 onfail="Link up was not discovered in " +
2577 str( link_sleep ) +
2578 " seconds" )
2579
GlennRCfcfdc4f2015-09-30 16:01:57 -07002580 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002581 # Giving onos multiple chances to install intents
2582 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002583 if i != 0:
2584 main.log.warn( "Verification failed. Retrying..." )
2585 main.log.info("Giving onos some time...")
2586 time.sleep( main.checkIntentsDelay )
2587
2588 intentState = main.TRUE
2589 for e in range(int(main.numCtrls)):
2590 main.log.info( "Checking intents on CLI %s" % (e+1) )
2591 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2592 intentState
2593 if not intentState:
2594 main.log.warn( "Not all intents installed" )
2595 if intentState:
2596 break
2597 else:
2598 #Dumping intent summary
2599 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2600
2601
2602 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2603 onpass="INTENTS INSTALLED",
2604 onfail="SOME INTENTS NOT INSTALLED" )
2605
Hari Krishnab79d0822015-08-20 09:48:43 -07002606 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002607 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002608 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002609 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2610 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002611 main.log.warn("First pingall failed. Retrying...")
2612 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002613 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002614
Hari Krishnab79d0822015-08-20 09:48:43 -07002615 time2 = time.time()
2616 timeDiff = round( ( time2 - time1 ), 2 )
2617 main.log.report(
2618 "Time taken for Ping All: " +
2619 str( timeDiff ) +
2620 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002621 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002622 onpass="PING ALL PASS",
2623 onfail="PING ALL FAIL" )
2624
GlennRCbddd58f2015-10-01 15:45:25 -07002625 caseResult = linkUp and pingResult
2626 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002627 onpass="Link Up Test PASS",
2628 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002629 # Printing what exactly failed
2630 if not linkUp:
2631 main.log.debug( "Link down was not discovered correctly" )
2632 if not pingResult:
2633 main.log.debug( "Pingall failed" )
2634 if not intentState:
2635 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002636
GlennRCbddd58f2015-10-01 15:45:25 -07002637 if not caseResult and main.failSwitch:
2638 main.log.report("Stopping test")
2639 main.stop( email=main.emailOnStop )
2640
Hari Krishna4223dbd2015-08-13 16:29:53 -07002641 def CASE170( self ):
2642 """
2643 IPv6 ping all with some core links down( Host Intents-Att Topo)
2644 """
2645 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2646 main.log.report( "_________________________________________________" )
2647 import itertools
2648 import time
2649 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2650 main.step( "Verify IPv6 Ping across all hosts" )
2651 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2652 pingResult = main.FALSE
2653 time1 = time.time()
2654 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002655 if not pingResult:
2656 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
2657 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002658 time2 = time.time()
2659 timeDiff = round( ( time2 - time1 ), 2 )
2660 main.log.report(
2661 "Time taken for IPv6 Ping All: " +
2662 str( timeDiff ) +
2663 " seconds" )
2664 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2665 onpass="PING ALL PASS",
2666 onfail="PING ALL FAIL" )
2667
GlennRCbddd58f2015-10-01 15:45:25 -07002668 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002669 utilities.assert_equals(
2670 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002671 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002672 onpass="IPv6 Ping across 300 host intents test PASS",
2673 onfail="IPv6 Ping across 300 host intents test FAIL" )
2674
2675 def CASE180( self ):
2676 """
2677 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2678 """
2679 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2680 main.log.report( "_________________________________________________" )
2681 import itertools
2682 import time
2683 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2684 main.step( "Verify IPv6 Ping across all hosts" )
2685 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2686 pingResult = main.FALSE
2687 time1 = time.time()
2688 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002689 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002690 main.log.warn("First ping failed. Retrying...")
2691 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002692 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002693
Hari Krishna4223dbd2015-08-13 16:29:53 -07002694 time2 = time.time()
2695 timeDiff = round( ( time2 - time1 ), 2 )
2696 main.log.report(
2697 "Time taken for IPv6 Ping All: " +
2698 str( timeDiff ) +
2699 " seconds" )
2700 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2701 onpass="PING ALL PASS",
2702 onfail="PING ALL FAIL" )
2703
GlennRCbddd58f2015-10-01 15:45:25 -07002704 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002705 utilities.assert_equals(
2706 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002707 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002708 onpass="IPv6 Ping across 300 host intents test PASS",
2709 onfail="IPv6 Ping across 300 host intents test FAIL" )
2710
2711 def CASE171( self ):
2712 """
2713 IPv6 ping all with some core links down( Point Intents-Att Topo)
2714 """
2715 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2716 main.log.report( "_________________________________________________" )
2717 import itertools
2718 import time
2719 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2720 main.step( "Verify IPv6 Ping across all hosts" )
2721 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2722 pingResult = main.FALSE
2723 time1 = time.time()
2724 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002725 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002726 main.log.warn("First ping failed. Retrying...")
2727 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002728 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002729
Hari Krishna4223dbd2015-08-13 16:29:53 -07002730 time2 = time.time()
2731 timeDiff = round( ( time2 - time1 ), 2 )
2732 main.log.report(
2733 "Time taken for IPv6 Ping All: " +
2734 str( timeDiff ) +
2735 " seconds" )
2736 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2737 onpass="PING ALL PASS",
2738 onfail="PING ALL FAIL" )
2739
GlennRCbddd58f2015-10-01 15:45:25 -07002740 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002741 utilities.assert_equals(
2742 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002743 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002744 onpass="IPv6 Ping across 600 point intents test PASS",
2745 onfail="IPv6 Ping across 600 point intents test FAIL" )
2746
2747 def CASE181( self ):
2748 """
2749 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2750 """
2751 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2752 main.log.report( "_________________________________________________" )
2753 import itertools
2754 import time
2755 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2756 main.step( "Verify IPv6 Ping across all hosts" )
2757 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2758 pingResult = main.FALSE
2759 time1 = time.time()
2760 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002761 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002762 main.log.warn("First ping failed. Retrying...")
2763 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002764 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002765
Hari Krishna4223dbd2015-08-13 16:29:53 -07002766 time2 = time.time()
2767 timeDiff = round( ( time2 - time1 ), 2 )
2768 main.log.report(
2769 "Time taken for IPv6 Ping All: " +
2770 str( timeDiff ) +
2771 " seconds" )
2772 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2773 onpass="PING ALL PASS",
2774 onfail="PING ALL FAIL" )
2775
GlennRCbddd58f2015-10-01 15:45:25 -07002776 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002777 utilities.assert_equals(
2778 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002779 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002780 onpass="IPv6 Ping across 600 Point intents test PASS",
2781 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2782
2783 def CASE172( self ):
2784 """
2785 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2786 """
2787 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2788 main.log.report( "_________________________________________________" )
2789 import itertools
2790 import time
2791 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2792 main.step( "Verify IPv6 Ping across all hosts" )
2793 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2794 pingResult = main.FALSE
2795 time1 = time.time()
2796 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002797 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002798 main.log.warn("First ping failed. Retrying...")
2799 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002800 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002801
Hari Krishna4223dbd2015-08-13 16:29:53 -07002802 time2 = time.time()
2803 timeDiff = round( ( time2 - time1 ), 2 )
2804 main.log.report(
2805 "Time taken for IPv6 Ping All: " +
2806 str( timeDiff ) +
2807 " seconds" )
2808 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2809 onpass="PING ALL PASS",
2810 onfail="PING ALL FAIL" )
2811
GlennRCbddd58f2015-10-01 15:45:25 -07002812 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002813 utilities.assert_equals(
2814 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002815 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002816 onpass="IPv6 Ping across 300 host intents test PASS",
2817 onfail="IPv6 Ping across 300 host intents test FAIL" )
2818
2819 def CASE182( self ):
2820 """
2821 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2822 """
2823 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2824 main.log.report( "_________________________________________________" )
2825 import itertools
2826 import time
2827 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2828 main.step( "Verify IPv6 Ping across all hosts" )
2829 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2830 pingResult = main.FALSE
2831 time1 = time.time()
2832 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002833 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002834 main.log.warn("First ping failed. Retrying...")
2835 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002836 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002837
Hari Krishna4223dbd2015-08-13 16:29:53 -07002838 time2 = time.time()
2839 timeDiff = round( ( time2 - time1 ), 2 )
2840 main.log.report(
2841 "Time taken for IPv6 Ping All: " +
2842 str( timeDiff ) +
2843 " seconds" )
2844 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2845 onpass="PING ALL PASS",
2846 onfail="PING ALL FAIL" )
2847
GlennRCbddd58f2015-10-01 15:45:25 -07002848 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002849 utilities.assert_equals(
2850 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002851 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002852 onpass="IPv6 Ping across 300 host intents test PASS",
2853 onfail="IPv6 Ping across 300 host intents test FAIL" )
2854
2855 def CASE173( self ):
2856 """
2857 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2858 """
2859 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2860 main.log.report( "_________________________________________________" )
2861 import itertools
2862 import time
2863 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2864 main.step( "Verify IPv6 Ping across all hosts" )
2865 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2866 pingResult = main.FALSE
2867 time1 = time.time()
2868 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002869 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002870 main.log.warn("First ping failed. Retrying...")
2871 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002872 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002873
Hari Krishna4223dbd2015-08-13 16:29:53 -07002874 time2 = time.time()
2875 timeDiff = round( ( time2 - time1 ), 2 )
2876 main.log.report(
2877 "Time taken for IPv6 Ping All: " +
2878 str( timeDiff ) +
2879 " seconds" )
2880 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2881 onpass="PING ALL PASS",
2882 onfail="PING ALL FAIL" )
2883
GlennRCbddd58f2015-10-01 15:45:25 -07002884 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002885 utilities.assert_equals(
2886 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002887 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002888 onpass="IPv6 Ping across 600 point intents test PASS",
2889 onfail="IPv6 Ping across 600 point intents test FAIL" )
2890
2891 def CASE183( self ):
2892 """
2893 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2894 """
2895 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2896 main.log.report( "_________________________________________________" )
2897 import itertools
2898 import time
2899 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2900 main.step( "Verify IPv6 Ping across all hosts" )
2901 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2902 pingResult = main.FALSE
2903 time1 = time.time()
2904 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002905 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002906 main.log.warn("First ping failed. Retrying...")
2907 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002908 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002909
Hari Krishna4223dbd2015-08-13 16:29:53 -07002910 time2 = time.time()
2911 timeDiff = round( ( time2 - time1 ), 2 )
2912 main.log.report(
2913 "Time taken for IPv6 Ping All: " +
2914 str( timeDiff ) +
2915 " seconds" )
2916 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2917 onpass="PING ALL PASS",
2918 onfail="PING ALL FAIL" )
2919
GlennRCbddd58f2015-10-01 15:45:25 -07002920 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002921 utilities.assert_equals(
2922 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002923 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002924 onpass="IPv6 Ping across 600 Point intents test PASS",
2925 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2926
2927 def CASE174( self ):
2928 """
2929 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2930 """
2931 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2932 main.log.report( "_________________________________________________" )
2933 import itertools
2934 import time
2935 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2936 main.step( "Verify IPv6 Ping across all hosts" )
2937 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2938 pingResult = main.FALSE
2939 time1 = time.time()
2940 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002941 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002942 main.log.warn("First ping failed. Retrying...")
2943 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002944 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002945
Hari Krishna4223dbd2015-08-13 16:29:53 -07002946 time2 = time.time()
2947 timeDiff = round( ( time2 - time1 ), 2 )
2948 main.log.report(
2949 "Time taken for IPv6 Ping All: " +
2950 str( timeDiff ) +
2951 " seconds" )
2952 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2953 onpass="PING ALL PASS",
2954 onfail="PING ALL FAIL" )
2955
GlennRCbddd58f2015-10-01 15:45:25 -07002956 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002957 utilities.assert_equals(
2958 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002959 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002960 onpass="IPv6 Ping across 2278 host intents test PASS",
2961 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2962
2963 def CASE184( self ):
2964 """
2965 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2966 """
2967 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2968 main.log.report( "_________________________________________________" )
2969 import itertools
2970 import time
2971 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2972 main.step( "Verify IPv6 Ping across all hosts" )
2973 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2974 pingResult = main.FALSE
2975 time1 = time.time()
2976 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002977 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002978 main.log.warn("First ping failed. Retrying...")
2979 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002980 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002981
Hari Krishna4223dbd2015-08-13 16:29:53 -07002982 time2 = time.time()
2983 timeDiff = round( ( time2 - time1 ), 2 )
2984 main.log.report(
2985 "Time taken for IPv6 Ping All: " +
2986 str( timeDiff ) +
2987 " seconds" )
2988 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2989 onpass="PING ALL PASS",
2990 onfail="PING ALL FAIL" )
2991
GlennRCbddd58f2015-10-01 15:45:25 -07002992 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002993 utilities.assert_equals(
2994 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002995 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002996 onpass="IPv6 Ping across 2278 host intents test PASS",
2997 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2998
2999 def CASE175( self ):
3000 """
3001 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3002 """
3003 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3004 main.log.report( "_________________________________________________" )
3005 import itertools
3006 import time
3007 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3008 main.step( "Verify IPv6 Ping across all hosts" )
3009 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3010 pingResult = main.FALSE
3011 time1 = time.time()
3012 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003013 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003014 main.log.warn("First ping failed. Retrying...")
3015 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003016 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003017
Hari Krishna4223dbd2015-08-13 16:29:53 -07003018 time2 = time.time()
3019 timeDiff = round( ( time2 - time1 ), 2 )
3020 main.log.report(
3021 "Time taken for IPv6 Ping All: " +
3022 str( timeDiff ) +
3023 " seconds" )
3024 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3025 onpass="PING ALL PASS",
3026 onfail="PING ALL FAIL" )
3027
GlennRCbddd58f2015-10-01 15:45:25 -07003028 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003029 utilities.assert_equals(
3030 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003031 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003032 onpass="IPv6 Ping across 4556 point intents test PASS",
3033 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3034
3035 def CASE185( self ):
3036 """
3037 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3038 """
3039 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3040 main.log.report( "_________________________________________________" )
3041 import itertools
3042 import time
3043 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3044 main.step( "Verify IPv6 Ping across all hosts" )
3045 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3046 pingResult = main.FALSE
3047 time1 = time.time()
3048 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003049 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003050 main.log.warn("First ping failed. Retrying...")
3051 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003052 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003053
Hari Krishna4223dbd2015-08-13 16:29:53 -07003054 time2 = time.time()
3055 timeDiff = round( ( time2 - time1 ), 2 )
3056 main.log.report(
3057 "Time taken for IPv6 Ping All: " +
3058 str( timeDiff ) +
3059 " seconds" )
3060 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3061 onpass="PING ALL PASS",
3062 onfail="PING ALL FAIL" )
3063
GlennRCbddd58f2015-10-01 15:45:25 -07003064 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003065 utilities.assert_equals(
3066 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003067 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003068 onpass="IPv6 Ping across 4556 Point intents test PASS",
3069 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3070
Hari Krishnac195f3b2015-07-08 20:02:24 -07003071 def CASE90( self ):
3072 """
3073 Install 600 point intents and verify ping all (Att Topology)
3074 """
3075 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3076 main.log.report( "_______________________________________" )
3077 import itertools
3078 import time
3079 main.case( "Install 600 point intents" )
3080 main.step( "Add point Intents" )
3081 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003082 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3083
Hari Krishnac195f3b2015-07-08 20:02:24 -07003084 intentIdList = []
3085 time1 = time.time()
3086 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3087 pool = []
3088 for cli in main.CLIs:
3089 if i >= len( deviceCombos ):
3090 break
3091 t = main.Thread( target=cli.addPointIntent,
3092 threadID=main.threadID,
3093 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003094 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 -07003095 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003096 t.start()
3097 i = i + 1
3098 main.threadID = main.threadID + 1
3099 for thread in pool:
3100 thread.join()
3101 intentIdList.append(thread.result)
3102 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003103 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003104
GlennRCfcfdc4f2015-09-30 16:01:57 -07003105 # Saving intent ids to check intents in later case
3106 main.intentIds = list(intentIdList)
3107
GlennRCa8d786a2015-09-23 17:40:11 -07003108 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003109
GlennRC1dde1712015-10-02 11:03:08 -07003110 # Giving onos multiple chances to install intents
3111 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003112 if i != 0:
3113 main.log.warn( "Verification failed. Retrying..." )
3114 main.log.info("Waiting for onos to install intents...")
3115 time.sleep( main.checkIntentsDelay )
3116
GlennRCa8d786a2015-09-23 17:40:11 -07003117 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003118 for e in range(int(main.numCtrls)):
3119 main.log.info( "Checking intents on CLI %s" % (e+1) )
3120 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3121 intentState
3122 if not intentState:
3123 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003124 if intentState:
3125 break
GlennRCdb2c8422015-09-29 12:21:59 -07003126 else:
3127 #Dumping intent summary
3128 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003129
3130 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3131 onpass="INTENTS INSTALLED",
3132 onfail="SOME INTENTS NOT INSTALLED" )
3133
Hari Krishnac195f3b2015-07-08 20:02:24 -07003134 main.step( "Verify Ping across all hosts" )
3135 pingResult = main.FALSE
3136 time1 = time.time()
3137 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3138 time2 = time.time()
3139 timeDiff = round( ( time2 - time1 ), 2 )
3140 main.log.report(
3141 "Time taken for Ping All: " +
3142 str( timeDiff ) +
3143 " seconds" )
3144 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3145 onpass="PING tALL PASS",
3146 onfail="PING ALL FAIL" )
3147
GlennRCbddd58f2015-10-01 15:45:25 -07003148 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003149
Hari Krishnac195f3b2015-07-08 20:02:24 -07003150 utilities.assert_equals(
3151 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003152 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003153 onpass="Install 600 point Intents and Ping All test PASS",
3154 onfail="Install 600 point Intents and Ping All test FAIL" )
3155
GlennRCbddd58f2015-10-01 15:45:25 -07003156 if not intentState:
3157 main.log.debug( "Intents failed to install completely" )
3158 if not pingResult:
3159 main.log.debug( "Pingall failed" )
3160
3161 if not caseResult and main.failSwitch:
3162 main.log.report("Stopping test")
3163 main.stop( email=main.emailOnStop )
3164
Hari Krishnac195f3b2015-07-08 20:02:24 -07003165 def CASE91( self ):
3166 """
3167 Install 600 point intents and verify ping all (Chordal Topology)
3168 """
3169 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3170 main.log.report( "_______________________________________" )
3171 import itertools
3172 import time
3173 main.case( "Install 600 point intents" )
3174 main.step( "Add point Intents" )
3175 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003176 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3177
Hari Krishnac195f3b2015-07-08 20:02:24 -07003178 intentIdList = []
3179 time1 = time.time()
3180 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3181 pool = []
3182 for cli in main.CLIs:
3183 if i >= len( deviceCombos ):
3184 break
3185 t = main.Thread( target=cli.addPointIntent,
3186 threadID=main.threadID,
3187 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003188 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 -07003189 pool.append(t)
3190 #time.sleep(1)
3191 t.start()
3192 i = i + 1
3193 main.threadID = main.threadID + 1
3194 for thread in pool:
3195 thread.join()
3196 intentIdList.append(thread.result)
3197 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003198 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003199
GlennRCfcfdc4f2015-09-30 16:01:57 -07003200 # Saving intent ids to check intents in later case
3201 main.intentIds = list(intentIdList)
3202
GlennRCa8d786a2015-09-23 17:40:11 -07003203 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003204
GlennRC1dde1712015-10-02 11:03:08 -07003205 # Giving onos multiple chances to install intents
3206 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003207 if i != 0:
3208 main.log.warn( "Verification failed. Retrying..." )
3209 main.log.info("Waiting for onos to install intents...")
3210 time.sleep( main.checkIntentsDelay )
3211
GlennRCa8d786a2015-09-23 17:40:11 -07003212 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003213 for e in range(int(main.numCtrls)):
3214 main.log.info( "Checking intents on CLI %s" % (e+1) )
3215 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3216 intentState
3217 if not intentState:
3218 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003219 if intentState:
3220 break
GlennRCdb2c8422015-09-29 12:21:59 -07003221 else:
3222 #Dumping intent summary
3223 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003224
3225 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3226 onpass="INTENTS INSTALLED",
3227 onfail="SOME INTENTS NOT INSTALLED" )
3228
Hari Krishnac195f3b2015-07-08 20:02:24 -07003229 main.step( "Verify Ping across all hosts" )
3230 pingResult = main.FALSE
3231 time1 = time.time()
3232 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3233 time2 = time.time()
3234 timeDiff = round( ( time2 - time1 ), 2 )
3235 main.log.report(
3236 "Time taken for Ping All: " +
3237 str( timeDiff ) +
3238 " seconds" )
3239 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3240 onpass="PING ALL PASS",
3241 onfail="PING ALL FAIL" )
3242
GlennRCbddd58f2015-10-01 15:45:25 -07003243 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003244
Hari Krishnac195f3b2015-07-08 20:02:24 -07003245 utilities.assert_equals(
3246 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003247 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003248 onpass="Install 600 point Intents and Ping All test PASS",
3249 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003250
GlennRCbddd58f2015-10-01 15:45:25 -07003251 if not intentState:
3252 main.log.debug( "Intents failed to install completely" )
3253 if not pingResult:
3254 main.log.debug( "Pingall failed" )
3255
3256 if not caseResult and main.failSwitch:
3257 main.log.report("Stopping test")
3258 main.stop( email=main.emailOnStop )
3259
Hari Krishnac195f3b2015-07-08 20:02:24 -07003260 def CASE92( self ):
3261 """
3262 Install 4556 point intents and verify ping all (Spine Topology)
3263 """
3264 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3265 main.log.report( "_______________________________________" )
3266 import itertools
3267 import time
3268 main.case( "Install 4556 point intents" )
3269 main.step( "Add point Intents" )
3270 intentResult = main.TRUE
3271 main.pingTimeout = 600
3272 for i in range(len(main.hostMACs)):
3273 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3274 print main.MACsDict
3275 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3276 intentIdList = []
3277 time1 = time.time()
3278 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3279 pool = []
3280 for cli in main.CLIs:
3281 if i >= len( deviceCombos ):
3282 break
3283 t = main.Thread( target=cli.addPointIntent,
3284 threadID=main.threadID,
3285 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003286 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 -07003287 pool.append(t)
3288 #time.sleep(1)
3289 t.start()
3290 i = i + 1
3291 main.threadID = main.threadID + 1
3292 for thread in pool:
3293 thread.join()
3294 intentIdList.append(thread.result)
3295 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003296 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003297
GlennRCfcfdc4f2015-09-30 16:01:57 -07003298 # Saving intent ids to check intents in later case
3299 main.intentIds = list(intentIdList)
3300
GlennRCa8d786a2015-09-23 17:40:11 -07003301 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003302
GlennRC1dde1712015-10-02 11:03:08 -07003303 # Giving onos multiple chances to install intents
3304 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003305 if i != 0:
3306 main.log.warn( "Verification failed. Retrying..." )
3307 main.log.info("Waiting for onos to install intents...")
3308 time.sleep( main.checkIntentsDelay )
3309
GlennRCa8d786a2015-09-23 17:40:11 -07003310 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003311 for e in range(int(main.numCtrls)):
3312 main.log.info( "Checking intents on CLI %s" % (e+1) )
3313 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3314 intentState
3315 if not intentState:
3316 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003317 if intentState:
3318 break
GlennRCdb2c8422015-09-29 12:21:59 -07003319 else:
3320 #Dumping intent summary
3321 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003322
3323 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3324 onpass="INTENTS INSTALLED",
3325 onfail="SOME INTENTS NOT INSTALLED" )
3326
Hari Krishnac195f3b2015-07-08 20:02:24 -07003327 main.step( "Verify Ping across all hosts" )
3328 pingResult = main.FALSE
3329 time1 = time.time()
3330 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3331 time2 = time.time()
3332 timeDiff = round( ( time2 - time1 ), 2 )
3333 main.log.report(
3334 "Time taken for Ping All: " +
3335 str( timeDiff ) +
3336 " seconds" )
3337 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3338 onpass="PING ALL PASS",
3339 onfail="PING ALL FAIL" )
3340
GlennRCbddd58f2015-10-01 15:45:25 -07003341 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003342
Hari Krishnac195f3b2015-07-08 20:02:24 -07003343 utilities.assert_equals(
3344 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003345 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003346 onpass="Install 4556 point Intents and Ping All test PASS",
3347 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003348
GlennRCbddd58f2015-10-01 15:45:25 -07003349 if not intentState:
3350 main.log.debug( "Intents failed to install completely" )
3351 if not pingResult:
3352 main.log.debug( "Pingall failed" )
3353
3354 if not caseResult and main.failSwitch:
3355 main.log.report("Stopping test")
3356 main.stop( email=main.emailOnStop )
3357
Hari Krishnac195f3b2015-07-08 20:02:24 -07003358 def CASE93( self ):
3359 """
3360 Install multi-single point intents and verify Ping all works
3361 for att topology
3362 """
3363 import copy
3364 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003365 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003366 main.log.report( "Install multi-single point intents and verify Ping all" )
3367 main.log.report( "___________________________________________" )
3368 main.case( "Install multi-single point intents and Ping all" )
3369 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3370 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3371 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003372 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003373 time1 = time.time()
3374 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3375 pool = []
3376 for cli in main.CLIs:
3377 egressDevice = deviceDPIDsCopy[i]
3378 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3379 ingressDeviceList.remove(egressDevice)
3380 if i >= len( deviceDPIDsCopy ):
3381 break
3382 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3383 threadID=main.threadID,
3384 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003385 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003386 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003387 t.start()
3388 i = i + 1
3389 main.threadID = main.threadID + 1
3390 for thread in pool:
3391 thread.join()
3392 intentIdList.append(thread.result)
3393 time2 = time.time()
3394 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003395
GlennRCdb2c8422015-09-29 12:21:59 -07003396 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003397
GlennRC1dde1712015-10-02 11:03:08 -07003398 # Giving onos multiple chances to install intents
3399 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003400 if i != 0:
3401 main.log.warn( "Verification failed. Retrying..." )
3402 main.log.info("Waiting for onos to install intents...")
3403 time.sleep( main.checkIntentsDelay )
3404
3405 intentState = main.TRUE
3406 for e in range(int(main.numCtrls)):
3407 main.log.info( "Checking intents on CLI %s" % (e+1) )
3408 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3409 intentState
3410 if not intentState:
3411 main.log.warn( "Not all intents installed" )
3412 if intentState:
3413 break
3414 else:
3415 #Dumping intent summary
3416 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3417
3418 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3419 onpass="INTENTS INSTALLED",
3420 onfail="SOME INTENTS NOT INSTALLED" )
3421
3422 main.log.info( "Checking flows state" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003423 checkFlowsState = main.ONOScli1.checkFlowsState()
GlennRCdb2c8422015-09-29 12:21:59 -07003424 # Giving onos time to return the state of the flows
Hari Krishnac195f3b2015-07-08 20:02:24 -07003425 time.sleep(50)
GlennRCdb2c8422015-09-29 12:21:59 -07003426
Hari Krishnac195f3b2015-07-08 20:02:24 -07003427 main.step( "Verify Ping across all hosts" )
3428 pingResult = main.FALSE
3429 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003430 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3431 if not pingResult:
3432 time1 = time.time()
3433 main.log.warn("First pingall failed. Retrying")
3434 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3435
Hari Krishnac195f3b2015-07-08 20:02:24 -07003436 time2 = time.time()
3437 timeDiff = round( ( time2 - time1 ), 2 )
3438 main.log.report(
3439 "Time taken for Ping All: " +
3440 str( timeDiff ) +
3441 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003442
GlennRCbddd58f2015-10-01 15:45:25 -07003443 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003444 utilities.assert_equals(
3445 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003446 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003447 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3448 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003449
Hari Krishnac195f3b2015-07-08 20:02:24 -07003450 def CASE94( self ):
3451 """
3452 Install multi-single point intents and verify Ping all works
3453 for Chordal topology
3454 """
3455 import copy
3456 import time
3457 main.log.report( "Install multi-single point intents and verify Ping all" )
3458 main.log.report( "___________________________________________" )
3459 main.case( "Install multi-single point intents and Ping all" )
3460 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3461 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3462 intentIdList = []
3463 print "MACsDict", main.MACsDict
3464 time1 = time.time()
3465 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3466 pool = []
3467 for cli in main.CLIs:
3468 egressDevice = deviceDPIDsCopy[i]
3469 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3470 ingressDeviceList.remove(egressDevice)
3471 if i >= len( deviceDPIDsCopy ):
3472 break
3473 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3474 threadID=main.threadID,
3475 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003476 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003477 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003478 t.start()
3479 i = i + 1
3480 main.threadID = main.threadID + 1
3481 for thread in pool:
3482 thread.join()
3483 intentIdList.append(thread.result)
3484 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003485 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003486
3487 main.step("Verify intents are installed")
3488
GlennRC1dde1712015-10-02 11:03:08 -07003489 # Giving onos multiple chances to install intents
3490 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003491 if i != 0:
3492 main.log.warn( "Verification failed. Retrying..." )
3493 main.log.info("Waiting for onos to install intents...")
3494 time.sleep( main.checkIntentsDelay )
3495
3496 intentState = main.TRUE
3497 for e in range(int(main.numCtrls)):
3498 main.log.info( "Checking intents on CLI %s" % (e+1) )
3499 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3500 intentState
3501 if not intentState:
3502 main.log.warn( "Not all intents installed" )
3503 if intentState:
3504 break
3505 else:
3506 #Dumping intent summary
3507 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3508
3509
3510 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3511 onpass="INTENTS INSTALLED",
3512 onfail="SOME INTENTS NOT INSTALLED" )
3513
Hari Krishnac195f3b2015-07-08 20:02:24 -07003514 main.step( "Verify Ping across all hosts" )
3515 pingResult = main.FALSE
3516 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003517 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3518 if not pingResult:
3519 main.log.info( "First pingall failed. Retrying..." )
3520 time1 = time.time()
3521 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003522 time2 = time.time()
3523 timeDiff = round( ( time2 - time1 ), 2 )
3524 main.log.report(
3525 "Time taken for Ping All: " +
3526 str( timeDiff ) +
3527 " seconds" )
3528
GlennRCdb2c8422015-09-29 12:21:59 -07003529
GlennRCbddd58f2015-10-01 15:45:25 -07003530 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003531 utilities.assert_equals(
3532 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003533 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003534 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3535 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003536
Hari Krishnac195f3b2015-07-08 20:02:24 -07003537 #def CASE95 multi-single point intent for Spine
3538
3539 def CASE96( self ):
3540 """
3541 Install single-multi point intents and verify Ping all works
3542 for att topology
3543 """
3544 import copy
3545 main.log.report( "Install single-multi point intents and verify Ping all" )
3546 main.log.report( "___________________________________________" )
3547 main.case( "Install single-multi point intents and Ping all" )
3548 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3549 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3550 intentIdList = []
3551 print "MACsDict", main.MACsDict
3552 time1 = time.time()
3553 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3554 pool = []
3555 for cli in main.CLIs:
3556 ingressDevice = deviceDPIDsCopy[i]
3557 egressDeviceList = copy.copy(deviceDPIDsCopy)
3558 egressDeviceList.remove(ingressDevice)
3559 if i >= len( deviceDPIDsCopy ):
3560 break
3561 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3562 threadID=main.threadID,
3563 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003564 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003565 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003566 t.start()
3567 i = i + 1
3568 main.threadID = main.threadID + 1
3569 for thread in pool:
3570 thread.join()
3571 intentIdList.append(thread.result)
3572 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003573 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003574
3575 main.step("Verify intents are installed")
3576
GlennRC1dde1712015-10-02 11:03:08 -07003577 # Giving onos multiple chances to install intents
3578 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003579 if i != 0:
3580 main.log.warn( "Verification failed. Retrying..." )
3581 main.log.info("Waiting for onos to install intents...")
3582 time.sleep( main.checkIntentsDelay )
3583
3584 intentState = main.TRUE
3585 for e in range(int(main.numCtrls)):
3586 main.log.info( "Checking intents on CLI %s" % (e+1) )
3587 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3588 intentState
3589 if not intentState:
3590 main.log.warn( "Not all intents installed" )
3591 if intentState:
3592 break
3593 else:
3594 #Dumping intent summary
3595 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3596
3597
3598 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3599 onpass="INTENTS INSTALLED",
3600 onfail="SOME INTENTS NOT INSTALLED" )
3601
Hari Krishnac195f3b2015-07-08 20:02:24 -07003602 main.step( "Verify Ping across all hosts" )
3603 pingResult = main.FALSE
3604 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003605 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3606 if not pingResult:
3607 main.log.info( "First pingall failed. Retrying..." )
3608 time1 = time.time()
3609 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003610 time2 = time.time()
3611 timeDiff = round( ( time2 - time1 ), 2 )
3612 main.log.report(
3613 "Time taken for Ping All: " +
3614 str( timeDiff ) +
3615 " seconds" )
3616
GlennRCbddd58f2015-10-01 15:45:25 -07003617 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003618 utilities.assert_equals(
3619 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003620 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003621 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3622 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3623
3624 def CASE97( self ):
3625 """
3626 Install single-multi point intents and verify Ping all works
3627 for Chordal topology
3628 """
3629 import copy
3630 main.log.report( "Install single-multi point intents and verify Ping all" )
3631 main.log.report( "___________________________________________" )
3632 main.case( "Install single-multi point intents and Ping all" )
3633 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3634 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3635 intentIdList = []
3636 print "MACsDict", main.MACsDict
3637 time1 = time.time()
3638 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3639 pool = []
3640 for cli in main.CLIs:
3641 ingressDevice = deviceDPIDsCopy[i]
3642 egressDeviceList = copy.copy(deviceDPIDsCopy)
3643 egressDeviceList.remove(ingressDevice)
3644 if i >= len( deviceDPIDsCopy ):
3645 break
3646 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3647 threadID=main.threadID,
3648 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003649 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003650 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003651 t.start()
3652 i = i + 1
3653 main.threadID = main.threadID + 1
3654 for thread in pool:
3655 thread.join()
3656 intentIdList.append(thread.result)
3657 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003658 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003659
3660 main.step("Verify intents are installed")
3661
GlennRC1dde1712015-10-02 11:03:08 -07003662 # Giving onos multiple chances to install intents
3663 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003664 if i != 0:
3665 main.log.warn( "Verification failed. Retrying..." )
3666 main.log.info("Waiting for onos to install intents...")
3667 time.sleep( main.checkIntentsDelay )
3668
3669 intentState = main.TRUE
3670 for e in range(int(main.numCtrls)):
3671 main.log.info( "Checking intents on CLI %s" % (e+1) )
3672 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3673 intentState
3674 if not intentState:
3675 main.log.warn( "Not all intents installed" )
3676 if intentState:
3677 break
3678 else:
3679 #Dumping intent summary
3680 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3681
3682
3683 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3684 onpass="INTENTS INSTALLED",
3685 onfail="SOME INTENTS NOT INSTALLED" )
3686
Hari Krishnac195f3b2015-07-08 20:02:24 -07003687 main.step( "Verify Ping across all hosts" )
3688 pingResult = main.FALSE
3689 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003690 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3691 if not pingResult:
3692 main.log.info( "First pingall failed. Retrying..." )
3693 time1 = time.time()
3694 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003695 time2 = time.time()
3696 timeDiff = round( ( time2 - time1 ), 2 )
3697 main.log.report(
3698 "Time taken for Ping All: " +
3699 str( timeDiff ) +
3700 " seconds" )
3701
GlennRCbddd58f2015-10-01 15:45:25 -07003702 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003703 utilities.assert_equals(
3704 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003705 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003706 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3707 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3708
3709 def CASE98( self ):
3710 """
3711 Install single-multi point intents and verify Ping all works
3712 for Spine topology
3713 """
3714 import copy
3715 main.log.report( "Install single-multi point intents and verify Ping all" )
3716 main.log.report( "___________________________________________" )
3717 main.case( "Install single-multi point intents and Ping all" )
3718 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3719 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3720 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3721 intentIdList = []
3722 MACsDictCopy = {}
3723 for i in range( len( deviceDPIDsCopy ) ):
3724 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3725
3726 print "deviceDPIDsCopy", deviceDPIDsCopy
3727 print ""
3728 print "MACsDictCopy", MACsDictCopy
3729 time1 = time.time()
3730 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3731 pool = []
3732 for cli in main.CLIs:
3733 if i >= len( deviceDPIDsCopy ):
3734 break
3735 ingressDevice = deviceDPIDsCopy[i]
3736 egressDeviceList = copy.copy(deviceDPIDsCopy)
3737 egressDeviceList.remove(ingressDevice)
3738 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3739 threadID=main.threadID,
3740 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003741 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003742 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003743 t.start()
3744 i = i + 1
3745 main.threadID = main.threadID + 1
3746 for thread in pool:
3747 thread.join()
3748 intentIdList.append(thread.result)
3749 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003750 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003751
3752 main.step("Verify intents are installed")
3753
GlennRC1dde1712015-10-02 11:03:08 -07003754 # Giving onos multiple chances to install intents
3755 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003756 if i != 0:
3757 main.log.warn( "Verification failed. Retrying..." )
3758 main.log.info("Waiting for onos to install intents...")
3759 time.sleep( main.checkIntentsDelay )
3760
3761 intentState = main.TRUE
3762 for e in range(int(main.numCtrls)):
3763 main.log.info( "Checking intents on CLI %s" % (e+1) )
3764 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3765 intentState
3766 if not intentState:
3767 main.log.warn( "Not all intents installed" )
3768 if intentState:
3769 break
3770 else:
3771 #Dumping intent summary
3772 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3773
3774
3775 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3776 onpass="INTENTS INSTALLED",
3777 onfail="SOME INTENTS NOT INSTALLED" )
3778
Hari Krishnac195f3b2015-07-08 20:02:24 -07003779 main.step( "Verify Ping across all hosts" )
3780 pingResult = main.FALSE
3781 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003782 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3783 if not pingResult:
3784 main.log.info( "First pingall failed. Retrying..." )
3785 time1 = time.time()
3786 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003787 time2 = time.time()
3788 timeDiff = round( ( time2 - time1 ), 2 )
3789 main.log.report(
3790 "Time taken for Ping All: " +
3791 str( timeDiff ) +
3792 " seconds" )
3793
GlennRCbddd58f2015-10-01 15:45:25 -07003794 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003795 utilities.assert_equals(
3796 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003797 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003798 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3799 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3800
Hari Krishna4223dbd2015-08-13 16:29:53 -07003801 def CASE190( self ):
3802 """
3803 Verify IPv6 ping across 600 Point intents (Att Topology)
3804 """
3805 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3806 main.log.report( "_________________________________________________" )
3807 import itertools
3808 import time
3809 main.case( "IPv6 ping all 600 Point intents" )
3810 main.step( "Verify IPv6 Ping across all hosts" )
3811 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3812 pingResult = main.FALSE
3813 time1 = time.time()
3814 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003815 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003816 main.log.warn("First pingall failed. Retrying...")
3817 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003818 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3819
Hari Krishna4223dbd2015-08-13 16:29:53 -07003820 time2 = time.time()
3821 timeDiff = round( ( time2 - time1 ), 2 )
3822 main.log.report(
3823 "Time taken for IPv6 Ping All: " +
3824 str( timeDiff ) +
3825 " seconds" )
3826 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3827 onpass="PING ALL PASS",
3828 onfail="PING ALL FAIL" )
3829
GlennRCbddd58f2015-10-01 15:45:25 -07003830 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003831 utilities.assert_equals(
3832 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003833 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003834 onpass="IPv6 Ping across 600 Point intents test PASS",
3835 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3836
3837 def CASE191( self ):
3838 """
3839 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3840 """
3841 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3842 main.log.report( "_________________________________________________" )
3843 import itertools
3844 import time
3845 main.case( "IPv6 ping all 600 Point intents" )
3846 main.step( "Verify IPv6 Ping across all hosts" )
3847 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3848 pingResult = main.FALSE
3849 time1 = time.time()
3850 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003851 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003852 main.log.warn("First pingall failed. Retrying...")
3853 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003854 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003855
Hari Krishna4223dbd2015-08-13 16:29:53 -07003856 time2 = time.time()
3857 timeDiff = round( ( time2 - time1 ), 2 )
3858 main.log.report(
3859 "Time taken for IPv6 Ping All: " +
3860 str( timeDiff ) +
3861 " seconds" )
3862 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3863 onpass="PING ALL PASS",
3864 onfail="PING ALL FAIL" )
3865
GlennRCbddd58f2015-10-01 15:45:25 -07003866 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003867 utilities.assert_equals(
3868 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003869 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003870 onpass="IPv6 Ping across 600 Point intents test PASS",
3871 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3872
3873 def CASE192( self ):
3874 """
3875 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3876 """
3877 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3878 main.log.report( "_________________________________________________" )
3879 import itertools
3880 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003881 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003882 main.step( "Verify IPv6 Ping across all hosts" )
3883 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3884 pingResult = main.FALSE
3885 time1 = time.time()
3886 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003887 if not pingResult:
3888 main.log.warn("First pingall failed. Retrying...")
3889 time1 = time.time()
3890 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3891
Hari Krishna4223dbd2015-08-13 16:29:53 -07003892 time2 = time.time()
3893 timeDiff = round( ( time2 - time1 ), 2 )
3894 main.log.report(
3895 "Time taken for IPv6 Ping All: " +
3896 str( timeDiff ) +
3897 " seconds" )
3898 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3899 onpass="PING ALL PASS",
3900 onfail="PING ALL FAIL" )
3901
GlennRCbddd58f2015-10-01 15:45:25 -07003902 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003903 utilities.assert_equals(
3904 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003905 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003906 onpass="IPv6 Ping across 4556 Point intents test PASS",
3907 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003908
Hari Krishnac195f3b2015-07-08 20:02:24 -07003909 def CASE10( self ):
3910 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003911 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003912 """
3913 Remove all Intents
3914 """
3915 main.log.report( "Remove all intents that were installed previously" )
3916 main.log.report( "______________________________________________" )
3917 main.log.info( "Remove all intents" )
3918 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003919 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003920 main.step( "Obtain the intent id's first" )
3921 intentsList = main.ONOScli1.getAllIntentIds()
3922 ansi_escape = re.compile( r'\x1b[^m]*m' )
3923 intentsList = ansi_escape.sub( '', intentsList )
3924 intentsList = intentsList.replace(
3925 " onos:intents | grep id=",
3926 "" ).replace(
3927 "id=",
3928 "" ).replace(
3929 "\r\r",
3930 "" )
3931 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003932 intentIdList = []
3933 step1Result = main.TRUE
3934 moreIntents = main.TRUE
3935 removeIntentCount = 0
3936 intentsCount = len(intentsList)
3937 main.log.info ( "Current number of intents: " + str(intentsCount) )
3938 if ( len( intentsList ) > 1 ):
3939 results = main.TRUE
3940 main.log.info("Removing intent...")
3941 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003942 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003943 if removeIntentCount == 5:
3944 break
3945 removeIntentCount = removeIntentCount + 1
3946 intentsList1 = main.ONOScli1.getAllIntentIds()
3947 if len( intentsList1 ) == 0:
3948 break
3949 ansi_escape = re.compile( r'\x1b[^m]*m' )
3950 intentsList1 = ansi_escape.sub( '', intentsList1 )
3951 intentsList1 = intentsList1.replace(
3952 " onos:intents | grep id=",
3953 "" ).replace(
3954 " state=",
3955 "" ).replace(
3956 "\r\r",
3957 "" )
3958 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003959 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3960 print intentsList1
3961 intentIdList1 = []
3962 if ( len( intentsList1 ) > 0 ):
3963 moreIntents = main.TRUE
3964 for i in range( len( intentsList1 ) ):
3965 intentsTemp1 = intentsList1[ i ].split( ',' )
3966 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3967 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3968 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3969 time1 = time.time()
3970 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3971 pool = []
3972 for cli in main.CLIs:
3973 if i >= len( intentIdList1 ):
3974 break
3975 t = main.Thread( target=cli.removeIntent,
3976 threadID=main.threadID,
3977 name="removeIntent",
3978 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3979 pool.append(t)
3980 t.start()
3981 i = i + 1
3982 main.threadID = main.threadID + 1
3983 for thread in pool:
3984 thread.join()
3985 intentIdList.append(thread.result)
3986 #time.sleep(2)
3987 time2 = time.time()
3988 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003989 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003990 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003991 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003992 else:
3993 time.sleep(10)
3994 if len( main.ONOScli1.intents()):
3995 continue
3996 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003997 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003998 else:
3999 print "Removed %d intents" %(intentsCount)
4000 step1Result = main.TRUE
4001 else:
4002 print "No Intent IDs found in Intents list: ", intentsList
4003 step1Result = main.FALSE
4004
4005 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004006 caseResult = step1Result
4007 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004008 onpass="Intent removal test successful",
4009 onfail="Intent removal test failed" )
4010
4011 def CASE12( self, main ):
4012 """
4013 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4014 """
4015 import re
4016 import copy
4017 import time
4018
Hari Krishnac195f3b2015-07-08 20:02:24 -07004019 threadID = 0
4020
4021 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4022 main.log.report( "_____________________________________________________" )
4023 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4024 main.step( "Enable intent based Reactive forwarding" )
4025 installResult = main.FALSE
4026 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004027
Hari Krishnac195f3b2015-07-08 20:02:24 -07004028 pool = []
4029 time1 = time.time()
4030 for cli,feature in main.CLIs:
4031 t = main.Thread(target=cli,threadID=threadID,
4032 name="featureInstall",args=[feature])
4033 pool.append(t)
4034 t.start()
4035 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004036
Hari Krishnac195f3b2015-07-08 20:02:24 -07004037 results = []
4038 for thread in pool:
4039 thread.join()
4040 results.append(thread.result)
4041 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004042
Hari Krishnac195f3b2015-07-08 20:02:24 -07004043 if( all(result == main.TRUE for result in results) == False):
4044 main.log.info("Did not install onos-app-ifwd feature properly")
4045 #main.cleanup()
4046 #main.exit()
4047 else:
4048 main.log.info("Successful feature:install onos-app-ifwd")
4049 installResult = main.TRUE
4050 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004051
Hari Krishnac195f3b2015-07-08 20:02:24 -07004052 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07004053 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07004054 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07004055 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004056 time2 = time.time()
4057 timeDiff = round( ( time2 - time1 ), 2 )
4058 main.log.report(
4059 "Time taken for Ping All: " +
4060 str( timeDiff ) +
4061 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004062
GlennRC626ba132015-09-18 16:16:31 -07004063 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004064 main.log.report( "Pingall Test in Reactive mode successful" )
4065 else:
4066 main.log.report( "Pingall Test in Reactive mode failed" )
4067
4068 main.step( "Disable Intent based Reactive forwarding" )
4069 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004070
Hari Krishnac195f3b2015-07-08 20:02:24 -07004071 pool = []
4072 time1 = time.time()
4073 for cli,feature in main.CLIs:
4074 t = main.Thread(target=cli,threadID=threadID,
4075 name="featureUninstall",args=[feature])
4076 pool.append(t)
4077 t.start()
4078 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004079
Hari Krishnac195f3b2015-07-08 20:02:24 -07004080 results = []
4081 for thread in pool:
4082 thread.join()
4083 results.append(thread.result)
4084 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004085
Hari Krishnac195f3b2015-07-08 20:02:24 -07004086 if( all(result == main.TRUE for result in results) == False):
4087 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4088 uninstallResult = main.FALSE
4089 #main.cleanup()
4090 #main.exit()
4091 else:
4092 main.log.info("Successful feature:uninstall onos-app-ifwd")
4093 uninstallResult = main.TRUE
4094 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4095
4096 # Waiting for reative flows to be cleared.
4097 time.sleep( 10 )
4098
GlennRCbddd58f2015-10-01 15:45:25 -07004099 caseResult = installResult and pingResult and uninstallResult
4100 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004101 onpass="Intent based Reactive forwarding Pingall test PASS",
4102 onfail="Intent based Reactive forwarding Pingall test FAIL" )