blob: dc1dfd7e69f468fbf66e5aa6b9cc5c1f099226e5 [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
GlennRCef344fc2015-12-11 17:56:57 -080030 main.pingTimeout = 600
Hari Krishnac195f3b2015-07-08 20:02:24 -070031 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'] )
GlennRCf7be6632015-10-20 13:04:07 -070036 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070037 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070038 main.intentCheck = int( main.params['TEST']['intentChecks'] )
GlennRC289c1b62015-12-12 10:45:43 -080039 main.topoCheck = int( main.params['TEST']['topoChecks'] )
GlennRCf7be6632015-10-20 13:04:07 -070040 main.numPings = int( main.params['TEST']['numPings'] )
GlennRC6ac11b12015-10-21 17:41:28 -070041 main.pingSleep = int( main.params['timers']['pingSleep'] )
GlennRC289c1b62015-12-12 10:45:43 -080042 main.topoCheckDelay = int( main.params['timers']['topoCheckDelay'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070043 main.newTopo = ""
44 main.CLIs = []
GlennRC186b7362015-12-11 18:20:16 -080045 main.prefix = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -070046
GlennRC9e7465e2015-10-02 13:50:36 -070047 main.failSwitch = True if main.failSwitch == "on" else False
48 main.emailOnStop = True if main.emailOnStop == "on" else False
49
Hari Krishnac195f3b2015-07-08 20:02:24 -070050 for i in range( 1, int(main.numCtrls) + 1 ):
51 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070052
53 main.case( "Set up test environment" )
54 main.log.report( "Set up test environment" )
55 main.log.report( "_______________________" )
56
Hari Krishna6185fc12015-07-13 15:42:31 -070057 main.step( "Apply Cell environment for ONOS" )
58 if ( main.onoscell ):
59 cellName = main.onoscell
60 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070061 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
62 onpass="Test step PASS",
63 onfail="Test step FAIL" )
64 else:
65 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
66 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080067 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070068 main.exit()
69
Hari Krishnac195f3b2015-07-08 20:02:24 -070070 main.step( "Git checkout and pull " + git_branch )
71 if git_pull == 'on':
72 checkout_result = main.ONOSbench.gitCheckout( git_branch )
73 pull_result = main.ONOSbench.gitPull()
74 cp_result = ( checkout_result and pull_result )
75 else:
76 checkout_result = main.TRUE
77 pull_result = main.TRUE
78 main.log.info( "Skipped git checkout and pull" )
79 cp_result = ( checkout_result and pull_result )
80 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
81 onpass="Test step PASS",
82 onfail="Test step FAIL" )
83
84 main.step( "mvn clean & install" )
85 if git_pull == 'on':
86 mvn_result = main.ONOSbench.cleanInstall()
87 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
88 onpass="Test step PASS",
89 onfail="Test step FAIL" )
90 else:
91 mvn_result = main.TRUE
92 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
93
94 main.ONOSbench.getVersion( report=True )
95
Hari Krishnac195f3b2015-07-08 20:02:24 -070096 main.step( "Create ONOS package" )
97 packageResult = main.ONOSbench.onosPackage()
98 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
99 onpass="Test step PASS",
100 onfail="Test step FAIL" )
101
102 main.step( "Uninstall ONOS package on all Nodes" )
103 uninstallResult = main.TRUE
104 for i in range( int( main.numCtrls ) ):
105 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
106 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
107 utilities.assert_equals( expect=main.TRUE, actual=u_result,
108 onpass="Test step PASS",
109 onfail="Test step FAIL" )
110 uninstallResult = ( uninstallResult and u_result )
111
112 main.step( "Install ONOS package on all Nodes" )
113 installResult = main.TRUE
114 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700115 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700116 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
117 utilities.assert_equals( expect=main.TRUE, actual=i_result,
118 onpass="Test step PASS",
119 onfail="Test step FAIL" )
120 installResult = ( installResult and i_result )
121
122 main.step( "Verify ONOS nodes UP status" )
123 statusResult = main.TRUE
124 for i in range( int( main.numCtrls ) ):
125 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
126 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
127 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
128 onpass="Test step PASS",
129 onfail="Test step FAIL" )
130 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700131
Hari Krishnac195f3b2015-07-08 20:02:24 -0700132 main.step( "Start ONOS CLI on all nodes" )
133 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700134 main.log.step(" Start ONOS cli using thread ")
135 startCliResult = main.TRUE
136 pool = []
137 time1 = time.time()
138 for i in range( int( main.numCtrls) ):
139 t = main.Thread( target=main.CLIs[i].startOnosCli,
140 threadID=main.threadID,
141 name="startOnosCli",
142 args=[ main.onosIPs[i], karafTimeout ] )
143 pool.append(t)
144 t.start()
145 main.threadID = main.threadID + 1
146 for t in pool:
147 t.join()
148 startCliResult = startCliResult and t.result
149 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700150
Hari Krishnac195f3b2015-07-08 20:02:24 -0700151 if not startCliResult:
152 main.log.info("ONOS CLI did not start up properly")
153 main.cleanup()
154 main.exit()
155 else:
156 main.log.info("Successful CLI startup")
157 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700158
159 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
160 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
161 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
162 cfgResult = cfgResult1 and cfgResult2
163 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
164 onpass="ipv6NeighborDiscovery cfg is set to true",
165 onfail="Failed to cfg set ipv6NeighborDiscovery" )
166
167 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700168 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
169 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
170 onpass="Set up test environment PASS",
171 onfail="Set up test environment FAIL" )
172
173 def CASE20( self, main ):
174 """
175 This test script Loads a new Topology (Att) on CHO setup and balances all switches
176 """
177 import re
178 import time
179 import copy
180
181 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
182 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
183 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
184 main.pingTimeout = 300
185 main.log.report(
186 "Load Att topology and Balance all Mininet switches across controllers" )
187 main.log.report(
188 "________________________________________________________________________" )
189 main.case(
190 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700191
Hari Krishnac195f3b2015-07-08 20:02:24 -0700192 main.step( "Stop any previous Mininet network topology" )
193 cliResult = main.TRUE
194 if main.newTopo == main.params['TOPO3']['topo']:
195 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
196
197 main.step( "Start Mininet with Att topology" )
198 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700199 mininetDir = main.Mininet1.home + "/custom/"
200 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
201 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
202 topoPath = mininetDir + main.newTopo
203 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700204
Hari Krishnac195f3b2015-07-08 20:02:24 -0700205 main.step( "Assign switches to controllers" )
206 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
207 main.Mininet1.assignSwController(
208 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700209 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700210
211 switch_mastership = main.TRUE
212 for i in range( 1, ( main.numMNswitches + 1 ) ):
213 response = main.Mininet1.getSwController( "s" + str( i ) )
214 print( "Response is " + str( response ) )
215 if re.search( "tcp:" + main.onosIPs[0], response ):
216 switch_mastership = switch_mastership and main.TRUE
217 else:
218 switch_mastership = main.FALSE
219
220 if switch_mastership == main.TRUE:
221 main.log.report( "Controller assignment successfull" )
222 else:
223 main.log.report( "Controller assignment failed" )
224
225 time.sleep(30) # waiting here to make sure topology converges across all nodes
226
227 main.step( "Balance devices across controllers" )
228 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700229 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700230 time.sleep( 5 )
231
232 topology_output = main.ONOScli1.topology()
233 topology_result = main.ONOSbench.getTopology( topology_output )
234 case2Result = ( switch_mastership and startStatus )
235 utilities.assert_equals(
236 expect=main.TRUE,
237 actual=case2Result,
238 onpass="Starting new Att topology test PASS",
239 onfail="Starting new Att topology test FAIL" )
240
241 def CASE21( self, main ):
242 """
243 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
244 """
245 import re
246 import time
247 import copy
248
GlennRC2db29952015-12-14 12:00:29 -0800249 main.prefix += 1
250
Hari Krishnac195f3b2015-07-08 20:02:24 -0700251 main.newTopo = main.params['TOPO2']['topo']
252 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
253 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
254 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
255 main.pingTimeout = 300
256 main.log.report(
257 "Load Chordal topology and Balance all Mininet switches across controllers" )
258 main.log.report(
259 "________________________________________________________________________" )
260 main.case(
261 "Assign and Balance all Mininet switches across controllers" )
262
263 main.step( "Stop any previous Mininet network topology" )
264 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
265
GlennRCc6cd2a62015-08-10 16:08:22 -0700266 main.step("Start Mininet with Chordal topology")
267 mininetDir = main.Mininet1.home + "/custom/"
268 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
269 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
270 topoPath = mininetDir + main.newTopo
271 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700272
273 main.step( "Assign switches to controllers" )
274
275 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
276 main.Mininet1.assignSwController(
277 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700278 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700279
280 switch_mastership = main.TRUE
281 for i in range( 1, ( main.numMNswitches + 1 ) ):
282 response = main.Mininet1.getSwController( "s" + str( i ) )
283 print( "Response is " + str( response ) )
284 if re.search( "tcp:" + main.onosIPs[0], response ):
285 switch_mastership = switch_mastership and main.TRUE
286 else:
287 switch_mastership = main.FALSE
288
289 if switch_mastership == main.TRUE:
290 main.log.report( "Controller assignment successfull" )
291 else:
292 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700293
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 main.step( "Balance devices across controllers" )
295 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700296 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297 time.sleep( 5 )
298
GlennRCbddd58f2015-10-01 15:45:25 -0700299 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300 time.sleep(30)
301 utilities.assert_equals(
302 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700303 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700304 onpass="Starting new Chordal topology test PASS",
305 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700306
Hari Krishnac195f3b2015-07-08 20:02:24 -0700307 def CASE22( self, main ):
308 """
309 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
310 """
311 import re
312 import time
313 import copy
314
GlennRC2db29952015-12-14 12:00:29 -0800315 main.prefix += 1
316
Hari Krishnac195f3b2015-07-08 20:02:24 -0700317 main.newTopo = main.params['TOPO3']['topo']
318 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
319 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
320 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
321 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700322
Hari Krishnac195f3b2015-07-08 20:02:24 -0700323 main.log.report(
324 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
325 main.log.report(
326 "________________________________________________________________________" )
327 main.case(
328 "Assign and Balance all Mininet switches across controllers" )
329 main.step( "Stop any previous Mininet network topology" )
330 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700331
332 main.step("Start Mininet with Spine topology")
333 mininetDir = main.Mininet1.home + "/custom/"
334 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
335 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
336 topoPath = mininetDir + main.newTopo
337 startStatus = main.Mininet1.startNet(topoFile = topoPath)
338
Hari Krishnac195f3b2015-07-08 20:02:24 -0700339 time.sleep(60)
340 main.step( "Assign switches to controllers" )
341
342 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
343 main.Mininet1.assignSwController(
344 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700345 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700346
347 switch_mastership = main.TRUE
348 for i in range( 1, ( main.numMNswitches + 1 ) ):
349 response = main.Mininet1.getSwController( "s" + str( i ) )
350 print( "Response is " + str( response ) )
351 if re.search( "tcp:" + main.onosIPs[0], response ):
352 switch_mastership = switch_mastership and main.TRUE
353 else:
354 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700355
Hari Krishnac195f3b2015-07-08 20:02:24 -0700356 if switch_mastership == main.TRUE:
357 main.log.report( "Controller assignment successfull" )
358 else:
359 main.log.report( "Controller assignment failed" )
360 time.sleep( 5 )
361
362 main.step( "Balance devices across controllers" )
363 for i in range( int( main.numCtrls ) ):
364 balanceResult = main.ONOScli1.balanceMasters()
365 # giving some breathing time for ONOS to complete re-balance
366 time.sleep( 3 )
367
GlennRCbddd58f2015-10-01 15:45:25 -0700368 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700369 time.sleep(60)
370 utilities.assert_equals(
371 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700372 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700373 onpass="Starting new Spine topology test PASS",
374 onfail="Starting new Spine topology test FAIL" )
375
376 def CASE3( self, main ):
377 """
378 This Test case will be extended to collect and store more data related
379 ONOS state.
380 """
381 import re
382 import copy
383 main.deviceDPIDs = []
384 main.hostMACs = []
385 main.deviceLinks = []
386 main.deviceActiveLinksCount = []
387 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700388
Hari Krishnac195f3b2015-07-08 20:02:24 -0700389 main.log.report(
390 "Collect and Store topology details from ONOS before running any Tests" )
391 main.log.report(
392 "____________________________________________________________________" )
393 main.case( "Collect and Store Topology Details from ONOS" )
394 main.step( "Collect and store current number of switches and links" )
395 topology_output = main.ONOScli1.topology()
396 topology_result = main.ONOSbench.getTopology( topology_output )
397 numOnosDevices = topology_result[ 'devices' ]
398 numOnosLinks = topology_result[ 'links' ]
399 topoResult = main.TRUE
400
GlennRCee8f3bf2015-12-14 16:18:39 -0800401 for check in range(main.topoCheck):
402 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
403 main.step( "Store Device DPIDs" )
404 for i in range( 1, (main.numMNswitches+1) ):
405 main.deviceDPIDs.append( "of:" + str(main.prefix) + "0000000000000%02d" % i )
406 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700407
GlennRCee8f3bf2015-12-14 16:18:39 -0800408 main.step( "Store Host MACs" )
409 for i in range( 1, ( main.numMNhosts + 1 ) ):
410 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
411 print "Host MACs in Store: \n", str( main.hostMACs )
412 main.MACsDict = {}
413 print "Creating dictionary of DPID and HostMacs"
414 for i in range(len(main.hostMACs)):
415 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
416 print main.MACsDict
417 main.step( "Collect and store all Devices Links" )
418 linksResult = main.ONOScli1.links( jsonFormat=False )
419 ansi_escape = re.compile( r'\x1b[^m]*m' )
420 linksResult = ansi_escape.sub( '', linksResult )
421 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
422 linksResult = linksResult.splitlines()
423 main.deviceLinks = copy.copy( linksResult )
424 print "Device Links Stored: \n", str( main.deviceLinks )
425 # this will be asserted to check with the params provided count of
426 # links
427 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700428
GlennRCee8f3bf2015-12-14 16:18:39 -0800429 main.step( "Collect and store each Device ports enabled Count" )
430 time1 = time.time()
431 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
432 pool = []
433 for cli in main.CLIs:
434 if i >= main.numMNswitches + 1:
435 break
436 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
437 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
438 t.start()
439 pool.append(t)
440 i = i + 1
441 main.threadID = main.threadID + 1
442 for thread in pool:
443 thread.join()
444 portResult = thread.result
445 main.devicePortsEnabledCount.append( portResult )
446 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
447 time2 = time.time()
448 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700449
GlennRCee8f3bf2015-12-14 16:18:39 -0800450 main.step( "Collect and store each Device active links Count" )
451 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700452
GlennRCee8f3bf2015-12-14 16:18:39 -0800453 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
454 pool = []
455 for cli in main.CLIs:
456 if i >= main.numMNswitches + 1:
457 break
458 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
459 t = main.Thread( target = cli.getDeviceLinksActiveCount,
460 threadID = main.threadID,
461 name = "getDevicePortsEnabledCount",
462 args = [dpid])
463 t.start()
464 pool.append(t)
465 i = i + 1
466 main.threadID = main.threadID + 1
467 for thread in pool:
468 thread.join()
469 linkCountResult = thread.result
470 main.deviceActiveLinksCount.append( linkCountResult )
471 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
472 time2 = time.time()
473 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700474
GlennRCee8f3bf2015-12-14 16:18:39 -0800475 # Exit out of the topo check loop
476 break
477
478 else:
479 main.log.info("Devices (expected): %s, Links (expected): %s" %
480 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
481 main.log.info("Devices (actual): %s, Links (actual): %s" %
482 ( numOnosDevices , numOnosLinks ) )
483 main.log.info("Topology does not match, trying again...")
484 topoResult = main.FALSE
485 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700486
487 # just returning TRUE for now as this one just collects data
488 case3Result = topoResult
489 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
490 onpass="Saving ONOS topology data test PASS",
491 onfail="Saving ONOS topology data test FAIL" )
492
GlennRC186b7362015-12-11 18:20:16 -0800493
Hari Krishnac195f3b2015-07-08 20:02:24 -0700494 def CASE40( self, main ):
495 """
GlennRC15d164c2015-12-15 17:12:25 -0800496 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700497 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700498 import time
GlennRC15d164c2015-12-15 17:12:25 -0800499 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700500 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800501 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700502
GlennRC15d164c2015-12-15 17:12:25 -0800503 main.step( "Enable Reactive forwarding" )
504 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
505 utilities.assert_equals( expect=main.TRUE, actual=appResult,
506 onpass="Successfully install fwd app",
507 onfail="Failed to install fwd app" )
508
Hari Krishnac195f3b2015-07-08 20:02:24 -0700509
GlennRC6ac11b12015-10-21 17:41:28 -0700510 main.step( "Verify Ping across all hosts" )
511 for i in range(main.numPings):
512 time1 = time.time()
513 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
514 if not pingResult:
515 main.log.warn("First pingall failed. Retrying...")
516 time.sleep(main.pingSleep)
GlennRC15d164c2015-12-15 17:12:25 -0800517 else:
518 break
GlennRC6ac11b12015-10-21 17:41:28 -0700519
Hari Krishnac195f3b2015-07-08 20:02:24 -0700520 time2 = time.time()
521 timeDiff = round( ( time2 - time1 ), 2 )
522 main.log.report(
523 "Time taken for Ping All: " +
524 str( timeDiff ) +
525 " seconds" )
526
GlennRC15d164c2015-12-15 17:12:25 -0800527 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700528 onpass="Reactive Mode IPv4 Pingall test PASS",
529 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700530
GlennRC15d164c2015-12-15 17:12:25 -0800531 main.step( "Disable Reactive forwarding" )
532 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
533 utilities.assert_equals( expect=main.TRUE, actual=appResult,
534 onpass="Succefully deactivated fwd app",
535 onfail="Failed to deactivate fwd app" )
536
Hari Krishnac195f3b2015-07-08 20:02:24 -0700537 def CASE41( self, main ):
538 """
539 Verify Reactive forwarding (Chordal Topology)
540 """
541 import re
542 import copy
543 import time
544 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
545 main.log.report( "______________________________________________" )
546 main.case( "Enable Reactive forwarding and Verify ping all" )
547 main.step( "Enable Reactive forwarding" )
548 installResult = main.TRUE
549 # Activate fwd app
550 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
551
552 appCheck = main.TRUE
553 pool = []
554 for cli in main.CLIs:
555 t = main.Thread( target=cli.appToIDCheck,
556 name="appToIDCheck-" + str( i ),
557 args=[] )
558 pool.append( t )
559 t.start()
560 for t in pool:
561 t.join()
562 appCheck = appCheck and t.result
563 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
564 onpass="App Ids seem to be correct",
565 onfail="Something is wrong with app Ids" )
566 if appCheck != main.TRUE:
567 main.log.warn( main.CLIs[0].apps() )
568 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700569
Hari Krishnac195f3b2015-07-08 20:02:24 -0700570 time.sleep( 10 )
571
GlennRC6ac11b12015-10-21 17:41:28 -0700572 main.step( "Verify Ping across all hosts" )
573 for i in range(main.numPings):
574 time1 = time.time()
575 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
576 if not pingResult:
577 main.log.warn("First pingall failed. Retrying...")
578 time.sleep(main.pingSleep)
579 else: break
580
Hari Krishnac195f3b2015-07-08 20:02:24 -0700581 time2 = time.time()
582 timeDiff = round( ( time2 - time1 ), 2 )
583 main.log.report(
584 "Time taken for Ping All: " +
585 str( timeDiff ) +
586 " seconds" )
587
GlennRC626ba132015-09-18 16:16:31 -0700588 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700589 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700590 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700591 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700592
GlennRCbddd58f2015-10-01 15:45:25 -0700593 caseResult = appCheck and pingResult
594 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700595 onpass="Reactive Mode IPv4 Pingall test PASS",
596 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700597
598 def CASE42( self, main ):
599 """
600 Verify Reactive forwarding (Spine Topology)
601 """
602 import re
603 import copy
604 import time
605 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
606 main.log.report( "______________________________________________" )
607 main.case( "Enable Reactive forwarding and Verify ping all" )
608 main.step( "Enable Reactive forwarding" )
609 installResult = main.TRUE
610 # Activate fwd app
611 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
612
613 appCheck = main.TRUE
614 pool = []
615 for cli in main.CLIs:
616 t = main.Thread( target=cli.appToIDCheck,
617 name="appToIDCheck-" + str( i ),
618 args=[] )
619 pool.append( t )
620 t.start()
621 for t in pool:
622 t.join()
623 appCheck = appCheck and t.result
624 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
625 onpass="App Ids seem to be correct",
626 onfail="Something is wrong with app Ids" )
627 if appCheck != main.TRUE:
628 main.log.warn( main.CLIs[0].apps() )
629 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700630
Hari Krishnac195f3b2015-07-08 20:02:24 -0700631 time.sleep( 10 )
632
GlennRC6ac11b12015-10-21 17:41:28 -0700633 main.step( "Verify Ping across all hosts" )
634 for i in range(main.numPings):
635 time1 = time.time()
636 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
637 if not pingResult:
638 main.log.warn("First pingall failed. Retrying...")
639 time.sleep(main.pingSleep)
640 else: break
641
Hari Krishnac195f3b2015-07-08 20:02:24 -0700642 time2 = time.time()
643 timeDiff = round( ( time2 - time1 ), 2 )
644 main.log.report(
645 "Time taken for Ping All: " +
646 str( timeDiff ) +
647 " seconds" )
648
GlennRC626ba132015-09-18 16:16:31 -0700649 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700650 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700651 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700652 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
653
GlennRCbddd58f2015-10-01 15:45:25 -0700654 caseResult = appCheck and pingResult
655 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700656 onpass="Reactive Mode IPv4 Pingall test PASS",
657 onfail="Reactive Mode IPv4 Pingall test FAIL" )
658
659 def CASE140( self, main ):
660 """
661 Verify IPv6 Reactive forwarding (Att Topology)
662 """
663 import re
664 import copy
665 import time
666 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
667 main.log.report( "______________________________________________" )
668 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
669 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
670
671 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
672 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
673 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
674 cfgResult = cfgResult1 and cfgResult2
675 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
676 onpass="Reactive mode ipv6Fowarding cfg is set to true",
677 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
678
679 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700680 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700681 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700682 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
683 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700684 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700685 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700686 time2 = time.time()
687 timeDiff = round( ( time2 - time1 ), 2 )
688 main.log.report(
689 "Time taken for IPv6 Ping All: " +
690 str( timeDiff ) +
691 " seconds" )
692
GlennRC626ba132015-09-18 16:16:31 -0700693 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700694 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
695 else:
696 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700697
Jon Hall4ba53f02015-07-29 13:07:41 -0700698
GlennRC15d164c2015-12-15 17:12:25 -0800699 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700700 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700701 onpass="Reactive Mode IPv6 Pingall test PASS",
702 onfail="Reactive Mode IPv6 Pingall test FAIL" )
703
704 def CASE141( self, main ):
705 """
706 Verify IPv6 Reactive forwarding (Chordal Topology)
707 """
708 import re
709 import copy
710 import time
711 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
712 main.log.report( "______________________________________________" )
713 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
714 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
715
716 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
717 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
718 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
719 cfgResult = cfgResult1 and cfgResult2
720 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
721 onpass="Reactive mode ipv6Fowarding cfg is set to true",
722 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
723
724 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700725 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700726 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700727 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
728 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700729 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700730 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700731 time2 = time.time()
732 timeDiff = round( ( time2 - time1 ), 2 )
733 main.log.report(
734 "Time taken for IPv6 Ping All: " +
735 str( timeDiff ) +
736 " seconds" )
737
GlennRC626ba132015-09-18 16:16:31 -0700738 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700739 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
740 else:
741 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
742
743 main.step( "Disable Reactive forwarding" )
744
745 main.log.info( "Uninstall reactive forwarding app" )
746 appCheck = main.TRUE
747 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
748 pool = []
749 for cli in main.CLIs:
750 t = main.Thread( target=cli.appToIDCheck,
751 name="appToIDCheck-" + str( i ),
752 args=[] )
753 pool.append( t )
754 t.start()
755
756 for t in pool:
757 t.join()
758 appCheck = appCheck and t.result
759 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
760 onpass="App Ids seem to be correct",
761 onfail="Something is wrong with app Ids" )
762 if appCheck != main.TRUE:
763 main.log.warn( main.CLIs[0].apps() )
764 main.log.warn( main.CLIs[0].appIDs() )
765
766 # Waiting for reative flows to be cleared.
767 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700768 caseResult = appCheck and cfgResult and pingResult
769 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700770 onpass="Reactive Mode IPv6 Pingall test PASS",
771 onfail="Reactive Mode IPv6 Pingall test FAIL" )
772
773 def CASE142( self, main ):
774 """
775 Verify IPv6 Reactive forwarding (Spine Topology)
776 """
777 import re
778 import copy
779 import time
780 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
781 main.log.report( "______________________________________________" )
782 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
783 # Spine topology do not have hosts h1-h10
784 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
785 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
786 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
787 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
788 cfgResult = cfgResult1 and cfgResult2
789 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
790 onpass="Reactive mode ipv6Fowarding cfg is set to true",
791 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
792
793 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700794 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700795 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700796 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
797 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700798 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700799 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700800 time2 = time.time()
801 timeDiff = round( ( time2 - time1 ), 2 )
802 main.log.report(
803 "Time taken for IPv6 Ping All: " +
804 str( timeDiff ) +
805 " seconds" )
806
GlennRC626ba132015-09-18 16:16:31 -0700807 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700808 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
809 else:
810 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
811
812 main.step( "Disable Reactive forwarding" )
813
814 main.log.info( "Uninstall reactive forwarding app" )
815 appCheck = main.TRUE
816 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
817 pool = []
818 for cli in main.CLIs:
819 t = main.Thread( target=cli.appToIDCheck,
820 name="appToIDCheck-" + str( i ),
821 args=[] )
822 pool.append( t )
823 t.start()
824
825 for t in pool:
826 t.join()
827 appCheck = appCheck and t.result
828 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
829 onpass="App Ids seem to be correct",
830 onfail="Something is wrong with app Ids" )
831 if appCheck != main.TRUE:
832 main.log.warn( main.CLIs[0].apps() )
833 main.log.warn( main.CLIs[0].appIDs() )
834
835 # Waiting for reative flows to be cleared.
836 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700837 caseResult = appCheck and cfgResult and pingResult
838 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700839 onpass="Reactive Mode IPv6 Pingall test PASS",
840 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700841
842 def CASE5( self, main ):
843 """
844 Compare current ONOS topology with reference data
845 """
846 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700847
Hari Krishnac195f3b2015-07-08 20:02:24 -0700848 devicesDPIDTemp = []
849 hostMACsTemp = []
850 deviceLinksTemp = []
851 deviceActiveLinksCountTemp = []
852 devicePortsEnabledCountTemp = []
853
854 main.log.report(
855 "Compare ONOS topology with reference data in Stores" )
856 main.log.report( "__________________________________________________" )
857 main.case( "Compare ONOS topology with reference data" )
858
859 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700860
GlennRC289c1b62015-12-12 10:45:43 -0800861 for check in range(main.topoCheck):
862 time1 = time.time()
863 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
864 pool = []
865 for cli in main.CLIs:
866 if i >= main.numMNswitches + 1:
867 break
GlennRC2db29952015-12-14 12:00:29 -0800868 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800869 t = main.Thread(target = cli.getDevicePortsEnabledCount,
870 threadID = main.threadID,
871 name = "getDevicePortsEnabledCount",
872 args = [dpid])
873 t.start()
874 pool.append(t)
875 i = i + 1
876 main.threadID = main.threadID + 1
877 for thread in pool:
878 thread.join()
879 portResult = thread.result
880 #portTemp = re.split( r'\t+', portResult )
881 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
882 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -0700883
GlennRC289c1b62015-12-12 10:45:43 -0800884 time2 = time.time()
885 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
886 main.log.info (
887 "Device Enabled ports EXPECTED: %s" %
888 str( main.devicePortsEnabledCount ) )
889 main.log.info (
890 "Device Enabled ports ACTUAL: %s" %
891 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700892
GlennRC289c1b62015-12-12 10:45:43 -0800893 if ( cmp( main.devicePortsEnabledCount,
894 devicePortsEnabledCountTemp ) == 0 ):
895 stepResult1 = main.TRUE
896 else:
897 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700898
GlennRC289c1b62015-12-12 10:45:43 -0800899 main.step( "Compare Device active links with reference" )
900 time1 = time.time()
901 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
902 pool = []
903 for cli in main.CLIs:
904 if i >= main.numMNswitches + 1:
905 break
GlennRC2db29952015-12-14 12:00:29 -0800906 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800907 t = main.Thread(target = cli.getDeviceLinksActiveCount,
908 threadID = main.threadID,
909 name = "getDeviceLinksActiveCount",
910 args = [dpid])
911 t.start()
912 pool.append(t)
913 i = i + 1
914 main.threadID = main.threadID + 1
915 for thread in pool:
916 thread.join()
917 linkCountResult = thread.result
918 #linkCountTemp = re.split( r'\t+', linkCountResult )
919 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
920 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700921
GlennRC289c1b62015-12-12 10:45:43 -0800922 time2 = time.time()
923 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
924 main.log.info (
925 "Device Active links EXPECTED: %s" %
926 str( main.deviceActiveLinksCount ) )
927 main.log.info (
928 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
929 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
930 stepResult2 = main.TRUE
931 else:
932 stepResult2 = main.FALSE
933
934 """
935 place holder for comparing devices, hosts, paths and intents if required.
936 Links and ports data would be incorrect with out devices anyways.
937 """
938 caseResult = ( stepResult1 and stepResult2 )
939
940 if caseResult:
941 break
942 else:
943 time.sleep( main.topoCheckDelay )
944 main.log.warn( "Topology check failed. Trying again..." )
945
946
947 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700948 onpass="Compare Topology test PASS",
949 onfail="Compare Topology test FAIL" )
950
951 def CASE60( self ):
952 """
953 Install 300 host intents and verify ping all (Att Topology)
954 """
955 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
956 main.log.report( "_______________________________________" )
957 import itertools
958 import time
959 main.case( "Install 300 host intents" )
960 main.step( "Add host Intents" )
961 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700962 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
963
Hari Krishnac195f3b2015-07-08 20:02:24 -0700964 intentIdList = []
965 time1 = time.time()
966 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
967 pool = []
968 for cli in main.CLIs:
969 if i >= len( hostCombos ):
970 break
971 t = main.Thread( target=cli.addHostIntent,
972 threadID=main.threadID,
973 name="addHostIntent",
974 args=[hostCombos[i][0],hostCombos[i][1]])
975 pool.append(t)
976 t.start()
977 i = i + 1
978 main.threadID = main.threadID + 1
979 for thread in pool:
980 thread.join()
981 intentIdList.append(thread.result)
982 time2 = time.time()
983 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
984
GlennRCfcfdc4f2015-09-30 16:01:57 -0700985 # Saving intent ids to check intents in later cases
986 main.intentIds = list(intentIdList)
987
GlennRCa8d786a2015-09-23 17:40:11 -0700988 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700989
GlennRC1dde1712015-10-02 11:03:08 -0700990 # Giving onos multiple chances to install intents
991 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -0700992 if i != 0:
993 main.log.warn( "Verification failed. Retrying..." )
994 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -0700995 time.sleep( main.checkIntentsDelay )
996
997 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -0700998 for e in range(int(main.numCtrls)):
999 main.log.info( "Checking intents on CLI %s" % (e+1) )
1000 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1001 intentState
1002 if not intentState:
1003 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001004 if intentState:
1005 break
GlennRCdb2c8422015-09-29 12:21:59 -07001006 else:
1007 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001008 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001009
GlennRCa8d786a2015-09-23 17:40:11 -07001010
1011 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1012 onpass="INTENTS INSTALLED",
1013 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001014
1015 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001016 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001017 time1 = time.time()
1018 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001019 if not pingResult:
1020 main.log.warn("First pingall failed. Retrying...")
1021 time.sleep(3)
1022 else: break
1023
Hari Krishnac195f3b2015-07-08 20:02:24 -07001024 time2 = time.time()
1025 timeDiff = round( ( time2 - time1 ), 2 )
1026 main.log.report(
1027 "Time taken for Ping All: " +
1028 str( timeDiff ) +
1029 " seconds" )
1030 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1031 onpass="PING ALL PASS",
1032 onfail="PING ALL FAIL" )
1033
GlennRCbddd58f2015-10-01 15:45:25 -07001034 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001035 utilities.assert_equals(
1036 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001037 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001038 onpass="Install 300 Host Intents and Ping All test PASS",
1039 onfail="Install 300 Host Intents and Ping All test FAIL" )
1040
GlennRCfcfdc4f2015-09-30 16:01:57 -07001041 if not intentState:
1042 main.log.debug( "Intents failed to install completely" )
1043 if not pingResult:
1044 main.log.debug( "Pingall failed" )
1045
GlennRCbddd58f2015-10-01 15:45:25 -07001046 if not caseResult and main.failSwitch:
1047 main.log.report("Stopping test")
1048 main.stop( email=main.emailOnStop )
1049
Hari Krishnac195f3b2015-07-08 20:02:24 -07001050 def CASE61( self ):
1051 """
1052 Install 600 host intents and verify ping all for Chordal Topology
1053 """
1054 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1055 main.log.report( "_______________________________________" )
1056 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001057
Hari Krishnac195f3b2015-07-08 20:02:24 -07001058 main.case( "Install 600 host intents" )
1059 main.step( "Add host Intents" )
1060 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001061 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1062
Hari Krishnac195f3b2015-07-08 20:02:24 -07001063 intentIdList = []
1064 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001065
Hari Krishnac195f3b2015-07-08 20:02:24 -07001066 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1067 pool = []
1068 for cli in main.CLIs:
1069 if i >= len( hostCombos ):
1070 break
1071 t = main.Thread( target=cli.addHostIntent,
1072 threadID=main.threadID,
1073 name="addHostIntent",
1074 args=[hostCombos[i][0],hostCombos[i][1]])
1075 pool.append(t)
1076 t.start()
1077 i = i + 1
1078 main.threadID = main.threadID + 1
1079 for thread in pool:
1080 thread.join()
1081 intentIdList.append(thread.result)
1082 time2 = time.time()
1083 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001084
GlennRCfcfdc4f2015-09-30 16:01:57 -07001085 # Saving intent ids to check intents in later cases
1086 main.intentIds = list(intentIdList)
1087
GlennRCa8d786a2015-09-23 17:40:11 -07001088 main.step("Verify intents are installed")
1089
GlennRC1dde1712015-10-02 11:03:08 -07001090 # Giving onos multiple chances to install intents
1091 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001092 if i != 0:
1093 main.log.warn( "Verification failed. Retrying..." )
1094 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001095 time.sleep( main.checkIntentsDelay )
1096
1097 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001098 for e in range(int(main.numCtrls)):
1099 main.log.info( "Checking intents on CLI %s" % (e+1) )
1100 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1101 intentState
1102 if not intentState:
1103 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001104 if intentState:
1105 break
GlennRCdb2c8422015-09-29 12:21:59 -07001106 else:
1107 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001108 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001109
1110 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1111 onpass="INTENTS INSTALLED",
1112 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001113
1114 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001115 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001116 time1 = time.time()
1117 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001118 if not pingResult:
1119 main.log.warn("First pingall failed. Retrying...")
1120 time.sleep(main.pingSleep)
1121 else: break
1122
Hari Krishnac195f3b2015-07-08 20:02:24 -07001123 time2 = time.time()
1124 timeDiff = round( ( time2 - time1 ), 2 )
1125 main.log.report(
1126 "Time taken for Ping All: " +
1127 str( timeDiff ) +
1128 " seconds" )
1129 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1130 onpass="PING ALL PASS",
1131 onfail="PING ALL FAIL" )
1132
GlennRCbddd58f2015-10-01 15:45:25 -07001133 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001134
Hari Krishnac195f3b2015-07-08 20:02:24 -07001135 utilities.assert_equals(
1136 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001137 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001138 onpass="Install 300 Host Intents and Ping All test PASS",
1139 onfail="Install 300 Host Intents and Ping All test FAIL" )
1140
GlennRCfcfdc4f2015-09-30 16:01:57 -07001141 if not intentState:
1142 main.log.debug( "Intents failed to install completely" )
1143 if not pingResult:
1144 main.log.debug( "Pingall failed" )
1145
GlennRCbddd58f2015-10-01 15:45:25 -07001146 if not caseResult and main.failSwitch:
1147 main.log.report("Stopping test")
1148 main.stop( email=main.emailOnStop )
1149
Hari Krishnac195f3b2015-07-08 20:02:24 -07001150 def CASE62( self ):
1151 """
1152 Install 2278 host intents and verify ping all for Spine Topology
1153 """
1154 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1155 main.log.report( "_______________________________________" )
1156 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001157
Hari Krishnac195f3b2015-07-08 20:02:24 -07001158 main.case( "Install 2278 host intents" )
1159 main.step( "Add host Intents" )
1160 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001161 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001162 main.pingTimeout = 300
1163 intentIdList = []
1164 time1 = time.time()
1165 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1166 pool = []
1167 for cli in main.CLIs:
1168 if i >= len( hostCombos ):
1169 break
1170 t = main.Thread( target=cli.addHostIntent,
1171 threadID=main.threadID,
1172 name="addHostIntent",
1173 args=[hostCombos[i][0],hostCombos[i][1]])
1174 pool.append(t)
1175 t.start()
1176 i = i + 1
1177 main.threadID = main.threadID + 1
1178 for thread in pool:
1179 thread.join()
1180 intentIdList.append(thread.result)
1181 time2 = time.time()
1182 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001183
GlennRCfcfdc4f2015-09-30 16:01:57 -07001184 # Saving intent ids to check intents in later cases
1185 main.intentIds = list(intentIdList)
1186
GlennRCa8d786a2015-09-23 17:40:11 -07001187 main.step("Verify intents are installed")
1188
GlennRC1dde1712015-10-02 11:03:08 -07001189 # Giving onos multiple chances to install intents
1190 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001191 if i != 0:
1192 main.log.warn( "Verification failed. Retrying..." )
1193 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001194 time.sleep( main.checkIntentsDelay )
1195
1196 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001197 for e in range(int(main.numCtrls)):
1198 main.log.info( "Checking intents on CLI %s" % (e+1) )
1199 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1200 intentState
1201 if not intentState:
1202 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001203 if intentState:
1204 break
GlennRCdb2c8422015-09-29 12:21:59 -07001205 else:
1206 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001207 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001208
1209 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1210 onpass="INTENTS INSTALLED",
1211 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001212
1213 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001214 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001215 time1 = time.time()
1216 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001217 if not pingResult:
1218 main.log.warn("First pingall failed. Retrying...")
1219 time.sleep(main.pingSleep)
1220 else: break
1221
Hari Krishnac195f3b2015-07-08 20:02:24 -07001222 time2 = time.time()
1223 timeDiff = round( ( time2 - time1 ), 2 )
1224 main.log.report(
1225 "Time taken for Ping All: " +
1226 str( timeDiff ) +
1227 " seconds" )
1228 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1229 onpass="PING ALL PASS",
1230 onfail="PING ALL FAIL" )
1231
GlennRCbddd58f2015-10-01 15:45:25 -07001232 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001233
Hari Krishnac195f3b2015-07-08 20:02:24 -07001234 utilities.assert_equals(
1235 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001236 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001237 onpass="Install 2278 Host Intents and Ping All test PASS",
1238 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1239
GlennRCfcfdc4f2015-09-30 16:01:57 -07001240 if not intentState:
1241 main.log.debug( "Intents failed to install completely" )
1242 if not pingResult:
1243 main.log.debug( "Pingall failed" )
1244
GlennRCbddd58f2015-10-01 15:45:25 -07001245 if not caseResult and main.failSwitch:
1246 main.log.report("Stopping test")
1247 main.stop( email=main.emailOnStop )
1248
Hari Krishna4223dbd2015-08-13 16:29:53 -07001249 def CASE160( self ):
1250 """
1251 Verify IPv6 ping across 300 host intents (Att Topology)
1252 """
1253 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1254 main.log.report( "_________________________________________________" )
1255 import itertools
1256 import time
1257 main.case( "IPv6 ping all 300 host intents" )
1258 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001259 pingResult = main.FALSE
1260 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001261 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001262 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001263 main.log.warn("First pingall failed. Retrying...")
1264 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001265 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001266 time2 = time.time()
1267 timeDiff = round( ( time2 - time1 ), 2 )
1268 main.log.report(
1269 "Time taken for IPv6 Ping All: " +
1270 str( timeDiff ) +
1271 " seconds" )
1272 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1273 onpass="PING ALL PASS",
1274 onfail="PING ALL FAIL" )
1275
GlennRCbddd58f2015-10-01 15:45:25 -07001276 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001277 utilities.assert_equals(
1278 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001279 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001280 onpass="IPv6 Ping across 300 host intents test PASS",
1281 onfail="IPv6 Ping across 300 host intents test FAIL" )
1282
1283 def CASE161( self ):
1284 """
1285 Verify IPv6 ping across 600 host intents (Chordal Topology)
1286 """
1287 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1288 main.log.report( "_________________________________________________" )
1289 import itertools
1290 import time
1291 main.case( "IPv6 ping all 600 host intents" )
1292 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001293 pingResult = main.FALSE
1294 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001295 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001296 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001297 main.log.warn("First pingall failed. Retrying...")
1298 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001299 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001300 time2 = time.time()
1301 timeDiff = round( ( time2 - time1 ), 2 )
1302 main.log.report(
1303 "Time taken for IPv6 Ping All: " +
1304 str( timeDiff ) +
1305 " seconds" )
1306 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1307 onpass="PING ALL PASS",
1308 onfail="PING ALL FAIL" )
1309
GlennRCbddd58f2015-10-01 15:45:25 -07001310 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001311 utilities.assert_equals(
1312 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001313 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001314 onpass="IPv6 Ping across 600 host intents test PASS",
1315 onfail="IPv6 Ping across 600 host intents test FAIL" )
1316
1317 def CASE162( self ):
1318 """
1319 Verify IPv6 ping across 2278 host intents (Spine Topology)
1320 """
1321 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1322 main.log.report( "_________________________________________________" )
1323 import itertools
1324 import time
1325 main.case( "IPv6 ping all 600 host intents" )
1326 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001327 pingResult = main.FALSE
1328 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001329 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001330 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001331 main.log.warn("First pingall failed. Retrying...")
1332 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001333 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001334 time2 = time.time()
1335 timeDiff = round( ( time2 - time1 ), 2 )
1336 main.log.report(
1337 "Time taken for IPv6 Ping All: " +
1338 str( timeDiff ) +
1339 " seconds" )
1340 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1341 onpass="PING ALL PASS",
1342 onfail="PING ALL FAIL" )
1343
GlennRCbddd58f2015-10-01 15:45:25 -07001344 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001345 utilities.assert_equals(
1346 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001347 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001348 onpass="IPv6 Ping across 600 host intents test PASS",
1349 onfail="IPv6 Ping across 600 host intents test FAIL" )
1350
Hari Krishnac195f3b2015-07-08 20:02:24 -07001351 def CASE70( self, main ):
1352 """
1353 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1354 """
1355 import random
1356 main.randomLink1 = []
1357 main.randomLink2 = []
1358 main.randomLink3 = []
1359 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1360 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1361 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1362 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1363 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1364 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1365 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1366 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1367
1368 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1369 main.log.report( "___________________________________________________________________________" )
1370 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1371 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1372 if ( int( switchLinksToToggle ) ==
1373 0 or int( switchLinksToToggle ) > 5 ):
1374 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1375 #main.cleanup()
1376 #main.exit()
1377 else:
1378 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1379
1380 main.step( "Cut links on Core devices using user provided range" )
1381 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1382 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1383 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1384 for i in range( int( switchLinksToToggle ) ):
1385 main.Mininet1.link(
1386 END1=link1End1,
1387 END2=main.randomLink1[ i ],
1388 OPTION="down" )
1389 time.sleep( link_sleep )
1390 main.Mininet1.link(
1391 END1=link2End1,
1392 END2=main.randomLink2[ i ],
1393 OPTION="down" )
1394 time.sleep( link_sleep )
1395 main.Mininet1.link(
1396 END1=link3End1,
1397 END2=main.randomLink3[ i ],
1398 OPTION="down" )
1399 time.sleep( link_sleep )
1400
Hari Krishna6185fc12015-07-13 15:42:31 -07001401 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001402 linkDown = main.ONOSbench.checkStatus(
1403 topology_output, main.numMNswitches, str(
1404 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1405 utilities.assert_equals(
1406 expect=main.TRUE,
1407 actual=linkDown,
1408 onpass="Link Down discovered properly",
1409 onfail="Link down was not discovered in " +
1410 str( link_sleep ) +
1411 " seconds" )
1412
GlennRCfcfdc4f2015-09-30 16:01:57 -07001413 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001414 # Giving onos multiple chances to install intents
1415 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001416 if i != 0:
1417 main.log.warn( "Verification failed. Retrying..." )
1418 main.log.info("Giving onos some time...")
1419 time.sleep( main.checkIntentsDelay )
1420
1421 intentState = main.TRUE
1422 for e in range(int(main.numCtrls)):
1423 main.log.info( "Checking intents on CLI %s" % (e+1) )
1424 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1425 intentState
1426 if not intentState:
1427 main.log.warn( "Not all intents installed" )
1428 if intentState:
1429 break
1430 else:
1431 #Dumping intent summary
1432 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1433
1434
1435 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1436 onpass="INTENTS INSTALLED",
1437 onfail="SOME INTENTS NOT INSTALLED" )
1438
Hari Krishnac195f3b2015-07-08 20:02:24 -07001439 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001440 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001441 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001442 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1443 if not pingResult:
1444 main.log.warn("First pingall failed. Retrying...")
1445 time.sleep(main.pingSleep)
1446 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001447
Hari Krishnac195f3b2015-07-08 20:02:24 -07001448 time2 = time.time()
1449 timeDiff = round( ( time2 - time1 ), 2 )
1450 main.log.report(
1451 "Time taken for Ping All: " +
1452 str( timeDiff ) +
1453 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001454 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001455 onpass="PING ALL PASS",
1456 onfail="PING ALL FAIL" )
1457
GlennRCbddd58f2015-10-01 15:45:25 -07001458 caseResult = linkDown and pingResult and intentState
1459 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001460 onpass="Random Link cut Test PASS",
1461 onfail="Random Link cut Test FAIL" )
1462
GlennRCfcfdc4f2015-09-30 16:01:57 -07001463 # Printing what exactly failed
1464 if not linkDown:
1465 main.log.debug( "Link down was not discovered correctly" )
1466 if not pingResult:
1467 main.log.debug( "Pingall failed" )
1468 if not intentState:
1469 main.log.debug( "Intents are not all installed" )
1470
GlennRCbddd58f2015-10-01 15:45:25 -07001471 if not caseResult and main.failSwitch:
1472 main.log.report("Stopping test")
1473 main.stop( email=main.emailOnStop )
1474
Hari Krishnac195f3b2015-07-08 20:02:24 -07001475 def CASE80( self, main ):
1476 """
1477 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1478 """
1479 import random
1480 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1481 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1482 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1483 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1484 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1485
1486 main.log.report(
1487 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1488 main.log.report(
1489 "__________________________________________________________________" )
1490 main.case(
1491 "Host intents - Bring the core links up that are down and verify ping all" )
1492 main.step( "Bring randomly cut links on Core devices up" )
1493 for i in range( int( switchLinksToToggle ) ):
1494 main.Mininet1.link(
1495 END1=link1End1,
1496 END2=main.randomLink1[ i ],
1497 OPTION="up" )
1498 time.sleep( link_sleep )
1499 main.Mininet1.link(
1500 END1=link2End1,
1501 END2=main.randomLink2[ i ],
1502 OPTION="up" )
1503 time.sleep( link_sleep )
1504 main.Mininet1.link(
1505 END1=link3End1,
1506 END2=main.randomLink3[ i ],
1507 OPTION="up" )
1508 time.sleep( link_sleep )
1509
Hari Krishna6185fc12015-07-13 15:42:31 -07001510 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001511 linkUp = main.ONOSbench.checkStatus(
1512 topology_output,
1513 main.numMNswitches,
1514 str( main.numMNlinks ) )
1515 utilities.assert_equals(
1516 expect=main.TRUE,
1517 actual=linkUp,
1518 onpass="Link up discovered properly",
1519 onfail="Link up was not discovered in " +
1520 str( link_sleep ) +
1521 " seconds" )
1522
GlennRCfcfdc4f2015-09-30 16:01:57 -07001523 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001524 # Giving onos multiple chances to install intents
1525 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001526 if i != 0:
1527 main.log.warn( "Verification failed. Retrying..." )
1528 main.log.info("Giving onos some time...")
1529 time.sleep( main.checkIntentsDelay )
1530
1531 intentState = main.TRUE
1532 for e in range(int(main.numCtrls)):
1533 main.log.info( "Checking intents on CLI %s" % (e+1) )
1534 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1535 intentState
1536 if not intentState:
1537 main.log.warn( "Not all intents installed" )
1538 if intentState:
1539 break
1540 else:
1541 #Dumping intent summary
1542 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1543
1544
1545 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1546 onpass="INTENTS INSTALLED",
1547 onfail="SOME INTENTS NOT INSTALLED" )
1548
Hari Krishnac195f3b2015-07-08 20:02:24 -07001549 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001550 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001551 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001552 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1553 if not pingResult:
1554 main.log.warn("First pingall failed. Retrying...")
1555 time.sleep(main.pingSleep)
1556 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001557
Hari Krishnac195f3b2015-07-08 20:02:24 -07001558 time2 = time.time()
1559 timeDiff = round( ( time2 - time1 ), 2 )
1560 main.log.report(
1561 "Time taken for Ping All: " +
1562 str( timeDiff ) +
1563 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001564 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001565 onpass="PING ALL PASS",
1566 onfail="PING ALL FAIL" )
1567
GlennRCbddd58f2015-10-01 15:45:25 -07001568 caseResult = linkUp and pingResult
1569 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001570 onpass="Link Up Test PASS",
1571 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001572 # Printing what exactly failed
1573 if not linkUp:
1574 main.log.debug( "Link down was not discovered correctly" )
1575 if not pingResult:
1576 main.log.debug( "Pingall failed" )
1577 if not intentState:
1578 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001579
GlennRCbddd58f2015-10-01 15:45:25 -07001580 if not caseResult and main.failSwitch:
1581 main.log.report("Stopping test")
1582 main.stop( email=main.emailOnStop )
1583
Hari Krishnac195f3b2015-07-08 20:02:24 -07001584 def CASE71( self, main ):
1585 """
1586 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1587 """
1588 import random
1589 main.randomLink1 = []
1590 main.randomLink2 = []
1591 main.randomLink3 = []
1592 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1593 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1594 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1595 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1596 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1597 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1598 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1599 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1600
1601 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1602 main.log.report( "___________________________________________________________________________" )
1603 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1604 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1605 if ( int( switchLinksToToggle ) ==
1606 0 or int( switchLinksToToggle ) > 5 ):
1607 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1608 #main.cleanup()
1609 #main.exit()
1610 else:
1611 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1612
1613 main.step( "Cut links on Core devices using user provided range" )
1614 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1615 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1616 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1617 for i in range( int( switchLinksToToggle ) ):
1618 main.Mininet1.link(
1619 END1=link1End1,
1620 END2=main.randomLink1[ i ],
1621 OPTION="down" )
1622 time.sleep( link_sleep )
1623 main.Mininet1.link(
1624 END1=link2End1,
1625 END2=main.randomLink2[ i ],
1626 OPTION="down" )
1627 time.sleep( link_sleep )
1628 main.Mininet1.link(
1629 END1=link3End1,
1630 END2=main.randomLink3[ i ],
1631 OPTION="down" )
1632 time.sleep( link_sleep )
1633
Hari Krishna6185fc12015-07-13 15:42:31 -07001634 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001635 linkDown = main.ONOSbench.checkStatus(
1636 topology_output, main.numMNswitches, str(
1637 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1638 utilities.assert_equals(
1639 expect=main.TRUE,
1640 actual=linkDown,
1641 onpass="Link Down discovered properly",
1642 onfail="Link down was not discovered in " +
1643 str( link_sleep ) +
1644 " seconds" )
1645
GlennRCfcfdc4f2015-09-30 16:01:57 -07001646 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001647 # Giving onos multiple chances to install intents
1648 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001649 if i != 0:
1650 main.log.warn( "Verification failed. Retrying..." )
1651 main.log.info("Giving onos some time...")
1652 time.sleep( main.checkIntentsDelay )
1653
1654 intentState = main.TRUE
1655 for e in range(int(main.numCtrls)):
1656 main.log.info( "Checking intents on CLI %s" % (e+1) )
1657 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1658 intentState
1659 if not intentState:
1660 main.log.warn( "Not all intents installed" )
1661 if intentState:
1662 break
1663 else:
1664 #Dumping intent summary
1665 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1666
1667
1668 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1669 onpass="INTENTS INSTALLED",
1670 onfail="SOME INTENTS NOT INSTALLED" )
1671
Hari Krishnac195f3b2015-07-08 20:02:24 -07001672 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001673 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001674 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001675 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1676 if not pingResult:
1677 main.log.warn("First pingall failed. Retrying...")
1678 time.sleep(main.pingSleep)
1679 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001680
Hari Krishnac195f3b2015-07-08 20:02:24 -07001681 time2 = time.time()
1682 timeDiff = round( ( time2 - time1 ), 2 )
1683 main.log.report(
1684 "Time taken for Ping All: " +
1685 str( timeDiff ) +
1686 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001687 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001688 onpass="PING ALL PASS",
1689 onfail="PING ALL FAIL" )
1690
GlennRCbddd58f2015-10-01 15:45:25 -07001691 caseResult = linkDown and pingResult and intentState
1692 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001693 onpass="Random Link cut Test PASS",
1694 onfail="Random Link cut Test FAIL" )
1695
GlennRCfcfdc4f2015-09-30 16:01:57 -07001696 # Printing what exactly failed
1697 if not linkDown:
1698 main.log.debug( "Link down was not discovered correctly" )
1699 if not pingResult:
1700 main.log.debug( "Pingall failed" )
1701 if not intentState:
1702 main.log.debug( "Intents are not all installed" )
1703
GlennRCbddd58f2015-10-01 15:45:25 -07001704 if not caseResult and main.failSwitch:
1705 main.log.report("Stopping test")
1706 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001707
Hari Krishnac195f3b2015-07-08 20:02:24 -07001708 def CASE81( self, main ):
1709 """
1710 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1711 """
1712 import random
1713 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1714 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1715 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1716 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1717 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1718
1719 main.log.report(
1720 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1721 main.log.report(
1722 "__________________________________________________________________" )
1723 main.case(
1724 "Point intents - Bring the core links up that are down and verify ping all" )
1725 main.step( "Bring randomly cut links on Core devices up" )
1726 for i in range( int( switchLinksToToggle ) ):
1727 main.Mininet1.link(
1728 END1=link1End1,
1729 END2=main.randomLink1[ i ],
1730 OPTION="up" )
1731 time.sleep( link_sleep )
1732 main.Mininet1.link(
1733 END1=link2End1,
1734 END2=main.randomLink2[ i ],
1735 OPTION="up" )
1736 time.sleep( link_sleep )
1737 main.Mininet1.link(
1738 END1=link3End1,
1739 END2=main.randomLink3[ i ],
1740 OPTION="up" )
1741 time.sleep( link_sleep )
1742
Hari Krishna6185fc12015-07-13 15:42:31 -07001743 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001744 linkUp = main.ONOSbench.checkStatus(
1745 topology_output,
1746 main.numMNswitches,
1747 str( main.numMNlinks ) )
1748 utilities.assert_equals(
1749 expect=main.TRUE,
1750 actual=linkUp,
1751 onpass="Link up discovered properly",
1752 onfail="Link up was not discovered in " +
1753 str( link_sleep ) +
1754 " seconds" )
1755
GlennRCfcfdc4f2015-09-30 16:01:57 -07001756 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001757 # Giving onos multiple chances to install intents
1758 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001759 if i != 0:
1760 main.log.warn( "Verification failed. Retrying..." )
1761 main.log.info("Giving onos some time...")
1762 time.sleep( main.checkIntentsDelay )
1763
1764 intentState = main.TRUE
1765 for e in range(int(main.numCtrls)):
1766 main.log.info( "Checking intents on CLI %s" % (e+1) )
1767 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1768 intentState
1769 if not intentState:
1770 main.log.warn( "Not all intents installed" )
1771 if intentState:
1772 break
1773 else:
1774 #Dumping intent summary
1775 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1776
1777
1778 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1779 onpass="INTENTS INSTALLED",
1780 onfail="SOME INTENTS NOT INSTALLED" )
1781
Hari Krishnac195f3b2015-07-08 20:02:24 -07001782 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001783 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001784 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001785 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1786 if not pingResult:
1787 main.log.warn("First pingall failed. Retrying...")
1788 time.sleep(main.pingSleep)
1789 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001790
Hari Krishnac195f3b2015-07-08 20:02:24 -07001791 time2 = time.time()
1792 timeDiff = round( ( time2 - time1 ), 2 )
1793 main.log.report(
1794 "Time taken for Ping All: " +
1795 str( timeDiff ) +
1796 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001797 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001798 onpass="PING ALL PASS",
1799 onfail="PING ALL FAIL" )
1800
GlennRCbddd58f2015-10-01 15:45:25 -07001801 caseResult = linkUp and pingResult
1802 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001803 onpass="Link Up Test PASS",
1804 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001805 # Printing what exactly failed
1806 if not linkUp:
1807 main.log.debug( "Link down was not discovered correctly" )
1808 if not pingResult:
1809 main.log.debug( "Pingall failed" )
1810 if not intentState:
1811 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001812
GlennRCbddd58f2015-10-01 15:45:25 -07001813 if not caseResult and main.failSwitch:
1814 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001815 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001816
Hari Krishnac195f3b2015-07-08 20:02:24 -07001817 def CASE72( self, main ):
1818 """
1819 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1820 """
1821 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001822 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001823 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001824
Hari Krishnac195f3b2015-07-08 20:02:24 -07001825 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1826 main.log.report( "___________________________________________________________________________" )
1827 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1828 switches = []
1829 switchesComb = []
1830 for i in range( main.numMNswitches ):
1831 switches.append('s%d'%(i+1))
1832 switchesLinksComb = list(itertools.combinations(switches,2))
1833 main.randomLinks = random.sample(switchesLinksComb, 5 )
1834 print main.randomLinks
1835 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001836
Hari Krishnac195f3b2015-07-08 20:02:24 -07001837 for switch in main.randomLinks:
1838 main.Mininet1.link(
1839 END1=switch[0],
1840 END2=switch[1],
1841 OPTION="down")
1842 time.sleep( link_sleep )
1843
Hari Krishna6185fc12015-07-13 15:42:31 -07001844 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001845 linkDown = main.ONOSbench.checkStatus(
1846 topology_output, main.numMNswitches, str(
1847 int( main.numMNlinks ) - 5 * 2 ) )
1848 utilities.assert_equals(
1849 expect=main.TRUE,
1850 actual=linkDown,
1851 onpass="Link Down discovered properly",
1852 onfail="Link down was not discovered in " +
1853 str( link_sleep ) +
1854 " seconds" )
1855
GlennRCfcfdc4f2015-09-30 16:01:57 -07001856 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001857 # Giving onos multiple chances to install intents
1858 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001859 if i != 0:
1860 main.log.warn( "Verification failed. Retrying..." )
1861 main.log.info("Giving onos some time...")
1862 time.sleep( main.checkIntentsDelay )
1863
1864 intentState = main.TRUE
1865 for e in range(int(main.numCtrls)):
1866 main.log.info( "Checking intents on CLI %s" % (e+1) )
1867 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1868 intentState
1869 if not intentState:
1870 main.log.warn( "Not all intents installed" )
1871 if intentState:
1872 break
1873 else:
1874 #Dumping intent summary
1875 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1876
1877
1878 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1879 onpass="INTENTS INSTALLED",
1880 onfail="SOME INTENTS NOT INSTALLED" )
1881
Hari Krishnac195f3b2015-07-08 20:02:24 -07001882 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001883 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001884 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001885 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1886 if not pingResult:
1887 main.log.warn("First pingall failed. Retrying...")
1888 time.sleep(main.pingSleep)
1889 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001890
Hari Krishnac195f3b2015-07-08 20:02:24 -07001891 time2 = time.time()
1892 timeDiff = round( ( time2 - time1 ), 2 )
1893 main.log.report(
1894 "Time taken for Ping All: " +
1895 str( timeDiff ) +
1896 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001897 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001898 onpass="PING ALL PASS",
1899 onfail="PING ALL FAIL" )
1900
GlennRCbddd58f2015-10-01 15:45:25 -07001901 caseResult = linkDown and pingResult and intentState
1902 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001903 onpass="Random Link cut Test PASS",
1904 onfail="Random Link cut Test FAIL" )
1905
GlennRCfcfdc4f2015-09-30 16:01:57 -07001906 # Printing what exactly failed
1907 if not linkDown:
1908 main.log.debug( "Link down was not discovered correctly" )
1909 if not pingResult:
1910 main.log.debug( "Pingall failed" )
1911 if not intentState:
1912 main.log.debug( "Intents are not all installed" )
1913
GlennRCbddd58f2015-10-01 15:45:25 -07001914 if not caseResult and main.failSwitch:
1915 main.log.report("Stopping test")
1916 main.stop( email=main.emailOnStop )
1917
Hari Krishnac195f3b2015-07-08 20:02:24 -07001918 def CASE82( self, main ):
1919 """
1920 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1921 """
1922 import random
1923 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001924
Hari Krishnac195f3b2015-07-08 20:02:24 -07001925 main.log.report(
1926 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1927 main.log.report(
1928 "__________________________________________________________________" )
1929 main.case(
1930 "Host intents - Bring the core links up that are down and verify ping all" )
1931 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001932
Hari Krishnac195f3b2015-07-08 20:02:24 -07001933 for switch in main.randomLinks:
1934 main.Mininet1.link(
1935 END1=switch[0],
1936 END2=switch[1],
1937 OPTION="up")
1938 time.sleep( link_sleep )
1939
Hari Krishna6185fc12015-07-13 15:42:31 -07001940 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001941 linkUp = main.ONOSbench.checkStatus(
1942 topology_output,
1943 main.numMNswitches,
1944 str( main.numMNlinks ) )
1945 utilities.assert_equals(
1946 expect=main.TRUE,
1947 actual=linkUp,
1948 onpass="Link up discovered properly",
1949 onfail="Link up was not discovered in " +
1950 str( link_sleep ) +
1951 " seconds" )
1952
GlennRCfcfdc4f2015-09-30 16:01:57 -07001953 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001954 # Giving onos multiple chances to install intents
1955 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001956 if i != 0:
1957 main.log.warn( "Verification failed. Retrying..." )
1958 main.log.info("Giving onos some time...")
1959 time.sleep( main.checkIntentsDelay )
1960
1961 intentState = main.TRUE
1962 for e in range(int(main.numCtrls)):
1963 main.log.info( "Checking intents on CLI %s" % (e+1) )
1964 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1965 intentState
1966 if not intentState:
1967 main.log.warn( "Not all intents installed" )
1968 if intentState:
1969 break
1970 else:
1971 #Dumping intent summary
1972 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1973
1974
1975 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1976 onpass="INTENTS INSTALLED",
1977 onfail="SOME INTENTS NOT INSTALLED" )
1978
Hari Krishnac195f3b2015-07-08 20:02:24 -07001979 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001980 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001981 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001982 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1983 if not pingResult:
1984 main.log.warn("First pingall failed. Retrying...")
1985 time.sleep(main.pingSleep)
1986 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001987
Hari Krishnac195f3b2015-07-08 20:02:24 -07001988 time2 = time.time()
1989 timeDiff = round( ( time2 - time1 ), 2 )
1990 main.log.report(
1991 "Time taken for Ping All: " +
1992 str( timeDiff ) +
1993 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001994 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001995 onpass="PING ALL PASS",
1996 onfail="PING ALL FAIL" )
1997
GlennRCbddd58f2015-10-01 15:45:25 -07001998 caseResult = linkUp and pingResult
1999 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002000 onpass="Link Up Test PASS",
2001 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002002 # Printing what exactly failed
2003 if not linkUp:
2004 main.log.debug( "Link down was not discovered correctly" )
2005 if not pingResult:
2006 main.log.debug( "Pingall failed" )
2007 if not intentState:
2008 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002009
GlennRCbddd58f2015-10-01 15:45:25 -07002010 if not caseResult and main.failSwitch:
2011 main.log.report("Stopping test")
2012 main.stop( email=main.emailOnStop )
2013
Hari Krishnac195f3b2015-07-08 20:02:24 -07002014 def CASE73( self, main ):
2015 """
2016 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2017 """
2018 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002019 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002020 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002021
Hari Krishnac195f3b2015-07-08 20:02:24 -07002022 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2023 main.log.report( "___________________________________________________________________________" )
2024 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2025 switches = []
2026 switchesComb = []
2027 for i in range( main.numMNswitches ):
2028 switches.append('s%d'%(i+1))
2029 switchesLinksComb = list(itertools.combinations(switches,2))
2030 main.randomLinks = random.sample(switchesLinksComb, 5 )
2031 print main.randomLinks
2032 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002033
Hari Krishnac195f3b2015-07-08 20:02:24 -07002034 for switch in main.randomLinks:
2035 main.Mininet1.link(
2036 END1=switch[0],
2037 END2=switch[1],
2038 OPTION="down")
2039 time.sleep( link_sleep )
2040
Hari Krishna6185fc12015-07-13 15:42:31 -07002041 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002042 linkDown = main.ONOSbench.checkStatus(
2043 topology_output, main.numMNswitches, str(
2044 int( main.numMNlinks ) - 5 * 2 ) )
2045 utilities.assert_equals(
2046 expect=main.TRUE,
2047 actual=linkDown,
2048 onpass="Link Down discovered properly",
2049 onfail="Link down was not discovered in " +
2050 str( link_sleep ) +
2051 " seconds" )
2052
GlennRCfcfdc4f2015-09-30 16:01:57 -07002053 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002054 # Giving onos multiple chances to install intents
2055 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002056 if i != 0:
2057 main.log.warn( "Verification failed. Retrying..." )
2058 main.log.info("Giving onos some time...")
2059 time.sleep( main.checkIntentsDelay )
2060
2061 intentState = main.TRUE
2062 for e in range(int(main.numCtrls)):
2063 main.log.info( "Checking intents on CLI %s" % (e+1) )
2064 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2065 intentState
2066 if not intentState:
2067 main.log.warn( "Not all intents installed" )
2068 if intentState:
2069 break
2070 else:
2071 #Dumping intent summary
2072 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2073
2074
2075 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2076 onpass="INTENTS INSTALLED",
2077 onfail="SOME INTENTS NOT INSTALLED" )
2078
Hari Krishnac195f3b2015-07-08 20:02:24 -07002079 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002080 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002081 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002082 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2083 if not pingResult:
2084 main.log.warn("First pingall failed. Retrying...")
2085 time.sleep(main.pingSleep)
2086 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002087
Hari Krishnac195f3b2015-07-08 20:02:24 -07002088 time2 = time.time()
2089 timeDiff = round( ( time2 - time1 ), 2 )
2090 main.log.report(
2091 "Time taken for Ping All: " +
2092 str( timeDiff ) +
2093 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002094 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002095 onpass="PING ALL PASS",
2096 onfail="PING ALL FAIL" )
2097
GlennRCbddd58f2015-10-01 15:45:25 -07002098 caseResult = linkDown and pingResult and intentState
2099 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002100 onpass="Random Link cut Test PASS",
2101 onfail="Random Link cut Test FAIL" )
2102
GlennRCfcfdc4f2015-09-30 16:01:57 -07002103 # Printing what exactly failed
2104 if not linkDown:
2105 main.log.debug( "Link down was not discovered correctly" )
2106 if not pingResult:
2107 main.log.debug( "Pingall failed" )
2108 if not intentState:
2109 main.log.debug( "Intents are not all installed" )
2110
GlennRCbddd58f2015-10-01 15:45:25 -07002111 if not caseResult and main.failSwitch:
2112 main.log.report("Stopping test")
2113 main.stop( email=main.emailOnStop )
2114
Hari Krishnac195f3b2015-07-08 20:02:24 -07002115 def CASE83( self, main ):
2116 """
2117 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2118 """
2119 import random
2120 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002121
Hari Krishnac195f3b2015-07-08 20:02:24 -07002122 main.log.report(
2123 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2124 main.log.report(
2125 "__________________________________________________________________" )
2126 main.case(
2127 "Point intents - Bring the core links up that are down and verify ping all" )
2128 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002129
Hari Krishnac195f3b2015-07-08 20:02:24 -07002130 for switch in main.randomLinks:
2131 main.Mininet1.link(
2132 END1=switch[0],
2133 END2=switch[1],
2134 OPTION="up")
2135 time.sleep( link_sleep )
2136
Hari Krishna6185fc12015-07-13 15:42:31 -07002137 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002138 linkUp = main.ONOSbench.checkStatus(
2139 topology_output,
2140 main.numMNswitches,
2141 str( main.numMNlinks ) )
2142 utilities.assert_equals(
2143 expect=main.TRUE,
2144 actual=linkUp,
2145 onpass="Link up discovered properly",
2146 onfail="Link up was not discovered in " +
2147 str( link_sleep ) +
2148 " seconds" )
2149
GlennRCfcfdc4f2015-09-30 16:01:57 -07002150 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002151 # Giving onos multiple chances to install intents
2152 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002153 if i != 0:
2154 main.log.warn( "Verification failed. Retrying..." )
2155 main.log.info("Giving onos some time...")
2156 time.sleep( main.checkIntentsDelay )
2157
2158 intentState = main.TRUE
2159 for e in range(int(main.numCtrls)):
2160 main.log.info( "Checking intents on CLI %s" % (e+1) )
2161 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2162 intentState
2163 if not intentState:
2164 main.log.warn( "Not all intents installed" )
2165 if intentState:
2166 break
2167 else:
2168 #Dumping intent summary
2169 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2170
2171
2172 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2173 onpass="INTENTS INSTALLED",
2174 onfail="SOME INTENTS NOT INSTALLED" )
2175
Hari Krishnac195f3b2015-07-08 20:02:24 -07002176 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002177 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002178 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002179 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2180 if not pingResult:
2181 main.log.warn("First pingall failed. Retrying...")
2182 time.sleep(main.pingSleep)
2183 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002184
Hari Krishnac195f3b2015-07-08 20:02:24 -07002185 time2 = time.time()
2186 timeDiff = round( ( time2 - time1 ), 2 )
2187 main.log.report(
2188 "Time taken for Ping All: " +
2189 str( timeDiff ) +
2190 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002191 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002192 onpass="PING ALL PASS",
2193 onfail="PING ALL FAIL" )
2194
GlennRCbddd58f2015-10-01 15:45:25 -07002195 caseResult = linkUp and pingResult
2196 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002197 onpass="Link Up Test PASS",
2198 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002199 # Printing what exactly failed
2200 if not linkUp:
2201 main.log.debug( "Link down was not discovered correctly" )
2202 if not pingResult:
2203 main.log.debug( "Pingall failed" )
2204 if not intentState:
2205 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002206
GlennRCbddd58f2015-10-01 15:45:25 -07002207 if not caseResult and main.failSwitch:
2208 main.log.report("Stopping test")
2209 main.stop( email=main.emailOnStop )
2210
Hari Krishnac195f3b2015-07-08 20:02:24 -07002211 def CASE74( self, main ):
2212 """
2213 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2214 """
2215 import random
2216 main.randomLink1 = []
2217 main.randomLink2 = []
2218 main.randomLink3 = []
2219 main.randomLink4 = []
2220 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2221 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2222 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2223 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2224 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2225 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2226 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2227 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002228
Hari Krishnac195f3b2015-07-08 20:02:24 -07002229 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2230 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002231 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002232 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002233 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002234 linkIndex.remove(linkIndexS9)
2235 linkIndexS10 = random.sample(linkIndex,1)[0]
2236 main.randomLink1 = link1End2top[linkIndexS9]
2237 main.randomLink2 = link2End2top[linkIndexS10]
2238 main.randomLink3 = random.sample(link1End2bot,1)[0]
2239 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002240
2241 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002242 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2243 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2244 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2245 time.sleep( link_sleep )
2246 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2247 time.sleep( link_sleep )
2248
Hari Krishna6185fc12015-07-13 15:42:31 -07002249 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002250 linkDown = main.ONOSbench.checkStatus(
2251 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002252 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002253 utilities.assert_equals(
2254 expect=main.TRUE,
2255 actual=linkDown,
2256 onpass="Link Down discovered properly",
2257 onfail="Link down was not discovered in " +
2258 str( link_sleep ) +
2259 " seconds" )
2260
GlennRCfcfdc4f2015-09-30 16:01:57 -07002261 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002262 # Giving onos multiple chances to install intents
2263 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002264 if i != 0:
2265 main.log.warn( "Verification failed. Retrying..." )
2266 main.log.info("Giving onos some time...")
2267 time.sleep( main.checkIntentsDelay )
2268
2269 intentState = main.TRUE
2270 for e in range(int(main.numCtrls)):
2271 main.log.info( "Checking intents on CLI %s" % (e+1) )
2272 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2273 intentState
2274 if not intentState:
2275 main.log.warn( "Not all intents installed" )
2276 if intentState:
2277 break
2278 else:
2279 #Dumping intent summary
2280 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2281
2282
2283 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2284 onpass="INTENTS INSTALLED",
2285 onfail="SOME INTENTS NOT INSTALLED" )
2286
Hari Krishnac195f3b2015-07-08 20:02:24 -07002287 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002288 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002289 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002290 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2291 if not pingResult:
2292 main.log.warn("First pingall failed. Retrying...")
2293 time.sleep(main.pingSleep)
2294 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002295
Hari Krishnac195f3b2015-07-08 20:02:24 -07002296 time2 = time.time()
2297 timeDiff = round( ( time2 - time1 ), 2 )
2298 main.log.report(
2299 "Time taken for Ping All: " +
2300 str( timeDiff ) +
2301 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002302 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002303 onpass="PING ALL PASS",
2304 onfail="PING ALL FAIL" )
2305
GlennRCbddd58f2015-10-01 15:45:25 -07002306 caseResult = linkDown and pingResult and intentState
2307 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002308 onpass="Random Link cut Test PASS",
2309 onfail="Random Link cut Test FAIL" )
2310
GlennRCfcfdc4f2015-09-30 16:01:57 -07002311 # Printing what exactly failed
2312 if not linkDown:
2313 main.log.debug( "Link down was not discovered correctly" )
2314 if not pingResult:
2315 main.log.debug( "Pingall failed" )
2316 if not intentState:
2317 main.log.debug( "Intents are not all installed" )
2318
GlennRCbddd58f2015-10-01 15:45:25 -07002319 if not caseResult and main.failSwitch:
2320 main.log.report("Stopping test")
2321 main.stop( email=main.emailOnStop )
2322
Hari Krishnac195f3b2015-07-08 20:02:24 -07002323 def CASE84( self, main ):
2324 """
2325 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2326 """
2327 import random
2328 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2329 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2330 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2331 main.log.report(
2332 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2333 main.log.report(
2334 "__________________________________________________________________" )
2335 main.case(
2336 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002337
2338 # Work around for link state propagation delay. Added some sleep time.
2339 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2340 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002341 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2342 time.sleep( link_sleep )
2343 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2344 time.sleep( link_sleep )
2345
Hari Krishna6185fc12015-07-13 15:42:31 -07002346 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002347 linkUp = main.ONOSbench.checkStatus(
2348 topology_output,
2349 main.numMNswitches,
2350 str( main.numMNlinks ) )
2351 utilities.assert_equals(
2352 expect=main.TRUE,
2353 actual=linkUp,
2354 onpass="Link up discovered properly",
2355 onfail="Link up was not discovered in " +
2356 str( link_sleep ) +
2357 " seconds" )
2358
GlennRCfcfdc4f2015-09-30 16:01:57 -07002359 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002360 # Giving onos multiple chances to install intents
2361 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002362 if i != 0:
2363 main.log.warn( "Verification failed. Retrying..." )
2364 main.log.info("Giving onos some time...")
2365 time.sleep( main.checkIntentsDelay )
2366
2367 intentState = main.TRUE
2368 for e in range(int(main.numCtrls)):
2369 main.log.info( "Checking intents on CLI %s" % (e+1) )
2370 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2371 intentState
2372 if not intentState:
2373 main.log.warn( "Not all intents installed" )
2374 if intentState:
2375 break
2376 else:
2377 #Dumping intent summary
2378 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2379
2380
2381 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2382 onpass="INTENTS INSTALLED",
2383 onfail="SOME INTENTS NOT INSTALLED" )
2384
Hari Krishnac195f3b2015-07-08 20:02:24 -07002385 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002386 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002387 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002388 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2389 if not pingResult:
2390 main.log.warn("First pingall failed. Retrying...")
2391 time.sleep(main.pingSleep)
2392 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002393
Hari Krishnac195f3b2015-07-08 20:02:24 -07002394 time2 = time.time()
2395 timeDiff = round( ( time2 - time1 ), 2 )
2396 main.log.report(
2397 "Time taken for Ping All: " +
2398 str( timeDiff ) +
2399 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002400 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002401 onpass="PING ALL PASS",
2402 onfail="PING ALL FAIL" )
2403
GlennRCbddd58f2015-10-01 15:45:25 -07002404 caseResult = linkUp and pingResult
2405 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002406 onpass="Link Up Test PASS",
2407 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002408 # Printing what exactly failed
2409 if not linkUp:
2410 main.log.debug( "Link down was not discovered correctly" )
2411 if not pingResult:
2412 main.log.debug( "Pingall failed" )
2413 if not intentState:
2414 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002415
GlennRCbddd58f2015-10-01 15:45:25 -07002416 if not caseResult and main.failSwitch:
2417 main.log.report("Stopping test")
2418 main.stop( email=main.emailOnStop )
2419
Hari Krishnab79d0822015-08-20 09:48:43 -07002420 def CASE75( self, main ):
2421 """
2422 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2423 """
2424 import random
2425 main.randomLink1 = []
2426 main.randomLink2 = []
2427 main.randomLink3 = []
2428 main.randomLink4 = []
2429 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2430 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2431 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2432 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2433 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2434 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2435 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2436 main.pingTimeout = 400
2437
2438 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2439 main.log.report( "___________________________________________________________________________" )
2440 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2441 linkIndex = range(4)
2442 linkIndexS9 = random.sample(linkIndex,1)[0]
2443 linkIndex.remove(linkIndexS9)
2444 linkIndexS10 = random.sample(linkIndex,1)[0]
2445 main.randomLink1 = link1End2top[linkIndexS9]
2446 main.randomLink2 = link2End2top[linkIndexS10]
2447 main.randomLink3 = random.sample(link1End2bot,1)[0]
2448 main.randomLink4 = random.sample(link2End2bot,1)[0]
2449
2450 # Work around for link state propagation delay. Added some sleep time.
2451 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2452 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2453 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2454 time.sleep( link_sleep )
2455 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2456 time.sleep( link_sleep )
2457
2458 topology_output = main.ONOScli1.topology()
2459 linkDown = main.ONOSbench.checkStatus(
2460 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002461 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002462 utilities.assert_equals(
2463 expect=main.TRUE,
2464 actual=linkDown,
2465 onpass="Link Down discovered properly",
2466 onfail="Link down was not discovered in " +
2467 str( link_sleep ) +
2468 " seconds" )
2469
GlennRCfcfdc4f2015-09-30 16:01:57 -07002470 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002471 # Giving onos multiple chances to install intents
2472 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002473 if i != 0:
2474 main.log.warn( "Verification failed. Retrying..." )
2475 main.log.info("Giving onos some time...")
2476 time.sleep( main.checkIntentsDelay )
2477
2478 intentState = main.TRUE
2479 for e in range(int(main.numCtrls)):
2480 main.log.info( "Checking intents on CLI %s" % (e+1) )
2481 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2482 intentState
2483 if not intentState:
2484 main.log.warn( "Not all intents installed" )
2485 if intentState:
2486 break
2487 else:
2488 #Dumping intent summary
2489 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2490
2491
2492 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2493 onpass="INTENTS INSTALLED",
2494 onfail="SOME INTENTS NOT INSTALLED" )
2495
Hari Krishnab79d0822015-08-20 09:48:43 -07002496 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002497 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002498 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002499 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2500 if not pingResult:
2501 main.log.warn("First pingall failed. Retrying...")
2502 time.sleep(main.pingSleep)
2503 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002504
Hari Krishnab79d0822015-08-20 09:48:43 -07002505 time2 = time.time()
2506 timeDiff = round( ( time2 - time1 ), 2 )
2507 main.log.report(
2508 "Time taken for Ping All: " +
2509 str( timeDiff ) +
2510 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002511 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002512 onpass="PING ALL PASS",
2513 onfail="PING ALL FAIL" )
2514
GlennRCbddd58f2015-10-01 15:45:25 -07002515 caseResult = linkDown and pingResult and intentState
2516 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002517 onpass="Random Link cut Test PASS",
2518 onfail="Random Link cut Test FAIL" )
2519
GlennRCfcfdc4f2015-09-30 16:01:57 -07002520 # Printing what exactly failed
2521 if not linkDown:
2522 main.log.debug( "Link down was not discovered correctly" )
2523 if not pingResult:
2524 main.log.debug( "Pingall failed" )
2525 if not intentState:
2526 main.log.debug( "Intents are not all installed" )
2527
GlennRCbddd58f2015-10-01 15:45:25 -07002528 if not caseResult and main.failSwitch:
2529 main.log.report("Stopping test")
2530 main.stop( email=main.emailOnStop )
2531
Hari Krishnab79d0822015-08-20 09:48:43 -07002532 def CASE85( self, main ):
2533 """
2534 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2535 """
2536 import random
2537 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2538 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2539 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2540 main.log.report(
2541 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2542 main.log.report(
2543 "__________________________________________________________________" )
2544 main.case(
2545 "Point intents - Bring the core links up that are down and verify ping all" )
2546
2547 # Work around for link state propagation delay. Added some sleep time.
2548 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2549 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2550 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2551 time.sleep( link_sleep )
2552 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2553 time.sleep( link_sleep )
2554
2555 topology_output = main.ONOScli1.topology()
2556 linkUp = main.ONOSbench.checkStatus(
2557 topology_output,
2558 main.numMNswitches,
2559 str( main.numMNlinks ) )
2560 utilities.assert_equals(
2561 expect=main.TRUE,
2562 actual=linkUp,
2563 onpass="Link up discovered properly",
2564 onfail="Link up was not discovered in " +
2565 str( link_sleep ) +
2566 " seconds" )
2567
GlennRCfcfdc4f2015-09-30 16:01:57 -07002568 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002569 # Giving onos multiple chances to install intents
2570 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002571 if i != 0:
2572 main.log.warn( "Verification failed. Retrying..." )
2573 main.log.info("Giving onos some time...")
2574 time.sleep( main.checkIntentsDelay )
2575
2576 intentState = main.TRUE
2577 for e in range(int(main.numCtrls)):
2578 main.log.info( "Checking intents on CLI %s" % (e+1) )
2579 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2580 intentState
2581 if not intentState:
2582 main.log.warn( "Not all intents installed" )
2583 if intentState:
2584 break
2585 else:
2586 #Dumping intent summary
2587 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2588
2589
2590 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2591 onpass="INTENTS INSTALLED",
2592 onfail="SOME INTENTS NOT INSTALLED" )
2593
Hari Krishnab79d0822015-08-20 09:48:43 -07002594 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002595 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002596 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002597 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2598 if not pingResult:
2599 main.log.warn("First pingall failed. Retrying...")
2600 time.sleep(main.pingSleep)
2601 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002602
Hari Krishnab79d0822015-08-20 09:48:43 -07002603 time2 = time.time()
2604 timeDiff = round( ( time2 - time1 ), 2 )
2605 main.log.report(
2606 "Time taken for Ping All: " +
2607 str( timeDiff ) +
2608 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002609 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002610 onpass="PING ALL PASS",
2611 onfail="PING ALL FAIL" )
2612
GlennRCbddd58f2015-10-01 15:45:25 -07002613 caseResult = linkUp and pingResult
2614 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002615 onpass="Link Up Test PASS",
2616 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002617 # Printing what exactly failed
2618 if not linkUp:
2619 main.log.debug( "Link down was not discovered correctly" )
2620 if not pingResult:
2621 main.log.debug( "Pingall failed" )
2622 if not intentState:
2623 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002624
GlennRCbddd58f2015-10-01 15:45:25 -07002625 if not caseResult and main.failSwitch:
2626 main.log.report("Stopping test")
2627 main.stop( email=main.emailOnStop )
2628
Hari Krishna4223dbd2015-08-13 16:29:53 -07002629 def CASE170( self ):
2630 """
2631 IPv6 ping all with some core links down( Host Intents-Att Topo)
2632 """
2633 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2634 main.log.report( "_________________________________________________" )
2635 import itertools
2636 import time
2637 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2638 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002639 pingResult = main.FALSE
2640 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002641 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002642 if not pingResult:
2643 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002644 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002645 time2 = time.time()
2646 timeDiff = round( ( time2 - time1 ), 2 )
2647 main.log.report(
2648 "Time taken for IPv6 Ping All: " +
2649 str( timeDiff ) +
2650 " seconds" )
2651 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2652 onpass="PING ALL PASS",
2653 onfail="PING ALL FAIL" )
2654
GlennRCbddd58f2015-10-01 15:45:25 -07002655 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002656 utilities.assert_equals(
2657 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002658 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002659 onpass="IPv6 Ping across 300 host intents test PASS",
2660 onfail="IPv6 Ping across 300 host intents test FAIL" )
2661
2662 def CASE180( self ):
2663 """
2664 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2665 """
2666 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2667 main.log.report( "_________________________________________________" )
2668 import itertools
2669 import time
2670 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2671 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002672 pingResult = main.FALSE
2673 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002674 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002675 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002676 main.log.warn("First ping failed. Retrying...")
2677 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002678 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002679 time2 = time.time()
2680 timeDiff = round( ( time2 - time1 ), 2 )
2681 main.log.report(
2682 "Time taken for IPv6 Ping All: " +
2683 str( timeDiff ) +
2684 " seconds" )
2685 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2686 onpass="PING ALL PASS",
2687 onfail="PING ALL FAIL" )
2688
GlennRCbddd58f2015-10-01 15:45:25 -07002689 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002690 utilities.assert_equals(
2691 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002692 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002693 onpass="IPv6 Ping across 300 host intents test PASS",
2694 onfail="IPv6 Ping across 300 host intents test FAIL" )
2695
2696 def CASE171( self ):
2697 """
2698 IPv6 ping all with some core links down( Point Intents-Att Topo)
2699 """
2700 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2701 main.log.report( "_________________________________________________" )
2702 import itertools
2703 import time
2704 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2705 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002706 pingResult = main.FALSE
2707 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002708 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002709 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002710 main.log.warn("First ping failed. Retrying...")
2711 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002712 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002713 time2 = time.time()
2714 timeDiff = round( ( time2 - time1 ), 2 )
2715 main.log.report(
2716 "Time taken for IPv6 Ping All: " +
2717 str( timeDiff ) +
2718 " seconds" )
2719 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2720 onpass="PING ALL PASS",
2721 onfail="PING ALL FAIL" )
2722
GlennRCbddd58f2015-10-01 15:45:25 -07002723 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002724 utilities.assert_equals(
2725 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002726 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002727 onpass="IPv6 Ping across 600 point intents test PASS",
2728 onfail="IPv6 Ping across 600 point intents test FAIL" )
2729
2730 def CASE181( self ):
2731 """
2732 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2733 """
2734 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2735 main.log.report( "_________________________________________________" )
2736 import itertools
2737 import time
2738 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2739 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002740 pingResult = main.FALSE
2741 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002742 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002743 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002744 main.log.warn("First ping failed. Retrying...")
2745 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002746 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002747 time2 = time.time()
2748 timeDiff = round( ( time2 - time1 ), 2 )
2749 main.log.report(
2750 "Time taken for IPv6 Ping All: " +
2751 str( timeDiff ) +
2752 " seconds" )
2753 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2754 onpass="PING ALL PASS",
2755 onfail="PING ALL FAIL" )
2756
GlennRCbddd58f2015-10-01 15:45:25 -07002757 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002758 utilities.assert_equals(
2759 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002760 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002761 onpass="IPv6 Ping across 600 Point intents test PASS",
2762 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2763
2764 def CASE172( self ):
2765 """
2766 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2767 """
2768 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2769 main.log.report( "_________________________________________________" )
2770 import itertools
2771 import time
2772 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2773 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002774 pingResult = main.FALSE
2775 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002776 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002777 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002778 main.log.warn("First ping failed. Retrying...")
2779 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002780 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002781 time2 = time.time()
2782 timeDiff = round( ( time2 - time1 ), 2 )
2783 main.log.report(
2784 "Time taken for IPv6 Ping All: " +
2785 str( timeDiff ) +
2786 " seconds" )
2787 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2788 onpass="PING ALL PASS",
2789 onfail="PING ALL FAIL" )
2790
GlennRCbddd58f2015-10-01 15:45:25 -07002791 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002792 utilities.assert_equals(
2793 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002794 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002795 onpass="IPv6 Ping across 300 host intents test PASS",
2796 onfail="IPv6 Ping across 300 host intents test FAIL" )
2797
2798 def CASE182( self ):
2799 """
2800 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2801 """
2802 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2803 main.log.report( "_________________________________________________" )
2804 import itertools
2805 import time
2806 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2807 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002808 pingResult = main.FALSE
2809 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002810 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002811 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002812 main.log.warn("First ping failed. Retrying...")
2813 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002814 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002815 time2 = time.time()
2816 timeDiff = round( ( time2 - time1 ), 2 )
2817 main.log.report(
2818 "Time taken for IPv6 Ping All: " +
2819 str( timeDiff ) +
2820 " seconds" )
2821 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2822 onpass="PING ALL PASS",
2823 onfail="PING ALL FAIL" )
2824
GlennRCbddd58f2015-10-01 15:45:25 -07002825 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002826 utilities.assert_equals(
2827 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002828 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002829 onpass="IPv6 Ping across 300 host intents test PASS",
2830 onfail="IPv6 Ping across 300 host intents test FAIL" )
2831
2832 def CASE173( self ):
2833 """
2834 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2835 """
2836 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2837 main.log.report( "_________________________________________________" )
2838 import itertools
2839 import time
2840 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2841 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002842 pingResult = main.FALSE
2843 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002844 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002845 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002846 main.log.warn("First ping failed. Retrying...")
2847 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002848 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002849 time2 = time.time()
2850 timeDiff = round( ( time2 - time1 ), 2 )
2851 main.log.report(
2852 "Time taken for IPv6 Ping All: " +
2853 str( timeDiff ) +
2854 " seconds" )
2855 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2856 onpass="PING ALL PASS",
2857 onfail="PING ALL FAIL" )
2858
GlennRCbddd58f2015-10-01 15:45:25 -07002859 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002860 utilities.assert_equals(
2861 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002862 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002863 onpass="IPv6 Ping across 600 point intents test PASS",
2864 onfail="IPv6 Ping across 600 point intents test FAIL" )
2865
2866 def CASE183( self ):
2867 """
2868 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2869 """
2870 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2871 main.log.report( "_________________________________________________" )
2872 import itertools
2873 import time
2874 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2875 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002876 pingResult = main.FALSE
2877 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002878 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
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()
GlennRC4ae5a242015-10-02 11:37:56 -07002882 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002883 time2 = time.time()
2884 timeDiff = round( ( time2 - time1 ), 2 )
2885 main.log.report(
2886 "Time taken for IPv6 Ping All: " +
2887 str( timeDiff ) +
2888 " seconds" )
2889 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2890 onpass="PING ALL PASS",
2891 onfail="PING ALL FAIL" )
2892
GlennRCbddd58f2015-10-01 15:45:25 -07002893 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002894 utilities.assert_equals(
2895 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002896 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002897 onpass="IPv6 Ping across 600 Point intents test PASS",
2898 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2899
2900 def CASE174( self ):
2901 """
2902 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2903 """
2904 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2905 main.log.report( "_________________________________________________" )
2906 import itertools
2907 import time
2908 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2909 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002910 pingResult = main.FALSE
2911 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002912 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002913 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002914 main.log.warn("First ping failed. Retrying...")
2915 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002916 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002917 time2 = time.time()
2918 timeDiff = round( ( time2 - time1 ), 2 )
2919 main.log.report(
2920 "Time taken for IPv6 Ping All: " +
2921 str( timeDiff ) +
2922 " seconds" )
2923 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2924 onpass="PING ALL PASS",
2925 onfail="PING ALL FAIL" )
2926
GlennRCbddd58f2015-10-01 15:45:25 -07002927 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002928 utilities.assert_equals(
2929 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002930 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002931 onpass="IPv6 Ping across 2278 host intents test PASS",
2932 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2933
2934 def CASE184( self ):
2935 """
2936 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2937 """
2938 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2939 main.log.report( "_________________________________________________" )
2940 import itertools
2941 import time
2942 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2943 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002944 pingResult = main.FALSE
2945 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002946 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002947 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002948 main.log.warn("First ping failed. Retrying...")
2949 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002950 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002951 time2 = time.time()
2952 timeDiff = round( ( time2 - time1 ), 2 )
2953 main.log.report(
2954 "Time taken for IPv6 Ping All: " +
2955 str( timeDiff ) +
2956 " seconds" )
2957 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2958 onpass="PING ALL PASS",
2959 onfail="PING ALL FAIL" )
2960
GlennRCbddd58f2015-10-01 15:45:25 -07002961 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002962 utilities.assert_equals(
2963 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002964 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002965 onpass="IPv6 Ping across 2278 host intents test PASS",
2966 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2967
2968 def CASE175( self ):
2969 """
2970 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2971 """
2972 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2973 main.log.report( "_________________________________________________" )
2974 import itertools
2975 import time
2976 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2977 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002978 pingResult = main.FALSE
2979 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002980 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002981 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002982 main.log.warn("First ping failed. Retrying...")
2983 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002984 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002985 time2 = time.time()
2986 timeDiff = round( ( time2 - time1 ), 2 )
2987 main.log.report(
2988 "Time taken for IPv6 Ping All: " +
2989 str( timeDiff ) +
2990 " seconds" )
2991 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2992 onpass="PING ALL PASS",
2993 onfail="PING ALL FAIL" )
2994
GlennRCbddd58f2015-10-01 15:45:25 -07002995 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002996 utilities.assert_equals(
2997 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002998 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002999 onpass="IPv6 Ping across 4556 point intents test PASS",
3000 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3001
3002 def CASE185( self ):
3003 """
3004 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3005 """
3006 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3007 main.log.report( "_________________________________________________" )
3008 import itertools
3009 import time
3010 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3011 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003012 pingResult = main.FALSE
3013 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003014 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003015 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003016 main.log.warn("First ping failed. Retrying...")
3017 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003018 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003019 time2 = time.time()
3020 timeDiff = round( ( time2 - time1 ), 2 )
3021 main.log.report(
3022 "Time taken for IPv6 Ping All: " +
3023 str( timeDiff ) +
3024 " seconds" )
3025 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3026 onpass="PING ALL PASS",
3027 onfail="PING ALL FAIL" )
3028
GlennRCbddd58f2015-10-01 15:45:25 -07003029 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003030 utilities.assert_equals(
3031 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003032 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003033 onpass="IPv6 Ping across 4556 Point intents test PASS",
3034 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3035
Hari Krishnac195f3b2015-07-08 20:02:24 -07003036 def CASE90( self ):
3037 """
3038 Install 600 point intents and verify ping all (Att Topology)
3039 """
3040 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3041 main.log.report( "_______________________________________" )
3042 import itertools
3043 import time
3044 main.case( "Install 600 point intents" )
3045 main.step( "Add point Intents" )
3046 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003047 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3048
Hari Krishnac195f3b2015-07-08 20:02:24 -07003049 intentIdList = []
3050 time1 = time.time()
3051 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3052 pool = []
3053 for cli in main.CLIs:
3054 if i >= len( deviceCombos ):
3055 break
3056 t = main.Thread( target=cli.addPointIntent,
3057 threadID=main.threadID,
3058 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003059 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 -07003060 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003061 t.start()
3062 i = i + 1
3063 main.threadID = main.threadID + 1
3064 for thread in pool:
3065 thread.join()
3066 intentIdList.append(thread.result)
3067 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003068 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003069
GlennRCfcfdc4f2015-09-30 16:01:57 -07003070 # Saving intent ids to check intents in later case
3071 main.intentIds = list(intentIdList)
3072
GlennRCa8d786a2015-09-23 17:40:11 -07003073 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003074
GlennRC1dde1712015-10-02 11:03:08 -07003075 # Giving onos multiple chances to install intents
3076 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003077 if i != 0:
3078 main.log.warn( "Verification failed. Retrying..." )
3079 main.log.info("Waiting for onos to install intents...")
3080 time.sleep( main.checkIntentsDelay )
3081
GlennRCa8d786a2015-09-23 17:40:11 -07003082 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003083 for e in range(int(main.numCtrls)):
3084 main.log.info( "Checking intents on CLI %s" % (e+1) )
3085 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3086 intentState
3087 if not intentState:
3088 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003089 if intentState:
3090 break
GlennRCdb2c8422015-09-29 12:21:59 -07003091 else:
3092 #Dumping intent summary
3093 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003094
3095 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3096 onpass="INTENTS INSTALLED",
3097 onfail="SOME INTENTS NOT INSTALLED" )
3098
Hari Krishnac195f3b2015-07-08 20:02:24 -07003099 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003100 for i in range(main.numPings):
3101 time1 = time.time()
3102 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3103 if not pingResult:
3104 main.log.warn("First pingall failed. Retrying...")
3105 time.sleep(main.pingSleep)
3106 else: break
3107
Hari Krishnac195f3b2015-07-08 20:02:24 -07003108 time2 = time.time()
3109 timeDiff = round( ( time2 - time1 ), 2 )
3110 main.log.report(
3111 "Time taken for Ping All: " +
3112 str( timeDiff ) +
3113 " seconds" )
3114 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003115 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003116 onfail="PING ALL FAIL" )
3117
GlennRCbddd58f2015-10-01 15:45:25 -07003118 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003119
Hari Krishnac195f3b2015-07-08 20:02:24 -07003120 utilities.assert_equals(
3121 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003122 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003123 onpass="Install 600 point Intents and Ping All test PASS",
3124 onfail="Install 600 point Intents and Ping All test FAIL" )
3125
GlennRCbddd58f2015-10-01 15:45:25 -07003126 if not intentState:
3127 main.log.debug( "Intents failed to install completely" )
3128 if not pingResult:
3129 main.log.debug( "Pingall failed" )
3130
3131 if not caseResult and main.failSwitch:
3132 main.log.report("Stopping test")
3133 main.stop( email=main.emailOnStop )
3134
Hari Krishnac195f3b2015-07-08 20:02:24 -07003135 def CASE91( self ):
3136 """
3137 Install 600 point intents and verify ping all (Chordal Topology)
3138 """
3139 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3140 main.log.report( "_______________________________________" )
3141 import itertools
3142 import time
3143 main.case( "Install 600 point intents" )
3144 main.step( "Add point Intents" )
3145 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003146 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3147
Hari Krishnac195f3b2015-07-08 20:02:24 -07003148 intentIdList = []
3149 time1 = time.time()
3150 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3151 pool = []
3152 for cli in main.CLIs:
3153 if i >= len( deviceCombos ):
3154 break
3155 t = main.Thread( target=cli.addPointIntent,
3156 threadID=main.threadID,
3157 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003158 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 -07003159 pool.append(t)
3160 #time.sleep(1)
3161 t.start()
3162 i = i + 1
3163 main.threadID = main.threadID + 1
3164 for thread in pool:
3165 thread.join()
3166 intentIdList.append(thread.result)
3167 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003168 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003169
GlennRCfcfdc4f2015-09-30 16:01:57 -07003170 # Saving intent ids to check intents in later case
3171 main.intentIds = list(intentIdList)
3172
GlennRCa8d786a2015-09-23 17:40:11 -07003173 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003174
GlennRC1dde1712015-10-02 11:03:08 -07003175 # Giving onos multiple chances to install intents
3176 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003177 if i != 0:
3178 main.log.warn( "Verification failed. Retrying..." )
3179 main.log.info("Waiting for onos to install intents...")
3180 time.sleep( main.checkIntentsDelay )
3181
GlennRCa8d786a2015-09-23 17:40:11 -07003182 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003183 for e in range(int(main.numCtrls)):
3184 main.log.info( "Checking intents on CLI %s" % (e+1) )
3185 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3186 intentState
3187 if not intentState:
3188 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003189 if intentState:
3190 break
GlennRCdb2c8422015-09-29 12:21:59 -07003191 else:
3192 #Dumping intent summary
3193 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003194
3195 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3196 onpass="INTENTS INSTALLED",
3197 onfail="SOME INTENTS NOT INSTALLED" )
3198
Hari Krishnac195f3b2015-07-08 20:02:24 -07003199 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003200 for i in range(main.numPings):
3201 time1 = time.time()
3202 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3203 if not pingResult:
3204 main.log.warn("First pingall failed. Retrying...")
3205 time.sleep(main.pingSleep)
3206 else: break
3207
Hari Krishnac195f3b2015-07-08 20:02:24 -07003208 time2 = time.time()
3209 timeDiff = round( ( time2 - time1 ), 2 )
3210 main.log.report(
3211 "Time taken for Ping All: " +
3212 str( timeDiff ) +
3213 " seconds" )
3214 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3215 onpass="PING ALL PASS",
3216 onfail="PING ALL FAIL" )
3217
GlennRCbddd58f2015-10-01 15:45:25 -07003218 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003219
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 utilities.assert_equals(
3221 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003222 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003223 onpass="Install 600 point Intents and Ping All test PASS",
3224 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003225
GlennRCbddd58f2015-10-01 15:45:25 -07003226 if not intentState:
3227 main.log.debug( "Intents failed to install completely" )
3228 if not pingResult:
3229 main.log.debug( "Pingall failed" )
3230
3231 if not caseResult and main.failSwitch:
3232 main.log.report("Stopping test")
3233 main.stop( email=main.emailOnStop )
3234
Hari Krishnac195f3b2015-07-08 20:02:24 -07003235 def CASE92( self ):
3236 """
3237 Install 4556 point intents and verify ping all (Spine Topology)
3238 """
3239 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3240 main.log.report( "_______________________________________" )
3241 import itertools
3242 import time
3243 main.case( "Install 4556 point intents" )
3244 main.step( "Add point Intents" )
3245 intentResult = main.TRUE
3246 main.pingTimeout = 600
3247 for i in range(len(main.hostMACs)):
3248 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3249 print main.MACsDict
3250 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3251 intentIdList = []
3252 time1 = time.time()
3253 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3254 pool = []
3255 for cli in main.CLIs:
3256 if i >= len( deviceCombos ):
3257 break
3258 t = main.Thread( target=cli.addPointIntent,
3259 threadID=main.threadID,
3260 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003261 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003262 pool.append(t)
3263 #time.sleep(1)
3264 t.start()
3265 i = i + 1
3266 main.threadID = main.threadID + 1
3267 for thread in pool:
3268 thread.join()
3269 intentIdList.append(thread.result)
3270 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003271 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003272
GlennRCfcfdc4f2015-09-30 16:01:57 -07003273 # Saving intent ids to check intents in later case
3274 main.intentIds = list(intentIdList)
3275
GlennRCa8d786a2015-09-23 17:40:11 -07003276 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003277
GlennRC1dde1712015-10-02 11:03:08 -07003278 # Giving onos multiple chances to install intents
3279 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003280 if i != 0:
3281 main.log.warn( "Verification failed. Retrying..." )
3282 main.log.info("Waiting for onos to install intents...")
3283 time.sleep( main.checkIntentsDelay )
3284
GlennRCa8d786a2015-09-23 17:40:11 -07003285 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003286 for e in range(int(main.numCtrls)):
3287 main.log.info( "Checking intents on CLI %s" % (e+1) )
3288 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3289 intentState
3290 if not intentState:
3291 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003292 if intentState:
3293 break
GlennRCdb2c8422015-09-29 12:21:59 -07003294 else:
3295 #Dumping intent summary
3296 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003297
3298 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3299 onpass="INTENTS INSTALLED",
3300 onfail="SOME INTENTS NOT INSTALLED" )
3301
Hari Krishnac195f3b2015-07-08 20:02:24 -07003302 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003303 for i in range(main.numPings):
3304 time1 = time.time()
3305 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3306 if not pingResult:
3307 main.log.warn("First pingall failed. Retrying...")
3308 time.sleep(main.pingSleep)
3309 else: break
3310
Hari Krishnac195f3b2015-07-08 20:02:24 -07003311 time2 = time.time()
3312 timeDiff = round( ( time2 - time1 ), 2 )
3313 main.log.report(
3314 "Time taken for Ping All: " +
3315 str( timeDiff ) +
3316 " seconds" )
3317 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3318 onpass="PING ALL PASS",
3319 onfail="PING ALL FAIL" )
3320
GlennRCbddd58f2015-10-01 15:45:25 -07003321 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003322
Hari Krishnac195f3b2015-07-08 20:02:24 -07003323 utilities.assert_equals(
3324 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003325 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003326 onpass="Install 4556 point Intents and Ping All test PASS",
3327 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003328
GlennRCbddd58f2015-10-01 15:45:25 -07003329 if not intentState:
3330 main.log.debug( "Intents failed to install completely" )
3331 if not pingResult:
3332 main.log.debug( "Pingall failed" )
3333
3334 if not caseResult and main.failSwitch:
3335 main.log.report("Stopping test")
3336 main.stop( email=main.emailOnStop )
3337
Hari Krishnac195f3b2015-07-08 20:02:24 -07003338 def CASE93( self ):
3339 """
3340 Install multi-single point intents and verify Ping all works
3341 for att topology
3342 """
3343 import copy
3344 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003345 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003346 main.log.report( "Install multi-single point intents and verify Ping all" )
3347 main.log.report( "___________________________________________" )
3348 main.case( "Install multi-single point intents and Ping all" )
3349 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3350 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3351 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003352 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003353 time1 = time.time()
3354 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3355 pool = []
3356 for cli in main.CLIs:
3357 egressDevice = deviceDPIDsCopy[i]
3358 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3359 ingressDeviceList.remove(egressDevice)
3360 if i >= len( deviceDPIDsCopy ):
3361 break
3362 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3363 threadID=main.threadID,
3364 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003365 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003366 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003367 t.start()
3368 i = i + 1
3369 main.threadID = main.threadID + 1
3370 for thread in pool:
3371 thread.join()
3372 intentIdList.append(thread.result)
3373 time2 = time.time()
3374 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003375
GlennRCdb2c8422015-09-29 12:21:59 -07003376 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003377
GlennRC1dde1712015-10-02 11:03:08 -07003378 # Giving onos multiple chances to install intents
3379 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003380 if i != 0:
3381 main.log.warn( "Verification failed. Retrying..." )
3382 main.log.info("Waiting for onos to install intents...")
3383 time.sleep( main.checkIntentsDelay )
3384
3385 intentState = main.TRUE
3386 for e in range(int(main.numCtrls)):
3387 main.log.info( "Checking intents on CLI %s" % (e+1) )
3388 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3389 intentState
3390 if not intentState:
3391 main.log.warn( "Not all intents installed" )
3392 if intentState:
3393 break
3394 else:
3395 #Dumping intent summary
3396 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3397
3398 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3399 onpass="INTENTS INSTALLED",
3400 onfail="SOME INTENTS NOT INSTALLED" )
3401
GlennRCfa69a2a2015-10-02 15:54:06 -07003402 main.step("Verify flows are all added")
3403
3404 for i in range( main.flowCheck ):
3405 if i != 0:
3406 main.log.warn( "verification failed. Retrying..." )
3407 main.log.info( "Waiting for onos to add flows..." )
3408 time.sleep( main.checkFlowsDelay )
3409
3410 flowState = main.TRUE
3411 for cli in main.CLIs:
3412 flowState = cli.checkFlowState()
3413 if not flowState:
3414 main.log.warn( "Not all flows added" )
3415 if flowState:
3416 break
3417 else:
3418 #Dumping summary
3419 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3420
3421 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3422 onpass="FLOWS INSTALLED",
3423 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003424
Hari Krishnac195f3b2015-07-08 20:02:24 -07003425 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003426 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003427 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003428 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3429 if not pingResult:
3430 main.log.warn("First pingall failed. Retrying...")
3431 time.sleep(main.pingSleep)
3432 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003433
Hari Krishnac195f3b2015-07-08 20:02:24 -07003434 time2 = time.time()
3435 timeDiff = round( ( time2 - time1 ), 2 )
3436 main.log.report(
3437 "Time taken for Ping All: " +
3438 str( timeDiff ) +
3439 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003440
GlennRCbddd58f2015-10-01 15:45:25 -07003441 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003442 utilities.assert_equals(
3443 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003444 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003445 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
GlennRCfa69a2a2015-10-02 15:54:06 -07003448 if not intentState:
3449 main.log.debug( "Intents failed to install completely" )
3450 if not pingResult:
3451 main.log.debug( "Pingall failed" )
3452 if not checkFlowsState:
3453 main.log.debug( "Flows failed to add completely" )
3454
3455 if not caseResult and main.failSwitch:
3456 main.log.report("Stopping test")
3457 main.stop( email=main.emailOnStop )
3458
Hari Krishnac195f3b2015-07-08 20:02:24 -07003459 def CASE94( self ):
3460 """
3461 Install multi-single point intents and verify Ping all works
3462 for Chordal topology
3463 """
3464 import copy
3465 import time
3466 main.log.report( "Install multi-single point intents and verify Ping all" )
3467 main.log.report( "___________________________________________" )
3468 main.case( "Install multi-single point intents and Ping all" )
3469 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3470 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3471 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003472 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003473 time1 = time.time()
3474 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3475 pool = []
3476 for cli in main.CLIs:
3477 egressDevice = deviceDPIDsCopy[i]
3478 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3479 ingressDeviceList.remove(egressDevice)
3480 if i >= len( deviceDPIDsCopy ):
3481 break
3482 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3483 threadID=main.threadID,
3484 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003485 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003486 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003487 t.start()
3488 i = i + 1
3489 main.threadID = main.threadID + 1
3490 for thread in pool:
3491 thread.join()
3492 intentIdList.append(thread.result)
3493 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003494 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003495
3496 main.step("Verify intents are installed")
3497
GlennRC1dde1712015-10-02 11:03:08 -07003498 # Giving onos multiple chances to install intents
3499 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003500 if i != 0:
3501 main.log.warn( "Verification failed. Retrying..." )
3502 main.log.info("Waiting for onos to install intents...")
3503 time.sleep( main.checkIntentsDelay )
3504
3505 intentState = main.TRUE
3506 for e in range(int(main.numCtrls)):
3507 main.log.info( "Checking intents on CLI %s" % (e+1) )
3508 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3509 intentState
3510 if not intentState:
3511 main.log.warn( "Not all intents installed" )
3512 if intentState:
3513 break
3514 else:
3515 #Dumping intent summary
3516 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3517
GlennRCdb2c8422015-09-29 12:21:59 -07003518 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3519 onpass="INTENTS INSTALLED",
3520 onfail="SOME INTENTS NOT INSTALLED" )
3521
GlennRCfa69a2a2015-10-02 15:54:06 -07003522 main.step("Verify flows are all added")
3523
3524 for i in range( main.flowCheck ):
3525 if i != 0:
3526 main.log.warn( "verification failed. Retrying..." )
3527 main.log.info( "Waiting for onos to add flows..." )
3528 time.sleep( main.checkFlowsDelay )
3529
3530 flowState = main.TRUE
3531 for cli in main.CLIs:
3532 flowState = cli.checkFlowState()
3533 if not flowState:
3534 main.log.warn( "Not all flows added" )
3535 if flowState:
3536 break
3537 else:
3538 #Dumping summary
3539 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3540
3541 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3542 onpass="FLOWS INSTALLED",
3543 onfail="SOME FLOWS NOT ADDED" )
3544
Hari Krishnac195f3b2015-07-08 20:02:24 -07003545 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003546 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003547 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003548 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3549 if not pingResult:
3550 main.log.warn("First pingall failed. Retrying...")
3551 time.sleep(main.pingSleep)
3552 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003553
Hari Krishnac195f3b2015-07-08 20:02:24 -07003554 time2 = time.time()
3555 timeDiff = round( ( time2 - time1 ), 2 )
3556 main.log.report(
3557 "Time taken for Ping All: " +
3558 str( timeDiff ) +
3559 " seconds" )
3560
GlennRCfa69a2a2015-10-02 15:54:06 -07003561 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003562 utilities.assert_equals(
3563 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003564 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003565 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3566 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003567
GlennRCfa69a2a2015-10-02 15:54:06 -07003568 if not intentState:
3569 main.log.debug( "Intents failed to install completely" )
3570 if not pingResult:
3571 main.log.debug( "Pingall failed" )
3572 if not checkFlowsState:
3573 main.log.debug( "Flows failed to add completely" )
3574
3575 if not caseResult and main.failSwitch:
3576 main.log.report("Stopping test")
3577 main.stop( email=main.emailOnStop )
3578
3579 def CASE95( self ):
3580 """
3581 Install multi-single point intents and verify Ping all works
3582 for Spine topology
3583 """
3584 import copy
3585 import time
3586 main.log.report( "Install multi-single point intents and verify Ping all" )
3587 main.log.report( "___________________________________________" )
3588 main.case( "Install multi-single point intents and Ping all" )
3589 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3590 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3591 intentIdList = []
3592 main.log.info( "MACsDict" + str(main.MACsDict) )
3593 time1 = time.time()
3594 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3595 pool = []
3596 for cli in main.CLIs:
3597 egressDevice = deviceDPIDsCopy[i]
3598 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3599 ingressDeviceList.remove(egressDevice)
3600 if i >= len( deviceDPIDsCopy ):
3601 break
3602 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3603 threadID=main.threadID,
3604 name="addMultipointToSinglepointIntent",
3605 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3606 pool.append(t)
3607 t.start()
3608 i = i + 1
3609 main.threadID = main.threadID + 1
3610 for thread in pool:
3611 thread.join()
3612 intentIdList.append(thread.result)
3613 time2 = time.time()
3614 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3615
3616 main.step("Verify intents are installed")
3617
3618 # Giving onos multiple chances to install intents
3619 for i in range( main.intentCheck ):
3620 if i != 0:
3621 main.log.warn( "Verification failed. Retrying..." )
3622 main.log.info("Waiting for onos to install intents...")
3623 time.sleep( main.checkIntentsDelay )
3624
3625 intentState = main.TRUE
3626 for e in range(int(main.numCtrls)):
3627 main.log.info( "Checking intents on CLI %s" % (e+1) )
3628 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3629 intentState
3630 if not intentState:
3631 main.log.warn( "Not all intents installed" )
3632 if intentState:
3633 break
3634 else:
3635 #Dumping intent summary
3636 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3637
3638 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3639 onpass="INTENTS INSTALLED",
3640 onfail="SOME INTENTS NOT INSTALLED" )
3641
3642 main.step("Verify flows are all added")
3643
3644 for i in range( main.flowCheck ):
3645 if i != 0:
3646 main.log.warn( "verification failed. Retrying..." )
3647 main.log.info( "Waiting for onos to add flows..." )
3648 time.sleep( main.checkFlowsDelay )
3649
3650 flowState = main.TRUE
3651 for cli in main.CLIs:
3652 flowState = cli.checkFlowState()
3653 if not flowState:
3654 main.log.warn( "Not all flows added" )
3655 if flowState:
3656 break
3657 else:
3658 #Dumping summary
3659 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3660
3661 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3662 onpass="FLOWS INSTALLED",
3663 onfail="SOME FLOWS NOT ADDED" )
3664
3665 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003666 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003667 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003668 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3669 if not pingResult:
3670 main.log.warn("First pingall failed. Retrying...")
3671 time.sleep(main.pingSleep)
3672 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003673
3674 time2 = time.time()
3675 timeDiff = round( ( time2 - time1 ), 2 )
3676 main.log.report(
3677 "Time taken for Ping All: " +
3678 str( timeDiff ) +
3679 " seconds" )
3680
3681 caseResult = ( checkFlowsState and pingResult and intentState )
3682 utilities.assert_equals(
3683 expect=main.TRUE,
3684 actual=caseResult,
3685 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3686 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3687
3688 if not intentState:
3689 main.log.debug( "Intents failed to install completely" )
3690 if not pingResult:
3691 main.log.debug( "Pingall failed" )
3692 if not checkFlowsState:
3693 main.log.debug( "Flows failed to add completely" )
3694
3695 if not caseResult and main.failSwitch:
3696 main.log.report("Stopping test")
3697 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003698
3699 def CASE96( self ):
3700 """
3701 Install single-multi point intents and verify Ping all works
3702 for att topology
3703 """
3704 import copy
3705 main.log.report( "Install single-multi point intents and verify Ping all" )
3706 main.log.report( "___________________________________________" )
3707 main.case( "Install single-multi point intents and Ping all" )
3708 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3709 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3710 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003711 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003712 time1 = time.time()
3713 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3714 pool = []
3715 for cli in main.CLIs:
3716 ingressDevice = deviceDPIDsCopy[i]
3717 egressDeviceList = copy.copy(deviceDPIDsCopy)
3718 egressDeviceList.remove(ingressDevice)
3719 if i >= len( deviceDPIDsCopy ):
3720 break
3721 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3722 threadID=main.threadID,
3723 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003724 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003725 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003726 t.start()
3727 i = i + 1
3728 main.threadID = main.threadID + 1
3729 for thread in pool:
3730 thread.join()
3731 intentIdList.append(thread.result)
3732 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003733 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003734
3735 main.step("Verify intents are installed")
3736
GlennRC1dde1712015-10-02 11:03:08 -07003737 # Giving onos multiple chances to install intents
3738 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003739 if i != 0:
3740 main.log.warn( "Verification failed. Retrying..." )
3741 main.log.info("Waiting for onos to install intents...")
3742 time.sleep( main.checkIntentsDelay )
3743
3744 intentState = main.TRUE
3745 for e in range(int(main.numCtrls)):
3746 main.log.info( "Checking intents on CLI %s" % (e+1) )
3747 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3748 intentState
3749 if not intentState:
3750 main.log.warn( "Not all intents installed" )
3751 if intentState:
3752 break
3753 else:
3754 #Dumping intent summary
3755 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3756
GlennRCdb2c8422015-09-29 12:21:59 -07003757 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3758 onpass="INTENTS INSTALLED",
3759 onfail="SOME INTENTS NOT INSTALLED" )
3760
GlennRCfa69a2a2015-10-02 15:54:06 -07003761 main.step("Verify flows are all added")
3762
3763 for i in range( main.flowCheck ):
3764 if i != 0:
3765 main.log.warn( "verification failed. Retrying..." )
3766 main.log.info( "Waiting for onos to add flows..." )
3767 time.sleep( main.checkFlowsDelay )
3768
3769 flowState = main.TRUE
3770 for cli in main.CLIs:
3771 flowState = cli.checkFlowState()
3772 if not flowState:
3773 main.log.warn( "Not all flows added" )
3774 if flowState:
3775 break
3776 else:
3777 #Dumping summary
3778 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3779
3780 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3781 onpass="FLOWS INSTALLED",
3782 onfail="SOME FLOWS NOT ADDED" )
3783
Hari Krishnac195f3b2015-07-08 20:02:24 -07003784 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003785 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003786 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003787 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3788 if not pingResult:
3789 main.log.warn("First pingall failed. Retrying...")
3790 time.sleep(main.pingSleep)
3791 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003792
Hari Krishnac195f3b2015-07-08 20:02:24 -07003793 time2 = time.time()
3794 timeDiff = round( ( time2 - time1 ), 2 )
3795 main.log.report(
3796 "Time taken for Ping All: " +
3797 str( timeDiff ) +
3798 " seconds" )
3799
GlennRCfa69a2a2015-10-02 15:54:06 -07003800 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003801 utilities.assert_equals(
3802 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003803 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003804 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3805 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3806
GlennRCfa69a2a2015-10-02 15:54:06 -07003807 if not intentState:
3808 main.log.debug( "Intents failed to install completely" )
3809 if not pingResult:
3810 main.log.debug( "Pingall failed" )
3811 if not checkFlowsState:
3812 main.log.debug( "Flows failed to add completely" )
3813
3814 if not caseResult and main.failSwitch:
3815 main.log.report("Stopping test")
3816 main.stop( email=main.emailOnStop )
3817
Hari Krishnac195f3b2015-07-08 20:02:24 -07003818 def CASE97( self ):
3819 """
3820 Install single-multi point intents and verify Ping all works
3821 for Chordal topology
3822 """
3823 import copy
3824 main.log.report( "Install single-multi point intents and verify Ping all" )
3825 main.log.report( "___________________________________________" )
3826 main.case( "Install single-multi point intents and Ping all" )
3827 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3828 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3829 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003830 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003831 time1 = time.time()
3832 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3833 pool = []
3834 for cli in main.CLIs:
3835 ingressDevice = deviceDPIDsCopy[i]
3836 egressDeviceList = copy.copy(deviceDPIDsCopy)
3837 egressDeviceList.remove(ingressDevice)
3838 if i >= len( deviceDPIDsCopy ):
3839 break
3840 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3841 threadID=main.threadID,
3842 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003843 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003844 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003845 t.start()
3846 i = i + 1
3847 main.threadID = main.threadID + 1
3848 for thread in pool:
3849 thread.join()
3850 intentIdList.append(thread.result)
3851 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003852 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003853
3854 main.step("Verify intents are installed")
3855
GlennRC1dde1712015-10-02 11:03:08 -07003856 # Giving onos multiple chances to install intents
3857 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003858 if i != 0:
3859 main.log.warn( "Verification failed. Retrying..." )
3860 main.log.info("Waiting for onos to install intents...")
3861 time.sleep( main.checkIntentsDelay )
3862
3863 intentState = main.TRUE
3864 for e in range(int(main.numCtrls)):
3865 main.log.info( "Checking intents on CLI %s" % (e+1) )
3866 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3867 intentState
3868 if not intentState:
3869 main.log.warn( "Not all intents installed" )
3870 if intentState:
3871 break
3872 else:
3873 #Dumping intent summary
3874 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3875
GlennRCdb2c8422015-09-29 12:21:59 -07003876 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3877 onpass="INTENTS INSTALLED",
3878 onfail="SOME INTENTS NOT INSTALLED" )
3879
GlennRCfa69a2a2015-10-02 15:54:06 -07003880 main.step("Verify flows are all added")
3881
3882 for i in range( main.flowCheck ):
3883 if i != 0:
3884 main.log.warn( "verification failed. Retrying..." )
3885 main.log.info( "Waiting for onos to add flows..." )
3886 time.sleep( main.checkFlowsDelay )
3887
3888 flowState = main.TRUE
3889 for cli in main.CLIs:
3890 flowState = cli.checkFlowState()
3891 if not flowState:
3892 main.log.warn( "Not all flows added" )
3893 if flowState:
3894 break
3895 else:
3896 #Dumping summary
3897 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3898
3899 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3900 onpass="FLOWS INSTALLED",
3901 onfail="SOME FLOWS NOT ADDED" )
3902
Hari Krishnac195f3b2015-07-08 20:02:24 -07003903 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003904 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003905 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003906 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3907 if not pingResult:
3908 main.log.warn("First pingall failed. Retrying...")
3909 time.sleep(main.pingSleep)
3910 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003911
Hari Krishnac195f3b2015-07-08 20:02:24 -07003912 time2 = time.time()
3913 timeDiff = round( ( time2 - time1 ), 2 )
3914 main.log.report(
3915 "Time taken for Ping All: " +
3916 str( timeDiff ) +
3917 " seconds" )
3918
GlennRCfa69a2a2015-10-02 15:54:06 -07003919 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003920 utilities.assert_equals(
3921 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003922 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003923 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3924 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3925
GlennRCfa69a2a2015-10-02 15:54:06 -07003926 if not intentState:
3927 main.log.debug( "Intents failed to install completely" )
3928 if not pingResult:
3929 main.log.debug( "Pingall failed" )
3930 if not checkFlowsState:
3931 main.log.debug( "Flows failed to add completely" )
3932
3933 if not caseResult and main.failSwitch:
3934 main.log.report("Stopping test")
3935 main.stop( email=main.emailOnStop )
3936
Hari Krishnac195f3b2015-07-08 20:02:24 -07003937 def CASE98( self ):
3938 """
3939 Install single-multi point intents and verify Ping all works
3940 for Spine topology
3941 """
3942 import copy
3943 main.log.report( "Install single-multi point intents and verify Ping all" )
3944 main.log.report( "___________________________________________" )
3945 main.case( "Install single-multi point intents and Ping all" )
3946 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3947 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3948 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3949 intentIdList = []
3950 MACsDictCopy = {}
3951 for i in range( len( deviceDPIDsCopy ) ):
3952 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3953
GlennRCfa69a2a2015-10-02 15:54:06 -07003954 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3955 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003956 time1 = time.time()
3957 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3958 pool = []
3959 for cli in main.CLIs:
3960 if i >= len( deviceDPIDsCopy ):
3961 break
3962 ingressDevice = deviceDPIDsCopy[i]
3963 egressDeviceList = copy.copy(deviceDPIDsCopy)
3964 egressDeviceList.remove(ingressDevice)
3965 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3966 threadID=main.threadID,
3967 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003968 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003969 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003970 t.start()
3971 i = i + 1
3972 main.threadID = main.threadID + 1
3973 for thread in pool:
3974 thread.join()
3975 intentIdList.append(thread.result)
3976 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003977 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003978
3979 main.step("Verify intents are installed")
3980
GlennRC1dde1712015-10-02 11:03:08 -07003981 # Giving onos multiple chances to install intents
3982 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003983 if i != 0:
3984 main.log.warn( "Verification failed. Retrying..." )
3985 main.log.info("Waiting for onos to install intents...")
3986 time.sleep( main.checkIntentsDelay )
3987
3988 intentState = main.TRUE
3989 for e in range(int(main.numCtrls)):
3990 main.log.info( "Checking intents on CLI %s" % (e+1) )
3991 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3992 intentState
3993 if not intentState:
3994 main.log.warn( "Not all intents installed" )
3995 if intentState:
3996 break
3997 else:
3998 #Dumping intent summary
3999 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4000
GlennRCdb2c8422015-09-29 12:21:59 -07004001 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4002 onpass="INTENTS INSTALLED",
4003 onfail="SOME INTENTS NOT INSTALLED" )
4004
GlennRCfa69a2a2015-10-02 15:54:06 -07004005 main.step("Verify flows are all added")
4006
4007 for i in range( main.flowCheck ):
4008 if i != 0:
4009 main.log.warn( "verification failed. Retrying..." )
4010 main.log.info( "Waiting for onos to add flows..." )
4011 time.sleep( main.checkFlowsDelay )
4012
4013 flowState = main.TRUE
4014 for cli in main.CLIs:
4015 flowState = cli.checkFlowState()
4016 if not flowState:
4017 main.log.warn( "Not all flows added" )
4018 if flowState:
4019 break
4020 else:
4021 #Dumping summary
4022 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4023
4024 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4025 onpass="FLOWS INSTALLED",
4026 onfail="SOME FLOWS NOT ADDED" )
4027
Hari Krishnac195f3b2015-07-08 20:02:24 -07004028 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004029 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004030 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004031 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4032 if not pingResult:
4033 main.log.warn("First pingall failed. Retrying...")
4034 time.sleep(main.pingSleep)
4035 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004036
Hari Krishnac195f3b2015-07-08 20:02:24 -07004037 time2 = time.time()
4038 timeDiff = round( ( time2 - time1 ), 2 )
4039 main.log.report(
4040 "Time taken for Ping All: " +
4041 str( timeDiff ) +
4042 " seconds" )
4043
GlennRCfa69a2a2015-10-02 15:54:06 -07004044 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004045 utilities.assert_equals(
4046 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004047 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004048 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4049 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4050
GlennRCfa69a2a2015-10-02 15:54:06 -07004051 if not intentState:
4052 main.log.debug( "Intents failed to install completely" )
4053 if not pingResult:
4054 main.log.debug( "Pingall failed" )
4055 if not checkFlowsState:
4056 main.log.debug( "Flows failed to add completely" )
4057
4058 if not caseResult and main.failSwitch:
4059 main.log.report("Stopping test")
4060 main.stop( email=main.emailOnStop )
4061
Hari Krishna4223dbd2015-08-13 16:29:53 -07004062 def CASE190( self ):
4063 """
4064 Verify IPv6 ping across 600 Point intents (Att Topology)
4065 """
4066 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4067 main.log.report( "_________________________________________________" )
4068 import itertools
4069 import time
4070 main.case( "IPv6 ping all 600 Point intents" )
4071 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004072 pingResult = main.FALSE
4073 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004074 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004075 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004076 main.log.warn("First pingall failed. Retrying...")
4077 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004078 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004079 time2 = time.time()
4080 timeDiff = round( ( time2 - time1 ), 2 )
4081 main.log.report(
4082 "Time taken for IPv6 Ping All: " +
4083 str( timeDiff ) +
4084 " seconds" )
4085 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4086 onpass="PING ALL PASS",
4087 onfail="PING ALL FAIL" )
4088
GlennRCbddd58f2015-10-01 15:45:25 -07004089 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004090 utilities.assert_equals(
4091 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004092 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004093 onpass="IPv6 Ping across 600 Point intents test PASS",
4094 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4095
4096 def CASE191( self ):
4097 """
4098 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4099 """
4100 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4101 main.log.report( "_________________________________________________" )
4102 import itertools
4103 import time
4104 main.case( "IPv6 ping all 600 Point intents" )
4105 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004106 pingResult = main.FALSE
4107 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004108 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004109 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004110 main.log.warn("First pingall failed. Retrying...")
4111 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004112 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004113 time2 = time.time()
4114 timeDiff = round( ( time2 - time1 ), 2 )
4115 main.log.report(
4116 "Time taken for IPv6 Ping All: " +
4117 str( timeDiff ) +
4118 " seconds" )
4119 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4120 onpass="PING ALL PASS",
4121 onfail="PING ALL FAIL" )
4122
GlennRCbddd58f2015-10-01 15:45:25 -07004123 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004124 utilities.assert_equals(
4125 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004126 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004127 onpass="IPv6 Ping across 600 Point intents test PASS",
4128 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4129
4130 def CASE192( self ):
4131 """
4132 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4133 """
4134 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4135 main.log.report( "_________________________________________________" )
4136 import itertools
4137 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004138 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004139 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004140 pingResult = main.FALSE
4141 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004142 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004143 if not pingResult:
4144 main.log.warn("First pingall failed. Retrying...")
4145 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004146 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004147 time2 = time.time()
4148 timeDiff = round( ( time2 - time1 ), 2 )
4149 main.log.report(
4150 "Time taken for IPv6 Ping All: " +
4151 str( timeDiff ) +
4152 " seconds" )
4153 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4154 onpass="PING ALL PASS",
4155 onfail="PING ALL FAIL" )
4156
GlennRCbddd58f2015-10-01 15:45:25 -07004157 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004158 utilities.assert_equals(
4159 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004160 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004161 onpass="IPv6 Ping across 4556 Point intents test PASS",
4162 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004163
Hari Krishnac195f3b2015-07-08 20:02:24 -07004164 def CASE10( self ):
4165 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004166 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004167 """
4168 Remove all Intents
4169 """
4170 main.log.report( "Remove all intents that were installed previously" )
4171 main.log.report( "______________________________________________" )
4172 main.log.info( "Remove all intents" )
4173 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004174 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004175 main.step( "Obtain the intent id's first" )
4176 intentsList = main.ONOScli1.getAllIntentIds()
4177 ansi_escape = re.compile( r'\x1b[^m]*m' )
4178 intentsList = ansi_escape.sub( '', intentsList )
4179 intentsList = intentsList.replace(
4180 " onos:intents | grep id=",
4181 "" ).replace(
4182 "id=",
4183 "" ).replace(
4184 "\r\r",
4185 "" )
4186 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004187 intentIdList = []
4188 step1Result = main.TRUE
4189 moreIntents = main.TRUE
4190 removeIntentCount = 0
4191 intentsCount = len(intentsList)
4192 main.log.info ( "Current number of intents: " + str(intentsCount) )
4193 if ( len( intentsList ) > 1 ):
4194 results = main.TRUE
4195 main.log.info("Removing intent...")
4196 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004197 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004198 if removeIntentCount == 5:
4199 break
4200 removeIntentCount = removeIntentCount + 1
4201 intentsList1 = main.ONOScli1.getAllIntentIds()
4202 if len( intentsList1 ) == 0:
4203 break
4204 ansi_escape = re.compile( r'\x1b[^m]*m' )
4205 intentsList1 = ansi_escape.sub( '', intentsList1 )
4206 intentsList1 = intentsList1.replace(
4207 " onos:intents | grep id=",
4208 "" ).replace(
4209 " state=",
4210 "" ).replace(
4211 "\r\r",
4212 "" )
4213 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004214 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4215 print intentsList1
4216 intentIdList1 = []
4217 if ( len( intentsList1 ) > 0 ):
4218 moreIntents = main.TRUE
4219 for i in range( len( intentsList1 ) ):
4220 intentsTemp1 = intentsList1[ i ].split( ',' )
4221 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4222 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4223 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4224 time1 = time.time()
4225 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4226 pool = []
4227 for cli in main.CLIs:
4228 if i >= len( intentIdList1 ):
4229 break
4230 t = main.Thread( target=cli.removeIntent,
4231 threadID=main.threadID,
4232 name="removeIntent",
4233 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4234 pool.append(t)
4235 t.start()
4236 i = i + 1
4237 main.threadID = main.threadID + 1
4238 for thread in pool:
4239 thread.join()
4240 intentIdList.append(thread.result)
4241 #time.sleep(2)
4242 time2 = time.time()
4243 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004244 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004245 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004246 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004247 else:
4248 time.sleep(10)
4249 if len( main.ONOScli1.intents()):
4250 continue
4251 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004252 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004253 else:
4254 print "Removed %d intents" %(intentsCount)
4255 step1Result = main.TRUE
4256 else:
4257 print "No Intent IDs found in Intents list: ", intentsList
4258 step1Result = main.FALSE
4259
4260 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004261 caseResult = step1Result
4262 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004263 onpass="Intent removal test successful",
4264 onfail="Intent removal test failed" )
4265
4266 def CASE12( self, main ):
4267 """
4268 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4269 """
4270 import re
4271 import copy
4272 import time
4273
Hari Krishnac195f3b2015-07-08 20:02:24 -07004274 threadID = 0
4275
4276 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4277 main.log.report( "_____________________________________________________" )
4278 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4279 main.step( "Enable intent based Reactive forwarding" )
4280 installResult = main.FALSE
4281 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004282
Hari Krishnac195f3b2015-07-08 20:02:24 -07004283 pool = []
4284 time1 = time.time()
4285 for cli,feature in main.CLIs:
4286 t = main.Thread(target=cli,threadID=threadID,
4287 name="featureInstall",args=[feature])
4288 pool.append(t)
4289 t.start()
4290 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004291
Hari Krishnac195f3b2015-07-08 20:02:24 -07004292 results = []
4293 for thread in pool:
4294 thread.join()
4295 results.append(thread.result)
4296 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004297
Hari Krishnac195f3b2015-07-08 20:02:24 -07004298 if( all(result == main.TRUE for result in results) == False):
4299 main.log.info("Did not install onos-app-ifwd feature properly")
4300 #main.cleanup()
4301 #main.exit()
4302 else:
4303 main.log.info("Successful feature:install onos-app-ifwd")
4304 installResult = main.TRUE
4305 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004306
GlennRC6ac11b12015-10-21 17:41:28 -07004307 main.step( "Verify Ping across all hosts" )
4308 for i in range(main.numPings):
4309 time1 = time.time()
4310 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4311 if not pingResult:
4312 main.log.warn("First pingall failed. Retrying...")
4313 time.sleep(main.pingSleep)
4314 else: break
4315
Hari Krishnac195f3b2015-07-08 20:02:24 -07004316 time2 = time.time()
4317 timeDiff = round( ( time2 - time1 ), 2 )
4318 main.log.report(
4319 "Time taken for Ping All: " +
4320 str( timeDiff ) +
4321 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004322
GlennRC626ba132015-09-18 16:16:31 -07004323 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004324 main.log.report( "Pingall Test in Reactive mode successful" )
4325 else:
4326 main.log.report( "Pingall Test in Reactive mode failed" )
4327
4328 main.step( "Disable Intent based Reactive forwarding" )
4329 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004330
Hari Krishnac195f3b2015-07-08 20:02:24 -07004331 pool = []
4332 time1 = time.time()
4333 for cli,feature in main.CLIs:
4334 t = main.Thread(target=cli,threadID=threadID,
4335 name="featureUninstall",args=[feature])
4336 pool.append(t)
4337 t.start()
4338 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004339
Hari Krishnac195f3b2015-07-08 20:02:24 -07004340 results = []
4341 for thread in pool:
4342 thread.join()
4343 results.append(thread.result)
4344 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004345
Hari Krishnac195f3b2015-07-08 20:02:24 -07004346 if( all(result == main.TRUE for result in results) == False):
4347 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4348 uninstallResult = main.FALSE
4349 #main.cleanup()
4350 #main.exit()
4351 else:
4352 main.log.info("Successful feature:uninstall onos-app-ifwd")
4353 uninstallResult = main.TRUE
4354 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4355
4356 # Waiting for reative flows to be cleared.
4357 time.sleep( 10 )
4358
GlennRCbddd58f2015-10-01 15:45:25 -07004359 caseResult = installResult and pingResult and uninstallResult
4360 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004361 onpass="Intent based Reactive forwarding Pingall test PASS",
4362 onfail="Intent based Reactive forwarding Pingall test FAIL" )