blob: f3129e74635963a6fa4243c753edca4ff0e54465 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
30 main.pingTimeout = 300
31 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070032 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
33 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070034 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCbddd58f2015-10-01 15:45:25 -070036 main.failSwitch = bool( main.params['TEST']['fail_switch'] )
37 main.emailOnStop = bool( main.params['TEST']['email'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070038 main.newTopo = ""
39 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070040
41 for i in range( 1, int(main.numCtrls) + 1 ):
42 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070043
44 main.case( "Set up test environment" )
45 main.log.report( "Set up test environment" )
46 main.log.report( "_______________________" )
47
Hari Krishna6185fc12015-07-13 15:42:31 -070048 main.step( "Apply Cell environment for ONOS" )
49 if ( main.onoscell ):
50 cellName = main.onoscell
51 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070052 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
53 onpass="Test step PASS",
54 onfail="Test step FAIL" )
55 else:
56 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
57 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
58 main.clean()
59 main.exit()
60
Hari Krishnac195f3b2015-07-08 20:02:24 -070061 main.step( "Git checkout and pull " + git_branch )
62 if git_pull == 'on':
63 checkout_result = main.ONOSbench.gitCheckout( git_branch )
64 pull_result = main.ONOSbench.gitPull()
65 cp_result = ( checkout_result and pull_result )
66 else:
67 checkout_result = main.TRUE
68 pull_result = main.TRUE
69 main.log.info( "Skipped git checkout and pull" )
70 cp_result = ( checkout_result and pull_result )
71 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
72 onpass="Test step PASS",
73 onfail="Test step FAIL" )
74
75 main.step( "mvn clean & install" )
76 if git_pull == 'on':
77 mvn_result = main.ONOSbench.cleanInstall()
78 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
79 onpass="Test step PASS",
80 onfail="Test step FAIL" )
81 else:
82 mvn_result = main.TRUE
83 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
84
85 main.ONOSbench.getVersion( report=True )
86
Hari Krishnac195f3b2015-07-08 20:02:24 -070087 main.step( "Create ONOS package" )
88 packageResult = main.ONOSbench.onosPackage()
89 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
90 onpass="Test step PASS",
91 onfail="Test step FAIL" )
92
93 main.step( "Uninstall ONOS package on all Nodes" )
94 uninstallResult = main.TRUE
95 for i in range( int( main.numCtrls ) ):
96 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
97 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
98 utilities.assert_equals( expect=main.TRUE, actual=u_result,
99 onpass="Test step PASS",
100 onfail="Test step FAIL" )
101 uninstallResult = ( uninstallResult and u_result )
102
103 main.step( "Install ONOS package on all Nodes" )
104 installResult = main.TRUE
105 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700106 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700107 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
108 utilities.assert_equals( expect=main.TRUE, actual=i_result,
109 onpass="Test step PASS",
110 onfail="Test step FAIL" )
111 installResult = ( installResult and i_result )
112
113 main.step( "Verify ONOS nodes UP status" )
114 statusResult = main.TRUE
115 for i in range( int( main.numCtrls ) ):
116 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
117 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
118 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
119 onpass="Test step PASS",
120 onfail="Test step FAIL" )
121 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700122
Hari Krishnac195f3b2015-07-08 20:02:24 -0700123 main.step( "Start ONOS CLI on all nodes" )
124 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700125 main.log.step(" Start ONOS cli using thread ")
126 startCliResult = main.TRUE
127 pool = []
128 time1 = time.time()
129 for i in range( int( main.numCtrls) ):
130 t = main.Thread( target=main.CLIs[i].startOnosCli,
131 threadID=main.threadID,
132 name="startOnosCli",
133 args=[ main.onosIPs[i], karafTimeout ] )
134 pool.append(t)
135 t.start()
136 main.threadID = main.threadID + 1
137 for t in pool:
138 t.join()
139 startCliResult = startCliResult and t.result
140 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700141
Hari Krishnac195f3b2015-07-08 20:02:24 -0700142 if not startCliResult:
143 main.log.info("ONOS CLI did not start up properly")
144 main.cleanup()
145 main.exit()
146 else:
147 main.log.info("Successful CLI startup")
148 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700149
150 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
151 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
152 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
153 cfgResult = cfgResult1 and cfgResult2
154 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
155 onpass="ipv6NeighborDiscovery cfg is set to true",
156 onfail="Failed to cfg set ipv6NeighborDiscovery" )
157
158 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700159 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
160 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
161 onpass="Set up test environment PASS",
162 onfail="Set up test environment FAIL" )
163
164 def CASE20( self, main ):
165 """
166 This test script Loads a new Topology (Att) on CHO setup and balances all switches
167 """
168 import re
169 import time
170 import copy
171
172 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
173 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
174 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
175 main.pingTimeout = 300
176 main.log.report(
177 "Load Att topology and Balance all Mininet switches across controllers" )
178 main.log.report(
179 "________________________________________________________________________" )
180 main.case(
181 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700182
Hari Krishnac195f3b2015-07-08 20:02:24 -0700183 main.step( "Stop any previous Mininet network topology" )
184 cliResult = main.TRUE
185 if main.newTopo == main.params['TOPO3']['topo']:
186 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
187
188 main.step( "Start Mininet with Att topology" )
189 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700190 mininetDir = main.Mininet1.home + "/custom/"
191 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
192 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
193 topoPath = mininetDir + main.newTopo
194 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700195
Hari Krishnac195f3b2015-07-08 20:02:24 -0700196 main.step( "Assign switches to controllers" )
197 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
198 main.Mininet1.assignSwController(
199 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700200 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700201
202 switch_mastership = main.TRUE
203 for i in range( 1, ( main.numMNswitches + 1 ) ):
204 response = main.Mininet1.getSwController( "s" + str( i ) )
205 print( "Response is " + str( response ) )
206 if re.search( "tcp:" + main.onosIPs[0], response ):
207 switch_mastership = switch_mastership and main.TRUE
208 else:
209 switch_mastership = main.FALSE
210
211 if switch_mastership == main.TRUE:
212 main.log.report( "Controller assignment successfull" )
213 else:
214 main.log.report( "Controller assignment failed" )
215
216 time.sleep(30) # waiting here to make sure topology converges across all nodes
217
218 main.step( "Balance devices across controllers" )
219 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700220 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700221 time.sleep( 5 )
222
223 topology_output = main.ONOScli1.topology()
224 topology_result = main.ONOSbench.getTopology( topology_output )
225 case2Result = ( switch_mastership and startStatus )
226 utilities.assert_equals(
227 expect=main.TRUE,
228 actual=case2Result,
229 onpass="Starting new Att topology test PASS",
230 onfail="Starting new Att topology test FAIL" )
231
232 def CASE21( self, main ):
233 """
234 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
235 """
236 import re
237 import time
238 import copy
239
240 main.newTopo = main.params['TOPO2']['topo']
241 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
242 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
243 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
244 main.pingTimeout = 300
245 main.log.report(
246 "Load Chordal topology and Balance all Mininet switches across controllers" )
247 main.log.report(
248 "________________________________________________________________________" )
249 main.case(
250 "Assign and Balance all Mininet switches across controllers" )
251
252 main.step( "Stop any previous Mininet network topology" )
253 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
254
GlennRCc6cd2a62015-08-10 16:08:22 -0700255 main.step("Start Mininet with Chordal topology")
256 mininetDir = main.Mininet1.home + "/custom/"
257 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
258 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
259 topoPath = mininetDir + main.newTopo
260 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700261
262 main.step( "Assign switches to controllers" )
263
264 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
265 main.Mininet1.assignSwController(
266 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700267 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700268
269 switch_mastership = main.TRUE
270 for i in range( 1, ( main.numMNswitches + 1 ) ):
271 response = main.Mininet1.getSwController( "s" + str( i ) )
272 print( "Response is " + str( response ) )
273 if re.search( "tcp:" + main.onosIPs[0], response ):
274 switch_mastership = switch_mastership and main.TRUE
275 else:
276 switch_mastership = main.FALSE
277
278 if switch_mastership == main.TRUE:
279 main.log.report( "Controller assignment successfull" )
280 else:
281 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700282
Hari Krishnac195f3b2015-07-08 20:02:24 -0700283 main.step( "Balance devices across controllers" )
284 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700285 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700286 time.sleep( 5 )
287
GlennRCbddd58f2015-10-01 15:45:25 -0700288 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700289 time.sleep(30)
290 utilities.assert_equals(
291 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700292 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293 onpass="Starting new Chordal topology test PASS",
294 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700295
Hari Krishnac195f3b2015-07-08 20:02:24 -0700296 def CASE22( self, main ):
297 """
298 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
299 """
300 import re
301 import time
302 import copy
303
304 main.newTopo = main.params['TOPO3']['topo']
305 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
306 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
307 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
308 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700309
Hari Krishnac195f3b2015-07-08 20:02:24 -0700310 main.log.report(
311 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
312 main.log.report(
313 "________________________________________________________________________" )
314 main.case(
315 "Assign and Balance all Mininet switches across controllers" )
316 main.step( "Stop any previous Mininet network topology" )
317 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700318
319 main.step("Start Mininet with Spine topology")
320 mininetDir = main.Mininet1.home + "/custom/"
321 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
322 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
323 topoPath = mininetDir + main.newTopo
324 startStatus = main.Mininet1.startNet(topoFile = topoPath)
325
Hari Krishnac195f3b2015-07-08 20:02:24 -0700326 time.sleep(60)
327 main.step( "Assign switches to controllers" )
328
329 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
330 main.Mininet1.assignSwController(
331 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700332 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700333
334 switch_mastership = main.TRUE
335 for i in range( 1, ( main.numMNswitches + 1 ) ):
336 response = main.Mininet1.getSwController( "s" + str( i ) )
337 print( "Response is " + str( response ) )
338 if re.search( "tcp:" + main.onosIPs[0], response ):
339 switch_mastership = switch_mastership and main.TRUE
340 else:
341 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700342
Hari Krishnac195f3b2015-07-08 20:02:24 -0700343 if switch_mastership == main.TRUE:
344 main.log.report( "Controller assignment successfull" )
345 else:
346 main.log.report( "Controller assignment failed" )
347 time.sleep( 5 )
348
349 main.step( "Balance devices across controllers" )
350 for i in range( int( main.numCtrls ) ):
351 balanceResult = main.ONOScli1.balanceMasters()
352 # giving some breathing time for ONOS to complete re-balance
353 time.sleep( 3 )
354
GlennRCbddd58f2015-10-01 15:45:25 -0700355 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700356 time.sleep(60)
357 utilities.assert_equals(
358 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700359 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700360 onpass="Starting new Spine topology test PASS",
361 onfail="Starting new Spine topology test FAIL" )
362
363 def CASE3( self, main ):
364 """
365 This Test case will be extended to collect and store more data related
366 ONOS state.
367 """
368 import re
369 import copy
370 main.deviceDPIDs = []
371 main.hostMACs = []
372 main.deviceLinks = []
373 main.deviceActiveLinksCount = []
374 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700375
Hari Krishnac195f3b2015-07-08 20:02:24 -0700376 main.log.report(
377 "Collect and Store topology details from ONOS before running any Tests" )
378 main.log.report(
379 "____________________________________________________________________" )
380 main.case( "Collect and Store Topology Details from ONOS" )
381 main.step( "Collect and store current number of switches and links" )
382 topology_output = main.ONOScli1.topology()
383 topology_result = main.ONOSbench.getTopology( topology_output )
384 numOnosDevices = topology_result[ 'devices' ]
385 numOnosLinks = topology_result[ 'links' ]
386 topoResult = main.TRUE
387
388 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
389 main.step( "Store Device DPIDs" )
390 for i in range( 1, (main.numMNswitches+1) ):
391 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
392 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
393
394 main.step( "Store Host MACs" )
395 for i in range( 1, ( main.numMNhosts + 1 ) ):
396 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
397 print "Host MACs in Store: \n", str( main.hostMACs )
398 main.MACsDict = {}
399 print "Creating dictionary of DPID and HostMacs"
400 for i in range(len(main.hostMACs)):
401 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
402 print main.MACsDict
403 main.step( "Collect and store all Devices Links" )
404 linksResult = main.ONOScli1.links( jsonFormat=False )
405 ansi_escape = re.compile( r'\x1b[^m]*m' )
406 linksResult = ansi_escape.sub( '', linksResult )
407 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
408 linksResult = linksResult.splitlines()
409 main.deviceLinks = copy.copy( linksResult )
410 print "Device Links Stored: \n", str( main.deviceLinks )
411 # this will be asserted to check with the params provided count of
412 # links
413 print "Length of Links Store", len( main.deviceLinks )
414
415 main.step( "Collect and store each Device ports enabled Count" )
416 time1 = time.time()
417 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
418 pool = []
419 for cli in main.CLIs:
420 if i >= main.numMNswitches + 1:
421 break
422 dpid = "of:00000000000000" + format( i,'02x' )
423 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
424 t.start()
425 pool.append(t)
426 i = i + 1
427 main.threadID = main.threadID + 1
428 for thread in pool:
429 thread.join()
430 portResult = thread.result
431 main.devicePortsEnabledCount.append( portResult )
432 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
433 time2 = time.time()
434 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
435
436 main.step( "Collect and store each Device active links Count" )
437 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700438
Hari Krishnac195f3b2015-07-08 20:02:24 -0700439 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
440 pool = []
441 for cli in main.CLIs:
442 if i >= main.numMNswitches + 1:
443 break
444 dpid = "of:00000000000000" + format( i,'02x' )
445 t = main.Thread( target = cli.getDeviceLinksActiveCount,
446 threadID = main.threadID,
447 name = "getDevicePortsEnabledCount",
448 args = [dpid])
449 t.start()
450 pool.append(t)
451 i = i + 1
452 main.threadID = main.threadID + 1
453 for thread in pool:
454 thread.join()
455 linkCountResult = thread.result
456 main.deviceActiveLinksCount.append( linkCountResult )
457 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
458 time2 = time.time()
459 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
460
461 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700462 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700463 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
464 main.log.info("Devices (actual): %s, Links (actual): %s" %
465 ( numOnosDevices , numOnosLinks ) )
466 main.log.info("Topology does not match, exiting CHO test...")
467 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700468 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700469 main.cleanup()
470 main.exit()
471
472 # just returning TRUE for now as this one just collects data
473 case3Result = topoResult
474 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
475 onpass="Saving ONOS topology data test PASS",
476 onfail="Saving ONOS topology data test FAIL" )
477
478 def CASE40( self, main ):
479 """
480 Verify Reactive forwarding (Att Topology)
481 """
482 import re
483 import copy
484 import time
485 main.log.report( "Verify Reactive forwarding (Att Topology)" )
486 main.log.report( "______________________________________________" )
487 main.case( "Enable Reactive forwarding and Verify ping all" )
488 main.step( "Enable Reactive forwarding" )
489 installResult = main.TRUE
490 # Activate fwd app
491 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
492 appCheck = main.TRUE
493 pool = []
494 for cli in main.CLIs:
495 t = main.Thread( target=cli.appToIDCheck,
496 name="appToIDCheck-" + str( i ),
497 args=[] )
498 pool.append( t )
499 t.start()
500 for t in pool:
501 t.join()
502 appCheck = appCheck and t.result
503 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
504 onpass="App Ids seem to be correct",
505 onfail="Something is wrong with app Ids" )
506 if appCheck != main.TRUE:
507 main.log.warn( main.CLIs[0].apps() )
508 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700509
Hari Krishnac195f3b2015-07-08 20:02:24 -0700510 time.sleep( 10 )
511
512 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700513 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700514 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700515 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
516 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700517 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700518 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700519 time2 = time.time()
520 timeDiff = round( ( time2 - time1 ), 2 )
521 main.log.report(
522 "Time taken for Ping All: " +
523 str( timeDiff ) +
524 " seconds" )
525
GlennRC626ba132015-09-18 16:16:31 -0700526 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700527 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700528 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700529 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700530
GlennRCbddd58f2015-10-01 15:45:25 -0700531 caseResult = appCheck and pingResult
532 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700533 onpass="Reactive Mode IPv4 Pingall test PASS",
534 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700535
536 def CASE41( self, main ):
537 """
538 Verify Reactive forwarding (Chordal Topology)
539 """
540 import re
541 import copy
542 import time
543 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
544 main.log.report( "______________________________________________" )
545 main.case( "Enable Reactive forwarding and Verify ping all" )
546 main.step( "Enable Reactive forwarding" )
547 installResult = main.TRUE
548 # Activate fwd app
549 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
550
551 appCheck = main.TRUE
552 pool = []
553 for cli in main.CLIs:
554 t = main.Thread( target=cli.appToIDCheck,
555 name="appToIDCheck-" + str( i ),
556 args=[] )
557 pool.append( t )
558 t.start()
559 for t in pool:
560 t.join()
561 appCheck = appCheck and t.result
562 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
563 onpass="App Ids seem to be correct",
564 onfail="Something is wrong with app Ids" )
565 if appCheck != main.TRUE:
566 main.log.warn( main.CLIs[0].apps() )
567 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700568
Hari Krishnac195f3b2015-07-08 20:02:24 -0700569 time.sleep( 10 )
570
571 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700572 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700573 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700574 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
575 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700576 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700577 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700578 time2 = time.time()
579 timeDiff = round( ( time2 - time1 ), 2 )
580 main.log.report(
581 "Time taken for Ping All: " +
582 str( timeDiff ) +
583 " seconds" )
584
GlennRC626ba132015-09-18 16:16:31 -0700585 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700586 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700587 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700588 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700589
GlennRCbddd58f2015-10-01 15:45:25 -0700590 caseResult = appCheck and pingResult
591 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700592 onpass="Reactive Mode IPv4 Pingall test PASS",
593 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700594
595 def CASE42( self, main ):
596 """
597 Verify Reactive forwarding (Spine Topology)
598 """
599 import re
600 import copy
601 import time
602 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
603 main.log.report( "______________________________________________" )
604 main.case( "Enable Reactive forwarding and Verify ping all" )
605 main.step( "Enable Reactive forwarding" )
606 installResult = main.TRUE
607 # Activate fwd app
608 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
609
610 appCheck = main.TRUE
611 pool = []
612 for cli in main.CLIs:
613 t = main.Thread( target=cli.appToIDCheck,
614 name="appToIDCheck-" + str( i ),
615 args=[] )
616 pool.append( t )
617 t.start()
618 for t in pool:
619 t.join()
620 appCheck = appCheck and t.result
621 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
622 onpass="App Ids seem to be correct",
623 onfail="Something is wrong with app Ids" )
624 if appCheck != main.TRUE:
625 main.log.warn( main.CLIs[0].apps() )
626 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700627
Hari Krishnac195f3b2015-07-08 20:02:24 -0700628 time.sleep( 10 )
629
630 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700631 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700632 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700633 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
634 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700635 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700636 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700637 time2 = time.time()
638 timeDiff = round( ( time2 - time1 ), 2 )
639 main.log.report(
640 "Time taken for Ping All: " +
641 str( timeDiff ) +
642 " seconds" )
643
GlennRC626ba132015-09-18 16:16:31 -0700644 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700645 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700646 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700647 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
648
GlennRCbddd58f2015-10-01 15:45:25 -0700649 caseResult = appCheck and pingResult
650 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700651 onpass="Reactive Mode IPv4 Pingall test PASS",
652 onfail="Reactive Mode IPv4 Pingall test FAIL" )
653
654 def CASE140( self, main ):
655 """
656 Verify IPv6 Reactive forwarding (Att Topology)
657 """
658 import re
659 import copy
660 import time
661 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
662 main.log.report( "______________________________________________" )
663 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
664 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
665
666 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
667 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
668 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
669 cfgResult = cfgResult1 and cfgResult2
670 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
671 onpass="Reactive mode ipv6Fowarding cfg is set to true",
672 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
673
674 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700675 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700676 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700677 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
678 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700679 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700680 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700681 time2 = time.time()
682 timeDiff = round( ( time2 - time1 ), 2 )
683 main.log.report(
684 "Time taken for IPv6 Ping All: " +
685 str( timeDiff ) +
686 " seconds" )
687
GlennRC626ba132015-09-18 16:16:31 -0700688 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700689 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
690 else:
691 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700692
693 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700694
Hari Krishnac195f3b2015-07-08 20:02:24 -0700695 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700696 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700697 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
698 pool = []
699 for cli in main.CLIs:
700 t = main.Thread( target=cli.appToIDCheck,
701 name="appToIDCheck-" + str( i ),
702 args=[] )
703 pool.append( t )
704 t.start()
705
706 for t in pool:
707 t.join()
708 appCheck = appCheck and t.result
709 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
710 onpass="App Ids seem to be correct",
711 onfail="Something is wrong with app Ids" )
712 if appCheck != main.TRUE:
713 main.log.warn( main.CLIs[0].apps() )
714 main.log.warn( main.CLIs[0].appIDs() )
715
716 # Waiting for reative flows to be cleared.
717 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700718 caseResult = appCheck and cfgResult and pingResult
719 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700720 onpass="Reactive Mode IPv6 Pingall test PASS",
721 onfail="Reactive Mode IPv6 Pingall test FAIL" )
722
723 def CASE141( self, main ):
724 """
725 Verify IPv6 Reactive forwarding (Chordal Topology)
726 """
727 import re
728 import copy
729 import time
730 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
731 main.log.report( "______________________________________________" )
732 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
733 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
734
735 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
736 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
737 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
738 cfgResult = cfgResult1 and cfgResult2
739 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
740 onpass="Reactive mode ipv6Fowarding cfg is set to true",
741 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
742
743 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700744 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700745 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700746 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
747 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700748 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700749 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700750 time2 = time.time()
751 timeDiff = round( ( time2 - time1 ), 2 )
752 main.log.report(
753 "Time taken for IPv6 Ping All: " +
754 str( timeDiff ) +
755 " seconds" )
756
GlennRC626ba132015-09-18 16:16:31 -0700757 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700758 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
759 else:
760 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
761
762 main.step( "Disable Reactive forwarding" )
763
764 main.log.info( "Uninstall reactive forwarding app" )
765 appCheck = main.TRUE
766 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
767 pool = []
768 for cli in main.CLIs:
769 t = main.Thread( target=cli.appToIDCheck,
770 name="appToIDCheck-" + str( i ),
771 args=[] )
772 pool.append( t )
773 t.start()
774
775 for t in pool:
776 t.join()
777 appCheck = appCheck and t.result
778 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
779 onpass="App Ids seem to be correct",
780 onfail="Something is wrong with app Ids" )
781 if appCheck != main.TRUE:
782 main.log.warn( main.CLIs[0].apps() )
783 main.log.warn( main.CLIs[0].appIDs() )
784
785 # Waiting for reative flows to be cleared.
786 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700787 caseResult = appCheck and cfgResult and pingResult
788 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700789 onpass="Reactive Mode IPv6 Pingall test PASS",
790 onfail="Reactive Mode IPv6 Pingall test FAIL" )
791
792 def CASE142( self, main ):
793 """
794 Verify IPv6 Reactive forwarding (Spine Topology)
795 """
796 import re
797 import copy
798 import time
799 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
800 main.log.report( "______________________________________________" )
801 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
802 # Spine topology do not have hosts h1-h10
803 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
804 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
805 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
806 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
807 cfgResult = cfgResult1 and cfgResult2
808 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
809 onpass="Reactive mode ipv6Fowarding cfg is set to true",
810 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
811
812 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700813 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700814 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -0700815 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
816 if not ping_result:
817 main.log.warn("First pingall failed. Trying again...")
818 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700819 time2 = time.time()
820 timeDiff = round( ( time2 - time1 ), 2 )
821 main.log.report(
822 "Time taken for IPv6 Ping All: " +
823 str( timeDiff ) +
824 " seconds" )
825
GlennRC626ba132015-09-18 16:16:31 -0700826 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700827 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
828 else:
829 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
830
831 main.step( "Disable Reactive forwarding" )
832
833 main.log.info( "Uninstall reactive forwarding app" )
834 appCheck = main.TRUE
835 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
836 pool = []
837 for cli in main.CLIs:
838 t = main.Thread( target=cli.appToIDCheck,
839 name="appToIDCheck-" + str( i ),
840 args=[] )
841 pool.append( t )
842 t.start()
843
844 for t in pool:
845 t.join()
846 appCheck = appCheck and t.result
847 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
848 onpass="App Ids seem to be correct",
849 onfail="Something is wrong with app Ids" )
850 if appCheck != main.TRUE:
851 main.log.warn( main.CLIs[0].apps() )
852 main.log.warn( main.CLIs[0].appIDs() )
853
854 # Waiting for reative flows to be cleared.
855 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700856 caseResult = appCheck and cfgResult and pingResult
857 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700858 onpass="Reactive Mode IPv6 Pingall test PASS",
859 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700860
861 def CASE5( self, main ):
862 """
863 Compare current ONOS topology with reference data
864 """
865 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700866
Hari Krishnac195f3b2015-07-08 20:02:24 -0700867 devicesDPIDTemp = []
868 hostMACsTemp = []
869 deviceLinksTemp = []
870 deviceActiveLinksCountTemp = []
871 devicePortsEnabledCountTemp = []
872
873 main.log.report(
874 "Compare ONOS topology with reference data in Stores" )
875 main.log.report( "__________________________________________________" )
876 main.case( "Compare ONOS topology with reference data" )
877
878 main.step( "Compare current Device ports enabled with reference" )
879 time1 = time.time()
880 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
881 pool = []
882 for cli in main.CLIs:
883 if i >= main.numMNswitches + 1:
884 break
885 dpid = "of:00000000000000" + format( i,'02x' )
886 t = main.Thread(target = cli.getDevicePortsEnabledCount,
887 threadID = main.threadID,
888 name = "getDevicePortsEnabledCount",
889 args = [dpid])
890 t.start()
891 pool.append(t)
892 i = i + 1
893 main.threadID = main.threadID + 1
894 for thread in pool:
895 thread.join()
896 portResult = thread.result
897 #portTemp = re.split( r'\t+', portResult )
898 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
899 devicePortsEnabledCountTemp.append( portResult )
900
901 time2 = time.time()
902 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
903 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700904 "Device Enabled ports EXPECTED: %s" %
905 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700906 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700907 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700908 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700909
Hari Krishnac195f3b2015-07-08 20:02:24 -0700910 if ( cmp( main.devicePortsEnabledCount,
911 devicePortsEnabledCountTemp ) == 0 ):
912 stepResult1 = main.TRUE
913 else:
914 stepResult1 = main.FALSE
915
916 main.step( "Compare Device active links with reference" )
917 time1 = time.time()
918 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
919 pool = []
920 for cli in main.CLIs:
921 if i >= main.numMNswitches + 1:
922 break
923 dpid = "of:00000000000000" + format( i,'02x' )
924 t = main.Thread(target = cli.getDeviceLinksActiveCount,
925 threadID = main.threadID,
926 name = "getDeviceLinksActiveCount",
927 args = [dpid])
928 t.start()
929 pool.append(t)
930 i = i + 1
931 main.threadID = main.threadID + 1
932 for thread in pool:
933 thread.join()
934 linkCountResult = thread.result
935 #linkCountTemp = re.split( r'\t+', linkCountResult )
936 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
937 deviceActiveLinksCountTemp.append( linkCountResult )
938
939 time2 = time.time()
940 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
941 main.log.info (
942 "Device Active links EXPECTED: %s" %
943 str( main.deviceActiveLinksCount ) )
944 main.log.info (
945 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
946 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
947 stepResult2 = main.TRUE
948 else:
949 stepResult2 = main.FALSE
950
951 """
952 place holder for comparing devices, hosts, paths and intents if required.
953 Links and ports data would be incorrect with out devices anyways.
954 """
955 case5Result = ( stepResult1 and stepResult2 )
956 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
957 onpass="Compare Topology test PASS",
958 onfail="Compare Topology test FAIL" )
959
960 def CASE60( self ):
961 """
962 Install 300 host intents and verify ping all (Att Topology)
963 """
964 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
965 main.log.report( "_______________________________________" )
966 import itertools
967 import time
968 main.case( "Install 300 host intents" )
969 main.step( "Add host Intents" )
970 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700971 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
972
Hari Krishnac195f3b2015-07-08 20:02:24 -0700973 intentIdList = []
974 time1 = time.time()
975 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
976 pool = []
977 for cli in main.CLIs:
978 if i >= len( hostCombos ):
979 break
980 t = main.Thread( target=cli.addHostIntent,
981 threadID=main.threadID,
982 name="addHostIntent",
983 args=[hostCombos[i][0],hostCombos[i][1]])
984 pool.append(t)
985 t.start()
986 i = i + 1
987 main.threadID = main.threadID + 1
988 for thread in pool:
989 thread.join()
990 intentIdList.append(thread.result)
991 time2 = time.time()
992 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
993
GlennRCfcfdc4f2015-09-30 16:01:57 -0700994 # Saving intent ids to check intents in later cases
995 main.intentIds = list(intentIdList)
996
GlennRCa8d786a2015-09-23 17:40:11 -0700997 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700998
GlennRCa8d786a2015-09-23 17:40:11 -0700999 # Giving onos 3 chances to install intents
1000 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07001001 if i != 0:
1002 main.log.warn( "Verification failed. Retrying..." )
1003 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001004 time.sleep( main.checkIntentsDelay )
1005
1006 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001007 for e in range(int(main.numCtrls)):
1008 main.log.info( "Checking intents on CLI %s" % (e+1) )
1009 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1010 intentState
1011 if not intentState:
1012 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001013 if intentState:
1014 break
GlennRCdb2c8422015-09-29 12:21:59 -07001015 else:
1016 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001017 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001018
GlennRCa8d786a2015-09-23 17:40:11 -07001019
1020 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1021 onpass="INTENTS INSTALLED",
1022 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001023
1024 main.step( "Verify Ping across all hosts" )
1025 pingResult = main.FALSE
1026 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001027 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1028 if not pingResult:
1029 main.log.warn("First pingall failed. Retrying...")
1030 time1 = time.time()
1031 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001032 time2 = time.time()
1033 timeDiff = round( ( time2 - time1 ), 2 )
1034 main.log.report(
1035 "Time taken for Ping All: " +
1036 str( timeDiff ) +
1037 " seconds" )
1038 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1039 onpass="PING ALL PASS",
1040 onfail="PING ALL FAIL" )
1041
GlennRCbddd58f2015-10-01 15:45:25 -07001042 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001043 utilities.assert_equals(
1044 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001045 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001046 onpass="Install 300 Host Intents and Ping All test PASS",
1047 onfail="Install 300 Host Intents and Ping All test FAIL" )
1048
GlennRCfcfdc4f2015-09-30 16:01:57 -07001049 if not intentState:
1050 main.log.debug( "Intents failed to install completely" )
1051 if not pingResult:
1052 main.log.debug( "Pingall failed" )
1053
GlennRCbddd58f2015-10-01 15:45:25 -07001054 if not caseResult and main.failSwitch:
1055 main.log.report("Stopping test")
1056 main.stop( email=main.emailOnStop )
1057
Hari Krishnac195f3b2015-07-08 20:02:24 -07001058 def CASE61( self ):
1059 """
1060 Install 600 host intents and verify ping all for Chordal Topology
1061 """
1062 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1063 main.log.report( "_______________________________________" )
1064 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001065
Hari Krishnac195f3b2015-07-08 20:02:24 -07001066 main.case( "Install 600 host intents" )
1067 main.step( "Add host Intents" )
1068 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001069 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1070
Hari Krishnac195f3b2015-07-08 20:02:24 -07001071 intentIdList = []
1072 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001073
Hari Krishnac195f3b2015-07-08 20:02:24 -07001074 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1075 pool = []
1076 for cli in main.CLIs:
1077 if i >= len( hostCombos ):
1078 break
1079 t = main.Thread( target=cli.addHostIntent,
1080 threadID=main.threadID,
1081 name="addHostIntent",
1082 args=[hostCombos[i][0],hostCombos[i][1]])
1083 pool.append(t)
1084 t.start()
1085 i = i + 1
1086 main.threadID = main.threadID + 1
1087 for thread in pool:
1088 thread.join()
1089 intentIdList.append(thread.result)
1090 time2 = time.time()
1091 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001092
GlennRCfcfdc4f2015-09-30 16:01:57 -07001093 # Saving intent ids to check intents in later cases
1094 main.intentIds = list(intentIdList)
1095
GlennRCa8d786a2015-09-23 17:40:11 -07001096 main.step("Verify intents are installed")
1097
1098 # Giving onos 3 chances to install intents
1099 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07001100 if i != 0:
1101 main.log.warn( "Verification failed. Retrying..." )
1102 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001103 time.sleep( main.checkIntentsDelay )
1104
1105 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001106 for e in range(int(main.numCtrls)):
1107 main.log.info( "Checking intents on CLI %s" % (e+1) )
1108 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1109 intentState
1110 if not intentState:
1111 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001112 if intentState:
1113 break
GlennRCdb2c8422015-09-29 12:21:59 -07001114 else:
1115 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001116 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001117
1118 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1119 onpass="INTENTS INSTALLED",
1120 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001121
1122 main.step( "Verify Ping across all hosts" )
1123 pingResult = main.FALSE
1124 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001125 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1126 if not pingResult:
1127 main.log.warn("First pingall failed. Retrying...")
1128 time1 = time.time()
1129 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001130 time2 = time.time()
1131 timeDiff = round( ( time2 - time1 ), 2 )
1132 main.log.report(
1133 "Time taken for Ping All: " +
1134 str( timeDiff ) +
1135 " seconds" )
1136 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1137 onpass="PING ALL PASS",
1138 onfail="PING ALL FAIL" )
1139
GlennRCbddd58f2015-10-01 15:45:25 -07001140 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001141
Hari Krishnac195f3b2015-07-08 20:02:24 -07001142 utilities.assert_equals(
1143 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001144 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001145 onpass="Install 300 Host Intents and Ping All test PASS",
1146 onfail="Install 300 Host Intents and Ping All test FAIL" )
1147
GlennRCfcfdc4f2015-09-30 16:01:57 -07001148 if not intentState:
1149 main.log.debug( "Intents failed to install completely" )
1150 if not pingResult:
1151 main.log.debug( "Pingall failed" )
1152
GlennRCbddd58f2015-10-01 15:45:25 -07001153 if not caseResult and main.failSwitch:
1154 main.log.report("Stopping test")
1155 main.stop( email=main.emailOnStop )
1156
Hari Krishnac195f3b2015-07-08 20:02:24 -07001157 def CASE62( self ):
1158 """
1159 Install 2278 host intents and verify ping all for Spine Topology
1160 """
1161 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1162 main.log.report( "_______________________________________" )
1163 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001164
Hari Krishnac195f3b2015-07-08 20:02:24 -07001165 main.case( "Install 2278 host intents" )
1166 main.step( "Add host Intents" )
1167 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001168 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001169 main.pingTimeout = 300
1170 intentIdList = []
1171 time1 = time.time()
1172 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1173 pool = []
1174 for cli in main.CLIs:
1175 if i >= len( hostCombos ):
1176 break
1177 t = main.Thread( target=cli.addHostIntent,
1178 threadID=main.threadID,
1179 name="addHostIntent",
1180 args=[hostCombos[i][0],hostCombos[i][1]])
1181 pool.append(t)
1182 t.start()
1183 i = i + 1
1184 main.threadID = main.threadID + 1
1185 for thread in pool:
1186 thread.join()
1187 intentIdList.append(thread.result)
1188 time2 = time.time()
1189 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001190
GlennRCfcfdc4f2015-09-30 16:01:57 -07001191 # Saving intent ids to check intents in later cases
1192 main.intentIds = list(intentIdList)
1193
GlennRCa8d786a2015-09-23 17:40:11 -07001194 main.step("Verify intents are installed")
1195
GlennRCdb2c8422015-09-29 12:21:59 -07001196 # Giving onos 3 chances to install intents
1197 for i in range(3):
1198 if i != 0:
1199 main.log.warn( "Verification failed. Retrying..." )
1200 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001201 time.sleep( main.checkIntentsDelay )
1202
1203 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001204 for e in range(int(main.numCtrls)):
1205 main.log.info( "Checking intents on CLI %s" % (e+1) )
1206 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1207 intentState
1208 if not intentState:
1209 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001210 if intentState:
1211 break
GlennRCdb2c8422015-09-29 12:21:59 -07001212 else:
1213 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001214 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001215
1216 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1217 onpass="INTENTS INSTALLED",
1218 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001219
1220 main.step( "Verify Ping across all hosts" )
1221 pingResult = main.FALSE
1222 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001223 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1224 if not pingResult:
1225 main.log.warn("First pingall failed. Retrying...")
1226 time1 = time.time()
1227 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001228 time2 = time.time()
1229 timeDiff = round( ( time2 - time1 ), 2 )
1230 main.log.report(
1231 "Time taken for Ping All: " +
1232 str( timeDiff ) +
1233 " seconds" )
1234 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1235 onpass="PING ALL PASS",
1236 onfail="PING ALL FAIL" )
1237
GlennRCbddd58f2015-10-01 15:45:25 -07001238 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001239
Hari Krishnac195f3b2015-07-08 20:02:24 -07001240 utilities.assert_equals(
1241 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001242 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001243 onpass="Install 2278 Host Intents and Ping All test PASS",
1244 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1245
GlennRCfcfdc4f2015-09-30 16:01:57 -07001246 if not intentState:
1247 main.log.debug( "Intents failed to install completely" )
1248 if not pingResult:
1249 main.log.debug( "Pingall failed" )
1250
GlennRCbddd58f2015-10-01 15:45:25 -07001251 if not caseResult and main.failSwitch:
1252 main.log.report("Stopping test")
1253 main.stop( email=main.emailOnStop )
1254
Hari Krishna4223dbd2015-08-13 16:29:53 -07001255 def CASE160( self ):
1256 """
1257 Verify IPv6 ping across 300 host intents (Att Topology)
1258 """
1259 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1260 main.log.report( "_________________________________________________" )
1261 import itertools
1262 import time
1263 main.case( "IPv6 ping all 300 host intents" )
1264 main.step( "Verify IPv6 Ping across all hosts" )
1265 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1266 pingResult = main.FALSE
1267 time1 = time.time()
1268 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001269 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001270 main.log.warn("First pingall failed. Retrying...")
1271 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001272 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001273 time2 = time.time()
1274 timeDiff = round( ( time2 - time1 ), 2 )
1275 main.log.report(
1276 "Time taken for IPv6 Ping All: " +
1277 str( timeDiff ) +
1278 " seconds" )
1279 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1280 onpass="PING ALL PASS",
1281 onfail="PING ALL FAIL" )
1282
GlennRCbddd58f2015-10-01 15:45:25 -07001283 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001284 utilities.assert_equals(
1285 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001286 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001287 onpass="IPv6 Ping across 300 host intents test PASS",
1288 onfail="IPv6 Ping across 300 host intents test FAIL" )
1289
1290 def CASE161( self ):
1291 """
1292 Verify IPv6 ping across 600 host intents (Chordal Topology)
1293 """
1294 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1295 main.log.report( "_________________________________________________" )
1296 import itertools
1297 import time
1298 main.case( "IPv6 ping all 600 host intents" )
1299 main.step( "Verify IPv6 Ping across all hosts" )
1300 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1301 pingResult = main.FALSE
1302 time1 = time.time()
1303 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001304 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001305 main.log.warn("First pingall failed. Retrying...")
1306 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001307 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001308
Hari Krishna4223dbd2015-08-13 16:29:53 -07001309 time2 = time.time()
1310 timeDiff = round( ( time2 - time1 ), 2 )
1311 main.log.report(
1312 "Time taken for IPv6 Ping All: " +
1313 str( timeDiff ) +
1314 " seconds" )
1315 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1316 onpass="PING ALL PASS",
1317 onfail="PING ALL FAIL" )
1318
GlennRCbddd58f2015-10-01 15:45:25 -07001319 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001320 utilities.assert_equals(
1321 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001322 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001323 onpass="IPv6 Ping across 600 host intents test PASS",
1324 onfail="IPv6 Ping across 600 host intents test FAIL" )
1325
1326 def CASE162( self ):
1327 """
1328 Verify IPv6 ping across 2278 host intents (Spine Topology)
1329 """
1330 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1331 main.log.report( "_________________________________________________" )
1332 import itertools
1333 import time
1334 main.case( "IPv6 ping all 600 host intents" )
1335 main.step( "Verify IPv6 Ping across all hosts" )
1336 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
1337 pingResult = main.FALSE
1338 time1 = time.time()
1339 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
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()
GlennRC626ba132015-09-18 16:16:31 -07001343 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001344
Hari Krishna4223dbd2015-08-13 16:29:53 -07001345 time2 = time.time()
1346 timeDiff = round( ( time2 - time1 ), 2 )
1347 main.log.report(
1348 "Time taken for IPv6 Ping All: " +
1349 str( timeDiff ) +
1350 " seconds" )
1351 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1352 onpass="PING ALL PASS",
1353 onfail="PING ALL FAIL" )
1354
GlennRCbddd58f2015-10-01 15:45:25 -07001355 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001356 utilities.assert_equals(
1357 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001358 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001359 onpass="IPv6 Ping across 600 host intents test PASS",
1360 onfail="IPv6 Ping across 600 host intents test FAIL" )
1361
Hari Krishnac195f3b2015-07-08 20:02:24 -07001362 def CASE70( self, main ):
1363 """
1364 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1365 """
1366 import random
1367 main.randomLink1 = []
1368 main.randomLink2 = []
1369 main.randomLink3 = []
1370 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1371 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1372 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1373 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1374 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1375 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1376 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1377 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1378
1379 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1380 main.log.report( "___________________________________________________________________________" )
1381 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1382 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1383 if ( int( switchLinksToToggle ) ==
1384 0 or int( switchLinksToToggle ) > 5 ):
1385 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1386 #main.cleanup()
1387 #main.exit()
1388 else:
1389 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1390
1391 main.step( "Cut links on Core devices using user provided range" )
1392 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1393 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1394 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1395 for i in range( int( switchLinksToToggle ) ):
1396 main.Mininet1.link(
1397 END1=link1End1,
1398 END2=main.randomLink1[ i ],
1399 OPTION="down" )
1400 time.sleep( link_sleep )
1401 main.Mininet1.link(
1402 END1=link2End1,
1403 END2=main.randomLink2[ i ],
1404 OPTION="down" )
1405 time.sleep( link_sleep )
1406 main.Mininet1.link(
1407 END1=link3End1,
1408 END2=main.randomLink3[ i ],
1409 OPTION="down" )
1410 time.sleep( link_sleep )
1411
Hari Krishna6185fc12015-07-13 15:42:31 -07001412 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001413 linkDown = main.ONOSbench.checkStatus(
1414 topology_output, main.numMNswitches, str(
1415 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1416 utilities.assert_equals(
1417 expect=main.TRUE,
1418 actual=linkDown,
1419 onpass="Link Down discovered properly",
1420 onfail="Link down was not discovered in " +
1421 str( link_sleep ) +
1422 " seconds" )
1423
GlennRCfcfdc4f2015-09-30 16:01:57 -07001424 main.step("Verify intents are installed")
1425 # Checking a maximum of 3
1426 for i in range(3):
1427 if i != 0:
1428 main.log.warn( "Verification failed. Retrying..." )
1429 main.log.info("Giving onos some time...")
1430 time.sleep( main.checkIntentsDelay )
1431
1432 intentState = main.TRUE
1433 for e in range(int(main.numCtrls)):
1434 main.log.info( "Checking intents on CLI %s" % (e+1) )
1435 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1436 intentState
1437 if not intentState:
1438 main.log.warn( "Not all intents installed" )
1439 if intentState:
1440 break
1441 else:
1442 #Dumping intent summary
1443 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1444
1445
1446 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1447 onpass="INTENTS INSTALLED",
1448 onfail="SOME INTENTS NOT INSTALLED" )
1449
Hari Krishnac195f3b2015-07-08 20:02:24 -07001450 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001451 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001452 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001453 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1454 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001455 main.log.warn("First pingall failed. Retrying...")
1456 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001457 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001458
Hari Krishnac195f3b2015-07-08 20:02:24 -07001459 time2 = time.time()
1460 timeDiff = round( ( time2 - time1 ), 2 )
1461 main.log.report(
1462 "Time taken for Ping All: " +
1463 str( timeDiff ) +
1464 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001465 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001466 onpass="PING ALL PASS",
1467 onfail="PING ALL FAIL" )
1468
GlennRCbddd58f2015-10-01 15:45:25 -07001469 caseResult = linkDown and pingResult and intentState
1470 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001471 onpass="Random Link cut Test PASS",
1472 onfail="Random Link cut Test FAIL" )
1473
GlennRCfcfdc4f2015-09-30 16:01:57 -07001474 # Printing what exactly failed
1475 if not linkDown:
1476 main.log.debug( "Link down was not discovered correctly" )
1477 if not pingResult:
1478 main.log.debug( "Pingall failed" )
1479 if not intentState:
1480 main.log.debug( "Intents are not all installed" )
1481
GlennRCbddd58f2015-10-01 15:45:25 -07001482 if not caseResult and main.failSwitch:
1483 main.log.report("Stopping test")
1484 main.stop( email=main.emailOnStop )
1485
Hari Krishnac195f3b2015-07-08 20:02:24 -07001486 def CASE80( self, main ):
1487 """
1488 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1489 """
1490 import random
1491 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1492 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1493 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1494 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1495 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1496
1497 main.log.report(
1498 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1499 main.log.report(
1500 "__________________________________________________________________" )
1501 main.case(
1502 "Host intents - Bring the core links up that are down and verify ping all" )
1503 main.step( "Bring randomly cut links on Core devices up" )
1504 for i in range( int( switchLinksToToggle ) ):
1505 main.Mininet1.link(
1506 END1=link1End1,
1507 END2=main.randomLink1[ i ],
1508 OPTION="up" )
1509 time.sleep( link_sleep )
1510 main.Mininet1.link(
1511 END1=link2End1,
1512 END2=main.randomLink2[ i ],
1513 OPTION="up" )
1514 time.sleep( link_sleep )
1515 main.Mininet1.link(
1516 END1=link3End1,
1517 END2=main.randomLink3[ i ],
1518 OPTION="up" )
1519 time.sleep( link_sleep )
1520
Hari Krishna6185fc12015-07-13 15:42:31 -07001521 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001522 linkUp = main.ONOSbench.checkStatus(
1523 topology_output,
1524 main.numMNswitches,
1525 str( main.numMNlinks ) )
1526 utilities.assert_equals(
1527 expect=main.TRUE,
1528 actual=linkUp,
1529 onpass="Link up discovered properly",
1530 onfail="Link up was not discovered in " +
1531 str( link_sleep ) +
1532 " seconds" )
1533
GlennRCfcfdc4f2015-09-30 16:01:57 -07001534 main.step("Verify intents are installed")
1535 # Checking a maximum of 3
1536 for i in range(3):
1537 if i != 0:
1538 main.log.warn( "Verification failed. Retrying..." )
1539 main.log.info("Giving onos some time...")
1540 time.sleep( main.checkIntentsDelay )
1541
1542 intentState = main.TRUE
1543 for e in range(int(main.numCtrls)):
1544 main.log.info( "Checking intents on CLI %s" % (e+1) )
1545 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1546 intentState
1547 if not intentState:
1548 main.log.warn( "Not all intents installed" )
1549 if intentState:
1550 break
1551 else:
1552 #Dumping intent summary
1553 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1554
1555
1556 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1557 onpass="INTENTS INSTALLED",
1558 onfail="SOME INTENTS NOT INSTALLED" )
1559
Hari Krishnac195f3b2015-07-08 20:02:24 -07001560 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001561 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001562 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001563 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1564 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001565 main.log.warn("First pingall failed. Retrying...")
1566 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001567 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001568
Hari Krishnac195f3b2015-07-08 20:02:24 -07001569 time2 = time.time()
1570 timeDiff = round( ( time2 - time1 ), 2 )
1571 main.log.report(
1572 "Time taken for Ping All: " +
1573 str( timeDiff ) +
1574 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001575 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001576 onpass="PING ALL PASS",
1577 onfail="PING ALL FAIL" )
1578
GlennRCbddd58f2015-10-01 15:45:25 -07001579 caseResult = linkUp and pingResult
1580 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001581 onpass="Link Up Test PASS",
1582 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001583 # Printing what exactly failed
1584 if not linkUp:
1585 main.log.debug( "Link down was not discovered correctly" )
1586 if not pingResult:
1587 main.log.debug( "Pingall failed" )
1588 if not intentState:
1589 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001590
GlennRCbddd58f2015-10-01 15:45:25 -07001591 if not caseResult and main.failSwitch:
1592 main.log.report("Stopping test")
1593 main.stop( email=main.emailOnStop )
1594
Hari Krishnac195f3b2015-07-08 20:02:24 -07001595 def CASE71( self, main ):
1596 """
1597 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1598 """
1599 import random
1600 main.randomLink1 = []
1601 main.randomLink2 = []
1602 main.randomLink3 = []
1603 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1604 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1605 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1606 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1607 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1608 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1609 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1610 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1611
1612 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1613 main.log.report( "___________________________________________________________________________" )
1614 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1615 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1616 if ( int( switchLinksToToggle ) ==
1617 0 or int( switchLinksToToggle ) > 5 ):
1618 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1619 #main.cleanup()
1620 #main.exit()
1621 else:
1622 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1623
1624 main.step( "Cut links on Core devices using user provided range" )
1625 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1626 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1627 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1628 for i in range( int( switchLinksToToggle ) ):
1629 main.Mininet1.link(
1630 END1=link1End1,
1631 END2=main.randomLink1[ i ],
1632 OPTION="down" )
1633 time.sleep( link_sleep )
1634 main.Mininet1.link(
1635 END1=link2End1,
1636 END2=main.randomLink2[ i ],
1637 OPTION="down" )
1638 time.sleep( link_sleep )
1639 main.Mininet1.link(
1640 END1=link3End1,
1641 END2=main.randomLink3[ i ],
1642 OPTION="down" )
1643 time.sleep( link_sleep )
1644
Hari Krishna6185fc12015-07-13 15:42:31 -07001645 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001646 linkDown = main.ONOSbench.checkStatus(
1647 topology_output, main.numMNswitches, str(
1648 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1649 utilities.assert_equals(
1650 expect=main.TRUE,
1651 actual=linkDown,
1652 onpass="Link Down discovered properly",
1653 onfail="Link down was not discovered in " +
1654 str( link_sleep ) +
1655 " seconds" )
1656
GlennRCfcfdc4f2015-09-30 16:01:57 -07001657 main.step("Verify intents are installed")
1658 # Checking a maximum of 3
1659 for i in range(3):
1660 if i != 0:
1661 main.log.warn( "Verification failed. Retrying..." )
1662 main.log.info("Giving onos some time...")
1663 time.sleep( main.checkIntentsDelay )
1664
1665 intentState = main.TRUE
1666 for e in range(int(main.numCtrls)):
1667 main.log.info( "Checking intents on CLI %s" % (e+1) )
1668 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1669 intentState
1670 if not intentState:
1671 main.log.warn( "Not all intents installed" )
1672 if intentState:
1673 break
1674 else:
1675 #Dumping intent summary
1676 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1677
1678
1679 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1680 onpass="INTENTS INSTALLED",
1681 onfail="SOME INTENTS NOT INSTALLED" )
1682
Hari Krishnac195f3b2015-07-08 20:02:24 -07001683 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001684 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001685 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001686 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1687 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001688 main.log.warn("First pingall failed. Retrying...")
1689 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001690 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001691
Hari Krishnac195f3b2015-07-08 20:02:24 -07001692 time2 = time.time()
1693 timeDiff = round( ( time2 - time1 ), 2 )
1694 main.log.report(
1695 "Time taken for Ping All: " +
1696 str( timeDiff ) +
1697 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001698 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001699 onpass="PING ALL PASS",
1700 onfail="PING ALL FAIL" )
1701
GlennRCbddd58f2015-10-01 15:45:25 -07001702 caseResult = linkDown and pingResult and intentState
1703 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001704 onpass="Random Link cut Test PASS",
1705 onfail="Random Link cut Test FAIL" )
1706
GlennRCfcfdc4f2015-09-30 16:01:57 -07001707 # Printing what exactly failed
1708 if not linkDown:
1709 main.log.debug( "Link down was not discovered correctly" )
1710 if not pingResult:
1711 main.log.debug( "Pingall failed" )
1712 if not intentState:
1713 main.log.debug( "Intents are not all installed" )
1714
GlennRCbddd58f2015-10-01 15:45:25 -07001715 if not caseResult and main.failSwitch:
1716 main.log.report("Stopping test")
1717 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001718
Hari Krishnac195f3b2015-07-08 20:02:24 -07001719 def CASE81( self, main ):
1720 """
1721 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1722 """
1723 import random
1724 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1725 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1726 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1727 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1728 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1729
1730 main.log.report(
1731 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1732 main.log.report(
1733 "__________________________________________________________________" )
1734 main.case(
1735 "Point intents - Bring the core links up that are down and verify ping all" )
1736 main.step( "Bring randomly cut links on Core devices up" )
1737 for i in range( int( switchLinksToToggle ) ):
1738 main.Mininet1.link(
1739 END1=link1End1,
1740 END2=main.randomLink1[ i ],
1741 OPTION="up" )
1742 time.sleep( link_sleep )
1743 main.Mininet1.link(
1744 END1=link2End1,
1745 END2=main.randomLink2[ i ],
1746 OPTION="up" )
1747 time.sleep( link_sleep )
1748 main.Mininet1.link(
1749 END1=link3End1,
1750 END2=main.randomLink3[ i ],
1751 OPTION="up" )
1752 time.sleep( link_sleep )
1753
Hari Krishna6185fc12015-07-13 15:42:31 -07001754 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001755 linkUp = main.ONOSbench.checkStatus(
1756 topology_output,
1757 main.numMNswitches,
1758 str( main.numMNlinks ) )
1759 utilities.assert_equals(
1760 expect=main.TRUE,
1761 actual=linkUp,
1762 onpass="Link up discovered properly",
1763 onfail="Link up was not discovered in " +
1764 str( link_sleep ) +
1765 " seconds" )
1766
GlennRCfcfdc4f2015-09-30 16:01:57 -07001767 main.step("Verify intents are installed")
1768 # Checking a maximum of 3
1769 for i in range(3):
1770 if i != 0:
1771 main.log.warn( "Verification failed. Retrying..." )
1772 main.log.info("Giving onos some time...")
1773 time.sleep( main.checkIntentsDelay )
1774
1775 intentState = main.TRUE
1776 for e in range(int(main.numCtrls)):
1777 main.log.info( "Checking intents on CLI %s" % (e+1) )
1778 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1779 intentState
1780 if not intentState:
1781 main.log.warn( "Not all intents installed" )
1782 if intentState:
1783 break
1784 else:
1785 #Dumping intent summary
1786 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1787
1788
1789 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1790 onpass="INTENTS INSTALLED",
1791 onfail="SOME INTENTS NOT INSTALLED" )
1792
Hari Krishnac195f3b2015-07-08 20:02:24 -07001793 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001794 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001795 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001796 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1797 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001798 main.log.warn("First pingall failed. Retrying...")
1799 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001800 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001801
Hari Krishnac195f3b2015-07-08 20:02:24 -07001802 time2 = time.time()
1803 timeDiff = round( ( time2 - time1 ), 2 )
1804 main.log.report(
1805 "Time taken for Ping All: " +
1806 str( timeDiff ) +
1807 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001808 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001809 onpass="PING ALL PASS",
1810 onfail="PING ALL FAIL" )
1811
GlennRCbddd58f2015-10-01 15:45:25 -07001812 caseResult = linkUp and pingResult
1813 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001814 onpass="Link Up Test PASS",
1815 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001816 # Printing what exactly failed
1817 if not linkUp:
1818 main.log.debug( "Link down was not discovered correctly" )
1819 if not pingResult:
1820 main.log.debug( "Pingall failed" )
1821 if not intentState:
1822 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001823
GlennRCbddd58f2015-10-01 15:45:25 -07001824 if not caseResult and main.failSwitch:
1825 main.log.report("Stopping test")
1826 main.stop( email=main.emailOnStop )
1827
Hari Krishnac195f3b2015-07-08 20:02:24 -07001828 def CASE72( self, main ):
1829 """
1830 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1831 """
1832 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001833 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001834 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001835
Hari Krishnac195f3b2015-07-08 20:02:24 -07001836 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1837 main.log.report( "___________________________________________________________________________" )
1838 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1839 switches = []
1840 switchesComb = []
1841 for i in range( main.numMNswitches ):
1842 switches.append('s%d'%(i+1))
1843 switchesLinksComb = list(itertools.combinations(switches,2))
1844 main.randomLinks = random.sample(switchesLinksComb, 5 )
1845 print main.randomLinks
1846 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001847
Hari Krishnac195f3b2015-07-08 20:02:24 -07001848 for switch in main.randomLinks:
1849 main.Mininet1.link(
1850 END1=switch[0],
1851 END2=switch[1],
1852 OPTION="down")
1853 time.sleep( link_sleep )
1854
Hari Krishna6185fc12015-07-13 15:42:31 -07001855 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001856 linkDown = main.ONOSbench.checkStatus(
1857 topology_output, main.numMNswitches, str(
1858 int( main.numMNlinks ) - 5 * 2 ) )
1859 utilities.assert_equals(
1860 expect=main.TRUE,
1861 actual=linkDown,
1862 onpass="Link Down discovered properly",
1863 onfail="Link down was not discovered in " +
1864 str( link_sleep ) +
1865 " seconds" )
1866
GlennRCfcfdc4f2015-09-30 16:01:57 -07001867 main.step("Verify intents are installed")
1868 # Checking a maximum of 3
1869 for i in range(3):
1870 if i != 0:
1871 main.log.warn( "Verification failed. Retrying..." )
1872 main.log.info("Giving onos some time...")
1873 time.sleep( main.checkIntentsDelay )
1874
1875 intentState = main.TRUE
1876 for e in range(int(main.numCtrls)):
1877 main.log.info( "Checking intents on CLI %s" % (e+1) )
1878 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1879 intentState
1880 if not intentState:
1881 main.log.warn( "Not all intents installed" )
1882 if intentState:
1883 break
1884 else:
1885 #Dumping intent summary
1886 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1887
1888
1889 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1890 onpass="INTENTS INSTALLED",
1891 onfail="SOME INTENTS NOT INSTALLED" )
1892
Hari Krishnac195f3b2015-07-08 20:02:24 -07001893 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001894 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001895 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001896 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1897 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001898 main.log.warn("First pingall failed. Retrying...")
1899 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001900 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001901
Hari Krishnac195f3b2015-07-08 20:02:24 -07001902 time2 = time.time()
1903 timeDiff = round( ( time2 - time1 ), 2 )
1904 main.log.report(
1905 "Time taken for Ping All: " +
1906 str( timeDiff ) +
1907 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001908 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001909 onpass="PING ALL PASS",
1910 onfail="PING ALL FAIL" )
1911
GlennRCbddd58f2015-10-01 15:45:25 -07001912 caseResult = linkDown and pingResult and intentState
1913 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001914 onpass="Random Link cut Test PASS",
1915 onfail="Random Link cut Test FAIL" )
1916
GlennRCfcfdc4f2015-09-30 16:01:57 -07001917 # Printing what exactly failed
1918 if not linkDown:
1919 main.log.debug( "Link down was not discovered correctly" )
1920 if not pingResult:
1921 main.log.debug( "Pingall failed" )
1922 if not intentState:
1923 main.log.debug( "Intents are not all installed" )
1924
GlennRCbddd58f2015-10-01 15:45:25 -07001925 if not caseResult and main.failSwitch:
1926 main.log.report("Stopping test")
1927 main.stop( email=main.emailOnStop )
1928
Hari Krishnac195f3b2015-07-08 20:02:24 -07001929 def CASE82( self, main ):
1930 """
1931 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1932 """
1933 import random
1934 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001935
Hari Krishnac195f3b2015-07-08 20:02:24 -07001936 main.log.report(
1937 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1938 main.log.report(
1939 "__________________________________________________________________" )
1940 main.case(
1941 "Host intents - Bring the core links up that are down and verify ping all" )
1942 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001943
Hari Krishnac195f3b2015-07-08 20:02:24 -07001944 for switch in main.randomLinks:
1945 main.Mininet1.link(
1946 END1=switch[0],
1947 END2=switch[1],
1948 OPTION="up")
1949 time.sleep( link_sleep )
1950
Hari Krishna6185fc12015-07-13 15:42:31 -07001951 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001952 linkUp = main.ONOSbench.checkStatus(
1953 topology_output,
1954 main.numMNswitches,
1955 str( main.numMNlinks ) )
1956 utilities.assert_equals(
1957 expect=main.TRUE,
1958 actual=linkUp,
1959 onpass="Link up discovered properly",
1960 onfail="Link up was not discovered in " +
1961 str( link_sleep ) +
1962 " seconds" )
1963
GlennRCfcfdc4f2015-09-30 16:01:57 -07001964 main.step("Verify intents are installed")
1965 # Checking a maximum of 3
1966 for i in range(3):
1967 if i != 0:
1968 main.log.warn( "Verification failed. Retrying..." )
1969 main.log.info("Giving onos some time...")
1970 time.sleep( main.checkIntentsDelay )
1971
1972 intentState = main.TRUE
1973 for e in range(int(main.numCtrls)):
1974 main.log.info( "Checking intents on CLI %s" % (e+1) )
1975 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1976 intentState
1977 if not intentState:
1978 main.log.warn( "Not all intents installed" )
1979 if intentState:
1980 break
1981 else:
1982 #Dumping intent summary
1983 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1984
1985
1986 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1987 onpass="INTENTS INSTALLED",
1988 onfail="SOME INTENTS NOT INSTALLED" )
1989
Hari Krishnac195f3b2015-07-08 20:02:24 -07001990 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001991 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001992 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001993 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1994 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001995 main.log.warn("First pingall failed. Retrying...")
1996 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001997 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001998
Hari Krishnac195f3b2015-07-08 20:02:24 -07001999 time2 = time.time()
2000 timeDiff = round( ( time2 - time1 ), 2 )
2001 main.log.report(
2002 "Time taken for Ping All: " +
2003 str( timeDiff ) +
2004 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002005 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002006 onpass="PING ALL PASS",
2007 onfail="PING ALL FAIL" )
2008
GlennRCbddd58f2015-10-01 15:45:25 -07002009 caseResult = linkUp and pingResult
2010 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002011 onpass="Link Up Test PASS",
2012 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002013 # Printing what exactly failed
2014 if not linkUp:
2015 main.log.debug( "Link down was not discovered correctly" )
2016 if not pingResult:
2017 main.log.debug( "Pingall failed" )
2018 if not intentState:
2019 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002020
GlennRCbddd58f2015-10-01 15:45:25 -07002021 if not caseResult and main.failSwitch:
2022 main.log.report("Stopping test")
2023 main.stop( email=main.emailOnStop )
2024
Hari Krishnac195f3b2015-07-08 20:02:24 -07002025 def CASE73( self, main ):
2026 """
2027 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2028 """
2029 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002030 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002031 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002032
Hari Krishnac195f3b2015-07-08 20:02:24 -07002033 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2034 main.log.report( "___________________________________________________________________________" )
2035 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2036 switches = []
2037 switchesComb = []
2038 for i in range( main.numMNswitches ):
2039 switches.append('s%d'%(i+1))
2040 switchesLinksComb = list(itertools.combinations(switches,2))
2041 main.randomLinks = random.sample(switchesLinksComb, 5 )
2042 print main.randomLinks
2043 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002044
Hari Krishnac195f3b2015-07-08 20:02:24 -07002045 for switch in main.randomLinks:
2046 main.Mininet1.link(
2047 END1=switch[0],
2048 END2=switch[1],
2049 OPTION="down")
2050 time.sleep( link_sleep )
2051
Hari Krishna6185fc12015-07-13 15:42:31 -07002052 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002053 linkDown = main.ONOSbench.checkStatus(
2054 topology_output, main.numMNswitches, str(
2055 int( main.numMNlinks ) - 5 * 2 ) )
2056 utilities.assert_equals(
2057 expect=main.TRUE,
2058 actual=linkDown,
2059 onpass="Link Down discovered properly",
2060 onfail="Link down was not discovered in " +
2061 str( link_sleep ) +
2062 " seconds" )
2063
GlennRCfcfdc4f2015-09-30 16:01:57 -07002064 main.step("Verify intents are installed")
2065 # Checking a maximum of 3
2066 for i in range(3):
2067 if i != 0:
2068 main.log.warn( "Verification failed. Retrying..." )
2069 main.log.info("Giving onos some time...")
2070 time.sleep( main.checkIntentsDelay )
2071
2072 intentState = main.TRUE
2073 for e in range(int(main.numCtrls)):
2074 main.log.info( "Checking intents on CLI %s" % (e+1) )
2075 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2076 intentState
2077 if not intentState:
2078 main.log.warn( "Not all intents installed" )
2079 if intentState:
2080 break
2081 else:
2082 #Dumping intent summary
2083 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2084
2085
2086 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2087 onpass="INTENTS INSTALLED",
2088 onfail="SOME INTENTS NOT INSTALLED" )
2089
Hari Krishnac195f3b2015-07-08 20:02:24 -07002090 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002091 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002092 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002093 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2094 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002095 main.log.warn("First pingall failed. Retrying...")
2096 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002097 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002098
Hari Krishnac195f3b2015-07-08 20:02:24 -07002099 time2 = time.time()
2100 timeDiff = round( ( time2 - time1 ), 2 )
2101 main.log.report(
2102 "Time taken for Ping All: " +
2103 str( timeDiff ) +
2104 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002105 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002106 onpass="PING ALL PASS",
2107 onfail="PING ALL FAIL" )
2108
GlennRCbddd58f2015-10-01 15:45:25 -07002109 caseResult = linkDown and pingResult and intentState
2110 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002111 onpass="Random Link cut Test PASS",
2112 onfail="Random Link cut Test FAIL" )
2113
GlennRCfcfdc4f2015-09-30 16:01:57 -07002114 # Printing what exactly failed
2115 if not linkDown:
2116 main.log.debug( "Link down was not discovered correctly" )
2117 if not pingResult:
2118 main.log.debug( "Pingall failed" )
2119 if not intentState:
2120 main.log.debug( "Intents are not all installed" )
2121
GlennRCbddd58f2015-10-01 15:45:25 -07002122 if not caseResult and main.failSwitch:
2123 main.log.report("Stopping test")
2124 main.stop( email=main.emailOnStop )
2125
Hari Krishnac195f3b2015-07-08 20:02:24 -07002126 def CASE83( self, main ):
2127 """
2128 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2129 """
2130 import random
2131 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002132
Hari Krishnac195f3b2015-07-08 20:02:24 -07002133 main.log.report(
2134 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2135 main.log.report(
2136 "__________________________________________________________________" )
2137 main.case(
2138 "Point intents - Bring the core links up that are down and verify ping all" )
2139 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002140
Hari Krishnac195f3b2015-07-08 20:02:24 -07002141 for switch in main.randomLinks:
2142 main.Mininet1.link(
2143 END1=switch[0],
2144 END2=switch[1],
2145 OPTION="up")
2146 time.sleep( link_sleep )
2147
Hari Krishna6185fc12015-07-13 15:42:31 -07002148 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002149 linkUp = main.ONOSbench.checkStatus(
2150 topology_output,
2151 main.numMNswitches,
2152 str( main.numMNlinks ) )
2153 utilities.assert_equals(
2154 expect=main.TRUE,
2155 actual=linkUp,
2156 onpass="Link up discovered properly",
2157 onfail="Link up was not discovered in " +
2158 str( link_sleep ) +
2159 " seconds" )
2160
GlennRCfcfdc4f2015-09-30 16:01:57 -07002161 main.step("Verify intents are installed")
2162 # Checking a maximum of 3
2163 for i in range(3):
2164 if i != 0:
2165 main.log.warn( "Verification failed. Retrying..." )
2166 main.log.info("Giving onos some time...")
2167 time.sleep( main.checkIntentsDelay )
2168
2169 intentState = main.TRUE
2170 for e in range(int(main.numCtrls)):
2171 main.log.info( "Checking intents on CLI %s" % (e+1) )
2172 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2173 intentState
2174 if not intentState:
2175 main.log.warn( "Not all intents installed" )
2176 if intentState:
2177 break
2178 else:
2179 #Dumping intent summary
2180 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2181
2182
2183 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2184 onpass="INTENTS INSTALLED",
2185 onfail="SOME INTENTS NOT INSTALLED" )
2186
Hari Krishnac195f3b2015-07-08 20:02:24 -07002187 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002188 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002189 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002190 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2191 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002192 main.log.warn("First pingall failed. Retrying...")
2193 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002194 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002195
Hari Krishnac195f3b2015-07-08 20:02:24 -07002196 time2 = time.time()
2197 timeDiff = round( ( time2 - time1 ), 2 )
2198 main.log.report(
2199 "Time taken for Ping All: " +
2200 str( timeDiff ) +
2201 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002202 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002203 onpass="PING ALL PASS",
2204 onfail="PING ALL FAIL" )
2205
GlennRCbddd58f2015-10-01 15:45:25 -07002206 caseResult = linkUp and pingResult
2207 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002208 onpass="Link Up Test PASS",
2209 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002210 # Printing what exactly failed
2211 if not linkUp:
2212 main.log.debug( "Link down was not discovered correctly" )
2213 if not pingResult:
2214 main.log.debug( "Pingall failed" )
2215 if not intentState:
2216 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002217
GlennRCbddd58f2015-10-01 15:45:25 -07002218 if not caseResult and main.failSwitch:
2219 main.log.report("Stopping test")
2220 main.stop( email=main.emailOnStop )
2221
Hari Krishnac195f3b2015-07-08 20:02:24 -07002222 def CASE74( self, main ):
2223 """
2224 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2225 """
2226 import random
2227 main.randomLink1 = []
2228 main.randomLink2 = []
2229 main.randomLink3 = []
2230 main.randomLink4 = []
2231 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2232 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2233 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2234 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2235 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2236 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2237 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2238 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002239
Hari Krishnac195f3b2015-07-08 20:02:24 -07002240 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2241 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002242 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002243 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002244 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002245 linkIndex.remove(linkIndexS9)
2246 linkIndexS10 = random.sample(linkIndex,1)[0]
2247 main.randomLink1 = link1End2top[linkIndexS9]
2248 main.randomLink2 = link2End2top[linkIndexS10]
2249 main.randomLink3 = random.sample(link1End2bot,1)[0]
2250 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002251
2252 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002253 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2254 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2255 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2256 time.sleep( link_sleep )
2257 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2258 time.sleep( link_sleep )
2259
Hari Krishna6185fc12015-07-13 15:42:31 -07002260 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002261 linkDown = main.ONOSbench.checkStatus(
2262 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002263 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002264 utilities.assert_equals(
2265 expect=main.TRUE,
2266 actual=linkDown,
2267 onpass="Link Down discovered properly",
2268 onfail="Link down was not discovered in " +
2269 str( link_sleep ) +
2270 " seconds" )
2271
GlennRCfcfdc4f2015-09-30 16:01:57 -07002272 main.step("Verify intents are installed")
2273 # Checking a maximum of 3
2274 for i in range(3):
2275 if i != 0:
2276 main.log.warn( "Verification failed. Retrying..." )
2277 main.log.info("Giving onos some time...")
2278 time.sleep( main.checkIntentsDelay )
2279
2280 intentState = main.TRUE
2281 for e in range(int(main.numCtrls)):
2282 main.log.info( "Checking intents on CLI %s" % (e+1) )
2283 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2284 intentState
2285 if not intentState:
2286 main.log.warn( "Not all intents installed" )
2287 if intentState:
2288 break
2289 else:
2290 #Dumping intent summary
2291 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2292
2293
2294 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2295 onpass="INTENTS INSTALLED",
2296 onfail="SOME INTENTS NOT INSTALLED" )
2297
Hari Krishnac195f3b2015-07-08 20:02:24 -07002298 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002299 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002300 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002301 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2302 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002303 main.log.warn("First pingall failed. Retrying...")
2304 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002305 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002306
Hari Krishnac195f3b2015-07-08 20:02:24 -07002307 time2 = time.time()
2308 timeDiff = round( ( time2 - time1 ), 2 )
2309 main.log.report(
2310 "Time taken for Ping All: " +
2311 str( timeDiff ) +
2312 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002313 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002314 onpass="PING ALL PASS",
2315 onfail="PING ALL FAIL" )
2316
GlennRCbddd58f2015-10-01 15:45:25 -07002317 caseResult = linkDown and pingResult and intentState
2318 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002319 onpass="Random Link cut Test PASS",
2320 onfail="Random Link cut Test FAIL" )
2321
GlennRCfcfdc4f2015-09-30 16:01:57 -07002322 # Printing what exactly failed
2323 if not linkDown:
2324 main.log.debug( "Link down was not discovered correctly" )
2325 if not pingResult:
2326 main.log.debug( "Pingall failed" )
2327 if not intentState:
2328 main.log.debug( "Intents are not all installed" )
2329
GlennRCbddd58f2015-10-01 15:45:25 -07002330 if not caseResult and main.failSwitch:
2331 main.log.report("Stopping test")
2332 main.stop( email=main.emailOnStop )
2333
Hari Krishnac195f3b2015-07-08 20:02:24 -07002334 def CASE84( self, main ):
2335 """
2336 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2337 """
2338 import random
2339 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2340 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2341 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2342 main.log.report(
2343 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2344 main.log.report(
2345 "__________________________________________________________________" )
2346 main.case(
2347 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002348
2349 # Work around for link state propagation delay. Added some sleep time.
2350 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2351 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002352 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2353 time.sleep( link_sleep )
2354 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2355 time.sleep( link_sleep )
2356
Hari Krishna6185fc12015-07-13 15:42:31 -07002357 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002358 linkUp = main.ONOSbench.checkStatus(
2359 topology_output,
2360 main.numMNswitches,
2361 str( main.numMNlinks ) )
2362 utilities.assert_equals(
2363 expect=main.TRUE,
2364 actual=linkUp,
2365 onpass="Link up discovered properly",
2366 onfail="Link up was not discovered in " +
2367 str( link_sleep ) +
2368 " seconds" )
2369
GlennRCfcfdc4f2015-09-30 16:01:57 -07002370 main.step("Verify intents are installed")
2371 # Checking a maximum of 3
2372 for i in range(3):
2373 if i != 0:
2374 main.log.warn( "Verification failed. Retrying..." )
2375 main.log.info("Giving onos some time...")
2376 time.sleep( main.checkIntentsDelay )
2377
2378 intentState = main.TRUE
2379 for e in range(int(main.numCtrls)):
2380 main.log.info( "Checking intents on CLI %s" % (e+1) )
2381 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2382 intentState
2383 if not intentState:
2384 main.log.warn( "Not all intents installed" )
2385 if intentState:
2386 break
2387 else:
2388 #Dumping intent summary
2389 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2390
2391
2392 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2393 onpass="INTENTS INSTALLED",
2394 onfail="SOME INTENTS NOT INSTALLED" )
2395
Hari Krishnac195f3b2015-07-08 20:02:24 -07002396 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002397 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002398 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002399 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2400 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002401 main.log.warn("First pingall failed. Retrying...")
2402 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002403 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002404
Hari Krishnac195f3b2015-07-08 20:02:24 -07002405 time2 = time.time()
2406 timeDiff = round( ( time2 - time1 ), 2 )
2407 main.log.report(
2408 "Time taken for Ping All: " +
2409 str( timeDiff ) +
2410 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002411 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002412 onpass="PING ALL PASS",
2413 onfail="PING ALL FAIL" )
2414
GlennRCbddd58f2015-10-01 15:45:25 -07002415 caseResult = linkUp and pingResult
2416 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002417 onpass="Link Up Test PASS",
2418 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002419 # Printing what exactly failed
2420 if not linkUp:
2421 main.log.debug( "Link down was not discovered correctly" )
2422 if not pingResult:
2423 main.log.debug( "Pingall failed" )
2424 if not intentState:
2425 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002426
GlennRCbddd58f2015-10-01 15:45:25 -07002427 if not caseResult and main.failSwitch:
2428 main.log.report("Stopping test")
2429 main.stop( email=main.emailOnStop )
2430
Hari Krishnab79d0822015-08-20 09:48:43 -07002431 def CASE75( self, main ):
2432 """
2433 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2434 """
2435 import random
2436 main.randomLink1 = []
2437 main.randomLink2 = []
2438 main.randomLink3 = []
2439 main.randomLink4 = []
2440 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2441 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2442 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2443 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2444 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2445 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2446 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2447 main.pingTimeout = 400
2448
2449 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2450 main.log.report( "___________________________________________________________________________" )
2451 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2452 linkIndex = range(4)
2453 linkIndexS9 = random.sample(linkIndex,1)[0]
2454 linkIndex.remove(linkIndexS9)
2455 linkIndexS10 = random.sample(linkIndex,1)[0]
2456 main.randomLink1 = link1End2top[linkIndexS9]
2457 main.randomLink2 = link2End2top[linkIndexS10]
2458 main.randomLink3 = random.sample(link1End2bot,1)[0]
2459 main.randomLink4 = random.sample(link2End2bot,1)[0]
2460
2461 # Work around for link state propagation delay. Added some sleep time.
2462 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2463 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2464 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2465 time.sleep( link_sleep )
2466 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2467 time.sleep( link_sleep )
2468
2469 topology_output = main.ONOScli1.topology()
2470 linkDown = main.ONOSbench.checkStatus(
2471 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002472 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002473 utilities.assert_equals(
2474 expect=main.TRUE,
2475 actual=linkDown,
2476 onpass="Link Down discovered properly",
2477 onfail="Link down was not discovered in " +
2478 str( link_sleep ) +
2479 " seconds" )
2480
GlennRCfcfdc4f2015-09-30 16:01:57 -07002481 main.step("Verify intents are installed")
2482 # Checking a maximum of 3
2483 for i in range(3):
2484 if i != 0:
2485 main.log.warn( "Verification failed. Retrying..." )
2486 main.log.info("Giving onos some time...")
2487 time.sleep( main.checkIntentsDelay )
2488
2489 intentState = main.TRUE
2490 for e in range(int(main.numCtrls)):
2491 main.log.info( "Checking intents on CLI %s" % (e+1) )
2492 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2493 intentState
2494 if not intentState:
2495 main.log.warn( "Not all intents installed" )
2496 if intentState:
2497 break
2498 else:
2499 #Dumping intent summary
2500 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2501
2502
2503 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2504 onpass="INTENTS INSTALLED",
2505 onfail="SOME INTENTS NOT INSTALLED" )
2506
Hari Krishnab79d0822015-08-20 09:48:43 -07002507 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002508 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002509 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002510 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2511 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002512 main.log.warn("First pingall failed. Retrying...")
2513 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002514 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002515
Hari Krishnab79d0822015-08-20 09:48:43 -07002516 time2 = time.time()
2517 timeDiff = round( ( time2 - time1 ), 2 )
2518 main.log.report(
2519 "Time taken for Ping All: " +
2520 str( timeDiff ) +
2521 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002522 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002523 onpass="PING ALL PASS",
2524 onfail="PING ALL FAIL" )
2525
GlennRCbddd58f2015-10-01 15:45:25 -07002526 caseResult = linkDown and pingResult and intentState
2527 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002528 onpass="Random Link cut Test PASS",
2529 onfail="Random Link cut Test FAIL" )
2530
GlennRCfcfdc4f2015-09-30 16:01:57 -07002531 # Printing what exactly failed
2532 if not linkDown:
2533 main.log.debug( "Link down was not discovered correctly" )
2534 if not pingResult:
2535 main.log.debug( "Pingall failed" )
2536 if not intentState:
2537 main.log.debug( "Intents are not all installed" )
2538
GlennRCbddd58f2015-10-01 15:45:25 -07002539 if not caseResult and main.failSwitch:
2540 main.log.report("Stopping test")
2541 main.stop( email=main.emailOnStop )
2542
Hari Krishnab79d0822015-08-20 09:48:43 -07002543 def CASE85( self, main ):
2544 """
2545 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2546 """
2547 import random
2548 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2549 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2550 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2551 main.log.report(
2552 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2553 main.log.report(
2554 "__________________________________________________________________" )
2555 main.case(
2556 "Point intents - Bring the core links up that are down and verify ping all" )
2557
2558 # Work around for link state propagation delay. Added some sleep time.
2559 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2560 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2561 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2562 time.sleep( link_sleep )
2563 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2564 time.sleep( link_sleep )
2565
2566 topology_output = main.ONOScli1.topology()
2567 linkUp = main.ONOSbench.checkStatus(
2568 topology_output,
2569 main.numMNswitches,
2570 str( main.numMNlinks ) )
2571 utilities.assert_equals(
2572 expect=main.TRUE,
2573 actual=linkUp,
2574 onpass="Link up discovered properly",
2575 onfail="Link up was not discovered in " +
2576 str( link_sleep ) +
2577 " seconds" )
2578
GlennRCfcfdc4f2015-09-30 16:01:57 -07002579 main.step("Verify intents are installed")
2580 # Checking a maximum of 3
2581 for i in range(3):
2582 if i != 0:
2583 main.log.warn( "Verification failed. Retrying..." )
2584 main.log.info("Giving onos some time...")
2585 time.sleep( main.checkIntentsDelay )
2586
2587 intentState = main.TRUE
2588 for e in range(int(main.numCtrls)):
2589 main.log.info( "Checking intents on CLI %s" % (e+1) )
2590 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2591 intentState
2592 if not intentState:
2593 main.log.warn( "Not all intents installed" )
2594 if intentState:
2595 break
2596 else:
2597 #Dumping intent summary
2598 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2599
2600
2601 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2602 onpass="INTENTS INSTALLED",
2603 onfail="SOME INTENTS NOT INSTALLED" )
2604
Hari Krishnab79d0822015-08-20 09:48:43 -07002605 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002606 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002607 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002608 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2609 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002610 main.log.warn("First pingall failed. Retrying...")
2611 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002612 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002613
Hari Krishnab79d0822015-08-20 09:48:43 -07002614 time2 = time.time()
2615 timeDiff = round( ( time2 - time1 ), 2 )
2616 main.log.report(
2617 "Time taken for Ping All: " +
2618 str( timeDiff ) +
2619 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002620 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002621 onpass="PING ALL PASS",
2622 onfail="PING ALL FAIL" )
2623
GlennRCbddd58f2015-10-01 15:45:25 -07002624 caseResult = linkUp and pingResult
2625 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002626 onpass="Link Up Test PASS",
2627 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002628 # Printing what exactly failed
2629 if not linkUp:
2630 main.log.debug( "Link down was not discovered correctly" )
2631 if not pingResult:
2632 main.log.debug( "Pingall failed" )
2633 if not intentState:
2634 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002635
GlennRCbddd58f2015-10-01 15:45:25 -07002636 if not caseResult and main.failSwitch:
2637 main.log.report("Stopping test")
2638 main.stop( email=main.emailOnStop )
2639
Hari Krishna4223dbd2015-08-13 16:29:53 -07002640 def CASE170( self ):
2641 """
2642 IPv6 ping all with some core links down( Host Intents-Att Topo)
2643 """
2644 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2645 main.log.report( "_________________________________________________" )
2646 import itertools
2647 import time
2648 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2649 main.step( "Verify IPv6 Ping across all hosts" )
2650 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2651 pingResult = main.FALSE
2652 time1 = time.time()
2653 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002654 if not pingResult:
2655 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
2656 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002657 time2 = time.time()
2658 timeDiff = round( ( time2 - time1 ), 2 )
2659 main.log.report(
2660 "Time taken for IPv6 Ping All: " +
2661 str( timeDiff ) +
2662 " seconds" )
2663 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2664 onpass="PING ALL PASS",
2665 onfail="PING ALL FAIL" )
2666
GlennRCbddd58f2015-10-01 15:45:25 -07002667 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002668 utilities.assert_equals(
2669 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002670 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002671 onpass="IPv6 Ping across 300 host intents test PASS",
2672 onfail="IPv6 Ping across 300 host intents test FAIL" )
2673
2674 def CASE180( self ):
2675 """
2676 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2677 """
2678 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2679 main.log.report( "_________________________________________________" )
2680 import itertools
2681 import time
2682 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2683 main.step( "Verify IPv6 Ping across all hosts" )
2684 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2685 pingResult = main.FALSE
2686 time1 = time.time()
2687 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002688 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002689 main.log.warn("First ping failed. Retrying...")
2690 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002691 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002692
Hari Krishna4223dbd2015-08-13 16:29:53 -07002693 time2 = time.time()
2694 timeDiff = round( ( time2 - time1 ), 2 )
2695 main.log.report(
2696 "Time taken for IPv6 Ping All: " +
2697 str( timeDiff ) +
2698 " seconds" )
2699 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2700 onpass="PING ALL PASS",
2701 onfail="PING ALL FAIL" )
2702
GlennRCbddd58f2015-10-01 15:45:25 -07002703 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002704 utilities.assert_equals(
2705 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002706 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002707 onpass="IPv6 Ping across 300 host intents test PASS",
2708 onfail="IPv6 Ping across 300 host intents test FAIL" )
2709
2710 def CASE171( self ):
2711 """
2712 IPv6 ping all with some core links down( Point Intents-Att Topo)
2713 """
2714 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2715 main.log.report( "_________________________________________________" )
2716 import itertools
2717 import time
2718 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2719 main.step( "Verify IPv6 Ping across all hosts" )
2720 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2721 pingResult = main.FALSE
2722 time1 = time.time()
2723 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002724 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002725 main.log.warn("First ping failed. Retrying...")
2726 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002727 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002728
Hari Krishna4223dbd2015-08-13 16:29:53 -07002729 time2 = time.time()
2730 timeDiff = round( ( time2 - time1 ), 2 )
2731 main.log.report(
2732 "Time taken for IPv6 Ping All: " +
2733 str( timeDiff ) +
2734 " seconds" )
2735 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2736 onpass="PING ALL PASS",
2737 onfail="PING ALL FAIL" )
2738
GlennRCbddd58f2015-10-01 15:45:25 -07002739 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002740 utilities.assert_equals(
2741 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002742 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002743 onpass="IPv6 Ping across 600 point intents test PASS",
2744 onfail="IPv6 Ping across 600 point intents test FAIL" )
2745
2746 def CASE181( self ):
2747 """
2748 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2749 """
2750 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2751 main.log.report( "_________________________________________________" )
2752 import itertools
2753 import time
2754 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2755 main.step( "Verify IPv6 Ping across all hosts" )
2756 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2757 pingResult = main.FALSE
2758 time1 = time.time()
2759 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002760 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002761 main.log.warn("First ping failed. Retrying...")
2762 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002763 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002764
Hari Krishna4223dbd2015-08-13 16:29:53 -07002765 time2 = time.time()
2766 timeDiff = round( ( time2 - time1 ), 2 )
2767 main.log.report(
2768 "Time taken for IPv6 Ping All: " +
2769 str( timeDiff ) +
2770 " seconds" )
2771 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2772 onpass="PING ALL PASS",
2773 onfail="PING ALL FAIL" )
2774
GlennRCbddd58f2015-10-01 15:45:25 -07002775 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002776 utilities.assert_equals(
2777 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002778 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002779 onpass="IPv6 Ping across 600 Point intents test PASS",
2780 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2781
2782 def CASE172( self ):
2783 """
2784 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2785 """
2786 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2787 main.log.report( "_________________________________________________" )
2788 import itertools
2789 import time
2790 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2791 main.step( "Verify IPv6 Ping across all hosts" )
2792 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2793 pingResult = main.FALSE
2794 time1 = time.time()
2795 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002796 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002797 main.log.warn("First ping failed. Retrying...")
2798 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002799 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002800
Hari Krishna4223dbd2015-08-13 16:29:53 -07002801 time2 = time.time()
2802 timeDiff = round( ( time2 - time1 ), 2 )
2803 main.log.report(
2804 "Time taken for IPv6 Ping All: " +
2805 str( timeDiff ) +
2806 " seconds" )
2807 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2808 onpass="PING ALL PASS",
2809 onfail="PING ALL FAIL" )
2810
GlennRCbddd58f2015-10-01 15:45:25 -07002811 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002812 utilities.assert_equals(
2813 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002814 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002815 onpass="IPv6 Ping across 300 host intents test PASS",
2816 onfail="IPv6 Ping across 300 host intents test FAIL" )
2817
2818 def CASE182( self ):
2819 """
2820 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2821 """
2822 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2823 main.log.report( "_________________________________________________" )
2824 import itertools
2825 import time
2826 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2827 main.step( "Verify IPv6 Ping across all hosts" )
2828 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2829 pingResult = main.FALSE
2830 time1 = time.time()
2831 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002832 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002833 main.log.warn("First ping failed. Retrying...")
2834 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002835 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002836
Hari Krishna4223dbd2015-08-13 16:29:53 -07002837 time2 = time.time()
2838 timeDiff = round( ( time2 - time1 ), 2 )
2839 main.log.report(
2840 "Time taken for IPv6 Ping All: " +
2841 str( timeDiff ) +
2842 " seconds" )
2843 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2844 onpass="PING ALL PASS",
2845 onfail="PING ALL FAIL" )
2846
GlennRCbddd58f2015-10-01 15:45:25 -07002847 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002848 utilities.assert_equals(
2849 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002850 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002851 onpass="IPv6 Ping across 300 host intents test PASS",
2852 onfail="IPv6 Ping across 300 host intents test FAIL" )
2853
2854 def CASE173( self ):
2855 """
2856 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2857 """
2858 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2859 main.log.report( "_________________________________________________" )
2860 import itertools
2861 import time
2862 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2863 main.step( "Verify IPv6 Ping across all hosts" )
2864 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2865 pingResult = main.FALSE
2866 time1 = time.time()
2867 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002868 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002869 main.log.warn("First ping failed. Retrying...")
2870 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002871 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002872
Hari Krishna4223dbd2015-08-13 16:29:53 -07002873 time2 = time.time()
2874 timeDiff = round( ( time2 - time1 ), 2 )
2875 main.log.report(
2876 "Time taken for IPv6 Ping All: " +
2877 str( timeDiff ) +
2878 " seconds" )
2879 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2880 onpass="PING ALL PASS",
2881 onfail="PING ALL FAIL" )
2882
GlennRCbddd58f2015-10-01 15:45:25 -07002883 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002884 utilities.assert_equals(
2885 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002886 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002887 onpass="IPv6 Ping across 600 point intents test PASS",
2888 onfail="IPv6 Ping across 600 point intents test FAIL" )
2889
2890 def CASE183( self ):
2891 """
2892 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2893 """
2894 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2895 main.log.report( "_________________________________________________" )
2896 import itertools
2897 import time
2898 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2899 main.step( "Verify IPv6 Ping across all hosts" )
2900 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2901 pingResult = main.FALSE
2902 time1 = time.time()
2903 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002904 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002905 main.log.warn("First ping failed. Retrying...")
2906 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002907 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002908
Hari Krishna4223dbd2015-08-13 16:29:53 -07002909 time2 = time.time()
2910 timeDiff = round( ( time2 - time1 ), 2 )
2911 main.log.report(
2912 "Time taken for IPv6 Ping All: " +
2913 str( timeDiff ) +
2914 " seconds" )
2915 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2916 onpass="PING ALL PASS",
2917 onfail="PING ALL FAIL" )
2918
GlennRCbddd58f2015-10-01 15:45:25 -07002919 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002920 utilities.assert_equals(
2921 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002922 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002923 onpass="IPv6 Ping across 600 Point intents test PASS",
2924 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2925
2926 def CASE174( self ):
2927 """
2928 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2929 """
2930 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2931 main.log.report( "_________________________________________________" )
2932 import itertools
2933 import time
2934 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2935 main.step( "Verify IPv6 Ping across all hosts" )
2936 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2937 pingResult = main.FALSE
2938 time1 = time.time()
2939 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002940 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002941 main.log.warn("First ping failed. Retrying...")
2942 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002943 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002944
Hari Krishna4223dbd2015-08-13 16:29:53 -07002945 time2 = time.time()
2946 timeDiff = round( ( time2 - time1 ), 2 )
2947 main.log.report(
2948 "Time taken for IPv6 Ping All: " +
2949 str( timeDiff ) +
2950 " seconds" )
2951 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2952 onpass="PING ALL PASS",
2953 onfail="PING ALL FAIL" )
2954
GlennRCbddd58f2015-10-01 15:45:25 -07002955 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002956 utilities.assert_equals(
2957 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002958 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002959 onpass="IPv6 Ping across 2278 host intents test PASS",
2960 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2961
2962 def CASE184( self ):
2963 """
2964 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2965 """
2966 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2967 main.log.report( "_________________________________________________" )
2968 import itertools
2969 import time
2970 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2971 main.step( "Verify IPv6 Ping across all hosts" )
2972 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2973 pingResult = main.FALSE
2974 time1 = time.time()
2975 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002976 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002977 main.log.warn("First ping failed. Retrying...")
2978 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002979 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002980
Hari Krishna4223dbd2015-08-13 16:29:53 -07002981 time2 = time.time()
2982 timeDiff = round( ( time2 - time1 ), 2 )
2983 main.log.report(
2984 "Time taken for IPv6 Ping All: " +
2985 str( timeDiff ) +
2986 " seconds" )
2987 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2988 onpass="PING ALL PASS",
2989 onfail="PING ALL FAIL" )
2990
GlennRCbddd58f2015-10-01 15:45:25 -07002991 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002992 utilities.assert_equals(
2993 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002994 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002995 onpass="IPv6 Ping across 2278 host intents test PASS",
2996 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2997
2998 def CASE175( self ):
2999 """
3000 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3001 """
3002 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3003 main.log.report( "_________________________________________________" )
3004 import itertools
3005 import time
3006 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3007 main.step( "Verify IPv6 Ping across all hosts" )
3008 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3009 pingResult = main.FALSE
3010 time1 = time.time()
3011 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003012 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003013 main.log.warn("First ping failed. Retrying...")
3014 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003015 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003016
Hari Krishna4223dbd2015-08-13 16:29:53 -07003017 time2 = time.time()
3018 timeDiff = round( ( time2 - time1 ), 2 )
3019 main.log.report(
3020 "Time taken for IPv6 Ping All: " +
3021 str( timeDiff ) +
3022 " seconds" )
3023 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3024 onpass="PING ALL PASS",
3025 onfail="PING ALL FAIL" )
3026
GlennRCbddd58f2015-10-01 15:45:25 -07003027 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003028 utilities.assert_equals(
3029 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003030 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003031 onpass="IPv6 Ping across 4556 point intents test PASS",
3032 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3033
3034 def CASE185( self ):
3035 """
3036 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3037 """
3038 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3039 main.log.report( "_________________________________________________" )
3040 import itertools
3041 import time
3042 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3043 main.step( "Verify IPv6 Ping across all hosts" )
3044 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3045 pingResult = main.FALSE
3046 time1 = time.time()
3047 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003048 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003049 main.log.warn("First ping failed. Retrying...")
3050 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003051 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003052
Hari Krishna4223dbd2015-08-13 16:29:53 -07003053 time2 = time.time()
3054 timeDiff = round( ( time2 - time1 ), 2 )
3055 main.log.report(
3056 "Time taken for IPv6 Ping All: " +
3057 str( timeDiff ) +
3058 " seconds" )
3059 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3060 onpass="PING ALL PASS",
3061 onfail="PING ALL FAIL" )
3062
GlennRCbddd58f2015-10-01 15:45:25 -07003063 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003064 utilities.assert_equals(
3065 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003066 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003067 onpass="IPv6 Ping across 4556 Point intents test PASS",
3068 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3069
Hari Krishnac195f3b2015-07-08 20:02:24 -07003070 def CASE90( self ):
3071 """
3072 Install 600 point intents and verify ping all (Att Topology)
3073 """
3074 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3075 main.log.report( "_______________________________________" )
3076 import itertools
3077 import time
3078 main.case( "Install 600 point intents" )
3079 main.step( "Add point Intents" )
3080 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003081 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3082
Hari Krishnac195f3b2015-07-08 20:02:24 -07003083 intentIdList = []
3084 time1 = time.time()
3085 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3086 pool = []
3087 for cli in main.CLIs:
3088 if i >= len( deviceCombos ):
3089 break
3090 t = main.Thread( target=cli.addPointIntent,
3091 threadID=main.threadID,
3092 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003093 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 -07003094 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003095 t.start()
3096 i = i + 1
3097 main.threadID = main.threadID + 1
3098 for thread in pool:
3099 thread.join()
3100 intentIdList.append(thread.result)
3101 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003102 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003103
GlennRCfcfdc4f2015-09-30 16:01:57 -07003104 # Saving intent ids to check intents in later case
3105 main.intentIds = list(intentIdList)
3106
GlennRCa8d786a2015-09-23 17:40:11 -07003107 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003108
3109 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07003110 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07003111 if i != 0:
3112 main.log.warn( "Verification failed. Retrying..." )
3113 main.log.info("Waiting for onos to install intents...")
3114 time.sleep( main.checkIntentsDelay )
3115
GlennRCa8d786a2015-09-23 17:40:11 -07003116 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003117 for e in range(int(main.numCtrls)):
3118 main.log.info( "Checking intents on CLI %s" % (e+1) )
3119 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3120 intentState
3121 if not intentState:
3122 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003123 if intentState:
3124 break
GlennRCdb2c8422015-09-29 12:21:59 -07003125 else:
3126 #Dumping intent summary
3127 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003128
3129 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3130 onpass="INTENTS INSTALLED",
3131 onfail="SOME INTENTS NOT INSTALLED" )
3132
Hari Krishnac195f3b2015-07-08 20:02:24 -07003133 main.step( "Verify Ping across all hosts" )
3134 pingResult = main.FALSE
3135 time1 = time.time()
3136 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3137 time2 = time.time()
3138 timeDiff = round( ( time2 - time1 ), 2 )
3139 main.log.report(
3140 "Time taken for Ping All: " +
3141 str( timeDiff ) +
3142 " seconds" )
3143 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3144 onpass="PING tALL PASS",
3145 onfail="PING ALL FAIL" )
3146
GlennRCbddd58f2015-10-01 15:45:25 -07003147 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003148
Hari Krishnac195f3b2015-07-08 20:02:24 -07003149 utilities.assert_equals(
3150 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003151 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003152 onpass="Install 600 point Intents and Ping All test PASS",
3153 onfail="Install 600 point Intents and Ping All test FAIL" )
3154
GlennRCbddd58f2015-10-01 15:45:25 -07003155 if not intentState:
3156 main.log.debug( "Intents failed to install completely" )
3157 if not pingResult:
3158 main.log.debug( "Pingall failed" )
3159
3160 if not caseResult and main.failSwitch:
3161 main.log.report("Stopping test")
3162 main.stop( email=main.emailOnStop )
3163
Hari Krishnac195f3b2015-07-08 20:02:24 -07003164 def CASE91( self ):
3165 """
3166 Install 600 point intents and verify ping all (Chordal Topology)
3167 """
3168 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3169 main.log.report( "_______________________________________" )
3170 import itertools
3171 import time
3172 main.case( "Install 600 point intents" )
3173 main.step( "Add point Intents" )
3174 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003175 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3176
Hari Krishnac195f3b2015-07-08 20:02:24 -07003177 intentIdList = []
3178 time1 = time.time()
3179 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3180 pool = []
3181 for cli in main.CLIs:
3182 if i >= len( deviceCombos ):
3183 break
3184 t = main.Thread( target=cli.addPointIntent,
3185 threadID=main.threadID,
3186 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003187 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 -07003188 pool.append(t)
3189 #time.sleep(1)
3190 t.start()
3191 i = i + 1
3192 main.threadID = main.threadID + 1
3193 for thread in pool:
3194 thread.join()
3195 intentIdList.append(thread.result)
3196 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003197 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003198
GlennRCfcfdc4f2015-09-30 16:01:57 -07003199 # Saving intent ids to check intents in later case
3200 main.intentIds = list(intentIdList)
3201
GlennRCa8d786a2015-09-23 17:40:11 -07003202 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003203
3204 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07003205 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07003206 if i != 0:
3207 main.log.warn( "Verification failed. Retrying..." )
3208 main.log.info("Waiting for onos to install intents...")
3209 time.sleep( main.checkIntentsDelay )
3210
GlennRCa8d786a2015-09-23 17:40:11 -07003211 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003212 for e in range(int(main.numCtrls)):
3213 main.log.info( "Checking intents on CLI %s" % (e+1) )
3214 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3215 intentState
3216 if not intentState:
3217 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003218 if intentState:
3219 break
GlennRCdb2c8422015-09-29 12:21:59 -07003220 else:
3221 #Dumping intent summary
3222 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003223
3224 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3225 onpass="INTENTS INSTALLED",
3226 onfail="SOME INTENTS NOT INSTALLED" )
3227
Hari Krishnac195f3b2015-07-08 20:02:24 -07003228 main.step( "Verify Ping across all hosts" )
3229 pingResult = main.FALSE
3230 time1 = time.time()
3231 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3232 time2 = time.time()
3233 timeDiff = round( ( time2 - time1 ), 2 )
3234 main.log.report(
3235 "Time taken for Ping All: " +
3236 str( timeDiff ) +
3237 " seconds" )
3238 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3239 onpass="PING ALL PASS",
3240 onfail="PING ALL FAIL" )
3241
GlennRCbddd58f2015-10-01 15:45:25 -07003242 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003243
Hari Krishnac195f3b2015-07-08 20:02:24 -07003244 utilities.assert_equals(
3245 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003246 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003247 onpass="Install 600 point Intents and Ping All test PASS",
3248 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003249
GlennRCbddd58f2015-10-01 15:45:25 -07003250 if not intentState:
3251 main.log.debug( "Intents failed to install completely" )
3252 if not pingResult:
3253 main.log.debug( "Pingall failed" )
3254
3255 if not caseResult and main.failSwitch:
3256 main.log.report("Stopping test")
3257 main.stop( email=main.emailOnStop )
3258
Hari Krishnac195f3b2015-07-08 20:02:24 -07003259 def CASE92( self ):
3260 """
3261 Install 4556 point intents and verify ping all (Spine Topology)
3262 """
3263 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3264 main.log.report( "_______________________________________" )
3265 import itertools
3266 import time
3267 main.case( "Install 4556 point intents" )
3268 main.step( "Add point Intents" )
3269 intentResult = main.TRUE
3270 main.pingTimeout = 600
3271 for i in range(len(main.hostMACs)):
3272 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3273 print main.MACsDict
3274 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3275 intentIdList = []
3276 time1 = time.time()
3277 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3278 pool = []
3279 for cli in main.CLIs:
3280 if i >= len( deviceCombos ):
3281 break
3282 t = main.Thread( target=cli.addPointIntent,
3283 threadID=main.threadID,
3284 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003285 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 -07003286 pool.append(t)
3287 #time.sleep(1)
3288 t.start()
3289 i = i + 1
3290 main.threadID = main.threadID + 1
3291 for thread in pool:
3292 thread.join()
3293 intentIdList.append(thread.result)
3294 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003295 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003296
GlennRCfcfdc4f2015-09-30 16:01:57 -07003297 # Saving intent ids to check intents in later case
3298 main.intentIds = list(intentIdList)
3299
GlennRCa8d786a2015-09-23 17:40:11 -07003300 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003301
GlennRCbddd58f2015-10-01 15:45:25 -07003302 # Giving onos 5 chances to install intents
3303 for i in range(5):
GlennRCdb2c8422015-09-29 12:21:59 -07003304 if i != 0:
3305 main.log.warn( "Verification failed. Retrying..." )
3306 main.log.info("Waiting for onos to install intents...")
3307 time.sleep( main.checkIntentsDelay )
3308
GlennRCa8d786a2015-09-23 17:40:11 -07003309 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003310 for e in range(int(main.numCtrls)):
3311 main.log.info( "Checking intents on CLI %s" % (e+1) )
3312 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3313 intentState
3314 if not intentState:
3315 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003316 if intentState:
3317 break
GlennRCdb2c8422015-09-29 12:21:59 -07003318 else:
3319 #Dumping intent summary
3320 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003321
3322 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3323 onpass="INTENTS INSTALLED",
3324 onfail="SOME INTENTS NOT INSTALLED" )
3325
Hari Krishnac195f3b2015-07-08 20:02:24 -07003326 main.step( "Verify Ping across all hosts" )
3327 pingResult = main.FALSE
3328 time1 = time.time()
3329 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3330 time2 = time.time()
3331 timeDiff = round( ( time2 - time1 ), 2 )
3332 main.log.report(
3333 "Time taken for Ping All: " +
3334 str( timeDiff ) +
3335 " seconds" )
3336 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3337 onpass="PING ALL PASS",
3338 onfail="PING ALL FAIL" )
3339
GlennRCbddd58f2015-10-01 15:45:25 -07003340 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003341
Hari Krishnac195f3b2015-07-08 20:02:24 -07003342 utilities.assert_equals(
3343 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003344 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003345 onpass="Install 4556 point Intents and Ping All test PASS",
3346 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003347
GlennRCbddd58f2015-10-01 15:45:25 -07003348 if not intentState:
3349 main.log.debug( "Intents failed to install completely" )
3350 if not pingResult:
3351 main.log.debug( "Pingall failed" )
3352
3353 if not caseResult and main.failSwitch:
3354 main.log.report("Stopping test")
3355 main.stop( email=main.emailOnStop )
3356
Hari Krishnac195f3b2015-07-08 20:02:24 -07003357 def CASE93( self ):
3358 """
3359 Install multi-single point intents and verify Ping all works
3360 for att topology
3361 """
3362 import copy
3363 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003364 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003365 main.log.report( "Install multi-single point intents and verify Ping all" )
3366 main.log.report( "___________________________________________" )
3367 main.case( "Install multi-single point intents and Ping all" )
3368 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3369 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3370 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003371 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003372 time1 = time.time()
3373 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3374 pool = []
3375 for cli in main.CLIs:
3376 egressDevice = deviceDPIDsCopy[i]
3377 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3378 ingressDeviceList.remove(egressDevice)
3379 if i >= len( deviceDPIDsCopy ):
3380 break
3381 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3382 threadID=main.threadID,
3383 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003384 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003385 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003386 t.start()
3387 i = i + 1
3388 main.threadID = main.threadID + 1
3389 for thread in pool:
3390 thread.join()
3391 intentIdList.append(thread.result)
3392 time2 = time.time()
3393 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003394
GlennRCdb2c8422015-09-29 12:21:59 -07003395 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003396
GlennRCdb2c8422015-09-29 12:21:59 -07003397 # Giving onos 3 chances to install intents
3398 for i in range(3):
3399 if i != 0:
3400 main.log.warn( "Verification failed. Retrying..." )
3401 main.log.info("Waiting for onos to install intents...")
3402 time.sleep( main.checkIntentsDelay )
3403
3404 intentState = main.TRUE
3405 for e in range(int(main.numCtrls)):
3406 main.log.info( "Checking intents on CLI %s" % (e+1) )
3407 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3408 intentState
3409 if not intentState:
3410 main.log.warn( "Not all intents installed" )
3411 if intentState:
3412 break
3413 else:
3414 #Dumping intent summary
3415 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3416
3417 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3418 onpass="INTENTS INSTALLED",
3419 onfail="SOME INTENTS NOT INSTALLED" )
3420
3421 main.log.info( "Checking flows state" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003422 checkFlowsState = main.ONOScli1.checkFlowsState()
GlennRCdb2c8422015-09-29 12:21:59 -07003423 # Giving onos time to return the state of the flows
Hari Krishnac195f3b2015-07-08 20:02:24 -07003424 time.sleep(50)
GlennRCdb2c8422015-09-29 12:21:59 -07003425
Hari Krishnac195f3b2015-07-08 20:02:24 -07003426 main.step( "Verify Ping across all hosts" )
3427 pingResult = main.FALSE
3428 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003429 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3430 if not pingResult:
3431 time1 = time.time()
3432 main.log.warn("First pingall failed. Retrying")
3433 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3434
Hari Krishnac195f3b2015-07-08 20:02:24 -07003435 time2 = time.time()
3436 timeDiff = round( ( time2 - time1 ), 2 )
3437 main.log.report(
3438 "Time taken for Ping All: " +
3439 str( timeDiff ) +
3440 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003441
GlennRCbddd58f2015-10-01 15:45:25 -07003442 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003443 utilities.assert_equals(
3444 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003445 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003446 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3447 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003448
Hari Krishnac195f3b2015-07-08 20:02:24 -07003449 def CASE94( self ):
3450 """
3451 Install multi-single point intents and verify Ping all works
3452 for Chordal topology
3453 """
3454 import copy
3455 import time
3456 main.log.report( "Install multi-single point intents and verify Ping all" )
3457 main.log.report( "___________________________________________" )
3458 main.case( "Install multi-single point intents and Ping all" )
3459 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3460 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3461 intentIdList = []
3462 print "MACsDict", main.MACsDict
3463 time1 = time.time()
3464 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3465 pool = []
3466 for cli in main.CLIs:
3467 egressDevice = deviceDPIDsCopy[i]
3468 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3469 ingressDeviceList.remove(egressDevice)
3470 if i >= len( deviceDPIDsCopy ):
3471 break
3472 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3473 threadID=main.threadID,
3474 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003475 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003476 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003477 t.start()
3478 i = i + 1
3479 main.threadID = main.threadID + 1
3480 for thread in pool:
3481 thread.join()
3482 intentIdList.append(thread.result)
3483 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003484 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003485
3486 main.step("Verify intents are installed")
3487
3488 # Giving onos 3 chances to install intents
3489 for i in range(3):
3490 if i != 0:
3491 main.log.warn( "Verification failed. Retrying..." )
3492 main.log.info("Waiting for onos to install intents...")
3493 time.sleep( main.checkIntentsDelay )
3494
3495 intentState = main.TRUE
3496 for e in range(int(main.numCtrls)):
3497 main.log.info( "Checking intents on CLI %s" % (e+1) )
3498 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3499 intentState
3500 if not intentState:
3501 main.log.warn( "Not all intents installed" )
3502 if intentState:
3503 break
3504 else:
3505 #Dumping intent summary
3506 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3507
3508
3509 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3510 onpass="INTENTS INSTALLED",
3511 onfail="SOME INTENTS NOT INSTALLED" )
3512
Hari Krishnac195f3b2015-07-08 20:02:24 -07003513 main.step( "Verify Ping across all hosts" )
3514 pingResult = main.FALSE
3515 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003516 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3517 if not pingResult:
3518 main.log.info( "First pingall failed. Retrying..." )
3519 time1 = time.time()
3520 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003521 time2 = time.time()
3522 timeDiff = round( ( time2 - time1 ), 2 )
3523 main.log.report(
3524 "Time taken for Ping All: " +
3525 str( timeDiff ) +
3526 " seconds" )
3527
GlennRCdb2c8422015-09-29 12:21:59 -07003528
GlennRCbddd58f2015-10-01 15:45:25 -07003529 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003530 utilities.assert_equals(
3531 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003532 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003533 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3534 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003535
Hari Krishnac195f3b2015-07-08 20:02:24 -07003536 #def CASE95 multi-single point intent for Spine
3537
3538 def CASE96( self ):
3539 """
3540 Install single-multi point intents and verify Ping all works
3541 for att topology
3542 """
3543 import copy
3544 main.log.report( "Install single-multi point intents and verify Ping all" )
3545 main.log.report( "___________________________________________" )
3546 main.case( "Install single-multi point intents and Ping all" )
3547 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3548 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3549 intentIdList = []
3550 print "MACsDict", main.MACsDict
3551 time1 = time.time()
3552 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3553 pool = []
3554 for cli in main.CLIs:
3555 ingressDevice = deviceDPIDsCopy[i]
3556 egressDeviceList = copy.copy(deviceDPIDsCopy)
3557 egressDeviceList.remove(ingressDevice)
3558 if i >= len( deviceDPIDsCopy ):
3559 break
3560 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3561 threadID=main.threadID,
3562 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003563 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003564 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003565 t.start()
3566 i = i + 1
3567 main.threadID = main.threadID + 1
3568 for thread in pool:
3569 thread.join()
3570 intentIdList.append(thread.result)
3571 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003572 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003573
3574 main.step("Verify intents are installed")
3575
3576 # Giving onos 3 chances to install intents
3577 for i in range(3):
3578 if i != 0:
3579 main.log.warn( "Verification failed. Retrying..." )
3580 main.log.info("Waiting for onos to install intents...")
3581 time.sleep( main.checkIntentsDelay )
3582
3583 intentState = main.TRUE
3584 for e in range(int(main.numCtrls)):
3585 main.log.info( "Checking intents on CLI %s" % (e+1) )
3586 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3587 intentState
3588 if not intentState:
3589 main.log.warn( "Not all intents installed" )
3590 if intentState:
3591 break
3592 else:
3593 #Dumping intent summary
3594 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3595
3596
3597 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3598 onpass="INTENTS INSTALLED",
3599 onfail="SOME INTENTS NOT INSTALLED" )
3600
Hari Krishnac195f3b2015-07-08 20:02:24 -07003601 main.step( "Verify Ping across all hosts" )
3602 pingResult = main.FALSE
3603 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003604 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3605 if not pingResult:
3606 main.log.info( "First pingall failed. Retrying..." )
3607 time1 = time.time()
3608 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003609 time2 = time.time()
3610 timeDiff = round( ( time2 - time1 ), 2 )
3611 main.log.report(
3612 "Time taken for Ping All: " +
3613 str( timeDiff ) +
3614 " seconds" )
3615
GlennRCbddd58f2015-10-01 15:45:25 -07003616 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003617 utilities.assert_equals(
3618 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003619 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003620 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3621 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3622
3623 def CASE97( self ):
3624 """
3625 Install single-multi point intents and verify Ping all works
3626 for Chordal topology
3627 """
3628 import copy
3629 main.log.report( "Install single-multi point intents and verify Ping all" )
3630 main.log.report( "___________________________________________" )
3631 main.case( "Install single-multi point intents and Ping all" )
3632 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3633 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3634 intentIdList = []
3635 print "MACsDict", main.MACsDict
3636 time1 = time.time()
3637 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3638 pool = []
3639 for cli in main.CLIs:
3640 ingressDevice = deviceDPIDsCopy[i]
3641 egressDeviceList = copy.copy(deviceDPIDsCopy)
3642 egressDeviceList.remove(ingressDevice)
3643 if i >= len( deviceDPIDsCopy ):
3644 break
3645 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3646 threadID=main.threadID,
3647 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003648 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003649 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003650 t.start()
3651 i = i + 1
3652 main.threadID = main.threadID + 1
3653 for thread in pool:
3654 thread.join()
3655 intentIdList.append(thread.result)
3656 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003657 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003658
3659 main.step("Verify intents are installed")
3660
3661 # Giving onos 3 chances to install intents
3662 for i in range(3):
3663 if i != 0:
3664 main.log.warn( "Verification failed. Retrying..." )
3665 main.log.info("Waiting for onos to install intents...")
3666 time.sleep( main.checkIntentsDelay )
3667
3668 intentState = main.TRUE
3669 for e in range(int(main.numCtrls)):
3670 main.log.info( "Checking intents on CLI %s" % (e+1) )
3671 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3672 intentState
3673 if not intentState:
3674 main.log.warn( "Not all intents installed" )
3675 if intentState:
3676 break
3677 else:
3678 #Dumping intent summary
3679 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3680
3681
3682 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3683 onpass="INTENTS INSTALLED",
3684 onfail="SOME INTENTS NOT INSTALLED" )
3685
Hari Krishnac195f3b2015-07-08 20:02:24 -07003686 main.step( "Verify Ping across all hosts" )
3687 pingResult = main.FALSE
3688 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003689 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3690 if not pingResult:
3691 main.log.info( "First pingall failed. Retrying..." )
3692 time1 = time.time()
3693 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003694 time2 = time.time()
3695 timeDiff = round( ( time2 - time1 ), 2 )
3696 main.log.report(
3697 "Time taken for Ping All: " +
3698 str( timeDiff ) +
3699 " seconds" )
3700
GlennRCbddd58f2015-10-01 15:45:25 -07003701 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003702 utilities.assert_equals(
3703 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003704 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003705 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3706 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3707
3708 def CASE98( self ):
3709 """
3710 Install single-multi point intents and verify Ping all works
3711 for Spine topology
3712 """
3713 import copy
3714 main.log.report( "Install single-multi point intents and verify Ping all" )
3715 main.log.report( "___________________________________________" )
3716 main.case( "Install single-multi point intents and Ping all" )
3717 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3718 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3719 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3720 intentIdList = []
3721 MACsDictCopy = {}
3722 for i in range( len( deviceDPIDsCopy ) ):
3723 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3724
3725 print "deviceDPIDsCopy", deviceDPIDsCopy
3726 print ""
3727 print "MACsDictCopy", MACsDictCopy
3728 time1 = time.time()
3729 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3730 pool = []
3731 for cli in main.CLIs:
3732 if i >= len( deviceDPIDsCopy ):
3733 break
3734 ingressDevice = deviceDPIDsCopy[i]
3735 egressDeviceList = copy.copy(deviceDPIDsCopy)
3736 egressDeviceList.remove(ingressDevice)
3737 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3738 threadID=main.threadID,
3739 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003740 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003741 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003742 t.start()
3743 i = i + 1
3744 main.threadID = main.threadID + 1
3745 for thread in pool:
3746 thread.join()
3747 intentIdList.append(thread.result)
3748 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003749 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003750
3751 main.step("Verify intents are installed")
3752
3753 # Giving onos 3 chances to install intents
3754 for i in range(3):
3755 if i != 0:
3756 main.log.warn( "Verification failed. Retrying..." )
3757 main.log.info("Waiting for onos to install intents...")
3758 time.sleep( main.checkIntentsDelay )
3759
3760 intentState = main.TRUE
3761 for e in range(int(main.numCtrls)):
3762 main.log.info( "Checking intents on CLI %s" % (e+1) )
3763 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3764 intentState
3765 if not intentState:
3766 main.log.warn( "Not all intents installed" )
3767 if intentState:
3768 break
3769 else:
3770 #Dumping intent summary
3771 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3772
3773
3774 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3775 onpass="INTENTS INSTALLED",
3776 onfail="SOME INTENTS NOT INSTALLED" )
3777
Hari Krishnac195f3b2015-07-08 20:02:24 -07003778 main.step( "Verify Ping across all hosts" )
3779 pingResult = main.FALSE
3780 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003781 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3782 if not pingResult:
3783 main.log.info( "First pingall failed. Retrying..." )
3784 time1 = time.time()
3785 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003786 time2 = time.time()
3787 timeDiff = round( ( time2 - time1 ), 2 )
3788 main.log.report(
3789 "Time taken for Ping All: " +
3790 str( timeDiff ) +
3791 " seconds" )
3792
GlennRCbddd58f2015-10-01 15:45:25 -07003793 caseResult = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003794 utilities.assert_equals(
3795 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003796 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003797 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3798 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3799
Hari Krishna4223dbd2015-08-13 16:29:53 -07003800 def CASE190( self ):
3801 """
3802 Verify IPv6 ping across 600 Point intents (Att Topology)
3803 """
3804 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3805 main.log.report( "_________________________________________________" )
3806 import itertools
3807 import time
3808 main.case( "IPv6 ping all 600 Point intents" )
3809 main.step( "Verify IPv6 Ping across all hosts" )
3810 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3811 pingResult = main.FALSE
3812 time1 = time.time()
3813 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003814 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003815 main.log.warn("First pingall failed. Retrying...")
3816 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003817 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3818
Hari Krishna4223dbd2015-08-13 16:29:53 -07003819 time2 = time.time()
3820 timeDiff = round( ( time2 - time1 ), 2 )
3821 main.log.report(
3822 "Time taken for IPv6 Ping All: " +
3823 str( timeDiff ) +
3824 " seconds" )
3825 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3826 onpass="PING ALL PASS",
3827 onfail="PING ALL FAIL" )
3828
GlennRCbddd58f2015-10-01 15:45:25 -07003829 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003830 utilities.assert_equals(
3831 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003832 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003833 onpass="IPv6 Ping across 600 Point intents test PASS",
3834 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3835
3836 def CASE191( self ):
3837 """
3838 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3839 """
3840 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3841 main.log.report( "_________________________________________________" )
3842 import itertools
3843 import time
3844 main.case( "IPv6 ping all 600 Point intents" )
3845 main.step( "Verify IPv6 Ping across all hosts" )
3846 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3847 pingResult = main.FALSE
3848 time1 = time.time()
3849 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003850 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003851 main.log.warn("First pingall failed. Retrying...")
3852 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003853 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003854
Hari Krishna4223dbd2015-08-13 16:29:53 -07003855 time2 = time.time()
3856 timeDiff = round( ( time2 - time1 ), 2 )
3857 main.log.report(
3858 "Time taken for IPv6 Ping All: " +
3859 str( timeDiff ) +
3860 " seconds" )
3861 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3862 onpass="PING ALL PASS",
3863 onfail="PING ALL FAIL" )
3864
GlennRCbddd58f2015-10-01 15:45:25 -07003865 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003866 utilities.assert_equals(
3867 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003868 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003869 onpass="IPv6 Ping across 600 Point intents test PASS",
3870 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3871
3872 def CASE192( self ):
3873 """
3874 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3875 """
3876 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3877 main.log.report( "_________________________________________________" )
3878 import itertools
3879 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003880 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003881 main.step( "Verify IPv6 Ping across all hosts" )
3882 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3883 pingResult = main.FALSE
3884 time1 = time.time()
3885 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003886 if not pingResult:
3887 main.log.warn("First pingall failed. Retrying...")
3888 time1 = time.time()
3889 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3890
Hari Krishna4223dbd2015-08-13 16:29:53 -07003891 time2 = time.time()
3892 timeDiff = round( ( time2 - time1 ), 2 )
3893 main.log.report(
3894 "Time taken for IPv6 Ping All: " +
3895 str( timeDiff ) +
3896 " seconds" )
3897 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3898 onpass="PING ALL PASS",
3899 onfail="PING ALL FAIL" )
3900
GlennRCbddd58f2015-10-01 15:45:25 -07003901 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003902 utilities.assert_equals(
3903 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003904 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003905 onpass="IPv6 Ping across 4556 Point intents test PASS",
3906 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003907
Hari Krishnac195f3b2015-07-08 20:02:24 -07003908 def CASE10( self ):
3909 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003910 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003911 """
3912 Remove all Intents
3913 """
3914 main.log.report( "Remove all intents that were installed previously" )
3915 main.log.report( "______________________________________________" )
3916 main.log.info( "Remove all intents" )
3917 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003918 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003919 main.step( "Obtain the intent id's first" )
3920 intentsList = main.ONOScli1.getAllIntentIds()
3921 ansi_escape = re.compile( r'\x1b[^m]*m' )
3922 intentsList = ansi_escape.sub( '', intentsList )
3923 intentsList = intentsList.replace(
3924 " onos:intents | grep id=",
3925 "" ).replace(
3926 "id=",
3927 "" ).replace(
3928 "\r\r",
3929 "" )
3930 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003931 intentIdList = []
3932 step1Result = main.TRUE
3933 moreIntents = main.TRUE
3934 removeIntentCount = 0
3935 intentsCount = len(intentsList)
3936 main.log.info ( "Current number of intents: " + str(intentsCount) )
3937 if ( len( intentsList ) > 1 ):
3938 results = main.TRUE
3939 main.log.info("Removing intent...")
3940 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003941 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003942 if removeIntentCount == 5:
3943 break
3944 removeIntentCount = removeIntentCount + 1
3945 intentsList1 = main.ONOScli1.getAllIntentIds()
3946 if len( intentsList1 ) == 0:
3947 break
3948 ansi_escape = re.compile( r'\x1b[^m]*m' )
3949 intentsList1 = ansi_escape.sub( '', intentsList1 )
3950 intentsList1 = intentsList1.replace(
3951 " onos:intents | grep id=",
3952 "" ).replace(
3953 " state=",
3954 "" ).replace(
3955 "\r\r",
3956 "" )
3957 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003958 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3959 print intentsList1
3960 intentIdList1 = []
3961 if ( len( intentsList1 ) > 0 ):
3962 moreIntents = main.TRUE
3963 for i in range( len( intentsList1 ) ):
3964 intentsTemp1 = intentsList1[ i ].split( ',' )
3965 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3966 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3967 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3968 time1 = time.time()
3969 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3970 pool = []
3971 for cli in main.CLIs:
3972 if i >= len( intentIdList1 ):
3973 break
3974 t = main.Thread( target=cli.removeIntent,
3975 threadID=main.threadID,
3976 name="removeIntent",
3977 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3978 pool.append(t)
3979 t.start()
3980 i = i + 1
3981 main.threadID = main.threadID + 1
3982 for thread in pool:
3983 thread.join()
3984 intentIdList.append(thread.result)
3985 #time.sleep(2)
3986 time2 = time.time()
3987 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003988 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003989 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003990 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003991 else:
3992 time.sleep(10)
3993 if len( main.ONOScli1.intents()):
3994 continue
3995 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003996 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003997 else:
3998 print "Removed %d intents" %(intentsCount)
3999 step1Result = main.TRUE
4000 else:
4001 print "No Intent IDs found in Intents list: ", intentsList
4002 step1Result = main.FALSE
4003
4004 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004005 caseResult = step1Result
4006 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004007 onpass="Intent removal test successful",
4008 onfail="Intent removal test failed" )
4009
4010 def CASE12( self, main ):
4011 """
4012 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4013 """
4014 import re
4015 import copy
4016 import time
4017
Hari Krishnac195f3b2015-07-08 20:02:24 -07004018 threadID = 0
4019
4020 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4021 main.log.report( "_____________________________________________________" )
4022 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4023 main.step( "Enable intent based Reactive forwarding" )
4024 installResult = main.FALSE
4025 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004026
Hari Krishnac195f3b2015-07-08 20:02:24 -07004027 pool = []
4028 time1 = time.time()
4029 for cli,feature in main.CLIs:
4030 t = main.Thread(target=cli,threadID=threadID,
4031 name="featureInstall",args=[feature])
4032 pool.append(t)
4033 t.start()
4034 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004035
Hari Krishnac195f3b2015-07-08 20:02:24 -07004036 results = []
4037 for thread in pool:
4038 thread.join()
4039 results.append(thread.result)
4040 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004041
Hari Krishnac195f3b2015-07-08 20:02:24 -07004042 if( all(result == main.TRUE for result in results) == False):
4043 main.log.info("Did not install onos-app-ifwd feature properly")
4044 #main.cleanup()
4045 #main.exit()
4046 else:
4047 main.log.info("Successful feature:install onos-app-ifwd")
4048 installResult = main.TRUE
4049 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004050
Hari Krishnac195f3b2015-07-08 20:02:24 -07004051 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07004052 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07004053 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07004054 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004055 time2 = time.time()
4056 timeDiff = round( ( time2 - time1 ), 2 )
4057 main.log.report(
4058 "Time taken for Ping All: " +
4059 str( timeDiff ) +
4060 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004061
GlennRC626ba132015-09-18 16:16:31 -07004062 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004063 main.log.report( "Pingall Test in Reactive mode successful" )
4064 else:
4065 main.log.report( "Pingall Test in Reactive mode failed" )
4066
4067 main.step( "Disable Intent based Reactive forwarding" )
4068 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004069
Hari Krishnac195f3b2015-07-08 20:02:24 -07004070 pool = []
4071 time1 = time.time()
4072 for cli,feature in main.CLIs:
4073 t = main.Thread(target=cli,threadID=threadID,
4074 name="featureUninstall",args=[feature])
4075 pool.append(t)
4076 t.start()
4077 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004078
Hari Krishnac195f3b2015-07-08 20:02:24 -07004079 results = []
4080 for thread in pool:
4081 thread.join()
4082 results.append(thread.result)
4083 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004084
Hari Krishnac195f3b2015-07-08 20:02:24 -07004085 if( all(result == main.TRUE for result in results) == False):
4086 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4087 uninstallResult = main.FALSE
4088 #main.cleanup()
4089 #main.exit()
4090 else:
4091 main.log.info("Successful feature:uninstall onos-app-ifwd")
4092 uninstallResult = main.TRUE
4093 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4094
4095 # Waiting for reative flows to be cleared.
4096 time.sleep( 10 )
4097
GlennRCbddd58f2015-10-01 15:45:25 -07004098 caseResult = installResult and pingResult and uninstallResult
4099 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004100 onpass="Intent based Reactive forwarding Pingall test PASS",
4101 onfail="Intent based Reactive forwarding Pingall test FAIL" )