blob: 45fddb1bc8f3e9eb5816312a4e0fc42052126a61 [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'] )
GlennRC9e7465e2015-10-02 13:50:36 -070036 main.failSwitch = main.params['TEST']['fail_switch']
37 main.emailOnStop = 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
GlennRC9e7465e2015-10-02 13:50:36 -070042 main.failSwitch = True if main.failSwitch == "on" else False
43 main.emailOnStop = True if main.emailOnStop == "on" else False
44
Hari Krishnac195f3b2015-07-08 20:02:24 -070045 for i in range( 1, int(main.numCtrls) + 1 ):
46 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070047
48 main.case( "Set up test environment" )
49 main.log.report( "Set up test environment" )
50 main.log.report( "_______________________" )
51
Hari Krishna6185fc12015-07-13 15:42:31 -070052 main.step( "Apply Cell environment for ONOS" )
53 if ( main.onoscell ):
54 cellName = main.onoscell
55 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070056 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
57 onpass="Test step PASS",
58 onfail="Test step FAIL" )
59 else:
60 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
61 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
62 main.clean()
63 main.exit()
64
Hari Krishnac195f3b2015-07-08 20:02:24 -070065 main.step( "Git checkout and pull " + git_branch )
66 if git_pull == 'on':
67 checkout_result = main.ONOSbench.gitCheckout( git_branch )
68 pull_result = main.ONOSbench.gitPull()
69 cp_result = ( checkout_result and pull_result )
70 else:
71 checkout_result = main.TRUE
72 pull_result = main.TRUE
73 main.log.info( "Skipped git checkout and pull" )
74 cp_result = ( checkout_result and pull_result )
75 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
76 onpass="Test step PASS",
77 onfail="Test step FAIL" )
78
79 main.step( "mvn clean & install" )
80 if git_pull == 'on':
81 mvn_result = main.ONOSbench.cleanInstall()
82 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
83 onpass="Test step PASS",
84 onfail="Test step FAIL" )
85 else:
86 mvn_result = main.TRUE
87 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
88
89 main.ONOSbench.getVersion( report=True )
90
Hari Krishnac195f3b2015-07-08 20:02:24 -070091 main.step( "Create ONOS package" )
92 packageResult = main.ONOSbench.onosPackage()
93 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
94 onpass="Test step PASS",
95 onfail="Test step FAIL" )
96
97 main.step( "Uninstall ONOS package on all Nodes" )
98 uninstallResult = main.TRUE
99 for i in range( int( main.numCtrls ) ):
100 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
101 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
102 utilities.assert_equals( expect=main.TRUE, actual=u_result,
103 onpass="Test step PASS",
104 onfail="Test step FAIL" )
105 uninstallResult = ( uninstallResult and u_result )
106
107 main.step( "Install ONOS package on all Nodes" )
108 installResult = main.TRUE
109 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700110 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700111 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
112 utilities.assert_equals( expect=main.TRUE, actual=i_result,
113 onpass="Test step PASS",
114 onfail="Test step FAIL" )
115 installResult = ( installResult and i_result )
116
117 main.step( "Verify ONOS nodes UP status" )
118 statusResult = main.TRUE
119 for i in range( int( main.numCtrls ) ):
120 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
121 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
122 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
123 onpass="Test step PASS",
124 onfail="Test step FAIL" )
125 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700126
Hari Krishnac195f3b2015-07-08 20:02:24 -0700127 main.step( "Start ONOS CLI on all nodes" )
128 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700129 main.log.step(" Start ONOS cli using thread ")
130 startCliResult = main.TRUE
131 pool = []
132 time1 = time.time()
133 for i in range( int( main.numCtrls) ):
134 t = main.Thread( target=main.CLIs[i].startOnosCli,
135 threadID=main.threadID,
136 name="startOnosCli",
137 args=[ main.onosIPs[i], karafTimeout ] )
138 pool.append(t)
139 t.start()
140 main.threadID = main.threadID + 1
141 for t in pool:
142 t.join()
143 startCliResult = startCliResult and t.result
144 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700145
Hari Krishnac195f3b2015-07-08 20:02:24 -0700146 if not startCliResult:
147 main.log.info("ONOS CLI did not start up properly")
148 main.cleanup()
149 main.exit()
150 else:
151 main.log.info("Successful CLI startup")
152 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700153
154 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
155 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
156 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
157 cfgResult = cfgResult1 and cfgResult2
158 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
159 onpass="ipv6NeighborDiscovery cfg is set to true",
160 onfail="Failed to cfg set ipv6NeighborDiscovery" )
161
162 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700163 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
164 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
165 onpass="Set up test environment PASS",
166 onfail="Set up test environment FAIL" )
167
168 def CASE20( self, main ):
169 """
170 This test script Loads a new Topology (Att) on CHO setup and balances all switches
171 """
172 import re
173 import time
174 import copy
175
176 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
177 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
178 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
179 main.pingTimeout = 300
180 main.log.report(
181 "Load Att topology and Balance all Mininet switches across controllers" )
182 main.log.report(
183 "________________________________________________________________________" )
184 main.case(
185 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700186
Hari Krishnac195f3b2015-07-08 20:02:24 -0700187 main.step( "Stop any previous Mininet network topology" )
188 cliResult = main.TRUE
189 if main.newTopo == main.params['TOPO3']['topo']:
190 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
191
192 main.step( "Start Mininet with Att topology" )
193 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700194 mininetDir = main.Mininet1.home + "/custom/"
195 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
196 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
197 topoPath = mininetDir + main.newTopo
198 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700199
Hari Krishnac195f3b2015-07-08 20:02:24 -0700200 main.step( "Assign switches to controllers" )
201 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
202 main.Mininet1.assignSwController(
203 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700204 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700205
206 switch_mastership = main.TRUE
207 for i in range( 1, ( main.numMNswitches + 1 ) ):
208 response = main.Mininet1.getSwController( "s" + str( i ) )
209 print( "Response is " + str( response ) )
210 if re.search( "tcp:" + main.onosIPs[0], response ):
211 switch_mastership = switch_mastership and main.TRUE
212 else:
213 switch_mastership = main.FALSE
214
215 if switch_mastership == main.TRUE:
216 main.log.report( "Controller assignment successfull" )
217 else:
218 main.log.report( "Controller assignment failed" )
219
220 time.sleep(30) # waiting here to make sure topology converges across all nodes
221
222 main.step( "Balance devices across controllers" )
223 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700224 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700225 time.sleep( 5 )
226
227 topology_output = main.ONOScli1.topology()
228 topology_result = main.ONOSbench.getTopology( topology_output )
229 case2Result = ( switch_mastership and startStatus )
230 utilities.assert_equals(
231 expect=main.TRUE,
232 actual=case2Result,
233 onpass="Starting new Att topology test PASS",
234 onfail="Starting new Att topology test FAIL" )
235
236 def CASE21( self, main ):
237 """
238 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
239 """
240 import re
241 import time
242 import copy
243
244 main.newTopo = main.params['TOPO2']['topo']
245 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
246 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
247 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
248 main.pingTimeout = 300
249 main.log.report(
250 "Load Chordal topology and Balance all Mininet switches across controllers" )
251 main.log.report(
252 "________________________________________________________________________" )
253 main.case(
254 "Assign and Balance all Mininet switches across controllers" )
255
256 main.step( "Stop any previous Mininet network topology" )
257 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
258
GlennRCc6cd2a62015-08-10 16:08:22 -0700259 main.step("Start Mininet with Chordal topology")
260 mininetDir = main.Mininet1.home + "/custom/"
261 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
262 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
263 topoPath = mininetDir + main.newTopo
264 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265
266 main.step( "Assign switches to controllers" )
267
268 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
269 main.Mininet1.assignSwController(
270 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700271 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700272
273 switch_mastership = main.TRUE
274 for i in range( 1, ( main.numMNswitches + 1 ) ):
275 response = main.Mininet1.getSwController( "s" + str( i ) )
276 print( "Response is " + str( response ) )
277 if re.search( "tcp:" + main.onosIPs[0], response ):
278 switch_mastership = switch_mastership and main.TRUE
279 else:
280 switch_mastership = main.FALSE
281
282 if switch_mastership == main.TRUE:
283 main.log.report( "Controller assignment successfull" )
284 else:
285 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700286
Hari Krishnac195f3b2015-07-08 20:02:24 -0700287 main.step( "Balance devices across controllers" )
288 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700289 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290 time.sleep( 5 )
291
GlennRCbddd58f2015-10-01 15:45:25 -0700292 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293 time.sleep(30)
294 utilities.assert_equals(
295 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700296 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297 onpass="Starting new Chordal topology test PASS",
298 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700299
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300 def CASE22( self, main ):
301 """
302 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
303 """
304 import re
305 import time
306 import copy
307
308 main.newTopo = main.params['TOPO3']['topo']
309 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
310 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
311 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
312 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700313
Hari Krishnac195f3b2015-07-08 20:02:24 -0700314 main.log.report(
315 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
316 main.log.report(
317 "________________________________________________________________________" )
318 main.case(
319 "Assign and Balance all Mininet switches across controllers" )
320 main.step( "Stop any previous Mininet network topology" )
321 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700322
323 main.step("Start Mininet with Spine topology")
324 mininetDir = main.Mininet1.home + "/custom/"
325 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
326 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
327 topoPath = mininetDir + main.newTopo
328 startStatus = main.Mininet1.startNet(topoFile = topoPath)
329
Hari Krishnac195f3b2015-07-08 20:02:24 -0700330 time.sleep(60)
331 main.step( "Assign switches to controllers" )
332
333 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
334 main.Mininet1.assignSwController(
335 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700336 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700337
338 switch_mastership = main.TRUE
339 for i in range( 1, ( main.numMNswitches + 1 ) ):
340 response = main.Mininet1.getSwController( "s" + str( i ) )
341 print( "Response is " + str( response ) )
342 if re.search( "tcp:" + main.onosIPs[0], response ):
343 switch_mastership = switch_mastership and main.TRUE
344 else:
345 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700346
Hari Krishnac195f3b2015-07-08 20:02:24 -0700347 if switch_mastership == main.TRUE:
348 main.log.report( "Controller assignment successfull" )
349 else:
350 main.log.report( "Controller assignment failed" )
351 time.sleep( 5 )
352
353 main.step( "Balance devices across controllers" )
354 for i in range( int( main.numCtrls ) ):
355 balanceResult = main.ONOScli1.balanceMasters()
356 # giving some breathing time for ONOS to complete re-balance
357 time.sleep( 3 )
358
GlennRCbddd58f2015-10-01 15:45:25 -0700359 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700360 time.sleep(60)
361 utilities.assert_equals(
362 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700363 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700364 onpass="Starting new Spine topology test PASS",
365 onfail="Starting new Spine topology test FAIL" )
366
367 def CASE3( self, main ):
368 """
369 This Test case will be extended to collect and store more data related
370 ONOS state.
371 """
372 import re
373 import copy
374 main.deviceDPIDs = []
375 main.hostMACs = []
376 main.deviceLinks = []
377 main.deviceActiveLinksCount = []
378 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700379
Hari Krishnac195f3b2015-07-08 20:02:24 -0700380 main.log.report(
381 "Collect and Store topology details from ONOS before running any Tests" )
382 main.log.report(
383 "____________________________________________________________________" )
384 main.case( "Collect and Store Topology Details from ONOS" )
385 main.step( "Collect and store current number of switches and links" )
386 topology_output = main.ONOScli1.topology()
387 topology_result = main.ONOSbench.getTopology( topology_output )
388 numOnosDevices = topology_result[ 'devices' ]
389 numOnosLinks = topology_result[ 'links' ]
390 topoResult = main.TRUE
391
392 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
393 main.step( "Store Device DPIDs" )
394 for i in range( 1, (main.numMNswitches+1) ):
395 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
396 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
397
398 main.step( "Store Host MACs" )
399 for i in range( 1, ( main.numMNhosts + 1 ) ):
400 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
401 print "Host MACs in Store: \n", str( main.hostMACs )
402 main.MACsDict = {}
403 print "Creating dictionary of DPID and HostMacs"
404 for i in range(len(main.hostMACs)):
405 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
406 print main.MACsDict
407 main.step( "Collect and store all Devices Links" )
408 linksResult = main.ONOScli1.links( jsonFormat=False )
409 ansi_escape = re.compile( r'\x1b[^m]*m' )
410 linksResult = ansi_escape.sub( '', linksResult )
411 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
412 linksResult = linksResult.splitlines()
413 main.deviceLinks = copy.copy( linksResult )
414 print "Device Links Stored: \n", str( main.deviceLinks )
415 # this will be asserted to check with the params provided count of
416 # links
417 print "Length of Links Store", len( main.deviceLinks )
418
419 main.step( "Collect and store each Device ports enabled Count" )
420 time1 = time.time()
421 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
422 pool = []
423 for cli in main.CLIs:
424 if i >= main.numMNswitches + 1:
425 break
426 dpid = "of:00000000000000" + format( i,'02x' )
427 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
428 t.start()
429 pool.append(t)
430 i = i + 1
431 main.threadID = main.threadID + 1
432 for thread in pool:
433 thread.join()
434 portResult = thread.result
435 main.devicePortsEnabledCount.append( portResult )
436 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
437 time2 = time.time()
438 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
439
440 main.step( "Collect and store each Device active links Count" )
441 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700442
Hari Krishnac195f3b2015-07-08 20:02:24 -0700443 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
444 pool = []
445 for cli in main.CLIs:
446 if i >= main.numMNswitches + 1:
447 break
448 dpid = "of:00000000000000" + format( i,'02x' )
449 t = main.Thread( target = cli.getDeviceLinksActiveCount,
450 threadID = main.threadID,
451 name = "getDevicePortsEnabledCount",
452 args = [dpid])
453 t.start()
454 pool.append(t)
455 i = i + 1
456 main.threadID = main.threadID + 1
457 for thread in pool:
458 thread.join()
459 linkCountResult = thread.result
460 main.deviceActiveLinksCount.append( linkCountResult )
461 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
462 time2 = time.time()
463 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
464
465 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700466 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700467 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
468 main.log.info("Devices (actual): %s, Links (actual): %s" %
469 ( numOnosDevices , numOnosLinks ) )
470 main.log.info("Topology does not match, exiting CHO test...")
471 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700472 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700473 main.cleanup()
474 main.exit()
475
476 # just returning TRUE for now as this one just collects data
477 case3Result = topoResult
478 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
479 onpass="Saving ONOS topology data test PASS",
480 onfail="Saving ONOS topology data test FAIL" )
481
482 def CASE40( self, main ):
483 """
484 Verify Reactive forwarding (Att Topology)
485 """
486 import re
487 import copy
488 import time
489 main.log.report( "Verify Reactive forwarding (Att Topology)" )
490 main.log.report( "______________________________________________" )
491 main.case( "Enable Reactive forwarding and Verify ping all" )
492 main.step( "Enable Reactive forwarding" )
493 installResult = main.TRUE
494 # Activate fwd app
495 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
496 appCheck = main.TRUE
497 pool = []
498 for cli in main.CLIs:
499 t = main.Thread( target=cli.appToIDCheck,
500 name="appToIDCheck-" + str( i ),
501 args=[] )
502 pool.append( t )
503 t.start()
504 for t in pool:
505 t.join()
506 appCheck = appCheck and t.result
507 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
508 onpass="App Ids seem to be correct",
509 onfail="Something is wrong with app Ids" )
510 if appCheck != main.TRUE:
511 main.log.warn( main.CLIs[0].apps() )
512 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700513
Hari Krishnac195f3b2015-07-08 20:02:24 -0700514 time.sleep( 10 )
515
516 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700517 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700518 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700519 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
520 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700521 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700522 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700523 time2 = time.time()
524 timeDiff = round( ( time2 - time1 ), 2 )
525 main.log.report(
526 "Time taken for Ping All: " +
527 str( timeDiff ) +
528 " seconds" )
529
GlennRC626ba132015-09-18 16:16:31 -0700530 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700531 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700532 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700533 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700534
GlennRCbddd58f2015-10-01 15:45:25 -0700535 caseResult = appCheck and pingResult
536 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700537 onpass="Reactive Mode IPv4 Pingall test PASS",
538 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700539
540 def CASE41( self, main ):
541 """
542 Verify Reactive forwarding (Chordal Topology)
543 """
544 import re
545 import copy
546 import time
547 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
548 main.log.report( "______________________________________________" )
549 main.case( "Enable Reactive forwarding and Verify ping all" )
550 main.step( "Enable Reactive forwarding" )
551 installResult = main.TRUE
552 # Activate fwd app
553 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
554
555 appCheck = main.TRUE
556 pool = []
557 for cli in main.CLIs:
558 t = main.Thread( target=cli.appToIDCheck,
559 name="appToIDCheck-" + str( i ),
560 args=[] )
561 pool.append( t )
562 t.start()
563 for t in pool:
564 t.join()
565 appCheck = appCheck and t.result
566 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
567 onpass="App Ids seem to be correct",
568 onfail="Something is wrong with app Ids" )
569 if appCheck != main.TRUE:
570 main.log.warn( main.CLIs[0].apps() )
571 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700572
Hari Krishnac195f3b2015-07-08 20:02:24 -0700573 time.sleep( 10 )
574
575 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700576 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700577 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700578 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
579 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700580 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700581 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700582 time2 = time.time()
583 timeDiff = round( ( time2 - time1 ), 2 )
584 main.log.report(
585 "Time taken for Ping All: " +
586 str( timeDiff ) +
587 " seconds" )
588
GlennRC626ba132015-09-18 16:16:31 -0700589 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700590 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700591 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700592 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700593
GlennRCbddd58f2015-10-01 15:45:25 -0700594 caseResult = appCheck and pingResult
595 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700596 onpass="Reactive Mode IPv4 Pingall test PASS",
597 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700598
599 def CASE42( self, main ):
600 """
601 Verify Reactive forwarding (Spine Topology)
602 """
603 import re
604 import copy
605 import time
606 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
607 main.log.report( "______________________________________________" )
608 main.case( "Enable Reactive forwarding and Verify ping all" )
609 main.step( "Enable Reactive forwarding" )
610 installResult = main.TRUE
611 # Activate fwd app
612 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
613
614 appCheck = main.TRUE
615 pool = []
616 for cli in main.CLIs:
617 t = main.Thread( target=cli.appToIDCheck,
618 name="appToIDCheck-" + str( i ),
619 args=[] )
620 pool.append( t )
621 t.start()
622 for t in pool:
623 t.join()
624 appCheck = appCheck and t.result
625 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
626 onpass="App Ids seem to be correct",
627 onfail="Something is wrong with app Ids" )
628 if appCheck != main.TRUE:
629 main.log.warn( main.CLIs[0].apps() )
630 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700631
Hari Krishnac195f3b2015-07-08 20:02:24 -0700632 time.sleep( 10 )
633
634 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700635 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700636 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700637 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
638 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700639 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700640 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700641 time2 = time.time()
642 timeDiff = round( ( time2 - time1 ), 2 )
643 main.log.report(
644 "Time taken for Ping All: " +
645 str( timeDiff ) +
646 " seconds" )
647
GlennRC626ba132015-09-18 16:16:31 -0700648 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700649 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700650 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700651 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
652
GlennRCbddd58f2015-10-01 15:45:25 -0700653 caseResult = appCheck and pingResult
654 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700655 onpass="Reactive Mode IPv4 Pingall test PASS",
656 onfail="Reactive Mode IPv4 Pingall test FAIL" )
657
658 def CASE140( self, main ):
659 """
660 Verify IPv6 Reactive forwarding (Att Topology)
661 """
662 import re
663 import copy
664 import time
665 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
666 main.log.report( "______________________________________________" )
667 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
668 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
669
670 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
671 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
672 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
673 cfgResult = cfgResult1 and cfgResult2
674 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
675 onpass="Reactive mode ipv6Fowarding cfg is set to true",
676 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
677
678 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700679 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700680 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700681 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
682 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700683 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700684 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700685 time2 = time.time()
686 timeDiff = round( ( time2 - time1 ), 2 )
687 main.log.report(
688 "Time taken for IPv6 Ping All: " +
689 str( timeDiff ) +
690 " seconds" )
691
GlennRC626ba132015-09-18 16:16:31 -0700692 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700693 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
694 else:
695 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700696
697 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700698
Hari Krishnac195f3b2015-07-08 20:02:24 -0700699 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700700 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700701 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
702 pool = []
703 for cli in main.CLIs:
704 t = main.Thread( target=cli.appToIDCheck,
705 name="appToIDCheck-" + str( i ),
706 args=[] )
707 pool.append( t )
708 t.start()
709
710 for t in pool:
711 t.join()
712 appCheck = appCheck and t.result
713 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
714 onpass="App Ids seem to be correct",
715 onfail="Something is wrong with app Ids" )
716 if appCheck != main.TRUE:
717 main.log.warn( main.CLIs[0].apps() )
718 main.log.warn( main.CLIs[0].appIDs() )
719
720 # Waiting for reative flows to be cleared.
721 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700722 caseResult = appCheck and cfgResult and pingResult
723 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700724 onpass="Reactive Mode IPv6 Pingall test PASS",
725 onfail="Reactive Mode IPv6 Pingall test FAIL" )
726
727 def CASE141( self, main ):
728 """
729 Verify IPv6 Reactive forwarding (Chordal Topology)
730 """
731 import re
732 import copy
733 import time
734 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
735 main.log.report( "______________________________________________" )
736 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
737 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
738
739 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
740 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
741 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
742 cfgResult = cfgResult1 and cfgResult2
743 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
744 onpass="Reactive mode ipv6Fowarding cfg is set to true",
745 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
746
747 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700748 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700749 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700750 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
751 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700752 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700753 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700754 time2 = time.time()
755 timeDiff = round( ( time2 - time1 ), 2 )
756 main.log.report(
757 "Time taken for IPv6 Ping All: " +
758 str( timeDiff ) +
759 " seconds" )
760
GlennRC626ba132015-09-18 16:16:31 -0700761 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700762 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
763 else:
764 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
765
766 main.step( "Disable Reactive forwarding" )
767
768 main.log.info( "Uninstall reactive forwarding app" )
769 appCheck = main.TRUE
770 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
771 pool = []
772 for cli in main.CLIs:
773 t = main.Thread( target=cli.appToIDCheck,
774 name="appToIDCheck-" + str( i ),
775 args=[] )
776 pool.append( t )
777 t.start()
778
779 for t in pool:
780 t.join()
781 appCheck = appCheck and t.result
782 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
783 onpass="App Ids seem to be correct",
784 onfail="Something is wrong with app Ids" )
785 if appCheck != main.TRUE:
786 main.log.warn( main.CLIs[0].apps() )
787 main.log.warn( main.CLIs[0].appIDs() )
788
789 # Waiting for reative flows to be cleared.
790 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700791 caseResult = appCheck and cfgResult and pingResult
792 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700793 onpass="Reactive Mode IPv6 Pingall test PASS",
794 onfail="Reactive Mode IPv6 Pingall test FAIL" )
795
796 def CASE142( self, main ):
797 """
798 Verify IPv6 Reactive forwarding (Spine Topology)
799 """
800 import re
801 import copy
802 import time
803 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
804 main.log.report( "______________________________________________" )
805 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
806 # Spine topology do not have hosts h1-h10
807 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
808 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
809 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
810 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
811 cfgResult = cfgResult1 and cfgResult2
812 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
813 onpass="Reactive mode ipv6Fowarding cfg is set to true",
814 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
815
816 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700817 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700818 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -0700819 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
820 if not ping_result:
821 main.log.warn("First pingall failed. Trying again...")
822 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700823 time2 = time.time()
824 timeDiff = round( ( time2 - time1 ), 2 )
825 main.log.report(
826 "Time taken for IPv6 Ping All: " +
827 str( timeDiff ) +
828 " seconds" )
829
GlennRC626ba132015-09-18 16:16:31 -0700830 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700831 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
832 else:
833 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
834
835 main.step( "Disable Reactive forwarding" )
836
837 main.log.info( "Uninstall reactive forwarding app" )
838 appCheck = main.TRUE
839 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
840 pool = []
841 for cli in main.CLIs:
842 t = main.Thread( target=cli.appToIDCheck,
843 name="appToIDCheck-" + str( i ),
844 args=[] )
845 pool.append( t )
846 t.start()
847
848 for t in pool:
849 t.join()
850 appCheck = appCheck and t.result
851 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
852 onpass="App Ids seem to be correct",
853 onfail="Something is wrong with app Ids" )
854 if appCheck != main.TRUE:
855 main.log.warn( main.CLIs[0].apps() )
856 main.log.warn( main.CLIs[0].appIDs() )
857
858 # Waiting for reative flows to be cleared.
859 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700860 caseResult = appCheck and cfgResult and pingResult
861 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700862 onpass="Reactive Mode IPv6 Pingall test PASS",
863 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700864
865 def CASE5( self, main ):
866 """
867 Compare current ONOS topology with reference data
868 """
869 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700870
Hari Krishnac195f3b2015-07-08 20:02:24 -0700871 devicesDPIDTemp = []
872 hostMACsTemp = []
873 deviceLinksTemp = []
874 deviceActiveLinksCountTemp = []
875 devicePortsEnabledCountTemp = []
876
877 main.log.report(
878 "Compare ONOS topology with reference data in Stores" )
879 main.log.report( "__________________________________________________" )
880 main.case( "Compare ONOS topology with reference data" )
881
882 main.step( "Compare current Device ports enabled with reference" )
883 time1 = time.time()
884 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
885 pool = []
886 for cli in main.CLIs:
887 if i >= main.numMNswitches + 1:
888 break
889 dpid = "of:00000000000000" + format( i,'02x' )
890 t = main.Thread(target = cli.getDevicePortsEnabledCount,
891 threadID = main.threadID,
892 name = "getDevicePortsEnabledCount",
893 args = [dpid])
894 t.start()
895 pool.append(t)
896 i = i + 1
897 main.threadID = main.threadID + 1
898 for thread in pool:
899 thread.join()
900 portResult = thread.result
901 #portTemp = re.split( r'\t+', portResult )
902 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
903 devicePortsEnabledCountTemp.append( portResult )
904
905 time2 = time.time()
906 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
907 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700908 "Device Enabled ports EXPECTED: %s" %
909 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700910 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700911 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700912 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700913
Hari Krishnac195f3b2015-07-08 20:02:24 -0700914 if ( cmp( main.devicePortsEnabledCount,
915 devicePortsEnabledCountTemp ) == 0 ):
916 stepResult1 = main.TRUE
917 else:
918 stepResult1 = main.FALSE
919
920 main.step( "Compare Device active links with reference" )
921 time1 = time.time()
922 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
923 pool = []
924 for cli in main.CLIs:
925 if i >= main.numMNswitches + 1:
926 break
927 dpid = "of:00000000000000" + format( i,'02x' )
928 t = main.Thread(target = cli.getDeviceLinksActiveCount,
929 threadID = main.threadID,
930 name = "getDeviceLinksActiveCount",
931 args = [dpid])
932 t.start()
933 pool.append(t)
934 i = i + 1
935 main.threadID = main.threadID + 1
936 for thread in pool:
937 thread.join()
938 linkCountResult = thread.result
939 #linkCountTemp = re.split( r'\t+', linkCountResult )
940 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
941 deviceActiveLinksCountTemp.append( linkCountResult )
942
943 time2 = time.time()
944 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
945 main.log.info (
946 "Device Active links EXPECTED: %s" %
947 str( main.deviceActiveLinksCount ) )
948 main.log.info (
949 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
950 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
951 stepResult2 = main.TRUE
952 else:
953 stepResult2 = main.FALSE
954
955 """
956 place holder for comparing devices, hosts, paths and intents if required.
957 Links and ports data would be incorrect with out devices anyways.
958 """
959 case5Result = ( stepResult1 and stepResult2 )
960 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
961 onpass="Compare Topology test PASS",
962 onfail="Compare Topology test FAIL" )
963
964 def CASE60( self ):
965 """
966 Install 300 host intents and verify ping all (Att Topology)
967 """
968 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
969 main.log.report( "_______________________________________" )
970 import itertools
971 import time
972 main.case( "Install 300 host intents" )
973 main.step( "Add host Intents" )
974 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700975 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
976
Hari Krishnac195f3b2015-07-08 20:02:24 -0700977 intentIdList = []
978 time1 = time.time()
979 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
980 pool = []
981 for cli in main.CLIs:
982 if i >= len( hostCombos ):
983 break
984 t = main.Thread( target=cli.addHostIntent,
985 threadID=main.threadID,
986 name="addHostIntent",
987 args=[hostCombos[i][0],hostCombos[i][1]])
988 pool.append(t)
989 t.start()
990 i = i + 1
991 main.threadID = main.threadID + 1
992 for thread in pool:
993 thread.join()
994 intentIdList.append(thread.result)
995 time2 = time.time()
996 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
997
GlennRCfcfdc4f2015-09-30 16:01:57 -0700998 # Saving intent ids to check intents in later cases
999 main.intentIds = list(intentIdList)
1000
GlennRCa8d786a2015-09-23 17:40:11 -07001001 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001002
GlennRC1dde1712015-10-02 11:03:08 -07001003 # Giving onos multiple chances to install intents
1004 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001005 if i != 0:
1006 main.log.warn( "Verification failed. Retrying..." )
1007 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001008 time.sleep( main.checkIntentsDelay )
1009
1010 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001011 for e in range(int(main.numCtrls)):
1012 main.log.info( "Checking intents on CLI %s" % (e+1) )
1013 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1014 intentState
1015 if not intentState:
1016 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001017 if intentState:
1018 break
GlennRCdb2c8422015-09-29 12:21:59 -07001019 else:
1020 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001021 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001022
GlennRCa8d786a2015-09-23 17:40:11 -07001023
1024 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1025 onpass="INTENTS INSTALLED",
1026 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001027
1028 main.step( "Verify Ping across all hosts" )
1029 pingResult = main.FALSE
1030 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001031 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1032 if not pingResult:
1033 main.log.warn("First pingall failed. Retrying...")
1034 time1 = time.time()
1035 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001036 time2 = time.time()
1037 timeDiff = round( ( time2 - time1 ), 2 )
1038 main.log.report(
1039 "Time taken for Ping All: " +
1040 str( timeDiff ) +
1041 " seconds" )
1042 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1043 onpass="PING ALL PASS",
1044 onfail="PING ALL FAIL" )
1045
GlennRCbddd58f2015-10-01 15:45:25 -07001046 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001047 utilities.assert_equals(
1048 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001049 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001050 onpass="Install 300 Host Intents and Ping All test PASS",
1051 onfail="Install 300 Host Intents and Ping All test FAIL" )
1052
GlennRCfcfdc4f2015-09-30 16:01:57 -07001053 if not intentState:
1054 main.log.debug( "Intents failed to install completely" )
1055 if not pingResult:
1056 main.log.debug( "Pingall failed" )
1057
GlennRCbddd58f2015-10-01 15:45:25 -07001058 if not caseResult and main.failSwitch:
1059 main.log.report("Stopping test")
1060 main.stop( email=main.emailOnStop )
1061
Hari Krishnac195f3b2015-07-08 20:02:24 -07001062 def CASE61( self ):
1063 """
1064 Install 600 host intents and verify ping all for Chordal Topology
1065 """
1066 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1067 main.log.report( "_______________________________________" )
1068 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001069
Hari Krishnac195f3b2015-07-08 20:02:24 -07001070 main.case( "Install 600 host intents" )
1071 main.step( "Add host Intents" )
1072 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001073 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1074
Hari Krishnac195f3b2015-07-08 20:02:24 -07001075 intentIdList = []
1076 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001077
Hari Krishnac195f3b2015-07-08 20:02:24 -07001078 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1079 pool = []
1080 for cli in main.CLIs:
1081 if i >= len( hostCombos ):
1082 break
1083 t = main.Thread( target=cli.addHostIntent,
1084 threadID=main.threadID,
1085 name="addHostIntent",
1086 args=[hostCombos[i][0],hostCombos[i][1]])
1087 pool.append(t)
1088 t.start()
1089 i = i + 1
1090 main.threadID = main.threadID + 1
1091 for thread in pool:
1092 thread.join()
1093 intentIdList.append(thread.result)
1094 time2 = time.time()
1095 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001096
GlennRCfcfdc4f2015-09-30 16:01:57 -07001097 # Saving intent ids to check intents in later cases
1098 main.intentIds = list(intentIdList)
1099
GlennRCa8d786a2015-09-23 17:40:11 -07001100 main.step("Verify intents are installed")
1101
GlennRC1dde1712015-10-02 11:03:08 -07001102 # Giving onos multiple chances to install intents
1103 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001104 if i != 0:
1105 main.log.warn( "Verification failed. Retrying..." )
1106 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001107 time.sleep( main.checkIntentsDelay )
1108
1109 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001110 for e in range(int(main.numCtrls)):
1111 main.log.info( "Checking intents on CLI %s" % (e+1) )
1112 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1113 intentState
1114 if not intentState:
1115 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001116 if intentState:
1117 break
GlennRCdb2c8422015-09-29 12:21:59 -07001118 else:
1119 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001120 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001121
1122 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1123 onpass="INTENTS INSTALLED",
1124 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001125
1126 main.step( "Verify Ping across all hosts" )
1127 pingResult = main.FALSE
1128 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001129 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1130 if not pingResult:
1131 main.log.warn("First pingall failed. Retrying...")
1132 time1 = time.time()
1133 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001134 time2 = time.time()
1135 timeDiff = round( ( time2 - time1 ), 2 )
1136 main.log.report(
1137 "Time taken for Ping All: " +
1138 str( timeDiff ) +
1139 " seconds" )
1140 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1141 onpass="PING ALL PASS",
1142 onfail="PING ALL FAIL" )
1143
GlennRCbddd58f2015-10-01 15:45:25 -07001144 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001145
Hari Krishnac195f3b2015-07-08 20:02:24 -07001146 utilities.assert_equals(
1147 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001148 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001149 onpass="Install 300 Host Intents and Ping All test PASS",
1150 onfail="Install 300 Host Intents and Ping All test FAIL" )
1151
GlennRCfcfdc4f2015-09-30 16:01:57 -07001152 if not intentState:
1153 main.log.debug( "Intents failed to install completely" )
1154 if not pingResult:
1155 main.log.debug( "Pingall failed" )
1156
GlennRCbddd58f2015-10-01 15:45:25 -07001157 if not caseResult and main.failSwitch:
1158 main.log.report("Stopping test")
1159 main.stop( email=main.emailOnStop )
1160
Hari Krishnac195f3b2015-07-08 20:02:24 -07001161 def CASE62( self ):
1162 """
1163 Install 2278 host intents and verify ping all for Spine Topology
1164 """
1165 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1166 main.log.report( "_______________________________________" )
1167 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001168
Hari Krishnac195f3b2015-07-08 20:02:24 -07001169 main.case( "Install 2278 host intents" )
1170 main.step( "Add host Intents" )
1171 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001172 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001173 main.pingTimeout = 300
1174 intentIdList = []
1175 time1 = time.time()
1176 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1177 pool = []
1178 for cli in main.CLIs:
1179 if i >= len( hostCombos ):
1180 break
1181 t = main.Thread( target=cli.addHostIntent,
1182 threadID=main.threadID,
1183 name="addHostIntent",
1184 args=[hostCombos[i][0],hostCombos[i][1]])
1185 pool.append(t)
1186 t.start()
1187 i = i + 1
1188 main.threadID = main.threadID + 1
1189 for thread in pool:
1190 thread.join()
1191 intentIdList.append(thread.result)
1192 time2 = time.time()
1193 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001194
GlennRCfcfdc4f2015-09-30 16:01:57 -07001195 # Saving intent ids to check intents in later cases
1196 main.intentIds = list(intentIdList)
1197
GlennRCa8d786a2015-09-23 17:40:11 -07001198 main.step("Verify intents are installed")
1199
GlennRC1dde1712015-10-02 11:03:08 -07001200 # Giving onos multiple chances to install intents
1201 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001202 if i != 0:
1203 main.log.warn( "Verification failed. Retrying..." )
1204 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001205 time.sleep( main.checkIntentsDelay )
1206
1207 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001208 for e in range(int(main.numCtrls)):
1209 main.log.info( "Checking intents on CLI %s" % (e+1) )
1210 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1211 intentState
1212 if not intentState:
1213 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001214 if intentState:
1215 break
GlennRCdb2c8422015-09-29 12:21:59 -07001216 else:
1217 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001218 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001219
1220 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1221 onpass="INTENTS INSTALLED",
1222 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001223
1224 main.step( "Verify Ping across all hosts" )
1225 pingResult = main.FALSE
1226 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001227 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1228 if not pingResult:
1229 main.log.warn("First pingall failed. Retrying...")
1230 time1 = time.time()
1231 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001232 time2 = time.time()
1233 timeDiff = round( ( time2 - time1 ), 2 )
1234 main.log.report(
1235 "Time taken for Ping All: " +
1236 str( timeDiff ) +
1237 " seconds" )
1238 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1239 onpass="PING ALL PASS",
1240 onfail="PING ALL FAIL" )
1241
GlennRCbddd58f2015-10-01 15:45:25 -07001242 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001243
Hari Krishnac195f3b2015-07-08 20:02:24 -07001244 utilities.assert_equals(
1245 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001246 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001247 onpass="Install 2278 Host Intents and Ping All test PASS",
1248 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1249
GlennRCfcfdc4f2015-09-30 16:01:57 -07001250 if not intentState:
1251 main.log.debug( "Intents failed to install completely" )
1252 if not pingResult:
1253 main.log.debug( "Pingall failed" )
1254
GlennRCbddd58f2015-10-01 15:45:25 -07001255 if not caseResult and main.failSwitch:
1256 main.log.report("Stopping test")
1257 main.stop( email=main.emailOnStop )
1258
Hari Krishna4223dbd2015-08-13 16:29:53 -07001259 def CASE160( self ):
1260 """
1261 Verify IPv6 ping across 300 host intents (Att Topology)
1262 """
1263 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1264 main.log.report( "_________________________________________________" )
1265 import itertools
1266 import time
1267 main.case( "IPv6 ping all 300 host intents" )
1268 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001269 pingResult = main.FALSE
1270 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001271 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001272 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001273 main.log.warn("First pingall failed. Retrying...")
1274 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001275 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001276 time2 = time.time()
1277 timeDiff = round( ( time2 - time1 ), 2 )
1278 main.log.report(
1279 "Time taken for IPv6 Ping All: " +
1280 str( timeDiff ) +
1281 " seconds" )
1282 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1283 onpass="PING ALL PASS",
1284 onfail="PING ALL FAIL" )
1285
GlennRCbddd58f2015-10-01 15:45:25 -07001286 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001287 utilities.assert_equals(
1288 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001289 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001290 onpass="IPv6 Ping across 300 host intents test PASS",
1291 onfail="IPv6 Ping across 300 host intents test FAIL" )
1292
1293 def CASE161( self ):
1294 """
1295 Verify IPv6 ping across 600 host intents (Chordal Topology)
1296 """
1297 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1298 main.log.report( "_________________________________________________" )
1299 import itertools
1300 import time
1301 main.case( "IPv6 ping all 600 host intents" )
1302 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001303 pingResult = main.FALSE
1304 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001305 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001306 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001307 main.log.warn("First pingall failed. Retrying...")
1308 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001309 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
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" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001337 pingResult = main.FALSE
1338 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001339 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001340 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001341 main.log.warn("First pingall failed. Retrying...")
1342 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001343 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001344 time2 = time.time()
1345 timeDiff = round( ( time2 - time1 ), 2 )
1346 main.log.report(
1347 "Time taken for IPv6 Ping All: " +
1348 str( timeDiff ) +
1349 " seconds" )
1350 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1351 onpass="PING ALL PASS",
1352 onfail="PING ALL FAIL" )
1353
GlennRCbddd58f2015-10-01 15:45:25 -07001354 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001355 utilities.assert_equals(
1356 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001357 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001358 onpass="IPv6 Ping across 600 host intents test PASS",
1359 onfail="IPv6 Ping across 600 host intents test FAIL" )
1360
Hari Krishnac195f3b2015-07-08 20:02:24 -07001361 def CASE70( self, main ):
1362 """
1363 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1364 """
1365 import random
1366 main.randomLink1 = []
1367 main.randomLink2 = []
1368 main.randomLink3 = []
1369 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1370 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1371 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1372 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1373 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1374 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1375 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1376 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1377
1378 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1379 main.log.report( "___________________________________________________________________________" )
1380 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1381 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1382 if ( int( switchLinksToToggle ) ==
1383 0 or int( switchLinksToToggle ) > 5 ):
1384 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1385 #main.cleanup()
1386 #main.exit()
1387 else:
1388 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1389
1390 main.step( "Cut links on Core devices using user provided range" )
1391 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1392 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1393 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1394 for i in range( int( switchLinksToToggle ) ):
1395 main.Mininet1.link(
1396 END1=link1End1,
1397 END2=main.randomLink1[ i ],
1398 OPTION="down" )
1399 time.sleep( link_sleep )
1400 main.Mininet1.link(
1401 END1=link2End1,
1402 END2=main.randomLink2[ i ],
1403 OPTION="down" )
1404 time.sleep( link_sleep )
1405 main.Mininet1.link(
1406 END1=link3End1,
1407 END2=main.randomLink3[ i ],
1408 OPTION="down" )
1409 time.sleep( link_sleep )
1410
Hari Krishna6185fc12015-07-13 15:42:31 -07001411 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001412 linkDown = main.ONOSbench.checkStatus(
1413 topology_output, main.numMNswitches, str(
1414 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1415 utilities.assert_equals(
1416 expect=main.TRUE,
1417 actual=linkDown,
1418 onpass="Link Down discovered properly",
1419 onfail="Link down was not discovered in " +
1420 str( link_sleep ) +
1421 " seconds" )
1422
GlennRCfcfdc4f2015-09-30 16:01:57 -07001423 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001424 # Giving onos multiple chances to install intents
1425 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001426 if i != 0:
1427 main.log.warn( "Verification failed. Retrying..." )
1428 main.log.info("Giving onos some time...")
1429 time.sleep( main.checkIntentsDelay )
1430
1431 intentState = main.TRUE
1432 for e in range(int(main.numCtrls)):
1433 main.log.info( "Checking intents on CLI %s" % (e+1) )
1434 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1435 intentState
1436 if not intentState:
1437 main.log.warn( "Not all intents installed" )
1438 if intentState:
1439 break
1440 else:
1441 #Dumping intent summary
1442 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1443
1444
1445 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1446 onpass="INTENTS INSTALLED",
1447 onfail="SOME INTENTS NOT INSTALLED" )
1448
Hari Krishnac195f3b2015-07-08 20:02:24 -07001449 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001450 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001451 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001452 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1453 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001454 main.log.warn("First pingall failed. Retrying...")
1455 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001456 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001457
Hari Krishnac195f3b2015-07-08 20:02:24 -07001458 time2 = time.time()
1459 timeDiff = round( ( time2 - time1 ), 2 )
1460 main.log.report(
1461 "Time taken for Ping All: " +
1462 str( timeDiff ) +
1463 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001464 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001465 onpass="PING ALL PASS",
1466 onfail="PING ALL FAIL" )
1467
GlennRCbddd58f2015-10-01 15:45:25 -07001468 caseResult = linkDown and pingResult and intentState
1469 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001470 onpass="Random Link cut Test PASS",
1471 onfail="Random Link cut Test FAIL" )
1472
GlennRCfcfdc4f2015-09-30 16:01:57 -07001473 # Printing what exactly failed
1474 if not linkDown:
1475 main.log.debug( "Link down was not discovered correctly" )
1476 if not pingResult:
1477 main.log.debug( "Pingall failed" )
1478 if not intentState:
1479 main.log.debug( "Intents are not all installed" )
1480
GlennRCbddd58f2015-10-01 15:45:25 -07001481 if not caseResult and main.failSwitch:
1482 main.log.report("Stopping test")
1483 main.stop( email=main.emailOnStop )
1484
Hari Krishnac195f3b2015-07-08 20:02:24 -07001485 def CASE80( self, main ):
1486 """
1487 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1488 """
1489 import random
1490 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1491 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1492 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1493 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1494 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1495
1496 main.log.report(
1497 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1498 main.log.report(
1499 "__________________________________________________________________" )
1500 main.case(
1501 "Host intents - Bring the core links up that are down and verify ping all" )
1502 main.step( "Bring randomly cut links on Core devices up" )
1503 for i in range( int( switchLinksToToggle ) ):
1504 main.Mininet1.link(
1505 END1=link1End1,
1506 END2=main.randomLink1[ i ],
1507 OPTION="up" )
1508 time.sleep( link_sleep )
1509 main.Mininet1.link(
1510 END1=link2End1,
1511 END2=main.randomLink2[ i ],
1512 OPTION="up" )
1513 time.sleep( link_sleep )
1514 main.Mininet1.link(
1515 END1=link3End1,
1516 END2=main.randomLink3[ i ],
1517 OPTION="up" )
1518 time.sleep( link_sleep )
1519
Hari Krishna6185fc12015-07-13 15:42:31 -07001520 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001521 linkUp = main.ONOSbench.checkStatus(
1522 topology_output,
1523 main.numMNswitches,
1524 str( main.numMNlinks ) )
1525 utilities.assert_equals(
1526 expect=main.TRUE,
1527 actual=linkUp,
1528 onpass="Link up discovered properly",
1529 onfail="Link up was not discovered in " +
1530 str( link_sleep ) +
1531 " seconds" )
1532
GlennRCfcfdc4f2015-09-30 16:01:57 -07001533 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001534 # Giving onos multiple chances to install intents
1535 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001536 if i != 0:
1537 main.log.warn( "Verification failed. Retrying..." )
1538 main.log.info("Giving onos some time...")
1539 time.sleep( main.checkIntentsDelay )
1540
1541 intentState = main.TRUE
1542 for e in range(int(main.numCtrls)):
1543 main.log.info( "Checking intents on CLI %s" % (e+1) )
1544 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1545 intentState
1546 if not intentState:
1547 main.log.warn( "Not all intents installed" )
1548 if intentState:
1549 break
1550 else:
1551 #Dumping intent summary
1552 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1553
1554
1555 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1556 onpass="INTENTS INSTALLED",
1557 onfail="SOME INTENTS NOT INSTALLED" )
1558
Hari Krishnac195f3b2015-07-08 20:02:24 -07001559 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001560 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001561 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001562 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1563 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001564 main.log.warn("First pingall failed. Retrying...")
1565 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001566 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001567
Hari Krishnac195f3b2015-07-08 20:02:24 -07001568 time2 = time.time()
1569 timeDiff = round( ( time2 - time1 ), 2 )
1570 main.log.report(
1571 "Time taken for Ping All: " +
1572 str( timeDiff ) +
1573 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001574 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575 onpass="PING ALL PASS",
1576 onfail="PING ALL FAIL" )
1577
GlennRCbddd58f2015-10-01 15:45:25 -07001578 caseResult = linkUp and pingResult
1579 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001580 onpass="Link Up Test PASS",
1581 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001582 # Printing what exactly failed
1583 if not linkUp:
1584 main.log.debug( "Link down was not discovered correctly" )
1585 if not pingResult:
1586 main.log.debug( "Pingall failed" )
1587 if not intentState:
1588 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001589
GlennRCbddd58f2015-10-01 15:45:25 -07001590 if not caseResult and main.failSwitch:
1591 main.log.report("Stopping test")
1592 main.stop( email=main.emailOnStop )
1593
Hari Krishnac195f3b2015-07-08 20:02:24 -07001594 def CASE71( self, main ):
1595 """
1596 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1597 """
1598 import random
1599 main.randomLink1 = []
1600 main.randomLink2 = []
1601 main.randomLink3 = []
1602 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1603 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1604 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1605 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1606 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1607 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1608 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1609 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1610
1611 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1612 main.log.report( "___________________________________________________________________________" )
1613 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1614 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1615 if ( int( switchLinksToToggle ) ==
1616 0 or int( switchLinksToToggle ) > 5 ):
1617 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1618 #main.cleanup()
1619 #main.exit()
1620 else:
1621 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1622
1623 main.step( "Cut links on Core devices using user provided range" )
1624 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1625 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1626 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1627 for i in range( int( switchLinksToToggle ) ):
1628 main.Mininet1.link(
1629 END1=link1End1,
1630 END2=main.randomLink1[ i ],
1631 OPTION="down" )
1632 time.sleep( link_sleep )
1633 main.Mininet1.link(
1634 END1=link2End1,
1635 END2=main.randomLink2[ i ],
1636 OPTION="down" )
1637 time.sleep( link_sleep )
1638 main.Mininet1.link(
1639 END1=link3End1,
1640 END2=main.randomLink3[ i ],
1641 OPTION="down" )
1642 time.sleep( link_sleep )
1643
Hari Krishna6185fc12015-07-13 15:42:31 -07001644 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001645 linkDown = main.ONOSbench.checkStatus(
1646 topology_output, main.numMNswitches, str(
1647 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1648 utilities.assert_equals(
1649 expect=main.TRUE,
1650 actual=linkDown,
1651 onpass="Link Down discovered properly",
1652 onfail="Link down was not discovered in " +
1653 str( link_sleep ) +
1654 " seconds" )
1655
GlennRCfcfdc4f2015-09-30 16:01:57 -07001656 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001657 # Giving onos multiple chances to install intents
1658 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001659 if i != 0:
1660 main.log.warn( "Verification failed. Retrying..." )
1661 main.log.info("Giving onos some time...")
1662 time.sleep( main.checkIntentsDelay )
1663
1664 intentState = main.TRUE
1665 for e in range(int(main.numCtrls)):
1666 main.log.info( "Checking intents on CLI %s" % (e+1) )
1667 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1668 intentState
1669 if not intentState:
1670 main.log.warn( "Not all intents installed" )
1671 if intentState:
1672 break
1673 else:
1674 #Dumping intent summary
1675 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1676
1677
1678 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1679 onpass="INTENTS INSTALLED",
1680 onfail="SOME INTENTS NOT INSTALLED" )
1681
Hari Krishnac195f3b2015-07-08 20:02:24 -07001682 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001683 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001684 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1686 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001687 main.log.warn("First pingall failed. Retrying...")
1688 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001689 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001690
Hari Krishnac195f3b2015-07-08 20:02:24 -07001691 time2 = time.time()
1692 timeDiff = round( ( time2 - time1 ), 2 )
1693 main.log.report(
1694 "Time taken for Ping All: " +
1695 str( timeDiff ) +
1696 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001697 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001698 onpass="PING ALL PASS",
1699 onfail="PING ALL FAIL" )
1700
GlennRCbddd58f2015-10-01 15:45:25 -07001701 caseResult = linkDown and pingResult and intentState
1702 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001703 onpass="Random Link cut Test PASS",
1704 onfail="Random Link cut Test FAIL" )
1705
GlennRCfcfdc4f2015-09-30 16:01:57 -07001706 # Printing what exactly failed
1707 if not linkDown:
1708 main.log.debug( "Link down was not discovered correctly" )
1709 if not pingResult:
1710 main.log.debug( "Pingall failed" )
1711 if not intentState:
1712 main.log.debug( "Intents are not all installed" )
1713
GlennRCbddd58f2015-10-01 15:45:25 -07001714 if not caseResult and main.failSwitch:
1715 main.log.report("Stopping test")
1716 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001717
Hari Krishnac195f3b2015-07-08 20:02:24 -07001718 def CASE81( self, main ):
1719 """
1720 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1721 """
1722 import random
1723 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1724 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1725 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1726 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1727 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1728
1729 main.log.report(
1730 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1731 main.log.report(
1732 "__________________________________________________________________" )
1733 main.case(
1734 "Point intents - Bring the core links up that are down and verify ping all" )
1735 main.step( "Bring randomly cut links on Core devices up" )
1736 for i in range( int( switchLinksToToggle ) ):
1737 main.Mininet1.link(
1738 END1=link1End1,
1739 END2=main.randomLink1[ i ],
1740 OPTION="up" )
1741 time.sleep( link_sleep )
1742 main.Mininet1.link(
1743 END1=link2End1,
1744 END2=main.randomLink2[ i ],
1745 OPTION="up" )
1746 time.sleep( link_sleep )
1747 main.Mininet1.link(
1748 END1=link3End1,
1749 END2=main.randomLink3[ i ],
1750 OPTION="up" )
1751 time.sleep( link_sleep )
1752
Hari Krishna6185fc12015-07-13 15:42:31 -07001753 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001754 linkUp = main.ONOSbench.checkStatus(
1755 topology_output,
1756 main.numMNswitches,
1757 str( main.numMNlinks ) )
1758 utilities.assert_equals(
1759 expect=main.TRUE,
1760 actual=linkUp,
1761 onpass="Link up discovered properly",
1762 onfail="Link up was not discovered in " +
1763 str( link_sleep ) +
1764 " seconds" )
1765
GlennRCfcfdc4f2015-09-30 16:01:57 -07001766 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001767 # Giving onos multiple chances to install intents
1768 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001769 if i != 0:
1770 main.log.warn( "Verification failed. Retrying..." )
1771 main.log.info("Giving onos some time...")
1772 time.sleep( main.checkIntentsDelay )
1773
1774 intentState = main.TRUE
1775 for e in range(int(main.numCtrls)):
1776 main.log.info( "Checking intents on CLI %s" % (e+1) )
1777 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1778 intentState
1779 if not intentState:
1780 main.log.warn( "Not all intents installed" )
1781 if intentState:
1782 break
1783 else:
1784 #Dumping intent summary
1785 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1786
1787
1788 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1789 onpass="INTENTS INSTALLED",
1790 onfail="SOME INTENTS NOT INSTALLED" )
1791
Hari Krishnac195f3b2015-07-08 20:02:24 -07001792 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001793 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001795 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1796 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001797 main.log.warn("First pingall failed. Retrying...")
1798 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001799 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001800
Hari Krishnac195f3b2015-07-08 20:02:24 -07001801 time2 = time.time()
1802 timeDiff = round( ( time2 - time1 ), 2 )
1803 main.log.report(
1804 "Time taken for Ping All: " +
1805 str( timeDiff ) +
1806 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001807 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001808 onpass="PING ALL PASS",
1809 onfail="PING ALL FAIL" )
1810
GlennRCbddd58f2015-10-01 15:45:25 -07001811 caseResult = linkUp and pingResult
1812 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001813 onpass="Link Up Test PASS",
1814 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001815 # Printing what exactly failed
1816 if not linkUp:
1817 main.log.debug( "Link down was not discovered correctly" )
1818 if not pingResult:
1819 main.log.debug( "Pingall failed" )
1820 if not intentState:
1821 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001822
GlennRCbddd58f2015-10-01 15:45:25 -07001823 if not caseResult and main.failSwitch:
1824 main.log.report("Stopping test")
GlennRC9e7465e2015-10-02 13:50:36 -07001825 main.stop( mail=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001826
Hari Krishnac195f3b2015-07-08 20:02:24 -07001827 def CASE72( self, main ):
1828 """
1829 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1830 """
1831 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001832 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001833 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001834
Hari Krishnac195f3b2015-07-08 20:02:24 -07001835 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1836 main.log.report( "___________________________________________________________________________" )
1837 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1838 switches = []
1839 switchesComb = []
1840 for i in range( main.numMNswitches ):
1841 switches.append('s%d'%(i+1))
1842 switchesLinksComb = list(itertools.combinations(switches,2))
1843 main.randomLinks = random.sample(switchesLinksComb, 5 )
1844 print main.randomLinks
1845 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001846
Hari Krishnac195f3b2015-07-08 20:02:24 -07001847 for switch in main.randomLinks:
1848 main.Mininet1.link(
1849 END1=switch[0],
1850 END2=switch[1],
1851 OPTION="down")
1852 time.sleep( link_sleep )
1853
Hari Krishna6185fc12015-07-13 15:42:31 -07001854 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001855 linkDown = main.ONOSbench.checkStatus(
1856 topology_output, main.numMNswitches, str(
1857 int( main.numMNlinks ) - 5 * 2 ) )
1858 utilities.assert_equals(
1859 expect=main.TRUE,
1860 actual=linkDown,
1861 onpass="Link Down discovered properly",
1862 onfail="Link down was not discovered in " +
1863 str( link_sleep ) +
1864 " seconds" )
1865
GlennRCfcfdc4f2015-09-30 16:01:57 -07001866 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001867 # Giving onos multiple chances to install intents
1868 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001869 if i != 0:
1870 main.log.warn( "Verification failed. Retrying..." )
1871 main.log.info("Giving onos some time...")
1872 time.sleep( main.checkIntentsDelay )
1873
1874 intentState = main.TRUE
1875 for e in range(int(main.numCtrls)):
1876 main.log.info( "Checking intents on CLI %s" % (e+1) )
1877 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1878 intentState
1879 if not intentState:
1880 main.log.warn( "Not all intents installed" )
1881 if intentState:
1882 break
1883 else:
1884 #Dumping intent summary
1885 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1886
1887
1888 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1889 onpass="INTENTS INSTALLED",
1890 onfail="SOME INTENTS NOT INSTALLED" )
1891
Hari Krishnac195f3b2015-07-08 20:02:24 -07001892 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001893 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001895 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1896 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001897 main.log.warn("First pingall failed. Retrying...")
1898 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001899 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001900
Hari Krishnac195f3b2015-07-08 20:02:24 -07001901 time2 = time.time()
1902 timeDiff = round( ( time2 - time1 ), 2 )
1903 main.log.report(
1904 "Time taken for Ping All: " +
1905 str( timeDiff ) +
1906 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001907 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001908 onpass="PING ALL PASS",
1909 onfail="PING ALL FAIL" )
1910
GlennRCbddd58f2015-10-01 15:45:25 -07001911 caseResult = linkDown and pingResult and intentState
1912 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001913 onpass="Random Link cut Test PASS",
1914 onfail="Random Link cut Test FAIL" )
1915
GlennRCfcfdc4f2015-09-30 16:01:57 -07001916 # Printing what exactly failed
1917 if not linkDown:
1918 main.log.debug( "Link down was not discovered correctly" )
1919 if not pingResult:
1920 main.log.debug( "Pingall failed" )
1921 if not intentState:
1922 main.log.debug( "Intents are not all installed" )
1923
GlennRCbddd58f2015-10-01 15:45:25 -07001924 if not caseResult and main.failSwitch:
1925 main.log.report("Stopping test")
1926 main.stop( email=main.emailOnStop )
1927
Hari Krishnac195f3b2015-07-08 20:02:24 -07001928 def CASE82( self, main ):
1929 """
1930 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1931 """
1932 import random
1933 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001934
Hari Krishnac195f3b2015-07-08 20:02:24 -07001935 main.log.report(
1936 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1937 main.log.report(
1938 "__________________________________________________________________" )
1939 main.case(
1940 "Host intents - Bring the core links up that are down and verify ping all" )
1941 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001942
Hari Krishnac195f3b2015-07-08 20:02:24 -07001943 for switch in main.randomLinks:
1944 main.Mininet1.link(
1945 END1=switch[0],
1946 END2=switch[1],
1947 OPTION="up")
1948 time.sleep( link_sleep )
1949
Hari Krishna6185fc12015-07-13 15:42:31 -07001950 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001951 linkUp = main.ONOSbench.checkStatus(
1952 topology_output,
1953 main.numMNswitches,
1954 str( main.numMNlinks ) )
1955 utilities.assert_equals(
1956 expect=main.TRUE,
1957 actual=linkUp,
1958 onpass="Link up discovered properly",
1959 onfail="Link up was not discovered in " +
1960 str( link_sleep ) +
1961 " seconds" )
1962
GlennRCfcfdc4f2015-09-30 16:01:57 -07001963 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001964 # Giving onos multiple chances to install intents
1965 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001966 if i != 0:
1967 main.log.warn( "Verification failed. Retrying..." )
1968 main.log.info("Giving onos some time...")
1969 time.sleep( main.checkIntentsDelay )
1970
1971 intentState = main.TRUE
1972 for e in range(int(main.numCtrls)):
1973 main.log.info( "Checking intents on CLI %s" % (e+1) )
1974 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1975 intentState
1976 if not intentState:
1977 main.log.warn( "Not all intents installed" )
1978 if intentState:
1979 break
1980 else:
1981 #Dumping intent summary
1982 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1983
1984
1985 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1986 onpass="INTENTS INSTALLED",
1987 onfail="SOME INTENTS NOT INSTALLED" )
1988
Hari Krishnac195f3b2015-07-08 20:02:24 -07001989 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001990 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001991 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001992 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1993 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001994 main.log.warn("First pingall failed. Retrying...")
1995 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001996 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001997
Hari Krishnac195f3b2015-07-08 20:02:24 -07001998 time2 = time.time()
1999 timeDiff = round( ( time2 - time1 ), 2 )
2000 main.log.report(
2001 "Time taken for Ping All: " +
2002 str( timeDiff ) +
2003 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002004 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002005 onpass="PING ALL PASS",
2006 onfail="PING ALL FAIL" )
2007
GlennRCbddd58f2015-10-01 15:45:25 -07002008 caseResult = linkUp and pingResult
2009 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002010 onpass="Link Up Test PASS",
2011 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002012 # Printing what exactly failed
2013 if not linkUp:
2014 main.log.debug( "Link down was not discovered correctly" )
2015 if not pingResult:
2016 main.log.debug( "Pingall failed" )
2017 if not intentState:
2018 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002019
GlennRCbddd58f2015-10-01 15:45:25 -07002020 if not caseResult and main.failSwitch:
2021 main.log.report("Stopping test")
2022 main.stop( email=main.emailOnStop )
2023
Hari Krishnac195f3b2015-07-08 20:02:24 -07002024 def CASE73( self, main ):
2025 """
2026 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2027 """
2028 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002029 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002031
Hari Krishnac195f3b2015-07-08 20:02:24 -07002032 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2033 main.log.report( "___________________________________________________________________________" )
2034 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2035 switches = []
2036 switchesComb = []
2037 for i in range( main.numMNswitches ):
2038 switches.append('s%d'%(i+1))
2039 switchesLinksComb = list(itertools.combinations(switches,2))
2040 main.randomLinks = random.sample(switchesLinksComb, 5 )
2041 print main.randomLinks
2042 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002043
Hari Krishnac195f3b2015-07-08 20:02:24 -07002044 for switch in main.randomLinks:
2045 main.Mininet1.link(
2046 END1=switch[0],
2047 END2=switch[1],
2048 OPTION="down")
2049 time.sleep( link_sleep )
2050
Hari Krishna6185fc12015-07-13 15:42:31 -07002051 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002052 linkDown = main.ONOSbench.checkStatus(
2053 topology_output, main.numMNswitches, str(
2054 int( main.numMNlinks ) - 5 * 2 ) )
2055 utilities.assert_equals(
2056 expect=main.TRUE,
2057 actual=linkDown,
2058 onpass="Link Down discovered properly",
2059 onfail="Link down was not discovered in " +
2060 str( link_sleep ) +
2061 " seconds" )
2062
GlennRCfcfdc4f2015-09-30 16:01:57 -07002063 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002064 # Giving onos multiple chances to install intents
2065 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002066 if i != 0:
2067 main.log.warn( "Verification failed. Retrying..." )
2068 main.log.info("Giving onos some time...")
2069 time.sleep( main.checkIntentsDelay )
2070
2071 intentState = main.TRUE
2072 for e in range(int(main.numCtrls)):
2073 main.log.info( "Checking intents on CLI %s" % (e+1) )
2074 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2075 intentState
2076 if not intentState:
2077 main.log.warn( "Not all intents installed" )
2078 if intentState:
2079 break
2080 else:
2081 #Dumping intent summary
2082 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2083
2084
2085 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2086 onpass="INTENTS INSTALLED",
2087 onfail="SOME INTENTS NOT INSTALLED" )
2088
Hari Krishnac195f3b2015-07-08 20:02:24 -07002089 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002090 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002091 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2093 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002094 main.log.warn("First pingall failed. Retrying...")
2095 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002096 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002097
Hari Krishnac195f3b2015-07-08 20:02:24 -07002098 time2 = time.time()
2099 timeDiff = round( ( time2 - time1 ), 2 )
2100 main.log.report(
2101 "Time taken for Ping All: " +
2102 str( timeDiff ) +
2103 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002104 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002105 onpass="PING ALL PASS",
2106 onfail="PING ALL FAIL" )
2107
GlennRCbddd58f2015-10-01 15:45:25 -07002108 caseResult = linkDown and pingResult and intentState
2109 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002110 onpass="Random Link cut Test PASS",
2111 onfail="Random Link cut Test FAIL" )
2112
GlennRCfcfdc4f2015-09-30 16:01:57 -07002113 # Printing what exactly failed
2114 if not linkDown:
2115 main.log.debug( "Link down was not discovered correctly" )
2116 if not pingResult:
2117 main.log.debug( "Pingall failed" )
2118 if not intentState:
2119 main.log.debug( "Intents are not all installed" )
2120
GlennRCbddd58f2015-10-01 15:45:25 -07002121 if not caseResult and main.failSwitch:
2122 main.log.report("Stopping test")
2123 main.stop( email=main.emailOnStop )
2124
Hari Krishnac195f3b2015-07-08 20:02:24 -07002125 def CASE83( self, main ):
2126 """
2127 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2128 """
2129 import random
2130 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002131
Hari Krishnac195f3b2015-07-08 20:02:24 -07002132 main.log.report(
2133 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2134 main.log.report(
2135 "__________________________________________________________________" )
2136 main.case(
2137 "Point intents - Bring the core links up that are down and verify ping all" )
2138 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002139
Hari Krishnac195f3b2015-07-08 20:02:24 -07002140 for switch in main.randomLinks:
2141 main.Mininet1.link(
2142 END1=switch[0],
2143 END2=switch[1],
2144 OPTION="up")
2145 time.sleep( link_sleep )
2146
Hari Krishna6185fc12015-07-13 15:42:31 -07002147 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002148 linkUp = main.ONOSbench.checkStatus(
2149 topology_output,
2150 main.numMNswitches,
2151 str( main.numMNlinks ) )
2152 utilities.assert_equals(
2153 expect=main.TRUE,
2154 actual=linkUp,
2155 onpass="Link up discovered properly",
2156 onfail="Link up was not discovered in " +
2157 str( link_sleep ) +
2158 " seconds" )
2159
GlennRCfcfdc4f2015-09-30 16:01:57 -07002160 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002161 # Giving onos multiple chances to install intents
2162 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002163 if i != 0:
2164 main.log.warn( "Verification failed. Retrying..." )
2165 main.log.info("Giving onos some time...")
2166 time.sleep( main.checkIntentsDelay )
2167
2168 intentState = main.TRUE
2169 for e in range(int(main.numCtrls)):
2170 main.log.info( "Checking intents on CLI %s" % (e+1) )
2171 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2172 intentState
2173 if not intentState:
2174 main.log.warn( "Not all intents installed" )
2175 if intentState:
2176 break
2177 else:
2178 #Dumping intent summary
2179 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2180
2181
2182 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2183 onpass="INTENTS INSTALLED",
2184 onfail="SOME INTENTS NOT INSTALLED" )
2185
Hari Krishnac195f3b2015-07-08 20:02:24 -07002186 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002187 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002188 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002189 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2190 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002191 main.log.warn("First pingall failed. Retrying...")
2192 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002193 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002194
Hari Krishnac195f3b2015-07-08 20:02:24 -07002195 time2 = time.time()
2196 timeDiff = round( ( time2 - time1 ), 2 )
2197 main.log.report(
2198 "Time taken for Ping All: " +
2199 str( timeDiff ) +
2200 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002201 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002202 onpass="PING ALL PASS",
2203 onfail="PING ALL FAIL" )
2204
GlennRCbddd58f2015-10-01 15:45:25 -07002205 caseResult = linkUp and pingResult
2206 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002207 onpass="Link Up Test PASS",
2208 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002209 # Printing what exactly failed
2210 if not linkUp:
2211 main.log.debug( "Link down was not discovered correctly" )
2212 if not pingResult:
2213 main.log.debug( "Pingall failed" )
2214 if not intentState:
2215 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002216
GlennRCbddd58f2015-10-01 15:45:25 -07002217 if not caseResult and main.failSwitch:
2218 main.log.report("Stopping test")
2219 main.stop( email=main.emailOnStop )
2220
Hari Krishnac195f3b2015-07-08 20:02:24 -07002221 def CASE74( self, main ):
2222 """
2223 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2224 """
2225 import random
2226 main.randomLink1 = []
2227 main.randomLink2 = []
2228 main.randomLink3 = []
2229 main.randomLink4 = []
2230 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2231 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2232 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2233 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2234 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2235 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2236 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2237 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002238
Hari Krishnac195f3b2015-07-08 20:02:24 -07002239 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2240 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002241 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002242 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002243 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002244 linkIndex.remove(linkIndexS9)
2245 linkIndexS10 = random.sample(linkIndex,1)[0]
2246 main.randomLink1 = link1End2top[linkIndexS9]
2247 main.randomLink2 = link2End2top[linkIndexS10]
2248 main.randomLink3 = random.sample(link1End2bot,1)[0]
2249 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002250
2251 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002252 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2253 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2254 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2255 time.sleep( link_sleep )
2256 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2257 time.sleep( link_sleep )
2258
Hari Krishna6185fc12015-07-13 15:42:31 -07002259 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002260 linkDown = main.ONOSbench.checkStatus(
2261 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002262 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002263 utilities.assert_equals(
2264 expect=main.TRUE,
2265 actual=linkDown,
2266 onpass="Link Down discovered properly",
2267 onfail="Link down was not discovered in " +
2268 str( link_sleep ) +
2269 " seconds" )
2270
GlennRCfcfdc4f2015-09-30 16:01:57 -07002271 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002272 # Giving onos multiple chances to install intents
2273 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002274 if i != 0:
2275 main.log.warn( "Verification failed. Retrying..." )
2276 main.log.info("Giving onos some time...")
2277 time.sleep( main.checkIntentsDelay )
2278
2279 intentState = main.TRUE
2280 for e in range(int(main.numCtrls)):
2281 main.log.info( "Checking intents on CLI %s" % (e+1) )
2282 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2283 intentState
2284 if not intentState:
2285 main.log.warn( "Not all intents installed" )
2286 if intentState:
2287 break
2288 else:
2289 #Dumping intent summary
2290 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2291
2292
2293 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2294 onpass="INTENTS INSTALLED",
2295 onfail="SOME INTENTS NOT INSTALLED" )
2296
Hari Krishnac195f3b2015-07-08 20:02:24 -07002297 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002298 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002299 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2301 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002302 main.log.warn("First pingall failed. Retrying...")
2303 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002304 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002305
Hari Krishnac195f3b2015-07-08 20:02:24 -07002306 time2 = time.time()
2307 timeDiff = round( ( time2 - time1 ), 2 )
2308 main.log.report(
2309 "Time taken for Ping All: " +
2310 str( timeDiff ) +
2311 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002312 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002313 onpass="PING ALL PASS",
2314 onfail="PING ALL FAIL" )
2315
GlennRCbddd58f2015-10-01 15:45:25 -07002316 caseResult = linkDown and pingResult and intentState
2317 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002318 onpass="Random Link cut Test PASS",
2319 onfail="Random Link cut Test FAIL" )
2320
GlennRCfcfdc4f2015-09-30 16:01:57 -07002321 # Printing what exactly failed
2322 if not linkDown:
2323 main.log.debug( "Link down was not discovered correctly" )
2324 if not pingResult:
2325 main.log.debug( "Pingall failed" )
2326 if not intentState:
2327 main.log.debug( "Intents are not all installed" )
2328
GlennRCbddd58f2015-10-01 15:45:25 -07002329 if not caseResult and main.failSwitch:
2330 main.log.report("Stopping test")
2331 main.stop( email=main.emailOnStop )
2332
Hari Krishnac195f3b2015-07-08 20:02:24 -07002333 def CASE84( self, main ):
2334 """
2335 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2336 """
2337 import random
2338 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2339 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2340 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2341 main.log.report(
2342 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2343 main.log.report(
2344 "__________________________________________________________________" )
2345 main.case(
2346 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002347
2348 # Work around for link state propagation delay. Added some sleep time.
2349 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2350 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002351 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2352 time.sleep( link_sleep )
2353 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2354 time.sleep( link_sleep )
2355
Hari Krishna6185fc12015-07-13 15:42:31 -07002356 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002357 linkUp = main.ONOSbench.checkStatus(
2358 topology_output,
2359 main.numMNswitches,
2360 str( main.numMNlinks ) )
2361 utilities.assert_equals(
2362 expect=main.TRUE,
2363 actual=linkUp,
2364 onpass="Link up discovered properly",
2365 onfail="Link up was not discovered in " +
2366 str( link_sleep ) +
2367 " seconds" )
2368
GlennRCfcfdc4f2015-09-30 16:01:57 -07002369 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002370 # Giving onos multiple chances to install intents
2371 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002372 if i != 0:
2373 main.log.warn( "Verification failed. Retrying..." )
2374 main.log.info("Giving onos some time...")
2375 time.sleep( main.checkIntentsDelay )
2376
2377 intentState = main.TRUE
2378 for e in range(int(main.numCtrls)):
2379 main.log.info( "Checking intents on CLI %s" % (e+1) )
2380 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2381 intentState
2382 if not intentState:
2383 main.log.warn( "Not all intents installed" )
2384 if intentState:
2385 break
2386 else:
2387 #Dumping intent summary
2388 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2389
2390
2391 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2392 onpass="INTENTS INSTALLED",
2393 onfail="SOME INTENTS NOT INSTALLED" )
2394
Hari Krishnac195f3b2015-07-08 20:02:24 -07002395 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002396 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002397 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002398 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2399 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002400 main.log.warn("First pingall failed. Retrying...")
2401 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002402 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002403
Hari Krishnac195f3b2015-07-08 20:02:24 -07002404 time2 = time.time()
2405 timeDiff = round( ( time2 - time1 ), 2 )
2406 main.log.report(
2407 "Time taken for Ping All: " +
2408 str( timeDiff ) +
2409 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002410 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002411 onpass="PING ALL PASS",
2412 onfail="PING ALL FAIL" )
2413
GlennRCbddd58f2015-10-01 15:45:25 -07002414 caseResult = linkUp and pingResult
2415 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002416 onpass="Link Up Test PASS",
2417 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002418 # Printing what exactly failed
2419 if not linkUp:
2420 main.log.debug( "Link down was not discovered correctly" )
2421 if not pingResult:
2422 main.log.debug( "Pingall failed" )
2423 if not intentState:
2424 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002425
GlennRCbddd58f2015-10-01 15:45:25 -07002426 if not caseResult and main.failSwitch:
2427 main.log.report("Stopping test")
2428 main.stop( email=main.emailOnStop )
2429
Hari Krishnab79d0822015-08-20 09:48:43 -07002430 def CASE75( self, main ):
2431 """
2432 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2433 """
2434 import random
2435 main.randomLink1 = []
2436 main.randomLink2 = []
2437 main.randomLink3 = []
2438 main.randomLink4 = []
2439 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2440 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2441 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2442 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2443 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2444 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2445 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2446 main.pingTimeout = 400
2447
2448 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2449 main.log.report( "___________________________________________________________________________" )
2450 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2451 linkIndex = range(4)
2452 linkIndexS9 = random.sample(linkIndex,1)[0]
2453 linkIndex.remove(linkIndexS9)
2454 linkIndexS10 = random.sample(linkIndex,1)[0]
2455 main.randomLink1 = link1End2top[linkIndexS9]
2456 main.randomLink2 = link2End2top[linkIndexS10]
2457 main.randomLink3 = random.sample(link1End2bot,1)[0]
2458 main.randomLink4 = random.sample(link2End2bot,1)[0]
2459
2460 # Work around for link state propagation delay. Added some sleep time.
2461 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2462 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2463 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2464 time.sleep( link_sleep )
2465 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2466 time.sleep( link_sleep )
2467
2468 topology_output = main.ONOScli1.topology()
2469 linkDown = main.ONOSbench.checkStatus(
2470 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002471 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002472 utilities.assert_equals(
2473 expect=main.TRUE,
2474 actual=linkDown,
2475 onpass="Link Down discovered properly",
2476 onfail="Link down was not discovered in " +
2477 str( link_sleep ) +
2478 " seconds" )
2479
GlennRCfcfdc4f2015-09-30 16:01:57 -07002480 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002481 # Giving onos multiple chances to install intents
2482 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002483 if i != 0:
2484 main.log.warn( "Verification failed. Retrying..." )
2485 main.log.info("Giving onos some time...")
2486 time.sleep( main.checkIntentsDelay )
2487
2488 intentState = main.TRUE
2489 for e in range(int(main.numCtrls)):
2490 main.log.info( "Checking intents on CLI %s" % (e+1) )
2491 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2492 intentState
2493 if not intentState:
2494 main.log.warn( "Not all intents installed" )
2495 if intentState:
2496 break
2497 else:
2498 #Dumping intent summary
2499 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2500
2501
2502 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2503 onpass="INTENTS INSTALLED",
2504 onfail="SOME INTENTS NOT INSTALLED" )
2505
Hari Krishnab79d0822015-08-20 09:48:43 -07002506 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002507 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002508 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002509 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2510 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002511 main.log.warn("First pingall failed. Retrying...")
2512 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002513 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002514
Hari Krishnab79d0822015-08-20 09:48:43 -07002515 time2 = time.time()
2516 timeDiff = round( ( time2 - time1 ), 2 )
2517 main.log.report(
2518 "Time taken for Ping All: " +
2519 str( timeDiff ) +
2520 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002521 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002522 onpass="PING ALL PASS",
2523 onfail="PING ALL FAIL" )
2524
GlennRCbddd58f2015-10-01 15:45:25 -07002525 caseResult = linkDown and pingResult and intentState
2526 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002527 onpass="Random Link cut Test PASS",
2528 onfail="Random Link cut Test FAIL" )
2529
GlennRCfcfdc4f2015-09-30 16:01:57 -07002530 # Printing what exactly failed
2531 if not linkDown:
2532 main.log.debug( "Link down was not discovered correctly" )
2533 if not pingResult:
2534 main.log.debug( "Pingall failed" )
2535 if not intentState:
2536 main.log.debug( "Intents are not all installed" )
2537
GlennRCbddd58f2015-10-01 15:45:25 -07002538 if not caseResult and main.failSwitch:
2539 main.log.report("Stopping test")
2540 main.stop( email=main.emailOnStop )
2541
Hari Krishnab79d0822015-08-20 09:48:43 -07002542 def CASE85( self, main ):
2543 """
2544 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2545 """
2546 import random
2547 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2548 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2549 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2550 main.log.report(
2551 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2552 main.log.report(
2553 "__________________________________________________________________" )
2554 main.case(
2555 "Point intents - Bring the core links up that are down and verify ping all" )
2556
2557 # Work around for link state propagation delay. Added some sleep time.
2558 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2559 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2560 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2561 time.sleep( link_sleep )
2562 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2563 time.sleep( link_sleep )
2564
2565 topology_output = main.ONOScli1.topology()
2566 linkUp = main.ONOSbench.checkStatus(
2567 topology_output,
2568 main.numMNswitches,
2569 str( main.numMNlinks ) )
2570 utilities.assert_equals(
2571 expect=main.TRUE,
2572 actual=linkUp,
2573 onpass="Link up discovered properly",
2574 onfail="Link up was not discovered in " +
2575 str( link_sleep ) +
2576 " seconds" )
2577
GlennRCfcfdc4f2015-09-30 16:01:57 -07002578 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002579 # Giving onos multiple chances to install intents
2580 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002581 if i != 0:
2582 main.log.warn( "Verification failed. Retrying..." )
2583 main.log.info("Giving onos some time...")
2584 time.sleep( main.checkIntentsDelay )
2585
2586 intentState = main.TRUE
2587 for e in range(int(main.numCtrls)):
2588 main.log.info( "Checking intents on CLI %s" % (e+1) )
2589 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2590 intentState
2591 if not intentState:
2592 main.log.warn( "Not all intents installed" )
2593 if intentState:
2594 break
2595 else:
2596 #Dumping intent summary
2597 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2598
2599
2600 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2601 onpass="INTENTS INSTALLED",
2602 onfail="SOME INTENTS NOT INSTALLED" )
2603
Hari Krishnab79d0822015-08-20 09:48:43 -07002604 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002605 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002606 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002607 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2608 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002609 main.log.warn("First pingall failed. Retrying...")
2610 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002611 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002612
Hari Krishnab79d0822015-08-20 09:48:43 -07002613 time2 = time.time()
2614 timeDiff = round( ( time2 - time1 ), 2 )
2615 main.log.report(
2616 "Time taken for Ping All: " +
2617 str( timeDiff ) +
2618 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002619 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002620 onpass="PING ALL PASS",
2621 onfail="PING ALL FAIL" )
2622
GlennRCbddd58f2015-10-01 15:45:25 -07002623 caseResult = linkUp and pingResult
2624 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002625 onpass="Link Up Test PASS",
2626 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002627 # Printing what exactly failed
2628 if not linkUp:
2629 main.log.debug( "Link down was not discovered correctly" )
2630 if not pingResult:
2631 main.log.debug( "Pingall failed" )
2632 if not intentState:
2633 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002634
GlennRCbddd58f2015-10-01 15:45:25 -07002635 if not caseResult and main.failSwitch:
2636 main.log.report("Stopping test")
2637 main.stop( email=main.emailOnStop )
2638
Hari Krishna4223dbd2015-08-13 16:29:53 -07002639 def CASE170( self ):
2640 """
2641 IPv6 ping all with some core links down( Host Intents-Att Topo)
2642 """
2643 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2644 main.log.report( "_________________________________________________" )
2645 import itertools
2646 import time
2647 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2648 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002649 pingResult = main.FALSE
2650 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002651 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002652 if not pingResult:
2653 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002654 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002655 time2 = time.time()
2656 timeDiff = round( ( time2 - time1 ), 2 )
2657 main.log.report(
2658 "Time taken for IPv6 Ping All: " +
2659 str( timeDiff ) +
2660 " seconds" )
2661 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2662 onpass="PING ALL PASS",
2663 onfail="PING ALL FAIL" )
2664
GlennRCbddd58f2015-10-01 15:45:25 -07002665 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002666 utilities.assert_equals(
2667 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002668 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002669 onpass="IPv6 Ping across 300 host intents test PASS",
2670 onfail="IPv6 Ping across 300 host intents test FAIL" )
2671
2672 def CASE180( self ):
2673 """
2674 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2675 """
2676 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2677 main.log.report( "_________________________________________________" )
2678 import itertools
2679 import time
2680 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2681 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002682 pingResult = main.FALSE
2683 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002684 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002685 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002686 main.log.warn("First ping failed. Retrying...")
2687 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002688 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002689 time2 = time.time()
2690 timeDiff = round( ( time2 - time1 ), 2 )
2691 main.log.report(
2692 "Time taken for IPv6 Ping All: " +
2693 str( timeDiff ) +
2694 " seconds" )
2695 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2696 onpass="PING ALL PASS",
2697 onfail="PING ALL FAIL" )
2698
GlennRCbddd58f2015-10-01 15:45:25 -07002699 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002700 utilities.assert_equals(
2701 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002702 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002703 onpass="IPv6 Ping across 300 host intents test PASS",
2704 onfail="IPv6 Ping across 300 host intents test FAIL" )
2705
2706 def CASE171( self ):
2707 """
2708 IPv6 ping all with some core links down( Point Intents-Att Topo)
2709 """
2710 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2711 main.log.report( "_________________________________________________" )
2712 import itertools
2713 import time
2714 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2715 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002716 pingResult = main.FALSE
2717 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002718 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002719 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002720 main.log.warn("First ping failed. Retrying...")
2721 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002722 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002723 time2 = time.time()
2724 timeDiff = round( ( time2 - time1 ), 2 )
2725 main.log.report(
2726 "Time taken for IPv6 Ping All: " +
2727 str( timeDiff ) +
2728 " seconds" )
2729 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2730 onpass="PING ALL PASS",
2731 onfail="PING ALL FAIL" )
2732
GlennRCbddd58f2015-10-01 15:45:25 -07002733 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002734 utilities.assert_equals(
2735 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002736 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002737 onpass="IPv6 Ping across 600 point intents test PASS",
2738 onfail="IPv6 Ping across 600 point intents test FAIL" )
2739
2740 def CASE181( self ):
2741 """
2742 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2743 """
2744 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2745 main.log.report( "_________________________________________________" )
2746 import itertools
2747 import time
2748 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2749 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002750 pingResult = main.FALSE
2751 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002752 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002753 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002754 main.log.warn("First ping failed. Retrying...")
2755 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002756 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002757 time2 = time.time()
2758 timeDiff = round( ( time2 - time1 ), 2 )
2759 main.log.report(
2760 "Time taken for IPv6 Ping All: " +
2761 str( timeDiff ) +
2762 " seconds" )
2763 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2764 onpass="PING ALL PASS",
2765 onfail="PING ALL FAIL" )
2766
GlennRCbddd58f2015-10-01 15:45:25 -07002767 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002768 utilities.assert_equals(
2769 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002770 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002771 onpass="IPv6 Ping across 600 Point intents test PASS",
2772 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2773
2774 def CASE172( self ):
2775 """
2776 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2777 """
2778 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2779 main.log.report( "_________________________________________________" )
2780 import itertools
2781 import time
2782 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2783 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002784 pingResult = main.FALSE
2785 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002786 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002787 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002788 main.log.warn("First ping failed. Retrying...")
2789 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002790 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002791 time2 = time.time()
2792 timeDiff = round( ( time2 - time1 ), 2 )
2793 main.log.report(
2794 "Time taken for IPv6 Ping All: " +
2795 str( timeDiff ) +
2796 " seconds" )
2797 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2798 onpass="PING ALL PASS",
2799 onfail="PING ALL FAIL" )
2800
GlennRCbddd58f2015-10-01 15:45:25 -07002801 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002802 utilities.assert_equals(
2803 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002804 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002805 onpass="IPv6 Ping across 300 host intents test PASS",
2806 onfail="IPv6 Ping across 300 host intents test FAIL" )
2807
2808 def CASE182( self ):
2809 """
2810 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2811 """
2812 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2813 main.log.report( "_________________________________________________" )
2814 import itertools
2815 import time
2816 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2817 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002818 pingResult = main.FALSE
2819 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002820 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002821 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002822 main.log.warn("First ping failed. Retrying...")
2823 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002824 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002825 time2 = time.time()
2826 timeDiff = round( ( time2 - time1 ), 2 )
2827 main.log.report(
2828 "Time taken for IPv6 Ping All: " +
2829 str( timeDiff ) +
2830 " seconds" )
2831 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2832 onpass="PING ALL PASS",
2833 onfail="PING ALL FAIL" )
2834
GlennRCbddd58f2015-10-01 15:45:25 -07002835 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002836 utilities.assert_equals(
2837 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002838 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002839 onpass="IPv6 Ping across 300 host intents test PASS",
2840 onfail="IPv6 Ping across 300 host intents test FAIL" )
2841
2842 def CASE173( self ):
2843 """
2844 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2845 """
2846 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2847 main.log.report( "_________________________________________________" )
2848 import itertools
2849 import time
2850 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2851 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002852 pingResult = main.FALSE
2853 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002854 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002855 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002856 main.log.warn("First ping failed. Retrying...")
2857 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002858 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002859 time2 = time.time()
2860 timeDiff = round( ( time2 - time1 ), 2 )
2861 main.log.report(
2862 "Time taken for IPv6 Ping All: " +
2863 str( timeDiff ) +
2864 " seconds" )
2865 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2866 onpass="PING ALL PASS",
2867 onfail="PING ALL FAIL" )
2868
GlennRCbddd58f2015-10-01 15:45:25 -07002869 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002870 utilities.assert_equals(
2871 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002872 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002873 onpass="IPv6 Ping across 600 point intents test PASS",
2874 onfail="IPv6 Ping across 600 point intents test FAIL" )
2875
2876 def CASE183( self ):
2877 """
2878 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2879 """
2880 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2881 main.log.report( "_________________________________________________" )
2882 import itertools
2883 import time
2884 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2885 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002886 pingResult = main.FALSE
2887 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002888 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002889 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002890 main.log.warn("First ping failed. Retrying...")
2891 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002892 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002893 time2 = time.time()
2894 timeDiff = round( ( time2 - time1 ), 2 )
2895 main.log.report(
2896 "Time taken for IPv6 Ping All: " +
2897 str( timeDiff ) +
2898 " seconds" )
2899 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2900 onpass="PING ALL PASS",
2901 onfail="PING ALL FAIL" )
2902
GlennRCbddd58f2015-10-01 15:45:25 -07002903 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002904 utilities.assert_equals(
2905 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002906 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002907 onpass="IPv6 Ping across 600 Point intents test PASS",
2908 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2909
2910 def CASE174( self ):
2911 """
2912 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2913 """
2914 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2915 main.log.report( "_________________________________________________" )
2916 import itertools
2917 import time
2918 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2919 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002920 pingResult = main.FALSE
2921 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002922 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002923 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002924 main.log.warn("First ping failed. Retrying...")
2925 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002926 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002927 time2 = time.time()
2928 timeDiff = round( ( time2 - time1 ), 2 )
2929 main.log.report(
2930 "Time taken for IPv6 Ping All: " +
2931 str( timeDiff ) +
2932 " seconds" )
2933 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2934 onpass="PING ALL PASS",
2935 onfail="PING ALL FAIL" )
2936
GlennRCbddd58f2015-10-01 15:45:25 -07002937 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002938 utilities.assert_equals(
2939 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002940 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002941 onpass="IPv6 Ping across 2278 host intents test PASS",
2942 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2943
2944 def CASE184( self ):
2945 """
2946 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2947 """
2948 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2949 main.log.report( "_________________________________________________" )
2950 import itertools
2951 import time
2952 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2953 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002954 pingResult = main.FALSE
2955 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002956 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002957 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002958 main.log.warn("First ping failed. Retrying...")
2959 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002960 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002961 time2 = time.time()
2962 timeDiff = round( ( time2 - time1 ), 2 )
2963 main.log.report(
2964 "Time taken for IPv6 Ping All: " +
2965 str( timeDiff ) +
2966 " seconds" )
2967 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2968 onpass="PING ALL PASS",
2969 onfail="PING ALL FAIL" )
2970
GlennRCbddd58f2015-10-01 15:45:25 -07002971 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002972 utilities.assert_equals(
2973 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002974 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002975 onpass="IPv6 Ping across 2278 host intents test PASS",
2976 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2977
2978 def CASE175( self ):
2979 """
2980 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2981 """
2982 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2983 main.log.report( "_________________________________________________" )
2984 import itertools
2985 import time
2986 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2987 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002988 pingResult = main.FALSE
2989 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002990 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002991 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002992 main.log.warn("First ping failed. Retrying...")
2993 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002994 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002995 time2 = time.time()
2996 timeDiff = round( ( time2 - time1 ), 2 )
2997 main.log.report(
2998 "Time taken for IPv6 Ping All: " +
2999 str( timeDiff ) +
3000 " seconds" )
3001 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3002 onpass="PING ALL PASS",
3003 onfail="PING ALL FAIL" )
3004
GlennRCbddd58f2015-10-01 15:45:25 -07003005 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003006 utilities.assert_equals(
3007 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003008 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003009 onpass="IPv6 Ping across 4556 point intents test PASS",
3010 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3011
3012 def CASE185( self ):
3013 """
3014 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3015 """
3016 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3017 main.log.report( "_________________________________________________" )
3018 import itertools
3019 import time
3020 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3021 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003022 pingResult = main.FALSE
3023 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003024 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003025 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003026 main.log.warn("First ping failed. Retrying...")
3027 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003028 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003029 time2 = time.time()
3030 timeDiff = round( ( time2 - time1 ), 2 )
3031 main.log.report(
3032 "Time taken for IPv6 Ping All: " +
3033 str( timeDiff ) +
3034 " seconds" )
3035 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3036 onpass="PING ALL PASS",
3037 onfail="PING ALL FAIL" )
3038
GlennRCbddd58f2015-10-01 15:45:25 -07003039 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003040 utilities.assert_equals(
3041 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003042 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003043 onpass="IPv6 Ping across 4556 Point intents test PASS",
3044 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3045
Hari Krishnac195f3b2015-07-08 20:02:24 -07003046 def CASE90( self ):
3047 """
3048 Install 600 point intents and verify ping all (Att Topology)
3049 """
3050 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3051 main.log.report( "_______________________________________" )
3052 import itertools
3053 import time
3054 main.case( "Install 600 point intents" )
3055 main.step( "Add point Intents" )
3056 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003057 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3058
Hari Krishnac195f3b2015-07-08 20:02:24 -07003059 intentIdList = []
3060 time1 = time.time()
3061 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3062 pool = []
3063 for cli in main.CLIs:
3064 if i >= len( deviceCombos ):
3065 break
3066 t = main.Thread( target=cli.addPointIntent,
3067 threadID=main.threadID,
3068 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003069 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 -07003070 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003071 t.start()
3072 i = i + 1
3073 main.threadID = main.threadID + 1
3074 for thread in pool:
3075 thread.join()
3076 intentIdList.append(thread.result)
3077 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003078 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003079
GlennRCfcfdc4f2015-09-30 16:01:57 -07003080 # Saving intent ids to check intents in later case
3081 main.intentIds = list(intentIdList)
3082
GlennRCa8d786a2015-09-23 17:40:11 -07003083 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003084
GlennRC1dde1712015-10-02 11:03:08 -07003085 # Giving onos multiple chances to install intents
3086 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003087 if i != 0:
3088 main.log.warn( "Verification failed. Retrying..." )
3089 main.log.info("Waiting for onos to install intents...")
3090 time.sleep( main.checkIntentsDelay )
3091
GlennRCa8d786a2015-09-23 17:40:11 -07003092 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003093 for e in range(int(main.numCtrls)):
3094 main.log.info( "Checking intents on CLI %s" % (e+1) )
3095 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3096 intentState
3097 if not intentState:
3098 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003099 if intentState:
3100 break
GlennRCdb2c8422015-09-29 12:21:59 -07003101 else:
3102 #Dumping intent summary
3103 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003104
3105 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3106 onpass="INTENTS INSTALLED",
3107 onfail="SOME INTENTS NOT INSTALLED" )
3108
Hari Krishnac195f3b2015-07-08 20:02:24 -07003109 main.step( "Verify Ping across all hosts" )
3110 pingResult = main.FALSE
3111 time1 = time.time()
3112 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3113 time2 = time.time()
3114 timeDiff = round( ( time2 - time1 ), 2 )
3115 main.log.report(
3116 "Time taken for Ping All: " +
3117 str( timeDiff ) +
3118 " seconds" )
3119 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3120 onpass="PING tALL PASS",
3121 onfail="PING ALL FAIL" )
3122
GlennRCbddd58f2015-10-01 15:45:25 -07003123 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003124
Hari Krishnac195f3b2015-07-08 20:02:24 -07003125 utilities.assert_equals(
3126 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003127 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003128 onpass="Install 600 point Intents and Ping All test PASS",
3129 onfail="Install 600 point Intents and Ping All test FAIL" )
3130
GlennRCbddd58f2015-10-01 15:45:25 -07003131 if not intentState:
3132 main.log.debug( "Intents failed to install completely" )
3133 if not pingResult:
3134 main.log.debug( "Pingall failed" )
3135
3136 if not caseResult and main.failSwitch:
3137 main.log.report("Stopping test")
3138 main.stop( email=main.emailOnStop )
3139
Hari Krishnac195f3b2015-07-08 20:02:24 -07003140 def CASE91( self ):
3141 """
3142 Install 600 point intents and verify ping all (Chordal Topology)
3143 """
3144 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3145 main.log.report( "_______________________________________" )
3146 import itertools
3147 import time
3148 main.case( "Install 600 point intents" )
3149 main.step( "Add point Intents" )
3150 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003151 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3152
Hari Krishnac195f3b2015-07-08 20:02:24 -07003153 intentIdList = []
3154 time1 = time.time()
3155 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3156 pool = []
3157 for cli in main.CLIs:
3158 if i >= len( deviceCombos ):
3159 break
3160 t = main.Thread( target=cli.addPointIntent,
3161 threadID=main.threadID,
3162 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003163 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 -07003164 pool.append(t)
3165 #time.sleep(1)
3166 t.start()
3167 i = i + 1
3168 main.threadID = main.threadID + 1
3169 for thread in pool:
3170 thread.join()
3171 intentIdList.append(thread.result)
3172 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003173 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003174
GlennRCfcfdc4f2015-09-30 16:01:57 -07003175 # Saving intent ids to check intents in later case
3176 main.intentIds = list(intentIdList)
3177
GlennRCa8d786a2015-09-23 17:40:11 -07003178 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003179
GlennRC1dde1712015-10-02 11:03:08 -07003180 # Giving onos multiple chances to install intents
3181 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003182 if i != 0:
3183 main.log.warn( "Verification failed. Retrying..." )
3184 main.log.info("Waiting for onos to install intents...")
3185 time.sleep( main.checkIntentsDelay )
3186
GlennRCa8d786a2015-09-23 17:40:11 -07003187 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003188 for e in range(int(main.numCtrls)):
3189 main.log.info( "Checking intents on CLI %s" % (e+1) )
3190 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3191 intentState
3192 if not intentState:
3193 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003194 if intentState:
3195 break
GlennRCdb2c8422015-09-29 12:21:59 -07003196 else:
3197 #Dumping intent summary
3198 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003199
3200 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3201 onpass="INTENTS INSTALLED",
3202 onfail="SOME INTENTS NOT INSTALLED" )
3203
Hari Krishnac195f3b2015-07-08 20:02:24 -07003204 main.step( "Verify Ping across all hosts" )
3205 pingResult = main.FALSE
3206 time1 = time.time()
3207 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3208 time2 = time.time()
3209 timeDiff = round( ( time2 - time1 ), 2 )
3210 main.log.report(
3211 "Time taken for Ping All: " +
3212 str( timeDiff ) +
3213 " seconds" )
3214 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3215 onpass="PING ALL PASS",
3216 onfail="PING ALL FAIL" )
3217
GlennRCbddd58f2015-10-01 15:45:25 -07003218 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003219
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 utilities.assert_equals(
3221 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003222 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003223 onpass="Install 600 point Intents and Ping All test PASS",
3224 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003225
GlennRCbddd58f2015-10-01 15:45:25 -07003226 if not intentState:
3227 main.log.debug( "Intents failed to install completely" )
3228 if not pingResult:
3229 main.log.debug( "Pingall failed" )
3230
3231 if not caseResult and main.failSwitch:
3232 main.log.report("Stopping test")
3233 main.stop( email=main.emailOnStop )
3234
Hari Krishnac195f3b2015-07-08 20:02:24 -07003235 def CASE92( self ):
3236 """
3237 Install 4556 point intents and verify ping all (Spine Topology)
3238 """
3239 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3240 main.log.report( "_______________________________________" )
3241 import itertools
3242 import time
3243 main.case( "Install 4556 point intents" )
3244 main.step( "Add point Intents" )
3245 intentResult = main.TRUE
3246 main.pingTimeout = 600
3247 for i in range(len(main.hostMACs)):
3248 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3249 print main.MACsDict
3250 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3251 intentIdList = []
3252 time1 = time.time()
3253 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3254 pool = []
3255 for cli in main.CLIs:
3256 if i >= len( deviceCombos ):
3257 break
3258 t = main.Thread( target=cli.addPointIntent,
3259 threadID=main.threadID,
3260 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003261 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 -07003262 pool.append(t)
3263 #time.sleep(1)
3264 t.start()
3265 i = i + 1
3266 main.threadID = main.threadID + 1
3267 for thread in pool:
3268 thread.join()
3269 intentIdList.append(thread.result)
3270 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003271 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003272
GlennRCfcfdc4f2015-09-30 16:01:57 -07003273 # Saving intent ids to check intents in later case
3274 main.intentIds = list(intentIdList)
3275
GlennRCa8d786a2015-09-23 17:40:11 -07003276 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003277
GlennRC1dde1712015-10-02 11:03:08 -07003278 # Giving onos multiple chances to install intents
3279 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003280 if i != 0:
3281 main.log.warn( "Verification failed. Retrying..." )
3282 main.log.info("Waiting for onos to install intents...")
3283 time.sleep( main.checkIntentsDelay )
3284
GlennRCa8d786a2015-09-23 17:40:11 -07003285 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003286 for e in range(int(main.numCtrls)):
3287 main.log.info( "Checking intents on CLI %s" % (e+1) )
3288 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3289 intentState
3290 if not intentState:
3291 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003292 if intentState:
3293 break
GlennRCdb2c8422015-09-29 12:21:59 -07003294 else:
3295 #Dumping intent summary
3296 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003297
3298 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3299 onpass="INTENTS INSTALLED",
3300 onfail="SOME INTENTS NOT INSTALLED" )
3301
Hari Krishnac195f3b2015-07-08 20:02:24 -07003302 main.step( "Verify Ping across all hosts" )
3303 pingResult = main.FALSE
3304 time1 = time.time()
3305 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3306 time2 = time.time()
3307 timeDiff = round( ( time2 - time1 ), 2 )
3308 main.log.report(
3309 "Time taken for Ping All: " +
3310 str( timeDiff ) +
3311 " seconds" )
3312 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3313 onpass="PING ALL PASS",
3314 onfail="PING ALL FAIL" )
3315
GlennRCbddd58f2015-10-01 15:45:25 -07003316 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003317
Hari Krishnac195f3b2015-07-08 20:02:24 -07003318 utilities.assert_equals(
3319 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003320 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003321 onpass="Install 4556 point Intents and Ping All test PASS",
3322 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003323
GlennRCbddd58f2015-10-01 15:45:25 -07003324 if not intentState:
3325 main.log.debug( "Intents failed to install completely" )
3326 if not pingResult:
3327 main.log.debug( "Pingall failed" )
3328
3329 if not caseResult and main.failSwitch:
3330 main.log.report("Stopping test")
3331 main.stop( email=main.emailOnStop )
3332
Hari Krishnac195f3b2015-07-08 20:02:24 -07003333 def CASE93( self ):
3334 """
3335 Install multi-single point intents and verify Ping all works
3336 for att topology
3337 """
3338 import copy
3339 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003340 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003341 main.log.report( "Install multi-single point intents and verify Ping all" )
3342 main.log.report( "___________________________________________" )
3343 main.case( "Install multi-single point intents and Ping all" )
3344 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3345 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3346 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003347 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003348 time1 = time.time()
3349 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3350 pool = []
3351 for cli in main.CLIs:
3352 egressDevice = deviceDPIDsCopy[i]
3353 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3354 ingressDeviceList.remove(egressDevice)
3355 if i >= len( deviceDPIDsCopy ):
3356 break
3357 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3358 threadID=main.threadID,
3359 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003360 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003361 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003362 t.start()
3363 i = i + 1
3364 main.threadID = main.threadID + 1
3365 for thread in pool:
3366 thread.join()
3367 intentIdList.append(thread.result)
3368 time2 = time.time()
3369 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003370
GlennRCdb2c8422015-09-29 12:21:59 -07003371 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003372
GlennRC1dde1712015-10-02 11:03:08 -07003373 # Giving onos multiple chances to install intents
3374 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003375 if i != 0:
3376 main.log.warn( "Verification failed. Retrying..." )
3377 main.log.info("Waiting for onos to install intents...")
3378 time.sleep( main.checkIntentsDelay )
3379
3380 intentState = main.TRUE
3381 for e in range(int(main.numCtrls)):
3382 main.log.info( "Checking intents on CLI %s" % (e+1) )
3383 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3384 intentState
3385 if not intentState:
3386 main.log.warn( "Not all intents installed" )
3387 if intentState:
3388 break
3389 else:
3390 #Dumping intent summary
3391 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3392
3393 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3394 onpass="INTENTS INSTALLED",
3395 onfail="SOME INTENTS NOT INSTALLED" )
3396
3397 main.log.info( "Checking flows state" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003398 checkFlowsState = main.ONOScli1.checkFlowsState()
GlennRCdb2c8422015-09-29 12:21:59 -07003399 # Giving onos time to return the state of the flows
Hari Krishnac195f3b2015-07-08 20:02:24 -07003400 time.sleep(50)
GlennRCdb2c8422015-09-29 12:21:59 -07003401
Hari Krishnac195f3b2015-07-08 20:02:24 -07003402 main.step( "Verify Ping across all hosts" )
3403 pingResult = main.FALSE
3404 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003405 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3406 if not pingResult:
3407 time1 = time.time()
3408 main.log.warn("First pingall failed. Retrying")
3409 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3410
Hari Krishnac195f3b2015-07-08 20:02:24 -07003411 time2 = time.time()
3412 timeDiff = round( ( time2 - time1 ), 2 )
3413 main.log.report(
3414 "Time taken for Ping All: " +
3415 str( timeDiff ) +
3416 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003417
GlennRCbddd58f2015-10-01 15:45:25 -07003418 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003419 utilities.assert_equals(
3420 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003421 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003422 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3423 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003424
Hari Krishnac195f3b2015-07-08 20:02:24 -07003425 def CASE94( self ):
3426 """
3427 Install multi-single point intents and verify Ping all works
3428 for Chordal topology
3429 """
3430 import copy
3431 import time
3432 main.log.report( "Install multi-single point intents and verify Ping all" )
3433 main.log.report( "___________________________________________" )
3434 main.case( "Install multi-single point intents and Ping all" )
3435 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3436 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3437 intentIdList = []
3438 print "MACsDict", main.MACsDict
3439 time1 = time.time()
3440 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3441 pool = []
3442 for cli in main.CLIs:
3443 egressDevice = deviceDPIDsCopy[i]
3444 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3445 ingressDeviceList.remove(egressDevice)
3446 if i >= len( deviceDPIDsCopy ):
3447 break
3448 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3449 threadID=main.threadID,
3450 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003451 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003452 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003453 t.start()
3454 i = i + 1
3455 main.threadID = main.threadID + 1
3456 for thread in pool:
3457 thread.join()
3458 intentIdList.append(thread.result)
3459 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003460 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003461
3462 main.step("Verify intents are installed")
3463
GlennRC1dde1712015-10-02 11:03:08 -07003464 # Giving onos multiple chances to install intents
3465 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003466 if i != 0:
3467 main.log.warn( "Verification failed. Retrying..." )
3468 main.log.info("Waiting for onos to install intents...")
3469 time.sleep( main.checkIntentsDelay )
3470
3471 intentState = main.TRUE
3472 for e in range(int(main.numCtrls)):
3473 main.log.info( "Checking intents on CLI %s" % (e+1) )
3474 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3475 intentState
3476 if not intentState:
3477 main.log.warn( "Not all intents installed" )
3478 if intentState:
3479 break
3480 else:
3481 #Dumping intent summary
3482 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3483
3484
3485 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3486 onpass="INTENTS INSTALLED",
3487 onfail="SOME INTENTS NOT INSTALLED" )
3488
Hari Krishnac195f3b2015-07-08 20:02:24 -07003489 main.step( "Verify Ping across all hosts" )
3490 pingResult = main.FALSE
3491 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003492 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3493 if not pingResult:
3494 main.log.info( "First pingall failed. Retrying..." )
3495 time1 = time.time()
3496 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003497 time2 = time.time()
3498 timeDiff = round( ( time2 - time1 ), 2 )
3499 main.log.report(
3500 "Time taken for Ping All: " +
3501 str( timeDiff ) +
3502 " seconds" )
3503
GlennRCdb2c8422015-09-29 12:21:59 -07003504
GlennRCbddd58f2015-10-01 15:45:25 -07003505 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003506 utilities.assert_equals(
3507 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003508 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003509 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3510 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003511
Hari Krishnac195f3b2015-07-08 20:02:24 -07003512 #def CASE95 multi-single point intent for Spine
3513
3514 def CASE96( self ):
3515 """
3516 Install single-multi point intents and verify Ping all works
3517 for att topology
3518 """
3519 import copy
3520 main.log.report( "Install single-multi point intents and verify Ping all" )
3521 main.log.report( "___________________________________________" )
3522 main.case( "Install single-multi point intents and Ping all" )
3523 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3524 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3525 intentIdList = []
3526 print "MACsDict", main.MACsDict
3527 time1 = time.time()
3528 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3529 pool = []
3530 for cli in main.CLIs:
3531 ingressDevice = deviceDPIDsCopy[i]
3532 egressDeviceList = copy.copy(deviceDPIDsCopy)
3533 egressDeviceList.remove(ingressDevice)
3534 if i >= len( deviceDPIDsCopy ):
3535 break
3536 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3537 threadID=main.threadID,
3538 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003539 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003540 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003541 t.start()
3542 i = i + 1
3543 main.threadID = main.threadID + 1
3544 for thread in pool:
3545 thread.join()
3546 intentIdList.append(thread.result)
3547 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003548 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003549
3550 main.step("Verify intents are installed")
3551
GlennRC1dde1712015-10-02 11:03:08 -07003552 # Giving onos multiple chances to install intents
3553 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003554 if i != 0:
3555 main.log.warn( "Verification failed. Retrying..." )
3556 main.log.info("Waiting for onos to install intents...")
3557 time.sleep( main.checkIntentsDelay )
3558
3559 intentState = main.TRUE
3560 for e in range(int(main.numCtrls)):
3561 main.log.info( "Checking intents on CLI %s" % (e+1) )
3562 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3563 intentState
3564 if not intentState:
3565 main.log.warn( "Not all intents installed" )
3566 if intentState:
3567 break
3568 else:
3569 #Dumping intent summary
3570 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3571
3572
3573 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3574 onpass="INTENTS INSTALLED",
3575 onfail="SOME INTENTS NOT INSTALLED" )
3576
Hari Krishnac195f3b2015-07-08 20:02:24 -07003577 main.step( "Verify Ping across all hosts" )
3578 pingResult = main.FALSE
3579 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003580 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3581 if not pingResult:
3582 main.log.info( "First pingall failed. Retrying..." )
3583 time1 = time.time()
3584 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003585 time2 = time.time()
3586 timeDiff = round( ( time2 - time1 ), 2 )
3587 main.log.report(
3588 "Time taken for Ping All: " +
3589 str( timeDiff ) +
3590 " seconds" )
3591
GlennRCbddd58f2015-10-01 15:45:25 -07003592 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003593 utilities.assert_equals(
3594 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003595 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003596 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3597 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3598
3599 def CASE97( self ):
3600 """
3601 Install single-multi point intents and verify Ping all works
3602 for Chordal topology
3603 """
3604 import copy
3605 main.log.report( "Install single-multi point intents and verify Ping all" )
3606 main.log.report( "___________________________________________" )
3607 main.case( "Install single-multi point intents and Ping all" )
3608 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3609 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3610 intentIdList = []
3611 print "MACsDict", main.MACsDict
3612 time1 = time.time()
3613 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3614 pool = []
3615 for cli in main.CLIs:
3616 ingressDevice = deviceDPIDsCopy[i]
3617 egressDeviceList = copy.copy(deviceDPIDsCopy)
3618 egressDeviceList.remove(ingressDevice)
3619 if i >= len( deviceDPIDsCopy ):
3620 break
3621 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3622 threadID=main.threadID,
3623 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003624 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003625 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003626 t.start()
3627 i = i + 1
3628 main.threadID = main.threadID + 1
3629 for thread in pool:
3630 thread.join()
3631 intentIdList.append(thread.result)
3632 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003633 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003634
3635 main.step("Verify intents are installed")
3636
GlennRC1dde1712015-10-02 11:03:08 -07003637 # Giving onos multiple chances to install intents
3638 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003639 if i != 0:
3640 main.log.warn( "Verification failed. Retrying..." )
3641 main.log.info("Waiting for onos to install intents...")
3642 time.sleep( main.checkIntentsDelay )
3643
3644 intentState = main.TRUE
3645 for e in range(int(main.numCtrls)):
3646 main.log.info( "Checking intents on CLI %s" % (e+1) )
3647 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3648 intentState
3649 if not intentState:
3650 main.log.warn( "Not all intents installed" )
3651 if intentState:
3652 break
3653 else:
3654 #Dumping intent summary
3655 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3656
3657
3658 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3659 onpass="INTENTS INSTALLED",
3660 onfail="SOME INTENTS NOT INSTALLED" )
3661
Hari Krishnac195f3b2015-07-08 20:02:24 -07003662 main.step( "Verify Ping across all hosts" )
3663 pingResult = main.FALSE
3664 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003665 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3666 if not pingResult:
3667 main.log.info( "First pingall failed. Retrying..." )
3668 time1 = time.time()
3669 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003670 time2 = time.time()
3671 timeDiff = round( ( time2 - time1 ), 2 )
3672 main.log.report(
3673 "Time taken for Ping All: " +
3674 str( timeDiff ) +
3675 " seconds" )
3676
GlennRCbddd58f2015-10-01 15:45:25 -07003677 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003678 utilities.assert_equals(
3679 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003680 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003681 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3682 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3683
3684 def CASE98( self ):
3685 """
3686 Install single-multi point intents and verify Ping all works
3687 for Spine topology
3688 """
3689 import copy
3690 main.log.report( "Install single-multi point intents and verify Ping all" )
3691 main.log.report( "___________________________________________" )
3692 main.case( "Install single-multi point intents and Ping all" )
3693 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3694 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3695 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3696 intentIdList = []
3697 MACsDictCopy = {}
3698 for i in range( len( deviceDPIDsCopy ) ):
3699 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3700
3701 print "deviceDPIDsCopy", deviceDPIDsCopy
3702 print ""
3703 print "MACsDictCopy", MACsDictCopy
3704 time1 = time.time()
3705 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3706 pool = []
3707 for cli in main.CLIs:
3708 if i >= len( deviceDPIDsCopy ):
3709 break
3710 ingressDevice = deviceDPIDsCopy[i]
3711 egressDeviceList = copy.copy(deviceDPIDsCopy)
3712 egressDeviceList.remove(ingressDevice)
3713 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3714 threadID=main.threadID,
3715 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003716 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003717 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003718 t.start()
3719 i = i + 1
3720 main.threadID = main.threadID + 1
3721 for thread in pool:
3722 thread.join()
3723 intentIdList.append(thread.result)
3724 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003725 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003726
3727 main.step("Verify intents are installed")
3728
GlennRC1dde1712015-10-02 11:03:08 -07003729 # Giving onos multiple chances to install intents
3730 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003731 if i != 0:
3732 main.log.warn( "Verification failed. Retrying..." )
3733 main.log.info("Waiting for onos to install intents...")
3734 time.sleep( main.checkIntentsDelay )
3735
3736 intentState = main.TRUE
3737 for e in range(int(main.numCtrls)):
3738 main.log.info( "Checking intents on CLI %s" % (e+1) )
3739 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3740 intentState
3741 if not intentState:
3742 main.log.warn( "Not all intents installed" )
3743 if intentState:
3744 break
3745 else:
3746 #Dumping intent summary
3747 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3748
3749
3750 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3751 onpass="INTENTS INSTALLED",
3752 onfail="SOME INTENTS NOT INSTALLED" )
3753
Hari Krishnac195f3b2015-07-08 20:02:24 -07003754 main.step( "Verify Ping across all hosts" )
3755 pingResult = main.FALSE
3756 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003757 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3758 if not pingResult:
3759 main.log.info( "First pingall failed. Retrying..." )
3760 time1 = time.time()
3761 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003762 time2 = time.time()
3763 timeDiff = round( ( time2 - time1 ), 2 )
3764 main.log.report(
3765 "Time taken for Ping All: " +
3766 str( timeDiff ) +
3767 " seconds" )
3768
GlennRCbddd58f2015-10-01 15:45:25 -07003769 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003770 utilities.assert_equals(
3771 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003772 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003773 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3774 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3775
Hari Krishna4223dbd2015-08-13 16:29:53 -07003776 def CASE190( self ):
3777 """
3778 Verify IPv6 ping across 600 Point intents (Att Topology)
3779 """
3780 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3781 main.log.report( "_________________________________________________" )
3782 import itertools
3783 import time
3784 main.case( "IPv6 ping all 600 Point intents" )
3785 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003786 pingResult = main.FALSE
3787 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003788 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003789 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003790 main.log.warn("First pingall failed. Retrying...")
3791 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003792 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003793 time2 = time.time()
3794 timeDiff = round( ( time2 - time1 ), 2 )
3795 main.log.report(
3796 "Time taken for IPv6 Ping All: " +
3797 str( timeDiff ) +
3798 " seconds" )
3799 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3800 onpass="PING ALL PASS",
3801 onfail="PING ALL FAIL" )
3802
GlennRCbddd58f2015-10-01 15:45:25 -07003803 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003804 utilities.assert_equals(
3805 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003806 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003807 onpass="IPv6 Ping across 600 Point intents test PASS",
3808 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3809
3810 def CASE191( self ):
3811 """
3812 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3813 """
3814 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3815 main.log.report( "_________________________________________________" )
3816 import itertools
3817 import time
3818 main.case( "IPv6 ping all 600 Point intents" )
3819 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003820 pingResult = main.FALSE
3821 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003822 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003823 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003824 main.log.warn("First pingall failed. Retrying...")
3825 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003826 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003827 time2 = time.time()
3828 timeDiff = round( ( time2 - time1 ), 2 )
3829 main.log.report(
3830 "Time taken for IPv6 Ping All: " +
3831 str( timeDiff ) +
3832 " seconds" )
3833 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3834 onpass="PING ALL PASS",
3835 onfail="PING ALL FAIL" )
3836
GlennRCbddd58f2015-10-01 15:45:25 -07003837 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003838 utilities.assert_equals(
3839 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003840 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003841 onpass="IPv6 Ping across 600 Point intents test PASS",
3842 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3843
3844 def CASE192( self ):
3845 """
3846 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3847 """
3848 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3849 main.log.report( "_________________________________________________" )
3850 import itertools
3851 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003852 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003853 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003854 pingResult = main.FALSE
3855 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003856 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07003857 if not pingResult:
3858 main.log.warn("First pingall failed. Retrying...")
3859 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003860 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003861 time2 = time.time()
3862 timeDiff = round( ( time2 - time1 ), 2 )
3863 main.log.report(
3864 "Time taken for IPv6 Ping All: " +
3865 str( timeDiff ) +
3866 " seconds" )
3867 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3868 onpass="PING ALL PASS",
3869 onfail="PING ALL FAIL" )
3870
GlennRCbddd58f2015-10-01 15:45:25 -07003871 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003872 utilities.assert_equals(
3873 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003874 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003875 onpass="IPv6 Ping across 4556 Point intents test PASS",
3876 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003877
Hari Krishnac195f3b2015-07-08 20:02:24 -07003878 def CASE10( self ):
3879 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003880 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003881 """
3882 Remove all Intents
3883 """
3884 main.log.report( "Remove all intents that were installed previously" )
3885 main.log.report( "______________________________________________" )
3886 main.log.info( "Remove all intents" )
3887 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003888 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003889 main.step( "Obtain the intent id's first" )
3890 intentsList = main.ONOScli1.getAllIntentIds()
3891 ansi_escape = re.compile( r'\x1b[^m]*m' )
3892 intentsList = ansi_escape.sub( '', intentsList )
3893 intentsList = intentsList.replace(
3894 " onos:intents | grep id=",
3895 "" ).replace(
3896 "id=",
3897 "" ).replace(
3898 "\r\r",
3899 "" )
3900 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003901 intentIdList = []
3902 step1Result = main.TRUE
3903 moreIntents = main.TRUE
3904 removeIntentCount = 0
3905 intentsCount = len(intentsList)
3906 main.log.info ( "Current number of intents: " + str(intentsCount) )
3907 if ( len( intentsList ) > 1 ):
3908 results = main.TRUE
3909 main.log.info("Removing intent...")
3910 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003911 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003912 if removeIntentCount == 5:
3913 break
3914 removeIntentCount = removeIntentCount + 1
3915 intentsList1 = main.ONOScli1.getAllIntentIds()
3916 if len( intentsList1 ) == 0:
3917 break
3918 ansi_escape = re.compile( r'\x1b[^m]*m' )
3919 intentsList1 = ansi_escape.sub( '', intentsList1 )
3920 intentsList1 = intentsList1.replace(
3921 " onos:intents | grep id=",
3922 "" ).replace(
3923 " state=",
3924 "" ).replace(
3925 "\r\r",
3926 "" )
3927 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003928 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3929 print intentsList1
3930 intentIdList1 = []
3931 if ( len( intentsList1 ) > 0 ):
3932 moreIntents = main.TRUE
3933 for i in range( len( intentsList1 ) ):
3934 intentsTemp1 = intentsList1[ i ].split( ',' )
3935 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3936 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3937 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3938 time1 = time.time()
3939 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3940 pool = []
3941 for cli in main.CLIs:
3942 if i >= len( intentIdList1 ):
3943 break
3944 t = main.Thread( target=cli.removeIntent,
3945 threadID=main.threadID,
3946 name="removeIntent",
3947 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3948 pool.append(t)
3949 t.start()
3950 i = i + 1
3951 main.threadID = main.threadID + 1
3952 for thread in pool:
3953 thread.join()
3954 intentIdList.append(thread.result)
3955 #time.sleep(2)
3956 time2 = time.time()
3957 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003958 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003959 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003960 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003961 else:
3962 time.sleep(10)
3963 if len( main.ONOScli1.intents()):
3964 continue
3965 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003966 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003967 else:
3968 print "Removed %d intents" %(intentsCount)
3969 step1Result = main.TRUE
3970 else:
3971 print "No Intent IDs found in Intents list: ", intentsList
3972 step1Result = main.FALSE
3973
3974 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07003975 caseResult = step1Result
3976 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003977 onpass="Intent removal test successful",
3978 onfail="Intent removal test failed" )
3979
3980 def CASE12( self, main ):
3981 """
3982 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3983 """
3984 import re
3985 import copy
3986 import time
3987
Hari Krishnac195f3b2015-07-08 20:02:24 -07003988 threadID = 0
3989
3990 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3991 main.log.report( "_____________________________________________________" )
3992 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3993 main.step( "Enable intent based Reactive forwarding" )
3994 installResult = main.FALSE
3995 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003996
Hari Krishnac195f3b2015-07-08 20:02:24 -07003997 pool = []
3998 time1 = time.time()
3999 for cli,feature in main.CLIs:
4000 t = main.Thread(target=cli,threadID=threadID,
4001 name="featureInstall",args=[feature])
4002 pool.append(t)
4003 t.start()
4004 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004005
Hari Krishnac195f3b2015-07-08 20:02:24 -07004006 results = []
4007 for thread in pool:
4008 thread.join()
4009 results.append(thread.result)
4010 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004011
Hari Krishnac195f3b2015-07-08 20:02:24 -07004012 if( all(result == main.TRUE for result in results) == False):
4013 main.log.info("Did not install onos-app-ifwd feature properly")
4014 #main.cleanup()
4015 #main.exit()
4016 else:
4017 main.log.info("Successful feature:install onos-app-ifwd")
4018 installResult = main.TRUE
4019 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004020
Hari Krishnac195f3b2015-07-08 20:02:24 -07004021 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07004022 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07004023 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07004024 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004025 time2 = time.time()
4026 timeDiff = round( ( time2 - time1 ), 2 )
4027 main.log.report(
4028 "Time taken for Ping All: " +
4029 str( timeDiff ) +
4030 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004031
GlennRC626ba132015-09-18 16:16:31 -07004032 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004033 main.log.report( "Pingall Test in Reactive mode successful" )
4034 else:
4035 main.log.report( "Pingall Test in Reactive mode failed" )
4036
4037 main.step( "Disable Intent based Reactive forwarding" )
4038 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004039
Hari Krishnac195f3b2015-07-08 20:02:24 -07004040 pool = []
4041 time1 = time.time()
4042 for cli,feature in main.CLIs:
4043 t = main.Thread(target=cli,threadID=threadID,
4044 name="featureUninstall",args=[feature])
4045 pool.append(t)
4046 t.start()
4047 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004048
Hari Krishnac195f3b2015-07-08 20:02:24 -07004049 results = []
4050 for thread in pool:
4051 thread.join()
4052 results.append(thread.result)
4053 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004054
Hari Krishnac195f3b2015-07-08 20:02:24 -07004055 if( all(result == main.TRUE for result in results) == False):
4056 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4057 uninstallResult = main.FALSE
4058 #main.cleanup()
4059 #main.exit()
4060 else:
4061 main.log.info("Successful feature:uninstall onos-app-ifwd")
4062 uninstallResult = main.TRUE
4063 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4064
4065 # Waiting for reative flows to be cleared.
4066 time.sleep( 10 )
4067
GlennRCbddd58f2015-10-01 15:45:25 -07004068 caseResult = installResult and pingResult and uninstallResult
4069 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004070 onpass="Intent based Reactive forwarding Pingall test PASS",
4071 onfail="Intent based Reactive forwarding Pingall test FAIL" )