blob: a1a16101748e7f64b47c60238d30c542d5313d8f [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
30 main.pingTimeout = 300
31 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070032 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
33 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070034 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070036 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070037 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070038 main.intentCheck = int( main.params['TEST']['intentChecks'] )
39 main.numPings = int( main.params['TEST']['numPings'] )
GlennRC6ac11b12015-10-21 17:41:28 -070040 main.pingSleep = int( main.params['timers']['pingSleep'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070041 main.newTopo = ""
42 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070043
GlennRC9e7465e2015-10-02 13:50:36 -070044 main.failSwitch = True if main.failSwitch == "on" else False
45 main.emailOnStop = True if main.emailOnStop == "on" else False
46
Hari Krishnac195f3b2015-07-08 20:02:24 -070047 for i in range( 1, int(main.numCtrls) + 1 ):
48 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070049
50 main.case( "Set up test environment" )
51 main.log.report( "Set up test environment" )
52 main.log.report( "_______________________" )
53
Hari Krishna6185fc12015-07-13 15:42:31 -070054 main.step( "Apply Cell environment for ONOS" )
55 if ( main.onoscell ):
56 cellName = main.onoscell
57 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070058 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
59 onpass="Test step PASS",
60 onfail="Test step FAIL" )
61 else:
62 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
63 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
64 main.clean()
65 main.exit()
66
Hari Krishnac195f3b2015-07-08 20:02:24 -070067 main.step( "Git checkout and pull " + git_branch )
68 if git_pull == 'on':
69 checkout_result = main.ONOSbench.gitCheckout( git_branch )
70 pull_result = main.ONOSbench.gitPull()
71 cp_result = ( checkout_result and pull_result )
72 else:
73 checkout_result = main.TRUE
74 pull_result = main.TRUE
75 main.log.info( "Skipped git checkout and pull" )
76 cp_result = ( checkout_result and pull_result )
77 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
78 onpass="Test step PASS",
79 onfail="Test step FAIL" )
80
81 main.step( "mvn clean & install" )
82 if git_pull == 'on':
83 mvn_result = main.ONOSbench.cleanInstall()
84 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
85 onpass="Test step PASS",
86 onfail="Test step FAIL" )
87 else:
88 mvn_result = main.TRUE
89 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
90
91 main.ONOSbench.getVersion( report=True )
92
Hari Krishnac195f3b2015-07-08 20:02:24 -070093 main.step( "Create ONOS package" )
94 packageResult = main.ONOSbench.onosPackage()
95 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
96 onpass="Test step PASS",
97 onfail="Test step FAIL" )
98
99 main.step( "Uninstall ONOS package on all Nodes" )
100 uninstallResult = main.TRUE
101 for i in range( int( main.numCtrls ) ):
102 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
103 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
104 utilities.assert_equals( expect=main.TRUE, actual=u_result,
105 onpass="Test step PASS",
106 onfail="Test step FAIL" )
107 uninstallResult = ( uninstallResult and u_result )
108
109 main.step( "Install ONOS package on all Nodes" )
110 installResult = main.TRUE
111 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700112 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700113 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
114 utilities.assert_equals( expect=main.TRUE, actual=i_result,
115 onpass="Test step PASS",
116 onfail="Test step FAIL" )
117 installResult = ( installResult and i_result )
118
119 main.step( "Verify ONOS nodes UP status" )
120 statusResult = main.TRUE
121 for i in range( int( main.numCtrls ) ):
122 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
123 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
124 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
125 onpass="Test step PASS",
126 onfail="Test step FAIL" )
127 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700128
Hari Krishnac195f3b2015-07-08 20:02:24 -0700129 main.step( "Start ONOS CLI on all nodes" )
130 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700131 main.log.step(" Start ONOS cli using thread ")
132 startCliResult = main.TRUE
133 pool = []
134 time1 = time.time()
135 for i in range( int( main.numCtrls) ):
136 t = main.Thread( target=main.CLIs[i].startOnosCli,
137 threadID=main.threadID,
138 name="startOnosCli",
139 args=[ main.onosIPs[i], karafTimeout ] )
140 pool.append(t)
141 t.start()
142 main.threadID = main.threadID + 1
143 for t in pool:
144 t.join()
145 startCliResult = startCliResult and t.result
146 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700147
Hari Krishnac195f3b2015-07-08 20:02:24 -0700148 if not startCliResult:
149 main.log.info("ONOS CLI did not start up properly")
150 main.cleanup()
151 main.exit()
152 else:
153 main.log.info("Successful CLI startup")
154 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700155
156 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
157 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
158 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
159 cfgResult = cfgResult1 and cfgResult2
160 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
161 onpass="ipv6NeighborDiscovery cfg is set to true",
162 onfail="Failed to cfg set ipv6NeighborDiscovery" )
163
164 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700165 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
166 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
167 onpass="Set up test environment PASS",
168 onfail="Set up test environment FAIL" )
169
170 def CASE20( self, main ):
171 """
172 This test script Loads a new Topology (Att) on CHO setup and balances all switches
173 """
174 import re
175 import time
176 import copy
177
178 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
179 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
180 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
181 main.pingTimeout = 300
182 main.log.report(
183 "Load Att topology and Balance all Mininet switches across controllers" )
184 main.log.report(
185 "________________________________________________________________________" )
186 main.case(
187 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700188
Hari Krishnac195f3b2015-07-08 20:02:24 -0700189 main.step( "Stop any previous Mininet network topology" )
190 cliResult = main.TRUE
191 if main.newTopo == main.params['TOPO3']['topo']:
192 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
193
194 main.step( "Start Mininet with Att topology" )
195 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700196 mininetDir = main.Mininet1.home + "/custom/"
197 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
198 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
199 topoPath = mininetDir + main.newTopo
200 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700201
Hari Krishnac195f3b2015-07-08 20:02:24 -0700202 main.step( "Assign switches to controllers" )
203 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
204 main.Mininet1.assignSwController(
205 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700206 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700207
208 switch_mastership = main.TRUE
209 for i in range( 1, ( main.numMNswitches + 1 ) ):
210 response = main.Mininet1.getSwController( "s" + str( i ) )
211 print( "Response is " + str( response ) )
212 if re.search( "tcp:" + main.onosIPs[0], response ):
213 switch_mastership = switch_mastership and main.TRUE
214 else:
215 switch_mastership = main.FALSE
216
217 if switch_mastership == main.TRUE:
218 main.log.report( "Controller assignment successfull" )
219 else:
220 main.log.report( "Controller assignment failed" )
221
222 time.sleep(30) # waiting here to make sure topology converges across all nodes
223
224 main.step( "Balance devices across controllers" )
225 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700226 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700227 time.sleep( 5 )
228
229 topology_output = main.ONOScli1.topology()
230 topology_result = main.ONOSbench.getTopology( topology_output )
231 case2Result = ( switch_mastership and startStatus )
232 utilities.assert_equals(
233 expect=main.TRUE,
234 actual=case2Result,
235 onpass="Starting new Att topology test PASS",
236 onfail="Starting new Att topology test FAIL" )
237
238 def CASE21( self, main ):
239 """
240 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
241 """
242 import re
243 import time
244 import copy
245
246 main.newTopo = main.params['TOPO2']['topo']
247 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
248 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
249 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
250 main.pingTimeout = 300
251 main.log.report(
252 "Load Chordal topology and Balance all Mininet switches across controllers" )
253 main.log.report(
254 "________________________________________________________________________" )
255 main.case(
256 "Assign and Balance all Mininet switches across controllers" )
257
258 main.step( "Stop any previous Mininet network topology" )
259 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
260
GlennRCc6cd2a62015-08-10 16:08:22 -0700261 main.step("Start Mininet with Chordal topology")
262 mininetDir = main.Mininet1.home + "/custom/"
263 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
264 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
265 topoPath = mininetDir + main.newTopo
266 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700267
268 main.step( "Assign switches to controllers" )
269
270 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
271 main.Mininet1.assignSwController(
272 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700273 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700274
275 switch_mastership = main.TRUE
276 for i in range( 1, ( main.numMNswitches + 1 ) ):
277 response = main.Mininet1.getSwController( "s" + str( i ) )
278 print( "Response is " + str( response ) )
279 if re.search( "tcp:" + main.onosIPs[0], response ):
280 switch_mastership = switch_mastership and main.TRUE
281 else:
282 switch_mastership = main.FALSE
283
284 if switch_mastership == main.TRUE:
285 main.log.report( "Controller assignment successfull" )
286 else:
287 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700288
Hari Krishnac195f3b2015-07-08 20:02:24 -0700289 main.step( "Balance devices across controllers" )
290 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700291 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700292 time.sleep( 5 )
293
GlennRCbddd58f2015-10-01 15:45:25 -0700294 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700295 time.sleep(30)
296 utilities.assert_equals(
297 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700298 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700299 onpass="Starting new Chordal topology test PASS",
300 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700301
Hari Krishnac195f3b2015-07-08 20:02:24 -0700302 def CASE22( self, main ):
303 """
304 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
305 """
306 import re
307 import time
308 import copy
309
310 main.newTopo = main.params['TOPO3']['topo']
311 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
312 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
313 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
314 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700315
Hari Krishnac195f3b2015-07-08 20:02:24 -0700316 main.log.report(
317 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
318 main.log.report(
319 "________________________________________________________________________" )
320 main.case(
321 "Assign and Balance all Mininet switches across controllers" )
322 main.step( "Stop any previous Mininet network topology" )
323 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700324
325 main.step("Start Mininet with Spine topology")
326 mininetDir = main.Mininet1.home + "/custom/"
327 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
328 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
329 topoPath = mininetDir + main.newTopo
330 startStatus = main.Mininet1.startNet(topoFile = topoPath)
331
Hari Krishnac195f3b2015-07-08 20:02:24 -0700332 time.sleep(60)
333 main.step( "Assign switches to controllers" )
334
335 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
336 main.Mininet1.assignSwController(
337 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700338 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700339
340 switch_mastership = main.TRUE
341 for i in range( 1, ( main.numMNswitches + 1 ) ):
342 response = main.Mininet1.getSwController( "s" + str( i ) )
343 print( "Response is " + str( response ) )
344 if re.search( "tcp:" + main.onosIPs[0], response ):
345 switch_mastership = switch_mastership and main.TRUE
346 else:
347 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700348
Hari Krishnac195f3b2015-07-08 20:02:24 -0700349 if switch_mastership == main.TRUE:
350 main.log.report( "Controller assignment successfull" )
351 else:
352 main.log.report( "Controller assignment failed" )
353 time.sleep( 5 )
354
355 main.step( "Balance devices across controllers" )
356 for i in range( int( main.numCtrls ) ):
357 balanceResult = main.ONOScli1.balanceMasters()
358 # giving some breathing time for ONOS to complete re-balance
359 time.sleep( 3 )
360
GlennRCbddd58f2015-10-01 15:45:25 -0700361 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700362 time.sleep(60)
363 utilities.assert_equals(
364 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700365 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700366 onpass="Starting new Spine topology test PASS",
367 onfail="Starting new Spine topology test FAIL" )
368
369 def CASE3( self, main ):
370 """
371 This Test case will be extended to collect and store more data related
372 ONOS state.
373 """
374 import re
375 import copy
376 main.deviceDPIDs = []
377 main.hostMACs = []
378 main.deviceLinks = []
379 main.deviceActiveLinksCount = []
380 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700381
Hari Krishnac195f3b2015-07-08 20:02:24 -0700382 main.log.report(
383 "Collect and Store topology details from ONOS before running any Tests" )
384 main.log.report(
385 "____________________________________________________________________" )
386 main.case( "Collect and Store Topology Details from ONOS" )
387 main.step( "Collect and store current number of switches and links" )
388 topology_output = main.ONOScli1.topology()
389 topology_result = main.ONOSbench.getTopology( topology_output )
390 numOnosDevices = topology_result[ 'devices' ]
391 numOnosLinks = topology_result[ 'links' ]
392 topoResult = main.TRUE
393
394 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
395 main.step( "Store Device DPIDs" )
396 for i in range( 1, (main.numMNswitches+1) ):
397 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
398 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
399
400 main.step( "Store Host MACs" )
401 for i in range( 1, ( main.numMNhosts + 1 ) ):
402 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
403 print "Host MACs in Store: \n", str( main.hostMACs )
404 main.MACsDict = {}
405 print "Creating dictionary of DPID and HostMacs"
406 for i in range(len(main.hostMACs)):
407 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
408 print main.MACsDict
409 main.step( "Collect and store all Devices Links" )
410 linksResult = main.ONOScli1.links( jsonFormat=False )
411 ansi_escape = re.compile( r'\x1b[^m]*m' )
412 linksResult = ansi_escape.sub( '', linksResult )
413 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
414 linksResult = linksResult.splitlines()
415 main.deviceLinks = copy.copy( linksResult )
416 print "Device Links Stored: \n", str( main.deviceLinks )
417 # this will be asserted to check with the params provided count of
418 # links
419 print "Length of Links Store", len( main.deviceLinks )
420
421 main.step( "Collect and store each Device ports enabled Count" )
422 time1 = time.time()
423 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
424 pool = []
425 for cli in main.CLIs:
426 if i >= main.numMNswitches + 1:
427 break
428 dpid = "of:00000000000000" + format( i,'02x' )
429 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
430 t.start()
431 pool.append(t)
432 i = i + 1
433 main.threadID = main.threadID + 1
434 for thread in pool:
435 thread.join()
436 portResult = thread.result
437 main.devicePortsEnabledCount.append( portResult )
438 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
439 time2 = time.time()
440 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
441
442 main.step( "Collect and store each Device active links Count" )
443 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700444
Hari Krishnac195f3b2015-07-08 20:02:24 -0700445 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
446 pool = []
447 for cli in main.CLIs:
448 if i >= main.numMNswitches + 1:
449 break
450 dpid = "of:00000000000000" + format( i,'02x' )
451 t = main.Thread( target = cli.getDeviceLinksActiveCount,
452 threadID = main.threadID,
453 name = "getDevicePortsEnabledCount",
454 args = [dpid])
455 t.start()
456 pool.append(t)
457 i = i + 1
458 main.threadID = main.threadID + 1
459 for thread in pool:
460 thread.join()
461 linkCountResult = thread.result
462 main.deviceActiveLinksCount.append( linkCountResult )
463 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
464 time2 = time.time()
465 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
466
467 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700468 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700469 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
470 main.log.info("Devices (actual): %s, Links (actual): %s" %
471 ( numOnosDevices , numOnosLinks ) )
472 main.log.info("Topology does not match, exiting CHO test...")
473 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700474 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700475 main.cleanup()
476 main.exit()
477
478 # just returning TRUE for now as this one just collects data
479 case3Result = topoResult
480 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
481 onpass="Saving ONOS topology data test PASS",
482 onfail="Saving ONOS topology data test FAIL" )
483
484 def CASE40( self, main ):
485 """
486 Verify Reactive forwarding (Att Topology)
487 """
488 import re
489 import copy
490 import time
491 main.log.report( "Verify Reactive forwarding (Att Topology)" )
492 main.log.report( "______________________________________________" )
493 main.case( "Enable Reactive forwarding and Verify ping all" )
494 main.step( "Enable Reactive forwarding" )
495 installResult = main.TRUE
496 # Activate fwd app
497 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
498 appCheck = main.TRUE
499 pool = []
500 for cli in main.CLIs:
501 t = main.Thread( target=cli.appToIDCheck,
502 name="appToIDCheck-" + str( i ),
503 args=[] )
504 pool.append( t )
505 t.start()
506 for t in pool:
507 t.join()
508 appCheck = appCheck and t.result
509 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
510 onpass="App Ids seem to be correct",
511 onfail="Something is wrong with app Ids" )
512 if appCheck != main.TRUE:
513 main.log.warn( main.CLIs[0].apps() )
514 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700515
Hari Krishnac195f3b2015-07-08 20:02:24 -0700516 time.sleep( 10 )
517
GlennRC6ac11b12015-10-21 17:41:28 -0700518 main.step( "Verify Ping across all hosts" )
519 for i in range(main.numPings):
520 time1 = time.time()
521 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
522 if not pingResult:
523 main.log.warn("First pingall failed. Retrying...")
524 time.sleep(main.pingSleep)
525 else: break
526
Hari Krishnac195f3b2015-07-08 20:02:24 -0700527 time2 = time.time()
528 timeDiff = round( ( time2 - time1 ), 2 )
529 main.log.report(
530 "Time taken for Ping All: " +
531 str( timeDiff ) +
532 " seconds" )
533
GlennRC626ba132015-09-18 16:16:31 -0700534 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700535 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700536 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700537 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700538
GlennRCbddd58f2015-10-01 15:45:25 -0700539 caseResult = appCheck and pingResult
540 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700541 onpass="Reactive Mode IPv4 Pingall test PASS",
542 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700543
544 def CASE41( self, main ):
545 """
546 Verify Reactive forwarding (Chordal Topology)
547 """
548 import re
549 import copy
550 import time
551 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
552 main.log.report( "______________________________________________" )
553 main.case( "Enable Reactive forwarding and Verify ping all" )
554 main.step( "Enable Reactive forwarding" )
555 installResult = main.TRUE
556 # Activate fwd app
557 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
558
559 appCheck = main.TRUE
560 pool = []
561 for cli in main.CLIs:
562 t = main.Thread( target=cli.appToIDCheck,
563 name="appToIDCheck-" + str( i ),
564 args=[] )
565 pool.append( t )
566 t.start()
567 for t in pool:
568 t.join()
569 appCheck = appCheck and t.result
570 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
571 onpass="App Ids seem to be correct",
572 onfail="Something is wrong with app Ids" )
573 if appCheck != main.TRUE:
574 main.log.warn( main.CLIs[0].apps() )
575 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700576
Hari Krishnac195f3b2015-07-08 20:02:24 -0700577 time.sleep( 10 )
578
GlennRC6ac11b12015-10-21 17:41:28 -0700579 main.step( "Verify Ping across all hosts" )
580 for i in range(main.numPings):
581 time1 = time.time()
582 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
583 if not pingResult:
584 main.log.warn("First pingall failed. Retrying...")
585 time.sleep(main.pingSleep)
586 else: break
587
Hari Krishnac195f3b2015-07-08 20:02:24 -0700588 time2 = time.time()
589 timeDiff = round( ( time2 - time1 ), 2 )
590 main.log.report(
591 "Time taken for Ping All: " +
592 str( timeDiff ) +
593 " seconds" )
594
GlennRC626ba132015-09-18 16:16:31 -0700595 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700596 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700597 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700598 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700599
GlennRCbddd58f2015-10-01 15:45:25 -0700600 caseResult = appCheck and pingResult
601 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700602 onpass="Reactive Mode IPv4 Pingall test PASS",
603 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700604
605 def CASE42( self, main ):
606 """
607 Verify Reactive forwarding (Spine Topology)
608 """
609 import re
610 import copy
611 import time
612 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
613 main.log.report( "______________________________________________" )
614 main.case( "Enable Reactive forwarding and Verify ping all" )
615 main.step( "Enable Reactive forwarding" )
616 installResult = main.TRUE
617 # Activate fwd app
618 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
619
620 appCheck = main.TRUE
621 pool = []
622 for cli in main.CLIs:
623 t = main.Thread( target=cli.appToIDCheck,
624 name="appToIDCheck-" + str( i ),
625 args=[] )
626 pool.append( t )
627 t.start()
628 for t in pool:
629 t.join()
630 appCheck = appCheck and t.result
631 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
632 onpass="App Ids seem to be correct",
633 onfail="Something is wrong with app Ids" )
634 if appCheck != main.TRUE:
635 main.log.warn( main.CLIs[0].apps() )
636 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700637
Hari Krishnac195f3b2015-07-08 20:02:24 -0700638 time.sleep( 10 )
639
GlennRC6ac11b12015-10-21 17:41:28 -0700640 main.step( "Verify Ping across all hosts" )
641 for i in range(main.numPings):
642 time1 = time.time()
643 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
644 if not pingResult:
645 main.log.warn("First pingall failed. Retrying...")
646 time.sleep(main.pingSleep)
647 else: break
648
Hari Krishnac195f3b2015-07-08 20:02:24 -0700649 time2 = time.time()
650 timeDiff = round( ( time2 - time1 ), 2 )
651 main.log.report(
652 "Time taken for Ping All: " +
653 str( timeDiff ) +
654 " seconds" )
655
GlennRC626ba132015-09-18 16:16:31 -0700656 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700657 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700658 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700659 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
660
GlennRCbddd58f2015-10-01 15:45:25 -0700661 caseResult = appCheck and pingResult
662 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700663 onpass="Reactive Mode IPv4 Pingall test PASS",
664 onfail="Reactive Mode IPv4 Pingall test FAIL" )
665
666 def CASE140( self, main ):
667 """
668 Verify IPv6 Reactive forwarding (Att Topology)
669 """
670 import re
671 import copy
672 import time
673 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
674 main.log.report( "______________________________________________" )
675 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
676 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
677
678 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
679 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
680 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
681 cfgResult = cfgResult1 and cfgResult2
682 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
683 onpass="Reactive mode ipv6Fowarding cfg is set to true",
684 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
685
686 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700687 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700688 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700689 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
690 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700691 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700692 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700693 time2 = time.time()
694 timeDiff = round( ( time2 - time1 ), 2 )
695 main.log.report(
696 "Time taken for IPv6 Ping All: " +
697 str( timeDiff ) +
698 " seconds" )
699
GlennRC626ba132015-09-18 16:16:31 -0700700 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700701 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
702 else:
703 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700704
705 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700706
Hari Krishnac195f3b2015-07-08 20:02:24 -0700707 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700708 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700709 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
710 pool = []
711 for cli in main.CLIs:
712 t = main.Thread( target=cli.appToIDCheck,
713 name="appToIDCheck-" + str( i ),
714 args=[] )
715 pool.append( t )
716 t.start()
717
718 for t in pool:
719 t.join()
720 appCheck = appCheck and t.result
721 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
722 onpass="App Ids seem to be correct",
723 onfail="Something is wrong with app Ids" )
724 if appCheck != main.TRUE:
725 main.log.warn( main.CLIs[0].apps() )
726 main.log.warn( main.CLIs[0].appIDs() )
727
728 # Waiting for reative flows to be cleared.
729 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700730 caseResult = appCheck and cfgResult and pingResult
731 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700732 onpass="Reactive Mode IPv6 Pingall test PASS",
733 onfail="Reactive Mode IPv6 Pingall test FAIL" )
734
735 def CASE141( self, main ):
736 """
737 Verify IPv6 Reactive forwarding (Chordal Topology)
738 """
739 import re
740 import copy
741 import time
742 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
743 main.log.report( "______________________________________________" )
744 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
745 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
746
747 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
748 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
749 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
750 cfgResult = cfgResult1 and cfgResult2
751 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
752 onpass="Reactive mode ipv6Fowarding cfg is set to true",
753 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
754
755 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700756 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700757 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700758 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
759 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700760 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700761 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700762 time2 = time.time()
763 timeDiff = round( ( time2 - time1 ), 2 )
764 main.log.report(
765 "Time taken for IPv6 Ping All: " +
766 str( timeDiff ) +
767 " seconds" )
768
GlennRC626ba132015-09-18 16:16:31 -0700769 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700770 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
771 else:
772 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
773
774 main.step( "Disable Reactive forwarding" )
775
776 main.log.info( "Uninstall reactive forwarding app" )
777 appCheck = main.TRUE
778 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
779 pool = []
780 for cli in main.CLIs:
781 t = main.Thread( target=cli.appToIDCheck,
782 name="appToIDCheck-" + str( i ),
783 args=[] )
784 pool.append( t )
785 t.start()
786
787 for t in pool:
788 t.join()
789 appCheck = appCheck and t.result
790 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
791 onpass="App Ids seem to be correct",
792 onfail="Something is wrong with app Ids" )
793 if appCheck != main.TRUE:
794 main.log.warn( main.CLIs[0].apps() )
795 main.log.warn( main.CLIs[0].appIDs() )
796
797 # Waiting for reative flows to be cleared.
798 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700799 caseResult = appCheck and cfgResult and pingResult
800 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700801 onpass="Reactive Mode IPv6 Pingall test PASS",
802 onfail="Reactive Mode IPv6 Pingall test FAIL" )
803
804 def CASE142( self, main ):
805 """
806 Verify IPv6 Reactive forwarding (Spine Topology)
807 """
808 import re
809 import copy
810 import time
811 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
812 main.log.report( "______________________________________________" )
813 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
814 # Spine topology do not have hosts h1-h10
815 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
816 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
817 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
818 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
819 cfgResult = cfgResult1 and cfgResult2
820 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
821 onpass="Reactive mode ipv6Fowarding cfg is set to true",
822 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
823
824 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700825 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700826 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700827 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
828 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700829 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700830 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700831 time2 = time.time()
832 timeDiff = round( ( time2 - time1 ), 2 )
833 main.log.report(
834 "Time taken for IPv6 Ping All: " +
835 str( timeDiff ) +
836 " seconds" )
837
GlennRC626ba132015-09-18 16:16:31 -0700838 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700839 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
840 else:
841 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
842
843 main.step( "Disable Reactive forwarding" )
844
845 main.log.info( "Uninstall reactive forwarding app" )
846 appCheck = main.TRUE
847 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
848 pool = []
849 for cli in main.CLIs:
850 t = main.Thread( target=cli.appToIDCheck,
851 name="appToIDCheck-" + str( i ),
852 args=[] )
853 pool.append( t )
854 t.start()
855
856 for t in pool:
857 t.join()
858 appCheck = appCheck and t.result
859 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
860 onpass="App Ids seem to be correct",
861 onfail="Something is wrong with app Ids" )
862 if appCheck != main.TRUE:
863 main.log.warn( main.CLIs[0].apps() )
864 main.log.warn( main.CLIs[0].appIDs() )
865
866 # Waiting for reative flows to be cleared.
867 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700868 caseResult = appCheck and cfgResult and pingResult
869 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700870 onpass="Reactive Mode IPv6 Pingall test PASS",
871 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700872
873 def CASE5( self, main ):
874 """
875 Compare current ONOS topology with reference data
876 """
877 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700878
Hari Krishnac195f3b2015-07-08 20:02:24 -0700879 devicesDPIDTemp = []
880 hostMACsTemp = []
881 deviceLinksTemp = []
882 deviceActiveLinksCountTemp = []
883 devicePortsEnabledCountTemp = []
884
885 main.log.report(
886 "Compare ONOS topology with reference data in Stores" )
887 main.log.report( "__________________________________________________" )
888 main.case( "Compare ONOS topology with reference data" )
889
890 main.step( "Compare current Device ports enabled with reference" )
891 time1 = time.time()
892 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
893 pool = []
894 for cli in main.CLIs:
895 if i >= main.numMNswitches + 1:
896 break
897 dpid = "of:00000000000000" + format( i,'02x' )
898 t = main.Thread(target = cli.getDevicePortsEnabledCount,
899 threadID = main.threadID,
900 name = "getDevicePortsEnabledCount",
901 args = [dpid])
902 t.start()
903 pool.append(t)
904 i = i + 1
905 main.threadID = main.threadID + 1
906 for thread in pool:
907 thread.join()
908 portResult = thread.result
909 #portTemp = re.split( r'\t+', portResult )
910 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
911 devicePortsEnabledCountTemp.append( portResult )
912
913 time2 = time.time()
914 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
915 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700916 "Device Enabled ports EXPECTED: %s" %
917 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700918 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700919 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700920 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700921
Hari Krishnac195f3b2015-07-08 20:02:24 -0700922 if ( cmp( main.devicePortsEnabledCount,
923 devicePortsEnabledCountTemp ) == 0 ):
924 stepResult1 = main.TRUE
925 else:
926 stepResult1 = main.FALSE
927
928 main.step( "Compare Device active links with reference" )
929 time1 = time.time()
930 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
931 pool = []
932 for cli in main.CLIs:
933 if i >= main.numMNswitches + 1:
934 break
935 dpid = "of:00000000000000" + format( i,'02x' )
936 t = main.Thread(target = cli.getDeviceLinksActiveCount,
937 threadID = main.threadID,
938 name = "getDeviceLinksActiveCount",
939 args = [dpid])
940 t.start()
941 pool.append(t)
942 i = i + 1
943 main.threadID = main.threadID + 1
944 for thread in pool:
945 thread.join()
946 linkCountResult = thread.result
947 #linkCountTemp = re.split( r'\t+', linkCountResult )
948 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
949 deviceActiveLinksCountTemp.append( linkCountResult )
950
951 time2 = time.time()
952 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
953 main.log.info (
954 "Device Active links EXPECTED: %s" %
955 str( main.deviceActiveLinksCount ) )
956 main.log.info (
957 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
958 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
959 stepResult2 = main.TRUE
960 else:
961 stepResult2 = main.FALSE
962
963 """
964 place holder for comparing devices, hosts, paths and intents if required.
965 Links and ports data would be incorrect with out devices anyways.
966 """
967 case5Result = ( stepResult1 and stepResult2 )
968 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
969 onpass="Compare Topology test PASS",
970 onfail="Compare Topology test FAIL" )
971
972 def CASE60( self ):
973 """
974 Install 300 host intents and verify ping all (Att Topology)
975 """
976 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
977 main.log.report( "_______________________________________" )
978 import itertools
979 import time
980 main.case( "Install 300 host intents" )
981 main.step( "Add host Intents" )
982 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700983 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
984
Hari Krishnac195f3b2015-07-08 20:02:24 -0700985 intentIdList = []
986 time1 = time.time()
987 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
988 pool = []
989 for cli in main.CLIs:
990 if i >= len( hostCombos ):
991 break
992 t = main.Thread( target=cli.addHostIntent,
993 threadID=main.threadID,
994 name="addHostIntent",
995 args=[hostCombos[i][0],hostCombos[i][1]])
996 pool.append(t)
997 t.start()
998 i = i + 1
999 main.threadID = main.threadID + 1
1000 for thread in pool:
1001 thread.join()
1002 intentIdList.append(thread.result)
1003 time2 = time.time()
1004 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1005
GlennRCfcfdc4f2015-09-30 16:01:57 -07001006 # Saving intent ids to check intents in later cases
1007 main.intentIds = list(intentIdList)
1008
GlennRCa8d786a2015-09-23 17:40:11 -07001009 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001010
GlennRC1dde1712015-10-02 11:03:08 -07001011 # Giving onos multiple chances to install intents
1012 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001013 if i != 0:
1014 main.log.warn( "Verification failed. Retrying..." )
1015 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001016 time.sleep( main.checkIntentsDelay )
1017
1018 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001019 for e in range(int(main.numCtrls)):
1020 main.log.info( "Checking intents on CLI %s" % (e+1) )
1021 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1022 intentState
1023 if not intentState:
1024 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001025 if intentState:
1026 break
GlennRCdb2c8422015-09-29 12:21:59 -07001027 else:
1028 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001029 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001030
GlennRCa8d786a2015-09-23 17:40:11 -07001031
1032 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1033 onpass="INTENTS INSTALLED",
1034 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001035
1036 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001037 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001038 time1 = time.time()
1039 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001040 if not pingResult:
1041 main.log.warn("First pingall failed. Retrying...")
1042 time.sleep(3)
1043 else: break
1044
Hari Krishnac195f3b2015-07-08 20:02:24 -07001045 time2 = time.time()
1046 timeDiff = round( ( time2 - time1 ), 2 )
1047 main.log.report(
1048 "Time taken for Ping All: " +
1049 str( timeDiff ) +
1050 " seconds" )
1051 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1052 onpass="PING ALL PASS",
1053 onfail="PING ALL FAIL" )
1054
GlennRCbddd58f2015-10-01 15:45:25 -07001055 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001056 utilities.assert_equals(
1057 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001058 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001059 onpass="Install 300 Host Intents and Ping All test PASS",
1060 onfail="Install 300 Host Intents and Ping All test FAIL" )
1061
GlennRCfcfdc4f2015-09-30 16:01:57 -07001062 if not intentState:
1063 main.log.debug( "Intents failed to install completely" )
1064 if not pingResult:
1065 main.log.debug( "Pingall failed" )
1066
GlennRCbddd58f2015-10-01 15:45:25 -07001067 if not caseResult and main.failSwitch:
1068 main.log.report("Stopping test")
1069 main.stop( email=main.emailOnStop )
1070
Hari Krishnac195f3b2015-07-08 20:02:24 -07001071 def CASE61( self ):
1072 """
1073 Install 600 host intents and verify ping all for Chordal Topology
1074 """
1075 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1076 main.log.report( "_______________________________________" )
1077 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001078
Hari Krishnac195f3b2015-07-08 20:02:24 -07001079 main.case( "Install 600 host intents" )
1080 main.step( "Add host Intents" )
1081 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001082 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1083
Hari Krishnac195f3b2015-07-08 20:02:24 -07001084 intentIdList = []
1085 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001086
Hari Krishnac195f3b2015-07-08 20:02:24 -07001087 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1088 pool = []
1089 for cli in main.CLIs:
1090 if i >= len( hostCombos ):
1091 break
1092 t = main.Thread( target=cli.addHostIntent,
1093 threadID=main.threadID,
1094 name="addHostIntent",
1095 args=[hostCombos[i][0],hostCombos[i][1]])
1096 pool.append(t)
1097 t.start()
1098 i = i + 1
1099 main.threadID = main.threadID + 1
1100 for thread in pool:
1101 thread.join()
1102 intentIdList.append(thread.result)
1103 time2 = time.time()
1104 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001105
GlennRCfcfdc4f2015-09-30 16:01:57 -07001106 # Saving intent ids to check intents in later cases
1107 main.intentIds = list(intentIdList)
1108
GlennRCa8d786a2015-09-23 17:40:11 -07001109 main.step("Verify intents are installed")
1110
GlennRC1dde1712015-10-02 11:03:08 -07001111 # Giving onos multiple chances to install intents
1112 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001113 if i != 0:
1114 main.log.warn( "Verification failed. Retrying..." )
1115 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001116 time.sleep( main.checkIntentsDelay )
1117
1118 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001119 for e in range(int(main.numCtrls)):
1120 main.log.info( "Checking intents on CLI %s" % (e+1) )
1121 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1122 intentState
1123 if not intentState:
1124 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001125 if intentState:
1126 break
GlennRCdb2c8422015-09-29 12:21:59 -07001127 else:
1128 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001129 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001130
1131 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1132 onpass="INTENTS INSTALLED",
1133 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001134
1135 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001136 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001137 time1 = time.time()
1138 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001139 if not pingResult:
1140 main.log.warn("First pingall failed. Retrying...")
1141 time.sleep(main.pingSleep)
1142 else: break
1143
Hari Krishnac195f3b2015-07-08 20:02:24 -07001144 time2 = time.time()
1145 timeDiff = round( ( time2 - time1 ), 2 )
1146 main.log.report(
1147 "Time taken for Ping All: " +
1148 str( timeDiff ) +
1149 " seconds" )
1150 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1151 onpass="PING ALL PASS",
1152 onfail="PING ALL FAIL" )
1153
GlennRCbddd58f2015-10-01 15:45:25 -07001154 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001155
Hari Krishnac195f3b2015-07-08 20:02:24 -07001156 utilities.assert_equals(
1157 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001158 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001159 onpass="Install 300 Host Intents and Ping All test PASS",
1160 onfail="Install 300 Host Intents and Ping All test FAIL" )
1161
GlennRCfcfdc4f2015-09-30 16:01:57 -07001162 if not intentState:
1163 main.log.debug( "Intents failed to install completely" )
1164 if not pingResult:
1165 main.log.debug( "Pingall failed" )
1166
GlennRCbddd58f2015-10-01 15:45:25 -07001167 if not caseResult and main.failSwitch:
1168 main.log.report("Stopping test")
1169 main.stop( email=main.emailOnStop )
1170
Hari Krishnac195f3b2015-07-08 20:02:24 -07001171 def CASE62( self ):
1172 """
1173 Install 2278 host intents and verify ping all for Spine Topology
1174 """
1175 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1176 main.log.report( "_______________________________________" )
1177 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001178
Hari Krishnac195f3b2015-07-08 20:02:24 -07001179 main.case( "Install 2278 host intents" )
1180 main.step( "Add host Intents" )
1181 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001182 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001183 main.pingTimeout = 300
1184 intentIdList = []
1185 time1 = time.time()
1186 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1187 pool = []
1188 for cli in main.CLIs:
1189 if i >= len( hostCombos ):
1190 break
1191 t = main.Thread( target=cli.addHostIntent,
1192 threadID=main.threadID,
1193 name="addHostIntent",
1194 args=[hostCombos[i][0],hostCombos[i][1]])
1195 pool.append(t)
1196 t.start()
1197 i = i + 1
1198 main.threadID = main.threadID + 1
1199 for thread in pool:
1200 thread.join()
1201 intentIdList.append(thread.result)
1202 time2 = time.time()
1203 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001204
GlennRCfcfdc4f2015-09-30 16:01:57 -07001205 # Saving intent ids to check intents in later cases
1206 main.intentIds = list(intentIdList)
1207
GlennRCa8d786a2015-09-23 17:40:11 -07001208 main.step("Verify intents are installed")
1209
GlennRC1dde1712015-10-02 11:03:08 -07001210 # Giving onos multiple chances to install intents
1211 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001212 if i != 0:
1213 main.log.warn( "Verification failed. Retrying..." )
1214 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001215 time.sleep( main.checkIntentsDelay )
1216
1217 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001218 for e in range(int(main.numCtrls)):
1219 main.log.info( "Checking intents on CLI %s" % (e+1) )
1220 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1221 intentState
1222 if not intentState:
1223 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001224 if intentState:
1225 break
GlennRCdb2c8422015-09-29 12:21:59 -07001226 else:
1227 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001228 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001229
1230 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1231 onpass="INTENTS INSTALLED",
1232 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001233
1234 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001235 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001236 time1 = time.time()
1237 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001238 if not pingResult:
1239 main.log.warn("First pingall failed. Retrying...")
1240 time.sleep(main.pingSleep)
1241 else: break
1242
Hari Krishnac195f3b2015-07-08 20:02:24 -07001243 time2 = time.time()
1244 timeDiff = round( ( time2 - time1 ), 2 )
1245 main.log.report(
1246 "Time taken for Ping All: " +
1247 str( timeDiff ) +
1248 " seconds" )
1249 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1250 onpass="PING ALL PASS",
1251 onfail="PING ALL FAIL" )
1252
GlennRCbddd58f2015-10-01 15:45:25 -07001253 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001254
Hari Krishnac195f3b2015-07-08 20:02:24 -07001255 utilities.assert_equals(
1256 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001257 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001258 onpass="Install 2278 Host Intents and Ping All test PASS",
1259 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1260
GlennRCfcfdc4f2015-09-30 16:01:57 -07001261 if not intentState:
1262 main.log.debug( "Intents failed to install completely" )
1263 if not pingResult:
1264 main.log.debug( "Pingall failed" )
1265
GlennRCbddd58f2015-10-01 15:45:25 -07001266 if not caseResult and main.failSwitch:
1267 main.log.report("Stopping test")
1268 main.stop( email=main.emailOnStop )
1269
Hari Krishna4223dbd2015-08-13 16:29:53 -07001270 def CASE160( self ):
1271 """
1272 Verify IPv6 ping across 300 host intents (Att Topology)
1273 """
1274 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1275 main.log.report( "_________________________________________________" )
1276 import itertools
1277 import time
1278 main.case( "IPv6 ping all 300 host intents" )
1279 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001280 pingResult = main.FALSE
1281 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001282 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001283 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001284 main.log.warn("First pingall failed. Retrying...")
1285 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001286 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001287 time2 = time.time()
1288 timeDiff = round( ( time2 - time1 ), 2 )
1289 main.log.report(
1290 "Time taken for IPv6 Ping All: " +
1291 str( timeDiff ) +
1292 " seconds" )
1293 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1294 onpass="PING ALL PASS",
1295 onfail="PING ALL FAIL" )
1296
GlennRCbddd58f2015-10-01 15:45:25 -07001297 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001298 utilities.assert_equals(
1299 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001300 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001301 onpass="IPv6 Ping across 300 host intents test PASS",
1302 onfail="IPv6 Ping across 300 host intents test FAIL" )
1303
1304 def CASE161( self ):
1305 """
1306 Verify IPv6 ping across 600 host intents (Chordal Topology)
1307 """
1308 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1309 main.log.report( "_________________________________________________" )
1310 import itertools
1311 import time
1312 main.case( "IPv6 ping all 600 host intents" )
1313 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001314 pingResult = main.FALSE
1315 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001316 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001317 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001318 main.log.warn("First pingall failed. Retrying...")
1319 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001320 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001321 time2 = time.time()
1322 timeDiff = round( ( time2 - time1 ), 2 )
1323 main.log.report(
1324 "Time taken for IPv6 Ping All: " +
1325 str( timeDiff ) +
1326 " seconds" )
1327 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1328 onpass="PING ALL PASS",
1329 onfail="PING ALL FAIL" )
1330
GlennRCbddd58f2015-10-01 15:45:25 -07001331 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001332 utilities.assert_equals(
1333 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001334 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001335 onpass="IPv6 Ping across 600 host intents test PASS",
1336 onfail="IPv6 Ping across 600 host intents test FAIL" )
1337
1338 def CASE162( self ):
1339 """
1340 Verify IPv6 ping across 2278 host intents (Spine Topology)
1341 """
1342 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1343 main.log.report( "_________________________________________________" )
1344 import itertools
1345 import time
1346 main.case( "IPv6 ping all 600 host intents" )
1347 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001348 pingResult = main.FALSE
1349 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001350 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001351 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001352 main.log.warn("First pingall failed. Retrying...")
1353 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001354 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001355 time2 = time.time()
1356 timeDiff = round( ( time2 - time1 ), 2 )
1357 main.log.report(
1358 "Time taken for IPv6 Ping All: " +
1359 str( timeDiff ) +
1360 " seconds" )
1361 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1362 onpass="PING ALL PASS",
1363 onfail="PING ALL FAIL" )
1364
GlennRCbddd58f2015-10-01 15:45:25 -07001365 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001366 utilities.assert_equals(
1367 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001368 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001369 onpass="IPv6 Ping across 600 host intents test PASS",
1370 onfail="IPv6 Ping across 600 host intents test FAIL" )
1371
Hari Krishnac195f3b2015-07-08 20:02:24 -07001372 def CASE70( self, main ):
1373 """
1374 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1375 """
1376 import random
1377 main.randomLink1 = []
1378 main.randomLink2 = []
1379 main.randomLink3 = []
1380 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1381 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1382 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1383 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1384 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1385 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1386 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1387 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1388
1389 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1390 main.log.report( "___________________________________________________________________________" )
1391 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1392 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1393 if ( int( switchLinksToToggle ) ==
1394 0 or int( switchLinksToToggle ) > 5 ):
1395 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1396 #main.cleanup()
1397 #main.exit()
1398 else:
1399 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1400
1401 main.step( "Cut links on Core devices using user provided range" )
1402 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1403 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1404 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1405 for i in range( int( switchLinksToToggle ) ):
1406 main.Mininet1.link(
1407 END1=link1End1,
1408 END2=main.randomLink1[ i ],
1409 OPTION="down" )
1410 time.sleep( link_sleep )
1411 main.Mininet1.link(
1412 END1=link2End1,
1413 END2=main.randomLink2[ i ],
1414 OPTION="down" )
1415 time.sleep( link_sleep )
1416 main.Mininet1.link(
1417 END1=link3End1,
1418 END2=main.randomLink3[ i ],
1419 OPTION="down" )
1420 time.sleep( link_sleep )
1421
Hari Krishna6185fc12015-07-13 15:42:31 -07001422 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001423 linkDown = main.ONOSbench.checkStatus(
1424 topology_output, main.numMNswitches, str(
1425 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1426 utilities.assert_equals(
1427 expect=main.TRUE,
1428 actual=linkDown,
1429 onpass="Link Down discovered properly",
1430 onfail="Link down was not discovered in " +
1431 str( link_sleep ) +
1432 " seconds" )
1433
GlennRCfcfdc4f2015-09-30 16:01:57 -07001434 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001435 # Giving onos multiple chances to install intents
1436 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001437 if i != 0:
1438 main.log.warn( "Verification failed. Retrying..." )
1439 main.log.info("Giving onos some time...")
1440 time.sleep( main.checkIntentsDelay )
1441
1442 intentState = main.TRUE
1443 for e in range(int(main.numCtrls)):
1444 main.log.info( "Checking intents on CLI %s" % (e+1) )
1445 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1446 intentState
1447 if not intentState:
1448 main.log.warn( "Not all intents installed" )
1449 if intentState:
1450 break
1451 else:
1452 #Dumping intent summary
1453 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1454
1455
1456 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1457 onpass="INTENTS INSTALLED",
1458 onfail="SOME INTENTS NOT INSTALLED" )
1459
Hari Krishnac195f3b2015-07-08 20:02:24 -07001460 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001461 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001462 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001463 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1464 if not pingResult:
1465 main.log.warn("First pingall failed. Retrying...")
1466 time.sleep(main.pingSleep)
1467 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001468
Hari Krishnac195f3b2015-07-08 20:02:24 -07001469 time2 = time.time()
1470 timeDiff = round( ( time2 - time1 ), 2 )
1471 main.log.report(
1472 "Time taken for Ping All: " +
1473 str( timeDiff ) +
1474 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001475 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001476 onpass="PING ALL PASS",
1477 onfail="PING ALL FAIL" )
1478
GlennRCbddd58f2015-10-01 15:45:25 -07001479 caseResult = linkDown and pingResult and intentState
1480 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001481 onpass="Random Link cut Test PASS",
1482 onfail="Random Link cut Test FAIL" )
1483
GlennRCfcfdc4f2015-09-30 16:01:57 -07001484 # Printing what exactly failed
1485 if not linkDown:
1486 main.log.debug( "Link down was not discovered correctly" )
1487 if not pingResult:
1488 main.log.debug( "Pingall failed" )
1489 if not intentState:
1490 main.log.debug( "Intents are not all installed" )
1491
GlennRCbddd58f2015-10-01 15:45:25 -07001492 if not caseResult and main.failSwitch:
1493 main.log.report("Stopping test")
1494 main.stop( email=main.emailOnStop )
1495
Hari Krishnac195f3b2015-07-08 20:02:24 -07001496 def CASE80( self, main ):
1497 """
1498 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1499 """
1500 import random
1501 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1502 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1503 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1504 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1505 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1506
1507 main.log.report(
1508 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1509 main.log.report(
1510 "__________________________________________________________________" )
1511 main.case(
1512 "Host intents - Bring the core links up that are down and verify ping all" )
1513 main.step( "Bring randomly cut links on Core devices up" )
1514 for i in range( int( switchLinksToToggle ) ):
1515 main.Mininet1.link(
1516 END1=link1End1,
1517 END2=main.randomLink1[ i ],
1518 OPTION="up" )
1519 time.sleep( link_sleep )
1520 main.Mininet1.link(
1521 END1=link2End1,
1522 END2=main.randomLink2[ i ],
1523 OPTION="up" )
1524 time.sleep( link_sleep )
1525 main.Mininet1.link(
1526 END1=link3End1,
1527 END2=main.randomLink3[ i ],
1528 OPTION="up" )
1529 time.sleep( link_sleep )
1530
Hari Krishna6185fc12015-07-13 15:42:31 -07001531 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001532 linkUp = main.ONOSbench.checkStatus(
1533 topology_output,
1534 main.numMNswitches,
1535 str( main.numMNlinks ) )
1536 utilities.assert_equals(
1537 expect=main.TRUE,
1538 actual=linkUp,
1539 onpass="Link up discovered properly",
1540 onfail="Link up was not discovered in " +
1541 str( link_sleep ) +
1542 " seconds" )
1543
GlennRCfcfdc4f2015-09-30 16:01:57 -07001544 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001545 # Giving onos multiple chances to install intents
1546 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001547 if i != 0:
1548 main.log.warn( "Verification failed. Retrying..." )
1549 main.log.info("Giving onos some time...")
1550 time.sleep( main.checkIntentsDelay )
1551
1552 intentState = main.TRUE
1553 for e in range(int(main.numCtrls)):
1554 main.log.info( "Checking intents on CLI %s" % (e+1) )
1555 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1556 intentState
1557 if not intentState:
1558 main.log.warn( "Not all intents installed" )
1559 if intentState:
1560 break
1561 else:
1562 #Dumping intent summary
1563 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1564
1565
1566 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1567 onpass="INTENTS INSTALLED",
1568 onfail="SOME INTENTS NOT INSTALLED" )
1569
Hari Krishnac195f3b2015-07-08 20:02:24 -07001570 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001571 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001572 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001573 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1574 if not pingResult:
1575 main.log.warn("First pingall failed. Retrying...")
1576 time.sleep(main.pingSleep)
1577 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001578
Hari Krishnac195f3b2015-07-08 20:02:24 -07001579 time2 = time.time()
1580 timeDiff = round( ( time2 - time1 ), 2 )
1581 main.log.report(
1582 "Time taken for Ping All: " +
1583 str( timeDiff ) +
1584 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001585 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001586 onpass="PING ALL PASS",
1587 onfail="PING ALL FAIL" )
1588
GlennRCbddd58f2015-10-01 15:45:25 -07001589 caseResult = linkUp and pingResult
1590 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591 onpass="Link Up Test PASS",
1592 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001593 # Printing what exactly failed
1594 if not linkUp:
1595 main.log.debug( "Link down was not discovered correctly" )
1596 if not pingResult:
1597 main.log.debug( "Pingall failed" )
1598 if not intentState:
1599 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001600
GlennRCbddd58f2015-10-01 15:45:25 -07001601 if not caseResult and main.failSwitch:
1602 main.log.report("Stopping test")
1603 main.stop( email=main.emailOnStop )
1604
Hari Krishnac195f3b2015-07-08 20:02:24 -07001605 def CASE71( self, main ):
1606 """
1607 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1608 """
1609 import random
1610 main.randomLink1 = []
1611 main.randomLink2 = []
1612 main.randomLink3 = []
1613 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1614 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1615 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1616 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1617 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1618 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1619 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1620 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1621
1622 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1623 main.log.report( "___________________________________________________________________________" )
1624 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1625 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1626 if ( int( switchLinksToToggle ) ==
1627 0 or int( switchLinksToToggle ) > 5 ):
1628 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1629 #main.cleanup()
1630 #main.exit()
1631 else:
1632 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1633
1634 main.step( "Cut links on Core devices using user provided range" )
1635 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1636 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1637 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1638 for i in range( int( switchLinksToToggle ) ):
1639 main.Mininet1.link(
1640 END1=link1End1,
1641 END2=main.randomLink1[ i ],
1642 OPTION="down" )
1643 time.sleep( link_sleep )
1644 main.Mininet1.link(
1645 END1=link2End1,
1646 END2=main.randomLink2[ i ],
1647 OPTION="down" )
1648 time.sleep( link_sleep )
1649 main.Mininet1.link(
1650 END1=link3End1,
1651 END2=main.randomLink3[ i ],
1652 OPTION="down" )
1653 time.sleep( link_sleep )
1654
Hari Krishna6185fc12015-07-13 15:42:31 -07001655 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001656 linkDown = main.ONOSbench.checkStatus(
1657 topology_output, main.numMNswitches, str(
1658 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1659 utilities.assert_equals(
1660 expect=main.TRUE,
1661 actual=linkDown,
1662 onpass="Link Down discovered properly",
1663 onfail="Link down was not discovered in " +
1664 str( link_sleep ) +
1665 " seconds" )
1666
GlennRCfcfdc4f2015-09-30 16:01:57 -07001667 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001668 # Giving onos multiple chances to install intents
1669 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001670 if i != 0:
1671 main.log.warn( "Verification failed. Retrying..." )
1672 main.log.info("Giving onos some time...")
1673 time.sleep( main.checkIntentsDelay )
1674
1675 intentState = main.TRUE
1676 for e in range(int(main.numCtrls)):
1677 main.log.info( "Checking intents on CLI %s" % (e+1) )
1678 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1679 intentState
1680 if not intentState:
1681 main.log.warn( "Not all intents installed" )
1682 if intentState:
1683 break
1684 else:
1685 #Dumping intent summary
1686 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1687
1688
1689 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1690 onpass="INTENTS INSTALLED",
1691 onfail="SOME INTENTS NOT INSTALLED" )
1692
Hari Krishnac195f3b2015-07-08 20:02:24 -07001693 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001694 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001695 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001696 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1697 if not pingResult:
1698 main.log.warn("First pingall failed. Retrying...")
1699 time.sleep(main.pingSleep)
1700 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001701
Hari Krishnac195f3b2015-07-08 20:02:24 -07001702 time2 = time.time()
1703 timeDiff = round( ( time2 - time1 ), 2 )
1704 main.log.report(
1705 "Time taken for Ping All: " +
1706 str( timeDiff ) +
1707 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001708 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001709 onpass="PING ALL PASS",
1710 onfail="PING ALL FAIL" )
1711
GlennRCbddd58f2015-10-01 15:45:25 -07001712 caseResult = linkDown and pingResult and intentState
1713 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001714 onpass="Random Link cut Test PASS",
1715 onfail="Random Link cut Test FAIL" )
1716
GlennRCfcfdc4f2015-09-30 16:01:57 -07001717 # Printing what exactly failed
1718 if not linkDown:
1719 main.log.debug( "Link down was not discovered correctly" )
1720 if not pingResult:
1721 main.log.debug( "Pingall failed" )
1722 if not intentState:
1723 main.log.debug( "Intents are not all installed" )
1724
GlennRCbddd58f2015-10-01 15:45:25 -07001725 if not caseResult and main.failSwitch:
1726 main.log.report("Stopping test")
1727 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001728
Hari Krishnac195f3b2015-07-08 20:02:24 -07001729 def CASE81( self, main ):
1730 """
1731 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1732 """
1733 import random
1734 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1735 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1736 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1737 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1738 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1739
1740 main.log.report(
1741 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1742 main.log.report(
1743 "__________________________________________________________________" )
1744 main.case(
1745 "Point intents - Bring the core links up that are down and verify ping all" )
1746 main.step( "Bring randomly cut links on Core devices up" )
1747 for i in range( int( switchLinksToToggle ) ):
1748 main.Mininet1.link(
1749 END1=link1End1,
1750 END2=main.randomLink1[ i ],
1751 OPTION="up" )
1752 time.sleep( link_sleep )
1753 main.Mininet1.link(
1754 END1=link2End1,
1755 END2=main.randomLink2[ i ],
1756 OPTION="up" )
1757 time.sleep( link_sleep )
1758 main.Mininet1.link(
1759 END1=link3End1,
1760 END2=main.randomLink3[ i ],
1761 OPTION="up" )
1762 time.sleep( link_sleep )
1763
Hari Krishna6185fc12015-07-13 15:42:31 -07001764 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001765 linkUp = main.ONOSbench.checkStatus(
1766 topology_output,
1767 main.numMNswitches,
1768 str( main.numMNlinks ) )
1769 utilities.assert_equals(
1770 expect=main.TRUE,
1771 actual=linkUp,
1772 onpass="Link up discovered properly",
1773 onfail="Link up was not discovered in " +
1774 str( link_sleep ) +
1775 " seconds" )
1776
GlennRCfcfdc4f2015-09-30 16:01:57 -07001777 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001778 # Giving onos multiple chances to install intents
1779 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001780 if i != 0:
1781 main.log.warn( "Verification failed. Retrying..." )
1782 main.log.info("Giving onos some time...")
1783 time.sleep( main.checkIntentsDelay )
1784
1785 intentState = main.TRUE
1786 for e in range(int(main.numCtrls)):
1787 main.log.info( "Checking intents on CLI %s" % (e+1) )
1788 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1789 intentState
1790 if not intentState:
1791 main.log.warn( "Not all intents installed" )
1792 if intentState:
1793 break
1794 else:
1795 #Dumping intent summary
1796 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1797
1798
1799 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1800 onpass="INTENTS INSTALLED",
1801 onfail="SOME INTENTS NOT INSTALLED" )
1802
Hari Krishnac195f3b2015-07-08 20:02:24 -07001803 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001804 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001805 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001806 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1807 if not pingResult:
1808 main.log.warn("First pingall failed. Retrying...")
1809 time.sleep(main.pingSleep)
1810 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001811
Hari Krishnac195f3b2015-07-08 20:02:24 -07001812 time2 = time.time()
1813 timeDiff = round( ( time2 - time1 ), 2 )
1814 main.log.report(
1815 "Time taken for Ping All: " +
1816 str( timeDiff ) +
1817 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001818 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819 onpass="PING ALL PASS",
1820 onfail="PING ALL FAIL" )
1821
GlennRCbddd58f2015-10-01 15:45:25 -07001822 caseResult = linkUp and pingResult
1823 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824 onpass="Link Up Test PASS",
1825 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001826 # Printing what exactly failed
1827 if not linkUp:
1828 main.log.debug( "Link down was not discovered correctly" )
1829 if not pingResult:
1830 main.log.debug( "Pingall failed" )
1831 if not intentState:
1832 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001833
GlennRCbddd58f2015-10-01 15:45:25 -07001834 if not caseResult and main.failSwitch:
1835 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001836 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001837
Hari Krishnac195f3b2015-07-08 20:02:24 -07001838 def CASE72( self, main ):
1839 """
1840 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1841 """
1842 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001843 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001844 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001845
Hari Krishnac195f3b2015-07-08 20:02:24 -07001846 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1847 main.log.report( "___________________________________________________________________________" )
1848 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1849 switches = []
1850 switchesComb = []
1851 for i in range( main.numMNswitches ):
1852 switches.append('s%d'%(i+1))
1853 switchesLinksComb = list(itertools.combinations(switches,2))
1854 main.randomLinks = random.sample(switchesLinksComb, 5 )
1855 print main.randomLinks
1856 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001857
Hari Krishnac195f3b2015-07-08 20:02:24 -07001858 for switch in main.randomLinks:
1859 main.Mininet1.link(
1860 END1=switch[0],
1861 END2=switch[1],
1862 OPTION="down")
1863 time.sleep( link_sleep )
1864
Hari Krishna6185fc12015-07-13 15:42:31 -07001865 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001866 linkDown = main.ONOSbench.checkStatus(
1867 topology_output, main.numMNswitches, str(
1868 int( main.numMNlinks ) - 5 * 2 ) )
1869 utilities.assert_equals(
1870 expect=main.TRUE,
1871 actual=linkDown,
1872 onpass="Link Down discovered properly",
1873 onfail="Link down was not discovered in " +
1874 str( link_sleep ) +
1875 " seconds" )
1876
GlennRCfcfdc4f2015-09-30 16:01:57 -07001877 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001878 # Giving onos multiple chances to install intents
1879 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001880 if i != 0:
1881 main.log.warn( "Verification failed. Retrying..." )
1882 main.log.info("Giving onos some time...")
1883 time.sleep( main.checkIntentsDelay )
1884
1885 intentState = main.TRUE
1886 for e in range(int(main.numCtrls)):
1887 main.log.info( "Checking intents on CLI %s" % (e+1) )
1888 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1889 intentState
1890 if not intentState:
1891 main.log.warn( "Not all intents installed" )
1892 if intentState:
1893 break
1894 else:
1895 #Dumping intent summary
1896 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1897
1898
1899 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1900 onpass="INTENTS INSTALLED",
1901 onfail="SOME INTENTS NOT INSTALLED" )
1902
Hari Krishnac195f3b2015-07-08 20:02:24 -07001903 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001904 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001905 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001906 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1907 if not pingResult:
1908 main.log.warn("First pingall failed. Retrying...")
1909 time.sleep(main.pingSleep)
1910 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001911
Hari Krishnac195f3b2015-07-08 20:02:24 -07001912 time2 = time.time()
1913 timeDiff = round( ( time2 - time1 ), 2 )
1914 main.log.report(
1915 "Time taken for Ping All: " +
1916 str( timeDiff ) +
1917 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001918 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001919 onpass="PING ALL PASS",
1920 onfail="PING ALL FAIL" )
1921
GlennRCbddd58f2015-10-01 15:45:25 -07001922 caseResult = linkDown and pingResult and intentState
1923 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001924 onpass="Random Link cut Test PASS",
1925 onfail="Random Link cut Test FAIL" )
1926
GlennRCfcfdc4f2015-09-30 16:01:57 -07001927 # Printing what exactly failed
1928 if not linkDown:
1929 main.log.debug( "Link down was not discovered correctly" )
1930 if not pingResult:
1931 main.log.debug( "Pingall failed" )
1932 if not intentState:
1933 main.log.debug( "Intents are not all installed" )
1934
GlennRCbddd58f2015-10-01 15:45:25 -07001935 if not caseResult and main.failSwitch:
1936 main.log.report("Stopping test")
1937 main.stop( email=main.emailOnStop )
1938
Hari Krishnac195f3b2015-07-08 20:02:24 -07001939 def CASE82( self, main ):
1940 """
1941 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1942 """
1943 import random
1944 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001945
Hari Krishnac195f3b2015-07-08 20:02:24 -07001946 main.log.report(
1947 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1948 main.log.report(
1949 "__________________________________________________________________" )
1950 main.case(
1951 "Host intents - Bring the core links up that are down and verify ping all" )
1952 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001953
Hari Krishnac195f3b2015-07-08 20:02:24 -07001954 for switch in main.randomLinks:
1955 main.Mininet1.link(
1956 END1=switch[0],
1957 END2=switch[1],
1958 OPTION="up")
1959 time.sleep( link_sleep )
1960
Hari Krishna6185fc12015-07-13 15:42:31 -07001961 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001962 linkUp = main.ONOSbench.checkStatus(
1963 topology_output,
1964 main.numMNswitches,
1965 str( main.numMNlinks ) )
1966 utilities.assert_equals(
1967 expect=main.TRUE,
1968 actual=linkUp,
1969 onpass="Link up discovered properly",
1970 onfail="Link up was not discovered in " +
1971 str( link_sleep ) +
1972 " seconds" )
1973
GlennRCfcfdc4f2015-09-30 16:01:57 -07001974 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001975 # Giving onos multiple chances to install intents
1976 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001977 if i != 0:
1978 main.log.warn( "Verification failed. Retrying..." )
1979 main.log.info("Giving onos some time...")
1980 time.sleep( main.checkIntentsDelay )
1981
1982 intentState = main.TRUE
1983 for e in range(int(main.numCtrls)):
1984 main.log.info( "Checking intents on CLI %s" % (e+1) )
1985 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1986 intentState
1987 if not intentState:
1988 main.log.warn( "Not all intents installed" )
1989 if intentState:
1990 break
1991 else:
1992 #Dumping intent summary
1993 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1994
1995
1996 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1997 onpass="INTENTS INSTALLED",
1998 onfail="SOME INTENTS NOT INSTALLED" )
1999
Hari Krishnac195f3b2015-07-08 20:02:24 -07002000 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002001 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002002 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002003 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2004 if not pingResult:
2005 main.log.warn("First pingall failed. Retrying...")
2006 time.sleep(main.pingSleep)
2007 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002008
Hari Krishnac195f3b2015-07-08 20:02:24 -07002009 time2 = time.time()
2010 timeDiff = round( ( time2 - time1 ), 2 )
2011 main.log.report(
2012 "Time taken for Ping All: " +
2013 str( timeDiff ) +
2014 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002015 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002016 onpass="PING ALL PASS",
2017 onfail="PING ALL FAIL" )
2018
GlennRCbddd58f2015-10-01 15:45:25 -07002019 caseResult = linkUp and pingResult
2020 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002021 onpass="Link Up Test PASS",
2022 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002023 # Printing what exactly failed
2024 if not linkUp:
2025 main.log.debug( "Link down was not discovered correctly" )
2026 if not pingResult:
2027 main.log.debug( "Pingall failed" )
2028 if not intentState:
2029 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030
GlennRCbddd58f2015-10-01 15:45:25 -07002031 if not caseResult and main.failSwitch:
2032 main.log.report("Stopping test")
2033 main.stop( email=main.emailOnStop )
2034
Hari Krishnac195f3b2015-07-08 20:02:24 -07002035 def CASE73( self, main ):
2036 """
2037 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2038 """
2039 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002040 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002041 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002042
Hari Krishnac195f3b2015-07-08 20:02:24 -07002043 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2044 main.log.report( "___________________________________________________________________________" )
2045 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2046 switches = []
2047 switchesComb = []
2048 for i in range( main.numMNswitches ):
2049 switches.append('s%d'%(i+1))
2050 switchesLinksComb = list(itertools.combinations(switches,2))
2051 main.randomLinks = random.sample(switchesLinksComb, 5 )
2052 print main.randomLinks
2053 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002054
Hari Krishnac195f3b2015-07-08 20:02:24 -07002055 for switch in main.randomLinks:
2056 main.Mininet1.link(
2057 END1=switch[0],
2058 END2=switch[1],
2059 OPTION="down")
2060 time.sleep( link_sleep )
2061
Hari Krishna6185fc12015-07-13 15:42:31 -07002062 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002063 linkDown = main.ONOSbench.checkStatus(
2064 topology_output, main.numMNswitches, str(
2065 int( main.numMNlinks ) - 5 * 2 ) )
2066 utilities.assert_equals(
2067 expect=main.TRUE,
2068 actual=linkDown,
2069 onpass="Link Down discovered properly",
2070 onfail="Link down was not discovered in " +
2071 str( link_sleep ) +
2072 " seconds" )
2073
GlennRCfcfdc4f2015-09-30 16:01:57 -07002074 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002075 # Giving onos multiple chances to install intents
2076 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002077 if i != 0:
2078 main.log.warn( "Verification failed. Retrying..." )
2079 main.log.info("Giving onos some time...")
2080 time.sleep( main.checkIntentsDelay )
2081
2082 intentState = main.TRUE
2083 for e in range(int(main.numCtrls)):
2084 main.log.info( "Checking intents on CLI %s" % (e+1) )
2085 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2086 intentState
2087 if not intentState:
2088 main.log.warn( "Not all intents installed" )
2089 if intentState:
2090 break
2091 else:
2092 #Dumping intent summary
2093 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2094
2095
2096 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2097 onpass="INTENTS INSTALLED",
2098 onfail="SOME INTENTS NOT INSTALLED" )
2099
Hari Krishnac195f3b2015-07-08 20:02:24 -07002100 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002101 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002102 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002103 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2104 if not pingResult:
2105 main.log.warn("First pingall failed. Retrying...")
2106 time.sleep(main.pingSleep)
2107 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002108
Hari Krishnac195f3b2015-07-08 20:02:24 -07002109 time2 = time.time()
2110 timeDiff = round( ( time2 - time1 ), 2 )
2111 main.log.report(
2112 "Time taken for Ping All: " +
2113 str( timeDiff ) +
2114 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002115 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002116 onpass="PING ALL PASS",
2117 onfail="PING ALL FAIL" )
2118
GlennRCbddd58f2015-10-01 15:45:25 -07002119 caseResult = linkDown and pingResult and intentState
2120 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002121 onpass="Random Link cut Test PASS",
2122 onfail="Random Link cut Test FAIL" )
2123
GlennRCfcfdc4f2015-09-30 16:01:57 -07002124 # Printing what exactly failed
2125 if not linkDown:
2126 main.log.debug( "Link down was not discovered correctly" )
2127 if not pingResult:
2128 main.log.debug( "Pingall failed" )
2129 if not intentState:
2130 main.log.debug( "Intents are not all installed" )
2131
GlennRCbddd58f2015-10-01 15:45:25 -07002132 if not caseResult and main.failSwitch:
2133 main.log.report("Stopping test")
2134 main.stop( email=main.emailOnStop )
2135
Hari Krishnac195f3b2015-07-08 20:02:24 -07002136 def CASE83( self, main ):
2137 """
2138 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2139 """
2140 import random
2141 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002142
Hari Krishnac195f3b2015-07-08 20:02:24 -07002143 main.log.report(
2144 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2145 main.log.report(
2146 "__________________________________________________________________" )
2147 main.case(
2148 "Point intents - Bring the core links up that are down and verify ping all" )
2149 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002150
Hari Krishnac195f3b2015-07-08 20:02:24 -07002151 for switch in main.randomLinks:
2152 main.Mininet1.link(
2153 END1=switch[0],
2154 END2=switch[1],
2155 OPTION="up")
2156 time.sleep( link_sleep )
2157
Hari Krishna6185fc12015-07-13 15:42:31 -07002158 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002159 linkUp = main.ONOSbench.checkStatus(
2160 topology_output,
2161 main.numMNswitches,
2162 str( main.numMNlinks ) )
2163 utilities.assert_equals(
2164 expect=main.TRUE,
2165 actual=linkUp,
2166 onpass="Link up discovered properly",
2167 onfail="Link up was not discovered in " +
2168 str( link_sleep ) +
2169 " seconds" )
2170
GlennRCfcfdc4f2015-09-30 16:01:57 -07002171 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002172 # Giving onos multiple chances to install intents
2173 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002174 if i != 0:
2175 main.log.warn( "Verification failed. Retrying..." )
2176 main.log.info("Giving onos some time...")
2177 time.sleep( main.checkIntentsDelay )
2178
2179 intentState = main.TRUE
2180 for e in range(int(main.numCtrls)):
2181 main.log.info( "Checking intents on CLI %s" % (e+1) )
2182 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2183 intentState
2184 if not intentState:
2185 main.log.warn( "Not all intents installed" )
2186 if intentState:
2187 break
2188 else:
2189 #Dumping intent summary
2190 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2191
2192
2193 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2194 onpass="INTENTS INSTALLED",
2195 onfail="SOME INTENTS NOT INSTALLED" )
2196
Hari Krishnac195f3b2015-07-08 20:02:24 -07002197 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002198 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002199 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002200 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2201 if not pingResult:
2202 main.log.warn("First pingall failed. Retrying...")
2203 time.sleep(main.pingSleep)
2204 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002205
Hari Krishnac195f3b2015-07-08 20:02:24 -07002206 time2 = time.time()
2207 timeDiff = round( ( time2 - time1 ), 2 )
2208 main.log.report(
2209 "Time taken for Ping All: " +
2210 str( timeDiff ) +
2211 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002212 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002213 onpass="PING ALL PASS",
2214 onfail="PING ALL FAIL" )
2215
GlennRCbddd58f2015-10-01 15:45:25 -07002216 caseResult = linkUp and pingResult
2217 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002218 onpass="Link Up Test PASS",
2219 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002220 # Printing what exactly failed
2221 if not linkUp:
2222 main.log.debug( "Link down was not discovered correctly" )
2223 if not pingResult:
2224 main.log.debug( "Pingall failed" )
2225 if not intentState:
2226 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002227
GlennRCbddd58f2015-10-01 15:45:25 -07002228 if not caseResult and main.failSwitch:
2229 main.log.report("Stopping test")
2230 main.stop( email=main.emailOnStop )
2231
Hari Krishnac195f3b2015-07-08 20:02:24 -07002232 def CASE74( self, main ):
2233 """
2234 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2235 """
2236 import random
2237 main.randomLink1 = []
2238 main.randomLink2 = []
2239 main.randomLink3 = []
2240 main.randomLink4 = []
2241 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2242 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2243 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2244 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2245 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2246 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2247 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2248 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002249
Hari Krishnac195f3b2015-07-08 20:02:24 -07002250 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2251 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002252 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002253 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002254 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002255 linkIndex.remove(linkIndexS9)
2256 linkIndexS10 = random.sample(linkIndex,1)[0]
2257 main.randomLink1 = link1End2top[linkIndexS9]
2258 main.randomLink2 = link2End2top[linkIndexS10]
2259 main.randomLink3 = random.sample(link1End2bot,1)[0]
2260 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002261
2262 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002263 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2264 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2265 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2266 time.sleep( link_sleep )
2267 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2268 time.sleep( link_sleep )
2269
Hari Krishna6185fc12015-07-13 15:42:31 -07002270 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002271 linkDown = main.ONOSbench.checkStatus(
2272 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002273 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002274 utilities.assert_equals(
2275 expect=main.TRUE,
2276 actual=linkDown,
2277 onpass="Link Down discovered properly",
2278 onfail="Link down was not discovered in " +
2279 str( link_sleep ) +
2280 " seconds" )
2281
GlennRCfcfdc4f2015-09-30 16:01:57 -07002282 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002283 # Giving onos multiple chances to install intents
2284 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002285 if i != 0:
2286 main.log.warn( "Verification failed. Retrying..." )
2287 main.log.info("Giving onos some time...")
2288 time.sleep( main.checkIntentsDelay )
2289
2290 intentState = main.TRUE
2291 for e in range(int(main.numCtrls)):
2292 main.log.info( "Checking intents on CLI %s" % (e+1) )
2293 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2294 intentState
2295 if not intentState:
2296 main.log.warn( "Not all intents installed" )
2297 if intentState:
2298 break
2299 else:
2300 #Dumping intent summary
2301 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2302
2303
2304 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2305 onpass="INTENTS INSTALLED",
2306 onfail="SOME INTENTS NOT INSTALLED" )
2307
Hari Krishnac195f3b2015-07-08 20:02:24 -07002308 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002309 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002310 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002311 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2312 if not pingResult:
2313 main.log.warn("First pingall failed. Retrying...")
2314 time.sleep(main.pingSleep)
2315 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002316
Hari Krishnac195f3b2015-07-08 20:02:24 -07002317 time2 = time.time()
2318 timeDiff = round( ( time2 - time1 ), 2 )
2319 main.log.report(
2320 "Time taken for Ping All: " +
2321 str( timeDiff ) +
2322 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002323 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002324 onpass="PING ALL PASS",
2325 onfail="PING ALL FAIL" )
2326
GlennRCbddd58f2015-10-01 15:45:25 -07002327 caseResult = linkDown and pingResult and intentState
2328 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002329 onpass="Random Link cut Test PASS",
2330 onfail="Random Link cut Test FAIL" )
2331
GlennRCfcfdc4f2015-09-30 16:01:57 -07002332 # Printing what exactly failed
2333 if not linkDown:
2334 main.log.debug( "Link down was not discovered correctly" )
2335 if not pingResult:
2336 main.log.debug( "Pingall failed" )
2337 if not intentState:
2338 main.log.debug( "Intents are not all installed" )
2339
GlennRCbddd58f2015-10-01 15:45:25 -07002340 if not caseResult and main.failSwitch:
2341 main.log.report("Stopping test")
2342 main.stop( email=main.emailOnStop )
2343
Hari Krishnac195f3b2015-07-08 20:02:24 -07002344 def CASE84( self, main ):
2345 """
2346 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2347 """
2348 import random
2349 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2350 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2351 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2352 main.log.report(
2353 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2354 main.log.report(
2355 "__________________________________________________________________" )
2356 main.case(
2357 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002358
2359 # Work around for link state propagation delay. Added some sleep time.
2360 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2361 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002362 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2363 time.sleep( link_sleep )
2364 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2365 time.sleep( link_sleep )
2366
Hari Krishna6185fc12015-07-13 15:42:31 -07002367 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002368 linkUp = main.ONOSbench.checkStatus(
2369 topology_output,
2370 main.numMNswitches,
2371 str( main.numMNlinks ) )
2372 utilities.assert_equals(
2373 expect=main.TRUE,
2374 actual=linkUp,
2375 onpass="Link up discovered properly",
2376 onfail="Link up was not discovered in " +
2377 str( link_sleep ) +
2378 " seconds" )
2379
GlennRCfcfdc4f2015-09-30 16:01:57 -07002380 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002381 # Giving onos multiple chances to install intents
2382 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002383 if i != 0:
2384 main.log.warn( "Verification failed. Retrying..." )
2385 main.log.info("Giving onos some time...")
2386 time.sleep( main.checkIntentsDelay )
2387
2388 intentState = main.TRUE
2389 for e in range(int(main.numCtrls)):
2390 main.log.info( "Checking intents on CLI %s" % (e+1) )
2391 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2392 intentState
2393 if not intentState:
2394 main.log.warn( "Not all intents installed" )
2395 if intentState:
2396 break
2397 else:
2398 #Dumping intent summary
2399 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2400
2401
2402 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2403 onpass="INTENTS INSTALLED",
2404 onfail="SOME INTENTS NOT INSTALLED" )
2405
Hari Krishnac195f3b2015-07-08 20:02:24 -07002406 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002407 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002408 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002409 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2410 if not pingResult:
2411 main.log.warn("First pingall failed. Retrying...")
2412 time.sleep(main.pingSleep)
2413 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002414
Hari Krishnac195f3b2015-07-08 20:02:24 -07002415 time2 = time.time()
2416 timeDiff = round( ( time2 - time1 ), 2 )
2417 main.log.report(
2418 "Time taken for Ping All: " +
2419 str( timeDiff ) +
2420 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002421 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002422 onpass="PING ALL PASS",
2423 onfail="PING ALL FAIL" )
2424
GlennRCbddd58f2015-10-01 15:45:25 -07002425 caseResult = linkUp and pingResult
2426 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002427 onpass="Link Up Test PASS",
2428 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002429 # Printing what exactly failed
2430 if not linkUp:
2431 main.log.debug( "Link down was not discovered correctly" )
2432 if not pingResult:
2433 main.log.debug( "Pingall failed" )
2434 if not intentState:
2435 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002436
GlennRCbddd58f2015-10-01 15:45:25 -07002437 if not caseResult and main.failSwitch:
2438 main.log.report("Stopping test")
2439 main.stop( email=main.emailOnStop )
2440
Hari Krishnab79d0822015-08-20 09:48:43 -07002441 def CASE75( self, main ):
2442 """
2443 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2444 """
2445 import random
2446 main.randomLink1 = []
2447 main.randomLink2 = []
2448 main.randomLink3 = []
2449 main.randomLink4 = []
2450 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2451 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2452 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2453 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2454 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2455 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2456 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2457 main.pingTimeout = 400
2458
2459 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2460 main.log.report( "___________________________________________________________________________" )
2461 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2462 linkIndex = range(4)
2463 linkIndexS9 = random.sample(linkIndex,1)[0]
2464 linkIndex.remove(linkIndexS9)
2465 linkIndexS10 = random.sample(linkIndex,1)[0]
2466 main.randomLink1 = link1End2top[linkIndexS9]
2467 main.randomLink2 = link2End2top[linkIndexS10]
2468 main.randomLink3 = random.sample(link1End2bot,1)[0]
2469 main.randomLink4 = random.sample(link2End2bot,1)[0]
2470
2471 # Work around for link state propagation delay. Added some sleep time.
2472 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2473 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2474 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2475 time.sleep( link_sleep )
2476 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2477 time.sleep( link_sleep )
2478
2479 topology_output = main.ONOScli1.topology()
2480 linkDown = main.ONOSbench.checkStatus(
2481 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002482 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002483 utilities.assert_equals(
2484 expect=main.TRUE,
2485 actual=linkDown,
2486 onpass="Link Down discovered properly",
2487 onfail="Link down was not discovered in " +
2488 str( link_sleep ) +
2489 " seconds" )
2490
GlennRCfcfdc4f2015-09-30 16:01:57 -07002491 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002492 # Giving onos multiple chances to install intents
2493 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002494 if i != 0:
2495 main.log.warn( "Verification failed. Retrying..." )
2496 main.log.info("Giving onos some time...")
2497 time.sleep( main.checkIntentsDelay )
2498
2499 intentState = main.TRUE
2500 for e in range(int(main.numCtrls)):
2501 main.log.info( "Checking intents on CLI %s" % (e+1) )
2502 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2503 intentState
2504 if not intentState:
2505 main.log.warn( "Not all intents installed" )
2506 if intentState:
2507 break
2508 else:
2509 #Dumping intent summary
2510 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2511
2512
2513 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2514 onpass="INTENTS INSTALLED",
2515 onfail="SOME INTENTS NOT INSTALLED" )
2516
Hari Krishnab79d0822015-08-20 09:48:43 -07002517 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002518 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002519 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002520 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2521 if not pingResult:
2522 main.log.warn("First pingall failed. Retrying...")
2523 time.sleep(main.pingSleep)
2524 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002525
Hari Krishnab79d0822015-08-20 09:48:43 -07002526 time2 = time.time()
2527 timeDiff = round( ( time2 - time1 ), 2 )
2528 main.log.report(
2529 "Time taken for Ping All: " +
2530 str( timeDiff ) +
2531 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002532 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002533 onpass="PING ALL PASS",
2534 onfail="PING ALL FAIL" )
2535
GlennRCbddd58f2015-10-01 15:45:25 -07002536 caseResult = linkDown and pingResult and intentState
2537 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002538 onpass="Random Link cut Test PASS",
2539 onfail="Random Link cut Test FAIL" )
2540
GlennRCfcfdc4f2015-09-30 16:01:57 -07002541 # Printing what exactly failed
2542 if not linkDown:
2543 main.log.debug( "Link down was not discovered correctly" )
2544 if not pingResult:
2545 main.log.debug( "Pingall failed" )
2546 if not intentState:
2547 main.log.debug( "Intents are not all installed" )
2548
GlennRCbddd58f2015-10-01 15:45:25 -07002549 if not caseResult and main.failSwitch:
2550 main.log.report("Stopping test")
2551 main.stop( email=main.emailOnStop )
2552
Hari Krishnab79d0822015-08-20 09:48:43 -07002553 def CASE85( self, main ):
2554 """
2555 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2556 """
2557 import random
2558 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2559 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2560 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2561 main.log.report(
2562 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2563 main.log.report(
2564 "__________________________________________________________________" )
2565 main.case(
2566 "Point intents - Bring the core links up that are down and verify ping all" )
2567
2568 # Work around for link state propagation delay. Added some sleep time.
2569 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2570 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2571 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2572 time.sleep( link_sleep )
2573 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2574 time.sleep( link_sleep )
2575
2576 topology_output = main.ONOScli1.topology()
2577 linkUp = main.ONOSbench.checkStatus(
2578 topology_output,
2579 main.numMNswitches,
2580 str( main.numMNlinks ) )
2581 utilities.assert_equals(
2582 expect=main.TRUE,
2583 actual=linkUp,
2584 onpass="Link up discovered properly",
2585 onfail="Link up was not discovered in " +
2586 str( link_sleep ) +
2587 " seconds" )
2588
GlennRCfcfdc4f2015-09-30 16:01:57 -07002589 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002590 # Giving onos multiple chances to install intents
2591 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002592 if i != 0:
2593 main.log.warn( "Verification failed. Retrying..." )
2594 main.log.info("Giving onos some time...")
2595 time.sleep( main.checkIntentsDelay )
2596
2597 intentState = main.TRUE
2598 for e in range(int(main.numCtrls)):
2599 main.log.info( "Checking intents on CLI %s" % (e+1) )
2600 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2601 intentState
2602 if not intentState:
2603 main.log.warn( "Not all intents installed" )
2604 if intentState:
2605 break
2606 else:
2607 #Dumping intent summary
2608 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2609
2610
2611 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2612 onpass="INTENTS INSTALLED",
2613 onfail="SOME INTENTS NOT INSTALLED" )
2614
Hari Krishnab79d0822015-08-20 09:48:43 -07002615 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002616 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002617 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002618 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2619 if not pingResult:
2620 main.log.warn("First pingall failed. Retrying...")
2621 time.sleep(main.pingSleep)
2622 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002623
Hari Krishnab79d0822015-08-20 09:48:43 -07002624 time2 = time.time()
2625 timeDiff = round( ( time2 - time1 ), 2 )
2626 main.log.report(
2627 "Time taken for Ping All: " +
2628 str( timeDiff ) +
2629 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002630 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002631 onpass="PING ALL PASS",
2632 onfail="PING ALL FAIL" )
2633
GlennRCbddd58f2015-10-01 15:45:25 -07002634 caseResult = linkUp and pingResult
2635 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002636 onpass="Link Up Test PASS",
2637 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002638 # Printing what exactly failed
2639 if not linkUp:
2640 main.log.debug( "Link down was not discovered correctly" )
2641 if not pingResult:
2642 main.log.debug( "Pingall failed" )
2643 if not intentState:
2644 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002645
GlennRCbddd58f2015-10-01 15:45:25 -07002646 if not caseResult and main.failSwitch:
2647 main.log.report("Stopping test")
2648 main.stop( email=main.emailOnStop )
2649
Hari Krishna4223dbd2015-08-13 16:29:53 -07002650 def CASE170( self ):
2651 """
2652 IPv6 ping all with some core links down( Host Intents-Att Topo)
2653 """
2654 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2655 main.log.report( "_________________________________________________" )
2656 import itertools
2657 import time
2658 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2659 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002660 pingResult = main.FALSE
2661 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002662 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002663 if not pingResult:
2664 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002665 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002666 time2 = time.time()
2667 timeDiff = round( ( time2 - time1 ), 2 )
2668 main.log.report(
2669 "Time taken for IPv6 Ping All: " +
2670 str( timeDiff ) +
2671 " seconds" )
2672 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2673 onpass="PING ALL PASS",
2674 onfail="PING ALL FAIL" )
2675
GlennRCbddd58f2015-10-01 15:45:25 -07002676 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002677 utilities.assert_equals(
2678 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002679 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002680 onpass="IPv6 Ping across 300 host intents test PASS",
2681 onfail="IPv6 Ping across 300 host intents test FAIL" )
2682
2683 def CASE180( self ):
2684 """
2685 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2686 """
2687 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2688 main.log.report( "_________________________________________________" )
2689 import itertools
2690 import time
2691 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2692 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002693 pingResult = main.FALSE
2694 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002695 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002696 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002697 main.log.warn("First ping failed. Retrying...")
2698 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002699 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002700 time2 = time.time()
2701 timeDiff = round( ( time2 - time1 ), 2 )
2702 main.log.report(
2703 "Time taken for IPv6 Ping All: " +
2704 str( timeDiff ) +
2705 " seconds" )
2706 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2707 onpass="PING ALL PASS",
2708 onfail="PING ALL FAIL" )
2709
GlennRCbddd58f2015-10-01 15:45:25 -07002710 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002711 utilities.assert_equals(
2712 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002713 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002714 onpass="IPv6 Ping across 300 host intents test PASS",
2715 onfail="IPv6 Ping across 300 host intents test FAIL" )
2716
2717 def CASE171( self ):
2718 """
2719 IPv6 ping all with some core links down( Point Intents-Att Topo)
2720 """
2721 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2722 main.log.report( "_________________________________________________" )
2723 import itertools
2724 import time
2725 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2726 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002727 pingResult = main.FALSE
2728 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002729 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002730 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002731 main.log.warn("First ping failed. Retrying...")
2732 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002733 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002734 time2 = time.time()
2735 timeDiff = round( ( time2 - time1 ), 2 )
2736 main.log.report(
2737 "Time taken for IPv6 Ping All: " +
2738 str( timeDiff ) +
2739 " seconds" )
2740 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2741 onpass="PING ALL PASS",
2742 onfail="PING ALL FAIL" )
2743
GlennRCbddd58f2015-10-01 15:45:25 -07002744 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002745 utilities.assert_equals(
2746 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002747 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002748 onpass="IPv6 Ping across 600 point intents test PASS",
2749 onfail="IPv6 Ping across 600 point intents test FAIL" )
2750
2751 def CASE181( self ):
2752 """
2753 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2754 """
2755 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2756 main.log.report( "_________________________________________________" )
2757 import itertools
2758 import time
2759 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2760 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002761 pingResult = main.FALSE
2762 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002763 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002764 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002765 main.log.warn("First ping failed. Retrying...")
2766 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002767 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002768 time2 = time.time()
2769 timeDiff = round( ( time2 - time1 ), 2 )
2770 main.log.report(
2771 "Time taken for IPv6 Ping All: " +
2772 str( timeDiff ) +
2773 " seconds" )
2774 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2775 onpass="PING ALL PASS",
2776 onfail="PING ALL FAIL" )
2777
GlennRCbddd58f2015-10-01 15:45:25 -07002778 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002779 utilities.assert_equals(
2780 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002781 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002782 onpass="IPv6 Ping across 600 Point intents test PASS",
2783 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2784
2785 def CASE172( self ):
2786 """
2787 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2788 """
2789 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2790 main.log.report( "_________________________________________________" )
2791 import itertools
2792 import time
2793 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2794 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002795 pingResult = main.FALSE
2796 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002797 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002798 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002799 main.log.warn("First ping failed. Retrying...")
2800 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002801 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002802 time2 = time.time()
2803 timeDiff = round( ( time2 - time1 ), 2 )
2804 main.log.report(
2805 "Time taken for IPv6 Ping All: " +
2806 str( timeDiff ) +
2807 " seconds" )
2808 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2809 onpass="PING ALL PASS",
2810 onfail="PING ALL FAIL" )
2811
GlennRCbddd58f2015-10-01 15:45:25 -07002812 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002813 utilities.assert_equals(
2814 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002815 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002816 onpass="IPv6 Ping across 300 host intents test PASS",
2817 onfail="IPv6 Ping across 300 host intents test FAIL" )
2818
2819 def CASE182( self ):
2820 """
2821 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2822 """
2823 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2824 main.log.report( "_________________________________________________" )
2825 import itertools
2826 import time
2827 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2828 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002829 pingResult = main.FALSE
2830 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002831 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002832 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002833 main.log.warn("First ping failed. Retrying...")
2834 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002835 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002836 time2 = time.time()
2837 timeDiff = round( ( time2 - time1 ), 2 )
2838 main.log.report(
2839 "Time taken for IPv6 Ping All: " +
2840 str( timeDiff ) +
2841 " seconds" )
2842 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2843 onpass="PING ALL PASS",
2844 onfail="PING ALL FAIL" )
2845
GlennRCbddd58f2015-10-01 15:45:25 -07002846 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002847 utilities.assert_equals(
2848 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002849 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002850 onpass="IPv6 Ping across 300 host intents test PASS",
2851 onfail="IPv6 Ping across 300 host intents test FAIL" )
2852
2853 def CASE173( self ):
2854 """
2855 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2856 """
2857 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2858 main.log.report( "_________________________________________________" )
2859 import itertools
2860 import time
2861 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2862 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002863 pingResult = main.FALSE
2864 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002865 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002866 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002867 main.log.warn("First ping failed. Retrying...")
2868 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002869 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002870 time2 = time.time()
2871 timeDiff = round( ( time2 - time1 ), 2 )
2872 main.log.report(
2873 "Time taken for IPv6 Ping All: " +
2874 str( timeDiff ) +
2875 " seconds" )
2876 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2877 onpass="PING ALL PASS",
2878 onfail="PING ALL FAIL" )
2879
GlennRCbddd58f2015-10-01 15:45:25 -07002880 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002881 utilities.assert_equals(
2882 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002883 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002884 onpass="IPv6 Ping across 600 point intents test PASS",
2885 onfail="IPv6 Ping across 600 point intents test FAIL" )
2886
2887 def CASE183( self ):
2888 """
2889 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2890 """
2891 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2892 main.log.report( "_________________________________________________" )
2893 import itertools
2894 import time
2895 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2896 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002897 pingResult = main.FALSE
2898 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002899 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002900 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002901 main.log.warn("First ping failed. Retrying...")
2902 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002903 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002904 time2 = time.time()
2905 timeDiff = round( ( time2 - time1 ), 2 )
2906 main.log.report(
2907 "Time taken for IPv6 Ping All: " +
2908 str( timeDiff ) +
2909 " seconds" )
2910 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2911 onpass="PING ALL PASS",
2912 onfail="PING ALL FAIL" )
2913
GlennRCbddd58f2015-10-01 15:45:25 -07002914 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002915 utilities.assert_equals(
2916 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002917 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002918 onpass="IPv6 Ping across 600 Point intents test PASS",
2919 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2920
2921 def CASE174( self ):
2922 """
2923 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2924 """
2925 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2926 main.log.report( "_________________________________________________" )
2927 import itertools
2928 import time
2929 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2930 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002931 pingResult = main.FALSE
2932 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002933 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002934 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002935 main.log.warn("First ping failed. Retrying...")
2936 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002937 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002938 time2 = time.time()
2939 timeDiff = round( ( time2 - time1 ), 2 )
2940 main.log.report(
2941 "Time taken for IPv6 Ping All: " +
2942 str( timeDiff ) +
2943 " seconds" )
2944 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2945 onpass="PING ALL PASS",
2946 onfail="PING ALL FAIL" )
2947
GlennRCbddd58f2015-10-01 15:45:25 -07002948 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002949 utilities.assert_equals(
2950 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002951 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002952 onpass="IPv6 Ping across 2278 host intents test PASS",
2953 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2954
2955 def CASE184( self ):
2956 """
2957 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2958 """
2959 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2960 main.log.report( "_________________________________________________" )
2961 import itertools
2962 import time
2963 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2964 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002965 pingResult = main.FALSE
2966 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002967 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002968 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002969 main.log.warn("First ping failed. Retrying...")
2970 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002971 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002972 time2 = time.time()
2973 timeDiff = round( ( time2 - time1 ), 2 )
2974 main.log.report(
2975 "Time taken for IPv6 Ping All: " +
2976 str( timeDiff ) +
2977 " seconds" )
2978 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2979 onpass="PING ALL PASS",
2980 onfail="PING ALL FAIL" )
2981
GlennRCbddd58f2015-10-01 15:45:25 -07002982 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002983 utilities.assert_equals(
2984 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002985 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002986 onpass="IPv6 Ping across 2278 host intents test PASS",
2987 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2988
2989 def CASE175( self ):
2990 """
2991 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2992 """
2993 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2994 main.log.report( "_________________________________________________" )
2995 import itertools
2996 import time
2997 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2998 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002999 pingResult = main.FALSE
3000 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003001 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003002 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003003 main.log.warn("First ping failed. Retrying...")
3004 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003005 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003006 time2 = time.time()
3007 timeDiff = round( ( time2 - time1 ), 2 )
3008 main.log.report(
3009 "Time taken for IPv6 Ping All: " +
3010 str( timeDiff ) +
3011 " seconds" )
3012 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3013 onpass="PING ALL PASS",
3014 onfail="PING ALL FAIL" )
3015
GlennRCbddd58f2015-10-01 15:45:25 -07003016 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003017 utilities.assert_equals(
3018 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003019 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003020 onpass="IPv6 Ping across 4556 point intents test PASS",
3021 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3022
3023 def CASE185( self ):
3024 """
3025 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3026 """
3027 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3028 main.log.report( "_________________________________________________" )
3029 import itertools
3030 import time
3031 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3032 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003033 pingResult = main.FALSE
3034 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003035 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003036 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003037 main.log.warn("First ping failed. Retrying...")
3038 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003039 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003040 time2 = time.time()
3041 timeDiff = round( ( time2 - time1 ), 2 )
3042 main.log.report(
3043 "Time taken for IPv6 Ping All: " +
3044 str( timeDiff ) +
3045 " seconds" )
3046 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3047 onpass="PING ALL PASS",
3048 onfail="PING ALL FAIL" )
3049
GlennRCbddd58f2015-10-01 15:45:25 -07003050 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003051 utilities.assert_equals(
3052 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003053 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003054 onpass="IPv6 Ping across 4556 Point intents test PASS",
3055 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3056
Hari Krishnac195f3b2015-07-08 20:02:24 -07003057 def CASE90( self ):
3058 """
3059 Install 600 point intents and verify ping all (Att Topology)
3060 """
3061 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3062 main.log.report( "_______________________________________" )
3063 import itertools
3064 import time
3065 main.case( "Install 600 point intents" )
3066 main.step( "Add point Intents" )
3067 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003068 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3069
Hari Krishnac195f3b2015-07-08 20:02:24 -07003070 intentIdList = []
3071 time1 = time.time()
3072 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3073 pool = []
3074 for cli in main.CLIs:
3075 if i >= len( deviceCombos ):
3076 break
3077 t = main.Thread( target=cli.addPointIntent,
3078 threadID=main.threadID,
3079 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003080 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 -07003081 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003082 t.start()
3083 i = i + 1
3084 main.threadID = main.threadID + 1
3085 for thread in pool:
3086 thread.join()
3087 intentIdList.append(thread.result)
3088 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003089 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003090
GlennRCfcfdc4f2015-09-30 16:01:57 -07003091 # Saving intent ids to check intents in later case
3092 main.intentIds = list(intentIdList)
3093
GlennRCa8d786a2015-09-23 17:40:11 -07003094 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003095
GlennRC1dde1712015-10-02 11:03:08 -07003096 # Giving onos multiple chances to install intents
3097 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003098 if i != 0:
3099 main.log.warn( "Verification failed. Retrying..." )
3100 main.log.info("Waiting for onos to install intents...")
3101 time.sleep( main.checkIntentsDelay )
3102
GlennRCa8d786a2015-09-23 17:40:11 -07003103 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003104 for e in range(int(main.numCtrls)):
3105 main.log.info( "Checking intents on CLI %s" % (e+1) )
3106 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3107 intentState
3108 if not intentState:
3109 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003110 if intentState:
3111 break
GlennRCdb2c8422015-09-29 12:21:59 -07003112 else:
3113 #Dumping intent summary
3114 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003115
3116 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3117 onpass="INTENTS INSTALLED",
3118 onfail="SOME INTENTS NOT INSTALLED" )
3119
Hari Krishnac195f3b2015-07-08 20:02:24 -07003120 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003121 for i in range(main.numPings):
3122 time1 = time.time()
3123 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3124 if not pingResult:
3125 main.log.warn("First pingall failed. Retrying...")
3126 time.sleep(main.pingSleep)
3127 else: break
3128
Hari Krishnac195f3b2015-07-08 20:02:24 -07003129 time2 = time.time()
3130 timeDiff = round( ( time2 - time1 ), 2 )
3131 main.log.report(
3132 "Time taken for Ping All: " +
3133 str( timeDiff ) +
3134 " seconds" )
3135 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003136 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003137 onfail="PING ALL FAIL" )
3138
GlennRCbddd58f2015-10-01 15:45:25 -07003139 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003140
Hari Krishnac195f3b2015-07-08 20:02:24 -07003141 utilities.assert_equals(
3142 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003143 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003144 onpass="Install 600 point Intents and Ping All test PASS",
3145 onfail="Install 600 point Intents and Ping All test FAIL" )
3146
GlennRCbddd58f2015-10-01 15:45:25 -07003147 if not intentState:
3148 main.log.debug( "Intents failed to install completely" )
3149 if not pingResult:
3150 main.log.debug( "Pingall failed" )
3151
3152 if not caseResult and main.failSwitch:
3153 main.log.report("Stopping test")
3154 main.stop( email=main.emailOnStop )
3155
Hari Krishnac195f3b2015-07-08 20:02:24 -07003156 def CASE91( self ):
3157 """
3158 Install 600 point intents and verify ping all (Chordal Topology)
3159 """
3160 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3161 main.log.report( "_______________________________________" )
3162 import itertools
3163 import time
3164 main.case( "Install 600 point intents" )
3165 main.step( "Add point Intents" )
3166 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003167 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3168
Hari Krishnac195f3b2015-07-08 20:02:24 -07003169 intentIdList = []
3170 time1 = time.time()
3171 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3172 pool = []
3173 for cli in main.CLIs:
3174 if i >= len( deviceCombos ):
3175 break
3176 t = main.Thread( target=cli.addPointIntent,
3177 threadID=main.threadID,
3178 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003179 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 -07003180 pool.append(t)
3181 #time.sleep(1)
3182 t.start()
3183 i = i + 1
3184 main.threadID = main.threadID + 1
3185 for thread in pool:
3186 thread.join()
3187 intentIdList.append(thread.result)
3188 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003189 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003190
GlennRCfcfdc4f2015-09-30 16:01:57 -07003191 # Saving intent ids to check intents in later case
3192 main.intentIds = list(intentIdList)
3193
GlennRCa8d786a2015-09-23 17:40:11 -07003194 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003195
GlennRC1dde1712015-10-02 11:03:08 -07003196 # Giving onos multiple chances to install intents
3197 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003198 if i != 0:
3199 main.log.warn( "Verification failed. Retrying..." )
3200 main.log.info("Waiting for onos to install intents...")
3201 time.sleep( main.checkIntentsDelay )
3202
GlennRCa8d786a2015-09-23 17:40:11 -07003203 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003204 for e in range(int(main.numCtrls)):
3205 main.log.info( "Checking intents on CLI %s" % (e+1) )
3206 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3207 intentState
3208 if not intentState:
3209 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003210 if intentState:
3211 break
GlennRCdb2c8422015-09-29 12:21:59 -07003212 else:
3213 #Dumping intent summary
3214 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003215
3216 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3217 onpass="INTENTS INSTALLED",
3218 onfail="SOME INTENTS NOT INSTALLED" )
3219
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003221 for i in range(main.numPings):
3222 time1 = time.time()
3223 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3224 if not pingResult:
3225 main.log.warn("First pingall failed. Retrying...")
3226 time.sleep(main.pingSleep)
3227 else: break
3228
Hari Krishnac195f3b2015-07-08 20:02:24 -07003229 time2 = time.time()
3230 timeDiff = round( ( time2 - time1 ), 2 )
3231 main.log.report(
3232 "Time taken for Ping All: " +
3233 str( timeDiff ) +
3234 " seconds" )
3235 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3236 onpass="PING ALL PASS",
3237 onfail="PING ALL FAIL" )
3238
GlennRCbddd58f2015-10-01 15:45:25 -07003239 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003240
Hari Krishnac195f3b2015-07-08 20:02:24 -07003241 utilities.assert_equals(
3242 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003243 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003244 onpass="Install 600 point Intents and Ping All test PASS",
3245 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003246
GlennRCbddd58f2015-10-01 15:45:25 -07003247 if not intentState:
3248 main.log.debug( "Intents failed to install completely" )
3249 if not pingResult:
3250 main.log.debug( "Pingall failed" )
3251
3252 if not caseResult and main.failSwitch:
3253 main.log.report("Stopping test")
3254 main.stop( email=main.emailOnStop )
3255
Hari Krishnac195f3b2015-07-08 20:02:24 -07003256 def CASE92( self ):
3257 """
3258 Install 4556 point intents and verify ping all (Spine Topology)
3259 """
3260 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3261 main.log.report( "_______________________________________" )
3262 import itertools
3263 import time
3264 main.case( "Install 4556 point intents" )
3265 main.step( "Add point Intents" )
3266 intentResult = main.TRUE
3267 main.pingTimeout = 600
3268 for i in range(len(main.hostMACs)):
3269 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3270 print main.MACsDict
3271 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3272 intentIdList = []
3273 time1 = time.time()
3274 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3275 pool = []
3276 for cli in main.CLIs:
3277 if i >= len( deviceCombos ):
3278 break
3279 t = main.Thread( target=cli.addPointIntent,
3280 threadID=main.threadID,
3281 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003282 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 -07003283 pool.append(t)
3284 #time.sleep(1)
3285 t.start()
3286 i = i + 1
3287 main.threadID = main.threadID + 1
3288 for thread in pool:
3289 thread.join()
3290 intentIdList.append(thread.result)
3291 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003292 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003293
GlennRCfcfdc4f2015-09-30 16:01:57 -07003294 # Saving intent ids to check intents in later case
3295 main.intentIds = list(intentIdList)
3296
GlennRCa8d786a2015-09-23 17:40:11 -07003297 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003298
GlennRC1dde1712015-10-02 11:03:08 -07003299 # Giving onos multiple chances to install intents
3300 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003301 if i != 0:
3302 main.log.warn( "Verification failed. Retrying..." )
3303 main.log.info("Waiting for onos to install intents...")
3304 time.sleep( main.checkIntentsDelay )
3305
GlennRCa8d786a2015-09-23 17:40:11 -07003306 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003307 for e in range(int(main.numCtrls)):
3308 main.log.info( "Checking intents on CLI %s" % (e+1) )
3309 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3310 intentState
3311 if not intentState:
3312 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003313 if intentState:
3314 break
GlennRCdb2c8422015-09-29 12:21:59 -07003315 else:
3316 #Dumping intent summary
3317 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003318
3319 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3320 onpass="INTENTS INSTALLED",
3321 onfail="SOME INTENTS NOT INSTALLED" )
3322
Hari Krishnac195f3b2015-07-08 20:02:24 -07003323 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003324 for i in range(main.numPings):
3325 time1 = time.time()
3326 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3327 if not pingResult:
3328 main.log.warn("First pingall failed. Retrying...")
3329 time.sleep(main.pingSleep)
3330 else: break
3331
Hari Krishnac195f3b2015-07-08 20:02:24 -07003332 time2 = time.time()
3333 timeDiff = round( ( time2 - time1 ), 2 )
3334 main.log.report(
3335 "Time taken for Ping All: " +
3336 str( timeDiff ) +
3337 " seconds" )
3338 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3339 onpass="PING ALL PASS",
3340 onfail="PING ALL FAIL" )
3341
GlennRCbddd58f2015-10-01 15:45:25 -07003342 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003343
Hari Krishnac195f3b2015-07-08 20:02:24 -07003344 utilities.assert_equals(
3345 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003346 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003347 onpass="Install 4556 point Intents and Ping All test PASS",
3348 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003349
GlennRCbddd58f2015-10-01 15:45:25 -07003350 if not intentState:
3351 main.log.debug( "Intents failed to install completely" )
3352 if not pingResult:
3353 main.log.debug( "Pingall failed" )
3354
3355 if not caseResult and main.failSwitch:
3356 main.log.report("Stopping test")
3357 main.stop( email=main.emailOnStop )
3358
Hari Krishnac195f3b2015-07-08 20:02:24 -07003359 def CASE93( self ):
3360 """
3361 Install multi-single point intents and verify Ping all works
3362 for att topology
3363 """
3364 import copy
3365 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003366 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003367 main.log.report( "Install multi-single point intents and verify Ping all" )
3368 main.log.report( "___________________________________________" )
3369 main.case( "Install multi-single point intents and Ping all" )
3370 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3371 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3372 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003373 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003374 time1 = time.time()
3375 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3376 pool = []
3377 for cli in main.CLIs:
3378 egressDevice = deviceDPIDsCopy[i]
3379 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3380 ingressDeviceList.remove(egressDevice)
3381 if i >= len( deviceDPIDsCopy ):
3382 break
3383 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3384 threadID=main.threadID,
3385 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003386 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003387 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003388 t.start()
3389 i = i + 1
3390 main.threadID = main.threadID + 1
3391 for thread in pool:
3392 thread.join()
3393 intentIdList.append(thread.result)
3394 time2 = time.time()
3395 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003396
GlennRCdb2c8422015-09-29 12:21:59 -07003397 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003398
GlennRC1dde1712015-10-02 11:03:08 -07003399 # Giving onos multiple chances to install intents
3400 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003401 if i != 0:
3402 main.log.warn( "Verification failed. Retrying..." )
3403 main.log.info("Waiting for onos to install intents...")
3404 time.sleep( main.checkIntentsDelay )
3405
3406 intentState = main.TRUE
3407 for e in range(int(main.numCtrls)):
3408 main.log.info( "Checking intents on CLI %s" % (e+1) )
3409 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3410 intentState
3411 if not intentState:
3412 main.log.warn( "Not all intents installed" )
3413 if intentState:
3414 break
3415 else:
3416 #Dumping intent summary
3417 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3418
3419 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3420 onpass="INTENTS INSTALLED",
3421 onfail="SOME INTENTS NOT INSTALLED" )
3422
GlennRCfa69a2a2015-10-02 15:54:06 -07003423 main.step("Verify flows are all added")
3424
3425 for i in range( main.flowCheck ):
3426 if i != 0:
3427 main.log.warn( "verification failed. Retrying..." )
3428 main.log.info( "Waiting for onos to add flows..." )
3429 time.sleep( main.checkFlowsDelay )
3430
3431 flowState = main.TRUE
3432 for cli in main.CLIs:
3433 flowState = cli.checkFlowState()
3434 if not flowState:
3435 main.log.warn( "Not all flows added" )
3436 if flowState:
3437 break
3438 else:
3439 #Dumping summary
3440 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3441
3442 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3443 onpass="FLOWS INSTALLED",
3444 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003445
Hari Krishnac195f3b2015-07-08 20:02:24 -07003446 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003447 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003448 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003449 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3450 if not pingResult:
3451 main.log.warn("First pingall failed. Retrying...")
3452 time.sleep(main.pingSleep)
3453 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003454
Hari Krishnac195f3b2015-07-08 20:02:24 -07003455 time2 = time.time()
3456 timeDiff = round( ( time2 - time1 ), 2 )
3457 main.log.report(
3458 "Time taken for Ping All: " +
3459 str( timeDiff ) +
3460 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003461
GlennRCbddd58f2015-10-01 15:45:25 -07003462 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003463 utilities.assert_equals(
3464 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003465 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003466 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3467 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003468
GlennRCfa69a2a2015-10-02 15:54:06 -07003469 if not intentState:
3470 main.log.debug( "Intents failed to install completely" )
3471 if not pingResult:
3472 main.log.debug( "Pingall failed" )
3473 if not checkFlowsState:
3474 main.log.debug( "Flows failed to add completely" )
3475
3476 if not caseResult and main.failSwitch:
3477 main.log.report("Stopping test")
3478 main.stop( email=main.emailOnStop )
3479
Hari Krishnac195f3b2015-07-08 20:02:24 -07003480 def CASE94( self ):
3481 """
3482 Install multi-single point intents and verify Ping all works
3483 for Chordal topology
3484 """
3485 import copy
3486 import time
3487 main.log.report( "Install multi-single point intents and verify Ping all" )
3488 main.log.report( "___________________________________________" )
3489 main.case( "Install multi-single point intents and Ping all" )
3490 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3491 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3492 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003493 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003494 time1 = time.time()
3495 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3496 pool = []
3497 for cli in main.CLIs:
3498 egressDevice = deviceDPIDsCopy[i]
3499 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3500 ingressDeviceList.remove(egressDevice)
3501 if i >= len( deviceDPIDsCopy ):
3502 break
3503 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3504 threadID=main.threadID,
3505 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003506 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003507 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003508 t.start()
3509 i = i + 1
3510 main.threadID = main.threadID + 1
3511 for thread in pool:
3512 thread.join()
3513 intentIdList.append(thread.result)
3514 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003515 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003516
3517 main.step("Verify intents are installed")
3518
GlennRC1dde1712015-10-02 11:03:08 -07003519 # Giving onos multiple chances to install intents
3520 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003521 if i != 0:
3522 main.log.warn( "Verification failed. Retrying..." )
3523 main.log.info("Waiting for onos to install intents...")
3524 time.sleep( main.checkIntentsDelay )
3525
3526 intentState = main.TRUE
3527 for e in range(int(main.numCtrls)):
3528 main.log.info( "Checking intents on CLI %s" % (e+1) )
3529 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3530 intentState
3531 if not intentState:
3532 main.log.warn( "Not all intents installed" )
3533 if intentState:
3534 break
3535 else:
3536 #Dumping intent summary
3537 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3538
GlennRCdb2c8422015-09-29 12:21:59 -07003539 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3540 onpass="INTENTS INSTALLED",
3541 onfail="SOME INTENTS NOT INSTALLED" )
3542
GlennRCfa69a2a2015-10-02 15:54:06 -07003543 main.step("Verify flows are all added")
3544
3545 for i in range( main.flowCheck ):
3546 if i != 0:
3547 main.log.warn( "verification failed. Retrying..." )
3548 main.log.info( "Waiting for onos to add flows..." )
3549 time.sleep( main.checkFlowsDelay )
3550
3551 flowState = main.TRUE
3552 for cli in main.CLIs:
3553 flowState = cli.checkFlowState()
3554 if not flowState:
3555 main.log.warn( "Not all flows added" )
3556 if flowState:
3557 break
3558 else:
3559 #Dumping summary
3560 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3561
3562 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3563 onpass="FLOWS INSTALLED",
3564 onfail="SOME FLOWS NOT ADDED" )
3565
Hari Krishnac195f3b2015-07-08 20:02:24 -07003566 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003567 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003568 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003569 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3570 if not pingResult:
3571 main.log.warn("First pingall failed. Retrying...")
3572 time.sleep(main.pingSleep)
3573 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003574
Hari Krishnac195f3b2015-07-08 20:02:24 -07003575 time2 = time.time()
3576 timeDiff = round( ( time2 - time1 ), 2 )
3577 main.log.report(
3578 "Time taken for Ping All: " +
3579 str( timeDiff ) +
3580 " seconds" )
3581
GlennRCfa69a2a2015-10-02 15:54:06 -07003582 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003583 utilities.assert_equals(
3584 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003585 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003586 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3587 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003588
GlennRCfa69a2a2015-10-02 15:54:06 -07003589 if not intentState:
3590 main.log.debug( "Intents failed to install completely" )
3591 if not pingResult:
3592 main.log.debug( "Pingall failed" )
3593 if not checkFlowsState:
3594 main.log.debug( "Flows failed to add completely" )
3595
3596 if not caseResult and main.failSwitch:
3597 main.log.report("Stopping test")
3598 main.stop( email=main.emailOnStop )
3599
3600 def CASE95( self ):
3601 """
3602 Install multi-single point intents and verify Ping all works
3603 for Spine topology
3604 """
3605 import copy
3606 import time
3607 main.log.report( "Install multi-single point intents and verify Ping all" )
3608 main.log.report( "___________________________________________" )
3609 main.case( "Install multi-single point intents and Ping all" )
3610 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3611 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3612 intentIdList = []
3613 main.log.info( "MACsDict" + str(main.MACsDict) )
3614 time1 = time.time()
3615 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3616 pool = []
3617 for cli in main.CLIs:
3618 egressDevice = deviceDPIDsCopy[i]
3619 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3620 ingressDeviceList.remove(egressDevice)
3621 if i >= len( deviceDPIDsCopy ):
3622 break
3623 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3624 threadID=main.threadID,
3625 name="addMultipointToSinglepointIntent",
3626 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3627 pool.append(t)
3628 t.start()
3629 i = i + 1
3630 main.threadID = main.threadID + 1
3631 for thread in pool:
3632 thread.join()
3633 intentIdList.append(thread.result)
3634 time2 = time.time()
3635 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3636
3637 main.step("Verify intents are installed")
3638
3639 # Giving onos multiple chances to install intents
3640 for i in range( main.intentCheck ):
3641 if i != 0:
3642 main.log.warn( "Verification failed. Retrying..." )
3643 main.log.info("Waiting for onos to install intents...")
3644 time.sleep( main.checkIntentsDelay )
3645
3646 intentState = main.TRUE
3647 for e in range(int(main.numCtrls)):
3648 main.log.info( "Checking intents on CLI %s" % (e+1) )
3649 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3650 intentState
3651 if not intentState:
3652 main.log.warn( "Not all intents installed" )
3653 if intentState:
3654 break
3655 else:
3656 #Dumping intent summary
3657 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3658
3659 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3660 onpass="INTENTS INSTALLED",
3661 onfail="SOME INTENTS NOT INSTALLED" )
3662
3663 main.step("Verify flows are all added")
3664
3665 for i in range( main.flowCheck ):
3666 if i != 0:
3667 main.log.warn( "verification failed. Retrying..." )
3668 main.log.info( "Waiting for onos to add flows..." )
3669 time.sleep( main.checkFlowsDelay )
3670
3671 flowState = main.TRUE
3672 for cli in main.CLIs:
3673 flowState = cli.checkFlowState()
3674 if not flowState:
3675 main.log.warn( "Not all flows added" )
3676 if flowState:
3677 break
3678 else:
3679 #Dumping summary
3680 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3681
3682 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3683 onpass="FLOWS INSTALLED",
3684 onfail="SOME FLOWS NOT ADDED" )
3685
3686 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003687 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003688 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003689 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3690 if not pingResult:
3691 main.log.warn("First pingall failed. Retrying...")
3692 time.sleep(main.pingSleep)
3693 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003694
3695 time2 = time.time()
3696 timeDiff = round( ( time2 - time1 ), 2 )
3697 main.log.report(
3698 "Time taken for Ping All: " +
3699 str( timeDiff ) +
3700 " seconds" )
3701
3702 caseResult = ( checkFlowsState and pingResult and intentState )
3703 utilities.assert_equals(
3704 expect=main.TRUE,
3705 actual=caseResult,
3706 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3707 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3708
3709 if not intentState:
3710 main.log.debug( "Intents failed to install completely" )
3711 if not pingResult:
3712 main.log.debug( "Pingall failed" )
3713 if not checkFlowsState:
3714 main.log.debug( "Flows failed to add completely" )
3715
3716 if not caseResult and main.failSwitch:
3717 main.log.report("Stopping test")
3718 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003719
3720 def CASE96( self ):
3721 """
3722 Install single-multi point intents and verify Ping all works
3723 for att topology
3724 """
3725 import copy
3726 main.log.report( "Install single-multi point intents and verify Ping all" )
3727 main.log.report( "___________________________________________" )
3728 main.case( "Install single-multi point intents and Ping all" )
3729 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3730 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3731 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003732 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003733 time1 = time.time()
3734 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3735 pool = []
3736 for cli in main.CLIs:
3737 ingressDevice = deviceDPIDsCopy[i]
3738 egressDeviceList = copy.copy(deviceDPIDsCopy)
3739 egressDeviceList.remove(ingressDevice)
3740 if i >= len( deviceDPIDsCopy ):
3741 break
3742 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3743 threadID=main.threadID,
3744 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003745 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003746 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003747 t.start()
3748 i = i + 1
3749 main.threadID = main.threadID + 1
3750 for thread in pool:
3751 thread.join()
3752 intentIdList.append(thread.result)
3753 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003754 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003755
3756 main.step("Verify intents are installed")
3757
GlennRC1dde1712015-10-02 11:03:08 -07003758 # Giving onos multiple chances to install intents
3759 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003760 if i != 0:
3761 main.log.warn( "Verification failed. Retrying..." )
3762 main.log.info("Waiting for onos to install intents...")
3763 time.sleep( main.checkIntentsDelay )
3764
3765 intentState = main.TRUE
3766 for e in range(int(main.numCtrls)):
3767 main.log.info( "Checking intents on CLI %s" % (e+1) )
3768 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3769 intentState
3770 if not intentState:
3771 main.log.warn( "Not all intents installed" )
3772 if intentState:
3773 break
3774 else:
3775 #Dumping intent summary
3776 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3777
GlennRCdb2c8422015-09-29 12:21:59 -07003778 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3779 onpass="INTENTS INSTALLED",
3780 onfail="SOME INTENTS NOT INSTALLED" )
3781
GlennRCfa69a2a2015-10-02 15:54:06 -07003782 main.step("Verify flows are all added")
3783
3784 for i in range( main.flowCheck ):
3785 if i != 0:
3786 main.log.warn( "verification failed. Retrying..." )
3787 main.log.info( "Waiting for onos to add flows..." )
3788 time.sleep( main.checkFlowsDelay )
3789
3790 flowState = main.TRUE
3791 for cli in main.CLIs:
3792 flowState = cli.checkFlowState()
3793 if not flowState:
3794 main.log.warn( "Not all flows added" )
3795 if flowState:
3796 break
3797 else:
3798 #Dumping summary
3799 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3800
3801 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3802 onpass="FLOWS INSTALLED",
3803 onfail="SOME FLOWS NOT ADDED" )
3804
Hari Krishnac195f3b2015-07-08 20:02:24 -07003805 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003806 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003807 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003808 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3809 if not pingResult:
3810 main.log.warn("First pingall failed. Retrying...")
3811 time.sleep(main.pingSleep)
3812 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003813
Hari Krishnac195f3b2015-07-08 20:02:24 -07003814 time2 = time.time()
3815 timeDiff = round( ( time2 - time1 ), 2 )
3816 main.log.report(
3817 "Time taken for Ping All: " +
3818 str( timeDiff ) +
3819 " seconds" )
3820
GlennRCfa69a2a2015-10-02 15:54:06 -07003821 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003822 utilities.assert_equals(
3823 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003824 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003825 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3826 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3827
GlennRCfa69a2a2015-10-02 15:54:06 -07003828 if not intentState:
3829 main.log.debug( "Intents failed to install completely" )
3830 if not pingResult:
3831 main.log.debug( "Pingall failed" )
3832 if not checkFlowsState:
3833 main.log.debug( "Flows failed to add completely" )
3834
3835 if not caseResult and main.failSwitch:
3836 main.log.report("Stopping test")
3837 main.stop( email=main.emailOnStop )
3838
Hari Krishnac195f3b2015-07-08 20:02:24 -07003839 def CASE97( self ):
3840 """
3841 Install single-multi point intents and verify Ping all works
3842 for Chordal topology
3843 """
3844 import copy
3845 main.log.report( "Install single-multi point intents and verify Ping all" )
3846 main.log.report( "___________________________________________" )
3847 main.case( "Install single-multi point intents and Ping all" )
3848 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3849 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3850 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003851 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003852 time1 = time.time()
3853 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3854 pool = []
3855 for cli in main.CLIs:
3856 ingressDevice = deviceDPIDsCopy[i]
3857 egressDeviceList = copy.copy(deviceDPIDsCopy)
3858 egressDeviceList.remove(ingressDevice)
3859 if i >= len( deviceDPIDsCopy ):
3860 break
3861 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3862 threadID=main.threadID,
3863 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003864 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003865 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003866 t.start()
3867 i = i + 1
3868 main.threadID = main.threadID + 1
3869 for thread in pool:
3870 thread.join()
3871 intentIdList.append(thread.result)
3872 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003873 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003874
3875 main.step("Verify intents are installed")
3876
GlennRC1dde1712015-10-02 11:03:08 -07003877 # Giving onos multiple chances to install intents
3878 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003879 if i != 0:
3880 main.log.warn( "Verification failed. Retrying..." )
3881 main.log.info("Waiting for onos to install intents...")
3882 time.sleep( main.checkIntentsDelay )
3883
3884 intentState = main.TRUE
3885 for e in range(int(main.numCtrls)):
3886 main.log.info( "Checking intents on CLI %s" % (e+1) )
3887 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3888 intentState
3889 if not intentState:
3890 main.log.warn( "Not all intents installed" )
3891 if intentState:
3892 break
3893 else:
3894 #Dumping intent summary
3895 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3896
GlennRCdb2c8422015-09-29 12:21:59 -07003897 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3898 onpass="INTENTS INSTALLED",
3899 onfail="SOME INTENTS NOT INSTALLED" )
3900
GlennRCfa69a2a2015-10-02 15:54:06 -07003901 main.step("Verify flows are all added")
3902
3903 for i in range( main.flowCheck ):
3904 if i != 0:
3905 main.log.warn( "verification failed. Retrying..." )
3906 main.log.info( "Waiting for onos to add flows..." )
3907 time.sleep( main.checkFlowsDelay )
3908
3909 flowState = main.TRUE
3910 for cli in main.CLIs:
3911 flowState = cli.checkFlowState()
3912 if not flowState:
3913 main.log.warn( "Not all flows added" )
3914 if flowState:
3915 break
3916 else:
3917 #Dumping summary
3918 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3919
3920 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3921 onpass="FLOWS INSTALLED",
3922 onfail="SOME FLOWS NOT ADDED" )
3923
Hari Krishnac195f3b2015-07-08 20:02:24 -07003924 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003925 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003926 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003927 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3928 if not pingResult:
3929 main.log.warn("First pingall failed. Retrying...")
3930 time.sleep(main.pingSleep)
3931 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003932
Hari Krishnac195f3b2015-07-08 20:02:24 -07003933 time2 = time.time()
3934 timeDiff = round( ( time2 - time1 ), 2 )
3935 main.log.report(
3936 "Time taken for Ping All: " +
3937 str( timeDiff ) +
3938 " seconds" )
3939
GlennRCfa69a2a2015-10-02 15:54:06 -07003940 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003941 utilities.assert_equals(
3942 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003943 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003944 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3945 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3946
GlennRCfa69a2a2015-10-02 15:54:06 -07003947 if not intentState:
3948 main.log.debug( "Intents failed to install completely" )
3949 if not pingResult:
3950 main.log.debug( "Pingall failed" )
3951 if not checkFlowsState:
3952 main.log.debug( "Flows failed to add completely" )
3953
3954 if not caseResult and main.failSwitch:
3955 main.log.report("Stopping test")
3956 main.stop( email=main.emailOnStop )
3957
Hari Krishnac195f3b2015-07-08 20:02:24 -07003958 def CASE98( self ):
3959 """
3960 Install single-multi point intents and verify Ping all works
3961 for Spine topology
3962 """
3963 import copy
3964 main.log.report( "Install single-multi point intents and verify Ping all" )
3965 main.log.report( "___________________________________________" )
3966 main.case( "Install single-multi point intents and Ping all" )
3967 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3968 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3969 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3970 intentIdList = []
3971 MACsDictCopy = {}
3972 for i in range( len( deviceDPIDsCopy ) ):
3973 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3974
GlennRCfa69a2a2015-10-02 15:54:06 -07003975 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3976 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003977 time1 = time.time()
3978 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3979 pool = []
3980 for cli in main.CLIs:
3981 if i >= len( deviceDPIDsCopy ):
3982 break
3983 ingressDevice = deviceDPIDsCopy[i]
3984 egressDeviceList = copy.copy(deviceDPIDsCopy)
3985 egressDeviceList.remove(ingressDevice)
3986 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3987 threadID=main.threadID,
3988 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003989 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003990 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003991 t.start()
3992 i = i + 1
3993 main.threadID = main.threadID + 1
3994 for thread in pool:
3995 thread.join()
3996 intentIdList.append(thread.result)
3997 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003998 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003999
4000 main.step("Verify intents are installed")
4001
GlennRC1dde1712015-10-02 11:03:08 -07004002 # Giving onos multiple chances to install intents
4003 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004004 if i != 0:
4005 main.log.warn( "Verification failed. Retrying..." )
4006 main.log.info("Waiting for onos to install intents...")
4007 time.sleep( main.checkIntentsDelay )
4008
4009 intentState = main.TRUE
4010 for e in range(int(main.numCtrls)):
4011 main.log.info( "Checking intents on CLI %s" % (e+1) )
4012 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4013 intentState
4014 if not intentState:
4015 main.log.warn( "Not all intents installed" )
4016 if intentState:
4017 break
4018 else:
4019 #Dumping intent summary
4020 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4021
GlennRCdb2c8422015-09-29 12:21:59 -07004022 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4023 onpass="INTENTS INSTALLED",
4024 onfail="SOME INTENTS NOT INSTALLED" )
4025
GlennRCfa69a2a2015-10-02 15:54:06 -07004026 main.step("Verify flows are all added")
4027
4028 for i in range( main.flowCheck ):
4029 if i != 0:
4030 main.log.warn( "verification failed. Retrying..." )
4031 main.log.info( "Waiting for onos to add flows..." )
4032 time.sleep( main.checkFlowsDelay )
4033
4034 flowState = main.TRUE
4035 for cli in main.CLIs:
4036 flowState = cli.checkFlowState()
4037 if not flowState:
4038 main.log.warn( "Not all flows added" )
4039 if flowState:
4040 break
4041 else:
4042 #Dumping summary
4043 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4044
4045 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4046 onpass="FLOWS INSTALLED",
4047 onfail="SOME FLOWS NOT ADDED" )
4048
Hari Krishnac195f3b2015-07-08 20:02:24 -07004049 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004050 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004051 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004052 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4053 if not pingResult:
4054 main.log.warn("First pingall failed. Retrying...")
4055 time.sleep(main.pingSleep)
4056 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004057
Hari Krishnac195f3b2015-07-08 20:02:24 -07004058 time2 = time.time()
4059 timeDiff = round( ( time2 - time1 ), 2 )
4060 main.log.report(
4061 "Time taken for Ping All: " +
4062 str( timeDiff ) +
4063 " seconds" )
4064
GlennRCfa69a2a2015-10-02 15:54:06 -07004065 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004066 utilities.assert_equals(
4067 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004068 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004069 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4070 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4071
GlennRCfa69a2a2015-10-02 15:54:06 -07004072 if not intentState:
4073 main.log.debug( "Intents failed to install completely" )
4074 if not pingResult:
4075 main.log.debug( "Pingall failed" )
4076 if not checkFlowsState:
4077 main.log.debug( "Flows failed to add completely" )
4078
4079 if not caseResult and main.failSwitch:
4080 main.log.report("Stopping test")
4081 main.stop( email=main.emailOnStop )
4082
Hari Krishna4223dbd2015-08-13 16:29:53 -07004083 def CASE190( self ):
4084 """
4085 Verify IPv6 ping across 600 Point intents (Att Topology)
4086 """
4087 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4088 main.log.report( "_________________________________________________" )
4089 import itertools
4090 import time
4091 main.case( "IPv6 ping all 600 Point intents" )
4092 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004093 pingResult = main.FALSE
4094 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004095 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004096 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004097 main.log.warn("First pingall failed. Retrying...")
4098 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004099 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004100 time2 = time.time()
4101 timeDiff = round( ( time2 - time1 ), 2 )
4102 main.log.report(
4103 "Time taken for IPv6 Ping All: " +
4104 str( timeDiff ) +
4105 " seconds" )
4106 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4107 onpass="PING ALL PASS",
4108 onfail="PING ALL FAIL" )
4109
GlennRCbddd58f2015-10-01 15:45:25 -07004110 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004111 utilities.assert_equals(
4112 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004113 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004114 onpass="IPv6 Ping across 600 Point intents test PASS",
4115 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4116
4117 def CASE191( self ):
4118 """
4119 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4120 """
4121 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4122 main.log.report( "_________________________________________________" )
4123 import itertools
4124 import time
4125 main.case( "IPv6 ping all 600 Point intents" )
4126 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004127 pingResult = main.FALSE
4128 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004129 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004130 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004131 main.log.warn("First pingall failed. Retrying...")
4132 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004133 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004134 time2 = time.time()
4135 timeDiff = round( ( time2 - time1 ), 2 )
4136 main.log.report(
4137 "Time taken for IPv6 Ping All: " +
4138 str( timeDiff ) +
4139 " seconds" )
4140 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4141 onpass="PING ALL PASS",
4142 onfail="PING ALL FAIL" )
4143
GlennRCbddd58f2015-10-01 15:45:25 -07004144 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004145 utilities.assert_equals(
4146 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004147 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004148 onpass="IPv6 Ping across 600 Point intents test PASS",
4149 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4150
4151 def CASE192( self ):
4152 """
4153 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4154 """
4155 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4156 main.log.report( "_________________________________________________" )
4157 import itertools
4158 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004159 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004160 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004161 pingResult = main.FALSE
4162 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004163 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004164 if not pingResult:
4165 main.log.warn("First pingall failed. Retrying...")
4166 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004167 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004168 time2 = time.time()
4169 timeDiff = round( ( time2 - time1 ), 2 )
4170 main.log.report(
4171 "Time taken for IPv6 Ping All: " +
4172 str( timeDiff ) +
4173 " seconds" )
4174 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4175 onpass="PING ALL PASS",
4176 onfail="PING ALL FAIL" )
4177
GlennRCbddd58f2015-10-01 15:45:25 -07004178 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004179 utilities.assert_equals(
4180 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004181 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004182 onpass="IPv6 Ping across 4556 Point intents test PASS",
4183 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004184
Hari Krishnac195f3b2015-07-08 20:02:24 -07004185 def CASE10( self ):
4186 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004187 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004188 """
4189 Remove all Intents
4190 """
4191 main.log.report( "Remove all intents that were installed previously" )
4192 main.log.report( "______________________________________________" )
4193 main.log.info( "Remove all intents" )
4194 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004195 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004196 main.step( "Obtain the intent id's first" )
4197 intentsList = main.ONOScli1.getAllIntentIds()
4198 ansi_escape = re.compile( r'\x1b[^m]*m' )
4199 intentsList = ansi_escape.sub( '', intentsList )
4200 intentsList = intentsList.replace(
4201 " onos:intents | grep id=",
4202 "" ).replace(
4203 "id=",
4204 "" ).replace(
4205 "\r\r",
4206 "" )
4207 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004208 intentIdList = []
4209 step1Result = main.TRUE
4210 moreIntents = main.TRUE
4211 removeIntentCount = 0
4212 intentsCount = len(intentsList)
4213 main.log.info ( "Current number of intents: " + str(intentsCount) )
4214 if ( len( intentsList ) > 1 ):
4215 results = main.TRUE
4216 main.log.info("Removing intent...")
4217 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004218 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004219 if removeIntentCount == 5:
4220 break
4221 removeIntentCount = removeIntentCount + 1
4222 intentsList1 = main.ONOScli1.getAllIntentIds()
4223 if len( intentsList1 ) == 0:
4224 break
4225 ansi_escape = re.compile( r'\x1b[^m]*m' )
4226 intentsList1 = ansi_escape.sub( '', intentsList1 )
4227 intentsList1 = intentsList1.replace(
4228 " onos:intents | grep id=",
4229 "" ).replace(
4230 " state=",
4231 "" ).replace(
4232 "\r\r",
4233 "" )
4234 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004235 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4236 print intentsList1
4237 intentIdList1 = []
4238 if ( len( intentsList1 ) > 0 ):
4239 moreIntents = main.TRUE
4240 for i in range( len( intentsList1 ) ):
4241 intentsTemp1 = intentsList1[ i ].split( ',' )
4242 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4243 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4244 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4245 time1 = time.time()
4246 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4247 pool = []
4248 for cli in main.CLIs:
4249 if i >= len( intentIdList1 ):
4250 break
4251 t = main.Thread( target=cli.removeIntent,
4252 threadID=main.threadID,
4253 name="removeIntent",
4254 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4255 pool.append(t)
4256 t.start()
4257 i = i + 1
4258 main.threadID = main.threadID + 1
4259 for thread in pool:
4260 thread.join()
4261 intentIdList.append(thread.result)
4262 #time.sleep(2)
4263 time2 = time.time()
4264 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004265 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004266 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004267 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004268 else:
4269 time.sleep(10)
4270 if len( main.ONOScli1.intents()):
4271 continue
4272 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004273 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004274 else:
4275 print "Removed %d intents" %(intentsCount)
4276 step1Result = main.TRUE
4277 else:
4278 print "No Intent IDs found in Intents list: ", intentsList
4279 step1Result = main.FALSE
4280
4281 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004282 caseResult = step1Result
4283 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004284 onpass="Intent removal test successful",
4285 onfail="Intent removal test failed" )
4286
4287 def CASE12( self, main ):
4288 """
4289 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4290 """
4291 import re
4292 import copy
4293 import time
4294
Hari Krishnac195f3b2015-07-08 20:02:24 -07004295 threadID = 0
4296
4297 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4298 main.log.report( "_____________________________________________________" )
4299 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4300 main.step( "Enable intent based Reactive forwarding" )
4301 installResult = main.FALSE
4302 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004303
Hari Krishnac195f3b2015-07-08 20:02:24 -07004304 pool = []
4305 time1 = time.time()
4306 for cli,feature in main.CLIs:
4307 t = main.Thread(target=cli,threadID=threadID,
4308 name="featureInstall",args=[feature])
4309 pool.append(t)
4310 t.start()
4311 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004312
Hari Krishnac195f3b2015-07-08 20:02:24 -07004313 results = []
4314 for thread in pool:
4315 thread.join()
4316 results.append(thread.result)
4317 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004318
Hari Krishnac195f3b2015-07-08 20:02:24 -07004319 if( all(result == main.TRUE for result in results) == False):
4320 main.log.info("Did not install onos-app-ifwd feature properly")
4321 #main.cleanup()
4322 #main.exit()
4323 else:
4324 main.log.info("Successful feature:install onos-app-ifwd")
4325 installResult = main.TRUE
4326 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004327
GlennRC6ac11b12015-10-21 17:41:28 -07004328 main.step( "Verify Ping across all hosts" )
4329 for i in range(main.numPings):
4330 time1 = time.time()
4331 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4332 if not pingResult:
4333 main.log.warn("First pingall failed. Retrying...")
4334 time.sleep(main.pingSleep)
4335 else: break
4336
Hari Krishnac195f3b2015-07-08 20:02:24 -07004337 time2 = time.time()
4338 timeDiff = round( ( time2 - time1 ), 2 )
4339 main.log.report(
4340 "Time taken for Ping All: " +
4341 str( timeDiff ) +
4342 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004343
GlennRC626ba132015-09-18 16:16:31 -07004344 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004345 main.log.report( "Pingall Test in Reactive mode successful" )
4346 else:
4347 main.log.report( "Pingall Test in Reactive mode failed" )
4348
4349 main.step( "Disable Intent based Reactive forwarding" )
4350 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004351
Hari Krishnac195f3b2015-07-08 20:02:24 -07004352 pool = []
4353 time1 = time.time()
4354 for cli,feature in main.CLIs:
4355 t = main.Thread(target=cli,threadID=threadID,
4356 name="featureUninstall",args=[feature])
4357 pool.append(t)
4358 t.start()
4359 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004360
Hari Krishnac195f3b2015-07-08 20:02:24 -07004361 results = []
4362 for thread in pool:
4363 thread.join()
4364 results.append(thread.result)
4365 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004366
Hari Krishnac195f3b2015-07-08 20:02:24 -07004367 if( all(result == main.TRUE for result in results) == False):
4368 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4369 uninstallResult = main.FALSE
4370 #main.cleanup()
4371 #main.exit()
4372 else:
4373 main.log.info("Successful feature:uninstall onos-app-ifwd")
4374 uninstallResult = main.TRUE
4375 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4376
4377 # Waiting for reative flows to be cleared.
4378 time.sleep( 10 )
4379
GlennRCbddd58f2015-10-01 15:45:25 -07004380 caseResult = installResult and pingResult and uninstallResult
4381 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004382 onpass="Intent based Reactive forwarding Pingall test PASS",
4383 onfail="Intent based Reactive forwarding Pingall test FAIL" )