blob: ffc67eb046de84f7cc7db0ea73489804b37e3539 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
30 main.pingTimeout = 300
31 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070032 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
33 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070034 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070036 main.newTopo = ""
37 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070038
39 for i in range( 1, int(main.numCtrls) + 1 ):
40 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070041
42 main.case( "Set up test environment" )
43 main.log.report( "Set up test environment" )
44 main.log.report( "_______________________" )
45
Hari Krishna6185fc12015-07-13 15:42:31 -070046 main.step( "Apply Cell environment for ONOS" )
47 if ( main.onoscell ):
48 cellName = main.onoscell
49 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070050 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
51 onpass="Test step PASS",
52 onfail="Test step FAIL" )
53 else:
54 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
55 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
56 main.clean()
57 main.exit()
58
Hari Krishnac195f3b2015-07-08 20:02:24 -070059 main.step( "Git checkout and pull " + git_branch )
60 if git_pull == 'on':
61 checkout_result = main.ONOSbench.gitCheckout( git_branch )
62 pull_result = main.ONOSbench.gitPull()
63 cp_result = ( checkout_result and pull_result )
64 else:
65 checkout_result = main.TRUE
66 pull_result = main.TRUE
67 main.log.info( "Skipped git checkout and pull" )
68 cp_result = ( checkout_result and pull_result )
69 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
70 onpass="Test step PASS",
71 onfail="Test step FAIL" )
72
73 main.step( "mvn clean & install" )
74 if git_pull == 'on':
75 mvn_result = main.ONOSbench.cleanInstall()
76 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
77 onpass="Test step PASS",
78 onfail="Test step FAIL" )
79 else:
80 mvn_result = main.TRUE
81 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
82
83 main.ONOSbench.getVersion( report=True )
84
Hari Krishnac195f3b2015-07-08 20:02:24 -070085 main.step( "Create ONOS package" )
86 packageResult = main.ONOSbench.onosPackage()
87 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
88 onpass="Test step PASS",
89 onfail="Test step FAIL" )
90
91 main.step( "Uninstall ONOS package on all Nodes" )
92 uninstallResult = main.TRUE
93 for i in range( int( main.numCtrls ) ):
94 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
95 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
96 utilities.assert_equals( expect=main.TRUE, actual=u_result,
97 onpass="Test step PASS",
98 onfail="Test step FAIL" )
99 uninstallResult = ( uninstallResult and u_result )
100
101 main.step( "Install ONOS package on all Nodes" )
102 installResult = main.TRUE
103 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700104 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700105 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
106 utilities.assert_equals( expect=main.TRUE, actual=i_result,
107 onpass="Test step PASS",
108 onfail="Test step FAIL" )
109 installResult = ( installResult and i_result )
110
111 main.step( "Verify ONOS nodes UP status" )
112 statusResult = main.TRUE
113 for i in range( int( main.numCtrls ) ):
114 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
115 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
116 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
117 onpass="Test step PASS",
118 onfail="Test step FAIL" )
119 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700120
Hari Krishnac195f3b2015-07-08 20:02:24 -0700121 main.step( "Start ONOS CLI on all nodes" )
122 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700123 main.log.step(" Start ONOS cli using thread ")
124 startCliResult = main.TRUE
125 pool = []
126 time1 = time.time()
127 for i in range( int( main.numCtrls) ):
128 t = main.Thread( target=main.CLIs[i].startOnosCli,
129 threadID=main.threadID,
130 name="startOnosCli",
131 args=[ main.onosIPs[i], karafTimeout ] )
132 pool.append(t)
133 t.start()
134 main.threadID = main.threadID + 1
135 for t in pool:
136 t.join()
137 startCliResult = startCliResult and t.result
138 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700139
Hari Krishnac195f3b2015-07-08 20:02:24 -0700140 if not startCliResult:
141 main.log.info("ONOS CLI did not start up properly")
142 main.cleanup()
143 main.exit()
144 else:
145 main.log.info("Successful CLI startup")
146 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700147
148 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
149 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
150 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
151 cfgResult = cfgResult1 and cfgResult2
152 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
153 onpass="ipv6NeighborDiscovery cfg is set to true",
154 onfail="Failed to cfg set ipv6NeighborDiscovery" )
155
156 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700157 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
158 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
159 onpass="Set up test environment PASS",
160 onfail="Set up test environment FAIL" )
161
162 def CASE20( self, main ):
163 """
164 This test script Loads a new Topology (Att) on CHO setup and balances all switches
165 """
166 import re
167 import time
168 import copy
169
170 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
171 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
172 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
173 main.pingTimeout = 300
174 main.log.report(
175 "Load Att topology and Balance all Mininet switches across controllers" )
176 main.log.report(
177 "________________________________________________________________________" )
178 main.case(
179 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700180
Hari Krishnac195f3b2015-07-08 20:02:24 -0700181 main.step( "Stop any previous Mininet network topology" )
182 cliResult = main.TRUE
183 if main.newTopo == main.params['TOPO3']['topo']:
184 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
185
186 main.step( "Start Mininet with Att topology" )
187 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700188 mininetDir = main.Mininet1.home + "/custom/"
189 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
190 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
191 topoPath = mininetDir + main.newTopo
192 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700193
Hari Krishnac195f3b2015-07-08 20:02:24 -0700194 main.step( "Assign switches to controllers" )
195 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
196 main.Mininet1.assignSwController(
197 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700198 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700199
200 switch_mastership = main.TRUE
201 for i in range( 1, ( main.numMNswitches + 1 ) ):
202 response = main.Mininet1.getSwController( "s" + str( i ) )
203 print( "Response is " + str( response ) )
204 if re.search( "tcp:" + main.onosIPs[0], response ):
205 switch_mastership = switch_mastership and main.TRUE
206 else:
207 switch_mastership = main.FALSE
208
209 if switch_mastership == main.TRUE:
210 main.log.report( "Controller assignment successfull" )
211 else:
212 main.log.report( "Controller assignment failed" )
213
214 time.sleep(30) # waiting here to make sure topology converges across all nodes
215
216 main.step( "Balance devices across controllers" )
217 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700218 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700219 time.sleep( 5 )
220
221 topology_output = main.ONOScli1.topology()
222 topology_result = main.ONOSbench.getTopology( topology_output )
223 case2Result = ( switch_mastership and startStatus )
224 utilities.assert_equals(
225 expect=main.TRUE,
226 actual=case2Result,
227 onpass="Starting new Att topology test PASS",
228 onfail="Starting new Att topology test FAIL" )
229
230 def CASE21( self, main ):
231 """
232 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
233 """
234 import re
235 import time
236 import copy
237
238 main.newTopo = main.params['TOPO2']['topo']
239 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
240 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
241 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
242 main.pingTimeout = 300
243 main.log.report(
244 "Load Chordal topology and Balance all Mininet switches across controllers" )
245 main.log.report(
246 "________________________________________________________________________" )
247 main.case(
248 "Assign and Balance all Mininet switches across controllers" )
249
250 main.step( "Stop any previous Mininet network topology" )
251 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
252
GlennRCc6cd2a62015-08-10 16:08:22 -0700253 main.step("Start Mininet with Chordal topology")
254 mininetDir = main.Mininet1.home + "/custom/"
255 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
256 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
257 topoPath = mininetDir + main.newTopo
258 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700259
260 main.step( "Assign switches to controllers" )
261
262 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
263 main.Mininet1.assignSwController(
264 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700265 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700266
267 switch_mastership = main.TRUE
268 for i in range( 1, ( main.numMNswitches + 1 ) ):
269 response = main.Mininet1.getSwController( "s" + str( i ) )
270 print( "Response is " + str( response ) )
271 if re.search( "tcp:" + main.onosIPs[0], response ):
272 switch_mastership = switch_mastership and main.TRUE
273 else:
274 switch_mastership = main.FALSE
275
276 if switch_mastership == main.TRUE:
277 main.log.report( "Controller assignment successfull" )
278 else:
279 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700280
Hari Krishnac195f3b2015-07-08 20:02:24 -0700281 main.step( "Balance devices across controllers" )
282 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700283 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700284 time.sleep( 5 )
285
286 case21Result = switch_mastership
287 time.sleep(30)
288 utilities.assert_equals(
289 expect=main.TRUE,
290 actual=case21Result,
291 onpass="Starting new Chordal topology test PASS",
292 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700293
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 def CASE22( self, main ):
295 """
296 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
297 """
298 import re
299 import time
300 import copy
301
302 main.newTopo = main.params['TOPO3']['topo']
303 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
304 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
305 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
306 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700307
Hari Krishnac195f3b2015-07-08 20:02:24 -0700308 main.log.report(
309 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
310 main.log.report(
311 "________________________________________________________________________" )
312 main.case(
313 "Assign and Balance all Mininet switches across controllers" )
314 main.step( "Stop any previous Mininet network topology" )
315 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700316
317 main.step("Start Mininet with Spine topology")
318 mininetDir = main.Mininet1.home + "/custom/"
319 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
320 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
321 topoPath = mininetDir + main.newTopo
322 startStatus = main.Mininet1.startNet(topoFile = topoPath)
323
Hari Krishnac195f3b2015-07-08 20:02:24 -0700324 time.sleep(60)
325 main.step( "Assign switches to controllers" )
326
327 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
328 main.Mininet1.assignSwController(
329 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700330 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700331
332 switch_mastership = main.TRUE
333 for i in range( 1, ( main.numMNswitches + 1 ) ):
334 response = main.Mininet1.getSwController( "s" + str( i ) )
335 print( "Response is " + str( response ) )
336 if re.search( "tcp:" + main.onosIPs[0], response ):
337 switch_mastership = switch_mastership and main.TRUE
338 else:
339 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700340
Hari Krishnac195f3b2015-07-08 20:02:24 -0700341 if switch_mastership == main.TRUE:
342 main.log.report( "Controller assignment successfull" )
343 else:
344 main.log.report( "Controller assignment failed" )
345 time.sleep( 5 )
346
347 main.step( "Balance devices across controllers" )
348 for i in range( int( main.numCtrls ) ):
349 balanceResult = main.ONOScli1.balanceMasters()
350 # giving some breathing time for ONOS to complete re-balance
351 time.sleep( 3 )
352
353 case22Result = switch_mastership
354 time.sleep(60)
355 utilities.assert_equals(
356 expect=main.TRUE,
357 actual=case22Result,
358 onpass="Starting new Spine topology test PASS",
359 onfail="Starting new Spine topology test FAIL" )
360
361 def CASE3( self, main ):
362 """
363 This Test case will be extended to collect and store more data related
364 ONOS state.
365 """
366 import re
367 import copy
368 main.deviceDPIDs = []
369 main.hostMACs = []
370 main.deviceLinks = []
371 main.deviceActiveLinksCount = []
372 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700373
Hari Krishnac195f3b2015-07-08 20:02:24 -0700374 main.log.report(
375 "Collect and Store topology details from ONOS before running any Tests" )
376 main.log.report(
377 "____________________________________________________________________" )
378 main.case( "Collect and Store Topology Details from ONOS" )
379 main.step( "Collect and store current number of switches and links" )
380 topology_output = main.ONOScli1.topology()
381 topology_result = main.ONOSbench.getTopology( topology_output )
382 numOnosDevices = topology_result[ 'devices' ]
383 numOnosLinks = topology_result[ 'links' ]
384 topoResult = main.TRUE
385
386 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
387 main.step( "Store Device DPIDs" )
388 for i in range( 1, (main.numMNswitches+1) ):
389 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
390 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
391
392 main.step( "Store Host MACs" )
393 for i in range( 1, ( main.numMNhosts + 1 ) ):
394 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
395 print "Host MACs in Store: \n", str( main.hostMACs )
396 main.MACsDict = {}
397 print "Creating dictionary of DPID and HostMacs"
398 for i in range(len(main.hostMACs)):
399 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
400 print main.MACsDict
401 main.step( "Collect and store all Devices Links" )
402 linksResult = main.ONOScli1.links( jsonFormat=False )
403 ansi_escape = re.compile( r'\x1b[^m]*m' )
404 linksResult = ansi_escape.sub( '', linksResult )
405 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
406 linksResult = linksResult.splitlines()
407 main.deviceLinks = copy.copy( linksResult )
408 print "Device Links Stored: \n", str( main.deviceLinks )
409 # this will be asserted to check with the params provided count of
410 # links
411 print "Length of Links Store", len( main.deviceLinks )
412
413 main.step( "Collect and store each Device ports enabled Count" )
414 time1 = time.time()
415 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
416 pool = []
417 for cli in main.CLIs:
418 if i >= main.numMNswitches + 1:
419 break
420 dpid = "of:00000000000000" + format( i,'02x' )
421 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
422 t.start()
423 pool.append(t)
424 i = i + 1
425 main.threadID = main.threadID + 1
426 for thread in pool:
427 thread.join()
428 portResult = thread.result
429 main.devicePortsEnabledCount.append( portResult )
430 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
431 time2 = time.time()
432 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
433
434 main.step( "Collect and store each Device active links Count" )
435 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700436
Hari Krishnac195f3b2015-07-08 20:02:24 -0700437 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
438 pool = []
439 for cli in main.CLIs:
440 if i >= main.numMNswitches + 1:
441 break
442 dpid = "of:00000000000000" + format( i,'02x' )
443 t = main.Thread( target = cli.getDeviceLinksActiveCount,
444 threadID = main.threadID,
445 name = "getDevicePortsEnabledCount",
446 args = [dpid])
447 t.start()
448 pool.append(t)
449 i = i + 1
450 main.threadID = main.threadID + 1
451 for thread in pool:
452 thread.join()
453 linkCountResult = thread.result
454 main.deviceActiveLinksCount.append( linkCountResult )
455 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
456 time2 = time.time()
457 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
458
459 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700460 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700461 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
462 main.log.info("Devices (actual): %s, Links (actual): %s" %
463 ( numOnosDevices , numOnosLinks ) )
464 main.log.info("Topology does not match, exiting CHO test...")
465 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700466 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700467 main.cleanup()
468 main.exit()
469
470 # just returning TRUE for now as this one just collects data
471 case3Result = topoResult
472 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
473 onpass="Saving ONOS topology data test PASS",
474 onfail="Saving ONOS topology data test FAIL" )
475
476 def CASE40( self, main ):
477 """
478 Verify Reactive forwarding (Att Topology)
479 """
480 import re
481 import copy
482 import time
483 main.log.report( "Verify Reactive forwarding (Att Topology)" )
484 main.log.report( "______________________________________________" )
485 main.case( "Enable Reactive forwarding and Verify ping all" )
486 main.step( "Enable Reactive forwarding" )
487 installResult = main.TRUE
488 # Activate fwd app
489 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
490 appCheck = main.TRUE
491 pool = []
492 for cli in main.CLIs:
493 t = main.Thread( target=cli.appToIDCheck,
494 name="appToIDCheck-" + str( i ),
495 args=[] )
496 pool.append( t )
497 t.start()
498 for t in pool:
499 t.join()
500 appCheck = appCheck and t.result
501 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
502 onpass="App Ids seem to be correct",
503 onfail="Something is wrong with app Ids" )
504 if appCheck != main.TRUE:
505 main.log.warn( main.CLIs[0].apps() )
506 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700507
Hari Krishnac195f3b2015-07-08 20:02:24 -0700508 time.sleep( 10 )
509
510 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700511 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700512 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700513 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
514 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700515 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700516 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700517 time2 = time.time()
518 timeDiff = round( ( time2 - time1 ), 2 )
519 main.log.report(
520 "Time taken for Ping All: " +
521 str( timeDiff ) +
522 " seconds" )
523
GlennRC626ba132015-09-18 16:16:31 -0700524 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700525 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700526 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700527 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700528
GlennRC626ba132015-09-18 16:16:31 -0700529 case40Result = appCheck and pingResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700530 utilities.assert_equals( expect=main.TRUE, actual=case40Result,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700531 onpass="Reactive Mode IPv4 Pingall test PASS",
532 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700533
534 def CASE41( self, main ):
535 """
536 Verify Reactive forwarding (Chordal Topology)
537 """
538 import re
539 import copy
540 import time
541 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
542 main.log.report( "______________________________________________" )
543 main.case( "Enable Reactive forwarding and Verify ping all" )
544 main.step( "Enable Reactive forwarding" )
545 installResult = main.TRUE
546 # Activate fwd app
547 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
548
549 appCheck = main.TRUE
550 pool = []
551 for cli in main.CLIs:
552 t = main.Thread( target=cli.appToIDCheck,
553 name="appToIDCheck-" + str( i ),
554 args=[] )
555 pool.append( t )
556 t.start()
557 for t in pool:
558 t.join()
559 appCheck = appCheck and t.result
560 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
561 onpass="App Ids seem to be correct",
562 onfail="Something is wrong with app Ids" )
563 if appCheck != main.TRUE:
564 main.log.warn( main.CLIs[0].apps() )
565 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700566
Hari Krishnac195f3b2015-07-08 20:02:24 -0700567 time.sleep( 10 )
568
569 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700570 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700571 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700572 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
573 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700574 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700575 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700576 time2 = time.time()
577 timeDiff = round( ( time2 - time1 ), 2 )
578 main.log.report(
579 "Time taken for Ping All: " +
580 str( timeDiff ) +
581 " seconds" )
582
GlennRC626ba132015-09-18 16:16:31 -0700583 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700584 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700585 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700586 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700587
GlennRC626ba132015-09-18 16:16:31 -0700588 case41Result = appCheck and pingResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700589 utilities.assert_equals( expect=main.TRUE, actual=case41Result,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700590 onpass="Reactive Mode IPv4 Pingall test PASS",
591 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700592
593 def CASE42( self, main ):
594 """
595 Verify Reactive forwarding (Spine Topology)
596 """
597 import re
598 import copy
599 import time
600 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
601 main.log.report( "______________________________________________" )
602 main.case( "Enable Reactive forwarding and Verify ping all" )
603 main.step( "Enable Reactive forwarding" )
604 installResult = main.TRUE
605 # Activate fwd app
606 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
607
608 appCheck = main.TRUE
609 pool = []
610 for cli in main.CLIs:
611 t = main.Thread( target=cli.appToIDCheck,
612 name="appToIDCheck-" + str( i ),
613 args=[] )
614 pool.append( t )
615 t.start()
616 for t in pool:
617 t.join()
618 appCheck = appCheck and t.result
619 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
620 onpass="App Ids seem to be correct",
621 onfail="Something is wrong with app Ids" )
622 if appCheck != main.TRUE:
623 main.log.warn( main.CLIs[0].apps() )
624 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700625
Hari Krishnac195f3b2015-07-08 20:02:24 -0700626 time.sleep( 10 )
627
628 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700629 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700630 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700631 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
632 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700633 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700634 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700635 time2 = time.time()
636 timeDiff = round( ( time2 - time1 ), 2 )
637 main.log.report(
638 "Time taken for Ping All: " +
639 str( timeDiff ) +
640 " seconds" )
641
GlennRC626ba132015-09-18 16:16:31 -0700642 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700643 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700644 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700645 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
646
GlennRC626ba132015-09-18 16:16:31 -0700647 case42Result = appCheck and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700648 utilities.assert_equals( expect=main.TRUE, actual=case42Result,
649 onpass="Reactive Mode IPv4 Pingall test PASS",
650 onfail="Reactive Mode IPv4 Pingall test FAIL" )
651
652 def CASE140( self, main ):
653 """
654 Verify IPv6 Reactive forwarding (Att Topology)
655 """
656 import re
657 import copy
658 import time
659 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
660 main.log.report( "______________________________________________" )
661 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
662 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
663
664 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
665 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
666 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
667 cfgResult = cfgResult1 and cfgResult2
668 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
669 onpass="Reactive mode ipv6Fowarding cfg is set to true",
670 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
671
672 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700673 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700674 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700675 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
676 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700677 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700678 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700679 time2 = time.time()
680 timeDiff = round( ( time2 - time1 ), 2 )
681 main.log.report(
682 "Time taken for IPv6 Ping All: " +
683 str( timeDiff ) +
684 " seconds" )
685
GlennRC626ba132015-09-18 16:16:31 -0700686 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700687 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
688 else:
689 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700690
691 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700692
Hari Krishnac195f3b2015-07-08 20:02:24 -0700693 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700694 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700695 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
696 pool = []
697 for cli in main.CLIs:
698 t = main.Thread( target=cli.appToIDCheck,
699 name="appToIDCheck-" + str( i ),
700 args=[] )
701 pool.append( t )
702 t.start()
703
704 for t in pool:
705 t.join()
706 appCheck = appCheck and t.result
707 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
708 onpass="App Ids seem to be correct",
709 onfail="Something is wrong with app Ids" )
710 if appCheck != main.TRUE:
711 main.log.warn( main.CLIs[0].apps() )
712 main.log.warn( main.CLIs[0].appIDs() )
713
714 # Waiting for reative flows to be cleared.
715 time.sleep( 30 )
GlennRC626ba132015-09-18 16:16:31 -0700716 case140Result = appCheck and cfgResult and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700717 utilities.assert_equals( expect=main.TRUE, actual=case140Result,
718 onpass="Reactive Mode IPv6 Pingall test PASS",
719 onfail="Reactive Mode IPv6 Pingall test FAIL" )
720
721 def CASE141( self, main ):
722 """
723 Verify IPv6 Reactive forwarding (Chordal Topology)
724 """
725 import re
726 import copy
727 import time
728 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
729 main.log.report( "______________________________________________" )
730 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
731 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
732
733 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
734 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
735 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
736 cfgResult = cfgResult1 and cfgResult2
737 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
738 onpass="Reactive mode ipv6Fowarding cfg is set to true",
739 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
740
741 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700742 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700743 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700744 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
745 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700746 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700747 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700748 time2 = time.time()
749 timeDiff = round( ( time2 - time1 ), 2 )
750 main.log.report(
751 "Time taken for IPv6 Ping All: " +
752 str( timeDiff ) +
753 " seconds" )
754
GlennRC626ba132015-09-18 16:16:31 -0700755 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700756 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
757 else:
758 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
759
760 main.step( "Disable Reactive forwarding" )
761
762 main.log.info( "Uninstall reactive forwarding app" )
763 appCheck = main.TRUE
764 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
765 pool = []
766 for cli in main.CLIs:
767 t = main.Thread( target=cli.appToIDCheck,
768 name="appToIDCheck-" + str( i ),
769 args=[] )
770 pool.append( t )
771 t.start()
772
773 for t in pool:
774 t.join()
775 appCheck = appCheck and t.result
776 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
777 onpass="App Ids seem to be correct",
778 onfail="Something is wrong with app Ids" )
779 if appCheck != main.TRUE:
780 main.log.warn( main.CLIs[0].apps() )
781 main.log.warn( main.CLIs[0].appIDs() )
782
783 # Waiting for reative flows to be cleared.
784 time.sleep( 30 )
GlennRC626ba132015-09-18 16:16:31 -0700785 case140Result = appCheck and cfgResult and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700786 utilities.assert_equals( expect=main.TRUE, actual=case140Result,
787 onpass="Reactive Mode IPv6 Pingall test PASS",
788 onfail="Reactive Mode IPv6 Pingall test FAIL" )
789
790 def CASE142( self, main ):
791 """
792 Verify IPv6 Reactive forwarding (Spine Topology)
793 """
794 import re
795 import copy
796 import time
797 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
798 main.log.report( "______________________________________________" )
799 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
800 # Spine topology do not have hosts h1-h10
801 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
802 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
803 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
804 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
805 cfgResult = cfgResult1 and cfgResult2
806 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
807 onpass="Reactive mode ipv6Fowarding cfg is set to true",
808 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
809
810 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700811 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700812 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -0700813 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
814 if not ping_result:
815 main.log.warn("First pingall failed. Trying again...")
816 ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700817 time2 = time.time()
818 timeDiff = round( ( time2 - time1 ), 2 )
819 main.log.report(
820 "Time taken for IPv6 Ping All: " +
821 str( timeDiff ) +
822 " seconds" )
823
GlennRC626ba132015-09-18 16:16:31 -0700824 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700825 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
826 else:
827 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
828
829 main.step( "Disable Reactive forwarding" )
830
831 main.log.info( "Uninstall reactive forwarding app" )
832 appCheck = main.TRUE
833 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
834 pool = []
835 for cli in main.CLIs:
836 t = main.Thread( target=cli.appToIDCheck,
837 name="appToIDCheck-" + str( i ),
838 args=[] )
839 pool.append( t )
840 t.start()
841
842 for t in pool:
843 t.join()
844 appCheck = appCheck and t.result
845 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
846 onpass="App Ids seem to be correct",
847 onfail="Something is wrong with app Ids" )
848 if appCheck != main.TRUE:
849 main.log.warn( main.CLIs[0].apps() )
850 main.log.warn( main.CLIs[0].appIDs() )
851
852 # Waiting for reative flows to be cleared.
853 time.sleep( 30 )
GlennRC626ba132015-09-18 16:16:31 -0700854 case142Result = appCheck and cfgResult and pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -0700855 utilities.assert_equals( expect=main.TRUE, actual=case142Result,
856 onpass="Reactive Mode IPv6 Pingall test PASS",
857 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700858
859 def CASE5( self, main ):
860 """
861 Compare current ONOS topology with reference data
862 """
863 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700864
Hari Krishnac195f3b2015-07-08 20:02:24 -0700865 devicesDPIDTemp = []
866 hostMACsTemp = []
867 deviceLinksTemp = []
868 deviceActiveLinksCountTemp = []
869 devicePortsEnabledCountTemp = []
870
871 main.log.report(
872 "Compare ONOS topology with reference data in Stores" )
873 main.log.report( "__________________________________________________" )
874 main.case( "Compare ONOS topology with reference data" )
875
876 main.step( "Compare current Device ports enabled with reference" )
877 time1 = time.time()
878 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
879 pool = []
880 for cli in main.CLIs:
881 if i >= main.numMNswitches + 1:
882 break
883 dpid = "of:00000000000000" + format( i,'02x' )
884 t = main.Thread(target = cli.getDevicePortsEnabledCount,
885 threadID = main.threadID,
886 name = "getDevicePortsEnabledCount",
887 args = [dpid])
888 t.start()
889 pool.append(t)
890 i = i + 1
891 main.threadID = main.threadID + 1
892 for thread in pool:
893 thread.join()
894 portResult = thread.result
895 #portTemp = re.split( r'\t+', portResult )
896 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
897 devicePortsEnabledCountTemp.append( portResult )
898
899 time2 = time.time()
900 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
901 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700902 "Device Enabled ports EXPECTED: %s" %
903 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700904 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700905 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700906 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700907
Hari Krishnac195f3b2015-07-08 20:02:24 -0700908 if ( cmp( main.devicePortsEnabledCount,
909 devicePortsEnabledCountTemp ) == 0 ):
910 stepResult1 = main.TRUE
911 else:
912 stepResult1 = main.FALSE
913
914 main.step( "Compare Device active links with reference" )
915 time1 = time.time()
916 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
917 pool = []
918 for cli in main.CLIs:
919 if i >= main.numMNswitches + 1:
920 break
921 dpid = "of:00000000000000" + format( i,'02x' )
922 t = main.Thread(target = cli.getDeviceLinksActiveCount,
923 threadID = main.threadID,
924 name = "getDeviceLinksActiveCount",
925 args = [dpid])
926 t.start()
927 pool.append(t)
928 i = i + 1
929 main.threadID = main.threadID + 1
930 for thread in pool:
931 thread.join()
932 linkCountResult = thread.result
933 #linkCountTemp = re.split( r'\t+', linkCountResult )
934 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
935 deviceActiveLinksCountTemp.append( linkCountResult )
936
937 time2 = time.time()
938 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
939 main.log.info (
940 "Device Active links EXPECTED: %s" %
941 str( main.deviceActiveLinksCount ) )
942 main.log.info (
943 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
944 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
945 stepResult2 = main.TRUE
946 else:
947 stepResult2 = main.FALSE
948
949 """
950 place holder for comparing devices, hosts, paths and intents if required.
951 Links and ports data would be incorrect with out devices anyways.
952 """
953 case5Result = ( stepResult1 and stepResult2 )
954 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
955 onpass="Compare Topology test PASS",
956 onfail="Compare Topology test FAIL" )
957
958 def CASE60( self ):
959 """
960 Install 300 host intents and verify ping all (Att Topology)
961 """
962 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
963 main.log.report( "_______________________________________" )
964 import itertools
965 import time
966 main.case( "Install 300 host intents" )
967 main.step( "Add host Intents" )
968 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700969 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
970
Hari Krishnac195f3b2015-07-08 20:02:24 -0700971 intentIdList = []
972 time1 = time.time()
973 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
974 pool = []
975 for cli in main.CLIs:
976 if i >= len( hostCombos ):
977 break
978 t = main.Thread( target=cli.addHostIntent,
979 threadID=main.threadID,
980 name="addHostIntent",
981 args=[hostCombos[i][0],hostCombos[i][1]])
982 pool.append(t)
983 t.start()
984 i = i + 1
985 main.threadID = main.threadID + 1
986 for thread in pool:
987 thread.join()
988 intentIdList.append(thread.result)
989 time2 = time.time()
990 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
991
GlennRCfcfdc4f2015-09-30 16:01:57 -0700992 # Saving intent ids to check intents in later cases
993 main.intentIds = list(intentIdList)
994
GlennRCa8d786a2015-09-23 17:40:11 -0700995 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700996
GlennRCa8d786a2015-09-23 17:40:11 -0700997 # Giving onos 3 chances to install intents
998 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -0700999 if i != 0:
1000 main.log.warn( "Verification failed. Retrying..." )
1001 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001002 time.sleep( main.checkIntentsDelay )
1003
1004 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001005 for e in range(int(main.numCtrls)):
1006 main.log.info( "Checking intents on CLI %s" % (e+1) )
1007 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1008 intentState
1009 if not intentState:
1010 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001011 if intentState:
1012 break
GlennRCdb2c8422015-09-29 12:21:59 -07001013 else:
1014 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001015 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001016
GlennRCa8d786a2015-09-23 17:40:11 -07001017
1018 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1019 onpass="INTENTS INSTALLED",
1020 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001021
1022 main.step( "Verify Ping across all hosts" )
1023 pingResult = main.FALSE
1024 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001025 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1026 if not pingResult:
1027 main.log.warn("First pingall failed. Retrying...")
1028 time1 = time.time()
1029 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001030 time2 = time.time()
1031 timeDiff = round( ( time2 - time1 ), 2 )
1032 main.log.report(
1033 "Time taken for Ping All: " +
1034 str( timeDiff ) +
1035 " seconds" )
1036 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1037 onpass="PING ALL PASS",
1038 onfail="PING ALL FAIL" )
1039
GlennRCa8d786a2015-09-23 17:40:11 -07001040 case60Result = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001041 utilities.assert_equals(
1042 expect=main.TRUE,
1043 actual=case60Result,
1044 onpass="Install 300 Host Intents and Ping All test PASS",
1045 onfail="Install 300 Host Intents and Ping All test FAIL" )
1046
GlennRCfcfdc4f2015-09-30 16:01:57 -07001047 if not intentState:
1048 main.log.debug( "Intents failed to install completely" )
1049 if not pingResult:
1050 main.log.debug( "Pingall failed" )
1051
Hari Krishnac195f3b2015-07-08 20:02:24 -07001052 def CASE61( self ):
1053 """
1054 Install 600 host intents and verify ping all for Chordal Topology
1055 """
1056 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1057 main.log.report( "_______________________________________" )
1058 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001059
Hari Krishnac195f3b2015-07-08 20:02:24 -07001060 main.case( "Install 600 host intents" )
1061 main.step( "Add host Intents" )
1062 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001063 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1064
Hari Krishnac195f3b2015-07-08 20:02:24 -07001065 intentIdList = []
1066 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001067
Hari Krishnac195f3b2015-07-08 20:02:24 -07001068 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1069 pool = []
1070 for cli in main.CLIs:
1071 if i >= len( hostCombos ):
1072 break
1073 t = main.Thread( target=cli.addHostIntent,
1074 threadID=main.threadID,
1075 name="addHostIntent",
1076 args=[hostCombos[i][0],hostCombos[i][1]])
1077 pool.append(t)
1078 t.start()
1079 i = i + 1
1080 main.threadID = main.threadID + 1
1081 for thread in pool:
1082 thread.join()
1083 intentIdList.append(thread.result)
1084 time2 = time.time()
1085 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001086
GlennRCfcfdc4f2015-09-30 16:01:57 -07001087 # Saving intent ids to check intents in later cases
1088 main.intentIds = list(intentIdList)
1089
GlennRCa8d786a2015-09-23 17:40:11 -07001090 main.step("Verify intents are installed")
1091
1092 # Giving onos 3 chances to install intents
1093 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07001094 if i != 0:
1095 main.log.warn( "Verification failed. Retrying..." )
1096 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001097 time.sleep( main.checkIntentsDelay )
1098
1099 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001100 for e in range(int(main.numCtrls)):
1101 main.log.info( "Checking intents on CLI %s" % (e+1) )
1102 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1103 intentState
1104 if not intentState:
1105 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001106 if intentState:
1107 break
GlennRCdb2c8422015-09-29 12:21:59 -07001108 else:
1109 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001110 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001111
1112 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1113 onpass="INTENTS INSTALLED",
1114 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001115
1116 main.step( "Verify Ping across all hosts" )
1117 pingResult = main.FALSE
1118 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001119 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1120 if not pingResult:
1121 main.log.warn("First pingall failed. Retrying...")
1122 time1 = time.time()
1123 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001124 time2 = time.time()
1125 timeDiff = round( ( time2 - time1 ), 2 )
1126 main.log.report(
1127 "Time taken for Ping All: " +
1128 str( timeDiff ) +
1129 " seconds" )
1130 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1131 onpass="PING ALL PASS",
1132 onfail="PING ALL FAIL" )
1133
GlennRCa8d786a2015-09-23 17:40:11 -07001134 case14Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001135
Hari Krishnac195f3b2015-07-08 20:02:24 -07001136 utilities.assert_equals(
1137 expect=main.TRUE,
1138 actual=case14Result,
1139 onpass="Install 300 Host Intents and Ping All test PASS",
1140 onfail="Install 300 Host Intents and Ping All test FAIL" )
1141
GlennRCfcfdc4f2015-09-30 16:01:57 -07001142 if not intentState:
1143 main.log.debug( "Intents failed to install completely" )
1144 if not pingResult:
1145 main.log.debug( "Pingall failed" )
1146
Hari Krishnac195f3b2015-07-08 20:02:24 -07001147 def CASE62( self ):
1148 """
1149 Install 2278 host intents and verify ping all for Spine Topology
1150 """
1151 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1152 main.log.report( "_______________________________________" )
1153 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001154
Hari Krishnac195f3b2015-07-08 20:02:24 -07001155 main.case( "Install 2278 host intents" )
1156 main.step( "Add host Intents" )
1157 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001158 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001159 main.pingTimeout = 300
1160 intentIdList = []
1161 time1 = time.time()
1162 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1163 pool = []
1164 for cli in main.CLIs:
1165 if i >= len( hostCombos ):
1166 break
1167 t = main.Thread( target=cli.addHostIntent,
1168 threadID=main.threadID,
1169 name="addHostIntent",
1170 args=[hostCombos[i][0],hostCombos[i][1]])
1171 pool.append(t)
1172 t.start()
1173 i = i + 1
1174 main.threadID = main.threadID + 1
1175 for thread in pool:
1176 thread.join()
1177 intentIdList.append(thread.result)
1178 time2 = time.time()
1179 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001180
GlennRCfcfdc4f2015-09-30 16:01:57 -07001181 # Saving intent ids to check intents in later cases
1182 main.intentIds = list(intentIdList)
1183
GlennRCa8d786a2015-09-23 17:40:11 -07001184 main.step("Verify intents are installed")
1185
GlennRCdb2c8422015-09-29 12:21:59 -07001186 # Giving onos 3 chances to install intents
1187 for i in range(3):
1188 if i != 0:
1189 main.log.warn( "Verification failed. Retrying..." )
1190 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001191 time.sleep( main.checkIntentsDelay )
1192
1193 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001194 for e in range(int(main.numCtrls)):
1195 main.log.info( "Checking intents on CLI %s" % (e+1) )
1196 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1197 intentState
1198 if not intentState:
1199 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001200 if intentState:
1201 break
GlennRCdb2c8422015-09-29 12:21:59 -07001202 else:
1203 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001204 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001205
1206 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1207 onpass="INTENTS INSTALLED",
1208 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001209
1210 main.step( "Verify Ping across all hosts" )
1211 pingResult = main.FALSE
1212 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001213 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1214 if not pingResult:
1215 main.log.warn("First pingall failed. Retrying...")
1216 time1 = time.time()
1217 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001218 time2 = time.time()
1219 timeDiff = round( ( time2 - time1 ), 2 )
1220 main.log.report(
1221 "Time taken for Ping All: " +
1222 str( timeDiff ) +
1223 " seconds" )
1224 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1225 onpass="PING ALL PASS",
1226 onfail="PING ALL FAIL" )
1227
GlennRCa8d786a2015-09-23 17:40:11 -07001228 case15Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001229
Hari Krishnac195f3b2015-07-08 20:02:24 -07001230 utilities.assert_equals(
1231 expect=main.TRUE,
1232 actual=case15Result,
1233 onpass="Install 2278 Host Intents and Ping All test PASS",
1234 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1235
GlennRCfcfdc4f2015-09-30 16:01:57 -07001236 if not intentState:
1237 main.log.debug( "Intents failed to install completely" )
1238 if not pingResult:
1239 main.log.debug( "Pingall failed" )
1240
Hari Krishna4223dbd2015-08-13 16:29:53 -07001241 def CASE160( self ):
1242 """
1243 Verify IPv6 ping across 300 host intents (Att Topology)
1244 """
1245 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1246 main.log.report( "_________________________________________________" )
1247 import itertools
1248 import time
1249 main.case( "IPv6 ping all 300 host intents" )
1250 main.step( "Verify IPv6 Ping across all hosts" )
1251 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1252 pingResult = main.FALSE
1253 time1 = time.time()
1254 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001255 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001256 main.log.warn("First pingall failed. Retrying...")
1257 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001258 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001259 time2 = time.time()
1260 timeDiff = round( ( time2 - time1 ), 2 )
1261 main.log.report(
1262 "Time taken for IPv6 Ping All: " +
1263 str( timeDiff ) +
1264 " seconds" )
1265 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1266 onpass="PING ALL PASS",
1267 onfail="PING ALL FAIL" )
1268
1269 case160Result = pingResult
1270 utilities.assert_equals(
1271 expect=main.TRUE,
1272 actual=case160Result,
1273 onpass="IPv6 Ping across 300 host intents test PASS",
1274 onfail="IPv6 Ping across 300 host intents test FAIL" )
1275
1276 def CASE161( self ):
1277 """
1278 Verify IPv6 ping across 600 host intents (Chordal Topology)
1279 """
1280 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1281 main.log.report( "_________________________________________________" )
1282 import itertools
1283 import time
1284 main.case( "IPv6 ping all 600 host intents" )
1285 main.step( "Verify IPv6 Ping across all hosts" )
1286 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
1287 pingResult = main.FALSE
1288 time1 = time.time()
1289 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001290 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001291 main.log.warn("First pingall failed. Retrying...")
1292 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001293 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001294
Hari Krishna4223dbd2015-08-13 16:29:53 -07001295 time2 = time.time()
1296 timeDiff = round( ( time2 - time1 ), 2 )
1297 main.log.report(
1298 "Time taken for IPv6 Ping All: " +
1299 str( timeDiff ) +
1300 " seconds" )
1301 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1302 onpass="PING ALL PASS",
1303 onfail="PING ALL FAIL" )
1304
1305 case161Result = pingResult
1306 utilities.assert_equals(
1307 expect=main.TRUE,
1308 actual=case161Result,
1309 onpass="IPv6 Ping across 600 host intents test PASS",
1310 onfail="IPv6 Ping across 600 host intents test FAIL" )
1311
1312 def CASE162( self ):
1313 """
1314 Verify IPv6 ping across 2278 host intents (Spine Topology)
1315 """
1316 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1317 main.log.report( "_________________________________________________" )
1318 import itertools
1319 import time
1320 main.case( "IPv6 ping all 600 host intents" )
1321 main.step( "Verify IPv6 Ping across all hosts" )
1322 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
1323 pingResult = main.FALSE
1324 time1 = time.time()
1325 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07001326 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001327 main.log.warn("First pingall failed. Retrying...")
1328 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07001329 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07001330
Hari Krishna4223dbd2015-08-13 16:29:53 -07001331 time2 = time.time()
1332 timeDiff = round( ( time2 - time1 ), 2 )
1333 main.log.report(
1334 "Time taken for IPv6 Ping All: " +
1335 str( timeDiff ) +
1336 " seconds" )
1337 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1338 onpass="PING ALL PASS",
1339 onfail="PING ALL FAIL" )
1340
1341 case162Result = pingResult
1342 utilities.assert_equals(
1343 expect=main.TRUE,
1344 actual=case162Result,
1345 onpass="IPv6 Ping across 600 host intents test PASS",
1346 onfail="IPv6 Ping across 600 host intents test FAIL" )
1347
Hari Krishnac195f3b2015-07-08 20:02:24 -07001348 def CASE70( self, main ):
1349 """
1350 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1351 """
1352 import random
1353 main.randomLink1 = []
1354 main.randomLink2 = []
1355 main.randomLink3 = []
1356 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1357 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1358 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1359 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1360 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1361 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1362 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1363 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1364
1365 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1366 main.log.report( "___________________________________________________________________________" )
1367 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1368 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1369 if ( int( switchLinksToToggle ) ==
1370 0 or int( switchLinksToToggle ) > 5 ):
1371 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1372 #main.cleanup()
1373 #main.exit()
1374 else:
1375 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1376
1377 main.step( "Cut links on Core devices using user provided range" )
1378 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1379 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1380 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1381 for i in range( int( switchLinksToToggle ) ):
1382 main.Mininet1.link(
1383 END1=link1End1,
1384 END2=main.randomLink1[ i ],
1385 OPTION="down" )
1386 time.sleep( link_sleep )
1387 main.Mininet1.link(
1388 END1=link2End1,
1389 END2=main.randomLink2[ i ],
1390 OPTION="down" )
1391 time.sleep( link_sleep )
1392 main.Mininet1.link(
1393 END1=link3End1,
1394 END2=main.randomLink3[ i ],
1395 OPTION="down" )
1396 time.sleep( link_sleep )
1397
Hari Krishna6185fc12015-07-13 15:42:31 -07001398 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001399 linkDown = main.ONOSbench.checkStatus(
1400 topology_output, main.numMNswitches, str(
1401 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1402 utilities.assert_equals(
1403 expect=main.TRUE,
1404 actual=linkDown,
1405 onpass="Link Down discovered properly",
1406 onfail="Link down was not discovered in " +
1407 str( link_sleep ) +
1408 " seconds" )
1409
GlennRCfcfdc4f2015-09-30 16:01:57 -07001410 main.step("Verify intents are installed")
1411 # Checking a maximum of 3
1412 for i in range(3):
1413 if i != 0:
1414 main.log.warn( "Verification failed. Retrying..." )
1415 main.log.info("Giving onos some time...")
1416 time.sleep( main.checkIntentsDelay )
1417
1418 intentState = main.TRUE
1419 for e in range(int(main.numCtrls)):
1420 main.log.info( "Checking intents on CLI %s" % (e+1) )
1421 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1422 intentState
1423 if not intentState:
1424 main.log.warn( "Not all intents installed" )
1425 if intentState:
1426 break
1427 else:
1428 #Dumping intent summary
1429 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1430
1431
1432 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1433 onpass="INTENTS INSTALLED",
1434 onfail="SOME INTENTS NOT INSTALLED" )
1435
Hari Krishnac195f3b2015-07-08 20:02:24 -07001436 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001437 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001438 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001439 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1440 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001441 main.log.warn("First pingall failed. Retrying...")
1442 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001443 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001444
Hari Krishnac195f3b2015-07-08 20:02:24 -07001445 time2 = time.time()
1446 timeDiff = round( ( time2 - time1 ), 2 )
1447 main.log.report(
1448 "Time taken for Ping All: " +
1449 str( timeDiff ) +
1450 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001451 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001452 onpass="PING ALL PASS",
1453 onfail="PING ALL FAIL" )
1454
GlennRCfcfdc4f2015-09-30 16:01:57 -07001455 caseResult70 = linkDown and pingResult and intentState
Hari Krishnac195f3b2015-07-08 20:02:24 -07001456 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
1457 onpass="Random Link cut Test PASS",
1458 onfail="Random Link cut Test FAIL" )
1459
GlennRCfcfdc4f2015-09-30 16:01:57 -07001460 # Printing what exactly failed
1461 if not linkDown:
1462 main.log.debug( "Link down was not discovered correctly" )
1463 if not pingResult:
1464 main.log.debug( "Pingall failed" )
1465 if not intentState:
1466 main.log.debug( "Intents are not all installed" )
1467
Hari Krishnac195f3b2015-07-08 20:02:24 -07001468 def CASE80( self, main ):
1469 """
1470 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1471 """
1472 import random
1473 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1474 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1475 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1476 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1477 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1478
1479 main.log.report(
1480 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1481 main.log.report(
1482 "__________________________________________________________________" )
1483 main.case(
1484 "Host intents - Bring the core links up that are down and verify ping all" )
1485 main.step( "Bring randomly cut links on Core devices up" )
1486 for i in range( int( switchLinksToToggle ) ):
1487 main.Mininet1.link(
1488 END1=link1End1,
1489 END2=main.randomLink1[ i ],
1490 OPTION="up" )
1491 time.sleep( link_sleep )
1492 main.Mininet1.link(
1493 END1=link2End1,
1494 END2=main.randomLink2[ i ],
1495 OPTION="up" )
1496 time.sleep( link_sleep )
1497 main.Mininet1.link(
1498 END1=link3End1,
1499 END2=main.randomLink3[ i ],
1500 OPTION="up" )
1501 time.sleep( link_sleep )
1502
Hari Krishna6185fc12015-07-13 15:42:31 -07001503 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001504 linkUp = main.ONOSbench.checkStatus(
1505 topology_output,
1506 main.numMNswitches,
1507 str( main.numMNlinks ) )
1508 utilities.assert_equals(
1509 expect=main.TRUE,
1510 actual=linkUp,
1511 onpass="Link up discovered properly",
1512 onfail="Link up was not discovered in " +
1513 str( link_sleep ) +
1514 " seconds" )
1515
GlennRCfcfdc4f2015-09-30 16:01:57 -07001516 main.step("Verify intents are installed")
1517 # Checking a maximum of 3
1518 for i in range(3):
1519 if i != 0:
1520 main.log.warn( "Verification failed. Retrying..." )
1521 main.log.info("Giving onos some time...")
1522 time.sleep( main.checkIntentsDelay )
1523
1524 intentState = main.TRUE
1525 for e in range(int(main.numCtrls)):
1526 main.log.info( "Checking intents on CLI %s" % (e+1) )
1527 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1528 intentState
1529 if not intentState:
1530 main.log.warn( "Not all intents installed" )
1531 if intentState:
1532 break
1533 else:
1534 #Dumping intent summary
1535 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1536
1537
1538 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1539 onpass="INTENTS INSTALLED",
1540 onfail="SOME INTENTS NOT INSTALLED" )
1541
Hari Krishnac195f3b2015-07-08 20:02:24 -07001542 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001543 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001544 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001545 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1546 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001547 main.log.warn("First pingall failed. Retrying...")
1548 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001549 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001550
Hari Krishnac195f3b2015-07-08 20:02:24 -07001551 time2 = time.time()
1552 timeDiff = round( ( time2 - time1 ), 2 )
1553 main.log.report(
1554 "Time taken for Ping All: " +
1555 str( timeDiff ) +
1556 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001557 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001558 onpass="PING ALL PASS",
1559 onfail="PING ALL FAIL" )
1560
GlennRCfcfdc4f2015-09-30 16:01:57 -07001561 caseResult80 = linkUp and pingResult
Hari Krishnac195f3b2015-07-08 20:02:24 -07001562 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
1563 onpass="Link Up Test PASS",
1564 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001565 # Printing what exactly failed
1566 if not linkUp:
1567 main.log.debug( "Link down was not discovered correctly" )
1568 if not pingResult:
1569 main.log.debug( "Pingall failed" )
1570 if not intentState:
1571 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001572
1573 def CASE71( self, main ):
1574 """
1575 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1576 """
1577 import random
1578 main.randomLink1 = []
1579 main.randomLink2 = []
1580 main.randomLink3 = []
1581 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1582 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1583 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1584 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1585 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1586 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1587 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1588 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1589
1590 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1591 main.log.report( "___________________________________________________________________________" )
1592 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1593 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1594 if ( int( switchLinksToToggle ) ==
1595 0 or int( switchLinksToToggle ) > 5 ):
1596 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1597 #main.cleanup()
1598 #main.exit()
1599 else:
1600 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1601
1602 main.step( "Cut links on Core devices using user provided range" )
1603 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1604 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1605 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1606 for i in range( int( switchLinksToToggle ) ):
1607 main.Mininet1.link(
1608 END1=link1End1,
1609 END2=main.randomLink1[ i ],
1610 OPTION="down" )
1611 time.sleep( link_sleep )
1612 main.Mininet1.link(
1613 END1=link2End1,
1614 END2=main.randomLink2[ i ],
1615 OPTION="down" )
1616 time.sleep( link_sleep )
1617 main.Mininet1.link(
1618 END1=link3End1,
1619 END2=main.randomLink3[ i ],
1620 OPTION="down" )
1621 time.sleep( link_sleep )
1622
Hari Krishna6185fc12015-07-13 15:42:31 -07001623 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001624 linkDown = main.ONOSbench.checkStatus(
1625 topology_output, main.numMNswitches, str(
1626 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1627 utilities.assert_equals(
1628 expect=main.TRUE,
1629 actual=linkDown,
1630 onpass="Link Down discovered properly",
1631 onfail="Link down was not discovered in " +
1632 str( link_sleep ) +
1633 " seconds" )
1634
GlennRCfcfdc4f2015-09-30 16:01:57 -07001635 main.step("Verify intents are installed")
1636 # Checking a maximum of 3
1637 for i in range(3):
1638 if i != 0:
1639 main.log.warn( "Verification failed. Retrying..." )
1640 main.log.info("Giving onos some time...")
1641 time.sleep( main.checkIntentsDelay )
1642
1643 intentState = main.TRUE
1644 for e in range(int(main.numCtrls)):
1645 main.log.info( "Checking intents on CLI %s" % (e+1) )
1646 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1647 intentState
1648 if not intentState:
1649 main.log.warn( "Not all intents installed" )
1650 if intentState:
1651 break
1652 else:
1653 #Dumping intent summary
1654 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1655
1656
1657 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1658 onpass="INTENTS INSTALLED",
1659 onfail="SOME INTENTS NOT INSTALLED" )
1660
Hari Krishnac195f3b2015-07-08 20:02:24 -07001661 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001662 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001663 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001664 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1665 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001666 main.log.warn("First pingall failed. Retrying...")
1667 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001668 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001669
Hari Krishnac195f3b2015-07-08 20:02:24 -07001670 time2 = time.time()
1671 timeDiff = round( ( time2 - time1 ), 2 )
1672 main.log.report(
1673 "Time taken for Ping All: " +
1674 str( timeDiff ) +
1675 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001676 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001677 onpass="PING ALL PASS",
1678 onfail="PING ALL FAIL" )
1679
GlennRCfcfdc4f2015-09-30 16:01:57 -07001680 caseResult70 = linkDown and pingResult and intentState
1681 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001682 onpass="Random Link cut Test PASS",
1683 onfail="Random Link cut Test FAIL" )
1684
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 # Printing what exactly failed
1686 if not linkDown:
1687 main.log.debug( "Link down was not discovered correctly" )
1688 if not pingResult:
1689 main.log.debug( "Pingall failed" )
1690 if not intentState:
1691 main.log.debug( "Intents are not all installed" )
1692
1693
Hari Krishnac195f3b2015-07-08 20:02:24 -07001694 def CASE81( self, main ):
1695 """
1696 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1697 """
1698 import random
1699 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1700 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1701 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1702 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1703 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1704
1705 main.log.report(
1706 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1707 main.log.report(
1708 "__________________________________________________________________" )
1709 main.case(
1710 "Point intents - Bring the core links up that are down and verify ping all" )
1711 main.step( "Bring randomly cut links on Core devices up" )
1712 for i in range( int( switchLinksToToggle ) ):
1713 main.Mininet1.link(
1714 END1=link1End1,
1715 END2=main.randomLink1[ i ],
1716 OPTION="up" )
1717 time.sleep( link_sleep )
1718 main.Mininet1.link(
1719 END1=link2End1,
1720 END2=main.randomLink2[ i ],
1721 OPTION="up" )
1722 time.sleep( link_sleep )
1723 main.Mininet1.link(
1724 END1=link3End1,
1725 END2=main.randomLink3[ i ],
1726 OPTION="up" )
1727 time.sleep( link_sleep )
1728
Hari Krishna6185fc12015-07-13 15:42:31 -07001729 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001730 linkUp = main.ONOSbench.checkStatus(
1731 topology_output,
1732 main.numMNswitches,
1733 str( main.numMNlinks ) )
1734 utilities.assert_equals(
1735 expect=main.TRUE,
1736 actual=linkUp,
1737 onpass="Link up discovered properly",
1738 onfail="Link up was not discovered in " +
1739 str( link_sleep ) +
1740 " seconds" )
1741
GlennRCfcfdc4f2015-09-30 16:01:57 -07001742 main.step("Verify intents are installed")
1743 # Checking a maximum of 3
1744 for i in range(3):
1745 if i != 0:
1746 main.log.warn( "Verification failed. Retrying..." )
1747 main.log.info("Giving onos some time...")
1748 time.sleep( main.checkIntentsDelay )
1749
1750 intentState = main.TRUE
1751 for e in range(int(main.numCtrls)):
1752 main.log.info( "Checking intents on CLI %s" % (e+1) )
1753 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1754 intentState
1755 if not intentState:
1756 main.log.warn( "Not all intents installed" )
1757 if intentState:
1758 break
1759 else:
1760 #Dumping intent summary
1761 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1762
1763
1764 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1765 onpass="INTENTS INSTALLED",
1766 onfail="SOME INTENTS NOT INSTALLED" )
1767
Hari Krishnac195f3b2015-07-08 20:02:24 -07001768 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001769 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001770 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001771 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1772 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001773 main.log.warn("First pingall failed. Retrying...")
1774 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001775 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001776
Hari Krishnac195f3b2015-07-08 20:02:24 -07001777 time2 = time.time()
1778 timeDiff = round( ( time2 - time1 ), 2 )
1779 main.log.report(
1780 "Time taken for Ping All: " +
1781 str( timeDiff ) +
1782 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001783 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001784 onpass="PING ALL PASS",
1785 onfail="PING ALL FAIL" )
1786
GlennRCfcfdc4f2015-09-30 16:01:57 -07001787 caseResult80 = linkUp and pingResult
1788 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001789 onpass="Link Up Test PASS",
1790 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001791 # Printing what exactly failed
1792 if not linkUp:
1793 main.log.debug( "Link down was not discovered correctly" )
1794 if not pingResult:
1795 main.log.debug( "Pingall failed" )
1796 if not intentState:
1797 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001798
1799 def CASE72( self, main ):
1800 """
1801 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1802 """
1803 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001804 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001805 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001806
Hari Krishnac195f3b2015-07-08 20:02:24 -07001807 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1808 main.log.report( "___________________________________________________________________________" )
1809 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1810 switches = []
1811 switchesComb = []
1812 for i in range( main.numMNswitches ):
1813 switches.append('s%d'%(i+1))
1814 switchesLinksComb = list(itertools.combinations(switches,2))
1815 main.randomLinks = random.sample(switchesLinksComb, 5 )
1816 print main.randomLinks
1817 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001818
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819 for switch in main.randomLinks:
1820 main.Mininet1.link(
1821 END1=switch[0],
1822 END2=switch[1],
1823 OPTION="down")
1824 time.sleep( link_sleep )
1825
Hari Krishna6185fc12015-07-13 15:42:31 -07001826 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001827 linkDown = main.ONOSbench.checkStatus(
1828 topology_output, main.numMNswitches, str(
1829 int( main.numMNlinks ) - 5 * 2 ) )
1830 utilities.assert_equals(
1831 expect=main.TRUE,
1832 actual=linkDown,
1833 onpass="Link Down discovered properly",
1834 onfail="Link down was not discovered in " +
1835 str( link_sleep ) +
1836 " seconds" )
1837
GlennRCfcfdc4f2015-09-30 16:01:57 -07001838 main.step("Verify intents are installed")
1839 # Checking a maximum of 3
1840 for i in range(3):
1841 if i != 0:
1842 main.log.warn( "Verification failed. Retrying..." )
1843 main.log.info("Giving onos some time...")
1844 time.sleep( main.checkIntentsDelay )
1845
1846 intentState = main.TRUE
1847 for e in range(int(main.numCtrls)):
1848 main.log.info( "Checking intents on CLI %s" % (e+1) )
1849 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1850 intentState
1851 if not intentState:
1852 main.log.warn( "Not all intents installed" )
1853 if intentState:
1854 break
1855 else:
1856 #Dumping intent summary
1857 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1858
1859
1860 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1861 onpass="INTENTS INSTALLED",
1862 onfail="SOME INTENTS NOT INSTALLED" )
1863
Hari Krishnac195f3b2015-07-08 20:02:24 -07001864 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001865 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001866 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001867 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1868 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001869 main.log.warn("First pingall failed. Retrying...")
1870 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001871 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001872
Hari Krishnac195f3b2015-07-08 20:02:24 -07001873 time2 = time.time()
1874 timeDiff = round( ( time2 - time1 ), 2 )
1875 main.log.report(
1876 "Time taken for Ping All: " +
1877 str( timeDiff ) +
1878 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001879 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001880 onpass="PING ALL PASS",
1881 onfail="PING ALL FAIL" )
1882
GlennRCfcfdc4f2015-09-30 16:01:57 -07001883 caseResult70 = linkDown and pingResult and intentState
1884 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001885 onpass="Random Link cut Test PASS",
1886 onfail="Random Link cut Test FAIL" )
1887
GlennRCfcfdc4f2015-09-30 16:01:57 -07001888 # Printing what exactly failed
1889 if not linkDown:
1890 main.log.debug( "Link down was not discovered correctly" )
1891 if not pingResult:
1892 main.log.debug( "Pingall failed" )
1893 if not intentState:
1894 main.log.debug( "Intents are not all installed" )
1895
Hari Krishnac195f3b2015-07-08 20:02:24 -07001896 def CASE82( self, main ):
1897 """
1898 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1899 """
1900 import random
1901 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001902
Hari Krishnac195f3b2015-07-08 20:02:24 -07001903 main.log.report(
1904 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1905 main.log.report(
1906 "__________________________________________________________________" )
1907 main.case(
1908 "Host intents - Bring the core links up that are down and verify ping all" )
1909 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001910
Hari Krishnac195f3b2015-07-08 20:02:24 -07001911 for switch in main.randomLinks:
1912 main.Mininet1.link(
1913 END1=switch[0],
1914 END2=switch[1],
1915 OPTION="up")
1916 time.sleep( link_sleep )
1917
Hari Krishna6185fc12015-07-13 15:42:31 -07001918 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001919 linkUp = main.ONOSbench.checkStatus(
1920 topology_output,
1921 main.numMNswitches,
1922 str( main.numMNlinks ) )
1923 utilities.assert_equals(
1924 expect=main.TRUE,
1925 actual=linkUp,
1926 onpass="Link up discovered properly",
1927 onfail="Link up was not discovered in " +
1928 str( link_sleep ) +
1929 " seconds" )
1930
GlennRCfcfdc4f2015-09-30 16:01:57 -07001931 main.step("Verify intents are installed")
1932 # Checking a maximum of 3
1933 for i in range(3):
1934 if i != 0:
1935 main.log.warn( "Verification failed. Retrying..." )
1936 main.log.info("Giving onos some time...")
1937 time.sleep( main.checkIntentsDelay )
1938
1939 intentState = main.TRUE
1940 for e in range(int(main.numCtrls)):
1941 main.log.info( "Checking intents on CLI %s" % (e+1) )
1942 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1943 intentState
1944 if not intentState:
1945 main.log.warn( "Not all intents installed" )
1946 if intentState:
1947 break
1948 else:
1949 #Dumping intent summary
1950 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1951
1952
1953 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1954 onpass="INTENTS INSTALLED",
1955 onfail="SOME INTENTS NOT INSTALLED" )
1956
Hari Krishnac195f3b2015-07-08 20:02:24 -07001957 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001958 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001959 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001960 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1961 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001962 main.log.warn("First pingall failed. Retrying...")
1963 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001964 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001965
Hari Krishnac195f3b2015-07-08 20:02:24 -07001966 time2 = time.time()
1967 timeDiff = round( ( time2 - time1 ), 2 )
1968 main.log.report(
1969 "Time taken for Ping All: " +
1970 str( timeDiff ) +
1971 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001972 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001973 onpass="PING ALL PASS",
1974 onfail="PING ALL FAIL" )
1975
GlennRCfcfdc4f2015-09-30 16:01:57 -07001976 caseResult80 = linkUp and pingResult
1977 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001978 onpass="Link Up Test PASS",
1979 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001980 # Printing what exactly failed
1981 if not linkUp:
1982 main.log.debug( "Link down was not discovered correctly" )
1983 if not pingResult:
1984 main.log.debug( "Pingall failed" )
1985 if not intentState:
1986 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001987
1988 def CASE73( self, main ):
1989 """
1990 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1991 """
1992 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001993 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001994 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001995
Hari Krishnac195f3b2015-07-08 20:02:24 -07001996 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1997 main.log.report( "___________________________________________________________________________" )
1998 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1999 switches = []
2000 switchesComb = []
2001 for i in range( main.numMNswitches ):
2002 switches.append('s%d'%(i+1))
2003 switchesLinksComb = list(itertools.combinations(switches,2))
2004 main.randomLinks = random.sample(switchesLinksComb, 5 )
2005 print main.randomLinks
2006 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002007
Hari Krishnac195f3b2015-07-08 20:02:24 -07002008 for switch in main.randomLinks:
2009 main.Mininet1.link(
2010 END1=switch[0],
2011 END2=switch[1],
2012 OPTION="down")
2013 time.sleep( link_sleep )
2014
Hari Krishna6185fc12015-07-13 15:42:31 -07002015 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002016 linkDown = main.ONOSbench.checkStatus(
2017 topology_output, main.numMNswitches, str(
2018 int( main.numMNlinks ) - 5 * 2 ) )
2019 utilities.assert_equals(
2020 expect=main.TRUE,
2021 actual=linkDown,
2022 onpass="Link Down discovered properly",
2023 onfail="Link down was not discovered in " +
2024 str( link_sleep ) +
2025 " seconds" )
2026
GlennRCfcfdc4f2015-09-30 16:01:57 -07002027 main.step("Verify intents are installed")
2028 # Checking a maximum of 3
2029 for i in range(3):
2030 if i != 0:
2031 main.log.warn( "Verification failed. Retrying..." )
2032 main.log.info("Giving onos some time...")
2033 time.sleep( main.checkIntentsDelay )
2034
2035 intentState = main.TRUE
2036 for e in range(int(main.numCtrls)):
2037 main.log.info( "Checking intents on CLI %s" % (e+1) )
2038 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2039 intentState
2040 if not intentState:
2041 main.log.warn( "Not all intents installed" )
2042 if intentState:
2043 break
2044 else:
2045 #Dumping intent summary
2046 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2047
2048
2049 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2050 onpass="INTENTS INSTALLED",
2051 onfail="SOME INTENTS NOT INSTALLED" )
2052
Hari Krishnac195f3b2015-07-08 20:02:24 -07002053 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002054 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002055 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002056 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2057 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002058 main.log.warn("First pingall failed. Retrying...")
2059 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002060 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002061
Hari Krishnac195f3b2015-07-08 20:02:24 -07002062 time2 = time.time()
2063 timeDiff = round( ( time2 - time1 ), 2 )
2064 main.log.report(
2065 "Time taken for Ping All: " +
2066 str( timeDiff ) +
2067 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002068 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002069 onpass="PING ALL PASS",
2070 onfail="PING ALL FAIL" )
2071
GlennRCfcfdc4f2015-09-30 16:01:57 -07002072 caseResult70 = linkDown and pingResult and intentState
2073 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002074 onpass="Random Link cut Test PASS",
2075 onfail="Random Link cut Test FAIL" )
2076
GlennRCfcfdc4f2015-09-30 16:01:57 -07002077 # Printing what exactly failed
2078 if not linkDown:
2079 main.log.debug( "Link down was not discovered correctly" )
2080 if not pingResult:
2081 main.log.debug( "Pingall failed" )
2082 if not intentState:
2083 main.log.debug( "Intents are not all installed" )
2084
Hari Krishnac195f3b2015-07-08 20:02:24 -07002085 def CASE83( self, main ):
2086 """
2087 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2088 """
2089 import random
2090 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002091
Hari Krishnac195f3b2015-07-08 20:02:24 -07002092 main.log.report(
2093 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2094 main.log.report(
2095 "__________________________________________________________________" )
2096 main.case(
2097 "Point intents - Bring the core links up that are down and verify ping all" )
2098 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002099
Hari Krishnac195f3b2015-07-08 20:02:24 -07002100 for switch in main.randomLinks:
2101 main.Mininet1.link(
2102 END1=switch[0],
2103 END2=switch[1],
2104 OPTION="up")
2105 time.sleep( link_sleep )
2106
Hari Krishna6185fc12015-07-13 15:42:31 -07002107 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002108 linkUp = main.ONOSbench.checkStatus(
2109 topology_output,
2110 main.numMNswitches,
2111 str( main.numMNlinks ) )
2112 utilities.assert_equals(
2113 expect=main.TRUE,
2114 actual=linkUp,
2115 onpass="Link up discovered properly",
2116 onfail="Link up was not discovered in " +
2117 str( link_sleep ) +
2118 " seconds" )
2119
GlennRCfcfdc4f2015-09-30 16:01:57 -07002120 main.step("Verify intents are installed")
2121 # Checking a maximum of 3
2122 for i in range(3):
2123 if i != 0:
2124 main.log.warn( "Verification failed. Retrying..." )
2125 main.log.info("Giving onos some time...")
2126 time.sleep( main.checkIntentsDelay )
2127
2128 intentState = main.TRUE
2129 for e in range(int(main.numCtrls)):
2130 main.log.info( "Checking intents on CLI %s" % (e+1) )
2131 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2132 intentState
2133 if not intentState:
2134 main.log.warn( "Not all intents installed" )
2135 if intentState:
2136 break
2137 else:
2138 #Dumping intent summary
2139 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2140
2141
2142 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2143 onpass="INTENTS INSTALLED",
2144 onfail="SOME INTENTS NOT INSTALLED" )
2145
Hari Krishnac195f3b2015-07-08 20:02:24 -07002146 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002147 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002148 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002149 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2150 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002151 main.log.warn("First pingall failed. Retrying...")
2152 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002153 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002154
Hari Krishnac195f3b2015-07-08 20:02:24 -07002155 time2 = time.time()
2156 timeDiff = round( ( time2 - time1 ), 2 )
2157 main.log.report(
2158 "Time taken for Ping All: " +
2159 str( timeDiff ) +
2160 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002161 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002162 onpass="PING ALL PASS",
2163 onfail="PING ALL FAIL" )
2164
GlennRCfcfdc4f2015-09-30 16:01:57 -07002165 caseResult80 = linkUp and pingResult
2166 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002167 onpass="Link Up Test PASS",
2168 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002169 # Printing what exactly failed
2170 if not linkUp:
2171 main.log.debug( "Link down was not discovered correctly" )
2172 if not pingResult:
2173 main.log.debug( "Pingall failed" )
2174 if not intentState:
2175 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002176
2177 def CASE74( self, main ):
2178 """
2179 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2180 """
2181 import random
2182 main.randomLink1 = []
2183 main.randomLink2 = []
2184 main.randomLink3 = []
2185 main.randomLink4 = []
2186 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2187 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2188 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2189 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2190 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2191 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2192 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2193 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002194
Hari Krishnac195f3b2015-07-08 20:02:24 -07002195 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2196 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002197 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002198 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002199 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002200 linkIndex.remove(linkIndexS9)
2201 linkIndexS10 = random.sample(linkIndex,1)[0]
2202 main.randomLink1 = link1End2top[linkIndexS9]
2203 main.randomLink2 = link2End2top[linkIndexS10]
2204 main.randomLink3 = random.sample(link1End2bot,1)[0]
2205 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002206
2207 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002208 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2209 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2210 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2211 time.sleep( link_sleep )
2212 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2213 time.sleep( link_sleep )
2214
Hari Krishna6185fc12015-07-13 15:42:31 -07002215 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002216 linkDown = main.ONOSbench.checkStatus(
2217 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002218 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002219 utilities.assert_equals(
2220 expect=main.TRUE,
2221 actual=linkDown,
2222 onpass="Link Down discovered properly",
2223 onfail="Link down was not discovered in " +
2224 str( link_sleep ) +
2225 " seconds" )
2226
GlennRCfcfdc4f2015-09-30 16:01:57 -07002227 main.step("Verify intents are installed")
2228 # Checking a maximum of 3
2229 for i in range(3):
2230 if i != 0:
2231 main.log.warn( "Verification failed. Retrying..." )
2232 main.log.info("Giving onos some time...")
2233 time.sleep( main.checkIntentsDelay )
2234
2235 intentState = main.TRUE
2236 for e in range(int(main.numCtrls)):
2237 main.log.info( "Checking intents on CLI %s" % (e+1) )
2238 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2239 intentState
2240 if not intentState:
2241 main.log.warn( "Not all intents installed" )
2242 if intentState:
2243 break
2244 else:
2245 #Dumping intent summary
2246 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2247
2248
2249 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2250 onpass="INTENTS INSTALLED",
2251 onfail="SOME INTENTS NOT INSTALLED" )
2252
Hari Krishnac195f3b2015-07-08 20:02:24 -07002253 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002254 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002255 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002256 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2257 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002258 main.log.warn("First pingall failed. Retrying...")
2259 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002260 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002261
Hari Krishnac195f3b2015-07-08 20:02:24 -07002262 time2 = time.time()
2263 timeDiff = round( ( time2 - time1 ), 2 )
2264 main.log.report(
2265 "Time taken for Ping All: " +
2266 str( timeDiff ) +
2267 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002268 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002269 onpass="PING ALL PASS",
2270 onfail="PING ALL FAIL" )
2271
GlennRCfcfdc4f2015-09-30 16:01:57 -07002272 caseResult70 = linkDown and pingResult and intentState
2273 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002274 onpass="Random Link cut Test PASS",
2275 onfail="Random Link cut Test FAIL" )
2276
GlennRCfcfdc4f2015-09-30 16:01:57 -07002277 # Printing what exactly failed
2278 if not linkDown:
2279 main.log.debug( "Link down was not discovered correctly" )
2280 if not pingResult:
2281 main.log.debug( "Pingall failed" )
2282 if not intentState:
2283 main.log.debug( "Intents are not all installed" )
2284
Hari Krishnac195f3b2015-07-08 20:02:24 -07002285 def CASE84( self, main ):
2286 """
2287 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2288 """
2289 import random
2290 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2291 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2292 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2293 main.log.report(
2294 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2295 main.log.report(
2296 "__________________________________________________________________" )
2297 main.case(
2298 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002299
2300 # Work around for link state propagation delay. Added some sleep time.
2301 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2302 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002303 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2304 time.sleep( link_sleep )
2305 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2306 time.sleep( link_sleep )
2307
Hari Krishna6185fc12015-07-13 15:42:31 -07002308 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002309 linkUp = main.ONOSbench.checkStatus(
2310 topology_output,
2311 main.numMNswitches,
2312 str( main.numMNlinks ) )
2313 utilities.assert_equals(
2314 expect=main.TRUE,
2315 actual=linkUp,
2316 onpass="Link up discovered properly",
2317 onfail="Link up was not discovered in " +
2318 str( link_sleep ) +
2319 " seconds" )
2320
GlennRCfcfdc4f2015-09-30 16:01:57 -07002321 main.step("Verify intents are installed")
2322 # Checking a maximum of 3
2323 for i in range(3):
2324 if i != 0:
2325 main.log.warn( "Verification failed. Retrying..." )
2326 main.log.info("Giving onos some time...")
2327 time.sleep( main.checkIntentsDelay )
2328
2329 intentState = main.TRUE
2330 for e in range(int(main.numCtrls)):
2331 main.log.info( "Checking intents on CLI %s" % (e+1) )
2332 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2333 intentState
2334 if not intentState:
2335 main.log.warn( "Not all intents installed" )
2336 if intentState:
2337 break
2338 else:
2339 #Dumping intent summary
2340 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2341
2342
2343 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2344 onpass="INTENTS INSTALLED",
2345 onfail="SOME INTENTS NOT INSTALLED" )
2346
Hari Krishnac195f3b2015-07-08 20:02:24 -07002347 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002348 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002349 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002350 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2351 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002352 main.log.warn("First pingall failed. Retrying...")
2353 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002354 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002355
Hari Krishnac195f3b2015-07-08 20:02:24 -07002356 time2 = time.time()
2357 timeDiff = round( ( time2 - time1 ), 2 )
2358 main.log.report(
2359 "Time taken for Ping All: " +
2360 str( timeDiff ) +
2361 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002362 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002363 onpass="PING ALL PASS",
2364 onfail="PING ALL FAIL" )
2365
GlennRCfcfdc4f2015-09-30 16:01:57 -07002366 caseResult80 = linkUp and pingResult
2367 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002368 onpass="Link Up Test PASS",
2369 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002370 # Printing what exactly failed
2371 if not linkUp:
2372 main.log.debug( "Link down was not discovered correctly" )
2373 if not pingResult:
2374 main.log.debug( "Pingall failed" )
2375 if not intentState:
2376 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002377
Hari Krishnab79d0822015-08-20 09:48:43 -07002378 def CASE75( self, main ):
2379 """
2380 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2381 """
2382 import random
2383 main.randomLink1 = []
2384 main.randomLink2 = []
2385 main.randomLink3 = []
2386 main.randomLink4 = []
2387 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2388 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2389 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2390 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2391 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2392 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2393 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2394 main.pingTimeout = 400
2395
2396 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2397 main.log.report( "___________________________________________________________________________" )
2398 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2399 linkIndex = range(4)
2400 linkIndexS9 = random.sample(linkIndex,1)[0]
2401 linkIndex.remove(linkIndexS9)
2402 linkIndexS10 = random.sample(linkIndex,1)[0]
2403 main.randomLink1 = link1End2top[linkIndexS9]
2404 main.randomLink2 = link2End2top[linkIndexS10]
2405 main.randomLink3 = random.sample(link1End2bot,1)[0]
2406 main.randomLink4 = random.sample(link2End2bot,1)[0]
2407
2408 # Work around for link state propagation delay. Added some sleep time.
2409 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2410 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2411 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2412 time.sleep( link_sleep )
2413 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2414 time.sleep( link_sleep )
2415
2416 topology_output = main.ONOScli1.topology()
2417 linkDown = main.ONOSbench.checkStatus(
2418 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002419 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002420 utilities.assert_equals(
2421 expect=main.TRUE,
2422 actual=linkDown,
2423 onpass="Link Down discovered properly",
2424 onfail="Link down was not discovered in " +
2425 str( link_sleep ) +
2426 " seconds" )
2427
GlennRCfcfdc4f2015-09-30 16:01:57 -07002428 main.step("Verify intents are installed")
2429 # Checking a maximum of 3
2430 for i in range(3):
2431 if i != 0:
2432 main.log.warn( "Verification failed. Retrying..." )
2433 main.log.info("Giving onos some time...")
2434 time.sleep( main.checkIntentsDelay )
2435
2436 intentState = main.TRUE
2437 for e in range(int(main.numCtrls)):
2438 main.log.info( "Checking intents on CLI %s" % (e+1) )
2439 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2440 intentState
2441 if not intentState:
2442 main.log.warn( "Not all intents installed" )
2443 if intentState:
2444 break
2445 else:
2446 #Dumping intent summary
2447 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2448
2449
2450 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2451 onpass="INTENTS INSTALLED",
2452 onfail="SOME INTENTS NOT INSTALLED" )
2453
Hari Krishnab79d0822015-08-20 09:48:43 -07002454 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002455 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002456 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002457 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2458 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002459 main.log.warn("First pingall failed. Retrying...")
2460 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002461 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002462
Hari Krishnab79d0822015-08-20 09:48:43 -07002463 time2 = time.time()
2464 timeDiff = round( ( time2 - time1 ), 2 )
2465 main.log.report(
2466 "Time taken for Ping All: " +
2467 str( timeDiff ) +
2468 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002469 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002470 onpass="PING ALL PASS",
2471 onfail="PING ALL FAIL" )
2472
GlennRCfcfdc4f2015-09-30 16:01:57 -07002473 caseResult70 = linkDown and pingResult and intentState
2474 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
Hari Krishnab79d0822015-08-20 09:48:43 -07002475 onpass="Random Link cut Test PASS",
2476 onfail="Random Link cut Test FAIL" )
2477
GlennRCfcfdc4f2015-09-30 16:01:57 -07002478 # Printing what exactly failed
2479 if not linkDown:
2480 main.log.debug( "Link down was not discovered correctly" )
2481 if not pingResult:
2482 main.log.debug( "Pingall failed" )
2483 if not intentState:
2484 main.log.debug( "Intents are not all installed" )
2485
Hari Krishnab79d0822015-08-20 09:48:43 -07002486 def CASE85( self, main ):
2487 """
2488 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2489 """
2490 import random
2491 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2492 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2493 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2494 main.log.report(
2495 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2496 main.log.report(
2497 "__________________________________________________________________" )
2498 main.case(
2499 "Point intents - Bring the core links up that are down and verify ping all" )
2500
2501 # Work around for link state propagation delay. Added some sleep time.
2502 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2503 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2504 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2505 time.sleep( link_sleep )
2506 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2507 time.sleep( link_sleep )
2508
2509 topology_output = main.ONOScli1.topology()
2510 linkUp = main.ONOSbench.checkStatus(
2511 topology_output,
2512 main.numMNswitches,
2513 str( main.numMNlinks ) )
2514 utilities.assert_equals(
2515 expect=main.TRUE,
2516 actual=linkUp,
2517 onpass="Link up discovered properly",
2518 onfail="Link up was not discovered in " +
2519 str( link_sleep ) +
2520 " seconds" )
2521
GlennRCfcfdc4f2015-09-30 16:01:57 -07002522 main.step("Verify intents are installed")
2523 # Checking a maximum of 3
2524 for i in range(3):
2525 if i != 0:
2526 main.log.warn( "Verification failed. Retrying..." )
2527 main.log.info("Giving onos some time...")
2528 time.sleep( main.checkIntentsDelay )
2529
2530 intentState = main.TRUE
2531 for e in range(int(main.numCtrls)):
2532 main.log.info( "Checking intents on CLI %s" % (e+1) )
2533 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2534 intentState
2535 if not intentState:
2536 main.log.warn( "Not all intents installed" )
2537 if intentState:
2538 break
2539 else:
2540 #Dumping intent summary
2541 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2542
2543
2544 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2545 onpass="INTENTS INSTALLED",
2546 onfail="SOME INTENTS NOT INSTALLED" )
2547
Hari Krishnab79d0822015-08-20 09:48:43 -07002548 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002549 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002550 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002551 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2552 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002553 main.log.warn("First pingall failed. Retrying...")
2554 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002555 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002556
Hari Krishnab79d0822015-08-20 09:48:43 -07002557 time2 = time.time()
2558 timeDiff = round( ( time2 - time1 ), 2 )
2559 main.log.report(
2560 "Time taken for Ping All: " +
2561 str( timeDiff ) +
2562 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002563 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002564 onpass="PING ALL PASS",
2565 onfail="PING ALL FAIL" )
2566
GlennRCfcfdc4f2015-09-30 16:01:57 -07002567 caseResult80 = linkUp and pingResult
2568 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
Hari Krishnab79d0822015-08-20 09:48:43 -07002569 onpass="Link Up Test PASS",
2570 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002571 # Printing what exactly failed
2572 if not linkUp:
2573 main.log.debug( "Link down was not discovered correctly" )
2574 if not pingResult:
2575 main.log.debug( "Pingall failed" )
2576 if not intentState:
2577 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002578
Hari Krishna4223dbd2015-08-13 16:29:53 -07002579 def CASE170( self ):
2580 """
2581 IPv6 ping all with some core links down( Host Intents-Att Topo)
2582 """
2583 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2584 main.log.report( "_________________________________________________" )
2585 import itertools
2586 import time
2587 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2588 main.step( "Verify IPv6 Ping across all hosts" )
2589 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2590 pingResult = main.FALSE
2591 time1 = time.time()
2592 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002593 if not pingResult:
2594 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
2595 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002596 time2 = time.time()
2597 timeDiff = round( ( time2 - time1 ), 2 )
2598 main.log.report(
2599 "Time taken for IPv6 Ping All: " +
2600 str( timeDiff ) +
2601 " seconds" )
2602 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2603 onpass="PING ALL PASS",
2604 onfail="PING ALL FAIL" )
2605
2606 case170Result = pingResult
2607 utilities.assert_equals(
2608 expect=main.TRUE,
2609 actual=case170Result,
2610 onpass="IPv6 Ping across 300 host intents test PASS",
2611 onfail="IPv6 Ping across 300 host intents test FAIL" )
2612
2613 def CASE180( self ):
2614 """
2615 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2616 """
2617 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2618 main.log.report( "_________________________________________________" )
2619 import itertools
2620 import time
2621 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2622 main.step( "Verify IPv6 Ping across all hosts" )
2623 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2624 pingResult = main.FALSE
2625 time1 = time.time()
2626 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002627 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002628 main.log.warn("First ping failed. Retrying...")
2629 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002630 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002631
Hari Krishna4223dbd2015-08-13 16:29:53 -07002632 time2 = time.time()
2633 timeDiff = round( ( time2 - time1 ), 2 )
2634 main.log.report(
2635 "Time taken for IPv6 Ping All: " +
2636 str( timeDiff ) +
2637 " seconds" )
2638 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2639 onpass="PING ALL PASS",
2640 onfail="PING ALL FAIL" )
2641
2642 case180Result = pingResult
2643 utilities.assert_equals(
2644 expect=main.TRUE,
2645 actual=case180Result,
2646 onpass="IPv6 Ping across 300 host intents test PASS",
2647 onfail="IPv6 Ping across 300 host intents test FAIL" )
2648
2649 def CASE171( self ):
2650 """
2651 IPv6 ping all with some core links down( Point Intents-Att Topo)
2652 """
2653 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2654 main.log.report( "_________________________________________________" )
2655 import itertools
2656 import time
2657 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2658 main.step( "Verify IPv6 Ping across all hosts" )
2659 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2660 pingResult = main.FALSE
2661 time1 = time.time()
2662 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002663 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002664 main.log.warn("First ping failed. Retrying...")
2665 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002666 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002667
Hari Krishna4223dbd2015-08-13 16:29:53 -07002668 time2 = time.time()
2669 timeDiff = round( ( time2 - time1 ), 2 )
2670 main.log.report(
2671 "Time taken for IPv6 Ping All: " +
2672 str( timeDiff ) +
2673 " seconds" )
2674 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2675 onpass="PING ALL PASS",
2676 onfail="PING ALL FAIL" )
2677
2678 case171Result = pingResult
2679 utilities.assert_equals(
2680 expect=main.TRUE,
2681 actual=case171Result,
2682 onpass="IPv6 Ping across 600 point intents test PASS",
2683 onfail="IPv6 Ping across 600 point intents test FAIL" )
2684
2685 def CASE181( self ):
2686 """
2687 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2688 """
2689 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2690 main.log.report( "_________________________________________________" )
2691 import itertools
2692 import time
2693 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2694 main.step( "Verify IPv6 Ping across all hosts" )
2695 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2696 pingResult = main.FALSE
2697 time1 = time.time()
2698 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002699 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002700 main.log.warn("First ping failed. Retrying...")
2701 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002702 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002703
Hari Krishna4223dbd2015-08-13 16:29:53 -07002704 time2 = time.time()
2705 timeDiff = round( ( time2 - time1 ), 2 )
2706 main.log.report(
2707 "Time taken for IPv6 Ping All: " +
2708 str( timeDiff ) +
2709 " seconds" )
2710 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2711 onpass="PING ALL PASS",
2712 onfail="PING ALL FAIL" )
2713
2714 case181Result = pingResult
2715 utilities.assert_equals(
2716 expect=main.TRUE,
2717 actual=case181Result,
2718 onpass="IPv6 Ping across 600 Point intents test PASS",
2719 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2720
2721 def CASE172( self ):
2722 """
2723 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2724 """
2725 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2726 main.log.report( "_________________________________________________" )
2727 import itertools
2728 import time
2729 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2730 main.step( "Verify IPv6 Ping across all hosts" )
2731 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2732 pingResult = main.FALSE
2733 time1 = time.time()
2734 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002735 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002736 main.log.warn("First ping failed. Retrying...")
2737 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002738 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002739
Hari Krishna4223dbd2015-08-13 16:29:53 -07002740 time2 = time.time()
2741 timeDiff = round( ( time2 - time1 ), 2 )
2742 main.log.report(
2743 "Time taken for IPv6 Ping All: " +
2744 str( timeDiff ) +
2745 " seconds" )
2746 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2747 onpass="PING ALL PASS",
2748 onfail="PING ALL FAIL" )
2749
2750 case172Result = pingResult
2751 utilities.assert_equals(
2752 expect=main.TRUE,
2753 actual=case172Result,
2754 onpass="IPv6 Ping across 300 host intents test PASS",
2755 onfail="IPv6 Ping across 300 host intents test FAIL" )
2756
2757 def CASE182( self ):
2758 """
2759 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2760 """
2761 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2762 main.log.report( "_________________________________________________" )
2763 import itertools
2764 import time
2765 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2766 main.step( "Verify IPv6 Ping across all hosts" )
2767 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2768 pingResult = main.FALSE
2769 time1 = time.time()
2770 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002771 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002772 main.log.warn("First ping failed. Retrying...")
2773 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002774 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002775
Hari Krishna4223dbd2015-08-13 16:29:53 -07002776 time2 = time.time()
2777 timeDiff = round( ( time2 - time1 ), 2 )
2778 main.log.report(
2779 "Time taken for IPv6 Ping All: " +
2780 str( timeDiff ) +
2781 " seconds" )
2782 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2783 onpass="PING ALL PASS",
2784 onfail="PING ALL FAIL" )
2785
2786 case182Result = pingResult
2787 utilities.assert_equals(
2788 expect=main.TRUE,
2789 actual=case182Result,
2790 onpass="IPv6 Ping across 300 host intents test PASS",
2791 onfail="IPv6 Ping across 300 host intents test FAIL" )
2792
2793 def CASE173( self ):
2794 """
2795 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2796 """
2797 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2798 main.log.report( "_________________________________________________" )
2799 import itertools
2800 import time
2801 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2802 main.step( "Verify IPv6 Ping across all hosts" )
2803 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2804 pingResult = main.FALSE
2805 time1 = time.time()
2806 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002807 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002808 main.log.warn("First ping failed. Retrying...")
2809 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002810 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002811
Hari Krishna4223dbd2015-08-13 16:29:53 -07002812 time2 = time.time()
2813 timeDiff = round( ( time2 - time1 ), 2 )
2814 main.log.report(
2815 "Time taken for IPv6 Ping All: " +
2816 str( timeDiff ) +
2817 " seconds" )
2818 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2819 onpass="PING ALL PASS",
2820 onfail="PING ALL FAIL" )
2821
2822 case173Result = pingResult
2823 utilities.assert_equals(
2824 expect=main.TRUE,
2825 actual=case173Result,
2826 onpass="IPv6 Ping across 600 point intents test PASS",
2827 onfail="IPv6 Ping across 600 point intents test FAIL" )
2828
2829 def CASE183( self ):
2830 """
2831 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2832 """
2833 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2834 main.log.report( "_________________________________________________" )
2835 import itertools
2836 import time
2837 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2838 main.step( "Verify IPv6 Ping across all hosts" )
2839 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
2840 pingResult = main.FALSE
2841 time1 = time.time()
2842 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002843 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002844 main.log.warn("First ping failed. Retrying...")
2845 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002846 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002847
Hari Krishna4223dbd2015-08-13 16:29:53 -07002848 time2 = time.time()
2849 timeDiff = round( ( time2 - time1 ), 2 )
2850 main.log.report(
2851 "Time taken for IPv6 Ping All: " +
2852 str( timeDiff ) +
2853 " seconds" )
2854 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2855 onpass="PING ALL PASS",
2856 onfail="PING ALL FAIL" )
2857
2858 case183Result = pingResult
2859 utilities.assert_equals(
2860 expect=main.TRUE,
2861 actual=case183Result,
2862 onpass="IPv6 Ping across 600 Point intents test PASS",
2863 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2864
2865 def CASE174( self ):
2866 """
2867 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2868 """
2869 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2870 main.log.report( "_________________________________________________" )
2871 import itertools
2872 import time
2873 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2874 main.step( "Verify IPv6 Ping across all hosts" )
2875 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2876 pingResult = main.FALSE
2877 time1 = time.time()
2878 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002879 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002880 main.log.warn("First ping failed. Retrying...")
2881 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002882 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002883
Hari Krishna4223dbd2015-08-13 16:29:53 -07002884 time2 = time.time()
2885 timeDiff = round( ( time2 - time1 ), 2 )
2886 main.log.report(
2887 "Time taken for IPv6 Ping All: " +
2888 str( timeDiff ) +
2889 " seconds" )
2890 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2891 onpass="PING ALL PASS",
2892 onfail="PING ALL FAIL" )
2893
2894 case174Result = pingResult
2895 utilities.assert_equals(
2896 expect=main.TRUE,
2897 actual=case174Result,
2898 onpass="IPv6 Ping across 2278 host intents test PASS",
2899 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2900
2901 def CASE184( self ):
2902 """
2903 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2904 """
2905 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2906 main.log.report( "_________________________________________________" )
2907 import itertools
2908 import time
2909 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2910 main.step( "Verify IPv6 Ping across all hosts" )
2911 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2912 pingResult = main.FALSE
2913 time1 = time.time()
2914 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002915 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002916 main.log.warn("First ping failed. Retrying...")
2917 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002918 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002919
Hari Krishna4223dbd2015-08-13 16:29:53 -07002920 time2 = time.time()
2921 timeDiff = round( ( time2 - time1 ), 2 )
2922 main.log.report(
2923 "Time taken for IPv6 Ping All: " +
2924 str( timeDiff ) +
2925 " seconds" )
2926 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2927 onpass="PING ALL PASS",
2928 onfail="PING ALL FAIL" )
2929
2930 case184Result = pingResult
2931 utilities.assert_equals(
2932 expect=main.TRUE,
2933 actual=case184Result,
2934 onpass="IPv6 Ping across 2278 host intents test PASS",
2935 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2936
2937 def CASE175( self ):
2938 """
2939 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2940 """
2941 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2942 main.log.report( "_________________________________________________" )
2943 import itertools
2944 import time
2945 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2946 main.step( "Verify IPv6 Ping across all hosts" )
2947 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2948 pingResult = main.FALSE
2949 time1 = time.time()
2950 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002951 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002952 main.log.warn("First ping failed. Retrying...")
2953 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002954 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002955
Hari Krishna4223dbd2015-08-13 16:29:53 -07002956 time2 = time.time()
2957 timeDiff = round( ( time2 - time1 ), 2 )
2958 main.log.report(
2959 "Time taken for IPv6 Ping All: " +
2960 str( timeDiff ) +
2961 " seconds" )
2962 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2963 onpass="PING ALL PASS",
2964 onfail="PING ALL FAIL" )
2965
2966 case175Result = pingResult
2967 utilities.assert_equals(
2968 expect=main.TRUE,
2969 actual=case175Result,
2970 onpass="IPv6 Ping across 4556 point intents test PASS",
2971 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2972
2973 def CASE185( self ):
2974 """
2975 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
2976 """
2977 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2978 main.log.report( "_________________________________________________" )
2979 import itertools
2980 import time
2981 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2982 main.step( "Verify IPv6 Ping across all hosts" )
2983 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
2984 pingResult = main.FALSE
2985 time1 = time.time()
2986 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07002987 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002988 main.log.warn("First ping failed. Retrying...")
2989 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07002990 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07002991
Hari Krishna4223dbd2015-08-13 16:29:53 -07002992 time2 = time.time()
2993 timeDiff = round( ( time2 - time1 ), 2 )
2994 main.log.report(
2995 "Time taken for IPv6 Ping All: " +
2996 str( timeDiff ) +
2997 " seconds" )
2998 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2999 onpass="PING ALL PASS",
3000 onfail="PING ALL FAIL" )
3001
3002 case183Result = pingResult
3003 utilities.assert_equals(
3004 expect=main.TRUE,
3005 actual=case183Result,
3006 onpass="IPv6 Ping across 4556 Point intents test PASS",
3007 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3008
Hari Krishnac195f3b2015-07-08 20:02:24 -07003009 def CASE90( self ):
3010 """
3011 Install 600 point intents and verify ping all (Att Topology)
3012 """
3013 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3014 main.log.report( "_______________________________________" )
3015 import itertools
3016 import time
3017 main.case( "Install 600 point intents" )
3018 main.step( "Add point Intents" )
3019 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003020 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3021
Hari Krishnac195f3b2015-07-08 20:02:24 -07003022 intentIdList = []
3023 time1 = time.time()
3024 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3025 pool = []
3026 for cli in main.CLIs:
3027 if i >= len( deviceCombos ):
3028 break
3029 t = main.Thread( target=cli.addPointIntent,
3030 threadID=main.threadID,
3031 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003032 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 -07003033 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003034 t.start()
3035 i = i + 1
3036 main.threadID = main.threadID + 1
3037 for thread in pool:
3038 thread.join()
3039 intentIdList.append(thread.result)
3040 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003041 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003042
GlennRCfcfdc4f2015-09-30 16:01:57 -07003043 # Saving intent ids to check intents in later case
3044 main.intentIds = list(intentIdList)
3045
GlennRCa8d786a2015-09-23 17:40:11 -07003046 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003047
3048 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07003049 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07003050 if i != 0:
3051 main.log.warn( "Verification failed. Retrying..." )
3052 main.log.info("Waiting for onos to install intents...")
3053 time.sleep( main.checkIntentsDelay )
3054
GlennRCa8d786a2015-09-23 17:40:11 -07003055 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003056 for e in range(int(main.numCtrls)):
3057 main.log.info( "Checking intents on CLI %s" % (e+1) )
3058 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3059 intentState
3060 if not intentState:
3061 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003062 if intentState:
3063 break
GlennRCdb2c8422015-09-29 12:21:59 -07003064 else:
3065 #Dumping intent summary
3066 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003067
3068 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3069 onpass="INTENTS INSTALLED",
3070 onfail="SOME INTENTS NOT INSTALLED" )
3071
Hari Krishnac195f3b2015-07-08 20:02:24 -07003072 main.step( "Verify Ping across all hosts" )
3073 pingResult = main.FALSE
3074 time1 = time.time()
3075 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3076 time2 = time.time()
3077 timeDiff = round( ( time2 - time1 ), 2 )
3078 main.log.report(
3079 "Time taken for Ping All: " +
3080 str( timeDiff ) +
3081 " seconds" )
3082 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3083 onpass="PING tALL PASS",
3084 onfail="PING ALL FAIL" )
3085
GlennRCdb2c8422015-09-29 12:21:59 -07003086 case90Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003087
Hari Krishnac195f3b2015-07-08 20:02:24 -07003088 utilities.assert_equals(
3089 expect=main.TRUE,
3090 actual=case90Result,
3091 onpass="Install 600 point Intents and Ping All test PASS",
3092 onfail="Install 600 point Intents and Ping All test FAIL" )
3093
3094 def CASE91( self ):
3095 """
3096 Install 600 point intents and verify ping all (Chordal Topology)
3097 """
3098 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3099 main.log.report( "_______________________________________" )
3100 import itertools
3101 import time
3102 main.case( "Install 600 point intents" )
3103 main.step( "Add point Intents" )
3104 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003105 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3106
Hari Krishnac195f3b2015-07-08 20:02:24 -07003107 intentIdList = []
3108 time1 = time.time()
3109 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3110 pool = []
3111 for cli in main.CLIs:
3112 if i >= len( deviceCombos ):
3113 break
3114 t = main.Thread( target=cli.addPointIntent,
3115 threadID=main.threadID,
3116 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003117 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 -07003118 pool.append(t)
3119 #time.sleep(1)
3120 t.start()
3121 i = i + 1
3122 main.threadID = main.threadID + 1
3123 for thread in pool:
3124 thread.join()
3125 intentIdList.append(thread.result)
3126 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003127 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003128
GlennRCfcfdc4f2015-09-30 16:01:57 -07003129 # Saving intent ids to check intents in later case
3130 main.intentIds = list(intentIdList)
3131
GlennRCa8d786a2015-09-23 17:40:11 -07003132 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003133
3134 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07003135 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07003136 if i != 0:
3137 main.log.warn( "Verification failed. Retrying..." )
3138 main.log.info("Waiting for onos to install intents...")
3139 time.sleep( main.checkIntentsDelay )
3140
GlennRCa8d786a2015-09-23 17:40:11 -07003141 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003142 for e in range(int(main.numCtrls)):
3143 main.log.info( "Checking intents on CLI %s" % (e+1) )
3144 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3145 intentState
3146 if not intentState:
3147 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003148 if intentState:
3149 break
GlennRCdb2c8422015-09-29 12:21:59 -07003150 else:
3151 #Dumping intent summary
3152 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003153
3154 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3155 onpass="INTENTS INSTALLED",
3156 onfail="SOME INTENTS NOT INSTALLED" )
3157
Hari Krishnac195f3b2015-07-08 20:02:24 -07003158 main.step( "Verify Ping across all hosts" )
3159 pingResult = main.FALSE
3160 time1 = time.time()
3161 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3162 time2 = time.time()
3163 timeDiff = round( ( time2 - time1 ), 2 )
3164 main.log.report(
3165 "Time taken for Ping All: " +
3166 str( timeDiff ) +
3167 " seconds" )
3168 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3169 onpass="PING ALL PASS",
3170 onfail="PING ALL FAIL" )
3171
GlennRCdb2c8422015-09-29 12:21:59 -07003172 case91Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003173
Hari Krishnac195f3b2015-07-08 20:02:24 -07003174 utilities.assert_equals(
3175 expect=main.TRUE,
3176 actual=case91Result,
3177 onpass="Install 600 point Intents and Ping All test PASS",
3178 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003179
Hari Krishnac195f3b2015-07-08 20:02:24 -07003180 def CASE92( self ):
3181 """
3182 Install 4556 point intents and verify ping all (Spine Topology)
3183 """
3184 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3185 main.log.report( "_______________________________________" )
3186 import itertools
3187 import time
3188 main.case( "Install 4556 point intents" )
3189 main.step( "Add point Intents" )
3190 intentResult = main.TRUE
3191 main.pingTimeout = 600
3192 for i in range(len(main.hostMACs)):
3193 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3194 print main.MACsDict
3195 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3196 intentIdList = []
3197 time1 = time.time()
3198 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3199 pool = []
3200 for cli in main.CLIs:
3201 if i >= len( deviceCombos ):
3202 break
3203 t = main.Thread( target=cli.addPointIntent,
3204 threadID=main.threadID,
3205 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003206 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 -07003207 pool.append(t)
3208 #time.sleep(1)
3209 t.start()
3210 i = i + 1
3211 main.threadID = main.threadID + 1
3212 for thread in pool:
3213 thread.join()
3214 intentIdList.append(thread.result)
3215 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003216 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003217
GlennRCfcfdc4f2015-09-30 16:01:57 -07003218 # Saving intent ids to check intents in later case
3219 main.intentIds = list(intentIdList)
3220
GlennRCa8d786a2015-09-23 17:40:11 -07003221 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003222
3223 # Giving onos 3 chances to install intents
GlennRCa8d786a2015-09-23 17:40:11 -07003224 for i in range(3):
GlennRCdb2c8422015-09-29 12:21:59 -07003225 if i != 0:
3226 main.log.warn( "Verification failed. Retrying..." )
3227 main.log.info("Waiting for onos to install intents...")
3228 time.sleep( main.checkIntentsDelay )
3229
GlennRCa8d786a2015-09-23 17:40:11 -07003230 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003231 for e in range(int(main.numCtrls)):
3232 main.log.info( "Checking intents on CLI %s" % (e+1) )
3233 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3234 intentState
3235 if not intentState:
3236 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003237 if intentState:
3238 break
GlennRCdb2c8422015-09-29 12:21:59 -07003239 else:
3240 #Dumping intent summary
3241 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003242
3243 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3244 onpass="INTENTS INSTALLED",
3245 onfail="SOME INTENTS NOT INSTALLED" )
3246
Hari Krishnac195f3b2015-07-08 20:02:24 -07003247 main.step( "Verify Ping across all hosts" )
3248 pingResult = main.FALSE
3249 time1 = time.time()
3250 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3251 time2 = time.time()
3252 timeDiff = round( ( time2 - time1 ), 2 )
3253 main.log.report(
3254 "Time taken for Ping All: " +
3255 str( timeDiff ) +
3256 " seconds" )
3257 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3258 onpass="PING ALL PASS",
3259 onfail="PING ALL FAIL" )
3260
GlennRCdb2c8422015-09-29 12:21:59 -07003261 case92Result = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003262
Hari Krishnac195f3b2015-07-08 20:02:24 -07003263 utilities.assert_equals(
3264 expect=main.TRUE,
3265 actual=case92Result,
3266 onpass="Install 4556 point Intents and Ping All test PASS",
3267 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003268
Hari Krishnac195f3b2015-07-08 20:02:24 -07003269 def CASE93( self ):
3270 """
3271 Install multi-single point intents and verify Ping all works
3272 for att topology
3273 """
3274 import copy
3275 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003276 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003277 main.log.report( "Install multi-single point intents and verify Ping all" )
3278 main.log.report( "___________________________________________" )
3279 main.case( "Install multi-single point intents and Ping all" )
3280 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3281 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3282 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003283 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003284 time1 = time.time()
3285 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3286 pool = []
3287 for cli in main.CLIs:
3288 egressDevice = deviceDPIDsCopy[i]
3289 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3290 ingressDeviceList.remove(egressDevice)
3291 if i >= len( deviceDPIDsCopy ):
3292 break
3293 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3294 threadID=main.threadID,
3295 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003296 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003297 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003298 t.start()
3299 i = i + 1
3300 main.threadID = main.threadID + 1
3301 for thread in pool:
3302 thread.join()
3303 intentIdList.append(thread.result)
3304 time2 = time.time()
3305 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003306
GlennRCdb2c8422015-09-29 12:21:59 -07003307 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003308
GlennRCdb2c8422015-09-29 12:21:59 -07003309 # Giving onos 3 chances to install intents
3310 for i in range(3):
3311 if i != 0:
3312 main.log.warn( "Verification failed. Retrying..." )
3313 main.log.info("Waiting for onos to install intents...")
3314 time.sleep( main.checkIntentsDelay )
3315
3316 intentState = main.TRUE
3317 for e in range(int(main.numCtrls)):
3318 main.log.info( "Checking intents on CLI %s" % (e+1) )
3319 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3320 intentState
3321 if not intentState:
3322 main.log.warn( "Not all intents installed" )
3323 if intentState:
3324 break
3325 else:
3326 #Dumping intent summary
3327 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3328
3329 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3330 onpass="INTENTS INSTALLED",
3331 onfail="SOME INTENTS NOT INSTALLED" )
3332
3333 main.log.info( "Checking flows state" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003334 checkFlowsState = main.ONOScli1.checkFlowsState()
GlennRCdb2c8422015-09-29 12:21:59 -07003335 # Giving onos time to return the state of the flows
Hari Krishnac195f3b2015-07-08 20:02:24 -07003336 time.sleep(50)
GlennRCdb2c8422015-09-29 12:21:59 -07003337
Hari Krishnac195f3b2015-07-08 20:02:24 -07003338 main.step( "Verify Ping across all hosts" )
3339 pingResult = main.FALSE
3340 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003341 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3342 if not pingResult:
3343 time1 = time.time()
3344 main.log.warn("First pingall failed. Retrying")
3345 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3346
Hari Krishnac195f3b2015-07-08 20:02:24 -07003347 time2 = time.time()
3348 timeDiff = round( ( time2 - time1 ), 2 )
3349 main.log.report(
3350 "Time taken for Ping All: " +
3351 str( timeDiff ) +
3352 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003353
3354 case93Result = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003355 utilities.assert_equals(
3356 expect=main.TRUE,
3357 actual=case93Result,
3358 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3359 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003360
Hari Krishnac195f3b2015-07-08 20:02:24 -07003361 def CASE94( self ):
3362 """
3363 Install multi-single point intents and verify Ping all works
3364 for Chordal topology
3365 """
3366 import copy
3367 import time
3368 main.log.report( "Install multi-single point intents and verify Ping all" )
3369 main.log.report( "___________________________________________" )
3370 main.case( "Install multi-single point intents and Ping all" )
3371 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3372 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3373 intentIdList = []
3374 print "MACsDict", main.MACsDict
3375 time1 = time.time()
3376 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3377 pool = []
3378 for cli in main.CLIs:
3379 egressDevice = deviceDPIDsCopy[i]
3380 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3381 ingressDeviceList.remove(egressDevice)
3382 if i >= len( deviceDPIDsCopy ):
3383 break
3384 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3385 threadID=main.threadID,
3386 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003387 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003388 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003389 t.start()
3390 i = i + 1
3391 main.threadID = main.threadID + 1
3392 for thread in pool:
3393 thread.join()
3394 intentIdList.append(thread.result)
3395 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003396 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003397
3398 main.step("Verify intents are installed")
3399
3400 # Giving onos 3 chances to install intents
3401 for i in range(3):
3402 if i != 0:
3403 main.log.warn( "Verification failed. Retrying..." )
3404 main.log.info("Waiting for onos to install intents...")
3405 time.sleep( main.checkIntentsDelay )
3406
3407 intentState = main.TRUE
3408 for e in range(int(main.numCtrls)):
3409 main.log.info( "Checking intents on CLI %s" % (e+1) )
3410 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3411 intentState
3412 if not intentState:
3413 main.log.warn( "Not all intents installed" )
3414 if intentState:
3415 break
3416 else:
3417 #Dumping intent summary
3418 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3419
3420
3421 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3422 onpass="INTENTS INSTALLED",
3423 onfail="SOME INTENTS NOT INSTALLED" )
3424
Hari Krishnac195f3b2015-07-08 20:02:24 -07003425 main.step( "Verify Ping across all hosts" )
3426 pingResult = main.FALSE
3427 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003428 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3429 if not pingResult:
3430 main.log.info( "First pingall failed. Retrying..." )
3431 time1 = time.time()
3432 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003433 time2 = time.time()
3434 timeDiff = round( ( time2 - time1 ), 2 )
3435 main.log.report(
3436 "Time taken for Ping All: " +
3437 str( timeDiff ) +
3438 " seconds" )
3439
GlennRCdb2c8422015-09-29 12:21:59 -07003440
3441 case94Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003442 utilities.assert_equals(
3443 expect=main.TRUE,
3444 actual=case94Result,
3445 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3446 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003447
Hari Krishnac195f3b2015-07-08 20:02:24 -07003448 #def CASE95 multi-single point intent for Spine
3449
3450 def CASE96( self ):
3451 """
3452 Install single-multi point intents and verify Ping all works
3453 for att topology
3454 """
3455 import copy
3456 main.log.report( "Install single-multi point intents and verify Ping all" )
3457 main.log.report( "___________________________________________" )
3458 main.case( "Install single-multi point intents and Ping all" )
3459 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3460 portEgressList = ['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 ingressDevice = deviceDPIDsCopy[i]
3468 egressDeviceList = copy.copy(deviceDPIDsCopy)
3469 egressDeviceList.remove(ingressDevice)
3470 if i >= len( deviceDPIDsCopy ):
3471 break
3472 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3473 threadID=main.threadID,
3474 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003475 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
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 case96Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003529 utilities.assert_equals(
3530 expect=main.TRUE,
3531 actual=case96Result,
3532 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3533 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3534
3535 def CASE97( self ):
3536 """
3537 Install single-multi point intents and verify Ping all works
3538 for Chordal topology
3539 """
3540 import copy
3541 main.log.report( "Install single-multi point intents and verify Ping all" )
3542 main.log.report( "___________________________________________" )
3543 main.case( "Install single-multi point intents and Ping all" )
3544 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3545 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3546 intentIdList = []
3547 print "MACsDict", main.MACsDict
3548 time1 = time.time()
3549 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3550 pool = []
3551 for cli in main.CLIs:
3552 ingressDevice = deviceDPIDsCopy[i]
3553 egressDeviceList = copy.copy(deviceDPIDsCopy)
3554 egressDeviceList.remove(ingressDevice)
3555 if i >= len( deviceDPIDsCopy ):
3556 break
3557 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3558 threadID=main.threadID,
3559 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003560 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003561 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003562 t.start()
3563 i = i + 1
3564 main.threadID = main.threadID + 1
3565 for thread in pool:
3566 thread.join()
3567 intentIdList.append(thread.result)
3568 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003569 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003570
3571 main.step("Verify intents are installed")
3572
3573 # Giving onos 3 chances to install intents
3574 for i in range(3):
3575 if i != 0:
3576 main.log.warn( "Verification failed. Retrying..." )
3577 main.log.info("Waiting for onos to install intents...")
3578 time.sleep( main.checkIntentsDelay )
3579
3580 intentState = main.TRUE
3581 for e in range(int(main.numCtrls)):
3582 main.log.info( "Checking intents on CLI %s" % (e+1) )
3583 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3584 intentState
3585 if not intentState:
3586 main.log.warn( "Not all intents installed" )
3587 if intentState:
3588 break
3589 else:
3590 #Dumping intent summary
3591 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3592
3593
3594 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3595 onpass="INTENTS INSTALLED",
3596 onfail="SOME INTENTS NOT INSTALLED" )
3597
Hari Krishnac195f3b2015-07-08 20:02:24 -07003598 main.step( "Verify Ping across all hosts" )
3599 pingResult = main.FALSE
3600 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003601 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3602 if not pingResult:
3603 main.log.info( "First pingall failed. Retrying..." )
3604 time1 = time.time()
3605 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003606 time2 = time.time()
3607 timeDiff = round( ( time2 - time1 ), 2 )
3608 main.log.report(
3609 "Time taken for Ping All: " +
3610 str( timeDiff ) +
3611 " seconds" )
3612
GlennRCdb2c8422015-09-29 12:21:59 -07003613 case97Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003614 utilities.assert_equals(
3615 expect=main.TRUE,
3616 actual=case97Result,
3617 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3618 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3619
3620 def CASE98( self ):
3621 """
3622 Install single-multi point intents and verify Ping all works
3623 for Spine topology
3624 """
3625 import copy
3626 main.log.report( "Install single-multi point intents and verify Ping all" )
3627 main.log.report( "___________________________________________" )
3628 main.case( "Install single-multi point intents and Ping all" )
3629 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3630 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3631 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3632 intentIdList = []
3633 MACsDictCopy = {}
3634 for i in range( len( deviceDPIDsCopy ) ):
3635 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3636
3637 print "deviceDPIDsCopy", deviceDPIDsCopy
3638 print ""
3639 print "MACsDictCopy", MACsDictCopy
3640 time1 = time.time()
3641 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3642 pool = []
3643 for cli in main.CLIs:
3644 if i >= len( deviceDPIDsCopy ):
3645 break
3646 ingressDevice = deviceDPIDsCopy[i]
3647 egressDeviceList = copy.copy(deviceDPIDsCopy)
3648 egressDeviceList.remove(ingressDevice)
3649 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3650 threadID=main.threadID,
3651 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003652 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003653 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003654 t.start()
3655 i = i + 1
3656 main.threadID = main.threadID + 1
3657 for thread in pool:
3658 thread.join()
3659 intentIdList.append(thread.result)
3660 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003661 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003662
3663 main.step("Verify intents are installed")
3664
3665 # Giving onos 3 chances to install intents
3666 for i in range(3):
3667 if i != 0:
3668 main.log.warn( "Verification failed. Retrying..." )
3669 main.log.info("Waiting for onos to install intents...")
3670 time.sleep( main.checkIntentsDelay )
3671
3672 intentState = main.TRUE
3673 for e in range(int(main.numCtrls)):
3674 main.log.info( "Checking intents on CLI %s" % (e+1) )
3675 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3676 intentState
3677 if not intentState:
3678 main.log.warn( "Not all intents installed" )
3679 if intentState:
3680 break
3681 else:
3682 #Dumping intent summary
3683 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3684
3685
3686 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3687 onpass="INTENTS INSTALLED",
3688 onfail="SOME INTENTS NOT INSTALLED" )
3689
Hari Krishnac195f3b2015-07-08 20:02:24 -07003690 main.step( "Verify Ping across all hosts" )
3691 pingResult = main.FALSE
3692 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003693 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3694 if not pingResult:
3695 main.log.info( "First pingall failed. Retrying..." )
3696 time1 = time.time()
3697 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003698 time2 = time.time()
3699 timeDiff = round( ( time2 - time1 ), 2 )
3700 main.log.report(
3701 "Time taken for Ping All: " +
3702 str( timeDiff ) +
3703 " seconds" )
3704
GlennRCdb2c8422015-09-29 12:21:59 -07003705 case98Result = ( pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003706 utilities.assert_equals(
3707 expect=main.TRUE,
3708 actual=case98Result,
3709 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3710 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3711
Hari Krishna4223dbd2015-08-13 16:29:53 -07003712 def CASE190( self ):
3713 """
3714 Verify IPv6 ping across 600 Point intents (Att Topology)
3715 """
3716 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3717 main.log.report( "_________________________________________________" )
3718 import itertools
3719 import time
3720 main.case( "IPv6 ping all 600 Point intents" )
3721 main.step( "Verify IPv6 Ping across all hosts" )
3722 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3723 pingResult = main.FALSE
3724 time1 = time.time()
3725 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003726 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003727 main.log.warn("First pingall failed. Retrying...")
3728 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003729 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3730
Hari Krishna4223dbd2015-08-13 16:29:53 -07003731 time2 = time.time()
3732 timeDiff = round( ( time2 - time1 ), 2 )
3733 main.log.report(
3734 "Time taken for IPv6 Ping All: " +
3735 str( timeDiff ) +
3736 " seconds" )
3737 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3738 onpass="PING ALL PASS",
3739 onfail="PING ALL FAIL" )
3740
3741 case160Result = pingResult
3742 utilities.assert_equals(
3743 expect=main.TRUE,
3744 actual=case160Result,
3745 onpass="IPv6 Ping across 600 Point intents test PASS",
3746 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3747
3748 def CASE191( self ):
3749 """
3750 Verify IPv6 ping across 600 Point intents (Chordal Topology)
3751 """
3752 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3753 main.log.report( "_________________________________________________" )
3754 import itertools
3755 import time
3756 main.case( "IPv6 ping all 600 Point intents" )
3757 main.step( "Verify IPv6 Ping across all hosts" )
3758 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
3759 pingResult = main.FALSE
3760 time1 = time.time()
3761 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRC626ba132015-09-18 16:16:31 -07003762 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003763 main.log.warn("First pingall failed. Retrying...")
3764 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003765 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003766
Hari Krishna4223dbd2015-08-13 16:29:53 -07003767 time2 = time.time()
3768 timeDiff = round( ( time2 - time1 ), 2 )
3769 main.log.report(
3770 "Time taken for IPv6 Ping All: " +
3771 str( timeDiff ) +
3772 " seconds" )
3773 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3774 onpass="PING ALL PASS",
3775 onfail="PING ALL FAIL" )
3776
3777 case191Result = pingResult
3778 utilities.assert_equals(
3779 expect=main.TRUE,
3780 actual=case191Result,
3781 onpass="IPv6 Ping across 600 Point intents test PASS",
3782 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3783
3784 def CASE192( self ):
3785 """
3786 Verify IPv6 ping across 4556 Point intents (Spine Topology)
3787 """
3788 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3789 main.log.report( "_________________________________________________" )
3790 import itertools
3791 import time
Hari Krishna310efca2015-09-03 09:43:16 -07003792 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003793 main.step( "Verify IPv6 Ping across all hosts" )
3794 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
3795 pingResult = main.FALSE
3796 time1 = time.time()
3797 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
GlennRCa8d786a2015-09-23 17:40:11 -07003798 if not pingResult:
3799 main.log.warn("First pingall failed. Retrying...")
3800 time1 = time.time()
3801 pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
3802
Hari Krishna4223dbd2015-08-13 16:29:53 -07003803 time2 = time.time()
3804 timeDiff = round( ( time2 - time1 ), 2 )
3805 main.log.report(
3806 "Time taken for IPv6 Ping All: " +
3807 str( timeDiff ) +
3808 " seconds" )
3809 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3810 onpass="PING ALL PASS",
3811 onfail="PING ALL FAIL" )
3812
3813 case192Result = pingResult
3814 utilities.assert_equals(
3815 expect=main.TRUE,
3816 actual=case192Result,
Hari Krishna310efca2015-09-03 09:43:16 -07003817 onpass="IPv6 Ping across 4556 Point intents test PASS",
3818 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003819
Hari Krishnac195f3b2015-07-08 20:02:24 -07003820 def CASE10( self ):
3821 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003822 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003823 """
3824 Remove all Intents
3825 """
3826 main.log.report( "Remove all intents that were installed previously" )
3827 main.log.report( "______________________________________________" )
3828 main.log.info( "Remove all intents" )
3829 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003830 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003831 main.step( "Obtain the intent id's first" )
3832 intentsList = main.ONOScli1.getAllIntentIds()
3833 ansi_escape = re.compile( r'\x1b[^m]*m' )
3834 intentsList = ansi_escape.sub( '', intentsList )
3835 intentsList = intentsList.replace(
3836 " onos:intents | grep id=",
3837 "" ).replace(
3838 "id=",
3839 "" ).replace(
3840 "\r\r",
3841 "" )
3842 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003843 intentIdList = []
3844 step1Result = main.TRUE
3845 moreIntents = main.TRUE
3846 removeIntentCount = 0
3847 intentsCount = len(intentsList)
3848 main.log.info ( "Current number of intents: " + str(intentsCount) )
3849 if ( len( intentsList ) > 1 ):
3850 results = main.TRUE
3851 main.log.info("Removing intent...")
3852 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07003853 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003854 if removeIntentCount == 5:
3855 break
3856 removeIntentCount = removeIntentCount + 1
3857 intentsList1 = main.ONOScli1.getAllIntentIds()
3858 if len( intentsList1 ) == 0:
3859 break
3860 ansi_escape = re.compile( r'\x1b[^m]*m' )
3861 intentsList1 = ansi_escape.sub( '', intentsList1 )
3862 intentsList1 = intentsList1.replace(
3863 " onos:intents | grep id=",
3864 "" ).replace(
3865 " state=",
3866 "" ).replace(
3867 "\r\r",
3868 "" )
3869 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003870 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
3871 print intentsList1
3872 intentIdList1 = []
3873 if ( len( intentsList1 ) > 0 ):
3874 moreIntents = main.TRUE
3875 for i in range( len( intentsList1 ) ):
3876 intentsTemp1 = intentsList1[ i ].split( ',' )
3877 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
3878 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
3879 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
3880 time1 = time.time()
3881 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
3882 pool = []
3883 for cli in main.CLIs:
3884 if i >= len( intentIdList1 ):
3885 break
3886 t = main.Thread( target=cli.removeIntent,
3887 threadID=main.threadID,
3888 name="removeIntent",
3889 args=[intentIdList1[i],'org.onosproject.cli',False,False])
3890 pool.append(t)
3891 t.start()
3892 i = i + 1
3893 main.threadID = main.threadID + 1
3894 for thread in pool:
3895 thread.join()
3896 intentIdList.append(thread.result)
3897 #time.sleep(2)
3898 time2 = time.time()
3899 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07003900 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003901 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07003902 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003903 else:
3904 time.sleep(10)
3905 if len( main.ONOScli1.intents()):
3906 continue
3907 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003908 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003909 else:
3910 print "Removed %d intents" %(intentsCount)
3911 step1Result = main.TRUE
3912 else:
3913 print "No Intent IDs found in Intents list: ", intentsList
3914 step1Result = main.FALSE
3915
3916 print main.ONOScli1.intents()
3917 caseResult10 = step1Result
3918 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
3919 onpass="Intent removal test successful",
3920 onfail="Intent removal test failed" )
3921
3922 def CASE12( self, main ):
3923 """
3924 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3925 """
3926 import re
3927 import copy
3928 import time
3929
Hari Krishnac195f3b2015-07-08 20:02:24 -07003930 threadID = 0
3931
3932 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3933 main.log.report( "_____________________________________________________" )
3934 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3935 main.step( "Enable intent based Reactive forwarding" )
3936 installResult = main.FALSE
3937 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003938
Hari Krishnac195f3b2015-07-08 20:02:24 -07003939 pool = []
3940 time1 = time.time()
3941 for cli,feature in main.CLIs:
3942 t = main.Thread(target=cli,threadID=threadID,
3943 name="featureInstall",args=[feature])
3944 pool.append(t)
3945 t.start()
3946 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003947
Hari Krishnac195f3b2015-07-08 20:02:24 -07003948 results = []
3949 for thread in pool:
3950 thread.join()
3951 results.append(thread.result)
3952 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003953
Hari Krishnac195f3b2015-07-08 20:02:24 -07003954 if( all(result == main.TRUE for result in results) == False):
3955 main.log.info("Did not install onos-app-ifwd feature properly")
3956 #main.cleanup()
3957 #main.exit()
3958 else:
3959 main.log.info("Successful feature:install onos-app-ifwd")
3960 installResult = main.TRUE
3961 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003962
Hari Krishnac195f3b2015-07-08 20:02:24 -07003963 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07003964 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07003965 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07003966 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003967 time2 = time.time()
3968 timeDiff = round( ( time2 - time1 ), 2 )
3969 main.log.report(
3970 "Time taken for Ping All: " +
3971 str( timeDiff ) +
3972 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003973
GlennRC626ba132015-09-18 16:16:31 -07003974 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003975 main.log.report( "Pingall Test in Reactive mode successful" )
3976 else:
3977 main.log.report( "Pingall Test in Reactive mode failed" )
3978
3979 main.step( "Disable Intent based Reactive forwarding" )
3980 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003981
Hari Krishnac195f3b2015-07-08 20:02:24 -07003982 pool = []
3983 time1 = time.time()
3984 for cli,feature in main.CLIs:
3985 t = main.Thread(target=cli,threadID=threadID,
3986 name="featureUninstall",args=[feature])
3987 pool.append(t)
3988 t.start()
3989 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003990
Hari Krishnac195f3b2015-07-08 20:02:24 -07003991 results = []
3992 for thread in pool:
3993 thread.join()
3994 results.append(thread.result)
3995 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003996
Hari Krishnac195f3b2015-07-08 20:02:24 -07003997 if( all(result == main.TRUE for result in results) == False):
3998 main.log.info("Did not uninstall onos-app-ifwd feature properly")
3999 uninstallResult = main.FALSE
4000 #main.cleanup()
4001 #main.exit()
4002 else:
4003 main.log.info("Successful feature:uninstall onos-app-ifwd")
4004 uninstallResult = main.TRUE
4005 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4006
4007 # Waiting for reative flows to be cleared.
4008 time.sleep( 10 )
4009
GlennRC626ba132015-09-18 16:16:31 -07004010 case11Result = installResult and pingResult and uninstallResult
Hari Krishnac195f3b2015-07-08 20:02:24 -07004011 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
4012 onpass="Intent based Reactive forwarding Pingall test PASS",
4013 onfail="Intent based Reactive forwarding Pingall test FAIL" )