blob: 0f14f7ec4338167d63f6cfd675e905628ec496ae [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
GlennRCef344fc2015-12-11 17:56:57 -080030 main.pingTimeout = 600
Hari Krishnac195f3b2015-07-08 20:02:24 -070031 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070032 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
33 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070034 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070036 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070037 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070038 main.intentCheck = int( main.params['TEST']['intentChecks'] )
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 = []
GlennRC186b7362015-12-11 18:20:16 -080043 main.prefix = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -070044
GlennRC9e7465e2015-10-02 13:50:36 -070045 main.failSwitch = True if main.failSwitch == "on" else False
46 main.emailOnStop = True if main.emailOnStop == "on" else False
47
Hari Krishnac195f3b2015-07-08 20:02:24 -070048 for i in range( 1, int(main.numCtrls) + 1 ):
49 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070050
51 main.case( "Set up test environment" )
52 main.log.report( "Set up test environment" )
53 main.log.report( "_______________________" )
54
Hari Krishna6185fc12015-07-13 15:42:31 -070055 main.step( "Apply Cell environment for ONOS" )
56 if ( main.onoscell ):
57 cellName = main.onoscell
58 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070059 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
60 onpass="Test step PASS",
61 onfail="Test step FAIL" )
62 else:
63 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
64 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080065 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070066 main.exit()
67
Hari Krishnac195f3b2015-07-08 20:02:24 -070068 main.step( "Git checkout and pull " + git_branch )
69 if git_pull == 'on':
70 checkout_result = main.ONOSbench.gitCheckout( git_branch )
71 pull_result = main.ONOSbench.gitPull()
72 cp_result = ( checkout_result and pull_result )
73 else:
74 checkout_result = main.TRUE
75 pull_result = main.TRUE
76 main.log.info( "Skipped git checkout and pull" )
77 cp_result = ( checkout_result and pull_result )
78 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
79 onpass="Test step PASS",
80 onfail="Test step FAIL" )
81
82 main.step( "mvn clean & install" )
83 if git_pull == 'on':
84 mvn_result = main.ONOSbench.cleanInstall()
85 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
86 onpass="Test step PASS",
87 onfail="Test step FAIL" )
88 else:
89 mvn_result = main.TRUE
90 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
91
92 main.ONOSbench.getVersion( report=True )
93
Hari Krishnac195f3b2015-07-08 20:02:24 -070094 main.step( "Create ONOS package" )
95 packageResult = main.ONOSbench.onosPackage()
96 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
97 onpass="Test step PASS",
98 onfail="Test step FAIL" )
99
100 main.step( "Uninstall ONOS package on all Nodes" )
101 uninstallResult = main.TRUE
102 for i in range( int( main.numCtrls ) ):
103 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
104 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
105 utilities.assert_equals( expect=main.TRUE, actual=u_result,
106 onpass="Test step PASS",
107 onfail="Test step FAIL" )
108 uninstallResult = ( uninstallResult and u_result )
109
110 main.step( "Install ONOS package on all Nodes" )
111 installResult = main.TRUE
112 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700113 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700114 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
115 utilities.assert_equals( expect=main.TRUE, actual=i_result,
116 onpass="Test step PASS",
117 onfail="Test step FAIL" )
118 installResult = ( installResult and i_result )
119
120 main.step( "Verify ONOS nodes UP status" )
121 statusResult = main.TRUE
122 for i in range( int( main.numCtrls ) ):
123 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
124 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
125 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
126 onpass="Test step PASS",
127 onfail="Test step FAIL" )
128 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700129
Hari Krishnac195f3b2015-07-08 20:02:24 -0700130 main.step( "Start ONOS CLI on all nodes" )
131 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700132 main.log.step(" Start ONOS cli using thread ")
133 startCliResult = main.TRUE
134 pool = []
135 time1 = time.time()
136 for i in range( int( main.numCtrls) ):
137 t = main.Thread( target=main.CLIs[i].startOnosCli,
138 threadID=main.threadID,
139 name="startOnosCli",
140 args=[ main.onosIPs[i], karafTimeout ] )
141 pool.append(t)
142 t.start()
143 main.threadID = main.threadID + 1
144 for t in pool:
145 t.join()
146 startCliResult = startCliResult and t.result
147 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700148
Hari Krishnac195f3b2015-07-08 20:02:24 -0700149 if not startCliResult:
150 main.log.info("ONOS CLI did not start up properly")
151 main.cleanup()
152 main.exit()
153 else:
154 main.log.info("Successful CLI startup")
155 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700156
157 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
158 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
159 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
160 cfgResult = cfgResult1 and cfgResult2
161 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
162 onpass="ipv6NeighborDiscovery cfg is set to true",
163 onfail="Failed to cfg set ipv6NeighborDiscovery" )
164
165 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700166 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
167 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
168 onpass="Set up test environment PASS",
169 onfail="Set up test environment FAIL" )
170
171 def CASE20( self, main ):
172 """
173 This test script Loads a new Topology (Att) on CHO setup and balances all switches
174 """
175 import re
176 import time
177 import copy
178
179 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
180 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
181 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
182 main.pingTimeout = 300
183 main.log.report(
184 "Load Att topology and Balance all Mininet switches across controllers" )
185 main.log.report(
186 "________________________________________________________________________" )
187 main.case(
188 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700189
Hari Krishnac195f3b2015-07-08 20:02:24 -0700190 main.step( "Stop any previous Mininet network topology" )
191 cliResult = main.TRUE
192 if main.newTopo == main.params['TOPO3']['topo']:
193 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
194
195 main.step( "Start Mininet with Att topology" )
196 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700197 mininetDir = main.Mininet1.home + "/custom/"
198 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
199 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
200 topoPath = mininetDir + main.newTopo
201 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700202
Hari Krishnac195f3b2015-07-08 20:02:24 -0700203 main.step( "Assign switches to controllers" )
204 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
205 main.Mininet1.assignSwController(
206 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700207 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700208
209 switch_mastership = main.TRUE
210 for i in range( 1, ( main.numMNswitches + 1 ) ):
211 response = main.Mininet1.getSwController( "s" + str( i ) )
212 print( "Response is " + str( response ) )
213 if re.search( "tcp:" + main.onosIPs[0], response ):
214 switch_mastership = switch_mastership and main.TRUE
215 else:
216 switch_mastership = main.FALSE
217
218 if switch_mastership == main.TRUE:
219 main.log.report( "Controller assignment successfull" )
220 else:
221 main.log.report( "Controller assignment failed" )
222
223 time.sleep(30) # waiting here to make sure topology converges across all nodes
224
225 main.step( "Balance devices across controllers" )
226 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700227 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700228 time.sleep( 5 )
229
230 topology_output = main.ONOScli1.topology()
231 topology_result = main.ONOSbench.getTopology( topology_output )
232 case2Result = ( switch_mastership and startStatus )
233 utilities.assert_equals(
234 expect=main.TRUE,
235 actual=case2Result,
236 onpass="Starting new Att topology test PASS",
237 onfail="Starting new Att topology test FAIL" )
238
239 def CASE21( self, main ):
240 """
241 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
242 """
243 import re
244 import time
245 import copy
246
247 main.newTopo = main.params['TOPO2']['topo']
248 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
249 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
250 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
251 main.pingTimeout = 300
252 main.log.report(
253 "Load Chordal topology and Balance all Mininet switches across controllers" )
254 main.log.report(
255 "________________________________________________________________________" )
256 main.case(
257 "Assign and Balance all Mininet switches across controllers" )
258
259 main.step( "Stop any previous Mininet network topology" )
260 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
261
GlennRCc6cd2a62015-08-10 16:08:22 -0700262 main.step("Start Mininet with Chordal topology")
263 mininetDir = main.Mininet1.home + "/custom/"
264 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
265 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
266 topoPath = mininetDir + main.newTopo
267 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700268
269 main.step( "Assign switches to controllers" )
270
271 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
272 main.Mininet1.assignSwController(
273 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700274 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700275
276 switch_mastership = main.TRUE
277 for i in range( 1, ( main.numMNswitches + 1 ) ):
278 response = main.Mininet1.getSwController( "s" + str( i ) )
279 print( "Response is " + str( response ) )
280 if re.search( "tcp:" + main.onosIPs[0], response ):
281 switch_mastership = switch_mastership and main.TRUE
282 else:
283 switch_mastership = main.FALSE
284
285 if switch_mastership == main.TRUE:
286 main.log.report( "Controller assignment successfull" )
287 else:
288 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700289
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290 main.step( "Balance devices across controllers" )
291 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700292 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293 time.sleep( 5 )
294
GlennRCbddd58f2015-10-01 15:45:25 -0700295 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700296 time.sleep(30)
297 utilities.assert_equals(
298 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700299 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300 onpass="Starting new Chordal topology test PASS",
301 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700302
Hari Krishnac195f3b2015-07-08 20:02:24 -0700303 def CASE22( self, main ):
304 """
305 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
306 """
307 import re
308 import time
309 import copy
310
311 main.newTopo = main.params['TOPO3']['topo']
312 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
313 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
314 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
315 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700316
Hari Krishnac195f3b2015-07-08 20:02:24 -0700317 main.log.report(
318 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
319 main.log.report(
320 "________________________________________________________________________" )
321 main.case(
322 "Assign and Balance all Mininet switches across controllers" )
323 main.step( "Stop any previous Mininet network topology" )
324 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700325
326 main.step("Start Mininet with Spine topology")
327 mininetDir = main.Mininet1.home + "/custom/"
328 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
329 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
330 topoPath = mininetDir + main.newTopo
331 startStatus = main.Mininet1.startNet(topoFile = topoPath)
332
Hari Krishnac195f3b2015-07-08 20:02:24 -0700333 time.sleep(60)
334 main.step( "Assign switches to controllers" )
335
336 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
337 main.Mininet1.assignSwController(
338 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700339 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700340
341 switch_mastership = main.TRUE
342 for i in range( 1, ( main.numMNswitches + 1 ) ):
343 response = main.Mininet1.getSwController( "s" + str( i ) )
344 print( "Response is " + str( response ) )
345 if re.search( "tcp:" + main.onosIPs[0], response ):
346 switch_mastership = switch_mastership and main.TRUE
347 else:
348 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700349
Hari Krishnac195f3b2015-07-08 20:02:24 -0700350 if switch_mastership == main.TRUE:
351 main.log.report( "Controller assignment successfull" )
352 else:
353 main.log.report( "Controller assignment failed" )
354 time.sleep( 5 )
355
356 main.step( "Balance devices across controllers" )
357 for i in range( int( main.numCtrls ) ):
358 balanceResult = main.ONOScli1.balanceMasters()
359 # giving some breathing time for ONOS to complete re-balance
360 time.sleep( 3 )
361
GlennRCbddd58f2015-10-01 15:45:25 -0700362 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700363 time.sleep(60)
364 utilities.assert_equals(
365 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700366 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700367 onpass="Starting new Spine topology test PASS",
368 onfail="Starting new Spine topology test FAIL" )
369
370 def CASE3( self, main ):
371 """
372 This Test case will be extended to collect and store more data related
373 ONOS state.
374 """
375 import re
376 import copy
377 main.deviceDPIDs = []
378 main.hostMACs = []
379 main.deviceLinks = []
380 main.deviceActiveLinksCount = []
381 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700382
Hari Krishnac195f3b2015-07-08 20:02:24 -0700383 main.log.report(
384 "Collect and Store topology details from ONOS before running any Tests" )
385 main.log.report(
386 "____________________________________________________________________" )
387 main.case( "Collect and Store Topology Details from ONOS" )
388 main.step( "Collect and store current number of switches and links" )
389 topology_output = main.ONOScli1.topology()
390 topology_result = main.ONOSbench.getTopology( topology_output )
391 numOnosDevices = topology_result[ 'devices' ]
392 numOnosLinks = topology_result[ 'links' ]
393 topoResult = main.TRUE
394
395 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
396 main.step( "Store Device DPIDs" )
397 for i in range( 1, (main.numMNswitches+1) ):
GlennRC186b7362015-12-11 18:20:16 -0800398 main.deviceDPIDs.append( "of:" + str(main.prefix) + "0000000000000%02d" % i )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700399 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
400
401 main.step( "Store Host MACs" )
402 for i in range( 1, ( main.numMNhosts + 1 ) ):
403 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
404 print "Host MACs in Store: \n", str( main.hostMACs )
405 main.MACsDict = {}
406 print "Creating dictionary of DPID and HostMacs"
407 for i in range(len(main.hostMACs)):
408 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
409 print main.MACsDict
410 main.step( "Collect and store all Devices Links" )
411 linksResult = main.ONOScli1.links( jsonFormat=False )
412 ansi_escape = re.compile( r'\x1b[^m]*m' )
413 linksResult = ansi_escape.sub( '', linksResult )
414 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
415 linksResult = linksResult.splitlines()
416 main.deviceLinks = copy.copy( linksResult )
417 print "Device Links Stored: \n", str( main.deviceLinks )
418 # this will be asserted to check with the params provided count of
419 # links
420 print "Length of Links Store", len( main.deviceLinks )
421
422 main.step( "Collect and store each Device ports enabled Count" )
423 time1 = time.time()
424 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
425 pool = []
426 for cli in main.CLIs:
427 if i >= main.numMNswitches + 1:
428 break
GlennRC186b7362015-12-11 18:20:16 -0800429 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
Hari Krishnac195f3b2015-07-08 20:02:24 -0700430 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
431 t.start()
432 pool.append(t)
433 i = i + 1
434 main.threadID = main.threadID + 1
435 for thread in pool:
436 thread.join()
437 portResult = thread.result
438 main.devicePortsEnabledCount.append( portResult )
439 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
440 time2 = time.time()
441 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
442
443 main.step( "Collect and store each Device active links Count" )
444 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700445
Hari Krishnac195f3b2015-07-08 20:02:24 -0700446 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
447 pool = []
448 for cli in main.CLIs:
449 if i >= main.numMNswitches + 1:
450 break
GlennRC186b7362015-12-11 18:20:16 -0800451 dpid = "of:" + str(main.prefix) + "0000000000000%02d" % i
Hari Krishnac195f3b2015-07-08 20:02:24 -0700452 t = main.Thread( target = cli.getDeviceLinksActiveCount,
453 threadID = main.threadID,
454 name = "getDevicePortsEnabledCount",
455 args = [dpid])
456 t.start()
457 pool.append(t)
458 i = i + 1
459 main.threadID = main.threadID + 1
460 for thread in pool:
461 thread.join()
462 linkCountResult = thread.result
463 main.deviceActiveLinksCount.append( linkCountResult )
464 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
465 time2 = time.time()
466 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
467
468 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700469 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700470 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
471 main.log.info("Devices (actual): %s, Links (actual): %s" %
472 ( numOnosDevices , numOnosLinks ) )
473 main.log.info("Topology does not match, exiting CHO test...")
474 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700475 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700476 main.cleanup()
477 main.exit()
478
479 # just returning TRUE for now as this one just collects data
480 case3Result = topoResult
481 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
482 onpass="Saving ONOS topology data test PASS",
483 onfail="Saving ONOS topology data test FAIL" )
484
GlennRC186b7362015-12-11 18:20:16 -0800485 main.prefix += 1
486
Hari Krishnac195f3b2015-07-08 20:02:24 -0700487 def CASE40( self, main ):
488 """
489 Verify Reactive forwarding (Att Topology)
490 """
491 import re
492 import copy
493 import time
494 main.log.report( "Verify Reactive forwarding (Att Topology)" )
495 main.log.report( "______________________________________________" )
496 main.case( "Enable Reactive forwarding and Verify ping all" )
497 main.step( "Enable Reactive forwarding" )
498 installResult = main.TRUE
499 # Activate fwd app
500 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
501 appCheck = main.TRUE
502 pool = []
503 for cli in main.CLIs:
504 t = main.Thread( target=cli.appToIDCheck,
505 name="appToIDCheck-" + str( i ),
506 args=[] )
507 pool.append( t )
508 t.start()
509 for t in pool:
510 t.join()
511 appCheck = appCheck and t.result
512 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
513 onpass="App Ids seem to be correct",
514 onfail="Something is wrong with app Ids" )
515 if appCheck != main.TRUE:
516 main.log.warn( main.CLIs[0].apps() )
517 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700518
Hari Krishnac195f3b2015-07-08 20:02:24 -0700519 time.sleep( 10 )
520
GlennRC6ac11b12015-10-21 17:41:28 -0700521 main.step( "Verify Ping across all hosts" )
522 for i in range(main.numPings):
523 time1 = time.time()
524 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
525 if not pingResult:
526 main.log.warn("First pingall failed. Retrying...")
527 time.sleep(main.pingSleep)
528 else: break
529
Hari Krishnac195f3b2015-07-08 20:02:24 -0700530 time2 = time.time()
531 timeDiff = round( ( time2 - time1 ), 2 )
532 main.log.report(
533 "Time taken for Ping All: " +
534 str( timeDiff ) +
535 " seconds" )
536
GlennRC626ba132015-09-18 16:16:31 -0700537 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700538 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700539 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700540 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700541
GlennRCbddd58f2015-10-01 15:45:25 -0700542 caseResult = appCheck and pingResult
543 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700544 onpass="Reactive Mode IPv4 Pingall test PASS",
545 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700546
547 def CASE41( self, main ):
548 """
549 Verify Reactive forwarding (Chordal Topology)
550 """
551 import re
552 import copy
553 import time
554 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
555 main.log.report( "______________________________________________" )
556 main.case( "Enable Reactive forwarding and Verify ping all" )
557 main.step( "Enable Reactive forwarding" )
558 installResult = main.TRUE
559 # Activate fwd app
560 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
561
562 appCheck = main.TRUE
563 pool = []
564 for cli in main.CLIs:
565 t = main.Thread( target=cli.appToIDCheck,
566 name="appToIDCheck-" + str( i ),
567 args=[] )
568 pool.append( t )
569 t.start()
570 for t in pool:
571 t.join()
572 appCheck = appCheck and t.result
573 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
574 onpass="App Ids seem to be correct",
575 onfail="Something is wrong with app Ids" )
576 if appCheck != main.TRUE:
577 main.log.warn( main.CLIs[0].apps() )
578 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700579
Hari Krishnac195f3b2015-07-08 20:02:24 -0700580 time.sleep( 10 )
581
GlennRC6ac11b12015-10-21 17:41:28 -0700582 main.step( "Verify Ping across all hosts" )
583 for i in range(main.numPings):
584 time1 = time.time()
585 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
586 if not pingResult:
587 main.log.warn("First pingall failed. Retrying...")
588 time.sleep(main.pingSleep)
589 else: break
590
Hari Krishnac195f3b2015-07-08 20:02:24 -0700591 time2 = time.time()
592 timeDiff = round( ( time2 - time1 ), 2 )
593 main.log.report(
594 "Time taken for Ping All: " +
595 str( timeDiff ) +
596 " seconds" )
597
GlennRC626ba132015-09-18 16:16:31 -0700598 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700599 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700600 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700601 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700602
GlennRCbddd58f2015-10-01 15:45:25 -0700603 caseResult = appCheck and pingResult
604 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700605 onpass="Reactive Mode IPv4 Pingall test PASS",
606 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700607
608 def CASE42( self, main ):
609 """
610 Verify Reactive forwarding (Spine Topology)
611 """
612 import re
613 import copy
614 import time
615 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
616 main.log.report( "______________________________________________" )
617 main.case( "Enable Reactive forwarding and Verify ping all" )
618 main.step( "Enable Reactive forwarding" )
619 installResult = main.TRUE
620 # Activate fwd app
621 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
622
623 appCheck = main.TRUE
624 pool = []
625 for cli in main.CLIs:
626 t = main.Thread( target=cli.appToIDCheck,
627 name="appToIDCheck-" + str( i ),
628 args=[] )
629 pool.append( t )
630 t.start()
631 for t in pool:
632 t.join()
633 appCheck = appCheck and t.result
634 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
635 onpass="App Ids seem to be correct",
636 onfail="Something is wrong with app Ids" )
637 if appCheck != main.TRUE:
638 main.log.warn( main.CLIs[0].apps() )
639 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700640
Hari Krishnac195f3b2015-07-08 20:02:24 -0700641 time.sleep( 10 )
642
GlennRC6ac11b12015-10-21 17:41:28 -0700643 main.step( "Verify Ping across all hosts" )
644 for i in range(main.numPings):
645 time1 = time.time()
646 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
647 if not pingResult:
648 main.log.warn("First pingall failed. Retrying...")
649 time.sleep(main.pingSleep)
650 else: break
651
Hari Krishnac195f3b2015-07-08 20:02:24 -0700652 time2 = time.time()
653 timeDiff = round( ( time2 - time1 ), 2 )
654 main.log.report(
655 "Time taken for Ping All: " +
656 str( timeDiff ) +
657 " seconds" )
658
GlennRC626ba132015-09-18 16:16:31 -0700659 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700660 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700661 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700662 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
663
GlennRCbddd58f2015-10-01 15:45:25 -0700664 caseResult = appCheck and pingResult
665 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700666 onpass="Reactive Mode IPv4 Pingall test PASS",
667 onfail="Reactive Mode IPv4 Pingall test FAIL" )
668
669 def CASE140( self, main ):
670 """
671 Verify IPv6 Reactive forwarding (Att Topology)
672 """
673 import re
674 import copy
675 import time
676 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
677 main.log.report( "______________________________________________" )
678 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
679 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
680
681 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
682 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
683 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
684 cfgResult = cfgResult1 and cfgResult2
685 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
686 onpass="Reactive mode ipv6Fowarding cfg is set to true",
687 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
688
689 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700690 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700691 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700692 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
693 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700694 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700695 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700696 time2 = time.time()
697 timeDiff = round( ( time2 - time1 ), 2 )
698 main.log.report(
699 "Time taken for IPv6 Ping All: " +
700 str( timeDiff ) +
701 " seconds" )
702
GlennRC626ba132015-09-18 16:16:31 -0700703 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700704 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
705 else:
706 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700707
708 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700709
Hari Krishnac195f3b2015-07-08 20:02:24 -0700710 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700711 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700712 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
713 pool = []
714 for cli in main.CLIs:
715 t = main.Thread( target=cli.appToIDCheck,
716 name="appToIDCheck-" + str( i ),
717 args=[] )
718 pool.append( t )
719 t.start()
720
721 for t in pool:
722 t.join()
723 appCheck = appCheck and t.result
724 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
725 onpass="App Ids seem to be correct",
726 onfail="Something is wrong with app Ids" )
727 if appCheck != main.TRUE:
728 main.log.warn( main.CLIs[0].apps() )
729 main.log.warn( main.CLIs[0].appIDs() )
730
731 # Waiting for reative flows to be cleared.
732 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700733 caseResult = appCheck and cfgResult and pingResult
734 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700735 onpass="Reactive Mode IPv6 Pingall test PASS",
736 onfail="Reactive Mode IPv6 Pingall test FAIL" )
737
738 def CASE141( self, main ):
739 """
740 Verify IPv6 Reactive forwarding (Chordal Topology)
741 """
742 import re
743 import copy
744 import time
745 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
746 main.log.report( "______________________________________________" )
747 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
748 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
749
750 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
751 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
752 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
753 cfgResult = cfgResult1 and cfgResult2
754 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
755 onpass="Reactive mode ipv6Fowarding cfg is set to true",
756 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
757
758 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700759 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700760 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700761 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
762 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700763 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700764 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700765 time2 = time.time()
766 timeDiff = round( ( time2 - time1 ), 2 )
767 main.log.report(
768 "Time taken for IPv6 Ping All: " +
769 str( timeDiff ) +
770 " seconds" )
771
GlennRC626ba132015-09-18 16:16:31 -0700772 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700773 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
774 else:
775 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
776
777 main.step( "Disable Reactive forwarding" )
778
779 main.log.info( "Uninstall reactive forwarding app" )
780 appCheck = main.TRUE
781 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
782 pool = []
783 for cli in main.CLIs:
784 t = main.Thread( target=cli.appToIDCheck,
785 name="appToIDCheck-" + str( i ),
786 args=[] )
787 pool.append( t )
788 t.start()
789
790 for t in pool:
791 t.join()
792 appCheck = appCheck and t.result
793 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
794 onpass="App Ids seem to be correct",
795 onfail="Something is wrong with app Ids" )
796 if appCheck != main.TRUE:
797 main.log.warn( main.CLIs[0].apps() )
798 main.log.warn( main.CLIs[0].appIDs() )
799
800 # Waiting for reative flows to be cleared.
801 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700802 caseResult = appCheck and cfgResult and pingResult
803 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700804 onpass="Reactive Mode IPv6 Pingall test PASS",
805 onfail="Reactive Mode IPv6 Pingall test FAIL" )
806
807 def CASE142( self, main ):
808 """
809 Verify IPv6 Reactive forwarding (Spine Topology)
810 """
811 import re
812 import copy
813 import time
814 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
815 main.log.report( "______________________________________________" )
816 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
817 # Spine topology do not have hosts h1-h10
818 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
819 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
820 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
821 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
822 cfgResult = cfgResult1 and cfgResult2
823 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
824 onpass="Reactive mode ipv6Fowarding cfg is set to true",
825 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
826
827 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700828 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700829 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700830 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
831 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700832 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700833 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700834 time2 = time.time()
835 timeDiff = round( ( time2 - time1 ), 2 )
836 main.log.report(
837 "Time taken for IPv6 Ping All: " +
838 str( timeDiff ) +
839 " seconds" )
840
GlennRC626ba132015-09-18 16:16:31 -0700841 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700842 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
843 else:
844 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
845
846 main.step( "Disable Reactive forwarding" )
847
848 main.log.info( "Uninstall reactive forwarding app" )
849 appCheck = main.TRUE
850 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
851 pool = []
852 for cli in main.CLIs:
853 t = main.Thread( target=cli.appToIDCheck,
854 name="appToIDCheck-" + str( i ),
855 args=[] )
856 pool.append( t )
857 t.start()
858
859 for t in pool:
860 t.join()
861 appCheck = appCheck and t.result
862 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
863 onpass="App Ids seem to be correct",
864 onfail="Something is wrong with app Ids" )
865 if appCheck != main.TRUE:
866 main.log.warn( main.CLIs[0].apps() )
867 main.log.warn( main.CLIs[0].appIDs() )
868
869 # Waiting for reative flows to be cleared.
870 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700871 caseResult = appCheck and cfgResult and pingResult
872 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700873 onpass="Reactive Mode IPv6 Pingall test PASS",
874 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700875
876 def CASE5( self, main ):
877 """
878 Compare current ONOS topology with reference data
879 """
880 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700881
Hari Krishnac195f3b2015-07-08 20:02:24 -0700882 devicesDPIDTemp = []
883 hostMACsTemp = []
884 deviceLinksTemp = []
885 deviceActiveLinksCountTemp = []
886 devicePortsEnabledCountTemp = []
887
888 main.log.report(
889 "Compare ONOS topology with reference data in Stores" )
890 main.log.report( "__________________________________________________" )
891 main.case( "Compare ONOS topology with reference data" )
892
893 main.step( "Compare current Device ports enabled with reference" )
894 time1 = time.time()
895 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
896 pool = []
897 for cli in main.CLIs:
898 if i >= main.numMNswitches + 1:
899 break
900 dpid = "of:00000000000000" + format( i,'02x' )
901 t = main.Thread(target = cli.getDevicePortsEnabledCount,
902 threadID = main.threadID,
903 name = "getDevicePortsEnabledCount",
904 args = [dpid])
905 t.start()
906 pool.append(t)
907 i = i + 1
908 main.threadID = main.threadID + 1
909 for thread in pool:
910 thread.join()
911 portResult = thread.result
912 #portTemp = re.split( r'\t+', portResult )
913 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
914 devicePortsEnabledCountTemp.append( portResult )
915
916 time2 = time.time()
917 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
918 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700919 "Device Enabled ports EXPECTED: %s" %
920 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700921 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700922 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700923 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700924
Hari Krishnac195f3b2015-07-08 20:02:24 -0700925 if ( cmp( main.devicePortsEnabledCount,
926 devicePortsEnabledCountTemp ) == 0 ):
927 stepResult1 = main.TRUE
928 else:
929 stepResult1 = main.FALSE
930
931 main.step( "Compare Device active links with reference" )
932 time1 = time.time()
933 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
934 pool = []
935 for cli in main.CLIs:
936 if i >= main.numMNswitches + 1:
937 break
938 dpid = "of:00000000000000" + format( i,'02x' )
939 t = main.Thread(target = cli.getDeviceLinksActiveCount,
940 threadID = main.threadID,
941 name = "getDeviceLinksActiveCount",
942 args = [dpid])
943 t.start()
944 pool.append(t)
945 i = i + 1
946 main.threadID = main.threadID + 1
947 for thread in pool:
948 thread.join()
949 linkCountResult = thread.result
950 #linkCountTemp = re.split( r'\t+', linkCountResult )
951 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
952 deviceActiveLinksCountTemp.append( linkCountResult )
953
954 time2 = time.time()
955 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
956 main.log.info (
957 "Device Active links EXPECTED: %s" %
958 str( main.deviceActiveLinksCount ) )
959 main.log.info (
960 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
961 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
962 stepResult2 = main.TRUE
963 else:
964 stepResult2 = main.FALSE
965
966 """
967 place holder for comparing devices, hosts, paths and intents if required.
968 Links and ports data would be incorrect with out devices anyways.
969 """
970 case5Result = ( stepResult1 and stepResult2 )
971 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
972 onpass="Compare Topology test PASS",
973 onfail="Compare Topology test FAIL" )
974
975 def CASE60( self ):
976 """
977 Install 300 host intents and verify ping all (Att Topology)
978 """
979 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
980 main.log.report( "_______________________________________" )
981 import itertools
982 import time
983 main.case( "Install 300 host intents" )
984 main.step( "Add host Intents" )
985 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700986 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
987
Hari Krishnac195f3b2015-07-08 20:02:24 -0700988 intentIdList = []
989 time1 = time.time()
990 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
991 pool = []
992 for cli in main.CLIs:
993 if i >= len( hostCombos ):
994 break
995 t = main.Thread( target=cli.addHostIntent,
996 threadID=main.threadID,
997 name="addHostIntent",
998 args=[hostCombos[i][0],hostCombos[i][1]])
999 pool.append(t)
1000 t.start()
1001 i = i + 1
1002 main.threadID = main.threadID + 1
1003 for thread in pool:
1004 thread.join()
1005 intentIdList.append(thread.result)
1006 time2 = time.time()
1007 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1008
GlennRCfcfdc4f2015-09-30 16:01:57 -07001009 # Saving intent ids to check intents in later cases
1010 main.intentIds = list(intentIdList)
1011
GlennRCa8d786a2015-09-23 17:40:11 -07001012 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001013
GlennRC1dde1712015-10-02 11:03:08 -07001014 # Giving onos multiple chances to install intents
1015 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001016 if i != 0:
1017 main.log.warn( "Verification failed. Retrying..." )
1018 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001019 time.sleep( main.checkIntentsDelay )
1020
1021 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001022 for e in range(int(main.numCtrls)):
1023 main.log.info( "Checking intents on CLI %s" % (e+1) )
1024 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1025 intentState
1026 if not intentState:
1027 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001028 if intentState:
1029 break
GlennRCdb2c8422015-09-29 12:21:59 -07001030 else:
1031 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001032 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001033
GlennRCa8d786a2015-09-23 17:40:11 -07001034
1035 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1036 onpass="INTENTS INSTALLED",
1037 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001038
1039 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001040 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001041 time1 = time.time()
1042 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001043 if not pingResult:
1044 main.log.warn("First pingall failed. Retrying...")
1045 time.sleep(3)
1046 else: break
1047
Hari Krishnac195f3b2015-07-08 20:02:24 -07001048 time2 = time.time()
1049 timeDiff = round( ( time2 - time1 ), 2 )
1050 main.log.report(
1051 "Time taken for Ping All: " +
1052 str( timeDiff ) +
1053 " seconds" )
1054 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1055 onpass="PING ALL PASS",
1056 onfail="PING ALL FAIL" )
1057
GlennRCbddd58f2015-10-01 15:45:25 -07001058 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001059 utilities.assert_equals(
1060 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001061 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001062 onpass="Install 300 Host Intents and Ping All test PASS",
1063 onfail="Install 300 Host Intents and Ping All test FAIL" )
1064
GlennRCfcfdc4f2015-09-30 16:01:57 -07001065 if not intentState:
1066 main.log.debug( "Intents failed to install completely" )
1067 if not pingResult:
1068 main.log.debug( "Pingall failed" )
1069
GlennRCbddd58f2015-10-01 15:45:25 -07001070 if not caseResult and main.failSwitch:
1071 main.log.report("Stopping test")
1072 main.stop( email=main.emailOnStop )
1073
Hari Krishnac195f3b2015-07-08 20:02:24 -07001074 def CASE61( self ):
1075 """
1076 Install 600 host intents and verify ping all for Chordal Topology
1077 """
1078 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1079 main.log.report( "_______________________________________" )
1080 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001081
Hari Krishnac195f3b2015-07-08 20:02:24 -07001082 main.case( "Install 600 host intents" )
1083 main.step( "Add host Intents" )
1084 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001085 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1086
Hari Krishnac195f3b2015-07-08 20:02:24 -07001087 intentIdList = []
1088 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001089
Hari Krishnac195f3b2015-07-08 20:02:24 -07001090 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1091 pool = []
1092 for cli in main.CLIs:
1093 if i >= len( hostCombos ):
1094 break
1095 t = main.Thread( target=cli.addHostIntent,
1096 threadID=main.threadID,
1097 name="addHostIntent",
1098 args=[hostCombos[i][0],hostCombos[i][1]])
1099 pool.append(t)
1100 t.start()
1101 i = i + 1
1102 main.threadID = main.threadID + 1
1103 for thread in pool:
1104 thread.join()
1105 intentIdList.append(thread.result)
1106 time2 = time.time()
1107 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001108
GlennRCfcfdc4f2015-09-30 16:01:57 -07001109 # Saving intent ids to check intents in later cases
1110 main.intentIds = list(intentIdList)
1111
GlennRCa8d786a2015-09-23 17:40:11 -07001112 main.step("Verify intents are installed")
1113
GlennRC1dde1712015-10-02 11:03:08 -07001114 # Giving onos multiple chances to install intents
1115 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001116 if i != 0:
1117 main.log.warn( "Verification failed. Retrying..." )
1118 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001119 time.sleep( main.checkIntentsDelay )
1120
1121 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001122 for e in range(int(main.numCtrls)):
1123 main.log.info( "Checking intents on CLI %s" % (e+1) )
1124 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1125 intentState
1126 if not intentState:
1127 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001128 if intentState:
1129 break
GlennRCdb2c8422015-09-29 12:21:59 -07001130 else:
1131 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001132 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001133
1134 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1135 onpass="INTENTS INSTALLED",
1136 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001137
1138 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001139 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001140 time1 = time.time()
1141 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001142 if not pingResult:
1143 main.log.warn("First pingall failed. Retrying...")
1144 time.sleep(main.pingSleep)
1145 else: break
1146
Hari Krishnac195f3b2015-07-08 20:02:24 -07001147 time2 = time.time()
1148 timeDiff = round( ( time2 - time1 ), 2 )
1149 main.log.report(
1150 "Time taken for Ping All: " +
1151 str( timeDiff ) +
1152 " seconds" )
1153 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1154 onpass="PING ALL PASS",
1155 onfail="PING ALL FAIL" )
1156
GlennRCbddd58f2015-10-01 15:45:25 -07001157 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001158
Hari Krishnac195f3b2015-07-08 20:02:24 -07001159 utilities.assert_equals(
1160 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001161 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001162 onpass="Install 300 Host Intents and Ping All test PASS",
1163 onfail="Install 300 Host Intents and Ping All test FAIL" )
1164
GlennRCfcfdc4f2015-09-30 16:01:57 -07001165 if not intentState:
1166 main.log.debug( "Intents failed to install completely" )
1167 if not pingResult:
1168 main.log.debug( "Pingall failed" )
1169
GlennRCbddd58f2015-10-01 15:45:25 -07001170 if not caseResult and main.failSwitch:
1171 main.log.report("Stopping test")
1172 main.stop( email=main.emailOnStop )
1173
Hari Krishnac195f3b2015-07-08 20:02:24 -07001174 def CASE62( self ):
1175 """
1176 Install 2278 host intents and verify ping all for Spine Topology
1177 """
1178 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1179 main.log.report( "_______________________________________" )
1180 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001181
Hari Krishnac195f3b2015-07-08 20:02:24 -07001182 main.case( "Install 2278 host intents" )
1183 main.step( "Add host Intents" )
1184 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001185 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001186 main.pingTimeout = 300
1187 intentIdList = []
1188 time1 = time.time()
1189 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1190 pool = []
1191 for cli in main.CLIs:
1192 if i >= len( hostCombos ):
1193 break
1194 t = main.Thread( target=cli.addHostIntent,
1195 threadID=main.threadID,
1196 name="addHostIntent",
1197 args=[hostCombos[i][0],hostCombos[i][1]])
1198 pool.append(t)
1199 t.start()
1200 i = i + 1
1201 main.threadID = main.threadID + 1
1202 for thread in pool:
1203 thread.join()
1204 intentIdList.append(thread.result)
1205 time2 = time.time()
1206 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001207
GlennRCfcfdc4f2015-09-30 16:01:57 -07001208 # Saving intent ids to check intents in later cases
1209 main.intentIds = list(intentIdList)
1210
GlennRCa8d786a2015-09-23 17:40:11 -07001211 main.step("Verify intents are installed")
1212
GlennRC1dde1712015-10-02 11:03:08 -07001213 # Giving onos multiple chances to install intents
1214 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001215 if i != 0:
1216 main.log.warn( "Verification failed. Retrying..." )
1217 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001218 time.sleep( main.checkIntentsDelay )
1219
1220 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001221 for e in range(int(main.numCtrls)):
1222 main.log.info( "Checking intents on CLI %s" % (e+1) )
1223 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1224 intentState
1225 if not intentState:
1226 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001227 if intentState:
1228 break
GlennRCdb2c8422015-09-29 12:21:59 -07001229 else:
1230 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001231 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001232
1233 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1234 onpass="INTENTS INSTALLED",
1235 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001236
1237 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001238 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001239 time1 = time.time()
1240 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001241 if not pingResult:
1242 main.log.warn("First pingall failed. Retrying...")
1243 time.sleep(main.pingSleep)
1244 else: break
1245
Hari Krishnac195f3b2015-07-08 20:02:24 -07001246 time2 = time.time()
1247 timeDiff = round( ( time2 - time1 ), 2 )
1248 main.log.report(
1249 "Time taken for Ping All: " +
1250 str( timeDiff ) +
1251 " seconds" )
1252 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1253 onpass="PING ALL PASS",
1254 onfail="PING ALL FAIL" )
1255
GlennRCbddd58f2015-10-01 15:45:25 -07001256 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001257
Hari Krishnac195f3b2015-07-08 20:02:24 -07001258 utilities.assert_equals(
1259 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001260 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001261 onpass="Install 2278 Host Intents and Ping All test PASS",
1262 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1263
GlennRCfcfdc4f2015-09-30 16:01:57 -07001264 if not intentState:
1265 main.log.debug( "Intents failed to install completely" )
1266 if not pingResult:
1267 main.log.debug( "Pingall failed" )
1268
GlennRCbddd58f2015-10-01 15:45:25 -07001269 if not caseResult and main.failSwitch:
1270 main.log.report("Stopping test")
1271 main.stop( email=main.emailOnStop )
1272
Hari Krishna4223dbd2015-08-13 16:29:53 -07001273 def CASE160( self ):
1274 """
1275 Verify IPv6 ping across 300 host intents (Att Topology)
1276 """
1277 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1278 main.log.report( "_________________________________________________" )
1279 import itertools
1280 import time
1281 main.case( "IPv6 ping all 300 host intents" )
1282 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001283 pingResult = main.FALSE
1284 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001285 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001286 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001287 main.log.warn("First pingall failed. Retrying...")
1288 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001289 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001290 time2 = time.time()
1291 timeDiff = round( ( time2 - time1 ), 2 )
1292 main.log.report(
1293 "Time taken for IPv6 Ping All: " +
1294 str( timeDiff ) +
1295 " seconds" )
1296 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1297 onpass="PING ALL PASS",
1298 onfail="PING ALL FAIL" )
1299
GlennRCbddd58f2015-10-01 15:45:25 -07001300 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001301 utilities.assert_equals(
1302 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001303 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001304 onpass="IPv6 Ping across 300 host intents test PASS",
1305 onfail="IPv6 Ping across 300 host intents test FAIL" )
1306
1307 def CASE161( self ):
1308 """
1309 Verify IPv6 ping across 600 host intents (Chordal Topology)
1310 """
1311 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1312 main.log.report( "_________________________________________________" )
1313 import itertools
1314 import time
1315 main.case( "IPv6 ping all 600 host intents" )
1316 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001317 pingResult = main.FALSE
1318 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001319 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001320 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001321 main.log.warn("First pingall failed. Retrying...")
1322 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001323 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001324 time2 = time.time()
1325 timeDiff = round( ( time2 - time1 ), 2 )
1326 main.log.report(
1327 "Time taken for IPv6 Ping All: " +
1328 str( timeDiff ) +
1329 " seconds" )
1330 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1331 onpass="PING ALL PASS",
1332 onfail="PING ALL FAIL" )
1333
GlennRCbddd58f2015-10-01 15:45:25 -07001334 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001335 utilities.assert_equals(
1336 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001337 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001338 onpass="IPv6 Ping across 600 host intents test PASS",
1339 onfail="IPv6 Ping across 600 host intents test FAIL" )
1340
1341 def CASE162( self ):
1342 """
1343 Verify IPv6 ping across 2278 host intents (Spine Topology)
1344 """
1345 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1346 main.log.report( "_________________________________________________" )
1347 import itertools
1348 import time
1349 main.case( "IPv6 ping all 600 host intents" )
1350 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001351 pingResult = main.FALSE
1352 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001353 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001354 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001355 main.log.warn("First pingall failed. Retrying...")
1356 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001357 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001358 time2 = time.time()
1359 timeDiff = round( ( time2 - time1 ), 2 )
1360 main.log.report(
1361 "Time taken for IPv6 Ping All: " +
1362 str( timeDiff ) +
1363 " seconds" )
1364 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1365 onpass="PING ALL PASS",
1366 onfail="PING ALL FAIL" )
1367
GlennRCbddd58f2015-10-01 15:45:25 -07001368 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001369 utilities.assert_equals(
1370 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001371 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001372 onpass="IPv6 Ping across 600 host intents test PASS",
1373 onfail="IPv6 Ping across 600 host intents test FAIL" )
1374
Hari Krishnac195f3b2015-07-08 20:02:24 -07001375 def CASE70( self, main ):
1376 """
1377 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1378 """
1379 import random
1380 main.randomLink1 = []
1381 main.randomLink2 = []
1382 main.randomLink3 = []
1383 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1384 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1385 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1386 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1387 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1388 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1389 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1390 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1391
1392 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1393 main.log.report( "___________________________________________________________________________" )
1394 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1395 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1396 if ( int( switchLinksToToggle ) ==
1397 0 or int( switchLinksToToggle ) > 5 ):
1398 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1399 #main.cleanup()
1400 #main.exit()
1401 else:
1402 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1403
1404 main.step( "Cut links on Core devices using user provided range" )
1405 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1406 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1407 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1408 for i in range( int( switchLinksToToggle ) ):
1409 main.Mininet1.link(
1410 END1=link1End1,
1411 END2=main.randomLink1[ i ],
1412 OPTION="down" )
1413 time.sleep( link_sleep )
1414 main.Mininet1.link(
1415 END1=link2End1,
1416 END2=main.randomLink2[ i ],
1417 OPTION="down" )
1418 time.sleep( link_sleep )
1419 main.Mininet1.link(
1420 END1=link3End1,
1421 END2=main.randomLink3[ i ],
1422 OPTION="down" )
1423 time.sleep( link_sleep )
1424
Hari Krishna6185fc12015-07-13 15:42:31 -07001425 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001426 linkDown = main.ONOSbench.checkStatus(
1427 topology_output, main.numMNswitches, str(
1428 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1429 utilities.assert_equals(
1430 expect=main.TRUE,
1431 actual=linkDown,
1432 onpass="Link Down discovered properly",
1433 onfail="Link down was not discovered in " +
1434 str( link_sleep ) +
1435 " seconds" )
1436
GlennRCfcfdc4f2015-09-30 16:01:57 -07001437 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001438 # Giving onos multiple chances to install intents
1439 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001440 if i != 0:
1441 main.log.warn( "Verification failed. Retrying..." )
1442 main.log.info("Giving onos some time...")
1443 time.sleep( main.checkIntentsDelay )
1444
1445 intentState = main.TRUE
1446 for e in range(int(main.numCtrls)):
1447 main.log.info( "Checking intents on CLI %s" % (e+1) )
1448 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1449 intentState
1450 if not intentState:
1451 main.log.warn( "Not all intents installed" )
1452 if intentState:
1453 break
1454 else:
1455 #Dumping intent summary
1456 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1457
1458
1459 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1460 onpass="INTENTS INSTALLED",
1461 onfail="SOME INTENTS NOT INSTALLED" )
1462
Hari Krishnac195f3b2015-07-08 20:02:24 -07001463 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001464 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001465 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001466 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1467 if not pingResult:
1468 main.log.warn("First pingall failed. Retrying...")
1469 time.sleep(main.pingSleep)
1470 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001471
Hari Krishnac195f3b2015-07-08 20:02:24 -07001472 time2 = time.time()
1473 timeDiff = round( ( time2 - time1 ), 2 )
1474 main.log.report(
1475 "Time taken for Ping All: " +
1476 str( timeDiff ) +
1477 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001478 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001479 onpass="PING ALL PASS",
1480 onfail="PING ALL FAIL" )
1481
GlennRCbddd58f2015-10-01 15:45:25 -07001482 caseResult = linkDown and pingResult and intentState
1483 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001484 onpass="Random Link cut Test PASS",
1485 onfail="Random Link cut Test FAIL" )
1486
GlennRCfcfdc4f2015-09-30 16:01:57 -07001487 # Printing what exactly failed
1488 if not linkDown:
1489 main.log.debug( "Link down was not discovered correctly" )
1490 if not pingResult:
1491 main.log.debug( "Pingall failed" )
1492 if not intentState:
1493 main.log.debug( "Intents are not all installed" )
1494
GlennRCbddd58f2015-10-01 15:45:25 -07001495 if not caseResult and main.failSwitch:
1496 main.log.report("Stopping test")
1497 main.stop( email=main.emailOnStop )
1498
Hari Krishnac195f3b2015-07-08 20:02:24 -07001499 def CASE80( self, main ):
1500 """
1501 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1502 """
1503 import random
1504 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1505 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1506 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1507 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1508 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1509
1510 main.log.report(
1511 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1512 main.log.report(
1513 "__________________________________________________________________" )
1514 main.case(
1515 "Host intents - Bring the core links up that are down and verify ping all" )
1516 main.step( "Bring randomly cut links on Core devices up" )
1517 for i in range( int( switchLinksToToggle ) ):
1518 main.Mininet1.link(
1519 END1=link1End1,
1520 END2=main.randomLink1[ i ],
1521 OPTION="up" )
1522 time.sleep( link_sleep )
1523 main.Mininet1.link(
1524 END1=link2End1,
1525 END2=main.randomLink2[ i ],
1526 OPTION="up" )
1527 time.sleep( link_sleep )
1528 main.Mininet1.link(
1529 END1=link3End1,
1530 END2=main.randomLink3[ i ],
1531 OPTION="up" )
1532 time.sleep( link_sleep )
1533
Hari Krishna6185fc12015-07-13 15:42:31 -07001534 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001535 linkUp = main.ONOSbench.checkStatus(
1536 topology_output,
1537 main.numMNswitches,
1538 str( main.numMNlinks ) )
1539 utilities.assert_equals(
1540 expect=main.TRUE,
1541 actual=linkUp,
1542 onpass="Link up discovered properly",
1543 onfail="Link up was not discovered in " +
1544 str( link_sleep ) +
1545 " seconds" )
1546
GlennRCfcfdc4f2015-09-30 16:01:57 -07001547 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001548 # Giving onos multiple chances to install intents
1549 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001550 if i != 0:
1551 main.log.warn( "Verification failed. Retrying..." )
1552 main.log.info("Giving onos some time...")
1553 time.sleep( main.checkIntentsDelay )
1554
1555 intentState = main.TRUE
1556 for e in range(int(main.numCtrls)):
1557 main.log.info( "Checking intents on CLI %s" % (e+1) )
1558 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1559 intentState
1560 if not intentState:
1561 main.log.warn( "Not all intents installed" )
1562 if intentState:
1563 break
1564 else:
1565 #Dumping intent summary
1566 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1567
1568
1569 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1570 onpass="INTENTS INSTALLED",
1571 onfail="SOME INTENTS NOT INSTALLED" )
1572
Hari Krishnac195f3b2015-07-08 20:02:24 -07001573 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001574 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001575 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001576 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1577 if not pingResult:
1578 main.log.warn("First pingall failed. Retrying...")
1579 time.sleep(main.pingSleep)
1580 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001581
Hari Krishnac195f3b2015-07-08 20:02:24 -07001582 time2 = time.time()
1583 timeDiff = round( ( time2 - time1 ), 2 )
1584 main.log.report(
1585 "Time taken for Ping All: " +
1586 str( timeDiff ) +
1587 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001588 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001589 onpass="PING ALL PASS",
1590 onfail="PING ALL FAIL" )
1591
GlennRCbddd58f2015-10-01 15:45:25 -07001592 caseResult = linkUp and pingResult
1593 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001594 onpass="Link Up Test PASS",
1595 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001596 # Printing what exactly failed
1597 if not linkUp:
1598 main.log.debug( "Link down was not discovered correctly" )
1599 if not pingResult:
1600 main.log.debug( "Pingall failed" )
1601 if not intentState:
1602 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001603
GlennRCbddd58f2015-10-01 15:45:25 -07001604 if not caseResult and main.failSwitch:
1605 main.log.report("Stopping test")
1606 main.stop( email=main.emailOnStop )
1607
Hari Krishnac195f3b2015-07-08 20:02:24 -07001608 def CASE71( self, main ):
1609 """
1610 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1611 """
1612 import random
1613 main.randomLink1 = []
1614 main.randomLink2 = []
1615 main.randomLink3 = []
1616 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1617 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1618 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1619 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1620 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1621 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1622 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1623 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1624
1625 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1626 main.log.report( "___________________________________________________________________________" )
1627 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1628 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1629 if ( int( switchLinksToToggle ) ==
1630 0 or int( switchLinksToToggle ) > 5 ):
1631 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1632 #main.cleanup()
1633 #main.exit()
1634 else:
1635 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1636
1637 main.step( "Cut links on Core devices using user provided range" )
1638 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1639 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1640 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1641 for i in range( int( switchLinksToToggle ) ):
1642 main.Mininet1.link(
1643 END1=link1End1,
1644 END2=main.randomLink1[ i ],
1645 OPTION="down" )
1646 time.sleep( link_sleep )
1647 main.Mininet1.link(
1648 END1=link2End1,
1649 END2=main.randomLink2[ i ],
1650 OPTION="down" )
1651 time.sleep( link_sleep )
1652 main.Mininet1.link(
1653 END1=link3End1,
1654 END2=main.randomLink3[ i ],
1655 OPTION="down" )
1656 time.sleep( link_sleep )
1657
Hari Krishna6185fc12015-07-13 15:42:31 -07001658 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001659 linkDown = main.ONOSbench.checkStatus(
1660 topology_output, main.numMNswitches, str(
1661 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1662 utilities.assert_equals(
1663 expect=main.TRUE,
1664 actual=linkDown,
1665 onpass="Link Down discovered properly",
1666 onfail="Link down was not discovered in " +
1667 str( link_sleep ) +
1668 " seconds" )
1669
GlennRCfcfdc4f2015-09-30 16:01:57 -07001670 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001671 # Giving onos multiple chances to install intents
1672 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001673 if i != 0:
1674 main.log.warn( "Verification failed. Retrying..." )
1675 main.log.info("Giving onos some time...")
1676 time.sleep( main.checkIntentsDelay )
1677
1678 intentState = main.TRUE
1679 for e in range(int(main.numCtrls)):
1680 main.log.info( "Checking intents on CLI %s" % (e+1) )
1681 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1682 intentState
1683 if not intentState:
1684 main.log.warn( "Not all intents installed" )
1685 if intentState:
1686 break
1687 else:
1688 #Dumping intent summary
1689 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1690
1691
1692 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1693 onpass="INTENTS INSTALLED",
1694 onfail="SOME INTENTS NOT INSTALLED" )
1695
Hari Krishnac195f3b2015-07-08 20:02:24 -07001696 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001697 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001698 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001699 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1700 if not pingResult:
1701 main.log.warn("First pingall failed. Retrying...")
1702 time.sleep(main.pingSleep)
1703 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001704
Hari Krishnac195f3b2015-07-08 20:02:24 -07001705 time2 = time.time()
1706 timeDiff = round( ( time2 - time1 ), 2 )
1707 main.log.report(
1708 "Time taken for Ping All: " +
1709 str( timeDiff ) +
1710 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001711 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001712 onpass="PING ALL PASS",
1713 onfail="PING ALL FAIL" )
1714
GlennRCbddd58f2015-10-01 15:45:25 -07001715 caseResult = linkDown and pingResult and intentState
1716 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001717 onpass="Random Link cut Test PASS",
1718 onfail="Random Link cut Test FAIL" )
1719
GlennRCfcfdc4f2015-09-30 16:01:57 -07001720 # Printing what exactly failed
1721 if not linkDown:
1722 main.log.debug( "Link down was not discovered correctly" )
1723 if not pingResult:
1724 main.log.debug( "Pingall failed" )
1725 if not intentState:
1726 main.log.debug( "Intents are not all installed" )
1727
GlennRCbddd58f2015-10-01 15:45:25 -07001728 if not caseResult and main.failSwitch:
1729 main.log.report("Stopping test")
1730 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001731
Hari Krishnac195f3b2015-07-08 20:02:24 -07001732 def CASE81( self, main ):
1733 """
1734 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1735 """
1736 import random
1737 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1738 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1739 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1740 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1741 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1742
1743 main.log.report(
1744 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1745 main.log.report(
1746 "__________________________________________________________________" )
1747 main.case(
1748 "Point intents - Bring the core links up that are down and verify ping all" )
1749 main.step( "Bring randomly cut links on Core devices up" )
1750 for i in range( int( switchLinksToToggle ) ):
1751 main.Mininet1.link(
1752 END1=link1End1,
1753 END2=main.randomLink1[ i ],
1754 OPTION="up" )
1755 time.sleep( link_sleep )
1756 main.Mininet1.link(
1757 END1=link2End1,
1758 END2=main.randomLink2[ i ],
1759 OPTION="up" )
1760 time.sleep( link_sleep )
1761 main.Mininet1.link(
1762 END1=link3End1,
1763 END2=main.randomLink3[ i ],
1764 OPTION="up" )
1765 time.sleep( link_sleep )
1766
Hari Krishna6185fc12015-07-13 15:42:31 -07001767 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001768 linkUp = main.ONOSbench.checkStatus(
1769 topology_output,
1770 main.numMNswitches,
1771 str( main.numMNlinks ) )
1772 utilities.assert_equals(
1773 expect=main.TRUE,
1774 actual=linkUp,
1775 onpass="Link up discovered properly",
1776 onfail="Link up was not discovered in " +
1777 str( link_sleep ) +
1778 " seconds" )
1779
GlennRCfcfdc4f2015-09-30 16:01:57 -07001780 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001781 # Giving onos multiple chances to install intents
1782 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001783 if i != 0:
1784 main.log.warn( "Verification failed. Retrying..." )
1785 main.log.info("Giving onos some time...")
1786 time.sleep( main.checkIntentsDelay )
1787
1788 intentState = main.TRUE
1789 for e in range(int(main.numCtrls)):
1790 main.log.info( "Checking intents on CLI %s" % (e+1) )
1791 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1792 intentState
1793 if not intentState:
1794 main.log.warn( "Not all intents installed" )
1795 if intentState:
1796 break
1797 else:
1798 #Dumping intent summary
1799 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1800
1801
1802 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1803 onpass="INTENTS INSTALLED",
1804 onfail="SOME INTENTS NOT INSTALLED" )
1805
Hari Krishnac195f3b2015-07-08 20:02:24 -07001806 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001807 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001808 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001809 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1810 if not pingResult:
1811 main.log.warn("First pingall failed. Retrying...")
1812 time.sleep(main.pingSleep)
1813 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001814
Hari Krishnac195f3b2015-07-08 20:02:24 -07001815 time2 = time.time()
1816 timeDiff = round( ( time2 - time1 ), 2 )
1817 main.log.report(
1818 "Time taken for Ping All: " +
1819 str( timeDiff ) +
1820 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001821 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001822 onpass="PING ALL PASS",
1823 onfail="PING ALL FAIL" )
1824
GlennRCbddd58f2015-10-01 15:45:25 -07001825 caseResult = linkUp and pingResult
1826 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001827 onpass="Link Up Test PASS",
1828 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001829 # Printing what exactly failed
1830 if not linkUp:
1831 main.log.debug( "Link down was not discovered correctly" )
1832 if not pingResult:
1833 main.log.debug( "Pingall failed" )
1834 if not intentState:
1835 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001836
GlennRCbddd58f2015-10-01 15:45:25 -07001837 if not caseResult and main.failSwitch:
1838 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001839 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001840
Hari Krishnac195f3b2015-07-08 20:02:24 -07001841 def CASE72( self, main ):
1842 """
1843 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1844 """
1845 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001846 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001847 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001848
Hari Krishnac195f3b2015-07-08 20:02:24 -07001849 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1850 main.log.report( "___________________________________________________________________________" )
1851 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1852 switches = []
1853 switchesComb = []
1854 for i in range( main.numMNswitches ):
1855 switches.append('s%d'%(i+1))
1856 switchesLinksComb = list(itertools.combinations(switches,2))
1857 main.randomLinks = random.sample(switchesLinksComb, 5 )
1858 print main.randomLinks
1859 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001860
Hari Krishnac195f3b2015-07-08 20:02:24 -07001861 for switch in main.randomLinks:
1862 main.Mininet1.link(
1863 END1=switch[0],
1864 END2=switch[1],
1865 OPTION="down")
1866 time.sleep( link_sleep )
1867
Hari Krishna6185fc12015-07-13 15:42:31 -07001868 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001869 linkDown = main.ONOSbench.checkStatus(
1870 topology_output, main.numMNswitches, str(
1871 int( main.numMNlinks ) - 5 * 2 ) )
1872 utilities.assert_equals(
1873 expect=main.TRUE,
1874 actual=linkDown,
1875 onpass="Link Down discovered properly",
1876 onfail="Link down was not discovered in " +
1877 str( link_sleep ) +
1878 " seconds" )
1879
GlennRCfcfdc4f2015-09-30 16:01:57 -07001880 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001881 # Giving onos multiple chances to install intents
1882 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001883 if i != 0:
1884 main.log.warn( "Verification failed. Retrying..." )
1885 main.log.info("Giving onos some time...")
1886 time.sleep( main.checkIntentsDelay )
1887
1888 intentState = main.TRUE
1889 for e in range(int(main.numCtrls)):
1890 main.log.info( "Checking intents on CLI %s" % (e+1) )
1891 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1892 intentState
1893 if not intentState:
1894 main.log.warn( "Not all intents installed" )
1895 if intentState:
1896 break
1897 else:
1898 #Dumping intent summary
1899 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1900
1901
1902 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1903 onpass="INTENTS INSTALLED",
1904 onfail="SOME INTENTS NOT INSTALLED" )
1905
Hari Krishnac195f3b2015-07-08 20:02:24 -07001906 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001907 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001908 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001909 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1910 if not pingResult:
1911 main.log.warn("First pingall failed. Retrying...")
1912 time.sleep(main.pingSleep)
1913 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001914
Hari Krishnac195f3b2015-07-08 20:02:24 -07001915 time2 = time.time()
1916 timeDiff = round( ( time2 - time1 ), 2 )
1917 main.log.report(
1918 "Time taken for Ping All: " +
1919 str( timeDiff ) +
1920 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001921 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001922 onpass="PING ALL PASS",
1923 onfail="PING ALL FAIL" )
1924
GlennRCbddd58f2015-10-01 15:45:25 -07001925 caseResult = linkDown and pingResult and intentState
1926 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001927 onpass="Random Link cut Test PASS",
1928 onfail="Random Link cut Test FAIL" )
1929
GlennRCfcfdc4f2015-09-30 16:01:57 -07001930 # Printing what exactly failed
1931 if not linkDown:
1932 main.log.debug( "Link down was not discovered correctly" )
1933 if not pingResult:
1934 main.log.debug( "Pingall failed" )
1935 if not intentState:
1936 main.log.debug( "Intents are not all installed" )
1937
GlennRCbddd58f2015-10-01 15:45:25 -07001938 if not caseResult and main.failSwitch:
1939 main.log.report("Stopping test")
1940 main.stop( email=main.emailOnStop )
1941
Hari Krishnac195f3b2015-07-08 20:02:24 -07001942 def CASE82( self, main ):
1943 """
1944 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1945 """
1946 import random
1947 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001948
Hari Krishnac195f3b2015-07-08 20:02:24 -07001949 main.log.report(
1950 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1951 main.log.report(
1952 "__________________________________________________________________" )
1953 main.case(
1954 "Host intents - Bring the core links up that are down and verify ping all" )
1955 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001956
Hari Krishnac195f3b2015-07-08 20:02:24 -07001957 for switch in main.randomLinks:
1958 main.Mininet1.link(
1959 END1=switch[0],
1960 END2=switch[1],
1961 OPTION="up")
1962 time.sleep( link_sleep )
1963
Hari Krishna6185fc12015-07-13 15:42:31 -07001964 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001965 linkUp = main.ONOSbench.checkStatus(
1966 topology_output,
1967 main.numMNswitches,
1968 str( main.numMNlinks ) )
1969 utilities.assert_equals(
1970 expect=main.TRUE,
1971 actual=linkUp,
1972 onpass="Link up discovered properly",
1973 onfail="Link up was not discovered in " +
1974 str( link_sleep ) +
1975 " seconds" )
1976
GlennRCfcfdc4f2015-09-30 16:01:57 -07001977 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001978 # Giving onos multiple chances to install intents
1979 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001980 if i != 0:
1981 main.log.warn( "Verification failed. Retrying..." )
1982 main.log.info("Giving onos some time...")
1983 time.sleep( main.checkIntentsDelay )
1984
1985 intentState = main.TRUE
1986 for e in range(int(main.numCtrls)):
1987 main.log.info( "Checking intents on CLI %s" % (e+1) )
1988 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1989 intentState
1990 if not intentState:
1991 main.log.warn( "Not all intents installed" )
1992 if intentState:
1993 break
1994 else:
1995 #Dumping intent summary
1996 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1997
1998
1999 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2000 onpass="INTENTS INSTALLED",
2001 onfail="SOME INTENTS NOT INSTALLED" )
2002
Hari Krishnac195f3b2015-07-08 20:02:24 -07002003 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002004 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002005 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002006 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2007 if not pingResult:
2008 main.log.warn("First pingall failed. Retrying...")
2009 time.sleep(main.pingSleep)
2010 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002011
Hari Krishnac195f3b2015-07-08 20:02:24 -07002012 time2 = time.time()
2013 timeDiff = round( ( time2 - time1 ), 2 )
2014 main.log.report(
2015 "Time taken for Ping All: " +
2016 str( timeDiff ) +
2017 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002018 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002019 onpass="PING ALL PASS",
2020 onfail="PING ALL FAIL" )
2021
GlennRCbddd58f2015-10-01 15:45:25 -07002022 caseResult = linkUp and pingResult
2023 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002024 onpass="Link Up Test PASS",
2025 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002026 # Printing what exactly failed
2027 if not linkUp:
2028 main.log.debug( "Link down was not discovered correctly" )
2029 if not pingResult:
2030 main.log.debug( "Pingall failed" )
2031 if not intentState:
2032 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002033
GlennRCbddd58f2015-10-01 15:45:25 -07002034 if not caseResult and main.failSwitch:
2035 main.log.report("Stopping test")
2036 main.stop( email=main.emailOnStop )
2037
Hari Krishnac195f3b2015-07-08 20:02:24 -07002038 def CASE73( self, main ):
2039 """
2040 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2041 """
2042 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002043 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002044 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002045
Hari Krishnac195f3b2015-07-08 20:02:24 -07002046 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2047 main.log.report( "___________________________________________________________________________" )
2048 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2049 switches = []
2050 switchesComb = []
2051 for i in range( main.numMNswitches ):
2052 switches.append('s%d'%(i+1))
2053 switchesLinksComb = list(itertools.combinations(switches,2))
2054 main.randomLinks = random.sample(switchesLinksComb, 5 )
2055 print main.randomLinks
2056 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002057
Hari Krishnac195f3b2015-07-08 20:02:24 -07002058 for switch in main.randomLinks:
2059 main.Mininet1.link(
2060 END1=switch[0],
2061 END2=switch[1],
2062 OPTION="down")
2063 time.sleep( link_sleep )
2064
Hari Krishna6185fc12015-07-13 15:42:31 -07002065 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002066 linkDown = main.ONOSbench.checkStatus(
2067 topology_output, main.numMNswitches, str(
2068 int( main.numMNlinks ) - 5 * 2 ) )
2069 utilities.assert_equals(
2070 expect=main.TRUE,
2071 actual=linkDown,
2072 onpass="Link Down discovered properly",
2073 onfail="Link down was not discovered in " +
2074 str( link_sleep ) +
2075 " seconds" )
2076
GlennRCfcfdc4f2015-09-30 16:01:57 -07002077 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002078 # Giving onos multiple chances to install intents
2079 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002080 if i != 0:
2081 main.log.warn( "Verification failed. Retrying..." )
2082 main.log.info("Giving onos some time...")
2083 time.sleep( main.checkIntentsDelay )
2084
2085 intentState = main.TRUE
2086 for e in range(int(main.numCtrls)):
2087 main.log.info( "Checking intents on CLI %s" % (e+1) )
2088 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2089 intentState
2090 if not intentState:
2091 main.log.warn( "Not all intents installed" )
2092 if intentState:
2093 break
2094 else:
2095 #Dumping intent summary
2096 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2097
2098
2099 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2100 onpass="INTENTS INSTALLED",
2101 onfail="SOME INTENTS NOT INSTALLED" )
2102
Hari Krishnac195f3b2015-07-08 20:02:24 -07002103 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002104 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002105 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002106 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2107 if not pingResult:
2108 main.log.warn("First pingall failed. Retrying...")
2109 time.sleep(main.pingSleep)
2110 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002111
Hari Krishnac195f3b2015-07-08 20:02:24 -07002112 time2 = time.time()
2113 timeDiff = round( ( time2 - time1 ), 2 )
2114 main.log.report(
2115 "Time taken for Ping All: " +
2116 str( timeDiff ) +
2117 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002118 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002119 onpass="PING ALL PASS",
2120 onfail="PING ALL FAIL" )
2121
GlennRCbddd58f2015-10-01 15:45:25 -07002122 caseResult = linkDown and pingResult and intentState
2123 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002124 onpass="Random Link cut Test PASS",
2125 onfail="Random Link cut Test FAIL" )
2126
GlennRCfcfdc4f2015-09-30 16:01:57 -07002127 # Printing what exactly failed
2128 if not linkDown:
2129 main.log.debug( "Link down was not discovered correctly" )
2130 if not pingResult:
2131 main.log.debug( "Pingall failed" )
2132 if not intentState:
2133 main.log.debug( "Intents are not all installed" )
2134
GlennRCbddd58f2015-10-01 15:45:25 -07002135 if not caseResult and main.failSwitch:
2136 main.log.report("Stopping test")
2137 main.stop( email=main.emailOnStop )
2138
Hari Krishnac195f3b2015-07-08 20:02:24 -07002139 def CASE83( self, main ):
2140 """
2141 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2142 """
2143 import random
2144 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002145
Hari Krishnac195f3b2015-07-08 20:02:24 -07002146 main.log.report(
2147 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2148 main.log.report(
2149 "__________________________________________________________________" )
2150 main.case(
2151 "Point intents - Bring the core links up that are down and verify ping all" )
2152 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002153
Hari Krishnac195f3b2015-07-08 20:02:24 -07002154 for switch in main.randomLinks:
2155 main.Mininet1.link(
2156 END1=switch[0],
2157 END2=switch[1],
2158 OPTION="up")
2159 time.sleep( link_sleep )
2160
Hari Krishna6185fc12015-07-13 15:42:31 -07002161 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002162 linkUp = main.ONOSbench.checkStatus(
2163 topology_output,
2164 main.numMNswitches,
2165 str( main.numMNlinks ) )
2166 utilities.assert_equals(
2167 expect=main.TRUE,
2168 actual=linkUp,
2169 onpass="Link up discovered properly",
2170 onfail="Link up was not discovered in " +
2171 str( link_sleep ) +
2172 " seconds" )
2173
GlennRCfcfdc4f2015-09-30 16:01:57 -07002174 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002175 # Giving onos multiple chances to install intents
2176 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002177 if i != 0:
2178 main.log.warn( "Verification failed. Retrying..." )
2179 main.log.info("Giving onos some time...")
2180 time.sleep( main.checkIntentsDelay )
2181
2182 intentState = main.TRUE
2183 for e in range(int(main.numCtrls)):
2184 main.log.info( "Checking intents on CLI %s" % (e+1) )
2185 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2186 intentState
2187 if not intentState:
2188 main.log.warn( "Not all intents installed" )
2189 if intentState:
2190 break
2191 else:
2192 #Dumping intent summary
2193 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2194
2195
2196 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2197 onpass="INTENTS INSTALLED",
2198 onfail="SOME INTENTS NOT INSTALLED" )
2199
Hari Krishnac195f3b2015-07-08 20:02:24 -07002200 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002201 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002202 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002203 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2204 if not pingResult:
2205 main.log.warn("First pingall failed. Retrying...")
2206 time.sleep(main.pingSleep)
2207 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002208
Hari Krishnac195f3b2015-07-08 20:02:24 -07002209 time2 = time.time()
2210 timeDiff = round( ( time2 - time1 ), 2 )
2211 main.log.report(
2212 "Time taken for Ping All: " +
2213 str( timeDiff ) +
2214 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002215 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002216 onpass="PING ALL PASS",
2217 onfail="PING ALL FAIL" )
2218
GlennRCbddd58f2015-10-01 15:45:25 -07002219 caseResult = linkUp and pingResult
2220 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002221 onpass="Link Up Test PASS",
2222 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002223 # Printing what exactly failed
2224 if not linkUp:
2225 main.log.debug( "Link down was not discovered correctly" )
2226 if not pingResult:
2227 main.log.debug( "Pingall failed" )
2228 if not intentState:
2229 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002230
GlennRCbddd58f2015-10-01 15:45:25 -07002231 if not caseResult and main.failSwitch:
2232 main.log.report("Stopping test")
2233 main.stop( email=main.emailOnStop )
2234
Hari Krishnac195f3b2015-07-08 20:02:24 -07002235 def CASE74( self, main ):
2236 """
2237 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2238 """
2239 import random
2240 main.randomLink1 = []
2241 main.randomLink2 = []
2242 main.randomLink3 = []
2243 main.randomLink4 = []
2244 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2245 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2246 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2247 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2248 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2249 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2250 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2251 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002252
Hari Krishnac195f3b2015-07-08 20:02:24 -07002253 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2254 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002255 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002256 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002257 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002258 linkIndex.remove(linkIndexS9)
2259 linkIndexS10 = random.sample(linkIndex,1)[0]
2260 main.randomLink1 = link1End2top[linkIndexS9]
2261 main.randomLink2 = link2End2top[linkIndexS10]
2262 main.randomLink3 = random.sample(link1End2bot,1)[0]
2263 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002264
2265 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002266 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2267 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2268 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2269 time.sleep( link_sleep )
2270 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2271 time.sleep( link_sleep )
2272
Hari Krishna6185fc12015-07-13 15:42:31 -07002273 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002274 linkDown = main.ONOSbench.checkStatus(
2275 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002276 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002277 utilities.assert_equals(
2278 expect=main.TRUE,
2279 actual=linkDown,
2280 onpass="Link Down discovered properly",
2281 onfail="Link down was not discovered in " +
2282 str( link_sleep ) +
2283 " seconds" )
2284
GlennRCfcfdc4f2015-09-30 16:01:57 -07002285 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002286 # Giving onos multiple chances to install intents
2287 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002288 if i != 0:
2289 main.log.warn( "Verification failed. Retrying..." )
2290 main.log.info("Giving onos some time...")
2291 time.sleep( main.checkIntentsDelay )
2292
2293 intentState = main.TRUE
2294 for e in range(int(main.numCtrls)):
2295 main.log.info( "Checking intents on CLI %s" % (e+1) )
2296 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2297 intentState
2298 if not intentState:
2299 main.log.warn( "Not all intents installed" )
2300 if intentState:
2301 break
2302 else:
2303 #Dumping intent summary
2304 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2305
2306
2307 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2308 onpass="INTENTS INSTALLED",
2309 onfail="SOME INTENTS NOT INSTALLED" )
2310
Hari Krishnac195f3b2015-07-08 20:02:24 -07002311 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002312 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002313 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002314 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2315 if not pingResult:
2316 main.log.warn("First pingall failed. Retrying...")
2317 time.sleep(main.pingSleep)
2318 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002319
Hari Krishnac195f3b2015-07-08 20:02:24 -07002320 time2 = time.time()
2321 timeDiff = round( ( time2 - time1 ), 2 )
2322 main.log.report(
2323 "Time taken for Ping All: " +
2324 str( timeDiff ) +
2325 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002326 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002327 onpass="PING ALL PASS",
2328 onfail="PING ALL FAIL" )
2329
GlennRCbddd58f2015-10-01 15:45:25 -07002330 caseResult = linkDown and pingResult and intentState
2331 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002332 onpass="Random Link cut Test PASS",
2333 onfail="Random Link cut Test FAIL" )
2334
GlennRCfcfdc4f2015-09-30 16:01:57 -07002335 # Printing what exactly failed
2336 if not linkDown:
2337 main.log.debug( "Link down was not discovered correctly" )
2338 if not pingResult:
2339 main.log.debug( "Pingall failed" )
2340 if not intentState:
2341 main.log.debug( "Intents are not all installed" )
2342
GlennRCbddd58f2015-10-01 15:45:25 -07002343 if not caseResult and main.failSwitch:
2344 main.log.report("Stopping test")
2345 main.stop( email=main.emailOnStop )
2346
Hari Krishnac195f3b2015-07-08 20:02:24 -07002347 def CASE84( self, main ):
2348 """
2349 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2350 """
2351 import random
2352 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2353 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2354 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2355 main.log.report(
2356 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2357 main.log.report(
2358 "__________________________________________________________________" )
2359 main.case(
2360 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002361
2362 # Work around for link state propagation delay. Added some sleep time.
2363 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2364 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002365 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2366 time.sleep( link_sleep )
2367 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2368 time.sleep( link_sleep )
2369
Hari Krishna6185fc12015-07-13 15:42:31 -07002370 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002371 linkUp = main.ONOSbench.checkStatus(
2372 topology_output,
2373 main.numMNswitches,
2374 str( main.numMNlinks ) )
2375 utilities.assert_equals(
2376 expect=main.TRUE,
2377 actual=linkUp,
2378 onpass="Link up discovered properly",
2379 onfail="Link up was not discovered in " +
2380 str( link_sleep ) +
2381 " seconds" )
2382
GlennRCfcfdc4f2015-09-30 16:01:57 -07002383 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002384 # Giving onos multiple chances to install intents
2385 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002386 if i != 0:
2387 main.log.warn( "Verification failed. Retrying..." )
2388 main.log.info("Giving onos some time...")
2389 time.sleep( main.checkIntentsDelay )
2390
2391 intentState = main.TRUE
2392 for e in range(int(main.numCtrls)):
2393 main.log.info( "Checking intents on CLI %s" % (e+1) )
2394 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2395 intentState
2396 if not intentState:
2397 main.log.warn( "Not all intents installed" )
2398 if intentState:
2399 break
2400 else:
2401 #Dumping intent summary
2402 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2403
2404
2405 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2406 onpass="INTENTS INSTALLED",
2407 onfail="SOME INTENTS NOT INSTALLED" )
2408
Hari Krishnac195f3b2015-07-08 20:02:24 -07002409 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002410 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002411 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002412 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2413 if not pingResult:
2414 main.log.warn("First pingall failed. Retrying...")
2415 time.sleep(main.pingSleep)
2416 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002417
Hari Krishnac195f3b2015-07-08 20:02:24 -07002418 time2 = time.time()
2419 timeDiff = round( ( time2 - time1 ), 2 )
2420 main.log.report(
2421 "Time taken for Ping All: " +
2422 str( timeDiff ) +
2423 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002424 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002425 onpass="PING ALL PASS",
2426 onfail="PING ALL FAIL" )
2427
GlennRCbddd58f2015-10-01 15:45:25 -07002428 caseResult = linkUp and pingResult
2429 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002430 onpass="Link Up Test PASS",
2431 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002432 # Printing what exactly failed
2433 if not linkUp:
2434 main.log.debug( "Link down was not discovered correctly" )
2435 if not pingResult:
2436 main.log.debug( "Pingall failed" )
2437 if not intentState:
2438 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002439
GlennRCbddd58f2015-10-01 15:45:25 -07002440 if not caseResult and main.failSwitch:
2441 main.log.report("Stopping test")
2442 main.stop( email=main.emailOnStop )
2443
Hari Krishnab79d0822015-08-20 09:48:43 -07002444 def CASE75( self, main ):
2445 """
2446 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2447 """
2448 import random
2449 main.randomLink1 = []
2450 main.randomLink2 = []
2451 main.randomLink3 = []
2452 main.randomLink4 = []
2453 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2454 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2455 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2456 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2457 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2458 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2459 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2460 main.pingTimeout = 400
2461
2462 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2463 main.log.report( "___________________________________________________________________________" )
2464 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2465 linkIndex = range(4)
2466 linkIndexS9 = random.sample(linkIndex,1)[0]
2467 linkIndex.remove(linkIndexS9)
2468 linkIndexS10 = random.sample(linkIndex,1)[0]
2469 main.randomLink1 = link1End2top[linkIndexS9]
2470 main.randomLink2 = link2End2top[linkIndexS10]
2471 main.randomLink3 = random.sample(link1End2bot,1)[0]
2472 main.randomLink4 = random.sample(link2End2bot,1)[0]
2473
2474 # Work around for link state propagation delay. Added some sleep time.
2475 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2476 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2477 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2478 time.sleep( link_sleep )
2479 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2480 time.sleep( link_sleep )
2481
2482 topology_output = main.ONOScli1.topology()
2483 linkDown = main.ONOSbench.checkStatus(
2484 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002485 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002486 utilities.assert_equals(
2487 expect=main.TRUE,
2488 actual=linkDown,
2489 onpass="Link Down discovered properly",
2490 onfail="Link down was not discovered in " +
2491 str( link_sleep ) +
2492 " seconds" )
2493
GlennRCfcfdc4f2015-09-30 16:01:57 -07002494 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002495 # Giving onos multiple chances to install intents
2496 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002497 if i != 0:
2498 main.log.warn( "Verification failed. Retrying..." )
2499 main.log.info("Giving onos some time...")
2500 time.sleep( main.checkIntentsDelay )
2501
2502 intentState = main.TRUE
2503 for e in range(int(main.numCtrls)):
2504 main.log.info( "Checking intents on CLI %s" % (e+1) )
2505 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2506 intentState
2507 if not intentState:
2508 main.log.warn( "Not all intents installed" )
2509 if intentState:
2510 break
2511 else:
2512 #Dumping intent summary
2513 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2514
2515
2516 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2517 onpass="INTENTS INSTALLED",
2518 onfail="SOME INTENTS NOT INSTALLED" )
2519
Hari Krishnab79d0822015-08-20 09:48:43 -07002520 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002521 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002522 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002523 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2524 if not pingResult:
2525 main.log.warn("First pingall failed. Retrying...")
2526 time.sleep(main.pingSleep)
2527 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002528
Hari Krishnab79d0822015-08-20 09:48:43 -07002529 time2 = time.time()
2530 timeDiff = round( ( time2 - time1 ), 2 )
2531 main.log.report(
2532 "Time taken for Ping All: " +
2533 str( timeDiff ) +
2534 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002535 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002536 onpass="PING ALL PASS",
2537 onfail="PING ALL FAIL" )
2538
GlennRCbddd58f2015-10-01 15:45:25 -07002539 caseResult = linkDown and pingResult and intentState
2540 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002541 onpass="Random Link cut Test PASS",
2542 onfail="Random Link cut Test FAIL" )
2543
GlennRCfcfdc4f2015-09-30 16:01:57 -07002544 # Printing what exactly failed
2545 if not linkDown:
2546 main.log.debug( "Link down was not discovered correctly" )
2547 if not pingResult:
2548 main.log.debug( "Pingall failed" )
2549 if not intentState:
2550 main.log.debug( "Intents are not all installed" )
2551
GlennRCbddd58f2015-10-01 15:45:25 -07002552 if not caseResult and main.failSwitch:
2553 main.log.report("Stopping test")
2554 main.stop( email=main.emailOnStop )
2555
Hari Krishnab79d0822015-08-20 09:48:43 -07002556 def CASE85( self, main ):
2557 """
2558 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2559 """
2560 import random
2561 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2562 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2563 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2564 main.log.report(
2565 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2566 main.log.report(
2567 "__________________________________________________________________" )
2568 main.case(
2569 "Point intents - Bring the core links up that are down and verify ping all" )
2570
2571 # Work around for link state propagation delay. Added some sleep time.
2572 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2573 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2574 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2575 time.sleep( link_sleep )
2576 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2577 time.sleep( link_sleep )
2578
2579 topology_output = main.ONOScli1.topology()
2580 linkUp = main.ONOSbench.checkStatus(
2581 topology_output,
2582 main.numMNswitches,
2583 str( main.numMNlinks ) )
2584 utilities.assert_equals(
2585 expect=main.TRUE,
2586 actual=linkUp,
2587 onpass="Link up discovered properly",
2588 onfail="Link up was not discovered in " +
2589 str( link_sleep ) +
2590 " seconds" )
2591
GlennRCfcfdc4f2015-09-30 16:01:57 -07002592 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002593 # Giving onos multiple chances to install intents
2594 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002595 if i != 0:
2596 main.log.warn( "Verification failed. Retrying..." )
2597 main.log.info("Giving onos some time...")
2598 time.sleep( main.checkIntentsDelay )
2599
2600 intentState = main.TRUE
2601 for e in range(int(main.numCtrls)):
2602 main.log.info( "Checking intents on CLI %s" % (e+1) )
2603 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2604 intentState
2605 if not intentState:
2606 main.log.warn( "Not all intents installed" )
2607 if intentState:
2608 break
2609 else:
2610 #Dumping intent summary
2611 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2612
2613
2614 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2615 onpass="INTENTS INSTALLED",
2616 onfail="SOME INTENTS NOT INSTALLED" )
2617
Hari Krishnab79d0822015-08-20 09:48:43 -07002618 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002619 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002620 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002621 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2622 if not pingResult:
2623 main.log.warn("First pingall failed. Retrying...")
2624 time.sleep(main.pingSleep)
2625 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002626
Hari Krishnab79d0822015-08-20 09:48:43 -07002627 time2 = time.time()
2628 timeDiff = round( ( time2 - time1 ), 2 )
2629 main.log.report(
2630 "Time taken for Ping All: " +
2631 str( timeDiff ) +
2632 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002633 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002634 onpass="PING ALL PASS",
2635 onfail="PING ALL FAIL" )
2636
GlennRCbddd58f2015-10-01 15:45:25 -07002637 caseResult = linkUp and pingResult
2638 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002639 onpass="Link Up Test PASS",
2640 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002641 # Printing what exactly failed
2642 if not linkUp:
2643 main.log.debug( "Link down was not discovered correctly" )
2644 if not pingResult:
2645 main.log.debug( "Pingall failed" )
2646 if not intentState:
2647 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002648
GlennRCbddd58f2015-10-01 15:45:25 -07002649 if not caseResult and main.failSwitch:
2650 main.log.report("Stopping test")
2651 main.stop( email=main.emailOnStop )
2652
Hari Krishna4223dbd2015-08-13 16:29:53 -07002653 def CASE170( self ):
2654 """
2655 IPv6 ping all with some core links down( Host Intents-Att Topo)
2656 """
2657 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2658 main.log.report( "_________________________________________________" )
2659 import itertools
2660 import time
2661 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2662 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002663 pingResult = main.FALSE
2664 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002665 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002666 if not pingResult:
2667 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002668 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002669 time2 = time.time()
2670 timeDiff = round( ( time2 - time1 ), 2 )
2671 main.log.report(
2672 "Time taken for IPv6 Ping All: " +
2673 str( timeDiff ) +
2674 " seconds" )
2675 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2676 onpass="PING ALL PASS",
2677 onfail="PING ALL FAIL" )
2678
GlennRCbddd58f2015-10-01 15:45:25 -07002679 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002680 utilities.assert_equals(
2681 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002682 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002683 onpass="IPv6 Ping across 300 host intents test PASS",
2684 onfail="IPv6 Ping across 300 host intents test FAIL" )
2685
2686 def CASE180( self ):
2687 """
2688 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2689 """
2690 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2691 main.log.report( "_________________________________________________" )
2692 import itertools
2693 import time
2694 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2695 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002696 pingResult = main.FALSE
2697 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002698 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002699 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002700 main.log.warn("First ping failed. Retrying...")
2701 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002702 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002703 time2 = time.time()
2704 timeDiff = round( ( time2 - time1 ), 2 )
2705 main.log.report(
2706 "Time taken for IPv6 Ping All: " +
2707 str( timeDiff ) +
2708 " seconds" )
2709 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2710 onpass="PING ALL PASS",
2711 onfail="PING ALL FAIL" )
2712
GlennRCbddd58f2015-10-01 15:45:25 -07002713 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002714 utilities.assert_equals(
2715 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002716 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002717 onpass="IPv6 Ping across 300 host intents test PASS",
2718 onfail="IPv6 Ping across 300 host intents test FAIL" )
2719
2720 def CASE171( self ):
2721 """
2722 IPv6 ping all with some core links down( Point Intents-Att Topo)
2723 """
2724 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2725 main.log.report( "_________________________________________________" )
2726 import itertools
2727 import time
2728 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2729 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002730 pingResult = main.FALSE
2731 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002732 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002733 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002734 main.log.warn("First ping failed. Retrying...")
2735 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002736 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002737 time2 = time.time()
2738 timeDiff = round( ( time2 - time1 ), 2 )
2739 main.log.report(
2740 "Time taken for IPv6 Ping All: " +
2741 str( timeDiff ) +
2742 " seconds" )
2743 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2744 onpass="PING ALL PASS",
2745 onfail="PING ALL FAIL" )
2746
GlennRCbddd58f2015-10-01 15:45:25 -07002747 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002748 utilities.assert_equals(
2749 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002750 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002751 onpass="IPv6 Ping across 600 point intents test PASS",
2752 onfail="IPv6 Ping across 600 point intents test FAIL" )
2753
2754 def CASE181( self ):
2755 """
2756 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2757 """
2758 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2759 main.log.report( "_________________________________________________" )
2760 import itertools
2761 import time
2762 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2763 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002764 pingResult = main.FALSE
2765 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002766 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002767 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002768 main.log.warn("First ping failed. Retrying...")
2769 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002770 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002771 time2 = time.time()
2772 timeDiff = round( ( time2 - time1 ), 2 )
2773 main.log.report(
2774 "Time taken for IPv6 Ping All: " +
2775 str( timeDiff ) +
2776 " seconds" )
2777 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2778 onpass="PING ALL PASS",
2779 onfail="PING ALL FAIL" )
2780
GlennRCbddd58f2015-10-01 15:45:25 -07002781 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002782 utilities.assert_equals(
2783 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002784 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002785 onpass="IPv6 Ping across 600 Point intents test PASS",
2786 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2787
2788 def CASE172( self ):
2789 """
2790 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2791 """
2792 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2793 main.log.report( "_________________________________________________" )
2794 import itertools
2795 import time
2796 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2797 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002798 pingResult = main.FALSE
2799 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002800 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002801 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002802 main.log.warn("First ping failed. Retrying...")
2803 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002804 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002805 time2 = time.time()
2806 timeDiff = round( ( time2 - time1 ), 2 )
2807 main.log.report(
2808 "Time taken for IPv6 Ping All: " +
2809 str( timeDiff ) +
2810 " seconds" )
2811 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2812 onpass="PING ALL PASS",
2813 onfail="PING ALL FAIL" )
2814
GlennRCbddd58f2015-10-01 15:45:25 -07002815 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002816 utilities.assert_equals(
2817 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002818 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002819 onpass="IPv6 Ping across 300 host intents test PASS",
2820 onfail="IPv6 Ping across 300 host intents test FAIL" )
2821
2822 def CASE182( self ):
2823 """
2824 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2825 """
2826 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2827 main.log.report( "_________________________________________________" )
2828 import itertools
2829 import time
2830 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2831 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002832 pingResult = main.FALSE
2833 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002834 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002835 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002836 main.log.warn("First ping failed. Retrying...")
2837 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002838 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002839 time2 = time.time()
2840 timeDiff = round( ( time2 - time1 ), 2 )
2841 main.log.report(
2842 "Time taken for IPv6 Ping All: " +
2843 str( timeDiff ) +
2844 " seconds" )
2845 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2846 onpass="PING ALL PASS",
2847 onfail="PING ALL FAIL" )
2848
GlennRCbddd58f2015-10-01 15:45:25 -07002849 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002850 utilities.assert_equals(
2851 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002852 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002853 onpass="IPv6 Ping across 300 host intents test PASS",
2854 onfail="IPv6 Ping across 300 host intents test FAIL" )
2855
2856 def CASE173( self ):
2857 """
2858 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2859 """
2860 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2861 main.log.report( "_________________________________________________" )
2862 import itertools
2863 import time
2864 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2865 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002866 pingResult = main.FALSE
2867 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002868 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002869 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002870 main.log.warn("First ping failed. Retrying...")
2871 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002872 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002873 time2 = time.time()
2874 timeDiff = round( ( time2 - time1 ), 2 )
2875 main.log.report(
2876 "Time taken for IPv6 Ping All: " +
2877 str( timeDiff ) +
2878 " seconds" )
2879 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2880 onpass="PING ALL PASS",
2881 onfail="PING ALL FAIL" )
2882
GlennRCbddd58f2015-10-01 15:45:25 -07002883 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002884 utilities.assert_equals(
2885 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002886 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002887 onpass="IPv6 Ping across 600 point intents test PASS",
2888 onfail="IPv6 Ping across 600 point intents test FAIL" )
2889
2890 def CASE183( self ):
2891 """
2892 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2893 """
2894 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2895 main.log.report( "_________________________________________________" )
2896 import itertools
2897 import time
2898 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2899 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002900 pingResult = main.FALSE
2901 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002902 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002903 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002904 main.log.warn("First ping failed. Retrying...")
2905 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002906 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002907 time2 = time.time()
2908 timeDiff = round( ( time2 - time1 ), 2 )
2909 main.log.report(
2910 "Time taken for IPv6 Ping All: " +
2911 str( timeDiff ) +
2912 " seconds" )
2913 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2914 onpass="PING ALL PASS",
2915 onfail="PING ALL FAIL" )
2916
GlennRCbddd58f2015-10-01 15:45:25 -07002917 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002918 utilities.assert_equals(
2919 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002920 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002921 onpass="IPv6 Ping across 600 Point intents test PASS",
2922 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2923
2924 def CASE174( self ):
2925 """
2926 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2927 """
2928 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2929 main.log.report( "_________________________________________________" )
2930 import itertools
2931 import time
2932 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2933 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002934 pingResult = main.FALSE
2935 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002936 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002937 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002938 main.log.warn("First ping failed. Retrying...")
2939 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002940 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002941 time2 = time.time()
2942 timeDiff = round( ( time2 - time1 ), 2 )
2943 main.log.report(
2944 "Time taken for IPv6 Ping All: " +
2945 str( timeDiff ) +
2946 " seconds" )
2947 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2948 onpass="PING ALL PASS",
2949 onfail="PING ALL FAIL" )
2950
GlennRCbddd58f2015-10-01 15:45:25 -07002951 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002952 utilities.assert_equals(
2953 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002954 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002955 onpass="IPv6 Ping across 2278 host intents test PASS",
2956 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2957
2958 def CASE184( self ):
2959 """
2960 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2961 """
2962 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2963 main.log.report( "_________________________________________________" )
2964 import itertools
2965 import time
2966 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2967 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002968 pingResult = main.FALSE
2969 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002970 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002971 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002972 main.log.warn("First ping failed. Retrying...")
2973 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002974 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002975 time2 = time.time()
2976 timeDiff = round( ( time2 - time1 ), 2 )
2977 main.log.report(
2978 "Time taken for IPv6 Ping All: " +
2979 str( timeDiff ) +
2980 " seconds" )
2981 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2982 onpass="PING ALL PASS",
2983 onfail="PING ALL FAIL" )
2984
GlennRCbddd58f2015-10-01 15:45:25 -07002985 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002986 utilities.assert_equals(
2987 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002988 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002989 onpass="IPv6 Ping across 2278 host intents test PASS",
2990 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2991
2992 def CASE175( self ):
2993 """
2994 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2995 """
2996 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2997 main.log.report( "_________________________________________________" )
2998 import itertools
2999 import time
3000 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3001 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003002 pingResult = main.FALSE
3003 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003004 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003005 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003006 main.log.warn("First ping failed. Retrying...")
3007 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003008 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003009 time2 = time.time()
3010 timeDiff = round( ( time2 - time1 ), 2 )
3011 main.log.report(
3012 "Time taken for IPv6 Ping All: " +
3013 str( timeDiff ) +
3014 " seconds" )
3015 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3016 onpass="PING ALL PASS",
3017 onfail="PING ALL FAIL" )
3018
GlennRCbddd58f2015-10-01 15:45:25 -07003019 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003020 utilities.assert_equals(
3021 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003022 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003023 onpass="IPv6 Ping across 4556 point intents test PASS",
3024 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3025
3026 def CASE185( self ):
3027 """
3028 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3029 """
3030 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3031 main.log.report( "_________________________________________________" )
3032 import itertools
3033 import time
3034 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3035 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003036 pingResult = main.FALSE
3037 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003038 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003039 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003040 main.log.warn("First ping failed. Retrying...")
3041 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003042 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003043 time2 = time.time()
3044 timeDiff = round( ( time2 - time1 ), 2 )
3045 main.log.report(
3046 "Time taken for IPv6 Ping All: " +
3047 str( timeDiff ) +
3048 " seconds" )
3049 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3050 onpass="PING ALL PASS",
3051 onfail="PING ALL FAIL" )
3052
GlennRCbddd58f2015-10-01 15:45:25 -07003053 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003054 utilities.assert_equals(
3055 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003056 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003057 onpass="IPv6 Ping across 4556 Point intents test PASS",
3058 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3059
Hari Krishnac195f3b2015-07-08 20:02:24 -07003060 def CASE90( self ):
3061 """
3062 Install 600 point intents and verify ping all (Att Topology)
3063 """
3064 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3065 main.log.report( "_______________________________________" )
3066 import itertools
3067 import time
3068 main.case( "Install 600 point intents" )
3069 main.step( "Add point Intents" )
3070 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003071 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3072
Hari Krishnac195f3b2015-07-08 20:02:24 -07003073 intentIdList = []
3074 time1 = time.time()
3075 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3076 pool = []
3077 for cli in main.CLIs:
3078 if i >= len( deviceCombos ):
3079 break
3080 t = main.Thread( target=cli.addPointIntent,
3081 threadID=main.threadID,
3082 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003083 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 -07003084 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003085 t.start()
3086 i = i + 1
3087 main.threadID = main.threadID + 1
3088 for thread in pool:
3089 thread.join()
3090 intentIdList.append(thread.result)
3091 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003092 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003093
GlennRCfcfdc4f2015-09-30 16:01:57 -07003094 # Saving intent ids to check intents in later case
3095 main.intentIds = list(intentIdList)
3096
GlennRCa8d786a2015-09-23 17:40:11 -07003097 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003098
GlennRC1dde1712015-10-02 11:03:08 -07003099 # Giving onos multiple chances to install intents
3100 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003101 if i != 0:
3102 main.log.warn( "Verification failed. Retrying..." )
3103 main.log.info("Waiting for onos to install intents...")
3104 time.sleep( main.checkIntentsDelay )
3105
GlennRCa8d786a2015-09-23 17:40:11 -07003106 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003107 for e in range(int(main.numCtrls)):
3108 main.log.info( "Checking intents on CLI %s" % (e+1) )
3109 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3110 intentState
3111 if not intentState:
3112 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003113 if intentState:
3114 break
GlennRCdb2c8422015-09-29 12:21:59 -07003115 else:
3116 #Dumping intent summary
3117 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003118
3119 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3120 onpass="INTENTS INSTALLED",
3121 onfail="SOME INTENTS NOT INSTALLED" )
3122
Hari Krishnac195f3b2015-07-08 20:02:24 -07003123 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003124 for i in range(main.numPings):
3125 time1 = time.time()
3126 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3127 if not pingResult:
3128 main.log.warn("First pingall failed. Retrying...")
3129 time.sleep(main.pingSleep)
3130 else: break
3131
Hari Krishnac195f3b2015-07-08 20:02:24 -07003132 time2 = time.time()
3133 timeDiff = round( ( time2 - time1 ), 2 )
3134 main.log.report(
3135 "Time taken for Ping All: " +
3136 str( timeDiff ) +
3137 " seconds" )
3138 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003139 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003140 onfail="PING ALL FAIL" )
3141
GlennRCbddd58f2015-10-01 15:45:25 -07003142 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003143
Hari Krishnac195f3b2015-07-08 20:02:24 -07003144 utilities.assert_equals(
3145 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003146 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003147 onpass="Install 600 point Intents and Ping All test PASS",
3148 onfail="Install 600 point Intents and Ping All test FAIL" )
3149
GlennRCbddd58f2015-10-01 15:45:25 -07003150 if not intentState:
3151 main.log.debug( "Intents failed to install completely" )
3152 if not pingResult:
3153 main.log.debug( "Pingall failed" )
3154
3155 if not caseResult and main.failSwitch:
3156 main.log.report("Stopping test")
3157 main.stop( email=main.emailOnStop )
3158
Hari Krishnac195f3b2015-07-08 20:02:24 -07003159 def CASE91( self ):
3160 """
3161 Install 600 point intents and verify ping all (Chordal Topology)
3162 """
3163 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3164 main.log.report( "_______________________________________" )
3165 import itertools
3166 import time
3167 main.case( "Install 600 point intents" )
3168 main.step( "Add point Intents" )
3169 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003170 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3171
Hari Krishnac195f3b2015-07-08 20:02:24 -07003172 intentIdList = []
3173 time1 = time.time()
3174 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3175 pool = []
3176 for cli in main.CLIs:
3177 if i >= len( deviceCombos ):
3178 break
3179 t = main.Thread( target=cli.addPointIntent,
3180 threadID=main.threadID,
3181 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003182 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 -07003183 pool.append(t)
3184 #time.sleep(1)
3185 t.start()
3186 i = i + 1
3187 main.threadID = main.threadID + 1
3188 for thread in pool:
3189 thread.join()
3190 intentIdList.append(thread.result)
3191 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003192 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003193
GlennRCfcfdc4f2015-09-30 16:01:57 -07003194 # Saving intent ids to check intents in later case
3195 main.intentIds = list(intentIdList)
3196
GlennRCa8d786a2015-09-23 17:40:11 -07003197 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003198
GlennRC1dde1712015-10-02 11:03:08 -07003199 # Giving onos multiple chances to install intents
3200 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003201 if i != 0:
3202 main.log.warn( "Verification failed. Retrying..." )
3203 main.log.info("Waiting for onos to install intents...")
3204 time.sleep( main.checkIntentsDelay )
3205
GlennRCa8d786a2015-09-23 17:40:11 -07003206 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003207 for e in range(int(main.numCtrls)):
3208 main.log.info( "Checking intents on CLI %s" % (e+1) )
3209 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3210 intentState
3211 if not intentState:
3212 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003213 if intentState:
3214 break
GlennRCdb2c8422015-09-29 12:21:59 -07003215 else:
3216 #Dumping intent summary
3217 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003218
3219 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3220 onpass="INTENTS INSTALLED",
3221 onfail="SOME INTENTS NOT INSTALLED" )
3222
Hari Krishnac195f3b2015-07-08 20:02:24 -07003223 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003224 for i in range(main.numPings):
3225 time1 = time.time()
3226 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3227 if not pingResult:
3228 main.log.warn("First pingall failed. Retrying...")
3229 time.sleep(main.pingSleep)
3230 else: break
3231
Hari Krishnac195f3b2015-07-08 20:02:24 -07003232 time2 = time.time()
3233 timeDiff = round( ( time2 - time1 ), 2 )
3234 main.log.report(
3235 "Time taken for Ping All: " +
3236 str( timeDiff ) +
3237 " seconds" )
3238 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3239 onpass="PING ALL PASS",
3240 onfail="PING ALL FAIL" )
3241
GlennRCbddd58f2015-10-01 15:45:25 -07003242 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003243
Hari Krishnac195f3b2015-07-08 20:02:24 -07003244 utilities.assert_equals(
3245 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003246 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003247 onpass="Install 600 point Intents and Ping All test PASS",
3248 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003249
GlennRCbddd58f2015-10-01 15:45:25 -07003250 if not intentState:
3251 main.log.debug( "Intents failed to install completely" )
3252 if not pingResult:
3253 main.log.debug( "Pingall failed" )
3254
3255 if not caseResult and main.failSwitch:
3256 main.log.report("Stopping test")
3257 main.stop( email=main.emailOnStop )
3258
Hari Krishnac195f3b2015-07-08 20:02:24 -07003259 def CASE92( self ):
3260 """
3261 Install 4556 point intents and verify ping all (Spine Topology)
3262 """
3263 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3264 main.log.report( "_______________________________________" )
3265 import itertools
3266 import time
3267 main.case( "Install 4556 point intents" )
3268 main.step( "Add point Intents" )
3269 intentResult = main.TRUE
3270 main.pingTimeout = 600
3271 for i in range(len(main.hostMACs)):
3272 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3273 print main.MACsDict
3274 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3275 intentIdList = []
3276 time1 = time.time()
3277 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3278 pool = []
3279 for cli in main.CLIs:
3280 if i >= len( deviceCombos ):
3281 break
3282 t = main.Thread( target=cli.addPointIntent,
3283 threadID=main.threadID,
3284 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003285 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003286 pool.append(t)
3287 #time.sleep(1)
3288 t.start()
3289 i = i + 1
3290 main.threadID = main.threadID + 1
3291 for thread in pool:
3292 thread.join()
3293 intentIdList.append(thread.result)
3294 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003295 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003296
GlennRCfcfdc4f2015-09-30 16:01:57 -07003297 # Saving intent ids to check intents in later case
3298 main.intentIds = list(intentIdList)
3299
GlennRCa8d786a2015-09-23 17:40:11 -07003300 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003301
GlennRC1dde1712015-10-02 11:03:08 -07003302 # Giving onos multiple chances to install intents
3303 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003304 if i != 0:
3305 main.log.warn( "Verification failed. Retrying..." )
3306 main.log.info("Waiting for onos to install intents...")
3307 time.sleep( main.checkIntentsDelay )
3308
GlennRCa8d786a2015-09-23 17:40:11 -07003309 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003310 for e in range(int(main.numCtrls)):
3311 main.log.info( "Checking intents on CLI %s" % (e+1) )
3312 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3313 intentState
3314 if not intentState:
3315 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003316 if intentState:
3317 break
GlennRCdb2c8422015-09-29 12:21:59 -07003318 else:
3319 #Dumping intent summary
3320 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003321
3322 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3323 onpass="INTENTS INSTALLED",
3324 onfail="SOME INTENTS NOT INSTALLED" )
3325
Hari Krishnac195f3b2015-07-08 20:02:24 -07003326 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003327 for i in range(main.numPings):
3328 time1 = time.time()
3329 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3330 if not pingResult:
3331 main.log.warn("First pingall failed. Retrying...")
3332 time.sleep(main.pingSleep)
3333 else: break
3334
Hari Krishnac195f3b2015-07-08 20:02:24 -07003335 time2 = time.time()
3336 timeDiff = round( ( time2 - time1 ), 2 )
3337 main.log.report(
3338 "Time taken for Ping All: " +
3339 str( timeDiff ) +
3340 " seconds" )
3341 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3342 onpass="PING ALL PASS",
3343 onfail="PING ALL FAIL" )
3344
GlennRCbddd58f2015-10-01 15:45:25 -07003345 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003346
Hari Krishnac195f3b2015-07-08 20:02:24 -07003347 utilities.assert_equals(
3348 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003349 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003350 onpass="Install 4556 point Intents and Ping All test PASS",
3351 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003352
GlennRCbddd58f2015-10-01 15:45:25 -07003353 if not intentState:
3354 main.log.debug( "Intents failed to install completely" )
3355 if not pingResult:
3356 main.log.debug( "Pingall failed" )
3357
3358 if not caseResult and main.failSwitch:
3359 main.log.report("Stopping test")
3360 main.stop( email=main.emailOnStop )
3361
Hari Krishnac195f3b2015-07-08 20:02:24 -07003362 def CASE93( self ):
3363 """
3364 Install multi-single point intents and verify Ping all works
3365 for att topology
3366 """
3367 import copy
3368 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003369 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003370 main.log.report( "Install multi-single point intents and verify Ping all" )
3371 main.log.report( "___________________________________________" )
3372 main.case( "Install multi-single point intents and Ping all" )
3373 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3374 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3375 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003376 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003377 time1 = time.time()
3378 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3379 pool = []
3380 for cli in main.CLIs:
3381 egressDevice = deviceDPIDsCopy[i]
3382 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3383 ingressDeviceList.remove(egressDevice)
3384 if i >= len( deviceDPIDsCopy ):
3385 break
3386 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3387 threadID=main.threadID,
3388 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003389 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003390 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003391 t.start()
3392 i = i + 1
3393 main.threadID = main.threadID + 1
3394 for thread in pool:
3395 thread.join()
3396 intentIdList.append(thread.result)
3397 time2 = time.time()
3398 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003399
GlennRCdb2c8422015-09-29 12:21:59 -07003400 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003401
GlennRC1dde1712015-10-02 11:03:08 -07003402 # Giving onos multiple chances to install intents
3403 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003404 if i != 0:
3405 main.log.warn( "Verification failed. Retrying..." )
3406 main.log.info("Waiting for onos to install intents...")
3407 time.sleep( main.checkIntentsDelay )
3408
3409 intentState = main.TRUE
3410 for e in range(int(main.numCtrls)):
3411 main.log.info( "Checking intents on CLI %s" % (e+1) )
3412 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3413 intentState
3414 if not intentState:
3415 main.log.warn( "Not all intents installed" )
3416 if intentState:
3417 break
3418 else:
3419 #Dumping intent summary
3420 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3421
3422 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3423 onpass="INTENTS INSTALLED",
3424 onfail="SOME INTENTS NOT INSTALLED" )
3425
GlennRCfa69a2a2015-10-02 15:54:06 -07003426 main.step("Verify flows are all added")
3427
3428 for i in range( main.flowCheck ):
3429 if i != 0:
3430 main.log.warn( "verification failed. Retrying..." )
3431 main.log.info( "Waiting for onos to add flows..." )
3432 time.sleep( main.checkFlowsDelay )
3433
3434 flowState = main.TRUE
3435 for cli in main.CLIs:
3436 flowState = cli.checkFlowState()
3437 if not flowState:
3438 main.log.warn( "Not all flows added" )
3439 if flowState:
3440 break
3441 else:
3442 #Dumping summary
3443 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3444
3445 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3446 onpass="FLOWS INSTALLED",
3447 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003448
Hari Krishnac195f3b2015-07-08 20:02:24 -07003449 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003450 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003451 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003452 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3453 if not pingResult:
3454 main.log.warn("First pingall failed. Retrying...")
3455 time.sleep(main.pingSleep)
3456 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003457
Hari Krishnac195f3b2015-07-08 20:02:24 -07003458 time2 = time.time()
3459 timeDiff = round( ( time2 - time1 ), 2 )
3460 main.log.report(
3461 "Time taken for Ping All: " +
3462 str( timeDiff ) +
3463 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003464
GlennRCbddd58f2015-10-01 15:45:25 -07003465 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003466 utilities.assert_equals(
3467 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003468 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003469 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3470 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003471
GlennRCfa69a2a2015-10-02 15:54:06 -07003472 if not intentState:
3473 main.log.debug( "Intents failed to install completely" )
3474 if not pingResult:
3475 main.log.debug( "Pingall failed" )
3476 if not checkFlowsState:
3477 main.log.debug( "Flows failed to add completely" )
3478
3479 if not caseResult and main.failSwitch:
3480 main.log.report("Stopping test")
3481 main.stop( email=main.emailOnStop )
3482
Hari Krishnac195f3b2015-07-08 20:02:24 -07003483 def CASE94( self ):
3484 """
3485 Install multi-single point intents and verify Ping all works
3486 for Chordal topology
3487 """
3488 import copy
3489 import time
3490 main.log.report( "Install multi-single point intents and verify Ping all" )
3491 main.log.report( "___________________________________________" )
3492 main.case( "Install multi-single point intents and Ping all" )
3493 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3494 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3495 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003496 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003497 time1 = time.time()
3498 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3499 pool = []
3500 for cli in main.CLIs:
3501 egressDevice = deviceDPIDsCopy[i]
3502 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3503 ingressDeviceList.remove(egressDevice)
3504 if i >= len( deviceDPIDsCopy ):
3505 break
3506 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3507 threadID=main.threadID,
3508 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003509 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003510 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003511 t.start()
3512 i = i + 1
3513 main.threadID = main.threadID + 1
3514 for thread in pool:
3515 thread.join()
3516 intentIdList.append(thread.result)
3517 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003518 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003519
3520 main.step("Verify intents are installed")
3521
GlennRC1dde1712015-10-02 11:03:08 -07003522 # Giving onos multiple chances to install intents
3523 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003524 if i != 0:
3525 main.log.warn( "Verification failed. Retrying..." )
3526 main.log.info("Waiting for onos to install intents...")
3527 time.sleep( main.checkIntentsDelay )
3528
3529 intentState = main.TRUE
3530 for e in range(int(main.numCtrls)):
3531 main.log.info( "Checking intents on CLI %s" % (e+1) )
3532 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3533 intentState
3534 if not intentState:
3535 main.log.warn( "Not all intents installed" )
3536 if intentState:
3537 break
3538 else:
3539 #Dumping intent summary
3540 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3541
GlennRCdb2c8422015-09-29 12:21:59 -07003542 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3543 onpass="INTENTS INSTALLED",
3544 onfail="SOME INTENTS NOT INSTALLED" )
3545
GlennRCfa69a2a2015-10-02 15:54:06 -07003546 main.step("Verify flows are all added")
3547
3548 for i in range( main.flowCheck ):
3549 if i != 0:
3550 main.log.warn( "verification failed. Retrying..." )
3551 main.log.info( "Waiting for onos to add flows..." )
3552 time.sleep( main.checkFlowsDelay )
3553
3554 flowState = main.TRUE
3555 for cli in main.CLIs:
3556 flowState = cli.checkFlowState()
3557 if not flowState:
3558 main.log.warn( "Not all flows added" )
3559 if flowState:
3560 break
3561 else:
3562 #Dumping summary
3563 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3564
3565 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3566 onpass="FLOWS INSTALLED",
3567 onfail="SOME FLOWS NOT ADDED" )
3568
Hari Krishnac195f3b2015-07-08 20:02:24 -07003569 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003570 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003571 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003572 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3573 if not pingResult:
3574 main.log.warn("First pingall failed. Retrying...")
3575 time.sleep(main.pingSleep)
3576 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003577
Hari Krishnac195f3b2015-07-08 20:02:24 -07003578 time2 = time.time()
3579 timeDiff = round( ( time2 - time1 ), 2 )
3580 main.log.report(
3581 "Time taken for Ping All: " +
3582 str( timeDiff ) +
3583 " seconds" )
3584
GlennRCfa69a2a2015-10-02 15:54:06 -07003585 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003586 utilities.assert_equals(
3587 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003588 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003589 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3590 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003591
GlennRCfa69a2a2015-10-02 15:54:06 -07003592 if not intentState:
3593 main.log.debug( "Intents failed to install completely" )
3594 if not pingResult:
3595 main.log.debug( "Pingall failed" )
3596 if not checkFlowsState:
3597 main.log.debug( "Flows failed to add completely" )
3598
3599 if not caseResult and main.failSwitch:
3600 main.log.report("Stopping test")
3601 main.stop( email=main.emailOnStop )
3602
3603 def CASE95( self ):
3604 """
3605 Install multi-single point intents and verify Ping all works
3606 for Spine topology
3607 """
3608 import copy
3609 import time
3610 main.log.report( "Install multi-single point intents and verify Ping all" )
3611 main.log.report( "___________________________________________" )
3612 main.case( "Install multi-single point intents and Ping all" )
3613 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3614 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3615 intentIdList = []
3616 main.log.info( "MACsDict" + str(main.MACsDict) )
3617 time1 = time.time()
3618 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3619 pool = []
3620 for cli in main.CLIs:
3621 egressDevice = deviceDPIDsCopy[i]
3622 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3623 ingressDeviceList.remove(egressDevice)
3624 if i >= len( deviceDPIDsCopy ):
3625 break
3626 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3627 threadID=main.threadID,
3628 name="addMultipointToSinglepointIntent",
3629 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3630 pool.append(t)
3631 t.start()
3632 i = i + 1
3633 main.threadID = main.threadID + 1
3634 for thread in pool:
3635 thread.join()
3636 intentIdList.append(thread.result)
3637 time2 = time.time()
3638 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3639
3640 main.step("Verify intents are installed")
3641
3642 # Giving onos multiple chances to install intents
3643 for i in range( main.intentCheck ):
3644 if i != 0:
3645 main.log.warn( "Verification failed. Retrying..." )
3646 main.log.info("Waiting for onos to install intents...")
3647 time.sleep( main.checkIntentsDelay )
3648
3649 intentState = main.TRUE
3650 for e in range(int(main.numCtrls)):
3651 main.log.info( "Checking intents on CLI %s" % (e+1) )
3652 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3653 intentState
3654 if not intentState:
3655 main.log.warn( "Not all intents installed" )
3656 if intentState:
3657 break
3658 else:
3659 #Dumping intent summary
3660 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3661
3662 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3663 onpass="INTENTS INSTALLED",
3664 onfail="SOME INTENTS NOT INSTALLED" )
3665
3666 main.step("Verify flows are all added")
3667
3668 for i in range( main.flowCheck ):
3669 if i != 0:
3670 main.log.warn( "verification failed. Retrying..." )
3671 main.log.info( "Waiting for onos to add flows..." )
3672 time.sleep( main.checkFlowsDelay )
3673
3674 flowState = main.TRUE
3675 for cli in main.CLIs:
3676 flowState = cli.checkFlowState()
3677 if not flowState:
3678 main.log.warn( "Not all flows added" )
3679 if flowState:
3680 break
3681 else:
3682 #Dumping summary
3683 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3684
3685 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3686 onpass="FLOWS INSTALLED",
3687 onfail="SOME FLOWS NOT ADDED" )
3688
3689 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003690 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003691 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003692 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3693 if not pingResult:
3694 main.log.warn("First pingall failed. Retrying...")
3695 time.sleep(main.pingSleep)
3696 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003697
3698 time2 = time.time()
3699 timeDiff = round( ( time2 - time1 ), 2 )
3700 main.log.report(
3701 "Time taken for Ping All: " +
3702 str( timeDiff ) +
3703 " seconds" )
3704
3705 caseResult = ( checkFlowsState and pingResult and intentState )
3706 utilities.assert_equals(
3707 expect=main.TRUE,
3708 actual=caseResult,
3709 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3710 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3711
3712 if not intentState:
3713 main.log.debug( "Intents failed to install completely" )
3714 if not pingResult:
3715 main.log.debug( "Pingall failed" )
3716 if not checkFlowsState:
3717 main.log.debug( "Flows failed to add completely" )
3718
3719 if not caseResult and main.failSwitch:
3720 main.log.report("Stopping test")
3721 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003722
3723 def CASE96( self ):
3724 """
3725 Install single-multi point intents and verify Ping all works
3726 for att topology
3727 """
3728 import copy
3729 main.log.report( "Install single-multi point intents and verify Ping all" )
3730 main.log.report( "___________________________________________" )
3731 main.case( "Install single-multi point intents and Ping all" )
3732 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3733 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3734 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003735 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003736 time1 = time.time()
3737 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3738 pool = []
3739 for cli in main.CLIs:
3740 ingressDevice = deviceDPIDsCopy[i]
3741 egressDeviceList = copy.copy(deviceDPIDsCopy)
3742 egressDeviceList.remove(ingressDevice)
3743 if i >= len( deviceDPIDsCopy ):
3744 break
3745 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3746 threadID=main.threadID,
3747 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003748 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003749 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003750 t.start()
3751 i = i + 1
3752 main.threadID = main.threadID + 1
3753 for thread in pool:
3754 thread.join()
3755 intentIdList.append(thread.result)
3756 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003757 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003758
3759 main.step("Verify intents are installed")
3760
GlennRC1dde1712015-10-02 11:03:08 -07003761 # Giving onos multiple chances to install intents
3762 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003763 if i != 0:
3764 main.log.warn( "Verification failed. Retrying..." )
3765 main.log.info("Waiting for onos to install intents...")
3766 time.sleep( main.checkIntentsDelay )
3767
3768 intentState = main.TRUE
3769 for e in range(int(main.numCtrls)):
3770 main.log.info( "Checking intents on CLI %s" % (e+1) )
3771 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3772 intentState
3773 if not intentState:
3774 main.log.warn( "Not all intents installed" )
3775 if intentState:
3776 break
3777 else:
3778 #Dumping intent summary
3779 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3780
GlennRCdb2c8422015-09-29 12:21:59 -07003781 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3782 onpass="INTENTS INSTALLED",
3783 onfail="SOME INTENTS NOT INSTALLED" )
3784
GlennRCfa69a2a2015-10-02 15:54:06 -07003785 main.step("Verify flows are all added")
3786
3787 for i in range( main.flowCheck ):
3788 if i != 0:
3789 main.log.warn( "verification failed. Retrying..." )
3790 main.log.info( "Waiting for onos to add flows..." )
3791 time.sleep( main.checkFlowsDelay )
3792
3793 flowState = main.TRUE
3794 for cli in main.CLIs:
3795 flowState = cli.checkFlowState()
3796 if not flowState:
3797 main.log.warn( "Not all flows added" )
3798 if flowState:
3799 break
3800 else:
3801 #Dumping summary
3802 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3803
3804 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3805 onpass="FLOWS INSTALLED",
3806 onfail="SOME FLOWS NOT ADDED" )
3807
Hari Krishnac195f3b2015-07-08 20:02:24 -07003808 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003809 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003810 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003811 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3812 if not pingResult:
3813 main.log.warn("First pingall failed. Retrying...")
3814 time.sleep(main.pingSleep)
3815 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003816
Hari Krishnac195f3b2015-07-08 20:02:24 -07003817 time2 = time.time()
3818 timeDiff = round( ( time2 - time1 ), 2 )
3819 main.log.report(
3820 "Time taken for Ping All: " +
3821 str( timeDiff ) +
3822 " seconds" )
3823
GlennRCfa69a2a2015-10-02 15:54:06 -07003824 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003825 utilities.assert_equals(
3826 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003827 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003828 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3829 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3830
GlennRCfa69a2a2015-10-02 15:54:06 -07003831 if not intentState:
3832 main.log.debug( "Intents failed to install completely" )
3833 if not pingResult:
3834 main.log.debug( "Pingall failed" )
3835 if not checkFlowsState:
3836 main.log.debug( "Flows failed to add completely" )
3837
3838 if not caseResult and main.failSwitch:
3839 main.log.report("Stopping test")
3840 main.stop( email=main.emailOnStop )
3841
Hari Krishnac195f3b2015-07-08 20:02:24 -07003842 def CASE97( self ):
3843 """
3844 Install single-multi point intents and verify Ping all works
3845 for Chordal topology
3846 """
3847 import copy
3848 main.log.report( "Install single-multi point intents and verify Ping all" )
3849 main.log.report( "___________________________________________" )
3850 main.case( "Install single-multi point intents and Ping all" )
3851 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3852 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3853 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003854 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003855 time1 = time.time()
3856 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3857 pool = []
3858 for cli in main.CLIs:
3859 ingressDevice = deviceDPIDsCopy[i]
3860 egressDeviceList = copy.copy(deviceDPIDsCopy)
3861 egressDeviceList.remove(ingressDevice)
3862 if i >= len( deviceDPIDsCopy ):
3863 break
3864 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3865 threadID=main.threadID,
3866 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003867 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003868 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003869 t.start()
3870 i = i + 1
3871 main.threadID = main.threadID + 1
3872 for thread in pool:
3873 thread.join()
3874 intentIdList.append(thread.result)
3875 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003876 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003877
3878 main.step("Verify intents are installed")
3879
GlennRC1dde1712015-10-02 11:03:08 -07003880 # Giving onos multiple chances to install intents
3881 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003882 if i != 0:
3883 main.log.warn( "Verification failed. Retrying..." )
3884 main.log.info("Waiting for onos to install intents...")
3885 time.sleep( main.checkIntentsDelay )
3886
3887 intentState = main.TRUE
3888 for e in range(int(main.numCtrls)):
3889 main.log.info( "Checking intents on CLI %s" % (e+1) )
3890 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3891 intentState
3892 if not intentState:
3893 main.log.warn( "Not all intents installed" )
3894 if intentState:
3895 break
3896 else:
3897 #Dumping intent summary
3898 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3899
GlennRCdb2c8422015-09-29 12:21:59 -07003900 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3901 onpass="INTENTS INSTALLED",
3902 onfail="SOME INTENTS NOT INSTALLED" )
3903
GlennRCfa69a2a2015-10-02 15:54:06 -07003904 main.step("Verify flows are all added")
3905
3906 for i in range( main.flowCheck ):
3907 if i != 0:
3908 main.log.warn( "verification failed. Retrying..." )
3909 main.log.info( "Waiting for onos to add flows..." )
3910 time.sleep( main.checkFlowsDelay )
3911
3912 flowState = main.TRUE
3913 for cli in main.CLIs:
3914 flowState = cli.checkFlowState()
3915 if not flowState:
3916 main.log.warn( "Not all flows added" )
3917 if flowState:
3918 break
3919 else:
3920 #Dumping summary
3921 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3922
3923 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3924 onpass="FLOWS INSTALLED",
3925 onfail="SOME FLOWS NOT ADDED" )
3926
Hari Krishnac195f3b2015-07-08 20:02:24 -07003927 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003928 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003929 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003930 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3931 if not pingResult:
3932 main.log.warn("First pingall failed. Retrying...")
3933 time.sleep(main.pingSleep)
3934 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003935
Hari Krishnac195f3b2015-07-08 20:02:24 -07003936 time2 = time.time()
3937 timeDiff = round( ( time2 - time1 ), 2 )
3938 main.log.report(
3939 "Time taken for Ping All: " +
3940 str( timeDiff ) +
3941 " seconds" )
3942
GlennRCfa69a2a2015-10-02 15:54:06 -07003943 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003944 utilities.assert_equals(
3945 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003946 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003947 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3948 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3949
GlennRCfa69a2a2015-10-02 15:54:06 -07003950 if not intentState:
3951 main.log.debug( "Intents failed to install completely" )
3952 if not pingResult:
3953 main.log.debug( "Pingall failed" )
3954 if not checkFlowsState:
3955 main.log.debug( "Flows failed to add completely" )
3956
3957 if not caseResult and main.failSwitch:
3958 main.log.report("Stopping test")
3959 main.stop( email=main.emailOnStop )
3960
Hari Krishnac195f3b2015-07-08 20:02:24 -07003961 def CASE98( self ):
3962 """
3963 Install single-multi point intents and verify Ping all works
3964 for Spine topology
3965 """
3966 import copy
3967 main.log.report( "Install single-multi point intents and verify Ping all" )
3968 main.log.report( "___________________________________________" )
3969 main.case( "Install single-multi point intents and Ping all" )
3970 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3971 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3972 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3973 intentIdList = []
3974 MACsDictCopy = {}
3975 for i in range( len( deviceDPIDsCopy ) ):
3976 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3977
GlennRCfa69a2a2015-10-02 15:54:06 -07003978 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3979 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003980 time1 = time.time()
3981 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3982 pool = []
3983 for cli in main.CLIs:
3984 if i >= len( deviceDPIDsCopy ):
3985 break
3986 ingressDevice = deviceDPIDsCopy[i]
3987 egressDeviceList = copy.copy(deviceDPIDsCopy)
3988 egressDeviceList.remove(ingressDevice)
3989 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3990 threadID=main.threadID,
3991 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003992 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003993 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003994 t.start()
3995 i = i + 1
3996 main.threadID = main.threadID + 1
3997 for thread in pool:
3998 thread.join()
3999 intentIdList.append(thread.result)
4000 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004001 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004002
4003 main.step("Verify intents are installed")
4004
GlennRC1dde1712015-10-02 11:03:08 -07004005 # Giving onos multiple chances to install intents
4006 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004007 if i != 0:
4008 main.log.warn( "Verification failed. Retrying..." )
4009 main.log.info("Waiting for onos to install intents...")
4010 time.sleep( main.checkIntentsDelay )
4011
4012 intentState = main.TRUE
4013 for e in range(int(main.numCtrls)):
4014 main.log.info( "Checking intents on CLI %s" % (e+1) )
4015 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4016 intentState
4017 if not intentState:
4018 main.log.warn( "Not all intents installed" )
4019 if intentState:
4020 break
4021 else:
4022 #Dumping intent summary
4023 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4024
GlennRCdb2c8422015-09-29 12:21:59 -07004025 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4026 onpass="INTENTS INSTALLED",
4027 onfail="SOME INTENTS NOT INSTALLED" )
4028
GlennRCfa69a2a2015-10-02 15:54:06 -07004029 main.step("Verify flows are all added")
4030
4031 for i in range( main.flowCheck ):
4032 if i != 0:
4033 main.log.warn( "verification failed. Retrying..." )
4034 main.log.info( "Waiting for onos to add flows..." )
4035 time.sleep( main.checkFlowsDelay )
4036
4037 flowState = main.TRUE
4038 for cli in main.CLIs:
4039 flowState = cli.checkFlowState()
4040 if not flowState:
4041 main.log.warn( "Not all flows added" )
4042 if flowState:
4043 break
4044 else:
4045 #Dumping summary
4046 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4047
4048 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4049 onpass="FLOWS INSTALLED",
4050 onfail="SOME FLOWS NOT ADDED" )
4051
Hari Krishnac195f3b2015-07-08 20:02:24 -07004052 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004053 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004054 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004055 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4056 if not pingResult:
4057 main.log.warn("First pingall failed. Retrying...")
4058 time.sleep(main.pingSleep)
4059 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004060
Hari Krishnac195f3b2015-07-08 20:02:24 -07004061 time2 = time.time()
4062 timeDiff = round( ( time2 - time1 ), 2 )
4063 main.log.report(
4064 "Time taken for Ping All: " +
4065 str( timeDiff ) +
4066 " seconds" )
4067
GlennRCfa69a2a2015-10-02 15:54:06 -07004068 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004069 utilities.assert_equals(
4070 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004071 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004072 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4073 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4074
GlennRCfa69a2a2015-10-02 15:54:06 -07004075 if not intentState:
4076 main.log.debug( "Intents failed to install completely" )
4077 if not pingResult:
4078 main.log.debug( "Pingall failed" )
4079 if not checkFlowsState:
4080 main.log.debug( "Flows failed to add completely" )
4081
4082 if not caseResult and main.failSwitch:
4083 main.log.report("Stopping test")
4084 main.stop( email=main.emailOnStop )
4085
Hari Krishna4223dbd2015-08-13 16:29:53 -07004086 def CASE190( self ):
4087 """
4088 Verify IPv6 ping across 600 Point intents (Att Topology)
4089 """
4090 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4091 main.log.report( "_________________________________________________" )
4092 import itertools
4093 import time
4094 main.case( "IPv6 ping all 600 Point intents" )
4095 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004096 pingResult = main.FALSE
4097 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004098 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004099 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004100 main.log.warn("First pingall failed. Retrying...")
4101 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004102 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004103 time2 = time.time()
4104 timeDiff = round( ( time2 - time1 ), 2 )
4105 main.log.report(
4106 "Time taken for IPv6 Ping All: " +
4107 str( timeDiff ) +
4108 " seconds" )
4109 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4110 onpass="PING ALL PASS",
4111 onfail="PING ALL FAIL" )
4112
GlennRCbddd58f2015-10-01 15:45:25 -07004113 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004114 utilities.assert_equals(
4115 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004116 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004117 onpass="IPv6 Ping across 600 Point intents test PASS",
4118 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4119
4120 def CASE191( self ):
4121 """
4122 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4123 """
4124 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4125 main.log.report( "_________________________________________________" )
4126 import itertools
4127 import time
4128 main.case( "IPv6 ping all 600 Point intents" )
4129 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004130 pingResult = main.FALSE
4131 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004132 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004133 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004134 main.log.warn("First pingall failed. Retrying...")
4135 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004136 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004137 time2 = time.time()
4138 timeDiff = round( ( time2 - time1 ), 2 )
4139 main.log.report(
4140 "Time taken for IPv6 Ping All: " +
4141 str( timeDiff ) +
4142 " seconds" )
4143 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4144 onpass="PING ALL PASS",
4145 onfail="PING ALL FAIL" )
4146
GlennRCbddd58f2015-10-01 15:45:25 -07004147 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004148 utilities.assert_equals(
4149 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004150 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004151 onpass="IPv6 Ping across 600 Point intents test PASS",
4152 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4153
4154 def CASE192( self ):
4155 """
4156 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4157 """
4158 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4159 main.log.report( "_________________________________________________" )
4160 import itertools
4161 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004162 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004163 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004164 pingResult = main.FALSE
4165 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004166 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004167 if not pingResult:
4168 main.log.warn("First pingall failed. Retrying...")
4169 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004170 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004171 time2 = time.time()
4172 timeDiff = round( ( time2 - time1 ), 2 )
4173 main.log.report(
4174 "Time taken for IPv6 Ping All: " +
4175 str( timeDiff ) +
4176 " seconds" )
4177 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4178 onpass="PING ALL PASS",
4179 onfail="PING ALL FAIL" )
4180
GlennRCbddd58f2015-10-01 15:45:25 -07004181 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004182 utilities.assert_equals(
4183 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004184 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004185 onpass="IPv6 Ping across 4556 Point intents test PASS",
4186 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004187
Hari Krishnac195f3b2015-07-08 20:02:24 -07004188 def CASE10( self ):
4189 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004190 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004191 """
4192 Remove all Intents
4193 """
4194 main.log.report( "Remove all intents that were installed previously" )
4195 main.log.report( "______________________________________________" )
4196 main.log.info( "Remove all intents" )
4197 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004198 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004199 main.step( "Obtain the intent id's first" )
4200 intentsList = main.ONOScli1.getAllIntentIds()
4201 ansi_escape = re.compile( r'\x1b[^m]*m' )
4202 intentsList = ansi_escape.sub( '', intentsList )
4203 intentsList = intentsList.replace(
4204 " onos:intents | grep id=",
4205 "" ).replace(
4206 "id=",
4207 "" ).replace(
4208 "\r\r",
4209 "" )
4210 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004211 intentIdList = []
4212 step1Result = main.TRUE
4213 moreIntents = main.TRUE
4214 removeIntentCount = 0
4215 intentsCount = len(intentsList)
4216 main.log.info ( "Current number of intents: " + str(intentsCount) )
4217 if ( len( intentsList ) > 1 ):
4218 results = main.TRUE
4219 main.log.info("Removing intent...")
4220 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004221 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004222 if removeIntentCount == 5:
4223 break
4224 removeIntentCount = removeIntentCount + 1
4225 intentsList1 = main.ONOScli1.getAllIntentIds()
4226 if len( intentsList1 ) == 0:
4227 break
4228 ansi_escape = re.compile( r'\x1b[^m]*m' )
4229 intentsList1 = ansi_escape.sub( '', intentsList1 )
4230 intentsList1 = intentsList1.replace(
4231 " onos:intents | grep id=",
4232 "" ).replace(
4233 " state=",
4234 "" ).replace(
4235 "\r\r",
4236 "" )
4237 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004238 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4239 print intentsList1
4240 intentIdList1 = []
4241 if ( len( intentsList1 ) > 0 ):
4242 moreIntents = main.TRUE
4243 for i in range( len( intentsList1 ) ):
4244 intentsTemp1 = intentsList1[ i ].split( ',' )
4245 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4246 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4247 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4248 time1 = time.time()
4249 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4250 pool = []
4251 for cli in main.CLIs:
4252 if i >= len( intentIdList1 ):
4253 break
4254 t = main.Thread( target=cli.removeIntent,
4255 threadID=main.threadID,
4256 name="removeIntent",
4257 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4258 pool.append(t)
4259 t.start()
4260 i = i + 1
4261 main.threadID = main.threadID + 1
4262 for thread in pool:
4263 thread.join()
4264 intentIdList.append(thread.result)
4265 #time.sleep(2)
4266 time2 = time.time()
4267 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004268 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004269 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004270 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004271 else:
4272 time.sleep(10)
4273 if len( main.ONOScli1.intents()):
4274 continue
4275 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004276 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004277 else:
4278 print "Removed %d intents" %(intentsCount)
4279 step1Result = main.TRUE
4280 else:
4281 print "No Intent IDs found in Intents list: ", intentsList
4282 step1Result = main.FALSE
4283
4284 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004285 caseResult = step1Result
4286 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004287 onpass="Intent removal test successful",
4288 onfail="Intent removal test failed" )
4289
4290 def CASE12( self, main ):
4291 """
4292 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4293 """
4294 import re
4295 import copy
4296 import time
4297
Hari Krishnac195f3b2015-07-08 20:02:24 -07004298 threadID = 0
4299
4300 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4301 main.log.report( "_____________________________________________________" )
4302 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4303 main.step( "Enable intent based Reactive forwarding" )
4304 installResult = main.FALSE
4305 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004306
Hari Krishnac195f3b2015-07-08 20:02:24 -07004307 pool = []
4308 time1 = time.time()
4309 for cli,feature in main.CLIs:
4310 t = main.Thread(target=cli,threadID=threadID,
4311 name="featureInstall",args=[feature])
4312 pool.append(t)
4313 t.start()
4314 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004315
Hari Krishnac195f3b2015-07-08 20:02:24 -07004316 results = []
4317 for thread in pool:
4318 thread.join()
4319 results.append(thread.result)
4320 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004321
Hari Krishnac195f3b2015-07-08 20:02:24 -07004322 if( all(result == main.TRUE for result in results) == False):
4323 main.log.info("Did not install onos-app-ifwd feature properly")
4324 #main.cleanup()
4325 #main.exit()
4326 else:
4327 main.log.info("Successful feature:install onos-app-ifwd")
4328 installResult = main.TRUE
4329 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004330
GlennRC6ac11b12015-10-21 17:41:28 -07004331 main.step( "Verify Ping across all hosts" )
4332 for i in range(main.numPings):
4333 time1 = time.time()
4334 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4335 if not pingResult:
4336 main.log.warn("First pingall failed. Retrying...")
4337 time.sleep(main.pingSleep)
4338 else: break
4339
Hari Krishnac195f3b2015-07-08 20:02:24 -07004340 time2 = time.time()
4341 timeDiff = round( ( time2 - time1 ), 2 )
4342 main.log.report(
4343 "Time taken for Ping All: " +
4344 str( timeDiff ) +
4345 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004346
GlennRC626ba132015-09-18 16:16:31 -07004347 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004348 main.log.report( "Pingall Test in Reactive mode successful" )
4349 else:
4350 main.log.report( "Pingall Test in Reactive mode failed" )
4351
4352 main.step( "Disable Intent based Reactive forwarding" )
4353 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004354
Hari Krishnac195f3b2015-07-08 20:02:24 -07004355 pool = []
4356 time1 = time.time()
4357 for cli,feature in main.CLIs:
4358 t = main.Thread(target=cli,threadID=threadID,
4359 name="featureUninstall",args=[feature])
4360 pool.append(t)
4361 t.start()
4362 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004363
Hari Krishnac195f3b2015-07-08 20:02:24 -07004364 results = []
4365 for thread in pool:
4366 thread.join()
4367 results.append(thread.result)
4368 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004369
Hari Krishnac195f3b2015-07-08 20:02:24 -07004370 if( all(result == main.TRUE for result in results) == False):
4371 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4372 uninstallResult = main.FALSE
4373 #main.cleanup()
4374 #main.exit()
4375 else:
4376 main.log.info("Successful feature:uninstall onos-app-ifwd")
4377 uninstallResult = main.TRUE
4378 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4379
4380 # Waiting for reative flows to be cleared.
4381 time.sleep( 10 )
4382
GlennRCbddd58f2015-10-01 15:45:25 -07004383 caseResult = installResult and pingResult and uninstallResult
4384 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004385 onpass="Intent based Reactive forwarding Pingall test PASS",
4386 onfail="Intent based Reactive forwarding Pingall test FAIL" )