blob: 9feb9b8f314a9bed969fdf304dfb5ef0652ce3fe [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
Hari Krishnac195f3b2015-07-08 20:02:24 -070030 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070031 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
32 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070033 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070034 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070035 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070036 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070037 main.intentCheck = int( main.params['TEST']['intentChecks'] )
GlennRC289c1b62015-12-12 10:45:43 -080038 main.topoCheck = int( main.params['TEST']['topoChecks'] )
GlennRCf7be6632015-10-20 13:04:07 -070039 main.numPings = int( main.params['TEST']['numPings'] )
GlennRC6ac11b12015-10-21 17:41:28 -070040 main.pingSleep = int( main.params['timers']['pingSleep'] )
GlennRC289c1b62015-12-12 10:45:43 -080041 main.topoCheckDelay = int( main.params['timers']['topoCheckDelay'] )
GlennRC3de72232015-12-16 10:48:35 -080042 main.pingTimeout = int( main.params['timers']['pingTimeout'] )
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
GlennRC3de72232015-12-16 10:48:35 -0800181 main.prefix = 0
182
Hari Krishnac195f3b2015-07-08 20:02:24 -0700183 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
184 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
185 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700186 main.log.report(
187 "Load Att topology and Balance all Mininet switches across controllers" )
188 main.log.report(
189 "________________________________________________________________________" )
190 main.case(
191 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700192
Hari Krishnac195f3b2015-07-08 20:02:24 -0700193 main.step( "Stop any previous Mininet network topology" )
194 cliResult = main.TRUE
195 if main.newTopo == main.params['TOPO3']['topo']:
196 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
197
198 main.step( "Start Mininet with Att topology" )
199 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700200 mininetDir = main.Mininet1.home + "/custom/"
201 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
202 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
203 topoPath = mininetDir + main.newTopo
204 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700205
Hari Krishnac195f3b2015-07-08 20:02:24 -0700206 main.step( "Assign switches to controllers" )
207 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
208 main.Mininet1.assignSwController(
209 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700210 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700211
212 switch_mastership = main.TRUE
213 for i in range( 1, ( main.numMNswitches + 1 ) ):
214 response = main.Mininet1.getSwController( "s" + str( i ) )
215 print( "Response is " + str( response ) )
216 if re.search( "tcp:" + main.onosIPs[0], response ):
217 switch_mastership = switch_mastership and main.TRUE
218 else:
219 switch_mastership = main.FALSE
220
221 if switch_mastership == main.TRUE:
222 main.log.report( "Controller assignment successfull" )
223 else:
224 main.log.report( "Controller assignment failed" )
225
226 time.sleep(30) # waiting here to make sure topology converges across all nodes
227
228 main.step( "Balance devices across controllers" )
229 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700230 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700231 time.sleep( 5 )
232
233 topology_output = main.ONOScli1.topology()
234 topology_result = main.ONOSbench.getTopology( topology_output )
235 case2Result = ( switch_mastership and startStatus )
236 utilities.assert_equals(
237 expect=main.TRUE,
238 actual=case2Result,
239 onpass="Starting new Att topology test PASS",
240 onfail="Starting new Att topology test FAIL" )
241
242 def CASE21( self, main ):
243 """
244 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
245 """
246 import re
247 import time
248 import copy
249
GlennRC3de72232015-12-16 10:48:35 -0800250 main.prefix = 1
GlennRC2db29952015-12-14 12:00:29 -0800251
Hari Krishnac195f3b2015-07-08 20:02:24 -0700252 main.newTopo = main.params['TOPO2']['topo']
253 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
254 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
255 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700256 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
GlennRC3de72232015-12-16 10:48:35 -0800315 main.prefix = 2
GlennRC2db29952015-12-14 12:00:29 -0800316
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
GlennRC3de72232015-12-16 10:48:35 -0800527 if not pingResult:
528 main.stop()
529
GlennRC15d164c2015-12-15 17:12:25 -0800530 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700531 onpass="Reactive Mode IPv4 Pingall test PASS",
532 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700533
GlennRC15d164c2015-12-15 17:12:25 -0800534 main.step( "Disable Reactive forwarding" )
535 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
536 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800537 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800538 onfail="Failed to deactivate fwd app" )
539
Hari Krishnac195f3b2015-07-08 20:02:24 -0700540 def CASE41( self, main ):
541 """
542 Verify Reactive forwarding (Chordal Topology)
543 """
544 import re
545 import copy
546 import time
547 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
548 main.log.report( "______________________________________________" )
549 main.case( "Enable Reactive forwarding and Verify ping all" )
550 main.step( "Enable Reactive forwarding" )
551 installResult = main.TRUE
552 # Activate fwd app
553 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
554
555 appCheck = main.TRUE
556 pool = []
557 for cli in main.CLIs:
558 t = main.Thread( target=cli.appToIDCheck,
559 name="appToIDCheck-" + str( i ),
560 args=[] )
561 pool.append( t )
562 t.start()
563 for t in pool:
564 t.join()
565 appCheck = appCheck and t.result
566 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
567 onpass="App Ids seem to be correct",
568 onfail="Something is wrong with app Ids" )
569 if appCheck != main.TRUE:
570 main.log.warn( main.CLIs[0].apps() )
571 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700572
Hari Krishnac195f3b2015-07-08 20:02:24 -0700573 time.sleep( 10 )
574
GlennRC6ac11b12015-10-21 17:41:28 -0700575 main.step( "Verify Ping across all hosts" )
576 for i in range(main.numPings):
577 time1 = time.time()
578 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
579 if not pingResult:
580 main.log.warn("First pingall failed. Retrying...")
581 time.sleep(main.pingSleep)
582 else: break
583
Hari Krishnac195f3b2015-07-08 20:02:24 -0700584 time2 = time.time()
585 timeDiff = round( ( time2 - time1 ), 2 )
586 main.log.report(
587 "Time taken for Ping All: " +
588 str( timeDiff ) +
589 " seconds" )
590
GlennRC626ba132015-09-18 16:16:31 -0700591 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700592 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700593 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700594 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700595
GlennRCbddd58f2015-10-01 15:45:25 -0700596 caseResult = appCheck and pingResult
597 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700598 onpass="Reactive Mode IPv4 Pingall test PASS",
599 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700600
601 def CASE42( self, main ):
602 """
603 Verify Reactive forwarding (Spine Topology)
604 """
605 import re
606 import copy
607 import time
608 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
609 main.log.report( "______________________________________________" )
610 main.case( "Enable Reactive forwarding and Verify ping all" )
611 main.step( "Enable Reactive forwarding" )
612 installResult = main.TRUE
613 # Activate fwd app
614 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
615
616 appCheck = main.TRUE
617 pool = []
618 for cli in main.CLIs:
619 t = main.Thread( target=cli.appToIDCheck,
620 name="appToIDCheck-" + str( i ),
621 args=[] )
622 pool.append( t )
623 t.start()
624 for t in pool:
625 t.join()
626 appCheck = appCheck and t.result
627 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
628 onpass="App Ids seem to be correct",
629 onfail="Something is wrong with app Ids" )
630 if appCheck != main.TRUE:
631 main.log.warn( main.CLIs[0].apps() )
632 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700633
Hari Krishnac195f3b2015-07-08 20:02:24 -0700634 time.sleep( 10 )
635
GlennRC6ac11b12015-10-21 17:41:28 -0700636 main.step( "Verify Ping across all hosts" )
637 for i in range(main.numPings):
638 time1 = time.time()
639 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
640 if not pingResult:
641 main.log.warn("First pingall failed. Retrying...")
642 time.sleep(main.pingSleep)
643 else: break
644
Hari Krishnac195f3b2015-07-08 20:02:24 -0700645 time2 = time.time()
646 timeDiff = round( ( time2 - time1 ), 2 )
647 main.log.report(
648 "Time taken for Ping All: " +
649 str( timeDiff ) +
650 " seconds" )
651
GlennRC626ba132015-09-18 16:16:31 -0700652 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700653 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700654 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700655 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
656
GlennRCbddd58f2015-10-01 15:45:25 -0700657 caseResult = appCheck and pingResult
658 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700659 onpass="Reactive Mode IPv4 Pingall test PASS",
660 onfail="Reactive Mode IPv4 Pingall test FAIL" )
661
662 def CASE140( self, main ):
663 """
664 Verify IPv6 Reactive forwarding (Att Topology)
665 """
666 import re
667 import copy
668 import time
669 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
670 main.log.report( "______________________________________________" )
671 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
672 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
673
674 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
675 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
676 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
677 cfgResult = cfgResult1 and cfgResult2
678 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
679 onpass="Reactive mode ipv6Fowarding cfg is set to true",
680 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
681
682 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700683 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700684 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700685 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
686 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700687 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700688 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700689 time2 = time.time()
690 timeDiff = round( ( time2 - time1 ), 2 )
691 main.log.report(
692 "Time taken for IPv6 Ping All: " +
693 str( timeDiff ) +
694 " seconds" )
695
GlennRC626ba132015-09-18 16:16:31 -0700696 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700697 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
698 else:
699 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700700
Jon Hall4ba53f02015-07-29 13:07:41 -0700701
GlennRC15d164c2015-12-15 17:12:25 -0800702 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700703 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700704 onpass="Reactive Mode IPv6 Pingall test PASS",
705 onfail="Reactive Mode IPv6 Pingall test FAIL" )
706
707 def CASE141( self, main ):
708 """
709 Verify IPv6 Reactive forwarding (Chordal Topology)
710 """
711 import re
712 import copy
713 import time
714 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
715 main.log.report( "______________________________________________" )
716 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
717 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
718
719 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
720 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
721 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
722 cfgResult = cfgResult1 and cfgResult2
723 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
724 onpass="Reactive mode ipv6Fowarding cfg is set to true",
725 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
726
727 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700728 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700729 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700730 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
731 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700732 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700733 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700734 time2 = time.time()
735 timeDiff = round( ( time2 - time1 ), 2 )
736 main.log.report(
737 "Time taken for IPv6 Ping All: " +
738 str( timeDiff ) +
739 " seconds" )
740
GlennRC626ba132015-09-18 16:16:31 -0700741 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700742 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
743 else:
744 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
745
746 main.step( "Disable Reactive forwarding" )
747
748 main.log.info( "Uninstall reactive forwarding app" )
749 appCheck = main.TRUE
750 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
751 pool = []
752 for cli in main.CLIs:
753 t = main.Thread( target=cli.appToIDCheck,
754 name="appToIDCheck-" + str( i ),
755 args=[] )
756 pool.append( t )
757 t.start()
758
759 for t in pool:
760 t.join()
761 appCheck = appCheck and t.result
762 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
763 onpass="App Ids seem to be correct",
764 onfail="Something is wrong with app Ids" )
765 if appCheck != main.TRUE:
766 main.log.warn( main.CLIs[0].apps() )
767 main.log.warn( main.CLIs[0].appIDs() )
768
769 # Waiting for reative flows to be cleared.
770 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700771 caseResult = appCheck and cfgResult and pingResult
772 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700773 onpass="Reactive Mode IPv6 Pingall test PASS",
774 onfail="Reactive Mode IPv6 Pingall test FAIL" )
775
776 def CASE142( self, main ):
777 """
778 Verify IPv6 Reactive forwarding (Spine Topology)
779 """
780 import re
781 import copy
782 import time
783 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
784 main.log.report( "______________________________________________" )
785 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
786 # Spine topology do not have hosts h1-h10
787 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
788 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
789 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
790 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
791 cfgResult = cfgResult1 and cfgResult2
792 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
793 onpass="Reactive mode ipv6Fowarding cfg is set to true",
794 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
795
796 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700797 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700798 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700799 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
800 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700801 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700802 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700803 time2 = time.time()
804 timeDiff = round( ( time2 - time1 ), 2 )
805 main.log.report(
806 "Time taken for IPv6 Ping All: " +
807 str( timeDiff ) +
808 " seconds" )
809
GlennRC626ba132015-09-18 16:16:31 -0700810 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700811 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
812 else:
813 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
814
815 main.step( "Disable Reactive forwarding" )
816
817 main.log.info( "Uninstall reactive forwarding app" )
818 appCheck = main.TRUE
819 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
820 pool = []
821 for cli in main.CLIs:
822 t = main.Thread( target=cli.appToIDCheck,
823 name="appToIDCheck-" + str( i ),
824 args=[] )
825 pool.append( t )
826 t.start()
827
828 for t in pool:
829 t.join()
830 appCheck = appCheck and t.result
831 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
832 onpass="App Ids seem to be correct",
833 onfail="Something is wrong with app Ids" )
834 if appCheck != main.TRUE:
835 main.log.warn( main.CLIs[0].apps() )
836 main.log.warn( main.CLIs[0].appIDs() )
837
838 # Waiting for reative flows to be cleared.
839 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700840 caseResult = appCheck and cfgResult and pingResult
841 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700842 onpass="Reactive Mode IPv6 Pingall test PASS",
843 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700844
845 def CASE5( self, main ):
846 """
847 Compare current ONOS topology with reference data
848 """
849 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700850
Hari Krishnac195f3b2015-07-08 20:02:24 -0700851 devicesDPIDTemp = []
852 hostMACsTemp = []
853 deviceLinksTemp = []
854 deviceActiveLinksCountTemp = []
855 devicePortsEnabledCountTemp = []
856
857 main.log.report(
858 "Compare ONOS topology with reference data in Stores" )
859 main.log.report( "__________________________________________________" )
860 main.case( "Compare ONOS topology with reference data" )
861
862 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700863
GlennRC289c1b62015-12-12 10:45:43 -0800864 for check in range(main.topoCheck):
865 time1 = time.time()
866 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
867 pool = []
868 for cli in main.CLIs:
869 if i >= main.numMNswitches + 1:
870 break
GlennRC2db29952015-12-14 12:00:29 -0800871 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800872 t = main.Thread(target = cli.getDevicePortsEnabledCount,
873 threadID = main.threadID,
874 name = "getDevicePortsEnabledCount",
875 args = [dpid])
876 t.start()
877 pool.append(t)
878 i = i + 1
879 main.threadID = main.threadID + 1
880 for thread in pool:
881 thread.join()
882 portResult = thread.result
883 #portTemp = re.split( r'\t+', portResult )
884 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
885 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -0700886
GlennRC289c1b62015-12-12 10:45:43 -0800887 time2 = time.time()
888 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
889 main.log.info (
890 "Device Enabled ports EXPECTED: %s" %
891 str( main.devicePortsEnabledCount ) )
892 main.log.info (
893 "Device Enabled ports ACTUAL: %s" %
894 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700895
GlennRC289c1b62015-12-12 10:45:43 -0800896 if ( cmp( main.devicePortsEnabledCount,
897 devicePortsEnabledCountTemp ) == 0 ):
898 stepResult1 = main.TRUE
899 else:
900 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700901
GlennRC289c1b62015-12-12 10:45:43 -0800902 main.step( "Compare Device active links with reference" )
903 time1 = time.time()
904 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
905 pool = []
906 for cli in main.CLIs:
907 if i >= main.numMNswitches + 1:
908 break
GlennRC2db29952015-12-14 12:00:29 -0800909 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
GlennRC289c1b62015-12-12 10:45:43 -0800910 t = main.Thread(target = cli.getDeviceLinksActiveCount,
911 threadID = main.threadID,
912 name = "getDeviceLinksActiveCount",
913 args = [dpid])
914 t.start()
915 pool.append(t)
916 i = i + 1
917 main.threadID = main.threadID + 1
918 for thread in pool:
919 thread.join()
920 linkCountResult = thread.result
921 #linkCountTemp = re.split( r'\t+', linkCountResult )
922 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
923 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700924
GlennRC289c1b62015-12-12 10:45:43 -0800925 time2 = time.time()
926 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
927 main.log.info (
928 "Device Active links EXPECTED: %s" %
929 str( main.deviceActiveLinksCount ) )
930 main.log.info (
931 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
932 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
933 stepResult2 = main.TRUE
934 else:
935 stepResult2 = main.FALSE
936
937 """
938 place holder for comparing devices, hosts, paths and intents if required.
939 Links and ports data would be incorrect with out devices anyways.
940 """
941 caseResult = ( stepResult1 and stepResult2 )
942
943 if caseResult:
944 break
945 else:
946 time.sleep( main.topoCheckDelay )
947 main.log.warn( "Topology check failed. Trying again..." )
948
949
950 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700951 onpass="Compare Topology test PASS",
952 onfail="Compare Topology test FAIL" )
953
954 def CASE60( self ):
955 """
956 Install 300 host intents and verify ping all (Att Topology)
957 """
958 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
959 main.log.report( "_______________________________________" )
960 import itertools
961 import time
962 main.case( "Install 300 host intents" )
963 main.step( "Add host Intents" )
964 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700965 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
966
Hari Krishnac195f3b2015-07-08 20:02:24 -0700967 intentIdList = []
968 time1 = time.time()
969 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
970 pool = []
971 for cli in main.CLIs:
972 if i >= len( hostCombos ):
973 break
974 t = main.Thread( target=cli.addHostIntent,
975 threadID=main.threadID,
976 name="addHostIntent",
977 args=[hostCombos[i][0],hostCombos[i][1]])
978 pool.append(t)
979 t.start()
980 i = i + 1
981 main.threadID = main.threadID + 1
982 for thread in pool:
983 thread.join()
984 intentIdList.append(thread.result)
985 time2 = time.time()
986 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
987
GlennRCfcfdc4f2015-09-30 16:01:57 -0700988 # Saving intent ids to check intents in later cases
989 main.intentIds = list(intentIdList)
990
GlennRCa8d786a2015-09-23 17:40:11 -0700991 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -0700992
GlennRC1dde1712015-10-02 11:03:08 -0700993 # Giving onos multiple chances to install intents
994 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -0700995 if i != 0:
996 main.log.warn( "Verification failed. Retrying..." )
997 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -0700998 time.sleep( main.checkIntentsDelay )
999
1000 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001001 for e in range(int(main.numCtrls)):
1002 main.log.info( "Checking intents on CLI %s" % (e+1) )
1003 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1004 intentState
1005 if not intentState:
1006 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001007 if intentState:
1008 break
GlennRCdb2c8422015-09-29 12:21:59 -07001009 else:
1010 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001011 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001012
GlennRCa8d786a2015-09-23 17:40:11 -07001013
1014 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1015 onpass="INTENTS INSTALLED",
1016 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001017
1018 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001019 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001020 time1 = time.time()
1021 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001022 if not pingResult:
1023 main.log.warn("First pingall failed. Retrying...")
1024 time.sleep(3)
1025 else: break
1026
Hari Krishnac195f3b2015-07-08 20:02:24 -07001027 time2 = time.time()
1028 timeDiff = round( ( time2 - time1 ), 2 )
1029 main.log.report(
1030 "Time taken for Ping All: " +
1031 str( timeDiff ) +
1032 " seconds" )
1033 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1034 onpass="PING ALL PASS",
1035 onfail="PING ALL FAIL" )
1036
GlennRCbddd58f2015-10-01 15:45:25 -07001037 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001038 utilities.assert_equals(
1039 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001040 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001041 onpass="Install 300 Host Intents and Ping All test PASS",
1042 onfail="Install 300 Host Intents and Ping All test FAIL" )
1043
GlennRCfcfdc4f2015-09-30 16:01:57 -07001044 if not intentState:
1045 main.log.debug( "Intents failed to install completely" )
1046 if not pingResult:
1047 main.log.debug( "Pingall failed" )
1048
GlennRCbddd58f2015-10-01 15:45:25 -07001049 if not caseResult and main.failSwitch:
1050 main.log.report("Stopping test")
1051 main.stop( email=main.emailOnStop )
1052
Hari Krishnac195f3b2015-07-08 20:02:24 -07001053 def CASE61( self ):
1054 """
1055 Install 600 host intents and verify ping all for Chordal Topology
1056 """
1057 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1058 main.log.report( "_______________________________________" )
1059 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001060
Hari Krishnac195f3b2015-07-08 20:02:24 -07001061 main.case( "Install 600 host intents" )
1062 main.step( "Add host Intents" )
1063 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001064 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1065
Hari Krishnac195f3b2015-07-08 20:02:24 -07001066 intentIdList = []
1067 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001068
Hari Krishnac195f3b2015-07-08 20:02:24 -07001069 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1070 pool = []
1071 for cli in main.CLIs:
1072 if i >= len( hostCombos ):
1073 break
1074 t = main.Thread( target=cli.addHostIntent,
1075 threadID=main.threadID,
1076 name="addHostIntent",
1077 args=[hostCombos[i][0],hostCombos[i][1]])
1078 pool.append(t)
1079 t.start()
1080 i = i + 1
1081 main.threadID = main.threadID + 1
1082 for thread in pool:
1083 thread.join()
1084 intentIdList.append(thread.result)
1085 time2 = time.time()
1086 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001087
GlennRCfcfdc4f2015-09-30 16:01:57 -07001088 # Saving intent ids to check intents in later cases
1089 main.intentIds = list(intentIdList)
1090
GlennRCa8d786a2015-09-23 17:40:11 -07001091 main.step("Verify intents are installed")
1092
GlennRC1dde1712015-10-02 11:03:08 -07001093 # Giving onos multiple chances to install intents
1094 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001095 if i != 0:
1096 main.log.warn( "Verification failed. Retrying..." )
1097 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001098 time.sleep( main.checkIntentsDelay )
1099
1100 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001101 for e in range(int(main.numCtrls)):
1102 main.log.info( "Checking intents on CLI %s" % (e+1) )
1103 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1104 intentState
1105 if not intentState:
1106 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001107 if intentState:
1108 break
GlennRCdb2c8422015-09-29 12:21:59 -07001109 else:
1110 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001111 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001112
1113 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1114 onpass="INTENTS INSTALLED",
1115 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001116
1117 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001118 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001119 time1 = time.time()
1120 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001121 if not pingResult:
1122 main.log.warn("First pingall failed. Retrying...")
1123 time.sleep(main.pingSleep)
1124 else: break
1125
Hari Krishnac195f3b2015-07-08 20:02:24 -07001126 time2 = time.time()
1127 timeDiff = round( ( time2 - time1 ), 2 )
1128 main.log.report(
1129 "Time taken for Ping All: " +
1130 str( timeDiff ) +
1131 " seconds" )
1132 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1133 onpass="PING ALL PASS",
1134 onfail="PING ALL FAIL" )
1135
GlennRCbddd58f2015-10-01 15:45:25 -07001136 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001137
Hari Krishnac195f3b2015-07-08 20:02:24 -07001138 utilities.assert_equals(
1139 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001140 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001141 onpass="Install 300 Host Intents and Ping All test PASS",
1142 onfail="Install 300 Host Intents and Ping All test FAIL" )
1143
GlennRCfcfdc4f2015-09-30 16:01:57 -07001144 if not intentState:
1145 main.log.debug( "Intents failed to install completely" )
1146 if not pingResult:
1147 main.log.debug( "Pingall failed" )
1148
GlennRCbddd58f2015-10-01 15:45:25 -07001149 if not caseResult and main.failSwitch:
1150 main.log.report("Stopping test")
1151 main.stop( email=main.emailOnStop )
1152
Hari Krishnac195f3b2015-07-08 20:02:24 -07001153 def CASE62( self ):
1154 """
1155 Install 2278 host intents and verify ping all for Spine Topology
1156 """
1157 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1158 main.log.report( "_______________________________________" )
1159 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001160
Hari Krishnac195f3b2015-07-08 20:02:24 -07001161 main.case( "Install 2278 host intents" )
1162 main.step( "Add host Intents" )
1163 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001164 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001165 main.pingTimeout = 300
1166 intentIdList = []
1167 time1 = time.time()
1168 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1169 pool = []
1170 for cli in main.CLIs:
1171 if i >= len( hostCombos ):
1172 break
1173 t = main.Thread( target=cli.addHostIntent,
1174 threadID=main.threadID,
1175 name="addHostIntent",
1176 args=[hostCombos[i][0],hostCombos[i][1]])
1177 pool.append(t)
1178 t.start()
1179 i = i + 1
1180 main.threadID = main.threadID + 1
1181 for thread in pool:
1182 thread.join()
1183 intentIdList.append(thread.result)
1184 time2 = time.time()
1185 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001186
GlennRCfcfdc4f2015-09-30 16:01:57 -07001187 # Saving intent ids to check intents in later cases
1188 main.intentIds = list(intentIdList)
1189
GlennRCa8d786a2015-09-23 17:40:11 -07001190 main.step("Verify intents are installed")
1191
GlennRC1dde1712015-10-02 11:03:08 -07001192 # Giving onos multiple chances to install intents
1193 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001194 if i != 0:
1195 main.log.warn( "Verification failed. Retrying..." )
1196 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001197 time.sleep( main.checkIntentsDelay )
1198
1199 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001200 for e in range(int(main.numCtrls)):
1201 main.log.info( "Checking intents on CLI %s" % (e+1) )
1202 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1203 intentState
1204 if not intentState:
1205 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001206 if intentState:
1207 break
GlennRCdb2c8422015-09-29 12:21:59 -07001208 else:
1209 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001210 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001211
1212 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1213 onpass="INTENTS INSTALLED",
1214 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001215
1216 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001217 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001218 time1 = time.time()
1219 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001220 if not pingResult:
1221 main.log.warn("First pingall failed. Retrying...")
1222 time.sleep(main.pingSleep)
1223 else: break
1224
Hari Krishnac195f3b2015-07-08 20:02:24 -07001225 time2 = time.time()
1226 timeDiff = round( ( time2 - time1 ), 2 )
1227 main.log.report(
1228 "Time taken for Ping All: " +
1229 str( timeDiff ) +
1230 " seconds" )
1231 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1232 onpass="PING ALL PASS",
1233 onfail="PING ALL FAIL" )
1234
GlennRCbddd58f2015-10-01 15:45:25 -07001235 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001236
Hari Krishnac195f3b2015-07-08 20:02:24 -07001237 utilities.assert_equals(
1238 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001239 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001240 onpass="Install 2278 Host Intents and Ping All test PASS",
1241 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1242
GlennRCfcfdc4f2015-09-30 16:01:57 -07001243 if not intentState:
1244 main.log.debug( "Intents failed to install completely" )
1245 if not pingResult:
1246 main.log.debug( "Pingall failed" )
1247
GlennRCbddd58f2015-10-01 15:45:25 -07001248 if not caseResult and main.failSwitch:
1249 main.log.report("Stopping test")
1250 main.stop( email=main.emailOnStop )
1251
Hari Krishna4223dbd2015-08-13 16:29:53 -07001252 def CASE160( self ):
1253 """
1254 Verify IPv6 ping across 300 host intents (Att Topology)
1255 """
1256 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1257 main.log.report( "_________________________________________________" )
1258 import itertools
1259 import time
1260 main.case( "IPv6 ping all 300 host intents" )
1261 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001262 pingResult = main.FALSE
1263 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001264 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001265 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001266 main.log.warn("First pingall failed. Retrying...")
1267 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001268 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001269 time2 = time.time()
1270 timeDiff = round( ( time2 - time1 ), 2 )
1271 main.log.report(
1272 "Time taken for IPv6 Ping All: " +
1273 str( timeDiff ) +
1274 " seconds" )
1275 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1276 onpass="PING ALL PASS",
1277 onfail="PING ALL FAIL" )
1278
GlennRCbddd58f2015-10-01 15:45:25 -07001279 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001280 utilities.assert_equals(
1281 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001282 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001283 onpass="IPv6 Ping across 300 host intents test PASS",
1284 onfail="IPv6 Ping across 300 host intents test FAIL" )
1285
1286 def CASE161( self ):
1287 """
1288 Verify IPv6 ping across 600 host intents (Chordal Topology)
1289 """
1290 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1291 main.log.report( "_________________________________________________" )
1292 import itertools
1293 import time
1294 main.case( "IPv6 ping all 600 host intents" )
1295 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001296 pingResult = main.FALSE
1297 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001298 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001299 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001300 main.log.warn("First pingall failed. Retrying...")
1301 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001302 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001303 time2 = time.time()
1304 timeDiff = round( ( time2 - time1 ), 2 )
1305 main.log.report(
1306 "Time taken for IPv6 Ping All: " +
1307 str( timeDiff ) +
1308 " seconds" )
1309 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1310 onpass="PING ALL PASS",
1311 onfail="PING ALL FAIL" )
1312
GlennRCbddd58f2015-10-01 15:45:25 -07001313 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001314 utilities.assert_equals(
1315 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001316 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001317 onpass="IPv6 Ping across 600 host intents test PASS",
1318 onfail="IPv6 Ping across 600 host intents test FAIL" )
1319
1320 def CASE162( self ):
1321 """
1322 Verify IPv6 ping across 2278 host intents (Spine Topology)
1323 """
1324 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1325 main.log.report( "_________________________________________________" )
1326 import itertools
1327 import time
1328 main.case( "IPv6 ping all 600 host intents" )
1329 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001330 pingResult = main.FALSE
1331 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001332 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001333 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001334 main.log.warn("First pingall failed. Retrying...")
1335 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001336 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001337 time2 = time.time()
1338 timeDiff = round( ( time2 - time1 ), 2 )
1339 main.log.report(
1340 "Time taken for IPv6 Ping All: " +
1341 str( timeDiff ) +
1342 " seconds" )
1343 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1344 onpass="PING ALL PASS",
1345 onfail="PING ALL FAIL" )
1346
GlennRCbddd58f2015-10-01 15:45:25 -07001347 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001348 utilities.assert_equals(
1349 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001350 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001351 onpass="IPv6 Ping across 600 host intents test PASS",
1352 onfail="IPv6 Ping across 600 host intents test FAIL" )
1353
Hari Krishnac195f3b2015-07-08 20:02:24 -07001354 def CASE70( self, main ):
1355 """
1356 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1357 """
1358 import random
1359 main.randomLink1 = []
1360 main.randomLink2 = []
1361 main.randomLink3 = []
1362 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1363 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1364 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1365 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1366 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1367 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1368 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1369 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1370
1371 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1372 main.log.report( "___________________________________________________________________________" )
1373 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1374 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1375 if ( int( switchLinksToToggle ) ==
1376 0 or int( switchLinksToToggle ) > 5 ):
1377 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1378 #main.cleanup()
1379 #main.exit()
1380 else:
1381 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1382
1383 main.step( "Cut links on Core devices using user provided range" )
1384 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1385 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1386 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1387 for i in range( int( switchLinksToToggle ) ):
1388 main.Mininet1.link(
1389 END1=link1End1,
1390 END2=main.randomLink1[ i ],
1391 OPTION="down" )
1392 time.sleep( link_sleep )
1393 main.Mininet1.link(
1394 END1=link2End1,
1395 END2=main.randomLink2[ i ],
1396 OPTION="down" )
1397 time.sleep( link_sleep )
1398 main.Mininet1.link(
1399 END1=link3End1,
1400 END2=main.randomLink3[ i ],
1401 OPTION="down" )
1402 time.sleep( link_sleep )
1403
Hari Krishna6185fc12015-07-13 15:42:31 -07001404 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001405 linkDown = main.ONOSbench.checkStatus(
1406 topology_output, main.numMNswitches, str(
1407 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1408 utilities.assert_equals(
1409 expect=main.TRUE,
1410 actual=linkDown,
1411 onpass="Link Down discovered properly",
1412 onfail="Link down was not discovered in " +
1413 str( link_sleep ) +
1414 " seconds" )
1415
GlennRCfcfdc4f2015-09-30 16:01:57 -07001416 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001417 # Giving onos multiple chances to install intents
1418 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001419 if i != 0:
1420 main.log.warn( "Verification failed. Retrying..." )
1421 main.log.info("Giving onos some time...")
1422 time.sleep( main.checkIntentsDelay )
1423
1424 intentState = main.TRUE
1425 for e in range(int(main.numCtrls)):
1426 main.log.info( "Checking intents on CLI %s" % (e+1) )
1427 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1428 intentState
1429 if not intentState:
1430 main.log.warn( "Not all intents installed" )
1431 if intentState:
1432 break
1433 else:
1434 #Dumping intent summary
1435 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1436
1437
1438 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1439 onpass="INTENTS INSTALLED",
1440 onfail="SOME INTENTS NOT INSTALLED" )
1441
Hari Krishnac195f3b2015-07-08 20:02:24 -07001442 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001443 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001444 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001445 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1446 if not pingResult:
1447 main.log.warn("First pingall failed. Retrying...")
1448 time.sleep(main.pingSleep)
1449 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001450
Hari Krishnac195f3b2015-07-08 20:02:24 -07001451 time2 = time.time()
1452 timeDiff = round( ( time2 - time1 ), 2 )
1453 main.log.report(
1454 "Time taken for Ping All: " +
1455 str( timeDiff ) +
1456 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001457 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001458 onpass="PING ALL PASS",
1459 onfail="PING ALL FAIL" )
1460
GlennRCbddd58f2015-10-01 15:45:25 -07001461 caseResult = linkDown and pingResult and intentState
1462 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001463 onpass="Random Link cut Test PASS",
1464 onfail="Random Link cut Test FAIL" )
1465
GlennRCfcfdc4f2015-09-30 16:01:57 -07001466 # Printing what exactly failed
1467 if not linkDown:
1468 main.log.debug( "Link down was not discovered correctly" )
1469 if not pingResult:
1470 main.log.debug( "Pingall failed" )
1471 if not intentState:
1472 main.log.debug( "Intents are not all installed" )
1473
GlennRCbddd58f2015-10-01 15:45:25 -07001474 if not caseResult and main.failSwitch:
1475 main.log.report("Stopping test")
1476 main.stop( email=main.emailOnStop )
1477
Hari Krishnac195f3b2015-07-08 20:02:24 -07001478 def CASE80( self, main ):
1479 """
1480 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1481 """
1482 import random
1483 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1484 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1485 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1486 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1487 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1488
1489 main.log.report(
1490 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1491 main.log.report(
1492 "__________________________________________________________________" )
1493 main.case(
1494 "Host intents - Bring the core links up that are down and verify ping all" )
1495 main.step( "Bring randomly cut links on Core devices up" )
1496 for i in range( int( switchLinksToToggle ) ):
1497 main.Mininet1.link(
1498 END1=link1End1,
1499 END2=main.randomLink1[ i ],
1500 OPTION="up" )
1501 time.sleep( link_sleep )
1502 main.Mininet1.link(
1503 END1=link2End1,
1504 END2=main.randomLink2[ i ],
1505 OPTION="up" )
1506 time.sleep( link_sleep )
1507 main.Mininet1.link(
1508 END1=link3End1,
1509 END2=main.randomLink3[ i ],
1510 OPTION="up" )
1511 time.sleep( link_sleep )
1512
Hari Krishna6185fc12015-07-13 15:42:31 -07001513 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001514 linkUp = main.ONOSbench.checkStatus(
1515 topology_output,
1516 main.numMNswitches,
1517 str( main.numMNlinks ) )
1518 utilities.assert_equals(
1519 expect=main.TRUE,
1520 actual=linkUp,
1521 onpass="Link up discovered properly",
1522 onfail="Link up was not discovered in " +
1523 str( link_sleep ) +
1524 " seconds" )
1525
GlennRCfcfdc4f2015-09-30 16:01:57 -07001526 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001527 # Giving onos multiple chances to install intents
1528 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001529 if i != 0:
1530 main.log.warn( "Verification failed. Retrying..." )
1531 main.log.info("Giving onos some time...")
1532 time.sleep( main.checkIntentsDelay )
1533
1534 intentState = main.TRUE
1535 for e in range(int(main.numCtrls)):
1536 main.log.info( "Checking intents on CLI %s" % (e+1) )
1537 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1538 intentState
1539 if not intentState:
1540 main.log.warn( "Not all intents installed" )
1541 if intentState:
1542 break
1543 else:
1544 #Dumping intent summary
1545 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1546
1547
1548 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1549 onpass="INTENTS INSTALLED",
1550 onfail="SOME INTENTS NOT INSTALLED" )
1551
Hari Krishnac195f3b2015-07-08 20:02:24 -07001552 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001553 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001554 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001555 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1556 if not pingResult:
1557 main.log.warn("First pingall failed. Retrying...")
1558 time.sleep(main.pingSleep)
1559 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001560
Hari Krishnac195f3b2015-07-08 20:02:24 -07001561 time2 = time.time()
1562 timeDiff = round( ( time2 - time1 ), 2 )
1563 main.log.report(
1564 "Time taken for Ping All: " +
1565 str( timeDiff ) +
1566 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001567 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001568 onpass="PING ALL PASS",
1569 onfail="PING ALL FAIL" )
1570
GlennRCbddd58f2015-10-01 15:45:25 -07001571 caseResult = linkUp and pingResult
1572 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001573 onpass="Link Up Test PASS",
1574 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001575 # Printing what exactly failed
1576 if not linkUp:
1577 main.log.debug( "Link down was not discovered correctly" )
1578 if not pingResult:
1579 main.log.debug( "Pingall failed" )
1580 if not intentState:
1581 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001582
GlennRCbddd58f2015-10-01 15:45:25 -07001583 if not caseResult and main.failSwitch:
1584 main.log.report("Stopping test")
1585 main.stop( email=main.emailOnStop )
1586
Hari Krishnac195f3b2015-07-08 20:02:24 -07001587 def CASE71( self, main ):
1588 """
1589 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1590 """
1591 import random
1592 main.randomLink1 = []
1593 main.randomLink2 = []
1594 main.randomLink3 = []
1595 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1596 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1597 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1598 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1599 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1600 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1601 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1602 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1603
1604 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1605 main.log.report( "___________________________________________________________________________" )
1606 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1607 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1608 if ( int( switchLinksToToggle ) ==
1609 0 or int( switchLinksToToggle ) > 5 ):
1610 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1611 #main.cleanup()
1612 #main.exit()
1613 else:
1614 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1615
1616 main.step( "Cut links on Core devices using user provided range" )
1617 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1618 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1619 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1620 for i in range( int( switchLinksToToggle ) ):
1621 main.Mininet1.link(
1622 END1=link1End1,
1623 END2=main.randomLink1[ i ],
1624 OPTION="down" )
1625 time.sleep( link_sleep )
1626 main.Mininet1.link(
1627 END1=link2End1,
1628 END2=main.randomLink2[ i ],
1629 OPTION="down" )
1630 time.sleep( link_sleep )
1631 main.Mininet1.link(
1632 END1=link3End1,
1633 END2=main.randomLink3[ i ],
1634 OPTION="down" )
1635 time.sleep( link_sleep )
1636
Hari Krishna6185fc12015-07-13 15:42:31 -07001637 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001638 linkDown = main.ONOSbench.checkStatus(
1639 topology_output, main.numMNswitches, str(
1640 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1641 utilities.assert_equals(
1642 expect=main.TRUE,
1643 actual=linkDown,
1644 onpass="Link Down discovered properly",
1645 onfail="Link down was not discovered in " +
1646 str( link_sleep ) +
1647 " seconds" )
1648
GlennRCfcfdc4f2015-09-30 16:01:57 -07001649 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001650 # Giving onos multiple chances to install intents
1651 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001652 if i != 0:
1653 main.log.warn( "Verification failed. Retrying..." )
1654 main.log.info("Giving onos some time...")
1655 time.sleep( main.checkIntentsDelay )
1656
1657 intentState = main.TRUE
1658 for e in range(int(main.numCtrls)):
1659 main.log.info( "Checking intents on CLI %s" % (e+1) )
1660 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1661 intentState
1662 if not intentState:
1663 main.log.warn( "Not all intents installed" )
1664 if intentState:
1665 break
1666 else:
1667 #Dumping intent summary
1668 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1669
1670
1671 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1672 onpass="INTENTS INSTALLED",
1673 onfail="SOME INTENTS NOT INSTALLED" )
1674
Hari Krishnac195f3b2015-07-08 20:02:24 -07001675 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001676 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001677 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001678 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1679 if not pingResult:
1680 main.log.warn("First pingall failed. Retrying...")
1681 time.sleep(main.pingSleep)
1682 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001683
Hari Krishnac195f3b2015-07-08 20:02:24 -07001684 time2 = time.time()
1685 timeDiff = round( ( time2 - time1 ), 2 )
1686 main.log.report(
1687 "Time taken for Ping All: " +
1688 str( timeDiff ) +
1689 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001690 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001691 onpass="PING ALL PASS",
1692 onfail="PING ALL FAIL" )
1693
GlennRCbddd58f2015-10-01 15:45:25 -07001694 caseResult = linkDown and pingResult and intentState
1695 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001696 onpass="Random Link cut Test PASS",
1697 onfail="Random Link cut Test FAIL" )
1698
GlennRCfcfdc4f2015-09-30 16:01:57 -07001699 # Printing what exactly failed
1700 if not linkDown:
1701 main.log.debug( "Link down was not discovered correctly" )
1702 if not pingResult:
1703 main.log.debug( "Pingall failed" )
1704 if not intentState:
1705 main.log.debug( "Intents are not all installed" )
1706
GlennRCbddd58f2015-10-01 15:45:25 -07001707 if not caseResult and main.failSwitch:
1708 main.log.report("Stopping test")
1709 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001710
Hari Krishnac195f3b2015-07-08 20:02:24 -07001711 def CASE81( self, main ):
1712 """
1713 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1714 """
1715 import random
1716 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1717 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1718 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1719 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1720 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1721
1722 main.log.report(
1723 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1724 main.log.report(
1725 "__________________________________________________________________" )
1726 main.case(
1727 "Point intents - Bring the core links up that are down and verify ping all" )
1728 main.step( "Bring randomly cut links on Core devices up" )
1729 for i in range( int( switchLinksToToggle ) ):
1730 main.Mininet1.link(
1731 END1=link1End1,
1732 END2=main.randomLink1[ i ],
1733 OPTION="up" )
1734 time.sleep( link_sleep )
1735 main.Mininet1.link(
1736 END1=link2End1,
1737 END2=main.randomLink2[ i ],
1738 OPTION="up" )
1739 time.sleep( link_sleep )
1740 main.Mininet1.link(
1741 END1=link3End1,
1742 END2=main.randomLink3[ i ],
1743 OPTION="up" )
1744 time.sleep( link_sleep )
1745
Hari Krishna6185fc12015-07-13 15:42:31 -07001746 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001747 linkUp = main.ONOSbench.checkStatus(
1748 topology_output,
1749 main.numMNswitches,
1750 str( main.numMNlinks ) )
1751 utilities.assert_equals(
1752 expect=main.TRUE,
1753 actual=linkUp,
1754 onpass="Link up discovered properly",
1755 onfail="Link up was not discovered in " +
1756 str( link_sleep ) +
1757 " seconds" )
1758
GlennRCfcfdc4f2015-09-30 16:01:57 -07001759 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001760 # Giving onos multiple chances to install intents
1761 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001762 if i != 0:
1763 main.log.warn( "Verification failed. Retrying..." )
1764 main.log.info("Giving onos some time...")
1765 time.sleep( main.checkIntentsDelay )
1766
1767 intentState = main.TRUE
1768 for e in range(int(main.numCtrls)):
1769 main.log.info( "Checking intents on CLI %s" % (e+1) )
1770 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1771 intentState
1772 if not intentState:
1773 main.log.warn( "Not all intents installed" )
1774 if intentState:
1775 break
1776 else:
1777 #Dumping intent summary
1778 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1779
1780
1781 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1782 onpass="INTENTS INSTALLED",
1783 onfail="SOME INTENTS NOT INSTALLED" )
1784
Hari Krishnac195f3b2015-07-08 20:02:24 -07001785 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001786 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001787 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001788 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1789 if not pingResult:
1790 main.log.warn("First pingall failed. Retrying...")
1791 time.sleep(main.pingSleep)
1792 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001793
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 time2 = time.time()
1795 timeDiff = round( ( time2 - time1 ), 2 )
1796 main.log.report(
1797 "Time taken for Ping All: " +
1798 str( timeDiff ) +
1799 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001800 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001801 onpass="PING ALL PASS",
1802 onfail="PING ALL FAIL" )
1803
GlennRCbddd58f2015-10-01 15:45:25 -07001804 caseResult = linkUp and pingResult
1805 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001806 onpass="Link Up Test PASS",
1807 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001808 # Printing what exactly failed
1809 if not linkUp:
1810 main.log.debug( "Link down was not discovered correctly" )
1811 if not pingResult:
1812 main.log.debug( "Pingall failed" )
1813 if not intentState:
1814 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001815
GlennRCbddd58f2015-10-01 15:45:25 -07001816 if not caseResult and main.failSwitch:
1817 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001818 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001819
Hari Krishnac195f3b2015-07-08 20:02:24 -07001820 def CASE72( self, main ):
1821 """
1822 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1823 """
1824 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001825 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001826 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001827
Hari Krishnac195f3b2015-07-08 20:02:24 -07001828 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1829 main.log.report( "___________________________________________________________________________" )
1830 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1831 switches = []
1832 switchesComb = []
1833 for i in range( main.numMNswitches ):
1834 switches.append('s%d'%(i+1))
1835 switchesLinksComb = list(itertools.combinations(switches,2))
1836 main.randomLinks = random.sample(switchesLinksComb, 5 )
1837 print main.randomLinks
1838 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001839
Hari Krishnac195f3b2015-07-08 20:02:24 -07001840 for switch in main.randomLinks:
1841 main.Mininet1.link(
1842 END1=switch[0],
1843 END2=switch[1],
1844 OPTION="down")
1845 time.sleep( link_sleep )
1846
Hari Krishna6185fc12015-07-13 15:42:31 -07001847 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001848 linkDown = main.ONOSbench.checkStatus(
1849 topology_output, main.numMNswitches, str(
1850 int( main.numMNlinks ) - 5 * 2 ) )
1851 utilities.assert_equals(
1852 expect=main.TRUE,
1853 actual=linkDown,
1854 onpass="Link Down discovered properly",
1855 onfail="Link down was not discovered in " +
1856 str( link_sleep ) +
1857 " seconds" )
1858
GlennRCfcfdc4f2015-09-30 16:01:57 -07001859 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001860 # Giving onos multiple chances to install intents
1861 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001862 if i != 0:
1863 main.log.warn( "Verification failed. Retrying..." )
1864 main.log.info("Giving onos some time...")
1865 time.sleep( main.checkIntentsDelay )
1866
1867 intentState = main.TRUE
1868 for e in range(int(main.numCtrls)):
1869 main.log.info( "Checking intents on CLI %s" % (e+1) )
1870 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1871 intentState
1872 if not intentState:
1873 main.log.warn( "Not all intents installed" )
1874 if intentState:
1875 break
1876 else:
1877 #Dumping intent summary
1878 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1879
1880
1881 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1882 onpass="INTENTS INSTALLED",
1883 onfail="SOME INTENTS NOT INSTALLED" )
1884
Hari Krishnac195f3b2015-07-08 20:02:24 -07001885 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001886 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001887 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001888 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1889 if not pingResult:
1890 main.log.warn("First pingall failed. Retrying...")
1891 time.sleep(main.pingSleep)
1892 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001893
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894 time2 = time.time()
1895 timeDiff = round( ( time2 - time1 ), 2 )
1896 main.log.report(
1897 "Time taken for Ping All: " +
1898 str( timeDiff ) +
1899 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001900 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001901 onpass="PING ALL PASS",
1902 onfail="PING ALL FAIL" )
1903
GlennRCbddd58f2015-10-01 15:45:25 -07001904 caseResult = linkDown and pingResult and intentState
1905 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001906 onpass="Random Link cut Test PASS",
1907 onfail="Random Link cut Test FAIL" )
1908
GlennRCfcfdc4f2015-09-30 16:01:57 -07001909 # Printing what exactly failed
1910 if not linkDown:
1911 main.log.debug( "Link down was not discovered correctly" )
1912 if not pingResult:
1913 main.log.debug( "Pingall failed" )
1914 if not intentState:
1915 main.log.debug( "Intents are not all installed" )
1916
GlennRCbddd58f2015-10-01 15:45:25 -07001917 if not caseResult and main.failSwitch:
1918 main.log.report("Stopping test")
1919 main.stop( email=main.emailOnStop )
1920
Hari Krishnac195f3b2015-07-08 20:02:24 -07001921 def CASE82( self, main ):
1922 """
1923 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1924 """
1925 import random
1926 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001927
Hari Krishnac195f3b2015-07-08 20:02:24 -07001928 main.log.report(
1929 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1930 main.log.report(
1931 "__________________________________________________________________" )
1932 main.case(
1933 "Host intents - Bring the core links up that are down and verify ping all" )
1934 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001935
Hari Krishnac195f3b2015-07-08 20:02:24 -07001936 for switch in main.randomLinks:
1937 main.Mininet1.link(
1938 END1=switch[0],
1939 END2=switch[1],
1940 OPTION="up")
1941 time.sleep( link_sleep )
1942
Hari Krishna6185fc12015-07-13 15:42:31 -07001943 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001944 linkUp = main.ONOSbench.checkStatus(
1945 topology_output,
1946 main.numMNswitches,
1947 str( main.numMNlinks ) )
1948 utilities.assert_equals(
1949 expect=main.TRUE,
1950 actual=linkUp,
1951 onpass="Link up discovered properly",
1952 onfail="Link up was not discovered in " +
1953 str( link_sleep ) +
1954 " seconds" )
1955
GlennRCfcfdc4f2015-09-30 16:01:57 -07001956 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001957 # Giving onos multiple chances to install intents
1958 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001959 if i != 0:
1960 main.log.warn( "Verification failed. Retrying..." )
1961 main.log.info("Giving onos some time...")
1962 time.sleep( main.checkIntentsDelay )
1963
1964 intentState = main.TRUE
1965 for e in range(int(main.numCtrls)):
1966 main.log.info( "Checking intents on CLI %s" % (e+1) )
1967 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1968 intentState
1969 if not intentState:
1970 main.log.warn( "Not all intents installed" )
1971 if intentState:
1972 break
1973 else:
1974 #Dumping intent summary
1975 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1976
1977
1978 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1979 onpass="INTENTS INSTALLED",
1980 onfail="SOME INTENTS NOT INSTALLED" )
1981
Hari Krishnac195f3b2015-07-08 20:02:24 -07001982 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001983 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001984 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001985 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1986 if not pingResult:
1987 main.log.warn("First pingall failed. Retrying...")
1988 time.sleep(main.pingSleep)
1989 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001990
Hari Krishnac195f3b2015-07-08 20:02:24 -07001991 time2 = time.time()
1992 timeDiff = round( ( time2 - time1 ), 2 )
1993 main.log.report(
1994 "Time taken for Ping All: " +
1995 str( timeDiff ) +
1996 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001997 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001998 onpass="PING ALL PASS",
1999 onfail="PING ALL FAIL" )
2000
GlennRCbddd58f2015-10-01 15:45:25 -07002001 caseResult = linkUp and pingResult
2002 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002003 onpass="Link Up Test PASS",
2004 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002005 # Printing what exactly failed
2006 if not linkUp:
2007 main.log.debug( "Link down was not discovered correctly" )
2008 if not pingResult:
2009 main.log.debug( "Pingall failed" )
2010 if not intentState:
2011 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002012
GlennRCbddd58f2015-10-01 15:45:25 -07002013 if not caseResult and main.failSwitch:
2014 main.log.report("Stopping test")
2015 main.stop( email=main.emailOnStop )
2016
Hari Krishnac195f3b2015-07-08 20:02:24 -07002017 def CASE73( self, main ):
2018 """
2019 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2020 """
2021 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002022 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002023 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002024
Hari Krishnac195f3b2015-07-08 20:02:24 -07002025 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2026 main.log.report( "___________________________________________________________________________" )
2027 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2028 switches = []
2029 switchesComb = []
2030 for i in range( main.numMNswitches ):
2031 switches.append('s%d'%(i+1))
2032 switchesLinksComb = list(itertools.combinations(switches,2))
2033 main.randomLinks = random.sample(switchesLinksComb, 5 )
2034 print main.randomLinks
2035 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002036
Hari Krishnac195f3b2015-07-08 20:02:24 -07002037 for switch in main.randomLinks:
2038 main.Mininet1.link(
2039 END1=switch[0],
2040 END2=switch[1],
2041 OPTION="down")
2042 time.sleep( link_sleep )
2043
Hari Krishna6185fc12015-07-13 15:42:31 -07002044 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002045 linkDown = main.ONOSbench.checkStatus(
2046 topology_output, main.numMNswitches, str(
2047 int( main.numMNlinks ) - 5 * 2 ) )
2048 utilities.assert_equals(
2049 expect=main.TRUE,
2050 actual=linkDown,
2051 onpass="Link Down discovered properly",
2052 onfail="Link down was not discovered in " +
2053 str( link_sleep ) +
2054 " seconds" )
2055
GlennRCfcfdc4f2015-09-30 16:01:57 -07002056 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002057 # Giving onos multiple chances to install intents
2058 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002059 if i != 0:
2060 main.log.warn( "Verification failed. Retrying..." )
2061 main.log.info("Giving onos some time...")
2062 time.sleep( main.checkIntentsDelay )
2063
2064 intentState = main.TRUE
2065 for e in range(int(main.numCtrls)):
2066 main.log.info( "Checking intents on CLI %s" % (e+1) )
2067 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2068 intentState
2069 if not intentState:
2070 main.log.warn( "Not all intents installed" )
2071 if intentState:
2072 break
2073 else:
2074 #Dumping intent summary
2075 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2076
2077
2078 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2079 onpass="INTENTS INSTALLED",
2080 onfail="SOME INTENTS NOT INSTALLED" )
2081
Hari Krishnac195f3b2015-07-08 20:02:24 -07002082 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002083 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002084 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002085 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2086 if not pingResult:
2087 main.log.warn("First pingall failed. Retrying...")
2088 time.sleep(main.pingSleep)
2089 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002090
Hari Krishnac195f3b2015-07-08 20:02:24 -07002091 time2 = time.time()
2092 timeDiff = round( ( time2 - time1 ), 2 )
2093 main.log.report(
2094 "Time taken for Ping All: " +
2095 str( timeDiff ) +
2096 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002097 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002098 onpass="PING ALL PASS",
2099 onfail="PING ALL FAIL" )
2100
GlennRCbddd58f2015-10-01 15:45:25 -07002101 caseResult = linkDown and pingResult and intentState
2102 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002103 onpass="Random Link cut Test PASS",
2104 onfail="Random Link cut Test FAIL" )
2105
GlennRCfcfdc4f2015-09-30 16:01:57 -07002106 # Printing what exactly failed
2107 if not linkDown:
2108 main.log.debug( "Link down was not discovered correctly" )
2109 if not pingResult:
2110 main.log.debug( "Pingall failed" )
2111 if not intentState:
2112 main.log.debug( "Intents are not all installed" )
2113
GlennRCbddd58f2015-10-01 15:45:25 -07002114 if not caseResult and main.failSwitch:
2115 main.log.report("Stopping test")
2116 main.stop( email=main.emailOnStop )
2117
Hari Krishnac195f3b2015-07-08 20:02:24 -07002118 def CASE83( self, main ):
2119 """
2120 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2121 """
2122 import random
2123 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002124
Hari Krishnac195f3b2015-07-08 20:02:24 -07002125 main.log.report(
2126 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2127 main.log.report(
2128 "__________________________________________________________________" )
2129 main.case(
2130 "Point intents - Bring the core links up that are down and verify ping all" )
2131 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002132
Hari Krishnac195f3b2015-07-08 20:02:24 -07002133 for switch in main.randomLinks:
2134 main.Mininet1.link(
2135 END1=switch[0],
2136 END2=switch[1],
2137 OPTION="up")
2138 time.sleep( link_sleep )
2139
Hari Krishna6185fc12015-07-13 15:42:31 -07002140 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002141 linkUp = main.ONOSbench.checkStatus(
2142 topology_output,
2143 main.numMNswitches,
2144 str( main.numMNlinks ) )
2145 utilities.assert_equals(
2146 expect=main.TRUE,
2147 actual=linkUp,
2148 onpass="Link up discovered properly",
2149 onfail="Link up was not discovered in " +
2150 str( link_sleep ) +
2151 " seconds" )
2152
GlennRCfcfdc4f2015-09-30 16:01:57 -07002153 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002154 # Giving onos multiple chances to install intents
2155 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002156 if i != 0:
2157 main.log.warn( "Verification failed. Retrying..." )
2158 main.log.info("Giving onos some time...")
2159 time.sleep( main.checkIntentsDelay )
2160
2161 intentState = main.TRUE
2162 for e in range(int(main.numCtrls)):
2163 main.log.info( "Checking intents on CLI %s" % (e+1) )
2164 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2165 intentState
2166 if not intentState:
2167 main.log.warn( "Not all intents installed" )
2168 if intentState:
2169 break
2170 else:
2171 #Dumping intent summary
2172 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2173
2174
2175 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2176 onpass="INTENTS INSTALLED",
2177 onfail="SOME INTENTS NOT INSTALLED" )
2178
Hari Krishnac195f3b2015-07-08 20:02:24 -07002179 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002180 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002181 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002182 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2183 if not pingResult:
2184 main.log.warn("First pingall failed. Retrying...")
2185 time.sleep(main.pingSleep)
2186 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002187
Hari Krishnac195f3b2015-07-08 20:02:24 -07002188 time2 = time.time()
2189 timeDiff = round( ( time2 - time1 ), 2 )
2190 main.log.report(
2191 "Time taken for Ping All: " +
2192 str( timeDiff ) +
2193 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002194 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002195 onpass="PING ALL PASS",
2196 onfail="PING ALL FAIL" )
2197
GlennRCbddd58f2015-10-01 15:45:25 -07002198 caseResult = linkUp and pingResult
2199 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002200 onpass="Link Up Test PASS",
2201 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002202 # Printing what exactly failed
2203 if not linkUp:
2204 main.log.debug( "Link down was not discovered correctly" )
2205 if not pingResult:
2206 main.log.debug( "Pingall failed" )
2207 if not intentState:
2208 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002209
GlennRCbddd58f2015-10-01 15:45:25 -07002210 if not caseResult and main.failSwitch:
2211 main.log.report("Stopping test")
2212 main.stop( email=main.emailOnStop )
2213
Hari Krishnac195f3b2015-07-08 20:02:24 -07002214 def CASE74( self, main ):
2215 """
2216 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2217 """
2218 import random
2219 main.randomLink1 = []
2220 main.randomLink2 = []
2221 main.randomLink3 = []
2222 main.randomLink4 = []
2223 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2224 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2225 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2226 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2227 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2228 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2229 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002230
Hari Krishnac195f3b2015-07-08 20:02:24 -07002231 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2232 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002233 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002234 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002235 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002236 linkIndex.remove(linkIndexS9)
2237 linkIndexS10 = random.sample(linkIndex,1)[0]
2238 main.randomLink1 = link1End2top[linkIndexS9]
2239 main.randomLink2 = link2End2top[linkIndexS10]
2240 main.randomLink3 = random.sample(link1End2bot,1)[0]
2241 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002242
2243 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002244 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2245 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2246 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2247 time.sleep( link_sleep )
2248 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2249 time.sleep( link_sleep )
2250
Hari Krishna6185fc12015-07-13 15:42:31 -07002251 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002252 linkDown = main.ONOSbench.checkStatus(
2253 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002254 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002255 utilities.assert_equals(
2256 expect=main.TRUE,
2257 actual=linkDown,
2258 onpass="Link Down discovered properly",
2259 onfail="Link down was not discovered in " +
2260 str( link_sleep ) +
2261 " seconds" )
2262
GlennRCfcfdc4f2015-09-30 16:01:57 -07002263 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002264 # Giving onos multiple chances to install intents
2265 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002266 if i != 0:
2267 main.log.warn( "Verification failed. Retrying..." )
2268 main.log.info("Giving onos some time...")
2269 time.sleep( main.checkIntentsDelay )
2270
2271 intentState = main.TRUE
2272 for e in range(int(main.numCtrls)):
2273 main.log.info( "Checking intents on CLI %s" % (e+1) )
2274 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2275 intentState
2276 if not intentState:
2277 main.log.warn( "Not all intents installed" )
2278 if intentState:
2279 break
2280 else:
2281 #Dumping intent summary
2282 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2283
2284
2285 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2286 onpass="INTENTS INSTALLED",
2287 onfail="SOME INTENTS NOT INSTALLED" )
2288
Hari Krishnac195f3b2015-07-08 20:02:24 -07002289 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002290 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002291 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002292 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2293 if not pingResult:
2294 main.log.warn("First pingall failed. Retrying...")
2295 time.sleep(main.pingSleep)
2296 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002297
Hari Krishnac195f3b2015-07-08 20:02:24 -07002298 time2 = time.time()
2299 timeDiff = round( ( time2 - time1 ), 2 )
2300 main.log.report(
2301 "Time taken for Ping All: " +
2302 str( timeDiff ) +
2303 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002304 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002305 onpass="PING ALL PASS",
2306 onfail="PING ALL FAIL" )
2307
GlennRCbddd58f2015-10-01 15:45:25 -07002308 caseResult = linkDown and pingResult and intentState
2309 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002310 onpass="Random Link cut Test PASS",
2311 onfail="Random Link cut Test FAIL" )
2312
GlennRCfcfdc4f2015-09-30 16:01:57 -07002313 # Printing what exactly failed
2314 if not linkDown:
2315 main.log.debug( "Link down was not discovered correctly" )
2316 if not pingResult:
2317 main.log.debug( "Pingall failed" )
2318 if not intentState:
2319 main.log.debug( "Intents are not all installed" )
2320
GlennRCbddd58f2015-10-01 15:45:25 -07002321 if not caseResult and main.failSwitch:
2322 main.log.report("Stopping test")
2323 main.stop( email=main.emailOnStop )
2324
Hari Krishnac195f3b2015-07-08 20:02:24 -07002325 def CASE84( self, main ):
2326 """
2327 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2328 """
2329 import random
2330 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2331 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2332 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2333 main.log.report(
2334 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2335 main.log.report(
2336 "__________________________________________________________________" )
2337 main.case(
2338 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002339
2340 # Work around for link state propagation delay. Added some sleep time.
2341 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2342 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002343 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2344 time.sleep( link_sleep )
2345 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2346 time.sleep( link_sleep )
2347
Hari Krishna6185fc12015-07-13 15:42:31 -07002348 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002349 linkUp = main.ONOSbench.checkStatus(
2350 topology_output,
2351 main.numMNswitches,
2352 str( main.numMNlinks ) )
2353 utilities.assert_equals(
2354 expect=main.TRUE,
2355 actual=linkUp,
2356 onpass="Link up discovered properly",
2357 onfail="Link up was not discovered in " +
2358 str( link_sleep ) +
2359 " seconds" )
2360
GlennRCfcfdc4f2015-09-30 16:01:57 -07002361 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002362 # Giving onos multiple chances to install intents
2363 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002364 if i != 0:
2365 main.log.warn( "Verification failed. Retrying..." )
2366 main.log.info("Giving onos some time...")
2367 time.sleep( main.checkIntentsDelay )
2368
2369 intentState = main.TRUE
2370 for e in range(int(main.numCtrls)):
2371 main.log.info( "Checking intents on CLI %s" % (e+1) )
2372 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2373 intentState
2374 if not intentState:
2375 main.log.warn( "Not all intents installed" )
2376 if intentState:
2377 break
2378 else:
2379 #Dumping intent summary
2380 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2381
2382
2383 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2384 onpass="INTENTS INSTALLED",
2385 onfail="SOME INTENTS NOT INSTALLED" )
2386
Hari Krishnac195f3b2015-07-08 20:02:24 -07002387 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002388 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002389 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002390 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2391 if not pingResult:
2392 main.log.warn("First pingall failed. Retrying...")
2393 time.sleep(main.pingSleep)
2394 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002395
Hari Krishnac195f3b2015-07-08 20:02:24 -07002396 time2 = time.time()
2397 timeDiff = round( ( time2 - time1 ), 2 )
2398 main.log.report(
2399 "Time taken for Ping All: " +
2400 str( timeDiff ) +
2401 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002402 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002403 onpass="PING ALL PASS",
2404 onfail="PING ALL FAIL" )
2405
GlennRCbddd58f2015-10-01 15:45:25 -07002406 caseResult = linkUp and pingResult
2407 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002408 onpass="Link Up Test PASS",
2409 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002410 # Printing what exactly failed
2411 if not linkUp:
2412 main.log.debug( "Link down was not discovered correctly" )
2413 if not pingResult:
2414 main.log.debug( "Pingall failed" )
2415 if not intentState:
2416 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002417
GlennRCbddd58f2015-10-01 15:45:25 -07002418 if not caseResult and main.failSwitch:
2419 main.log.report("Stopping test")
2420 main.stop( email=main.emailOnStop )
2421
Hari Krishnab79d0822015-08-20 09:48:43 -07002422 def CASE75( self, main ):
2423 """
2424 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2425 """
2426 import random
2427 main.randomLink1 = []
2428 main.randomLink2 = []
2429 main.randomLink3 = []
2430 main.randomLink4 = []
2431 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2432 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2433 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2434 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2435 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2436 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2437 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2438 main.pingTimeout = 400
2439
2440 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2441 main.log.report( "___________________________________________________________________________" )
2442 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2443 linkIndex = range(4)
2444 linkIndexS9 = random.sample(linkIndex,1)[0]
2445 linkIndex.remove(linkIndexS9)
2446 linkIndexS10 = random.sample(linkIndex,1)[0]
2447 main.randomLink1 = link1End2top[linkIndexS9]
2448 main.randomLink2 = link2End2top[linkIndexS10]
2449 main.randomLink3 = random.sample(link1End2bot,1)[0]
2450 main.randomLink4 = random.sample(link2End2bot,1)[0]
2451
2452 # Work around for link state propagation delay. Added some sleep time.
2453 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2454 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2455 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2456 time.sleep( link_sleep )
2457 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2458 time.sleep( link_sleep )
2459
2460 topology_output = main.ONOScli1.topology()
2461 linkDown = main.ONOSbench.checkStatus(
2462 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002463 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002464 utilities.assert_equals(
2465 expect=main.TRUE,
2466 actual=linkDown,
2467 onpass="Link Down discovered properly",
2468 onfail="Link down was not discovered in " +
2469 str( link_sleep ) +
2470 " seconds" )
2471
GlennRCfcfdc4f2015-09-30 16:01:57 -07002472 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002473 # Giving onos multiple chances to install intents
2474 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002475 if i != 0:
2476 main.log.warn( "Verification failed. Retrying..." )
2477 main.log.info("Giving onos some time...")
2478 time.sleep( main.checkIntentsDelay )
2479
2480 intentState = main.TRUE
2481 for e in range(int(main.numCtrls)):
2482 main.log.info( "Checking intents on CLI %s" % (e+1) )
2483 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2484 intentState
2485 if not intentState:
2486 main.log.warn( "Not all intents installed" )
2487 if intentState:
2488 break
2489 else:
2490 #Dumping intent summary
2491 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2492
2493
2494 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2495 onpass="INTENTS INSTALLED",
2496 onfail="SOME INTENTS NOT INSTALLED" )
2497
Hari Krishnab79d0822015-08-20 09:48:43 -07002498 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002499 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002500 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002501 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2502 if not pingResult:
2503 main.log.warn("First pingall failed. Retrying...")
2504 time.sleep(main.pingSleep)
2505 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002506
Hari Krishnab79d0822015-08-20 09:48:43 -07002507 time2 = time.time()
2508 timeDiff = round( ( time2 - time1 ), 2 )
2509 main.log.report(
2510 "Time taken for Ping All: " +
2511 str( timeDiff ) +
2512 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002513 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002514 onpass="PING ALL PASS",
2515 onfail="PING ALL FAIL" )
2516
GlennRCbddd58f2015-10-01 15:45:25 -07002517 caseResult = linkDown and pingResult and intentState
2518 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002519 onpass="Random Link cut Test PASS",
2520 onfail="Random Link cut Test FAIL" )
2521
GlennRCfcfdc4f2015-09-30 16:01:57 -07002522 # Printing what exactly failed
2523 if not linkDown:
2524 main.log.debug( "Link down was not discovered correctly" )
2525 if not pingResult:
2526 main.log.debug( "Pingall failed" )
2527 if not intentState:
2528 main.log.debug( "Intents are not all installed" )
2529
GlennRCbddd58f2015-10-01 15:45:25 -07002530 if not caseResult and main.failSwitch:
2531 main.log.report("Stopping test")
2532 main.stop( email=main.emailOnStop )
2533
Hari Krishnab79d0822015-08-20 09:48:43 -07002534 def CASE85( self, main ):
2535 """
2536 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2537 """
2538 import random
2539 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2540 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2541 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2542 main.log.report(
2543 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2544 main.log.report(
2545 "__________________________________________________________________" )
2546 main.case(
2547 "Point intents - Bring the core links up that are down and verify ping all" )
2548
2549 # Work around for link state propagation delay. Added some sleep time.
2550 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2551 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2552 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2553 time.sleep( link_sleep )
2554 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2555 time.sleep( link_sleep )
2556
2557 topology_output = main.ONOScli1.topology()
2558 linkUp = main.ONOSbench.checkStatus(
2559 topology_output,
2560 main.numMNswitches,
2561 str( main.numMNlinks ) )
2562 utilities.assert_equals(
2563 expect=main.TRUE,
2564 actual=linkUp,
2565 onpass="Link up discovered properly",
2566 onfail="Link up was not discovered in " +
2567 str( link_sleep ) +
2568 " seconds" )
2569
GlennRCfcfdc4f2015-09-30 16:01:57 -07002570 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002571 # Giving onos multiple chances to install intents
2572 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002573 if i != 0:
2574 main.log.warn( "Verification failed. Retrying..." )
2575 main.log.info("Giving onos some time...")
2576 time.sleep( main.checkIntentsDelay )
2577
2578 intentState = main.TRUE
2579 for e in range(int(main.numCtrls)):
2580 main.log.info( "Checking intents on CLI %s" % (e+1) )
2581 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2582 intentState
2583 if not intentState:
2584 main.log.warn( "Not all intents installed" )
2585 if intentState:
2586 break
2587 else:
2588 #Dumping intent summary
2589 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2590
2591
2592 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2593 onpass="INTENTS INSTALLED",
2594 onfail="SOME INTENTS NOT INSTALLED" )
2595
Hari Krishnab79d0822015-08-20 09:48:43 -07002596 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002597 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002598 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002599 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2600 if not pingResult:
2601 main.log.warn("First pingall failed. Retrying...")
2602 time.sleep(main.pingSleep)
2603 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002604
Hari Krishnab79d0822015-08-20 09:48:43 -07002605 time2 = time.time()
2606 timeDiff = round( ( time2 - time1 ), 2 )
2607 main.log.report(
2608 "Time taken for Ping All: " +
2609 str( timeDiff ) +
2610 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002611 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002612 onpass="PING ALL PASS",
2613 onfail="PING ALL FAIL" )
2614
GlennRCbddd58f2015-10-01 15:45:25 -07002615 caseResult = linkUp and pingResult
2616 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002617 onpass="Link Up Test PASS",
2618 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002619 # Printing what exactly failed
2620 if not linkUp:
2621 main.log.debug( "Link down was not discovered correctly" )
2622 if not pingResult:
2623 main.log.debug( "Pingall failed" )
2624 if not intentState:
2625 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002626
GlennRCbddd58f2015-10-01 15:45:25 -07002627 if not caseResult and main.failSwitch:
2628 main.log.report("Stopping test")
2629 main.stop( email=main.emailOnStop )
2630
Hari Krishna4223dbd2015-08-13 16:29:53 -07002631 def CASE170( self ):
2632 """
2633 IPv6 ping all with some core links down( Host Intents-Att Topo)
2634 """
2635 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2636 main.log.report( "_________________________________________________" )
2637 import itertools
2638 import time
2639 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2640 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002641 pingResult = main.FALSE
2642 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002643 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002644 if not pingResult:
2645 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002646 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002647 time2 = time.time()
2648 timeDiff = round( ( time2 - time1 ), 2 )
2649 main.log.report(
2650 "Time taken for IPv6 Ping All: " +
2651 str( timeDiff ) +
2652 " seconds" )
2653 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2654 onpass="PING ALL PASS",
2655 onfail="PING ALL FAIL" )
2656
GlennRCbddd58f2015-10-01 15:45:25 -07002657 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002658 utilities.assert_equals(
2659 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002660 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002661 onpass="IPv6 Ping across 300 host intents test PASS",
2662 onfail="IPv6 Ping across 300 host intents test FAIL" )
2663
2664 def CASE180( self ):
2665 """
2666 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2667 """
2668 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2669 main.log.report( "_________________________________________________" )
2670 import itertools
2671 import time
2672 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2673 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002674 pingResult = main.FALSE
2675 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002676 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002677 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002678 main.log.warn("First ping failed. Retrying...")
2679 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002680 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002681 time2 = time.time()
2682 timeDiff = round( ( time2 - time1 ), 2 )
2683 main.log.report(
2684 "Time taken for IPv6 Ping All: " +
2685 str( timeDiff ) +
2686 " seconds" )
2687 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2688 onpass="PING ALL PASS",
2689 onfail="PING ALL FAIL" )
2690
GlennRCbddd58f2015-10-01 15:45:25 -07002691 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002692 utilities.assert_equals(
2693 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002694 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002695 onpass="IPv6 Ping across 300 host intents test PASS",
2696 onfail="IPv6 Ping across 300 host intents test FAIL" )
2697
2698 def CASE171( self ):
2699 """
2700 IPv6 ping all with some core links down( Point Intents-Att Topo)
2701 """
2702 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2703 main.log.report( "_________________________________________________" )
2704 import itertools
2705 import time
2706 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2707 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002708 pingResult = main.FALSE
2709 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002710 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002711 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002712 main.log.warn("First ping failed. Retrying...")
2713 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002714 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002715 time2 = time.time()
2716 timeDiff = round( ( time2 - time1 ), 2 )
2717 main.log.report(
2718 "Time taken for IPv6 Ping All: " +
2719 str( timeDiff ) +
2720 " seconds" )
2721 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2722 onpass="PING ALL PASS",
2723 onfail="PING ALL FAIL" )
2724
GlennRCbddd58f2015-10-01 15:45:25 -07002725 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002726 utilities.assert_equals(
2727 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002728 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002729 onpass="IPv6 Ping across 600 point intents test PASS",
2730 onfail="IPv6 Ping across 600 point intents test FAIL" )
2731
2732 def CASE181( self ):
2733 """
2734 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2735 """
2736 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2737 main.log.report( "_________________________________________________" )
2738 import itertools
2739 import time
2740 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2741 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002742 pingResult = main.FALSE
2743 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002744 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002745 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002746 main.log.warn("First ping failed. Retrying...")
2747 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002748 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002749 time2 = time.time()
2750 timeDiff = round( ( time2 - time1 ), 2 )
2751 main.log.report(
2752 "Time taken for IPv6 Ping All: " +
2753 str( timeDiff ) +
2754 " seconds" )
2755 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2756 onpass="PING ALL PASS",
2757 onfail="PING ALL FAIL" )
2758
GlennRCbddd58f2015-10-01 15:45:25 -07002759 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002760 utilities.assert_equals(
2761 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002762 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002763 onpass="IPv6 Ping across 600 Point intents test PASS",
2764 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2765
2766 def CASE172( self ):
2767 """
2768 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2769 """
2770 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2771 main.log.report( "_________________________________________________" )
2772 import itertools
2773 import time
2774 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2775 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002776 pingResult = main.FALSE
2777 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002778 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002779 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002780 main.log.warn("First ping failed. Retrying...")
2781 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002782 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002783 time2 = time.time()
2784 timeDiff = round( ( time2 - time1 ), 2 )
2785 main.log.report(
2786 "Time taken for IPv6 Ping All: " +
2787 str( timeDiff ) +
2788 " seconds" )
2789 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2790 onpass="PING ALL PASS",
2791 onfail="PING ALL FAIL" )
2792
GlennRCbddd58f2015-10-01 15:45:25 -07002793 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002794 utilities.assert_equals(
2795 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002796 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002797 onpass="IPv6 Ping across 300 host intents test PASS",
2798 onfail="IPv6 Ping across 300 host intents test FAIL" )
2799
2800 def CASE182( self ):
2801 """
2802 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2803 """
2804 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2805 main.log.report( "_________________________________________________" )
2806 import itertools
2807 import time
2808 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2809 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002810 pingResult = main.FALSE
2811 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002812 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002813 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002814 main.log.warn("First ping failed. Retrying...")
2815 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002816 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002817 time2 = time.time()
2818 timeDiff = round( ( time2 - time1 ), 2 )
2819 main.log.report(
2820 "Time taken for IPv6 Ping All: " +
2821 str( timeDiff ) +
2822 " seconds" )
2823 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2824 onpass="PING ALL PASS",
2825 onfail="PING ALL FAIL" )
2826
GlennRCbddd58f2015-10-01 15:45:25 -07002827 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002828 utilities.assert_equals(
2829 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002830 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002831 onpass="IPv6 Ping across 300 host intents test PASS",
2832 onfail="IPv6 Ping across 300 host intents test FAIL" )
2833
2834 def CASE173( self ):
2835 """
2836 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2837 """
2838 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2839 main.log.report( "_________________________________________________" )
2840 import itertools
2841 import time
2842 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2843 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002844 pingResult = main.FALSE
2845 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002846 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002847 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002848 main.log.warn("First ping failed. Retrying...")
2849 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002850 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002851 time2 = time.time()
2852 timeDiff = round( ( time2 - time1 ), 2 )
2853 main.log.report(
2854 "Time taken for IPv6 Ping All: " +
2855 str( timeDiff ) +
2856 " seconds" )
2857 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2858 onpass="PING ALL PASS",
2859 onfail="PING ALL FAIL" )
2860
GlennRCbddd58f2015-10-01 15:45:25 -07002861 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002862 utilities.assert_equals(
2863 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002864 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002865 onpass="IPv6 Ping across 600 point intents test PASS",
2866 onfail="IPv6 Ping across 600 point intents test FAIL" )
2867
2868 def CASE183( self ):
2869 """
2870 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2871 """
2872 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2873 main.log.report( "_________________________________________________" )
2874 import itertools
2875 import time
2876 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2877 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002878 pingResult = main.FALSE
2879 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002880 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002881 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002882 main.log.warn("First ping failed. Retrying...")
2883 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002884 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002885 time2 = time.time()
2886 timeDiff = round( ( time2 - time1 ), 2 )
2887 main.log.report(
2888 "Time taken for IPv6 Ping All: " +
2889 str( timeDiff ) +
2890 " seconds" )
2891 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2892 onpass="PING ALL PASS",
2893 onfail="PING ALL FAIL" )
2894
GlennRCbddd58f2015-10-01 15:45:25 -07002895 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002896 utilities.assert_equals(
2897 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002898 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002899 onpass="IPv6 Ping across 600 Point intents test PASS",
2900 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2901
2902 def CASE174( self ):
2903 """
2904 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2905 """
2906 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2907 main.log.report( "_________________________________________________" )
2908 import itertools
2909 import time
2910 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2911 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002912 pingResult = main.FALSE
2913 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002914 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002915 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002916 main.log.warn("First ping failed. Retrying...")
2917 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002918 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002919 time2 = time.time()
2920 timeDiff = round( ( time2 - time1 ), 2 )
2921 main.log.report(
2922 "Time taken for IPv6 Ping All: " +
2923 str( timeDiff ) +
2924 " seconds" )
2925 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2926 onpass="PING ALL PASS",
2927 onfail="PING ALL FAIL" )
2928
GlennRCbddd58f2015-10-01 15:45:25 -07002929 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002930 utilities.assert_equals(
2931 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002932 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002933 onpass="IPv6 Ping across 2278 host intents test PASS",
2934 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2935
2936 def CASE184( self ):
2937 """
2938 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2939 """
2940 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2941 main.log.report( "_________________________________________________" )
2942 import itertools
2943 import time
2944 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2945 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002946 pingResult = main.FALSE
2947 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002948 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002949 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002950 main.log.warn("First ping failed. Retrying...")
2951 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002952 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002953 time2 = time.time()
2954 timeDiff = round( ( time2 - time1 ), 2 )
2955 main.log.report(
2956 "Time taken for IPv6 Ping All: " +
2957 str( timeDiff ) +
2958 " seconds" )
2959 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2960 onpass="PING ALL PASS",
2961 onfail="PING ALL FAIL" )
2962
GlennRCbddd58f2015-10-01 15:45:25 -07002963 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002964 utilities.assert_equals(
2965 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002966 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002967 onpass="IPv6 Ping across 2278 host intents test PASS",
2968 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2969
2970 def CASE175( self ):
2971 """
2972 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2973 """
2974 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2975 main.log.report( "_________________________________________________" )
2976 import itertools
2977 import time
2978 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2979 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002980 pingResult = main.FALSE
2981 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002982 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002983 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002984 main.log.warn("First ping failed. Retrying...")
2985 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002986 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002987 time2 = time.time()
2988 timeDiff = round( ( time2 - time1 ), 2 )
2989 main.log.report(
2990 "Time taken for IPv6 Ping All: " +
2991 str( timeDiff ) +
2992 " seconds" )
2993 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2994 onpass="PING ALL PASS",
2995 onfail="PING ALL FAIL" )
2996
GlennRCbddd58f2015-10-01 15:45:25 -07002997 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002998 utilities.assert_equals(
2999 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003000 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003001 onpass="IPv6 Ping across 4556 point intents test PASS",
3002 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3003
3004 def CASE185( self ):
3005 """
3006 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3007 """
3008 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3009 main.log.report( "_________________________________________________" )
3010 import itertools
3011 import time
3012 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3013 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003014 pingResult = main.FALSE
3015 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003016 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003017 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003018 main.log.warn("First ping failed. Retrying...")
3019 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003020 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003021 time2 = time.time()
3022 timeDiff = round( ( time2 - time1 ), 2 )
3023 main.log.report(
3024 "Time taken for IPv6 Ping All: " +
3025 str( timeDiff ) +
3026 " seconds" )
3027 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3028 onpass="PING ALL PASS",
3029 onfail="PING ALL FAIL" )
3030
GlennRCbddd58f2015-10-01 15:45:25 -07003031 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003032 utilities.assert_equals(
3033 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003034 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003035 onpass="IPv6 Ping across 4556 Point intents test PASS",
3036 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3037
Hari Krishnac195f3b2015-07-08 20:02:24 -07003038 def CASE90( self ):
3039 """
3040 Install 600 point intents and verify ping all (Att Topology)
3041 """
3042 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3043 main.log.report( "_______________________________________" )
3044 import itertools
3045 import time
3046 main.case( "Install 600 point intents" )
3047 main.step( "Add point Intents" )
3048 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003049 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3050
Hari Krishnac195f3b2015-07-08 20:02:24 -07003051 intentIdList = []
3052 time1 = time.time()
3053 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3054 pool = []
3055 for cli in main.CLIs:
3056 if i >= len( deviceCombos ):
3057 break
3058 t = main.Thread( target=cli.addPointIntent,
3059 threadID=main.threadID,
3060 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003061 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 -07003062 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003063 t.start()
3064 i = i + 1
3065 main.threadID = main.threadID + 1
3066 for thread in pool:
3067 thread.join()
3068 intentIdList.append(thread.result)
3069 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003070 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003071
GlennRCfcfdc4f2015-09-30 16:01:57 -07003072 # Saving intent ids to check intents in later case
3073 main.intentIds = list(intentIdList)
3074
GlennRCa8d786a2015-09-23 17:40:11 -07003075 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003076
GlennRC1dde1712015-10-02 11:03:08 -07003077 # Giving onos multiple chances to install intents
3078 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003079 if i != 0:
3080 main.log.warn( "Verification failed. Retrying..." )
3081 main.log.info("Waiting for onos to install intents...")
3082 time.sleep( main.checkIntentsDelay )
3083
GlennRCa8d786a2015-09-23 17:40:11 -07003084 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003085 for e in range(int(main.numCtrls)):
3086 main.log.info( "Checking intents on CLI %s" % (e+1) )
3087 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3088 intentState
3089 if not intentState:
3090 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003091 if intentState:
3092 break
GlennRCdb2c8422015-09-29 12:21:59 -07003093 else:
3094 #Dumping intent summary
3095 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003096
3097 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3098 onpass="INTENTS INSTALLED",
3099 onfail="SOME INTENTS NOT INSTALLED" )
3100
Hari Krishnac195f3b2015-07-08 20:02:24 -07003101 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003102 for i in range(main.numPings):
3103 time1 = time.time()
3104 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3105 if not pingResult:
3106 main.log.warn("First pingall failed. Retrying...")
3107 time.sleep(main.pingSleep)
3108 else: break
3109
Hari Krishnac195f3b2015-07-08 20:02:24 -07003110 time2 = time.time()
3111 timeDiff = round( ( time2 - time1 ), 2 )
3112 main.log.report(
3113 "Time taken for Ping All: " +
3114 str( timeDiff ) +
3115 " seconds" )
3116 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003117 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003118 onfail="PING ALL FAIL" )
3119
GlennRCbddd58f2015-10-01 15:45:25 -07003120 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003121
Hari Krishnac195f3b2015-07-08 20:02:24 -07003122 utilities.assert_equals(
3123 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003124 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003125 onpass="Install 600 point Intents and Ping All test PASS",
3126 onfail="Install 600 point Intents and Ping All test FAIL" )
3127
GlennRCbddd58f2015-10-01 15:45:25 -07003128 if not intentState:
3129 main.log.debug( "Intents failed to install completely" )
3130 if not pingResult:
3131 main.log.debug( "Pingall failed" )
3132
3133 if not caseResult and main.failSwitch:
3134 main.log.report("Stopping test")
3135 main.stop( email=main.emailOnStop )
3136
Hari Krishnac195f3b2015-07-08 20:02:24 -07003137 def CASE91( self ):
3138 """
3139 Install 600 point intents and verify ping all (Chordal Topology)
3140 """
3141 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3142 main.log.report( "_______________________________________" )
3143 import itertools
3144 import time
3145 main.case( "Install 600 point intents" )
3146 main.step( "Add point Intents" )
3147 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003148 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3149
Hari Krishnac195f3b2015-07-08 20:02:24 -07003150 intentIdList = []
3151 time1 = time.time()
3152 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3153 pool = []
3154 for cli in main.CLIs:
3155 if i >= len( deviceCombos ):
3156 break
3157 t = main.Thread( target=cli.addPointIntent,
3158 threadID=main.threadID,
3159 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003160 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 -07003161 pool.append(t)
3162 #time.sleep(1)
3163 t.start()
3164 i = i + 1
3165 main.threadID = main.threadID + 1
3166 for thread in pool:
3167 thread.join()
3168 intentIdList.append(thread.result)
3169 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003170 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003171
GlennRCfcfdc4f2015-09-30 16:01:57 -07003172 # Saving intent ids to check intents in later case
3173 main.intentIds = list(intentIdList)
3174
GlennRCa8d786a2015-09-23 17:40:11 -07003175 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003176
GlennRC1dde1712015-10-02 11:03:08 -07003177 # Giving onos multiple chances to install intents
3178 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003179 if i != 0:
3180 main.log.warn( "Verification failed. Retrying..." )
3181 main.log.info("Waiting for onos to install intents...")
3182 time.sleep( main.checkIntentsDelay )
3183
GlennRCa8d786a2015-09-23 17:40:11 -07003184 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003185 for e in range(int(main.numCtrls)):
3186 main.log.info( "Checking intents on CLI %s" % (e+1) )
3187 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3188 intentState
3189 if not intentState:
3190 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003191 if intentState:
3192 break
GlennRCdb2c8422015-09-29 12:21:59 -07003193 else:
3194 #Dumping intent summary
3195 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003196
3197 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3198 onpass="INTENTS INSTALLED",
3199 onfail="SOME INTENTS NOT INSTALLED" )
3200
Hari Krishnac195f3b2015-07-08 20:02:24 -07003201 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003202 for i in range(main.numPings):
3203 time1 = time.time()
3204 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3205 if not pingResult:
3206 main.log.warn("First pingall failed. Retrying...")
3207 time.sleep(main.pingSleep)
3208 else: break
3209
Hari Krishnac195f3b2015-07-08 20:02:24 -07003210 time2 = time.time()
3211 timeDiff = round( ( time2 - time1 ), 2 )
3212 main.log.report(
3213 "Time taken for Ping All: " +
3214 str( timeDiff ) +
3215 " seconds" )
3216 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3217 onpass="PING ALL PASS",
3218 onfail="PING ALL FAIL" )
3219
GlennRCbddd58f2015-10-01 15:45:25 -07003220 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003221
Hari Krishnac195f3b2015-07-08 20:02:24 -07003222 utilities.assert_equals(
3223 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003224 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003225 onpass="Install 600 point Intents and Ping All test PASS",
3226 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003227
GlennRCbddd58f2015-10-01 15:45:25 -07003228 if not intentState:
3229 main.log.debug( "Intents failed to install completely" )
3230 if not pingResult:
3231 main.log.debug( "Pingall failed" )
3232
3233 if not caseResult and main.failSwitch:
3234 main.log.report("Stopping test")
3235 main.stop( email=main.emailOnStop )
3236
Hari Krishnac195f3b2015-07-08 20:02:24 -07003237 def CASE92( self ):
3238 """
3239 Install 4556 point intents and verify ping all (Spine Topology)
3240 """
3241 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3242 main.log.report( "_______________________________________" )
3243 import itertools
3244 import time
3245 main.case( "Install 4556 point intents" )
3246 main.step( "Add point Intents" )
3247 intentResult = main.TRUE
3248 main.pingTimeout = 600
3249 for i in range(len(main.hostMACs)):
3250 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3251 print main.MACsDict
3252 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3253 intentIdList = []
3254 time1 = time.time()
3255 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3256 pool = []
3257 for cli in main.CLIs:
3258 if i >= len( deviceCombos ):
3259 break
3260 t = main.Thread( target=cli.addPointIntent,
3261 threadID=main.threadID,
3262 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003263 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 -07003264 pool.append(t)
3265 #time.sleep(1)
3266 t.start()
3267 i = i + 1
3268 main.threadID = main.threadID + 1
3269 for thread in pool:
3270 thread.join()
3271 intentIdList.append(thread.result)
3272 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003273 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003274
GlennRCfcfdc4f2015-09-30 16:01:57 -07003275 # Saving intent ids to check intents in later case
3276 main.intentIds = list(intentIdList)
3277
GlennRCa8d786a2015-09-23 17:40:11 -07003278 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003279
GlennRC1dde1712015-10-02 11:03:08 -07003280 # Giving onos multiple chances to install intents
3281 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003282 if i != 0:
3283 main.log.warn( "Verification failed. Retrying..." )
3284 main.log.info("Waiting for onos to install intents...")
3285 time.sleep( main.checkIntentsDelay )
3286
GlennRCa8d786a2015-09-23 17:40:11 -07003287 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003288 for e in range(int(main.numCtrls)):
3289 main.log.info( "Checking intents on CLI %s" % (e+1) )
3290 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3291 intentState
3292 if not intentState:
3293 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003294 if intentState:
3295 break
GlennRCdb2c8422015-09-29 12:21:59 -07003296 else:
3297 #Dumping intent summary
3298 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003299
3300 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3301 onpass="INTENTS INSTALLED",
3302 onfail="SOME INTENTS NOT INSTALLED" )
3303
Hari Krishnac195f3b2015-07-08 20:02:24 -07003304 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003305 for i in range(main.numPings):
3306 time1 = time.time()
3307 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3308 if not pingResult:
3309 main.log.warn("First pingall failed. Retrying...")
3310 time.sleep(main.pingSleep)
3311 else: break
3312
Hari Krishnac195f3b2015-07-08 20:02:24 -07003313 time2 = time.time()
3314 timeDiff = round( ( time2 - time1 ), 2 )
3315 main.log.report(
3316 "Time taken for Ping All: " +
3317 str( timeDiff ) +
3318 " seconds" )
3319 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3320 onpass="PING ALL PASS",
3321 onfail="PING ALL FAIL" )
3322
GlennRCbddd58f2015-10-01 15:45:25 -07003323 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003324
Hari Krishnac195f3b2015-07-08 20:02:24 -07003325 utilities.assert_equals(
3326 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003327 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003328 onpass="Install 4556 point Intents and Ping All test PASS",
3329 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003330
GlennRCbddd58f2015-10-01 15:45:25 -07003331 if not intentState:
3332 main.log.debug( "Intents failed to install completely" )
3333 if not pingResult:
3334 main.log.debug( "Pingall failed" )
3335
3336 if not caseResult and main.failSwitch:
3337 main.log.report("Stopping test")
3338 main.stop( email=main.emailOnStop )
3339
Hari Krishnac195f3b2015-07-08 20:02:24 -07003340 def CASE93( self ):
3341 """
3342 Install multi-single point intents and verify Ping all works
3343 for att topology
3344 """
3345 import copy
3346 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003347 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003348 main.log.report( "Install multi-single point intents and verify Ping all" )
3349 main.log.report( "___________________________________________" )
3350 main.case( "Install multi-single point intents and Ping all" )
3351 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3352 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3353 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003354 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003355 time1 = time.time()
3356 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3357 pool = []
3358 for cli in main.CLIs:
3359 egressDevice = deviceDPIDsCopy[i]
3360 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3361 ingressDeviceList.remove(egressDevice)
3362 if i >= len( deviceDPIDsCopy ):
3363 break
3364 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3365 threadID=main.threadID,
3366 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003367 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003368 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003369 t.start()
3370 i = i + 1
3371 main.threadID = main.threadID + 1
3372 for thread in pool:
3373 thread.join()
3374 intentIdList.append(thread.result)
3375 time2 = time.time()
3376 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003377
GlennRCdb2c8422015-09-29 12:21:59 -07003378 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003379
GlennRC1dde1712015-10-02 11:03:08 -07003380 # Giving onos multiple chances to install intents
3381 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003382 if i != 0:
3383 main.log.warn( "Verification failed. Retrying..." )
3384 main.log.info("Waiting for onos to install intents...")
3385 time.sleep( main.checkIntentsDelay )
3386
3387 intentState = main.TRUE
3388 for e in range(int(main.numCtrls)):
3389 main.log.info( "Checking intents on CLI %s" % (e+1) )
3390 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3391 intentState
3392 if not intentState:
3393 main.log.warn( "Not all intents installed" )
3394 if intentState:
3395 break
3396 else:
3397 #Dumping intent summary
3398 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3399
3400 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3401 onpass="INTENTS INSTALLED",
3402 onfail="SOME INTENTS NOT INSTALLED" )
3403
GlennRCfa69a2a2015-10-02 15:54:06 -07003404 main.step("Verify flows are all added")
3405
3406 for i in range( main.flowCheck ):
3407 if i != 0:
3408 main.log.warn( "verification failed. Retrying..." )
3409 main.log.info( "Waiting for onos to add flows..." )
3410 time.sleep( main.checkFlowsDelay )
3411
3412 flowState = main.TRUE
3413 for cli in main.CLIs:
3414 flowState = cli.checkFlowState()
3415 if not flowState:
3416 main.log.warn( "Not all flows added" )
3417 if flowState:
3418 break
3419 else:
3420 #Dumping summary
3421 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3422
3423 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3424 onpass="FLOWS INSTALLED",
3425 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003426
Hari Krishnac195f3b2015-07-08 20:02:24 -07003427 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003428 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003429 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003430 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3431 if not pingResult:
3432 main.log.warn("First pingall failed. Retrying...")
3433 time.sleep(main.pingSleep)
3434 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003435
Hari Krishnac195f3b2015-07-08 20:02:24 -07003436 time2 = time.time()
3437 timeDiff = round( ( time2 - time1 ), 2 )
3438 main.log.report(
3439 "Time taken for Ping All: " +
3440 str( timeDiff ) +
3441 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003442
GlennRCbddd58f2015-10-01 15:45:25 -07003443 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003444 utilities.assert_equals(
3445 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003446 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003447 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3448 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003449
GlennRCfa69a2a2015-10-02 15:54:06 -07003450 if not intentState:
3451 main.log.debug( "Intents failed to install completely" )
3452 if not pingResult:
3453 main.log.debug( "Pingall failed" )
3454 if not checkFlowsState:
3455 main.log.debug( "Flows failed to add completely" )
3456
3457 if not caseResult and main.failSwitch:
3458 main.log.report("Stopping test")
3459 main.stop( email=main.emailOnStop )
3460
Hari Krishnac195f3b2015-07-08 20:02:24 -07003461 def CASE94( self ):
3462 """
3463 Install multi-single point intents and verify Ping all works
3464 for Chordal topology
3465 """
3466 import copy
3467 import time
3468 main.log.report( "Install multi-single point intents and verify Ping all" )
3469 main.log.report( "___________________________________________" )
3470 main.case( "Install multi-single point intents and Ping all" )
3471 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3472 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3473 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003474 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003475 time1 = time.time()
3476 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3477 pool = []
3478 for cli in main.CLIs:
3479 egressDevice = deviceDPIDsCopy[i]
3480 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3481 ingressDeviceList.remove(egressDevice)
3482 if i >= len( deviceDPIDsCopy ):
3483 break
3484 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3485 threadID=main.threadID,
3486 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003487 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003488 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003489 t.start()
3490 i = i + 1
3491 main.threadID = main.threadID + 1
3492 for thread in pool:
3493 thread.join()
3494 intentIdList.append(thread.result)
3495 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003496 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003497
3498 main.step("Verify intents are installed")
3499
GlennRC1dde1712015-10-02 11:03:08 -07003500 # Giving onos multiple chances to install intents
3501 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003502 if i != 0:
3503 main.log.warn( "Verification failed. Retrying..." )
3504 main.log.info("Waiting for onos to install intents...")
3505 time.sleep( main.checkIntentsDelay )
3506
3507 intentState = main.TRUE
3508 for e in range(int(main.numCtrls)):
3509 main.log.info( "Checking intents on CLI %s" % (e+1) )
3510 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3511 intentState
3512 if not intentState:
3513 main.log.warn( "Not all intents installed" )
3514 if intentState:
3515 break
3516 else:
3517 #Dumping intent summary
3518 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3519
GlennRCdb2c8422015-09-29 12:21:59 -07003520 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3521 onpass="INTENTS INSTALLED",
3522 onfail="SOME INTENTS NOT INSTALLED" )
3523
GlennRCfa69a2a2015-10-02 15:54:06 -07003524 main.step("Verify flows are all added")
3525
3526 for i in range( main.flowCheck ):
3527 if i != 0:
3528 main.log.warn( "verification failed. Retrying..." )
3529 main.log.info( "Waiting for onos to add flows..." )
3530 time.sleep( main.checkFlowsDelay )
3531
3532 flowState = main.TRUE
3533 for cli in main.CLIs:
3534 flowState = cli.checkFlowState()
3535 if not flowState:
3536 main.log.warn( "Not all flows added" )
3537 if flowState:
3538 break
3539 else:
3540 #Dumping summary
3541 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3542
3543 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3544 onpass="FLOWS INSTALLED",
3545 onfail="SOME FLOWS NOT ADDED" )
3546
Hari Krishnac195f3b2015-07-08 20:02:24 -07003547 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003548 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003549 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003550 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3551 if not pingResult:
3552 main.log.warn("First pingall failed. Retrying...")
3553 time.sleep(main.pingSleep)
3554 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003555
Hari Krishnac195f3b2015-07-08 20:02:24 -07003556 time2 = time.time()
3557 timeDiff = round( ( time2 - time1 ), 2 )
3558 main.log.report(
3559 "Time taken for Ping All: " +
3560 str( timeDiff ) +
3561 " seconds" )
3562
GlennRCfa69a2a2015-10-02 15:54:06 -07003563 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003564 utilities.assert_equals(
3565 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003566 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003567 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3568 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003569
GlennRCfa69a2a2015-10-02 15:54:06 -07003570 if not intentState:
3571 main.log.debug( "Intents failed to install completely" )
3572 if not pingResult:
3573 main.log.debug( "Pingall failed" )
3574 if not checkFlowsState:
3575 main.log.debug( "Flows failed to add completely" )
3576
3577 if not caseResult and main.failSwitch:
3578 main.log.report("Stopping test")
3579 main.stop( email=main.emailOnStop )
3580
3581 def CASE95( self ):
3582 """
3583 Install multi-single point intents and verify Ping all works
3584 for Spine topology
3585 """
3586 import copy
3587 import time
3588 main.log.report( "Install multi-single point intents and verify Ping all" )
3589 main.log.report( "___________________________________________" )
3590 main.case( "Install multi-single point intents and Ping all" )
3591 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3592 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3593 intentIdList = []
3594 main.log.info( "MACsDict" + str(main.MACsDict) )
3595 time1 = time.time()
3596 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3597 pool = []
3598 for cli in main.CLIs:
3599 egressDevice = deviceDPIDsCopy[i]
3600 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3601 ingressDeviceList.remove(egressDevice)
3602 if i >= len( deviceDPIDsCopy ):
3603 break
3604 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3605 threadID=main.threadID,
3606 name="addMultipointToSinglepointIntent",
3607 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3608 pool.append(t)
3609 t.start()
3610 i = i + 1
3611 main.threadID = main.threadID + 1
3612 for thread in pool:
3613 thread.join()
3614 intentIdList.append(thread.result)
3615 time2 = time.time()
3616 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3617
3618 main.step("Verify intents are installed")
3619
3620 # Giving onos multiple chances to install intents
3621 for i in range( main.intentCheck ):
3622 if i != 0:
3623 main.log.warn( "Verification failed. Retrying..." )
3624 main.log.info("Waiting for onos to install intents...")
3625 time.sleep( main.checkIntentsDelay )
3626
3627 intentState = main.TRUE
3628 for e in range(int(main.numCtrls)):
3629 main.log.info( "Checking intents on CLI %s" % (e+1) )
3630 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3631 intentState
3632 if not intentState:
3633 main.log.warn( "Not all intents installed" )
3634 if intentState:
3635 break
3636 else:
3637 #Dumping intent summary
3638 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3639
3640 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3641 onpass="INTENTS INSTALLED",
3642 onfail="SOME INTENTS NOT INSTALLED" )
3643
3644 main.step("Verify flows are all added")
3645
3646 for i in range( main.flowCheck ):
3647 if i != 0:
3648 main.log.warn( "verification failed. Retrying..." )
3649 main.log.info( "Waiting for onos to add flows..." )
3650 time.sleep( main.checkFlowsDelay )
3651
3652 flowState = main.TRUE
3653 for cli in main.CLIs:
3654 flowState = cli.checkFlowState()
3655 if not flowState:
3656 main.log.warn( "Not all flows added" )
3657 if flowState:
3658 break
3659 else:
3660 #Dumping summary
3661 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3662
3663 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3664 onpass="FLOWS INSTALLED",
3665 onfail="SOME FLOWS NOT ADDED" )
3666
3667 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003668 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003669 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003670 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3671 if not pingResult:
3672 main.log.warn("First pingall failed. Retrying...")
3673 time.sleep(main.pingSleep)
3674 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003675
3676 time2 = time.time()
3677 timeDiff = round( ( time2 - time1 ), 2 )
3678 main.log.report(
3679 "Time taken for Ping All: " +
3680 str( timeDiff ) +
3681 " seconds" )
3682
3683 caseResult = ( checkFlowsState and pingResult and intentState )
3684 utilities.assert_equals(
3685 expect=main.TRUE,
3686 actual=caseResult,
3687 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3688 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3689
3690 if not intentState:
3691 main.log.debug( "Intents failed to install completely" )
3692 if not pingResult:
3693 main.log.debug( "Pingall failed" )
3694 if not checkFlowsState:
3695 main.log.debug( "Flows failed to add completely" )
3696
3697 if not caseResult and main.failSwitch:
3698 main.log.report("Stopping test")
3699 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003700
3701 def CASE96( self ):
3702 """
3703 Install single-multi point intents and verify Ping all works
3704 for att topology
3705 """
3706 import copy
3707 main.log.report( "Install single-multi point intents and verify Ping all" )
3708 main.log.report( "___________________________________________" )
3709 main.case( "Install single-multi point intents and Ping all" )
3710 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3711 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3712 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003713 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003714 time1 = time.time()
3715 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3716 pool = []
3717 for cli in main.CLIs:
3718 ingressDevice = deviceDPIDsCopy[i]
3719 egressDeviceList = copy.copy(deviceDPIDsCopy)
3720 egressDeviceList.remove(ingressDevice)
3721 if i >= len( deviceDPIDsCopy ):
3722 break
3723 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3724 threadID=main.threadID,
3725 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003726 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003727 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003728 t.start()
3729 i = i + 1
3730 main.threadID = main.threadID + 1
3731 for thread in pool:
3732 thread.join()
3733 intentIdList.append(thread.result)
3734 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003735 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003736
3737 main.step("Verify intents are installed")
3738
GlennRC1dde1712015-10-02 11:03:08 -07003739 # Giving onos multiple chances to install intents
3740 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003741 if i != 0:
3742 main.log.warn( "Verification failed. Retrying..." )
3743 main.log.info("Waiting for onos to install intents...")
3744 time.sleep( main.checkIntentsDelay )
3745
3746 intentState = main.TRUE
3747 for e in range(int(main.numCtrls)):
3748 main.log.info( "Checking intents on CLI %s" % (e+1) )
3749 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3750 intentState
3751 if not intentState:
3752 main.log.warn( "Not all intents installed" )
3753 if intentState:
3754 break
3755 else:
3756 #Dumping intent summary
3757 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3758
GlennRCdb2c8422015-09-29 12:21:59 -07003759 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3760 onpass="INTENTS INSTALLED",
3761 onfail="SOME INTENTS NOT INSTALLED" )
3762
GlennRCfa69a2a2015-10-02 15:54:06 -07003763 main.step("Verify flows are all added")
3764
3765 for i in range( main.flowCheck ):
3766 if i != 0:
3767 main.log.warn( "verification failed. Retrying..." )
3768 main.log.info( "Waiting for onos to add flows..." )
3769 time.sleep( main.checkFlowsDelay )
3770
3771 flowState = main.TRUE
3772 for cli in main.CLIs:
3773 flowState = cli.checkFlowState()
3774 if not flowState:
3775 main.log.warn( "Not all flows added" )
3776 if flowState:
3777 break
3778 else:
3779 #Dumping summary
3780 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3781
3782 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3783 onpass="FLOWS INSTALLED",
3784 onfail="SOME FLOWS NOT ADDED" )
3785
Hari Krishnac195f3b2015-07-08 20:02:24 -07003786 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003787 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003788 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003789 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3790 if not pingResult:
3791 main.log.warn("First pingall failed. Retrying...")
3792 time.sleep(main.pingSleep)
3793 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003794
Hari Krishnac195f3b2015-07-08 20:02:24 -07003795 time2 = time.time()
3796 timeDiff = round( ( time2 - time1 ), 2 )
3797 main.log.report(
3798 "Time taken for Ping All: " +
3799 str( timeDiff ) +
3800 " seconds" )
3801
GlennRCfa69a2a2015-10-02 15:54:06 -07003802 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003803 utilities.assert_equals(
3804 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003805 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003806 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3807 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3808
GlennRCfa69a2a2015-10-02 15:54:06 -07003809 if not intentState:
3810 main.log.debug( "Intents failed to install completely" )
3811 if not pingResult:
3812 main.log.debug( "Pingall failed" )
3813 if not checkFlowsState:
3814 main.log.debug( "Flows failed to add completely" )
3815
3816 if not caseResult and main.failSwitch:
3817 main.log.report("Stopping test")
3818 main.stop( email=main.emailOnStop )
3819
Hari Krishnac195f3b2015-07-08 20:02:24 -07003820 def CASE97( self ):
3821 """
3822 Install single-multi point intents and verify Ping all works
3823 for Chordal topology
3824 """
3825 import copy
3826 main.log.report( "Install single-multi point intents and verify Ping all" )
3827 main.log.report( "___________________________________________" )
3828 main.case( "Install single-multi point intents and Ping all" )
3829 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3830 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3831 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003832 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003833 time1 = time.time()
3834 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3835 pool = []
3836 for cli in main.CLIs:
3837 ingressDevice = deviceDPIDsCopy[i]
3838 egressDeviceList = copy.copy(deviceDPIDsCopy)
3839 egressDeviceList.remove(ingressDevice)
3840 if i >= len( deviceDPIDsCopy ):
3841 break
3842 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3843 threadID=main.threadID,
3844 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003845 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003846 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003847 t.start()
3848 i = i + 1
3849 main.threadID = main.threadID + 1
3850 for thread in pool:
3851 thread.join()
3852 intentIdList.append(thread.result)
3853 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003854 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003855
3856 main.step("Verify intents are installed")
3857
GlennRC1dde1712015-10-02 11:03:08 -07003858 # Giving onos multiple chances to install intents
3859 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003860 if i != 0:
3861 main.log.warn( "Verification failed. Retrying..." )
3862 main.log.info("Waiting for onos to install intents...")
3863 time.sleep( main.checkIntentsDelay )
3864
3865 intentState = main.TRUE
3866 for e in range(int(main.numCtrls)):
3867 main.log.info( "Checking intents on CLI %s" % (e+1) )
3868 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3869 intentState
3870 if not intentState:
3871 main.log.warn( "Not all intents installed" )
3872 if intentState:
3873 break
3874 else:
3875 #Dumping intent summary
3876 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3877
GlennRCdb2c8422015-09-29 12:21:59 -07003878 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3879 onpass="INTENTS INSTALLED",
3880 onfail="SOME INTENTS NOT INSTALLED" )
3881
GlennRCfa69a2a2015-10-02 15:54:06 -07003882 main.step("Verify flows are all added")
3883
3884 for i in range( main.flowCheck ):
3885 if i != 0:
3886 main.log.warn( "verification failed. Retrying..." )
3887 main.log.info( "Waiting for onos to add flows..." )
3888 time.sleep( main.checkFlowsDelay )
3889
3890 flowState = main.TRUE
3891 for cli in main.CLIs:
3892 flowState = cli.checkFlowState()
3893 if not flowState:
3894 main.log.warn( "Not all flows added" )
3895 if flowState:
3896 break
3897 else:
3898 #Dumping summary
3899 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3900
3901 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3902 onpass="FLOWS INSTALLED",
3903 onfail="SOME FLOWS NOT ADDED" )
3904
Hari Krishnac195f3b2015-07-08 20:02:24 -07003905 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003906 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003907 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003908 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3909 if not pingResult:
3910 main.log.warn("First pingall failed. Retrying...")
3911 time.sleep(main.pingSleep)
3912 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003913
Hari Krishnac195f3b2015-07-08 20:02:24 -07003914 time2 = time.time()
3915 timeDiff = round( ( time2 - time1 ), 2 )
3916 main.log.report(
3917 "Time taken for Ping All: " +
3918 str( timeDiff ) +
3919 " seconds" )
3920
GlennRCfa69a2a2015-10-02 15:54:06 -07003921 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003922 utilities.assert_equals(
3923 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003924 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003925 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3926 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3927
GlennRCfa69a2a2015-10-02 15:54:06 -07003928 if not intentState:
3929 main.log.debug( "Intents failed to install completely" )
3930 if not pingResult:
3931 main.log.debug( "Pingall failed" )
3932 if not checkFlowsState:
3933 main.log.debug( "Flows failed to add completely" )
3934
3935 if not caseResult and main.failSwitch:
3936 main.log.report("Stopping test")
3937 main.stop( email=main.emailOnStop )
3938
Hari Krishnac195f3b2015-07-08 20:02:24 -07003939 def CASE98( self ):
3940 """
3941 Install single-multi point intents and verify Ping all works
3942 for Spine topology
3943 """
3944 import copy
3945 main.log.report( "Install single-multi point intents and verify Ping all" )
3946 main.log.report( "___________________________________________" )
3947 main.case( "Install single-multi point intents and Ping all" )
3948 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3949 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3950 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3951 intentIdList = []
3952 MACsDictCopy = {}
3953 for i in range( len( deviceDPIDsCopy ) ):
3954 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3955
GlennRCfa69a2a2015-10-02 15:54:06 -07003956 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3957 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003958 time1 = time.time()
3959 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3960 pool = []
3961 for cli in main.CLIs:
3962 if i >= len( deviceDPIDsCopy ):
3963 break
3964 ingressDevice = deviceDPIDsCopy[i]
3965 egressDeviceList = copy.copy(deviceDPIDsCopy)
3966 egressDeviceList.remove(ingressDevice)
3967 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3968 threadID=main.threadID,
3969 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003970 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003971 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003972 t.start()
3973 i = i + 1
3974 main.threadID = main.threadID + 1
3975 for thread in pool:
3976 thread.join()
3977 intentIdList.append(thread.result)
3978 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003979 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003980
3981 main.step("Verify intents are installed")
3982
GlennRC1dde1712015-10-02 11:03:08 -07003983 # Giving onos multiple chances to install intents
3984 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003985 if i != 0:
3986 main.log.warn( "Verification failed. Retrying..." )
3987 main.log.info("Waiting for onos to install intents...")
3988 time.sleep( main.checkIntentsDelay )
3989
3990 intentState = main.TRUE
3991 for e in range(int(main.numCtrls)):
3992 main.log.info( "Checking intents on CLI %s" % (e+1) )
3993 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3994 intentState
3995 if not intentState:
3996 main.log.warn( "Not all intents installed" )
3997 if intentState:
3998 break
3999 else:
4000 #Dumping intent summary
4001 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4002
GlennRCdb2c8422015-09-29 12:21:59 -07004003 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4004 onpass="INTENTS INSTALLED",
4005 onfail="SOME INTENTS NOT INSTALLED" )
4006
GlennRCfa69a2a2015-10-02 15:54:06 -07004007 main.step("Verify flows are all added")
4008
4009 for i in range( main.flowCheck ):
4010 if i != 0:
4011 main.log.warn( "verification failed. Retrying..." )
4012 main.log.info( "Waiting for onos to add flows..." )
4013 time.sleep( main.checkFlowsDelay )
4014
4015 flowState = main.TRUE
4016 for cli in main.CLIs:
4017 flowState = cli.checkFlowState()
4018 if not flowState:
4019 main.log.warn( "Not all flows added" )
4020 if flowState:
4021 break
4022 else:
4023 #Dumping summary
4024 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4025
4026 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4027 onpass="FLOWS INSTALLED",
4028 onfail="SOME FLOWS NOT ADDED" )
4029
Hari Krishnac195f3b2015-07-08 20:02:24 -07004030 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004031 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004032 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004033 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4034 if not pingResult:
4035 main.log.warn("First pingall failed. Retrying...")
4036 time.sleep(main.pingSleep)
4037 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004038
Hari Krishnac195f3b2015-07-08 20:02:24 -07004039 time2 = time.time()
4040 timeDiff = round( ( time2 - time1 ), 2 )
4041 main.log.report(
4042 "Time taken for Ping All: " +
4043 str( timeDiff ) +
4044 " seconds" )
4045
GlennRCfa69a2a2015-10-02 15:54:06 -07004046 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004047 utilities.assert_equals(
4048 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004049 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004050 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4051 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4052
GlennRCfa69a2a2015-10-02 15:54:06 -07004053 if not intentState:
4054 main.log.debug( "Intents failed to install completely" )
4055 if not pingResult:
4056 main.log.debug( "Pingall failed" )
4057 if not checkFlowsState:
4058 main.log.debug( "Flows failed to add completely" )
4059
4060 if not caseResult and main.failSwitch:
4061 main.log.report("Stopping test")
4062 main.stop( email=main.emailOnStop )
4063
Hari Krishna4223dbd2015-08-13 16:29:53 -07004064 def CASE190( self ):
4065 """
4066 Verify IPv6 ping across 600 Point intents (Att Topology)
4067 """
4068 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4069 main.log.report( "_________________________________________________" )
4070 import itertools
4071 import time
4072 main.case( "IPv6 ping all 600 Point intents" )
4073 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004074 pingResult = main.FALSE
4075 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004076 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004077 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004078 main.log.warn("First pingall failed. Retrying...")
4079 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004080 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004081 time2 = time.time()
4082 timeDiff = round( ( time2 - time1 ), 2 )
4083 main.log.report(
4084 "Time taken for IPv6 Ping All: " +
4085 str( timeDiff ) +
4086 " seconds" )
4087 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4088 onpass="PING ALL PASS",
4089 onfail="PING ALL FAIL" )
4090
GlennRCbddd58f2015-10-01 15:45:25 -07004091 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004092 utilities.assert_equals(
4093 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004094 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004095 onpass="IPv6 Ping across 600 Point intents test PASS",
4096 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4097
4098 def CASE191( self ):
4099 """
4100 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4101 """
4102 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4103 main.log.report( "_________________________________________________" )
4104 import itertools
4105 import time
4106 main.case( "IPv6 ping all 600 Point intents" )
4107 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004108 pingResult = main.FALSE
4109 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004110 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004111 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004112 main.log.warn("First pingall failed. Retrying...")
4113 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004114 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004115 time2 = time.time()
4116 timeDiff = round( ( time2 - time1 ), 2 )
4117 main.log.report(
4118 "Time taken for IPv6 Ping All: " +
4119 str( timeDiff ) +
4120 " seconds" )
4121 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4122 onpass="PING ALL PASS",
4123 onfail="PING ALL FAIL" )
4124
GlennRCbddd58f2015-10-01 15:45:25 -07004125 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004126 utilities.assert_equals(
4127 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004128 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004129 onpass="IPv6 Ping across 600 Point intents test PASS",
4130 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4131
4132 def CASE192( self ):
4133 """
4134 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4135 """
4136 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4137 main.log.report( "_________________________________________________" )
4138 import itertools
4139 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004140 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004141 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004142 pingResult = main.FALSE
4143 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004144 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004145 if not pingResult:
4146 main.log.warn("First pingall failed. Retrying...")
4147 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004148 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004149 time2 = time.time()
4150 timeDiff = round( ( time2 - time1 ), 2 )
4151 main.log.report(
4152 "Time taken for IPv6 Ping All: " +
4153 str( timeDiff ) +
4154 " seconds" )
4155 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4156 onpass="PING ALL PASS",
4157 onfail="PING ALL FAIL" )
4158
GlennRCbddd58f2015-10-01 15:45:25 -07004159 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004160 utilities.assert_equals(
4161 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004162 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004163 onpass="IPv6 Ping across 4556 Point intents test PASS",
4164 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004165
Hari Krishnac195f3b2015-07-08 20:02:24 -07004166 def CASE10( self ):
4167 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004168 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004169 """
4170 Remove all Intents
4171 """
4172 main.log.report( "Remove all intents that were installed previously" )
4173 main.log.report( "______________________________________________" )
4174 main.log.info( "Remove all intents" )
4175 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004176 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004177 main.step( "Obtain the intent id's first" )
4178 intentsList = main.ONOScli1.getAllIntentIds()
4179 ansi_escape = re.compile( r'\x1b[^m]*m' )
4180 intentsList = ansi_escape.sub( '', intentsList )
4181 intentsList = intentsList.replace(
4182 " onos:intents | grep id=",
4183 "" ).replace(
4184 "id=",
4185 "" ).replace(
4186 "\r\r",
4187 "" )
4188 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004189 intentIdList = []
4190 step1Result = main.TRUE
4191 moreIntents = main.TRUE
4192 removeIntentCount = 0
4193 intentsCount = len(intentsList)
4194 main.log.info ( "Current number of intents: " + str(intentsCount) )
4195 if ( len( intentsList ) > 1 ):
4196 results = main.TRUE
4197 main.log.info("Removing intent...")
4198 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004199 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004200 if removeIntentCount == 5:
4201 break
4202 removeIntentCount = removeIntentCount + 1
4203 intentsList1 = main.ONOScli1.getAllIntentIds()
4204 if len( intentsList1 ) == 0:
4205 break
4206 ansi_escape = re.compile( r'\x1b[^m]*m' )
4207 intentsList1 = ansi_escape.sub( '', intentsList1 )
4208 intentsList1 = intentsList1.replace(
4209 " onos:intents | grep id=",
4210 "" ).replace(
4211 " state=",
4212 "" ).replace(
4213 "\r\r",
4214 "" )
4215 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004216 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4217 print intentsList1
4218 intentIdList1 = []
4219 if ( len( intentsList1 ) > 0 ):
4220 moreIntents = main.TRUE
4221 for i in range( len( intentsList1 ) ):
4222 intentsTemp1 = intentsList1[ i ].split( ',' )
4223 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4224 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4225 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4226 time1 = time.time()
4227 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4228 pool = []
4229 for cli in main.CLIs:
4230 if i >= len( intentIdList1 ):
4231 break
4232 t = main.Thread( target=cli.removeIntent,
4233 threadID=main.threadID,
4234 name="removeIntent",
4235 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4236 pool.append(t)
4237 t.start()
4238 i = i + 1
4239 main.threadID = main.threadID + 1
4240 for thread in pool:
4241 thread.join()
4242 intentIdList.append(thread.result)
4243 #time.sleep(2)
4244 time2 = time.time()
4245 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004246 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004247 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004248 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004249 else:
4250 time.sleep(10)
4251 if len( main.ONOScli1.intents()):
4252 continue
4253 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004254 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004255 else:
4256 print "Removed %d intents" %(intentsCount)
4257 step1Result = main.TRUE
4258 else:
4259 print "No Intent IDs found in Intents list: ", intentsList
4260 step1Result = main.FALSE
4261
4262 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004263 caseResult = step1Result
4264 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004265 onpass="Intent removal test successful",
4266 onfail="Intent removal test failed" )
4267
4268 def CASE12( self, main ):
4269 """
4270 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4271 """
4272 import re
4273 import copy
4274 import time
4275
Hari Krishnac195f3b2015-07-08 20:02:24 -07004276 threadID = 0
4277
4278 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4279 main.log.report( "_____________________________________________________" )
4280 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4281 main.step( "Enable intent based Reactive forwarding" )
4282 installResult = main.FALSE
4283 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004284
Hari Krishnac195f3b2015-07-08 20:02:24 -07004285 pool = []
4286 time1 = time.time()
4287 for cli,feature in main.CLIs:
4288 t = main.Thread(target=cli,threadID=threadID,
4289 name="featureInstall",args=[feature])
4290 pool.append(t)
4291 t.start()
4292 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004293
Hari Krishnac195f3b2015-07-08 20:02:24 -07004294 results = []
4295 for thread in pool:
4296 thread.join()
4297 results.append(thread.result)
4298 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004299
Hari Krishnac195f3b2015-07-08 20:02:24 -07004300 if( all(result == main.TRUE for result in results) == False):
4301 main.log.info("Did not install onos-app-ifwd feature properly")
4302 #main.cleanup()
4303 #main.exit()
4304 else:
4305 main.log.info("Successful feature:install onos-app-ifwd")
4306 installResult = main.TRUE
4307 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004308
GlennRC6ac11b12015-10-21 17:41:28 -07004309 main.step( "Verify Ping across all hosts" )
4310 for i in range(main.numPings):
4311 time1 = time.time()
4312 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4313 if not pingResult:
4314 main.log.warn("First pingall failed. Retrying...")
4315 time.sleep(main.pingSleep)
4316 else: break
4317
Hari Krishnac195f3b2015-07-08 20:02:24 -07004318 time2 = time.time()
4319 timeDiff = round( ( time2 - time1 ), 2 )
4320 main.log.report(
4321 "Time taken for Ping All: " +
4322 str( timeDiff ) +
4323 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004324
GlennRC626ba132015-09-18 16:16:31 -07004325 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004326 main.log.report( "Pingall Test in Reactive mode successful" )
4327 else:
4328 main.log.report( "Pingall Test in Reactive mode failed" )
4329
4330 main.step( "Disable Intent based Reactive forwarding" )
4331 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004332
Hari Krishnac195f3b2015-07-08 20:02:24 -07004333 pool = []
4334 time1 = time.time()
4335 for cli,feature in main.CLIs:
4336 t = main.Thread(target=cli,threadID=threadID,
4337 name="featureUninstall",args=[feature])
4338 pool.append(t)
4339 t.start()
4340 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004341
Hari Krishnac195f3b2015-07-08 20:02:24 -07004342 results = []
4343 for thread in pool:
4344 thread.join()
4345 results.append(thread.result)
4346 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004347
Hari Krishnac195f3b2015-07-08 20:02:24 -07004348 if( all(result == main.TRUE for result in results) == False):
4349 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4350 uninstallResult = main.FALSE
4351 #main.cleanup()
4352 #main.exit()
4353 else:
4354 main.log.info("Successful feature:uninstall onos-app-ifwd")
4355 uninstallResult = main.TRUE
4356 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4357
4358 # Waiting for reative flows to be cleared.
4359 time.sleep( 10 )
4360
GlennRCbddd58f2015-10-01 15:45:25 -07004361 caseResult = installResult and pingResult and uninstallResult
4362 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004363 onpass="Intent based Reactive forwarding Pingall test PASS",
4364 onfail="Intent based Reactive forwarding Pingall test FAIL" )