blob: dca0585dea2e7fd41d1e5248615a0eaf9177f810 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
Hari Krishnac195f3b2015-07-08 20:02:24 -070030 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070031 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
32 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070033 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070034 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070035 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070036 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070037 main.intentCheck = int( main.params['TEST']['intentChecks'] )
GlennRC289c1b62015-12-12 10:45:43 -080038 main.topoCheck = int( main.params['TEST']['topoChecks'] )
GlennRCf7be6632015-10-20 13:04:07 -070039 main.numPings = int( main.params['TEST']['numPings'] )
GlennRC6ac11b12015-10-21 17:41:28 -070040 main.pingSleep = int( main.params['timers']['pingSleep'] )
GlennRC289c1b62015-12-12 10:45:43 -080041 main.topoCheckDelay = int( main.params['timers']['topoCheckDelay'] )
GlennRC3de72232015-12-16 10:48:35 -080042 main.pingTimeout = int( main.params['timers']['pingTimeout'] )
GlennRC20fc6522015-12-23 23:26:57 -080043 main.remHostDelay = int( main.params['timers']['remHostDelay'] )
44 main.remDevDelay = int( main.params['timers']['remDevDelay'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070045 main.newTopo = ""
46 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070047
GlennRC9e7465e2015-10-02 13:50:36 -070048 main.failSwitch = True if main.failSwitch == "on" else False
49 main.emailOnStop = True if main.emailOnStop == "on" else False
50
Hari Krishnac195f3b2015-07-08 20:02:24 -070051 for i in range( 1, int(main.numCtrls) + 1 ):
52 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070053
54 main.case( "Set up test environment" )
55 main.log.report( "Set up test environment" )
56 main.log.report( "_______________________" )
57
Hari Krishna6185fc12015-07-13 15:42:31 -070058 main.step( "Apply Cell environment for ONOS" )
59 if ( main.onoscell ):
60 cellName = main.onoscell
61 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070062 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
63 onpass="Test step PASS",
64 onfail="Test step FAIL" )
65 else:
66 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
67 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080068 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070069 main.exit()
70
Hari Krishnac195f3b2015-07-08 20:02:24 -070071 main.step( "Git checkout and pull " + git_branch )
72 if git_pull == 'on':
73 checkout_result = main.ONOSbench.gitCheckout( git_branch )
74 pull_result = main.ONOSbench.gitPull()
75 cp_result = ( checkout_result and pull_result )
76 else:
77 checkout_result = main.TRUE
78 pull_result = main.TRUE
79 main.log.info( "Skipped git checkout and pull" )
80 cp_result = ( checkout_result and pull_result )
81 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
82 onpass="Test step PASS",
83 onfail="Test step FAIL" )
84
85 main.step( "mvn clean & install" )
86 if git_pull == 'on':
87 mvn_result = main.ONOSbench.cleanInstall()
88 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
89 onpass="Test step PASS",
90 onfail="Test step FAIL" )
91 else:
92 mvn_result = main.TRUE
93 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
94
95 main.ONOSbench.getVersion( report=True )
96
Hari Krishnac195f3b2015-07-08 20:02:24 -070097 main.step( "Create ONOS package" )
98 packageResult = main.ONOSbench.onosPackage()
99 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
100 onpass="Test step PASS",
101 onfail="Test step FAIL" )
102
103 main.step( "Uninstall ONOS package on all Nodes" )
104 uninstallResult = main.TRUE
105 for i in range( int( main.numCtrls ) ):
106 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
107 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
108 utilities.assert_equals( expect=main.TRUE, actual=u_result,
109 onpass="Test step PASS",
110 onfail="Test step FAIL" )
111 uninstallResult = ( uninstallResult and u_result )
112
113 main.step( "Install ONOS package on all Nodes" )
114 installResult = main.TRUE
115 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700116 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700117 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
118 utilities.assert_equals( expect=main.TRUE, actual=i_result,
119 onpass="Test step PASS",
120 onfail="Test step FAIL" )
121 installResult = ( installResult and i_result )
122
123 main.step( "Verify ONOS nodes UP status" )
124 statusResult = main.TRUE
125 for i in range( int( main.numCtrls ) ):
126 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
127 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
128 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
129 onpass="Test step PASS",
130 onfail="Test step FAIL" )
131 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700132
Hari Krishnac195f3b2015-07-08 20:02:24 -0700133 main.step( "Start ONOS CLI on all nodes" )
134 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700135 main.log.step(" Start ONOS cli using thread ")
136 startCliResult = main.TRUE
137 pool = []
138 time1 = time.time()
139 for i in range( int( main.numCtrls) ):
140 t = main.Thread( target=main.CLIs[i].startOnosCli,
141 threadID=main.threadID,
142 name="startOnosCli",
143 args=[ main.onosIPs[i], karafTimeout ] )
144 pool.append(t)
145 t.start()
146 main.threadID = main.threadID + 1
147 for t in pool:
148 t.join()
149 startCliResult = startCliResult and t.result
150 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700151
Hari Krishnac195f3b2015-07-08 20:02:24 -0700152 if not startCliResult:
153 main.log.info("ONOS CLI did not start up properly")
154 main.cleanup()
155 main.exit()
156 else:
157 main.log.info("Successful CLI startup")
158 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700159
160 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
161 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
162 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
163 cfgResult = cfgResult1 and cfgResult2
164 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
165 onpass="ipv6NeighborDiscovery cfg is set to true",
166 onfail="Failed to cfg set ipv6NeighborDiscovery" )
167
168 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700169 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
170 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
171 onpass="Set up test environment PASS",
172 onfail="Set up test environment FAIL" )
173
174 def CASE20( self, main ):
175 """
176 This test script Loads a new Topology (Att) on CHO setup and balances all switches
177 """
178 import re
179 import time
180 import copy
181
GlennRC3de72232015-12-16 10:48:35 -0800182 main.prefix = 0
183
Hari Krishnac195f3b2015-07-08 20:02:24 -0700184 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
185 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
186 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700187 main.log.report(
188 "Load Att topology and Balance all Mininet switches across controllers" )
189 main.log.report(
190 "________________________________________________________________________" )
191 main.case(
192 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700193
Hari Krishnac195f3b2015-07-08 20:02:24 -0700194 main.step( "Start Mininet with Att topology" )
195 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700196 mininetDir = main.Mininet1.home + "/custom/"
197 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
198 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
199 topoPath = mininetDir + main.newTopo
200 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700201
Hari Krishnac195f3b2015-07-08 20:02:24 -0700202 main.step( "Assign switches to controllers" )
203 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
204 main.Mininet1.assignSwController(
205 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700206 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700207
208 switch_mastership = main.TRUE
209 for i in range( 1, ( main.numMNswitches + 1 ) ):
210 response = main.Mininet1.getSwController( "s" + str( i ) )
211 print( "Response is " + str( response ) )
212 if re.search( "tcp:" + main.onosIPs[0], response ):
213 switch_mastership = switch_mastership and main.TRUE
214 else:
215 switch_mastership = main.FALSE
216
217 if switch_mastership == main.TRUE:
218 main.log.report( "Controller assignment successfull" )
219 else:
220 main.log.report( "Controller assignment failed" )
221
222 time.sleep(30) # waiting here to make sure topology converges across all nodes
223
224 main.step( "Balance devices across controllers" )
225 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700226 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700227 time.sleep( 5 )
228
229 topology_output = main.ONOScli1.topology()
230 topology_result = main.ONOSbench.getTopology( topology_output )
231 case2Result = ( switch_mastership and startStatus )
232 utilities.assert_equals(
233 expect=main.TRUE,
234 actual=case2Result,
235 onpass="Starting new Att topology test PASS",
236 onfail="Starting new Att topology test FAIL" )
237
238 def CASE21( self, main ):
239 """
240 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
241 """
242 import re
243 import time
244 import copy
245
GlennRC3de72232015-12-16 10:48:35 -0800246 main.prefix = 1
GlennRC2db29952015-12-14 12:00:29 -0800247
Hari Krishnac195f3b2015-07-08 20:02:24 -0700248 main.newTopo = main.params['TOPO2']['topo']
249 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
250 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
251 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700252 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
GlennRCc6cd2a62015-08-10 16:08:22 -0700259 main.step("Start Mininet with Chordal topology")
260 mininetDir = main.Mininet1.home + "/custom/"
261 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
262 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
263 topoPath = mininetDir + main.newTopo
264 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265
266 main.step( "Assign switches to controllers" )
267
268 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
269 main.Mininet1.assignSwController(
270 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700271 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700272
273 switch_mastership = main.TRUE
274 for i in range( 1, ( main.numMNswitches + 1 ) ):
275 response = main.Mininet1.getSwController( "s" + str( i ) )
276 print( "Response is " + str( response ) )
277 if re.search( "tcp:" + main.onosIPs[0], response ):
278 switch_mastership = switch_mastership and main.TRUE
279 else:
280 switch_mastership = main.FALSE
281
282 if switch_mastership == main.TRUE:
283 main.log.report( "Controller assignment successfull" )
284 else:
285 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700286
Hari Krishnac195f3b2015-07-08 20:02:24 -0700287 main.step( "Balance devices across controllers" )
288 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700289 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290 time.sleep( 5 )
291
GlennRCbddd58f2015-10-01 15:45:25 -0700292 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293 time.sleep(30)
294 utilities.assert_equals(
295 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700296 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297 onpass="Starting new Chordal topology test PASS",
298 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700299
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300 def CASE22( self, main ):
301 """
302 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
303 """
304 import re
305 import time
306 import copy
307
GlennRC3de72232015-12-16 10:48:35 -0800308 main.prefix = 2
GlennRC2db29952015-12-14 12:00:29 -0800309
Hari Krishnac195f3b2015-07-08 20:02:24 -0700310 main.newTopo = main.params['TOPO3']['topo']
311 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
312 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
313 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
314 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700315
Hari Krishnac195f3b2015-07-08 20:02:24 -0700316 main.log.report(
317 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
318 main.log.report(
319 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800320 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700321
322 main.step("Start Mininet with Spine topology")
323 mininetDir = main.Mininet1.home + "/custom/"
324 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
325 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
326 topoPath = mininetDir + main.newTopo
327 startStatus = main.Mininet1.startNet(topoFile = topoPath)
328
Hari Krishnac195f3b2015-07-08 20:02:24 -0700329 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
330 main.Mininet1.assignSwController(
331 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700332 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700333
334 switch_mastership = main.TRUE
335 for i in range( 1, ( main.numMNswitches + 1 ) ):
336 response = main.Mininet1.getSwController( "s" + str( i ) )
337 print( "Response is " + str( response ) )
338 if re.search( "tcp:" + main.onosIPs[0], response ):
339 switch_mastership = switch_mastership and main.TRUE
340 else:
341 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700342
Hari Krishnac195f3b2015-07-08 20:02:24 -0700343 if switch_mastership == main.TRUE:
344 main.log.report( "Controller assignment successfull" )
345 else:
346 main.log.report( "Controller assignment failed" )
347 time.sleep( 5 )
348
349 main.step( "Balance devices across controllers" )
350 for i in range( int( main.numCtrls ) ):
351 balanceResult = main.ONOScli1.balanceMasters()
352 # giving some breathing time for ONOS to complete re-balance
353 time.sleep( 3 )
354
GlennRCbddd58f2015-10-01 15:45:25 -0700355 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700356 time.sleep(60)
357 utilities.assert_equals(
358 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700359 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700360 onpass="Starting new Spine topology test PASS",
361 onfail="Starting new Spine topology test FAIL" )
362
363 def CASE3( self, main ):
364 """
365 This Test case will be extended to collect and store more data related
366 ONOS state.
367 """
368 import re
369 import copy
370 main.deviceDPIDs = []
371 main.hostMACs = []
372 main.deviceLinks = []
373 main.deviceActiveLinksCount = []
374 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700375
Hari Krishnac195f3b2015-07-08 20:02:24 -0700376 main.log.report(
377 "Collect and Store topology details from ONOS before running any Tests" )
378 main.log.report(
379 "____________________________________________________________________" )
380 main.case( "Collect and Store Topology Details from ONOS" )
381 main.step( "Collect and store current number of switches and links" )
382 topology_output = main.ONOScli1.topology()
383 topology_result = main.ONOSbench.getTopology( topology_output )
384 numOnosDevices = topology_result[ 'devices' ]
385 numOnosLinks = topology_result[ 'links' ]
386 topoResult = main.TRUE
387
GlennRCee8f3bf2015-12-14 16:18:39 -0800388 for check in range(main.topoCheck):
389 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
390 main.step( "Store Device DPIDs" )
391 for i in range( 1, (main.numMNswitches+1) ):
GlennRC20fc6522015-12-23 23:26:57 -0800392 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800393 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700394
GlennRCee8f3bf2015-12-14 16:18:39 -0800395 main.step( "Store Host MACs" )
396 for i in range( 1, ( main.numMNhosts + 1 ) ):
397 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
398 print "Host MACs in Store: \n", str( main.hostMACs )
399 main.MACsDict = {}
400 print "Creating dictionary of DPID and HostMacs"
401 for i in range(len(main.hostMACs)):
402 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
403 print main.MACsDict
404 main.step( "Collect and store all Devices Links" )
405 linksResult = main.ONOScli1.links( jsonFormat=False )
406 ansi_escape = re.compile( r'\x1b[^m]*m' )
407 linksResult = ansi_escape.sub( '', linksResult )
408 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
409 linksResult = linksResult.splitlines()
410 main.deviceLinks = copy.copy( linksResult )
411 print "Device Links Stored: \n", str( main.deviceLinks )
412 # this will be asserted to check with the params provided count of
413 # links
414 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700415
GlennRCee8f3bf2015-12-14 16:18:39 -0800416 main.step( "Collect and store each Device ports enabled Count" )
417 time1 = time.time()
418 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
419 pool = []
420 for cli in main.CLIs:
421 if i >= main.numMNswitches + 1:
422 break
GlennRC20fc6522015-12-23 23:26:57 -0800423 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800424 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
425 t.start()
426 pool.append(t)
427 i = i + 1
428 main.threadID = main.threadID + 1
429 for thread in pool:
430 thread.join()
431 portResult = thread.result
432 main.devicePortsEnabledCount.append( portResult )
433 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
434 time2 = time.time()
435 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700436
GlennRCee8f3bf2015-12-14 16:18:39 -0800437 main.step( "Collect and store each Device active links Count" )
438 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700439
GlennRCee8f3bf2015-12-14 16:18:39 -0800440 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
441 pool = []
442 for cli in main.CLIs:
443 if i >= main.numMNswitches + 1:
444 break
GlennRC20fc6522015-12-23 23:26:57 -0800445 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800446 t = main.Thread( target = cli.getDeviceLinksActiveCount,
447 threadID = main.threadID,
448 name = "getDevicePortsEnabledCount",
449 args = [dpid])
450 t.start()
451 pool.append(t)
452 i = i + 1
453 main.threadID = main.threadID + 1
454 for thread in pool:
455 thread.join()
456 linkCountResult = thread.result
457 main.deviceActiveLinksCount.append( linkCountResult )
458 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
459 time2 = time.time()
460 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700461
GlennRCee8f3bf2015-12-14 16:18:39 -0800462 # Exit out of the topo check loop
463 break
464
465 else:
466 main.log.info("Devices (expected): %s, Links (expected): %s" %
467 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
468 main.log.info("Devices (actual): %s, Links (actual): %s" %
469 ( numOnosDevices , numOnosLinks ) )
470 main.log.info("Topology does not match, trying again...")
471 topoResult = main.FALSE
472 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700473
474 # just returning TRUE for now as this one just collects data
475 case3Result = topoResult
476 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
477 onpass="Saving ONOS topology data test PASS",
478 onfail="Saving ONOS topology data test FAIL" )
479
GlennRC186b7362015-12-11 18:20:16 -0800480
GlennRC20fc6522015-12-23 23:26:57 -0800481
482 def CASE200( self, main ):
483
484 import time
485 main.log.report( "Clean up ONOS" )
486 main.log.case( "Stop topology and remove hosts and devices" )
487
488 main.step( "Stop Topology" )
489 stopStatus = main.Mininet1.stopNet()
490 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
491 onpass="Stopped mininet",
492 onfail="Failed to stop mininet" )
493
494
495 main.log.info( "Constructing host id list" )
496 hosts = []
497 for i in range( main.numMNhosts ):
498 hosts.append( "h" + str(i+1) )
499
500 main.step( "Getting host ids" )
501 hostList = main.CLIs[0].getHostsId( hosts )
502 hostIdResult = True if hostList else False
503 utilities.assert_equals( expect=True, actual=hostIdResult,
504 onpass="Successfully obtained the host ids.",
505 onfail="Failed to obtain the host ids" )
506
507 main.step( "Removing hosts" )
508 hostResult = main.CLIs[0].removeHost( hostList )
509 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
510 onpass="Successfully removed hosts",
511 onfail="Failed remove hosts" )
512
513 time.sleep( main.remHostDelay )
514
515 main.log.info( "Constructing device uri list" )
516 deviceList = []
517 for i in range( main.numMNswitches ):
518 deviceList.append( "of:00000000000000" + format( i+1, "02x" ) )
519
520 main.step( "Removing devices" )
521 deviceResult = main.CLIs[0].removeDevice( deviceList )
522 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
523 onpass="Successfully removed devices",
524 onfail="Failed remove devices" )
525
526 time.sleep( main.remDevDelay )
527
528 main.log.info( "Summary\n{}".format( main.CLIs[0].summary( jsonFormat=False ) ) )
529
530
Hari Krishnac195f3b2015-07-08 20:02:24 -0700531 def CASE40( self, main ):
532 """
GlennRC15d164c2015-12-15 17:12:25 -0800533 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700534 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700535 import time
GlennRC15d164c2015-12-15 17:12:25 -0800536 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700537 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800538 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700539
GlennRC15d164c2015-12-15 17:12:25 -0800540 main.step( "Enable Reactive forwarding" )
541 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
542 utilities.assert_equals( expect=main.TRUE, actual=appResult,
543 onpass="Successfully install fwd app",
544 onfail="Failed to install fwd app" )
545
Hari Krishnac195f3b2015-07-08 20:02:24 -0700546
GlennRC6ac11b12015-10-21 17:41:28 -0700547 main.step( "Verify Ping across all hosts" )
548 for i in range(main.numPings):
549 time1 = time.time()
550 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
551 if not pingResult:
552 main.log.warn("First pingall failed. Retrying...")
553 time.sleep(main.pingSleep)
GlennRC15d164c2015-12-15 17:12:25 -0800554 else:
555 break
GlennRC6ac11b12015-10-21 17:41:28 -0700556
Hari Krishnac195f3b2015-07-08 20:02:24 -0700557 time2 = time.time()
558 timeDiff = round( ( time2 - time1 ), 2 )
559 main.log.report(
560 "Time taken for Ping All: " +
561 str( timeDiff ) +
562 " seconds" )
563
GlennRC3de72232015-12-16 10:48:35 -0800564 if not pingResult:
565 main.stop()
566
GlennRC15d164c2015-12-15 17:12:25 -0800567 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700568 onpass="Reactive Mode IPv4 Pingall test PASS",
569 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700570
GlennRC15d164c2015-12-15 17:12:25 -0800571 main.step( "Disable Reactive forwarding" )
572 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
573 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800574 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800575 onfail="Failed to deactivate fwd app" )
576
Hari Krishnac195f3b2015-07-08 20:02:24 -0700577 def CASE41( self, main ):
578 """
579 Verify Reactive forwarding (Chordal Topology)
580 """
581 import re
582 import copy
583 import time
584 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
585 main.log.report( "______________________________________________" )
586 main.case( "Enable Reactive forwarding and Verify ping all" )
587 main.step( "Enable Reactive forwarding" )
588 installResult = main.TRUE
589 # Activate fwd app
590 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
591
592 appCheck = main.TRUE
593 pool = []
594 for cli in main.CLIs:
595 t = main.Thread( target=cli.appToIDCheck,
596 name="appToIDCheck-" + str( i ),
597 args=[] )
598 pool.append( t )
599 t.start()
600 for t in pool:
601 t.join()
602 appCheck = appCheck and t.result
603 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
604 onpass="App Ids seem to be correct",
605 onfail="Something is wrong with app Ids" )
606 if appCheck != main.TRUE:
607 main.log.warn( main.CLIs[0].apps() )
608 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700609
Hari Krishnac195f3b2015-07-08 20:02:24 -0700610 time.sleep( 10 )
611
GlennRC6ac11b12015-10-21 17:41:28 -0700612 main.step( "Verify Ping across all hosts" )
613 for i in range(main.numPings):
614 time1 = time.time()
615 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
616 if not pingResult:
617 main.log.warn("First pingall failed. Retrying...")
618 time.sleep(main.pingSleep)
619 else: break
620
Hari Krishnac195f3b2015-07-08 20:02:24 -0700621 time2 = time.time()
622 timeDiff = round( ( time2 - time1 ), 2 )
623 main.log.report(
624 "Time taken for Ping All: " +
625 str( timeDiff ) +
626 " seconds" )
627
GlennRC626ba132015-09-18 16:16:31 -0700628 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700629 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700630 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700631 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700632
GlennRCbddd58f2015-10-01 15:45:25 -0700633 caseResult = appCheck and pingResult
634 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700635 onpass="Reactive Mode IPv4 Pingall test PASS",
636 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700637
638 def CASE42( self, main ):
639 """
640 Verify Reactive forwarding (Spine Topology)
641 """
642 import re
643 import copy
644 import time
645 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
646 main.log.report( "______________________________________________" )
647 main.case( "Enable Reactive forwarding and Verify ping all" )
648 main.step( "Enable Reactive forwarding" )
649 installResult = main.TRUE
650 # Activate fwd app
651 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
652
653 appCheck = main.TRUE
654 pool = []
655 for cli in main.CLIs:
656 t = main.Thread( target=cli.appToIDCheck,
657 name="appToIDCheck-" + str( i ),
658 args=[] )
659 pool.append( t )
660 t.start()
661 for t in pool:
662 t.join()
663 appCheck = appCheck and t.result
664 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
665 onpass="App Ids seem to be correct",
666 onfail="Something is wrong with app Ids" )
667 if appCheck != main.TRUE:
668 main.log.warn( main.CLIs[0].apps() )
669 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700670
Hari Krishnac195f3b2015-07-08 20:02:24 -0700671 time.sleep( 10 )
672
GlennRC6ac11b12015-10-21 17:41:28 -0700673 main.step( "Verify Ping across all hosts" )
674 for i in range(main.numPings):
675 time1 = time.time()
676 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
677 if not pingResult:
678 main.log.warn("First pingall failed. Retrying...")
679 time.sleep(main.pingSleep)
680 else: break
681
Hari Krishnac195f3b2015-07-08 20:02:24 -0700682 time2 = time.time()
683 timeDiff = round( ( time2 - time1 ), 2 )
684 main.log.report(
685 "Time taken for Ping All: " +
686 str( timeDiff ) +
687 " seconds" )
688
GlennRC626ba132015-09-18 16:16:31 -0700689 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700690 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700691 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700692 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
693
GlennRCbddd58f2015-10-01 15:45:25 -0700694 caseResult = appCheck and pingResult
695 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700696 onpass="Reactive Mode IPv4 Pingall test PASS",
697 onfail="Reactive Mode IPv4 Pingall test FAIL" )
698
699 def CASE140( self, main ):
700 """
701 Verify IPv6 Reactive forwarding (Att Topology)
702 """
703 import re
704 import copy
705 import time
706 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
707 main.log.report( "______________________________________________" )
708 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
709 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
710
711 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
712 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
713 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
714 cfgResult = cfgResult1 and cfgResult2
715 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
716 onpass="Reactive mode ipv6Fowarding cfg is set to true",
717 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
718
719 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700720 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700721 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700722 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
723 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700724 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700725 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700726 time2 = time.time()
727 timeDiff = round( ( time2 - time1 ), 2 )
728 main.log.report(
729 "Time taken for IPv6 Ping All: " +
730 str( timeDiff ) +
731 " seconds" )
732
GlennRC626ba132015-09-18 16:16:31 -0700733 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700734 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
735 else:
736 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700737
Jon Hall4ba53f02015-07-29 13:07:41 -0700738
GlennRC15d164c2015-12-15 17:12:25 -0800739 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700740 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700741 onpass="Reactive Mode IPv6 Pingall test PASS",
742 onfail="Reactive Mode IPv6 Pingall test FAIL" )
743
744 def CASE141( self, main ):
745 """
746 Verify IPv6 Reactive forwarding (Chordal Topology)
747 """
748 import re
749 import copy
750 import time
751 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
752 main.log.report( "______________________________________________" )
753 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
754 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
755
756 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
757 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
758 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
759 cfgResult = cfgResult1 and cfgResult2
760 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
761 onpass="Reactive mode ipv6Fowarding cfg is set to true",
762 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
763
764 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700765 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700766 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700767 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
768 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700769 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700770 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700771 time2 = time.time()
772 timeDiff = round( ( time2 - time1 ), 2 )
773 main.log.report(
774 "Time taken for IPv6 Ping All: " +
775 str( timeDiff ) +
776 " seconds" )
777
GlennRC626ba132015-09-18 16:16:31 -0700778 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700779 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
780 else:
781 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
782
783 main.step( "Disable Reactive forwarding" )
784
785 main.log.info( "Uninstall reactive forwarding app" )
786 appCheck = main.TRUE
787 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
788 pool = []
789 for cli in main.CLIs:
790 t = main.Thread( target=cli.appToIDCheck,
791 name="appToIDCheck-" + str( i ),
792 args=[] )
793 pool.append( t )
794 t.start()
795
796 for t in pool:
797 t.join()
798 appCheck = appCheck and t.result
799 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
800 onpass="App Ids seem to be correct",
801 onfail="Something is wrong with app Ids" )
802 if appCheck != main.TRUE:
803 main.log.warn( main.CLIs[0].apps() )
804 main.log.warn( main.CLIs[0].appIDs() )
805
806 # Waiting for reative flows to be cleared.
807 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700808 caseResult = appCheck and cfgResult and pingResult
809 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700810 onpass="Reactive Mode IPv6 Pingall test PASS",
811 onfail="Reactive Mode IPv6 Pingall test FAIL" )
812
813 def CASE142( self, main ):
814 """
815 Verify IPv6 Reactive forwarding (Spine Topology)
816 """
817 import re
818 import copy
819 import time
820 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
821 main.log.report( "______________________________________________" )
822 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
823 # Spine topology do not have hosts h1-h10
824 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
825 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
826 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
827 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
828 cfgResult = cfgResult1 and cfgResult2
829 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
830 onpass="Reactive mode ipv6Fowarding cfg is set to true",
831 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
832
833 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700834 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700835 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700836 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
837 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700838 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700839 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700840 time2 = time.time()
841 timeDiff = round( ( time2 - time1 ), 2 )
842 main.log.report(
843 "Time taken for IPv6 Ping All: " +
844 str( timeDiff ) +
845 " seconds" )
846
GlennRC626ba132015-09-18 16:16:31 -0700847 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700848 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
849 else:
850 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
851
852 main.step( "Disable Reactive forwarding" )
853
854 main.log.info( "Uninstall reactive forwarding app" )
855 appCheck = main.TRUE
856 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
857 pool = []
858 for cli in main.CLIs:
859 t = main.Thread( target=cli.appToIDCheck,
860 name="appToIDCheck-" + str( i ),
861 args=[] )
862 pool.append( t )
863 t.start()
864
865 for t in pool:
866 t.join()
867 appCheck = appCheck and t.result
868 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
869 onpass="App Ids seem to be correct",
870 onfail="Something is wrong with app Ids" )
871 if appCheck != main.TRUE:
872 main.log.warn( main.CLIs[0].apps() )
873 main.log.warn( main.CLIs[0].appIDs() )
874
875 # Waiting for reative flows to be cleared.
876 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700877 caseResult = appCheck and cfgResult and pingResult
878 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700879 onpass="Reactive Mode IPv6 Pingall test PASS",
880 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700881
882 def CASE5( self, main ):
883 """
884 Compare current ONOS topology with reference data
885 """
886 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700887
Hari Krishnac195f3b2015-07-08 20:02:24 -0700888 devicesDPIDTemp = []
889 hostMACsTemp = []
890 deviceLinksTemp = []
891 deviceActiveLinksCountTemp = []
892 devicePortsEnabledCountTemp = []
893
894 main.log.report(
895 "Compare ONOS topology with reference data in Stores" )
896 main.log.report( "__________________________________________________" )
897 main.case( "Compare ONOS topology with reference data" )
898
899 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700900
GlennRC289c1b62015-12-12 10:45:43 -0800901 for check in range(main.topoCheck):
902 time1 = time.time()
903 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
904 pool = []
905 for cli in main.CLIs:
906 if i >= main.numMNswitches + 1:
907 break
GlennRC20fc6522015-12-23 23:26:57 -0800908 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -0800909 t = main.Thread(target = cli.getDevicePortsEnabledCount,
910 threadID = main.threadID,
911 name = "getDevicePortsEnabledCount",
912 args = [dpid])
913 t.start()
914 pool.append(t)
915 i = i + 1
916 main.threadID = main.threadID + 1
917 for thread in pool:
918 thread.join()
919 portResult = thread.result
920 #portTemp = re.split( r'\t+', portResult )
921 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
922 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -0700923
GlennRC289c1b62015-12-12 10:45:43 -0800924 time2 = time.time()
925 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
926 main.log.info (
927 "Device Enabled ports EXPECTED: %s" %
928 str( main.devicePortsEnabledCount ) )
929 main.log.info (
930 "Device Enabled ports ACTUAL: %s" %
931 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700932
GlennRC289c1b62015-12-12 10:45:43 -0800933 if ( cmp( main.devicePortsEnabledCount,
934 devicePortsEnabledCountTemp ) == 0 ):
935 stepResult1 = main.TRUE
936 else:
937 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700938
GlennRC289c1b62015-12-12 10:45:43 -0800939 main.step( "Compare Device active links with reference" )
940 time1 = time.time()
941 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
942 pool = []
943 for cli in main.CLIs:
944 if i >= main.numMNswitches + 1:
945 break
GlennRC20fc6522015-12-23 23:26:57 -0800946 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -0800947 t = main.Thread(target = cli.getDeviceLinksActiveCount,
948 threadID = main.threadID,
949 name = "getDeviceLinksActiveCount",
950 args = [dpid])
951 t.start()
952 pool.append(t)
953 i = i + 1
954 main.threadID = main.threadID + 1
955 for thread in pool:
956 thread.join()
957 linkCountResult = thread.result
958 #linkCountTemp = re.split( r'\t+', linkCountResult )
959 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
960 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700961
GlennRC289c1b62015-12-12 10:45:43 -0800962 time2 = time.time()
963 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
964 main.log.info (
965 "Device Active links EXPECTED: %s" %
966 str( main.deviceActiveLinksCount ) )
967 main.log.info (
968 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
969 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
970 stepResult2 = main.TRUE
971 else:
972 stepResult2 = main.FALSE
973
974 """
975 place holder for comparing devices, hosts, paths and intents if required.
976 Links and ports data would be incorrect with out devices anyways.
977 """
978 caseResult = ( stepResult1 and stepResult2 )
979
980 if caseResult:
981 break
982 else:
983 time.sleep( main.topoCheckDelay )
984 main.log.warn( "Topology check failed. Trying again..." )
985
986
987 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700988 onpass="Compare Topology test PASS",
989 onfail="Compare Topology test FAIL" )
990
991 def CASE60( self ):
992 """
993 Install 300 host intents and verify ping all (Att Topology)
994 """
995 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
996 main.log.report( "_______________________________________" )
997 import itertools
998 import time
999 main.case( "Install 300 host intents" )
1000 main.step( "Add host Intents" )
1001 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001002 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1003
Hari Krishnac195f3b2015-07-08 20:02:24 -07001004 intentIdList = []
1005 time1 = time.time()
1006 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1007 pool = []
1008 for cli in main.CLIs:
1009 if i >= len( hostCombos ):
1010 break
1011 t = main.Thread( target=cli.addHostIntent,
1012 threadID=main.threadID,
1013 name="addHostIntent",
1014 args=[hostCombos[i][0],hostCombos[i][1]])
1015 pool.append(t)
1016 t.start()
1017 i = i + 1
1018 main.threadID = main.threadID + 1
1019 for thread in pool:
1020 thread.join()
1021 intentIdList.append(thread.result)
1022 time2 = time.time()
1023 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1024
GlennRCfcfdc4f2015-09-30 16:01:57 -07001025 # Saving intent ids to check intents in later cases
1026 main.intentIds = list(intentIdList)
1027
GlennRCa8d786a2015-09-23 17:40:11 -07001028 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001029
GlennRC1dde1712015-10-02 11:03:08 -07001030 # Giving onos multiple chances to install intents
1031 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001032 if i != 0:
1033 main.log.warn( "Verification failed. Retrying..." )
1034 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001035 time.sleep( main.checkIntentsDelay )
1036
1037 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001038 for e in range(int(main.numCtrls)):
1039 main.log.info( "Checking intents on CLI %s" % (e+1) )
1040 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1041 intentState
1042 if not intentState:
1043 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001044 if intentState:
1045 break
GlennRCdb2c8422015-09-29 12:21:59 -07001046 else:
1047 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001048 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001049
GlennRCa8d786a2015-09-23 17:40:11 -07001050
1051 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1052 onpass="INTENTS INSTALLED",
1053 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001054
1055 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001056 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001057 time1 = time.time()
1058 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001059 if not pingResult:
1060 main.log.warn("First pingall failed. Retrying...")
1061 time.sleep(3)
1062 else: break
1063
Hari Krishnac195f3b2015-07-08 20:02:24 -07001064 time2 = time.time()
1065 timeDiff = round( ( time2 - time1 ), 2 )
1066 main.log.report(
1067 "Time taken for Ping All: " +
1068 str( timeDiff ) +
1069 " seconds" )
1070 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1071 onpass="PING ALL PASS",
1072 onfail="PING ALL FAIL" )
1073
GlennRCbddd58f2015-10-01 15:45:25 -07001074 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001075 utilities.assert_equals(
1076 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001077 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001078 onpass="Install 300 Host Intents and Ping All test PASS",
1079 onfail="Install 300 Host Intents and Ping All test FAIL" )
1080
GlennRCfcfdc4f2015-09-30 16:01:57 -07001081 if not intentState:
1082 main.log.debug( "Intents failed to install completely" )
1083 if not pingResult:
1084 main.log.debug( "Pingall failed" )
1085
GlennRCbddd58f2015-10-01 15:45:25 -07001086 if not caseResult and main.failSwitch:
1087 main.log.report("Stopping test")
1088 main.stop( email=main.emailOnStop )
1089
Hari Krishnac195f3b2015-07-08 20:02:24 -07001090 def CASE61( self ):
1091 """
1092 Install 600 host intents and verify ping all for Chordal Topology
1093 """
1094 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1095 main.log.report( "_______________________________________" )
1096 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001097
Hari Krishnac195f3b2015-07-08 20:02:24 -07001098 main.case( "Install 600 host intents" )
1099 main.step( "Add host Intents" )
1100 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001101 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1102
Hari Krishnac195f3b2015-07-08 20:02:24 -07001103 intentIdList = []
1104 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001105
Hari Krishnac195f3b2015-07-08 20:02:24 -07001106 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1107 pool = []
1108 for cli in main.CLIs:
1109 if i >= len( hostCombos ):
1110 break
1111 t = main.Thread( target=cli.addHostIntent,
1112 threadID=main.threadID,
1113 name="addHostIntent",
1114 args=[hostCombos[i][0],hostCombos[i][1]])
1115 pool.append(t)
1116 t.start()
1117 i = i + 1
1118 main.threadID = main.threadID + 1
1119 for thread in pool:
1120 thread.join()
1121 intentIdList.append(thread.result)
1122 time2 = time.time()
1123 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001124
GlennRCfcfdc4f2015-09-30 16:01:57 -07001125 # Saving intent ids to check intents in later cases
1126 main.intentIds = list(intentIdList)
1127
GlennRCa8d786a2015-09-23 17:40:11 -07001128 main.step("Verify intents are installed")
1129
GlennRC1dde1712015-10-02 11:03:08 -07001130 # Giving onos multiple chances to install intents
1131 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001132 if i != 0:
1133 main.log.warn( "Verification failed. Retrying..." )
1134 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001135 time.sleep( main.checkIntentsDelay )
1136
1137 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001138 for e in range(int(main.numCtrls)):
1139 main.log.info( "Checking intents on CLI %s" % (e+1) )
1140 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1141 intentState
1142 if not intentState:
1143 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001144 if intentState:
1145 break
GlennRCdb2c8422015-09-29 12:21:59 -07001146 else:
1147 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001148 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001149
1150 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1151 onpass="INTENTS INSTALLED",
1152 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001153
1154 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001155 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001156 time1 = time.time()
1157 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001158 if not pingResult:
1159 main.log.warn("First pingall failed. Retrying...")
1160 time.sleep(main.pingSleep)
1161 else: break
1162
Hari Krishnac195f3b2015-07-08 20:02:24 -07001163 time2 = time.time()
1164 timeDiff = round( ( time2 - time1 ), 2 )
1165 main.log.report(
1166 "Time taken for Ping All: " +
1167 str( timeDiff ) +
1168 " seconds" )
1169 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1170 onpass="PING ALL PASS",
1171 onfail="PING ALL FAIL" )
1172
GlennRCbddd58f2015-10-01 15:45:25 -07001173 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001174
Hari Krishnac195f3b2015-07-08 20:02:24 -07001175 utilities.assert_equals(
1176 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001177 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001178 onpass="Install 300 Host Intents and Ping All test PASS",
1179 onfail="Install 300 Host Intents and Ping All test FAIL" )
1180
GlennRCfcfdc4f2015-09-30 16:01:57 -07001181 if not intentState:
1182 main.log.debug( "Intents failed to install completely" )
1183 if not pingResult:
1184 main.log.debug( "Pingall failed" )
1185
GlennRCbddd58f2015-10-01 15:45:25 -07001186 if not caseResult and main.failSwitch:
1187 main.log.report("Stopping test")
1188 main.stop( email=main.emailOnStop )
1189
Hari Krishnac195f3b2015-07-08 20:02:24 -07001190 def CASE62( self ):
1191 """
1192 Install 2278 host intents and verify ping all for Spine Topology
1193 """
1194 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1195 main.log.report( "_______________________________________" )
1196 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001197
Hari Krishnac195f3b2015-07-08 20:02:24 -07001198 main.case( "Install 2278 host intents" )
1199 main.step( "Add host Intents" )
1200 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001201 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001202 main.pingTimeout = 300
1203 intentIdList = []
1204 time1 = time.time()
1205 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1206 pool = []
1207 for cli in main.CLIs:
1208 if i >= len( hostCombos ):
1209 break
1210 t = main.Thread( target=cli.addHostIntent,
1211 threadID=main.threadID,
1212 name="addHostIntent",
1213 args=[hostCombos[i][0],hostCombos[i][1]])
1214 pool.append(t)
1215 t.start()
1216 i = i + 1
1217 main.threadID = main.threadID + 1
1218 for thread in pool:
1219 thread.join()
1220 intentIdList.append(thread.result)
1221 time2 = time.time()
1222 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001223
GlennRCfcfdc4f2015-09-30 16:01:57 -07001224 # Saving intent ids to check intents in later cases
1225 main.intentIds = list(intentIdList)
1226
GlennRCa8d786a2015-09-23 17:40:11 -07001227 main.step("Verify intents are installed")
1228
GlennRC1dde1712015-10-02 11:03:08 -07001229 # Giving onos multiple chances to install intents
1230 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001231 if i != 0:
1232 main.log.warn( "Verification failed. Retrying..." )
1233 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001234 time.sleep( main.checkIntentsDelay )
1235
1236 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001237 for e in range(int(main.numCtrls)):
1238 main.log.info( "Checking intents on CLI %s" % (e+1) )
1239 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1240 intentState
1241 if not intentState:
1242 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001243 if intentState:
1244 break
GlennRCdb2c8422015-09-29 12:21:59 -07001245 else:
1246 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001247 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001248
1249 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1250 onpass="INTENTS INSTALLED",
1251 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001252
1253 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001254 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001255 time1 = time.time()
1256 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001257 if not pingResult:
1258 main.log.warn("First pingall failed. Retrying...")
1259 time.sleep(main.pingSleep)
1260 else: break
1261
Hari Krishnac195f3b2015-07-08 20:02:24 -07001262 time2 = time.time()
1263 timeDiff = round( ( time2 - time1 ), 2 )
1264 main.log.report(
1265 "Time taken for Ping All: " +
1266 str( timeDiff ) +
1267 " seconds" )
1268 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1269 onpass="PING ALL PASS",
1270 onfail="PING ALL FAIL" )
1271
GlennRCbddd58f2015-10-01 15:45:25 -07001272 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001273
Hari Krishnac195f3b2015-07-08 20:02:24 -07001274 utilities.assert_equals(
1275 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001276 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001277 onpass="Install 2278 Host Intents and Ping All test PASS",
1278 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1279
GlennRCfcfdc4f2015-09-30 16:01:57 -07001280 if not intentState:
1281 main.log.debug( "Intents failed to install completely" )
1282 if not pingResult:
1283 main.log.debug( "Pingall failed" )
1284
GlennRCbddd58f2015-10-01 15:45:25 -07001285 if not caseResult and main.failSwitch:
1286 main.log.report("Stopping test")
1287 main.stop( email=main.emailOnStop )
1288
Hari Krishna4223dbd2015-08-13 16:29:53 -07001289 def CASE160( self ):
1290 """
1291 Verify IPv6 ping across 300 host intents (Att Topology)
1292 """
1293 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1294 main.log.report( "_________________________________________________" )
1295 import itertools
1296 import time
1297 main.case( "IPv6 ping all 300 host intents" )
1298 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001299 pingResult = main.FALSE
1300 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001301 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001302 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001303 main.log.warn("First pingall failed. Retrying...")
1304 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001305 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001306 time2 = time.time()
1307 timeDiff = round( ( time2 - time1 ), 2 )
1308 main.log.report(
1309 "Time taken for IPv6 Ping All: " +
1310 str( timeDiff ) +
1311 " seconds" )
1312 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1313 onpass="PING ALL PASS",
1314 onfail="PING ALL FAIL" )
1315
GlennRCbddd58f2015-10-01 15:45:25 -07001316 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001317 utilities.assert_equals(
1318 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001319 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001320 onpass="IPv6 Ping across 300 host intents test PASS",
1321 onfail="IPv6 Ping across 300 host intents test FAIL" )
1322
1323 def CASE161( self ):
1324 """
1325 Verify IPv6 ping across 600 host intents (Chordal Topology)
1326 """
1327 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1328 main.log.report( "_________________________________________________" )
1329 import itertools
1330 import time
1331 main.case( "IPv6 ping all 600 host intents" )
1332 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001333 pingResult = main.FALSE
1334 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001335 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001336 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001337 main.log.warn("First pingall failed. Retrying...")
1338 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001339 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001340 time2 = time.time()
1341 timeDiff = round( ( time2 - time1 ), 2 )
1342 main.log.report(
1343 "Time taken for IPv6 Ping All: " +
1344 str( timeDiff ) +
1345 " seconds" )
1346 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1347 onpass="PING ALL PASS",
1348 onfail="PING ALL FAIL" )
1349
GlennRCbddd58f2015-10-01 15:45:25 -07001350 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001351 utilities.assert_equals(
1352 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001353 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001354 onpass="IPv6 Ping across 600 host intents test PASS",
1355 onfail="IPv6 Ping across 600 host intents test FAIL" )
1356
1357 def CASE162( self ):
1358 """
1359 Verify IPv6 ping across 2278 host intents (Spine Topology)
1360 """
1361 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1362 main.log.report( "_________________________________________________" )
1363 import itertools
1364 import time
1365 main.case( "IPv6 ping all 600 host intents" )
1366 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001367 pingResult = main.FALSE
1368 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001369 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001370 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001371 main.log.warn("First pingall failed. Retrying...")
1372 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001373 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001374 time2 = time.time()
1375 timeDiff = round( ( time2 - time1 ), 2 )
1376 main.log.report(
1377 "Time taken for IPv6 Ping All: " +
1378 str( timeDiff ) +
1379 " seconds" )
1380 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1381 onpass="PING ALL PASS",
1382 onfail="PING ALL FAIL" )
1383
GlennRCbddd58f2015-10-01 15:45:25 -07001384 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001385 utilities.assert_equals(
1386 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001387 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001388 onpass="IPv6 Ping across 600 host intents test PASS",
1389 onfail="IPv6 Ping across 600 host intents test FAIL" )
1390
Hari Krishnac195f3b2015-07-08 20:02:24 -07001391 def CASE70( self, main ):
1392 """
1393 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1394 """
1395 import random
1396 main.randomLink1 = []
1397 main.randomLink2 = []
1398 main.randomLink3 = []
1399 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1400 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1401 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1402 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1403 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1404 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1405 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1406 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1407
1408 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1409 main.log.report( "___________________________________________________________________________" )
1410 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1411 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1412 if ( int( switchLinksToToggle ) ==
1413 0 or int( switchLinksToToggle ) > 5 ):
1414 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1415 #main.cleanup()
1416 #main.exit()
1417 else:
1418 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1419
1420 main.step( "Cut links on Core devices using user provided range" )
1421 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1422 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1423 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1424 for i in range( int( switchLinksToToggle ) ):
1425 main.Mininet1.link(
1426 END1=link1End1,
1427 END2=main.randomLink1[ i ],
1428 OPTION="down" )
1429 time.sleep( link_sleep )
1430 main.Mininet1.link(
1431 END1=link2End1,
1432 END2=main.randomLink2[ i ],
1433 OPTION="down" )
1434 time.sleep( link_sleep )
1435 main.Mininet1.link(
1436 END1=link3End1,
1437 END2=main.randomLink3[ i ],
1438 OPTION="down" )
1439 time.sleep( link_sleep )
1440
Hari Krishna6185fc12015-07-13 15:42:31 -07001441 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001442 linkDown = main.ONOSbench.checkStatus(
1443 topology_output, main.numMNswitches, str(
1444 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1445 utilities.assert_equals(
1446 expect=main.TRUE,
1447 actual=linkDown,
1448 onpass="Link Down discovered properly",
1449 onfail="Link down was not discovered in " +
1450 str( link_sleep ) +
1451 " seconds" )
1452
GlennRCfcfdc4f2015-09-30 16:01:57 -07001453 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001454 # Giving onos multiple chances to install intents
1455 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001456 if i != 0:
1457 main.log.warn( "Verification failed. Retrying..." )
1458 main.log.info("Giving onos some time...")
1459 time.sleep( main.checkIntentsDelay )
1460
1461 intentState = main.TRUE
1462 for e in range(int(main.numCtrls)):
1463 main.log.info( "Checking intents on CLI %s" % (e+1) )
1464 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1465 intentState
1466 if not intentState:
1467 main.log.warn( "Not all intents installed" )
1468 if intentState:
1469 break
1470 else:
1471 #Dumping intent summary
1472 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1473
1474
1475 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1476 onpass="INTENTS INSTALLED",
1477 onfail="SOME INTENTS NOT INSTALLED" )
1478
Hari Krishnac195f3b2015-07-08 20:02:24 -07001479 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001480 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001481 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001482 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1483 if not pingResult:
1484 main.log.warn("First pingall failed. Retrying...")
1485 time.sleep(main.pingSleep)
1486 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001487
Hari Krishnac195f3b2015-07-08 20:02:24 -07001488 time2 = time.time()
1489 timeDiff = round( ( time2 - time1 ), 2 )
1490 main.log.report(
1491 "Time taken for Ping All: " +
1492 str( timeDiff ) +
1493 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001494 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001495 onpass="PING ALL PASS",
1496 onfail="PING ALL FAIL" )
1497
GlennRCbddd58f2015-10-01 15:45:25 -07001498 caseResult = linkDown and pingResult and intentState
1499 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001500 onpass="Random Link cut Test PASS",
1501 onfail="Random Link cut Test FAIL" )
1502
GlennRCfcfdc4f2015-09-30 16:01:57 -07001503 # Printing what exactly failed
1504 if not linkDown:
1505 main.log.debug( "Link down was not discovered correctly" )
1506 if not pingResult:
1507 main.log.debug( "Pingall failed" )
1508 if not intentState:
1509 main.log.debug( "Intents are not all installed" )
1510
GlennRCbddd58f2015-10-01 15:45:25 -07001511 if not caseResult and main.failSwitch:
1512 main.log.report("Stopping test")
1513 main.stop( email=main.emailOnStop )
1514
Hari Krishnac195f3b2015-07-08 20:02:24 -07001515 def CASE80( self, main ):
1516 """
1517 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1518 """
1519 import random
1520 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1521 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1522 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1523 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1524 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1525
1526 main.log.report(
1527 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1528 main.log.report(
1529 "__________________________________________________________________" )
1530 main.case(
1531 "Host intents - Bring the core links up that are down and verify ping all" )
1532 main.step( "Bring randomly cut links on Core devices up" )
1533 for i in range( int( switchLinksToToggle ) ):
1534 main.Mininet1.link(
1535 END1=link1End1,
1536 END2=main.randomLink1[ i ],
1537 OPTION="up" )
1538 time.sleep( link_sleep )
1539 main.Mininet1.link(
1540 END1=link2End1,
1541 END2=main.randomLink2[ i ],
1542 OPTION="up" )
1543 time.sleep( link_sleep )
1544 main.Mininet1.link(
1545 END1=link3End1,
1546 END2=main.randomLink3[ i ],
1547 OPTION="up" )
1548 time.sleep( link_sleep )
1549
Hari Krishna6185fc12015-07-13 15:42:31 -07001550 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001551 linkUp = main.ONOSbench.checkStatus(
1552 topology_output,
1553 main.numMNswitches,
1554 str( main.numMNlinks ) )
1555 utilities.assert_equals(
1556 expect=main.TRUE,
1557 actual=linkUp,
1558 onpass="Link up discovered properly",
1559 onfail="Link up was not discovered in " +
1560 str( link_sleep ) +
1561 " seconds" )
1562
GlennRCfcfdc4f2015-09-30 16:01:57 -07001563 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001564 # Giving onos multiple chances to install intents
1565 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001566 if i != 0:
1567 main.log.warn( "Verification failed. Retrying..." )
1568 main.log.info("Giving onos some time...")
1569 time.sleep( main.checkIntentsDelay )
1570
1571 intentState = main.TRUE
1572 for e in range(int(main.numCtrls)):
1573 main.log.info( "Checking intents on CLI %s" % (e+1) )
1574 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1575 intentState
1576 if not intentState:
1577 main.log.warn( "Not all intents installed" )
1578 if intentState:
1579 break
1580 else:
1581 #Dumping intent summary
1582 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1583
1584
1585 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1586 onpass="INTENTS INSTALLED",
1587 onfail="SOME INTENTS NOT INSTALLED" )
1588
Hari Krishnac195f3b2015-07-08 20:02:24 -07001589 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001590 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001591 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001592 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1593 if not pingResult:
1594 main.log.warn("First pingall failed. Retrying...")
1595 time.sleep(main.pingSleep)
1596 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001597
Hari Krishnac195f3b2015-07-08 20:02:24 -07001598 time2 = time.time()
1599 timeDiff = round( ( time2 - time1 ), 2 )
1600 main.log.report(
1601 "Time taken for Ping All: " +
1602 str( timeDiff ) +
1603 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001604 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001605 onpass="PING ALL PASS",
1606 onfail="PING ALL FAIL" )
1607
GlennRCbddd58f2015-10-01 15:45:25 -07001608 caseResult = linkUp and pingResult
1609 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001610 onpass="Link Up Test PASS",
1611 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001612 # Printing what exactly failed
1613 if not linkUp:
1614 main.log.debug( "Link down was not discovered correctly" )
1615 if not pingResult:
1616 main.log.debug( "Pingall failed" )
1617 if not intentState:
1618 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001619
GlennRCbddd58f2015-10-01 15:45:25 -07001620 if not caseResult and main.failSwitch:
1621 main.log.report("Stopping test")
1622 main.stop( email=main.emailOnStop )
1623
Hari Krishnac195f3b2015-07-08 20:02:24 -07001624 def CASE71( self, main ):
1625 """
1626 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1627 """
1628 import random
1629 main.randomLink1 = []
1630 main.randomLink2 = []
1631 main.randomLink3 = []
1632 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1633 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1634 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1635 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1636 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1637 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1638 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1639 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1640
1641 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1642 main.log.report( "___________________________________________________________________________" )
1643 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1644 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1645 if ( int( switchLinksToToggle ) ==
1646 0 or int( switchLinksToToggle ) > 5 ):
1647 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1648 #main.cleanup()
1649 #main.exit()
1650 else:
1651 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1652
1653 main.step( "Cut links on Core devices using user provided range" )
1654 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1655 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1656 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1657 for i in range( int( switchLinksToToggle ) ):
1658 main.Mininet1.link(
1659 END1=link1End1,
1660 END2=main.randomLink1[ i ],
1661 OPTION="down" )
1662 time.sleep( link_sleep )
1663 main.Mininet1.link(
1664 END1=link2End1,
1665 END2=main.randomLink2[ i ],
1666 OPTION="down" )
1667 time.sleep( link_sleep )
1668 main.Mininet1.link(
1669 END1=link3End1,
1670 END2=main.randomLink3[ i ],
1671 OPTION="down" )
1672 time.sleep( link_sleep )
1673
Hari Krishna6185fc12015-07-13 15:42:31 -07001674 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001675 linkDown = main.ONOSbench.checkStatus(
1676 topology_output, main.numMNswitches, str(
1677 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1678 utilities.assert_equals(
1679 expect=main.TRUE,
1680 actual=linkDown,
1681 onpass="Link Down discovered properly",
1682 onfail="Link down was not discovered in " +
1683 str( link_sleep ) +
1684 " seconds" )
1685
GlennRCfcfdc4f2015-09-30 16:01:57 -07001686 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001687 # Giving onos multiple chances to install intents
1688 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001689 if i != 0:
1690 main.log.warn( "Verification failed. Retrying..." )
1691 main.log.info("Giving onos some time...")
1692 time.sleep( main.checkIntentsDelay )
1693
1694 intentState = main.TRUE
1695 for e in range(int(main.numCtrls)):
1696 main.log.info( "Checking intents on CLI %s" % (e+1) )
1697 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1698 intentState
1699 if not intentState:
1700 main.log.warn( "Not all intents installed" )
1701 if intentState:
1702 break
1703 else:
1704 #Dumping intent summary
1705 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1706
1707
1708 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1709 onpass="INTENTS INSTALLED",
1710 onfail="SOME INTENTS NOT INSTALLED" )
1711
Hari Krishnac195f3b2015-07-08 20:02:24 -07001712 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001713 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001714 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001715 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1716 if not pingResult:
1717 main.log.warn("First pingall failed. Retrying...")
1718 time.sleep(main.pingSleep)
1719 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001720
Hari Krishnac195f3b2015-07-08 20:02:24 -07001721 time2 = time.time()
1722 timeDiff = round( ( time2 - time1 ), 2 )
1723 main.log.report(
1724 "Time taken for Ping All: " +
1725 str( timeDiff ) +
1726 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001727 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001728 onpass="PING ALL PASS",
1729 onfail="PING ALL FAIL" )
1730
GlennRCbddd58f2015-10-01 15:45:25 -07001731 caseResult = linkDown and pingResult and intentState
1732 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001733 onpass="Random Link cut Test PASS",
1734 onfail="Random Link cut Test FAIL" )
1735
GlennRCfcfdc4f2015-09-30 16:01:57 -07001736 # Printing what exactly failed
1737 if not linkDown:
1738 main.log.debug( "Link down was not discovered correctly" )
1739 if not pingResult:
1740 main.log.debug( "Pingall failed" )
1741 if not intentState:
1742 main.log.debug( "Intents are not all installed" )
1743
GlennRCbddd58f2015-10-01 15:45:25 -07001744 if not caseResult and main.failSwitch:
1745 main.log.report("Stopping test")
1746 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001747
Hari Krishnac195f3b2015-07-08 20:02:24 -07001748 def CASE81( self, main ):
1749 """
1750 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1751 """
1752 import random
1753 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1754 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1755 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1756 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1757 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1758
1759 main.log.report(
1760 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1761 main.log.report(
1762 "__________________________________________________________________" )
1763 main.case(
1764 "Point intents - Bring the core links up that are down and verify ping all" )
1765 main.step( "Bring randomly cut links on Core devices up" )
1766 for i in range( int( switchLinksToToggle ) ):
1767 main.Mininet1.link(
1768 END1=link1End1,
1769 END2=main.randomLink1[ i ],
1770 OPTION="up" )
1771 time.sleep( link_sleep )
1772 main.Mininet1.link(
1773 END1=link2End1,
1774 END2=main.randomLink2[ i ],
1775 OPTION="up" )
1776 time.sleep( link_sleep )
1777 main.Mininet1.link(
1778 END1=link3End1,
1779 END2=main.randomLink3[ i ],
1780 OPTION="up" )
1781 time.sleep( link_sleep )
1782
Hari Krishna6185fc12015-07-13 15:42:31 -07001783 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001784 linkUp = main.ONOSbench.checkStatus(
1785 topology_output,
1786 main.numMNswitches,
1787 str( main.numMNlinks ) )
1788 utilities.assert_equals(
1789 expect=main.TRUE,
1790 actual=linkUp,
1791 onpass="Link up discovered properly",
1792 onfail="Link up was not discovered in " +
1793 str( link_sleep ) +
1794 " seconds" )
1795
GlennRCfcfdc4f2015-09-30 16:01:57 -07001796 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001797 # Giving onos multiple chances to install intents
1798 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001799 if i != 0:
1800 main.log.warn( "Verification failed. Retrying..." )
1801 main.log.info("Giving onos some time...")
1802 time.sleep( main.checkIntentsDelay )
1803
1804 intentState = main.TRUE
1805 for e in range(int(main.numCtrls)):
1806 main.log.info( "Checking intents on CLI %s" % (e+1) )
1807 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1808 intentState
1809 if not intentState:
1810 main.log.warn( "Not all intents installed" )
1811 if intentState:
1812 break
1813 else:
1814 #Dumping intent summary
1815 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1816
1817
1818 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1819 onpass="INTENTS INSTALLED",
1820 onfail="SOME INTENTS NOT INSTALLED" )
1821
Hari Krishnac195f3b2015-07-08 20:02:24 -07001822 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001823 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001824 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001825 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1826 if not pingResult:
1827 main.log.warn("First pingall failed. Retrying...")
1828 time.sleep(main.pingSleep)
1829 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001830
Hari Krishnac195f3b2015-07-08 20:02:24 -07001831 time2 = time.time()
1832 timeDiff = round( ( time2 - time1 ), 2 )
1833 main.log.report(
1834 "Time taken for Ping All: " +
1835 str( timeDiff ) +
1836 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001837 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001838 onpass="PING ALL PASS",
1839 onfail="PING ALL FAIL" )
1840
GlennRCbddd58f2015-10-01 15:45:25 -07001841 caseResult = linkUp and pingResult
1842 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001843 onpass="Link Up Test PASS",
1844 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001845 # Printing what exactly failed
1846 if not linkUp:
1847 main.log.debug( "Link down was not discovered correctly" )
1848 if not pingResult:
1849 main.log.debug( "Pingall failed" )
1850 if not intentState:
1851 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001852
GlennRCbddd58f2015-10-01 15:45:25 -07001853 if not caseResult and main.failSwitch:
1854 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001855 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001856
Hari Krishnac195f3b2015-07-08 20:02:24 -07001857 def CASE72( self, main ):
1858 """
1859 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1860 """
1861 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001862 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001863 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001864
Hari Krishnac195f3b2015-07-08 20:02:24 -07001865 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1866 main.log.report( "___________________________________________________________________________" )
1867 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1868 switches = []
1869 switchesComb = []
1870 for i in range( main.numMNswitches ):
1871 switches.append('s%d'%(i+1))
1872 switchesLinksComb = list(itertools.combinations(switches,2))
1873 main.randomLinks = random.sample(switchesLinksComb, 5 )
1874 print main.randomLinks
1875 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001876
Hari Krishnac195f3b2015-07-08 20:02:24 -07001877 for switch in main.randomLinks:
1878 main.Mininet1.link(
1879 END1=switch[0],
1880 END2=switch[1],
1881 OPTION="down")
1882 time.sleep( link_sleep )
1883
Hari Krishna6185fc12015-07-13 15:42:31 -07001884 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001885 linkDown = main.ONOSbench.checkStatus(
1886 topology_output, main.numMNswitches, str(
1887 int( main.numMNlinks ) - 5 * 2 ) )
1888 utilities.assert_equals(
1889 expect=main.TRUE,
1890 actual=linkDown,
1891 onpass="Link Down discovered properly",
1892 onfail="Link down was not discovered in " +
1893 str( link_sleep ) +
1894 " seconds" )
1895
GlennRCfcfdc4f2015-09-30 16:01:57 -07001896 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001897 # Giving onos multiple chances to install intents
1898 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001899 if i != 0:
1900 main.log.warn( "Verification failed. Retrying..." )
1901 main.log.info("Giving onos some time...")
1902 time.sleep( main.checkIntentsDelay )
1903
1904 intentState = main.TRUE
1905 for e in range(int(main.numCtrls)):
1906 main.log.info( "Checking intents on CLI %s" % (e+1) )
1907 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1908 intentState
1909 if not intentState:
1910 main.log.warn( "Not all intents installed" )
1911 if intentState:
1912 break
1913 else:
1914 #Dumping intent summary
1915 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1916
1917
1918 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1919 onpass="INTENTS INSTALLED",
1920 onfail="SOME INTENTS NOT INSTALLED" )
1921
Hari Krishnac195f3b2015-07-08 20:02:24 -07001922 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001923 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001924 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001925 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1926 if not pingResult:
1927 main.log.warn("First pingall failed. Retrying...")
1928 time.sleep(main.pingSleep)
1929 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001930
Hari Krishnac195f3b2015-07-08 20:02:24 -07001931 time2 = time.time()
1932 timeDiff = round( ( time2 - time1 ), 2 )
1933 main.log.report(
1934 "Time taken for Ping All: " +
1935 str( timeDiff ) +
1936 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001937 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001938 onpass="PING ALL PASS",
1939 onfail="PING ALL FAIL" )
1940
GlennRCbddd58f2015-10-01 15:45:25 -07001941 caseResult = linkDown and pingResult and intentState
1942 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001943 onpass="Random Link cut Test PASS",
1944 onfail="Random Link cut Test FAIL" )
1945
GlennRCfcfdc4f2015-09-30 16:01:57 -07001946 # Printing what exactly failed
1947 if not linkDown:
1948 main.log.debug( "Link down was not discovered correctly" )
1949 if not pingResult:
1950 main.log.debug( "Pingall failed" )
1951 if not intentState:
1952 main.log.debug( "Intents are not all installed" )
1953
GlennRCbddd58f2015-10-01 15:45:25 -07001954 if not caseResult and main.failSwitch:
1955 main.log.report("Stopping test")
1956 main.stop( email=main.emailOnStop )
1957
Hari Krishnac195f3b2015-07-08 20:02:24 -07001958 def CASE82( self, main ):
1959 """
1960 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1961 """
1962 import random
1963 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001964
Hari Krishnac195f3b2015-07-08 20:02:24 -07001965 main.log.report(
1966 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1967 main.log.report(
1968 "__________________________________________________________________" )
1969 main.case(
1970 "Host intents - Bring the core links up that are down and verify ping all" )
1971 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001972
Hari Krishnac195f3b2015-07-08 20:02:24 -07001973 for switch in main.randomLinks:
1974 main.Mininet1.link(
1975 END1=switch[0],
1976 END2=switch[1],
1977 OPTION="up")
1978 time.sleep( link_sleep )
1979
Hari Krishna6185fc12015-07-13 15:42:31 -07001980 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001981 linkUp = main.ONOSbench.checkStatus(
1982 topology_output,
1983 main.numMNswitches,
1984 str( main.numMNlinks ) )
1985 utilities.assert_equals(
1986 expect=main.TRUE,
1987 actual=linkUp,
1988 onpass="Link up discovered properly",
1989 onfail="Link up was not discovered in " +
1990 str( link_sleep ) +
1991 " seconds" )
1992
GlennRCfcfdc4f2015-09-30 16:01:57 -07001993 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001994 # Giving onos multiple chances to install intents
1995 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001996 if i != 0:
1997 main.log.warn( "Verification failed. Retrying..." )
1998 main.log.info("Giving onos some time...")
1999 time.sleep( main.checkIntentsDelay )
2000
2001 intentState = main.TRUE
2002 for e in range(int(main.numCtrls)):
2003 main.log.info( "Checking intents on CLI %s" % (e+1) )
2004 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2005 intentState
2006 if not intentState:
2007 main.log.warn( "Not all intents installed" )
2008 if intentState:
2009 break
2010 else:
2011 #Dumping intent summary
2012 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2013
2014
2015 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2016 onpass="INTENTS INSTALLED",
2017 onfail="SOME INTENTS NOT INSTALLED" )
2018
Hari Krishnac195f3b2015-07-08 20:02:24 -07002019 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002020 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002021 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002022 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2023 if not pingResult:
2024 main.log.warn("First pingall failed. Retrying...")
2025 time.sleep(main.pingSleep)
2026 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002027
Hari Krishnac195f3b2015-07-08 20:02:24 -07002028 time2 = time.time()
2029 timeDiff = round( ( time2 - time1 ), 2 )
2030 main.log.report(
2031 "Time taken for Ping All: " +
2032 str( timeDiff ) +
2033 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002034 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002035 onpass="PING ALL PASS",
2036 onfail="PING ALL FAIL" )
2037
GlennRCbddd58f2015-10-01 15:45:25 -07002038 caseResult = linkUp and pingResult
2039 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002040 onpass="Link Up Test PASS",
2041 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002042 # Printing what exactly failed
2043 if not linkUp:
2044 main.log.debug( "Link down was not discovered correctly" )
2045 if not pingResult:
2046 main.log.debug( "Pingall failed" )
2047 if not intentState:
2048 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002049
GlennRCbddd58f2015-10-01 15:45:25 -07002050 if not caseResult and main.failSwitch:
2051 main.log.report("Stopping test")
2052 main.stop( email=main.emailOnStop )
2053
Hari Krishnac195f3b2015-07-08 20:02:24 -07002054 def CASE73( self, main ):
2055 """
2056 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2057 """
2058 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002059 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002060 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002061
Hari Krishnac195f3b2015-07-08 20:02:24 -07002062 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2063 main.log.report( "___________________________________________________________________________" )
2064 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2065 switches = []
2066 switchesComb = []
2067 for i in range( main.numMNswitches ):
2068 switches.append('s%d'%(i+1))
2069 switchesLinksComb = list(itertools.combinations(switches,2))
2070 main.randomLinks = random.sample(switchesLinksComb, 5 )
2071 print main.randomLinks
2072 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002073
Hari Krishnac195f3b2015-07-08 20:02:24 -07002074 for switch in main.randomLinks:
2075 main.Mininet1.link(
2076 END1=switch[0],
2077 END2=switch[1],
2078 OPTION="down")
2079 time.sleep( link_sleep )
2080
Hari Krishna6185fc12015-07-13 15:42:31 -07002081 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002082 linkDown = main.ONOSbench.checkStatus(
2083 topology_output, main.numMNswitches, str(
2084 int( main.numMNlinks ) - 5 * 2 ) )
2085 utilities.assert_equals(
2086 expect=main.TRUE,
2087 actual=linkDown,
2088 onpass="Link Down discovered properly",
2089 onfail="Link down was not discovered in " +
2090 str( link_sleep ) +
2091 " seconds" )
2092
GlennRCfcfdc4f2015-09-30 16:01:57 -07002093 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002094 # Giving onos multiple chances to install intents
2095 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002096 if i != 0:
2097 main.log.warn( "Verification failed. Retrying..." )
2098 main.log.info("Giving onos some time...")
2099 time.sleep( main.checkIntentsDelay )
2100
2101 intentState = main.TRUE
2102 for e in range(int(main.numCtrls)):
2103 main.log.info( "Checking intents on CLI %s" % (e+1) )
2104 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2105 intentState
2106 if not intentState:
2107 main.log.warn( "Not all intents installed" )
2108 if intentState:
2109 break
2110 else:
2111 #Dumping intent summary
2112 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2113
2114
2115 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2116 onpass="INTENTS INSTALLED",
2117 onfail="SOME INTENTS NOT INSTALLED" )
2118
Hari Krishnac195f3b2015-07-08 20:02:24 -07002119 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002120 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002121 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002122 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2123 if not pingResult:
2124 main.log.warn("First pingall failed. Retrying...")
2125 time.sleep(main.pingSleep)
2126 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002127
Hari Krishnac195f3b2015-07-08 20:02:24 -07002128 time2 = time.time()
2129 timeDiff = round( ( time2 - time1 ), 2 )
2130 main.log.report(
2131 "Time taken for Ping All: " +
2132 str( timeDiff ) +
2133 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002134 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002135 onpass="PING ALL PASS",
2136 onfail="PING ALL FAIL" )
2137
GlennRCbddd58f2015-10-01 15:45:25 -07002138 caseResult = linkDown and pingResult and intentState
2139 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002140 onpass="Random Link cut Test PASS",
2141 onfail="Random Link cut Test FAIL" )
2142
GlennRCfcfdc4f2015-09-30 16:01:57 -07002143 # Printing what exactly failed
2144 if not linkDown:
2145 main.log.debug( "Link down was not discovered correctly" )
2146 if not pingResult:
2147 main.log.debug( "Pingall failed" )
2148 if not intentState:
2149 main.log.debug( "Intents are not all installed" )
2150
GlennRCbddd58f2015-10-01 15:45:25 -07002151 if not caseResult and main.failSwitch:
2152 main.log.report("Stopping test")
2153 main.stop( email=main.emailOnStop )
2154
Hari Krishnac195f3b2015-07-08 20:02:24 -07002155 def CASE83( self, main ):
2156 """
2157 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2158 """
2159 import random
2160 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002161
Hari Krishnac195f3b2015-07-08 20:02:24 -07002162 main.log.report(
2163 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2164 main.log.report(
2165 "__________________________________________________________________" )
2166 main.case(
2167 "Point intents - Bring the core links up that are down and verify ping all" )
2168 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002169
Hari Krishnac195f3b2015-07-08 20:02:24 -07002170 for switch in main.randomLinks:
2171 main.Mininet1.link(
2172 END1=switch[0],
2173 END2=switch[1],
2174 OPTION="up")
2175 time.sleep( link_sleep )
2176
Hari Krishna6185fc12015-07-13 15:42:31 -07002177 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002178 linkUp = main.ONOSbench.checkStatus(
2179 topology_output,
2180 main.numMNswitches,
2181 str( main.numMNlinks ) )
2182 utilities.assert_equals(
2183 expect=main.TRUE,
2184 actual=linkUp,
2185 onpass="Link up discovered properly",
2186 onfail="Link up was not discovered in " +
2187 str( link_sleep ) +
2188 " seconds" )
2189
GlennRCfcfdc4f2015-09-30 16:01:57 -07002190 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002191 # Giving onos multiple chances to install intents
2192 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002193 if i != 0:
2194 main.log.warn( "Verification failed. Retrying..." )
2195 main.log.info("Giving onos some time...")
2196 time.sleep( main.checkIntentsDelay )
2197
2198 intentState = main.TRUE
2199 for e in range(int(main.numCtrls)):
2200 main.log.info( "Checking intents on CLI %s" % (e+1) )
2201 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2202 intentState
2203 if not intentState:
2204 main.log.warn( "Not all intents installed" )
2205 if intentState:
2206 break
2207 else:
2208 #Dumping intent summary
2209 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2210
2211
2212 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2213 onpass="INTENTS INSTALLED",
2214 onfail="SOME INTENTS NOT INSTALLED" )
2215
Hari Krishnac195f3b2015-07-08 20:02:24 -07002216 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002217 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002218 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002219 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2220 if not pingResult:
2221 main.log.warn("First pingall failed. Retrying...")
2222 time.sleep(main.pingSleep)
2223 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002224
Hari Krishnac195f3b2015-07-08 20:02:24 -07002225 time2 = time.time()
2226 timeDiff = round( ( time2 - time1 ), 2 )
2227 main.log.report(
2228 "Time taken for Ping All: " +
2229 str( timeDiff ) +
2230 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002231 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002232 onpass="PING ALL PASS",
2233 onfail="PING ALL FAIL" )
2234
GlennRCbddd58f2015-10-01 15:45:25 -07002235 caseResult = linkUp and pingResult
2236 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002237 onpass="Link Up Test PASS",
2238 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002239 # Printing what exactly failed
2240 if not linkUp:
2241 main.log.debug( "Link down was not discovered correctly" )
2242 if not pingResult:
2243 main.log.debug( "Pingall failed" )
2244 if not intentState:
2245 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002246
GlennRCbddd58f2015-10-01 15:45:25 -07002247 if not caseResult and main.failSwitch:
2248 main.log.report("Stopping test")
2249 main.stop( email=main.emailOnStop )
2250
Hari Krishnac195f3b2015-07-08 20:02:24 -07002251 def CASE74( self, main ):
2252 """
2253 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2254 """
2255 import random
2256 main.randomLink1 = []
2257 main.randomLink2 = []
2258 main.randomLink3 = []
2259 main.randomLink4 = []
2260 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2261 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2262 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2263 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2264 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2265 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2266 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002267
Hari Krishnac195f3b2015-07-08 20:02:24 -07002268 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2269 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002270 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002271 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002272 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002273 linkIndex.remove(linkIndexS9)
2274 linkIndexS10 = random.sample(linkIndex,1)[0]
2275 main.randomLink1 = link1End2top[linkIndexS9]
2276 main.randomLink2 = link2End2top[linkIndexS10]
2277 main.randomLink3 = random.sample(link1End2bot,1)[0]
2278 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002279
2280 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002281 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2282 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2283 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2284 time.sleep( link_sleep )
2285 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2286 time.sleep( link_sleep )
2287
Hari Krishna6185fc12015-07-13 15:42:31 -07002288 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002289 linkDown = main.ONOSbench.checkStatus(
2290 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002291 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002292 utilities.assert_equals(
2293 expect=main.TRUE,
2294 actual=linkDown,
2295 onpass="Link Down discovered properly",
2296 onfail="Link down was not discovered in " +
2297 str( link_sleep ) +
2298 " seconds" )
2299
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002301 # Giving onos multiple chances to install intents
2302 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002303 if i != 0:
2304 main.log.warn( "Verification failed. Retrying..." )
2305 main.log.info("Giving onos some time...")
2306 time.sleep( main.checkIntentsDelay )
2307
2308 intentState = main.TRUE
2309 for e in range(int(main.numCtrls)):
2310 main.log.info( "Checking intents on CLI %s" % (e+1) )
2311 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2312 intentState
2313 if not intentState:
2314 main.log.warn( "Not all intents installed" )
2315 if intentState:
2316 break
2317 else:
2318 #Dumping intent summary
2319 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2320
2321
2322 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2323 onpass="INTENTS INSTALLED",
2324 onfail="SOME INTENTS NOT INSTALLED" )
2325
Hari Krishnac195f3b2015-07-08 20:02:24 -07002326 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002327 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002328 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002329 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2330 if not pingResult:
2331 main.log.warn("First pingall failed. Retrying...")
2332 time.sleep(main.pingSleep)
2333 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002334
Hari Krishnac195f3b2015-07-08 20:02:24 -07002335 time2 = time.time()
2336 timeDiff = round( ( time2 - time1 ), 2 )
2337 main.log.report(
2338 "Time taken for Ping All: " +
2339 str( timeDiff ) +
2340 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002341 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002342 onpass="PING ALL PASS",
2343 onfail="PING ALL FAIL" )
2344
GlennRCbddd58f2015-10-01 15:45:25 -07002345 caseResult = linkDown and pingResult and intentState
2346 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002347 onpass="Random Link cut Test PASS",
2348 onfail="Random Link cut Test FAIL" )
2349
GlennRCfcfdc4f2015-09-30 16:01:57 -07002350 # Printing what exactly failed
2351 if not linkDown:
2352 main.log.debug( "Link down was not discovered correctly" )
2353 if not pingResult:
2354 main.log.debug( "Pingall failed" )
2355 if not intentState:
2356 main.log.debug( "Intents are not all installed" )
2357
GlennRCbddd58f2015-10-01 15:45:25 -07002358 if not caseResult and main.failSwitch:
2359 main.log.report("Stopping test")
2360 main.stop( email=main.emailOnStop )
2361
Hari Krishnac195f3b2015-07-08 20:02:24 -07002362 def CASE84( self, main ):
2363 """
2364 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2365 """
2366 import random
2367 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2368 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2369 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2370 main.log.report(
2371 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2372 main.log.report(
2373 "__________________________________________________________________" )
2374 main.case(
2375 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002376
2377 # Work around for link state propagation delay. Added some sleep time.
2378 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2379 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002380 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2381 time.sleep( link_sleep )
2382 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2383 time.sleep( link_sleep )
2384
Hari Krishna6185fc12015-07-13 15:42:31 -07002385 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002386 linkUp = main.ONOSbench.checkStatus(
2387 topology_output,
2388 main.numMNswitches,
2389 str( main.numMNlinks ) )
2390 utilities.assert_equals(
2391 expect=main.TRUE,
2392 actual=linkUp,
2393 onpass="Link up discovered properly",
2394 onfail="Link up was not discovered in " +
2395 str( link_sleep ) +
2396 " seconds" )
2397
GlennRCfcfdc4f2015-09-30 16:01:57 -07002398 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002399 # Giving onos multiple chances to install intents
2400 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002401 if i != 0:
2402 main.log.warn( "Verification failed. Retrying..." )
2403 main.log.info("Giving onos some time...")
2404 time.sleep( main.checkIntentsDelay )
2405
2406 intentState = main.TRUE
2407 for e in range(int(main.numCtrls)):
2408 main.log.info( "Checking intents on CLI %s" % (e+1) )
2409 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2410 intentState
2411 if not intentState:
2412 main.log.warn( "Not all intents installed" )
2413 if intentState:
2414 break
2415 else:
2416 #Dumping intent summary
2417 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2418
2419
2420 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2421 onpass="INTENTS INSTALLED",
2422 onfail="SOME INTENTS NOT INSTALLED" )
2423
Hari Krishnac195f3b2015-07-08 20:02:24 -07002424 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002425 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002426 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002427 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2428 if not pingResult:
2429 main.log.warn("First pingall failed. Retrying...")
2430 time.sleep(main.pingSleep)
2431 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002432
Hari Krishnac195f3b2015-07-08 20:02:24 -07002433 time2 = time.time()
2434 timeDiff = round( ( time2 - time1 ), 2 )
2435 main.log.report(
2436 "Time taken for Ping All: " +
2437 str( timeDiff ) +
2438 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002439 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002440 onpass="PING ALL PASS",
2441 onfail="PING ALL FAIL" )
2442
GlennRCbddd58f2015-10-01 15:45:25 -07002443 caseResult = linkUp and pingResult
2444 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002445 onpass="Link Up Test PASS",
2446 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002447 # Printing what exactly failed
2448 if not linkUp:
2449 main.log.debug( "Link down was not discovered correctly" )
2450 if not pingResult:
2451 main.log.debug( "Pingall failed" )
2452 if not intentState:
2453 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002454
GlennRCbddd58f2015-10-01 15:45:25 -07002455 if not caseResult and main.failSwitch:
2456 main.log.report("Stopping test")
2457 main.stop( email=main.emailOnStop )
2458
Hari Krishnab79d0822015-08-20 09:48:43 -07002459 def CASE75( self, main ):
2460 """
2461 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2462 """
2463 import random
2464 main.randomLink1 = []
2465 main.randomLink2 = []
2466 main.randomLink3 = []
2467 main.randomLink4 = []
2468 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2469 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2470 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2471 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2472 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2473 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2474 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2475 main.pingTimeout = 400
2476
2477 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2478 main.log.report( "___________________________________________________________________________" )
2479 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2480 linkIndex = range(4)
2481 linkIndexS9 = random.sample(linkIndex,1)[0]
2482 linkIndex.remove(linkIndexS9)
2483 linkIndexS10 = random.sample(linkIndex,1)[0]
2484 main.randomLink1 = link1End2top[linkIndexS9]
2485 main.randomLink2 = link2End2top[linkIndexS10]
2486 main.randomLink3 = random.sample(link1End2bot,1)[0]
2487 main.randomLink4 = random.sample(link2End2bot,1)[0]
2488
2489 # Work around for link state propagation delay. Added some sleep time.
2490 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2491 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2492 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2493 time.sleep( link_sleep )
2494 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2495 time.sleep( link_sleep )
2496
2497 topology_output = main.ONOScli1.topology()
2498 linkDown = main.ONOSbench.checkStatus(
2499 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002500 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002501 utilities.assert_equals(
2502 expect=main.TRUE,
2503 actual=linkDown,
2504 onpass="Link Down discovered properly",
2505 onfail="Link down was not discovered in " +
2506 str( link_sleep ) +
2507 " seconds" )
2508
GlennRCfcfdc4f2015-09-30 16:01:57 -07002509 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002510 # Giving onos multiple chances to install intents
2511 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002512 if i != 0:
2513 main.log.warn( "Verification failed. Retrying..." )
2514 main.log.info("Giving onos some time...")
2515 time.sleep( main.checkIntentsDelay )
2516
2517 intentState = main.TRUE
2518 for e in range(int(main.numCtrls)):
2519 main.log.info( "Checking intents on CLI %s" % (e+1) )
2520 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2521 intentState
2522 if not intentState:
2523 main.log.warn( "Not all intents installed" )
2524 if intentState:
2525 break
2526 else:
2527 #Dumping intent summary
2528 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2529
2530
2531 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2532 onpass="INTENTS INSTALLED",
2533 onfail="SOME INTENTS NOT INSTALLED" )
2534
Hari Krishnab79d0822015-08-20 09:48:43 -07002535 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002536 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002537 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002538 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2539 if not pingResult:
2540 main.log.warn("First pingall failed. Retrying...")
2541 time.sleep(main.pingSleep)
2542 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002543
Hari Krishnab79d0822015-08-20 09:48:43 -07002544 time2 = time.time()
2545 timeDiff = round( ( time2 - time1 ), 2 )
2546 main.log.report(
2547 "Time taken for Ping All: " +
2548 str( timeDiff ) +
2549 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002550 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002551 onpass="PING ALL PASS",
2552 onfail="PING ALL FAIL" )
2553
GlennRCbddd58f2015-10-01 15:45:25 -07002554 caseResult = linkDown and pingResult and intentState
2555 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002556 onpass="Random Link cut Test PASS",
2557 onfail="Random Link cut Test FAIL" )
2558
GlennRCfcfdc4f2015-09-30 16:01:57 -07002559 # Printing what exactly failed
2560 if not linkDown:
2561 main.log.debug( "Link down was not discovered correctly" )
2562 if not pingResult:
2563 main.log.debug( "Pingall failed" )
2564 if not intentState:
2565 main.log.debug( "Intents are not all installed" )
2566
GlennRCbddd58f2015-10-01 15:45:25 -07002567 if not caseResult and main.failSwitch:
2568 main.log.report("Stopping test")
2569 main.stop( email=main.emailOnStop )
2570
Hari Krishnab79d0822015-08-20 09:48:43 -07002571 def CASE85( self, main ):
2572 """
2573 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2574 """
2575 import random
2576 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2577 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2578 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2579 main.log.report(
2580 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2581 main.log.report(
2582 "__________________________________________________________________" )
2583 main.case(
2584 "Point intents - Bring the core links up that are down and verify ping all" )
2585
2586 # Work around for link state propagation delay. Added some sleep time.
2587 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2588 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2589 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2590 time.sleep( link_sleep )
2591 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2592 time.sleep( link_sleep )
2593
2594 topology_output = main.ONOScli1.topology()
2595 linkUp = main.ONOSbench.checkStatus(
2596 topology_output,
2597 main.numMNswitches,
2598 str( main.numMNlinks ) )
2599 utilities.assert_equals(
2600 expect=main.TRUE,
2601 actual=linkUp,
2602 onpass="Link up discovered properly",
2603 onfail="Link up was not discovered in " +
2604 str( link_sleep ) +
2605 " seconds" )
2606
GlennRCfcfdc4f2015-09-30 16:01:57 -07002607 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002608 # Giving onos multiple chances to install intents
2609 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002610 if i != 0:
2611 main.log.warn( "Verification failed. Retrying..." )
2612 main.log.info("Giving onos some time...")
2613 time.sleep( main.checkIntentsDelay )
2614
2615 intentState = main.TRUE
2616 for e in range(int(main.numCtrls)):
2617 main.log.info( "Checking intents on CLI %s" % (e+1) )
2618 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2619 intentState
2620 if not intentState:
2621 main.log.warn( "Not all intents installed" )
2622 if intentState:
2623 break
2624 else:
2625 #Dumping intent summary
2626 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2627
2628
2629 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2630 onpass="INTENTS INSTALLED",
2631 onfail="SOME INTENTS NOT INSTALLED" )
2632
Hari Krishnab79d0822015-08-20 09:48:43 -07002633 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002634 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002635 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002636 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2637 if not pingResult:
2638 main.log.warn("First pingall failed. Retrying...")
2639 time.sleep(main.pingSleep)
2640 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002641
Hari Krishnab79d0822015-08-20 09:48:43 -07002642 time2 = time.time()
2643 timeDiff = round( ( time2 - time1 ), 2 )
2644 main.log.report(
2645 "Time taken for Ping All: " +
2646 str( timeDiff ) +
2647 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002648 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002649 onpass="PING ALL PASS",
2650 onfail="PING ALL FAIL" )
2651
GlennRCbddd58f2015-10-01 15:45:25 -07002652 caseResult = linkUp and pingResult
2653 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002654 onpass="Link Up Test PASS",
2655 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002656 # Printing what exactly failed
2657 if not linkUp:
2658 main.log.debug( "Link down was not discovered correctly" )
2659 if not pingResult:
2660 main.log.debug( "Pingall failed" )
2661 if not intentState:
2662 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002663
GlennRCbddd58f2015-10-01 15:45:25 -07002664 if not caseResult and main.failSwitch:
2665 main.log.report("Stopping test")
2666 main.stop( email=main.emailOnStop )
2667
Hari Krishna4223dbd2015-08-13 16:29:53 -07002668 def CASE170( self ):
2669 """
2670 IPv6 ping all with some core links down( Host Intents-Att Topo)
2671 """
2672 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2673 main.log.report( "_________________________________________________" )
2674 import itertools
2675 import time
2676 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2677 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002678 pingResult = main.FALSE
2679 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002680 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002681 if not pingResult:
2682 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002683 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002684 time2 = time.time()
2685 timeDiff = round( ( time2 - time1 ), 2 )
2686 main.log.report(
2687 "Time taken for IPv6 Ping All: " +
2688 str( timeDiff ) +
2689 " seconds" )
2690 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2691 onpass="PING ALL PASS",
2692 onfail="PING ALL FAIL" )
2693
GlennRCbddd58f2015-10-01 15:45:25 -07002694 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002695 utilities.assert_equals(
2696 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002697 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002698 onpass="IPv6 Ping across 300 host intents test PASS",
2699 onfail="IPv6 Ping across 300 host intents test FAIL" )
2700
2701 def CASE180( self ):
2702 """
2703 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2704 """
2705 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2706 main.log.report( "_________________________________________________" )
2707 import itertools
2708 import time
2709 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2710 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002711 pingResult = main.FALSE
2712 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002713 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002714 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002715 main.log.warn("First ping failed. Retrying...")
2716 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002717 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002718 time2 = time.time()
2719 timeDiff = round( ( time2 - time1 ), 2 )
2720 main.log.report(
2721 "Time taken for IPv6 Ping All: " +
2722 str( timeDiff ) +
2723 " seconds" )
2724 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2725 onpass="PING ALL PASS",
2726 onfail="PING ALL FAIL" )
2727
GlennRCbddd58f2015-10-01 15:45:25 -07002728 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002729 utilities.assert_equals(
2730 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002731 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002732 onpass="IPv6 Ping across 300 host intents test PASS",
2733 onfail="IPv6 Ping across 300 host intents test FAIL" )
2734
2735 def CASE171( self ):
2736 """
2737 IPv6 ping all with some core links down( Point Intents-Att Topo)
2738 """
2739 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2740 main.log.report( "_________________________________________________" )
2741 import itertools
2742 import time
2743 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2744 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002745 pingResult = main.FALSE
2746 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002747 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002748 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002749 main.log.warn("First ping failed. Retrying...")
2750 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002751 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002752 time2 = time.time()
2753 timeDiff = round( ( time2 - time1 ), 2 )
2754 main.log.report(
2755 "Time taken for IPv6 Ping All: " +
2756 str( timeDiff ) +
2757 " seconds" )
2758 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2759 onpass="PING ALL PASS",
2760 onfail="PING ALL FAIL" )
2761
GlennRCbddd58f2015-10-01 15:45:25 -07002762 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002763 utilities.assert_equals(
2764 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002765 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002766 onpass="IPv6 Ping across 600 point intents test PASS",
2767 onfail="IPv6 Ping across 600 point intents test FAIL" )
2768
2769 def CASE181( self ):
2770 """
2771 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2772 """
2773 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2774 main.log.report( "_________________________________________________" )
2775 import itertools
2776 import time
2777 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2778 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002779 pingResult = main.FALSE
2780 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002781 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002782 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002783 main.log.warn("First ping failed. Retrying...")
2784 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002785 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002786 time2 = time.time()
2787 timeDiff = round( ( time2 - time1 ), 2 )
2788 main.log.report(
2789 "Time taken for IPv6 Ping All: " +
2790 str( timeDiff ) +
2791 " seconds" )
2792 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2793 onpass="PING ALL PASS",
2794 onfail="PING ALL FAIL" )
2795
GlennRCbddd58f2015-10-01 15:45:25 -07002796 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002797 utilities.assert_equals(
2798 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002799 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002800 onpass="IPv6 Ping across 600 Point intents test PASS",
2801 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2802
2803 def CASE172( self ):
2804 """
2805 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2806 """
2807 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2808 main.log.report( "_________________________________________________" )
2809 import itertools
2810 import time
2811 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2812 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002813 pingResult = main.FALSE
2814 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002815 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002816 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002817 main.log.warn("First ping failed. Retrying...")
2818 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002819 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002820 time2 = time.time()
2821 timeDiff = round( ( time2 - time1 ), 2 )
2822 main.log.report(
2823 "Time taken for IPv6 Ping All: " +
2824 str( timeDiff ) +
2825 " seconds" )
2826 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2827 onpass="PING ALL PASS",
2828 onfail="PING ALL FAIL" )
2829
GlennRCbddd58f2015-10-01 15:45:25 -07002830 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002831 utilities.assert_equals(
2832 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002833 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002834 onpass="IPv6 Ping across 300 host intents test PASS",
2835 onfail="IPv6 Ping across 300 host intents test FAIL" )
2836
2837 def CASE182( self ):
2838 """
2839 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2840 """
2841 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2842 main.log.report( "_________________________________________________" )
2843 import itertools
2844 import time
2845 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2846 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002847 pingResult = main.FALSE
2848 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002849 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002850 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002851 main.log.warn("First ping failed. Retrying...")
2852 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002853 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002854 time2 = time.time()
2855 timeDiff = round( ( time2 - time1 ), 2 )
2856 main.log.report(
2857 "Time taken for IPv6 Ping All: " +
2858 str( timeDiff ) +
2859 " seconds" )
2860 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2861 onpass="PING ALL PASS",
2862 onfail="PING ALL FAIL" )
2863
GlennRCbddd58f2015-10-01 15:45:25 -07002864 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002865 utilities.assert_equals(
2866 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002867 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002868 onpass="IPv6 Ping across 300 host intents test PASS",
2869 onfail="IPv6 Ping across 300 host intents test FAIL" )
2870
2871 def CASE173( self ):
2872 """
2873 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2874 """
2875 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2876 main.log.report( "_________________________________________________" )
2877 import itertools
2878 import time
2879 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2880 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002881 pingResult = main.FALSE
2882 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002883 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002884 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002885 main.log.warn("First ping failed. Retrying...")
2886 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002887 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002888 time2 = time.time()
2889 timeDiff = round( ( time2 - time1 ), 2 )
2890 main.log.report(
2891 "Time taken for IPv6 Ping All: " +
2892 str( timeDiff ) +
2893 " seconds" )
2894 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2895 onpass="PING ALL PASS",
2896 onfail="PING ALL FAIL" )
2897
GlennRCbddd58f2015-10-01 15:45:25 -07002898 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002899 utilities.assert_equals(
2900 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002901 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002902 onpass="IPv6 Ping across 600 point intents test PASS",
2903 onfail="IPv6 Ping across 600 point intents test FAIL" )
2904
2905 def CASE183( self ):
2906 """
2907 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2908 """
2909 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2910 main.log.report( "_________________________________________________" )
2911 import itertools
2912 import time
2913 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2914 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002915 pingResult = main.FALSE
2916 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002917 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002918 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002919 main.log.warn("First ping failed. Retrying...")
2920 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002921 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002922 time2 = time.time()
2923 timeDiff = round( ( time2 - time1 ), 2 )
2924 main.log.report(
2925 "Time taken for IPv6 Ping All: " +
2926 str( timeDiff ) +
2927 " seconds" )
2928 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2929 onpass="PING ALL PASS",
2930 onfail="PING ALL FAIL" )
2931
GlennRCbddd58f2015-10-01 15:45:25 -07002932 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002933 utilities.assert_equals(
2934 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002935 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002936 onpass="IPv6 Ping across 600 Point intents test PASS",
2937 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2938
2939 def CASE174( self ):
2940 """
2941 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2942 """
2943 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2944 main.log.report( "_________________________________________________" )
2945 import itertools
2946 import time
2947 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2948 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002949 pingResult = main.FALSE
2950 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002951 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002952 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002953 main.log.warn("First ping failed. Retrying...")
2954 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002955 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002956 time2 = time.time()
2957 timeDiff = round( ( time2 - time1 ), 2 )
2958 main.log.report(
2959 "Time taken for IPv6 Ping All: " +
2960 str( timeDiff ) +
2961 " seconds" )
2962 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2963 onpass="PING ALL PASS",
2964 onfail="PING ALL FAIL" )
2965
GlennRCbddd58f2015-10-01 15:45:25 -07002966 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002967 utilities.assert_equals(
2968 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002969 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002970 onpass="IPv6 Ping across 2278 host intents test PASS",
2971 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2972
2973 def CASE184( self ):
2974 """
2975 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2976 """
2977 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2978 main.log.report( "_________________________________________________" )
2979 import itertools
2980 import time
2981 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2982 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002983 pingResult = main.FALSE
2984 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002985 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002986 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002987 main.log.warn("First ping failed. Retrying...")
2988 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002989 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002990 time2 = time.time()
2991 timeDiff = round( ( time2 - time1 ), 2 )
2992 main.log.report(
2993 "Time taken for IPv6 Ping All: " +
2994 str( timeDiff ) +
2995 " seconds" )
2996 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2997 onpass="PING ALL PASS",
2998 onfail="PING ALL FAIL" )
2999
GlennRCbddd58f2015-10-01 15:45:25 -07003000 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003001 utilities.assert_equals(
3002 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003003 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003004 onpass="IPv6 Ping across 2278 host intents test PASS",
3005 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3006
3007 def CASE175( self ):
3008 """
3009 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3010 """
3011 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3012 main.log.report( "_________________________________________________" )
3013 import itertools
3014 import time
3015 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3016 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003017 pingResult = main.FALSE
3018 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003019 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003020 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003021 main.log.warn("First ping failed. Retrying...")
3022 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003023 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003024 time2 = time.time()
3025 timeDiff = round( ( time2 - time1 ), 2 )
3026 main.log.report(
3027 "Time taken for IPv6 Ping All: " +
3028 str( timeDiff ) +
3029 " seconds" )
3030 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3031 onpass="PING ALL PASS",
3032 onfail="PING ALL FAIL" )
3033
GlennRCbddd58f2015-10-01 15:45:25 -07003034 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003035 utilities.assert_equals(
3036 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003037 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003038 onpass="IPv6 Ping across 4556 point intents test PASS",
3039 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3040
3041 def CASE185( self ):
3042 """
3043 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3044 """
3045 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3046 main.log.report( "_________________________________________________" )
3047 import itertools
3048 import time
3049 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3050 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003051 pingResult = main.FALSE
3052 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003053 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003054 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003055 main.log.warn("First ping failed. Retrying...")
3056 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003057 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003058 time2 = time.time()
3059 timeDiff = round( ( time2 - time1 ), 2 )
3060 main.log.report(
3061 "Time taken for IPv6 Ping All: " +
3062 str( timeDiff ) +
3063 " seconds" )
3064 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3065 onpass="PING ALL PASS",
3066 onfail="PING ALL FAIL" )
3067
GlennRCbddd58f2015-10-01 15:45:25 -07003068 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003069 utilities.assert_equals(
3070 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003071 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003072 onpass="IPv6 Ping across 4556 Point intents test PASS",
3073 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3074
Hari Krishnac195f3b2015-07-08 20:02:24 -07003075 def CASE90( self ):
3076 """
3077 Install 600 point intents and verify ping all (Att Topology)
3078 """
3079 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3080 main.log.report( "_______________________________________" )
3081 import itertools
3082 import time
3083 main.case( "Install 600 point intents" )
3084 main.step( "Add point Intents" )
3085 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003086 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3087
Hari Krishnac195f3b2015-07-08 20:02:24 -07003088 intentIdList = []
3089 time1 = time.time()
3090 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3091 pool = []
3092 for cli in main.CLIs:
3093 if i >= len( deviceCombos ):
3094 break
3095 t = main.Thread( target=cli.addPointIntent,
3096 threadID=main.threadID,
3097 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003098 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 -07003099 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003100 t.start()
3101 i = i + 1
3102 main.threadID = main.threadID + 1
3103 for thread in pool:
3104 thread.join()
3105 intentIdList.append(thread.result)
3106 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003107 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003108
GlennRCfcfdc4f2015-09-30 16:01:57 -07003109 # Saving intent ids to check intents in later case
3110 main.intentIds = list(intentIdList)
3111
GlennRCa8d786a2015-09-23 17:40:11 -07003112 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003113
GlennRC1dde1712015-10-02 11:03:08 -07003114 # Giving onos multiple chances to install intents
3115 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003116 if i != 0:
3117 main.log.warn( "Verification failed. Retrying..." )
3118 main.log.info("Waiting for onos to install intents...")
3119 time.sleep( main.checkIntentsDelay )
3120
GlennRCa8d786a2015-09-23 17:40:11 -07003121 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003122 for e in range(int(main.numCtrls)):
3123 main.log.info( "Checking intents on CLI %s" % (e+1) )
3124 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3125 intentState
3126 if not intentState:
3127 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003128 if intentState:
3129 break
GlennRCdb2c8422015-09-29 12:21:59 -07003130 else:
3131 #Dumping intent summary
3132 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003133
3134 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3135 onpass="INTENTS INSTALLED",
3136 onfail="SOME INTENTS NOT INSTALLED" )
3137
Hari Krishnac195f3b2015-07-08 20:02:24 -07003138 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003139 for i in range(main.numPings):
3140 time1 = time.time()
3141 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3142 if not pingResult:
3143 main.log.warn("First pingall failed. Retrying...")
3144 time.sleep(main.pingSleep)
3145 else: break
3146
Hari Krishnac195f3b2015-07-08 20:02:24 -07003147 time2 = time.time()
3148 timeDiff = round( ( time2 - time1 ), 2 )
3149 main.log.report(
3150 "Time taken for Ping All: " +
3151 str( timeDiff ) +
3152 " seconds" )
3153 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003154 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003155 onfail="PING ALL FAIL" )
3156
GlennRCbddd58f2015-10-01 15:45:25 -07003157 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003158
Hari Krishnac195f3b2015-07-08 20:02:24 -07003159 utilities.assert_equals(
3160 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003161 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003162 onpass="Install 600 point Intents and Ping All test PASS",
3163 onfail="Install 600 point Intents and Ping All test FAIL" )
3164
GlennRCbddd58f2015-10-01 15:45:25 -07003165 if not intentState:
3166 main.log.debug( "Intents failed to install completely" )
3167 if not pingResult:
3168 main.log.debug( "Pingall failed" )
3169
3170 if not caseResult and main.failSwitch:
3171 main.log.report("Stopping test")
3172 main.stop( email=main.emailOnStop )
3173
Hari Krishnac195f3b2015-07-08 20:02:24 -07003174 def CASE91( self ):
3175 """
3176 Install 600 point intents and verify ping all (Chordal Topology)
3177 """
3178 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3179 main.log.report( "_______________________________________" )
3180 import itertools
3181 import time
3182 main.case( "Install 600 point intents" )
3183 main.step( "Add point Intents" )
3184 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003185 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3186
Hari Krishnac195f3b2015-07-08 20:02:24 -07003187 intentIdList = []
3188 time1 = time.time()
3189 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3190 pool = []
3191 for cli in main.CLIs:
3192 if i >= len( deviceCombos ):
3193 break
3194 t = main.Thread( target=cli.addPointIntent,
3195 threadID=main.threadID,
3196 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003197 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 -07003198 pool.append(t)
3199 #time.sleep(1)
3200 t.start()
3201 i = i + 1
3202 main.threadID = main.threadID + 1
3203 for thread in pool:
3204 thread.join()
3205 intentIdList.append(thread.result)
3206 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003207 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003208
GlennRCfcfdc4f2015-09-30 16:01:57 -07003209 # Saving intent ids to check intents in later case
3210 main.intentIds = list(intentIdList)
3211
GlennRCa8d786a2015-09-23 17:40:11 -07003212 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003213
GlennRC1dde1712015-10-02 11:03:08 -07003214 # Giving onos multiple chances to install intents
3215 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003216 if i != 0:
3217 main.log.warn( "Verification failed. Retrying..." )
3218 main.log.info("Waiting for onos to install intents...")
3219 time.sleep( main.checkIntentsDelay )
3220
GlennRCa8d786a2015-09-23 17:40:11 -07003221 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003222 for e in range(int(main.numCtrls)):
3223 main.log.info( "Checking intents on CLI %s" % (e+1) )
3224 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3225 intentState
3226 if not intentState:
3227 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003228 if intentState:
3229 break
GlennRCdb2c8422015-09-29 12:21:59 -07003230 else:
3231 #Dumping intent summary
3232 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003233
3234 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3235 onpass="INTENTS INSTALLED",
3236 onfail="SOME INTENTS NOT INSTALLED" )
3237
Hari Krishnac195f3b2015-07-08 20:02:24 -07003238 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003239 for i in range(main.numPings):
3240 time1 = time.time()
3241 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3242 if not pingResult:
3243 main.log.warn("First pingall failed. Retrying...")
3244 time.sleep(main.pingSleep)
3245 else: break
3246
Hari Krishnac195f3b2015-07-08 20:02:24 -07003247 time2 = time.time()
3248 timeDiff = round( ( time2 - time1 ), 2 )
3249 main.log.report(
3250 "Time taken for Ping All: " +
3251 str( timeDiff ) +
3252 " seconds" )
3253 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3254 onpass="PING ALL PASS",
3255 onfail="PING ALL FAIL" )
3256
GlennRCbddd58f2015-10-01 15:45:25 -07003257 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003258
Hari Krishnac195f3b2015-07-08 20:02:24 -07003259 utilities.assert_equals(
3260 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003261 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003262 onpass="Install 600 point Intents and Ping All test PASS",
3263 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003264
GlennRCbddd58f2015-10-01 15:45:25 -07003265 if not intentState:
3266 main.log.debug( "Intents failed to install completely" )
3267 if not pingResult:
3268 main.log.debug( "Pingall failed" )
3269
3270 if not caseResult and main.failSwitch:
3271 main.log.report("Stopping test")
3272 main.stop( email=main.emailOnStop )
3273
Hari Krishnac195f3b2015-07-08 20:02:24 -07003274 def CASE92( self ):
3275 """
3276 Install 4556 point intents and verify ping all (Spine Topology)
3277 """
3278 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3279 main.log.report( "_______________________________________" )
3280 import itertools
3281 import time
3282 main.case( "Install 4556 point intents" )
3283 main.step( "Add point Intents" )
3284 intentResult = main.TRUE
3285 main.pingTimeout = 600
3286 for i in range(len(main.hostMACs)):
3287 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3288 print main.MACsDict
3289 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3290 intentIdList = []
3291 time1 = time.time()
3292 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3293 pool = []
3294 for cli in main.CLIs:
3295 if i >= len( deviceCombos ):
3296 break
3297 t = main.Thread( target=cli.addPointIntent,
3298 threadID=main.threadID,
3299 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003300 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 -07003301 pool.append(t)
3302 #time.sleep(1)
3303 t.start()
3304 i = i + 1
3305 main.threadID = main.threadID + 1
3306 for thread in pool:
3307 thread.join()
3308 intentIdList.append(thread.result)
3309 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003310 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003311
GlennRCfcfdc4f2015-09-30 16:01:57 -07003312 # Saving intent ids to check intents in later case
3313 main.intentIds = list(intentIdList)
3314
GlennRCa8d786a2015-09-23 17:40:11 -07003315 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003316
GlennRC1dde1712015-10-02 11:03:08 -07003317 # Giving onos multiple chances to install intents
3318 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003319 if i != 0:
3320 main.log.warn( "Verification failed. Retrying..." )
3321 main.log.info("Waiting for onos to install intents...")
3322 time.sleep( main.checkIntentsDelay )
3323
GlennRCa8d786a2015-09-23 17:40:11 -07003324 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003325 for e in range(int(main.numCtrls)):
3326 main.log.info( "Checking intents on CLI %s" % (e+1) )
3327 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3328 intentState
3329 if not intentState:
3330 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003331 if intentState:
3332 break
GlennRCdb2c8422015-09-29 12:21:59 -07003333 else:
3334 #Dumping intent summary
3335 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003336
3337 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3338 onpass="INTENTS INSTALLED",
3339 onfail="SOME INTENTS NOT INSTALLED" )
3340
Hari Krishnac195f3b2015-07-08 20:02:24 -07003341 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003342 for i in range(main.numPings):
3343 time1 = time.time()
3344 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3345 if not pingResult:
3346 main.log.warn("First pingall failed. Retrying...")
3347 time.sleep(main.pingSleep)
3348 else: break
3349
Hari Krishnac195f3b2015-07-08 20:02:24 -07003350 time2 = time.time()
3351 timeDiff = round( ( time2 - time1 ), 2 )
3352 main.log.report(
3353 "Time taken for Ping All: " +
3354 str( timeDiff ) +
3355 " seconds" )
3356 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3357 onpass="PING ALL PASS",
3358 onfail="PING ALL FAIL" )
3359
GlennRCbddd58f2015-10-01 15:45:25 -07003360 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003361
Hari Krishnac195f3b2015-07-08 20:02:24 -07003362 utilities.assert_equals(
3363 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003364 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003365 onpass="Install 4556 point Intents and Ping All test PASS",
3366 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003367
GlennRCbddd58f2015-10-01 15:45:25 -07003368 if not intentState:
3369 main.log.debug( "Intents failed to install completely" )
3370 if not pingResult:
3371 main.log.debug( "Pingall failed" )
3372
3373 if not caseResult and main.failSwitch:
3374 main.log.report("Stopping test")
3375 main.stop( email=main.emailOnStop )
3376
Hari Krishnac195f3b2015-07-08 20:02:24 -07003377 def CASE93( self ):
3378 """
3379 Install multi-single point intents and verify Ping all works
3380 for att topology
3381 """
3382 import copy
3383 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003384 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003385 main.log.report( "Install multi-single point intents and verify Ping all" )
3386 main.log.report( "___________________________________________" )
3387 main.case( "Install multi-single point intents and Ping all" )
3388 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3389 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3390 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003391 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003392 time1 = time.time()
3393 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3394 pool = []
3395 for cli in main.CLIs:
3396 egressDevice = deviceDPIDsCopy[i]
3397 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3398 ingressDeviceList.remove(egressDevice)
3399 if i >= len( deviceDPIDsCopy ):
3400 break
3401 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3402 threadID=main.threadID,
3403 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003404 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003405 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003406 t.start()
3407 i = i + 1
3408 main.threadID = main.threadID + 1
3409 for thread in pool:
3410 thread.join()
3411 intentIdList.append(thread.result)
3412 time2 = time.time()
3413 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003414
GlennRCdb2c8422015-09-29 12:21:59 -07003415 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003416
GlennRC1dde1712015-10-02 11:03:08 -07003417 # Giving onos multiple chances to install intents
3418 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003419 if i != 0:
3420 main.log.warn( "Verification failed. Retrying..." )
3421 main.log.info("Waiting for onos to install intents...")
3422 time.sleep( main.checkIntentsDelay )
3423
3424 intentState = main.TRUE
3425 for e in range(int(main.numCtrls)):
3426 main.log.info( "Checking intents on CLI %s" % (e+1) )
3427 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3428 intentState
3429 if not intentState:
3430 main.log.warn( "Not all intents installed" )
3431 if intentState:
3432 break
3433 else:
3434 #Dumping intent summary
3435 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3436
3437 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3438 onpass="INTENTS INSTALLED",
3439 onfail="SOME INTENTS NOT INSTALLED" )
3440
GlennRCfa69a2a2015-10-02 15:54:06 -07003441 main.step("Verify flows are all added")
3442
3443 for i in range( main.flowCheck ):
3444 if i != 0:
3445 main.log.warn( "verification failed. Retrying..." )
3446 main.log.info( "Waiting for onos to add flows..." )
3447 time.sleep( main.checkFlowsDelay )
3448
3449 flowState = main.TRUE
3450 for cli in main.CLIs:
3451 flowState = cli.checkFlowState()
3452 if not flowState:
3453 main.log.warn( "Not all flows added" )
3454 if flowState:
3455 break
3456 else:
3457 #Dumping summary
3458 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3459
3460 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3461 onpass="FLOWS INSTALLED",
3462 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003463
Hari Krishnac195f3b2015-07-08 20:02:24 -07003464 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003465 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003466 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003467 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3468 if not pingResult:
3469 main.log.warn("First pingall failed. Retrying...")
3470 time.sleep(main.pingSleep)
3471 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003472
Hari Krishnac195f3b2015-07-08 20:02:24 -07003473 time2 = time.time()
3474 timeDiff = round( ( time2 - time1 ), 2 )
3475 main.log.report(
3476 "Time taken for Ping All: " +
3477 str( timeDiff ) +
3478 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003479
GlennRCbddd58f2015-10-01 15:45:25 -07003480 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003481 utilities.assert_equals(
3482 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003483 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003484 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3485 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003486
GlennRCfa69a2a2015-10-02 15:54:06 -07003487 if not intentState:
3488 main.log.debug( "Intents failed to install completely" )
3489 if not pingResult:
3490 main.log.debug( "Pingall failed" )
3491 if not checkFlowsState:
3492 main.log.debug( "Flows failed to add completely" )
3493
3494 if not caseResult and main.failSwitch:
3495 main.log.report("Stopping test")
3496 main.stop( email=main.emailOnStop )
3497
Hari Krishnac195f3b2015-07-08 20:02:24 -07003498 def CASE94( self ):
3499 """
3500 Install multi-single point intents and verify Ping all works
3501 for Chordal topology
3502 """
3503 import copy
3504 import time
3505 main.log.report( "Install multi-single point intents and verify Ping all" )
3506 main.log.report( "___________________________________________" )
3507 main.case( "Install multi-single point intents and Ping all" )
3508 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3509 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3510 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003511 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003512 time1 = time.time()
3513 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3514 pool = []
3515 for cli in main.CLIs:
3516 egressDevice = deviceDPIDsCopy[i]
3517 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3518 ingressDeviceList.remove(egressDevice)
3519 if i >= len( deviceDPIDsCopy ):
3520 break
3521 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3522 threadID=main.threadID,
3523 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003524 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003525 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003526 t.start()
3527 i = i + 1
3528 main.threadID = main.threadID + 1
3529 for thread in pool:
3530 thread.join()
3531 intentIdList.append(thread.result)
3532 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003533 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003534
3535 main.step("Verify intents are installed")
3536
GlennRC1dde1712015-10-02 11:03:08 -07003537 # Giving onos multiple chances to install intents
3538 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003539 if i != 0:
3540 main.log.warn( "Verification failed. Retrying..." )
3541 main.log.info("Waiting for onos to install intents...")
3542 time.sleep( main.checkIntentsDelay )
3543
3544 intentState = main.TRUE
3545 for e in range(int(main.numCtrls)):
3546 main.log.info( "Checking intents on CLI %s" % (e+1) )
3547 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3548 intentState
3549 if not intentState:
3550 main.log.warn( "Not all intents installed" )
3551 if intentState:
3552 break
3553 else:
3554 #Dumping intent summary
3555 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3556
GlennRCdb2c8422015-09-29 12:21:59 -07003557 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3558 onpass="INTENTS INSTALLED",
3559 onfail="SOME INTENTS NOT INSTALLED" )
3560
GlennRCfa69a2a2015-10-02 15:54:06 -07003561 main.step("Verify flows are all added")
3562
3563 for i in range( main.flowCheck ):
3564 if i != 0:
3565 main.log.warn( "verification failed. Retrying..." )
3566 main.log.info( "Waiting for onos to add flows..." )
3567 time.sleep( main.checkFlowsDelay )
3568
3569 flowState = main.TRUE
3570 for cli in main.CLIs:
3571 flowState = cli.checkFlowState()
3572 if not flowState:
3573 main.log.warn( "Not all flows added" )
3574 if flowState:
3575 break
3576 else:
3577 #Dumping summary
3578 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3579
3580 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3581 onpass="FLOWS INSTALLED",
3582 onfail="SOME FLOWS NOT ADDED" )
3583
Hari Krishnac195f3b2015-07-08 20:02:24 -07003584 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003585 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003586 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003587 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3588 if not pingResult:
3589 main.log.warn("First pingall failed. Retrying...")
3590 time.sleep(main.pingSleep)
3591 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003592
Hari Krishnac195f3b2015-07-08 20:02:24 -07003593 time2 = time.time()
3594 timeDiff = round( ( time2 - time1 ), 2 )
3595 main.log.report(
3596 "Time taken for Ping All: " +
3597 str( timeDiff ) +
3598 " seconds" )
3599
GlennRCfa69a2a2015-10-02 15:54:06 -07003600 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003601 utilities.assert_equals(
3602 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003603 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003604 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3605 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003606
GlennRCfa69a2a2015-10-02 15:54:06 -07003607 if not intentState:
3608 main.log.debug( "Intents failed to install completely" )
3609 if not pingResult:
3610 main.log.debug( "Pingall failed" )
3611 if not checkFlowsState:
3612 main.log.debug( "Flows failed to add completely" )
3613
3614 if not caseResult and main.failSwitch:
3615 main.log.report("Stopping test")
3616 main.stop( email=main.emailOnStop )
3617
3618 def CASE95( self ):
3619 """
3620 Install multi-single point intents and verify Ping all works
3621 for Spine topology
3622 """
3623 import copy
3624 import time
3625 main.log.report( "Install multi-single point intents and verify Ping all" )
3626 main.log.report( "___________________________________________" )
3627 main.case( "Install multi-single point intents and Ping all" )
3628 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3629 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3630 intentIdList = []
3631 main.log.info( "MACsDict" + str(main.MACsDict) )
3632 time1 = time.time()
3633 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3634 pool = []
3635 for cli in main.CLIs:
3636 egressDevice = deviceDPIDsCopy[i]
3637 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3638 ingressDeviceList.remove(egressDevice)
3639 if i >= len( deviceDPIDsCopy ):
3640 break
3641 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3642 threadID=main.threadID,
3643 name="addMultipointToSinglepointIntent",
3644 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3645 pool.append(t)
3646 t.start()
3647 i = i + 1
3648 main.threadID = main.threadID + 1
3649 for thread in pool:
3650 thread.join()
3651 intentIdList.append(thread.result)
3652 time2 = time.time()
3653 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3654
3655 main.step("Verify intents are installed")
3656
3657 # Giving onos multiple chances to install intents
3658 for i in range( main.intentCheck ):
3659 if i != 0:
3660 main.log.warn( "Verification failed. Retrying..." )
3661 main.log.info("Waiting for onos to install intents...")
3662 time.sleep( main.checkIntentsDelay )
3663
3664 intentState = main.TRUE
3665 for e in range(int(main.numCtrls)):
3666 main.log.info( "Checking intents on CLI %s" % (e+1) )
3667 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3668 intentState
3669 if not intentState:
3670 main.log.warn( "Not all intents installed" )
3671 if intentState:
3672 break
3673 else:
3674 #Dumping intent summary
3675 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3676
3677 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3678 onpass="INTENTS INSTALLED",
3679 onfail="SOME INTENTS NOT INSTALLED" )
3680
3681 main.step("Verify flows are all added")
3682
3683 for i in range( main.flowCheck ):
3684 if i != 0:
3685 main.log.warn( "verification failed. Retrying..." )
3686 main.log.info( "Waiting for onos to add flows..." )
3687 time.sleep( main.checkFlowsDelay )
3688
3689 flowState = main.TRUE
3690 for cli in main.CLIs:
3691 flowState = cli.checkFlowState()
3692 if not flowState:
3693 main.log.warn( "Not all flows added" )
3694 if flowState:
3695 break
3696 else:
3697 #Dumping summary
3698 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3699
3700 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3701 onpass="FLOWS INSTALLED",
3702 onfail="SOME FLOWS NOT ADDED" )
3703
3704 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003705 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003706 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003707 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3708 if not pingResult:
3709 main.log.warn("First pingall failed. Retrying...")
3710 time.sleep(main.pingSleep)
3711 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003712
3713 time2 = time.time()
3714 timeDiff = round( ( time2 - time1 ), 2 )
3715 main.log.report(
3716 "Time taken for Ping All: " +
3717 str( timeDiff ) +
3718 " seconds" )
3719
3720 caseResult = ( checkFlowsState and pingResult and intentState )
3721 utilities.assert_equals(
3722 expect=main.TRUE,
3723 actual=caseResult,
3724 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3725 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3726
3727 if not intentState:
3728 main.log.debug( "Intents failed to install completely" )
3729 if not pingResult:
3730 main.log.debug( "Pingall failed" )
3731 if not checkFlowsState:
3732 main.log.debug( "Flows failed to add completely" )
3733
3734 if not caseResult and main.failSwitch:
3735 main.log.report("Stopping test")
3736 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003737
3738 def CASE96( self ):
3739 """
3740 Install single-multi point intents and verify Ping all works
3741 for att topology
3742 """
3743 import copy
3744 main.log.report( "Install single-multi point intents and verify Ping all" )
3745 main.log.report( "___________________________________________" )
3746 main.case( "Install single-multi point intents and Ping all" )
3747 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3748 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3749 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003750 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003751 time1 = time.time()
3752 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3753 pool = []
3754 for cli in main.CLIs:
3755 ingressDevice = deviceDPIDsCopy[i]
3756 egressDeviceList = copy.copy(deviceDPIDsCopy)
3757 egressDeviceList.remove(ingressDevice)
3758 if i >= len( deviceDPIDsCopy ):
3759 break
3760 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3761 threadID=main.threadID,
3762 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003763 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003764 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003765 t.start()
3766 i = i + 1
3767 main.threadID = main.threadID + 1
3768 for thread in pool:
3769 thread.join()
3770 intentIdList.append(thread.result)
3771 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003772 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003773
3774 main.step("Verify intents are installed")
3775
GlennRC1dde1712015-10-02 11:03:08 -07003776 # Giving onos multiple chances to install intents
3777 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003778 if i != 0:
3779 main.log.warn( "Verification failed. Retrying..." )
3780 main.log.info("Waiting for onos to install intents...")
3781 time.sleep( main.checkIntentsDelay )
3782
3783 intentState = main.TRUE
3784 for e in range(int(main.numCtrls)):
3785 main.log.info( "Checking intents on CLI %s" % (e+1) )
3786 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3787 intentState
3788 if not intentState:
3789 main.log.warn( "Not all intents installed" )
3790 if intentState:
3791 break
3792 else:
3793 #Dumping intent summary
3794 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3795
GlennRCdb2c8422015-09-29 12:21:59 -07003796 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3797 onpass="INTENTS INSTALLED",
3798 onfail="SOME INTENTS NOT INSTALLED" )
3799
GlennRCfa69a2a2015-10-02 15:54:06 -07003800 main.step("Verify flows are all added")
3801
3802 for i in range( main.flowCheck ):
3803 if i != 0:
3804 main.log.warn( "verification failed. Retrying..." )
3805 main.log.info( "Waiting for onos to add flows..." )
3806 time.sleep( main.checkFlowsDelay )
3807
3808 flowState = main.TRUE
3809 for cli in main.CLIs:
3810 flowState = cli.checkFlowState()
3811 if not flowState:
3812 main.log.warn( "Not all flows added" )
3813 if flowState:
3814 break
3815 else:
3816 #Dumping summary
3817 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3818
3819 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3820 onpass="FLOWS INSTALLED",
3821 onfail="SOME FLOWS NOT ADDED" )
3822
Hari Krishnac195f3b2015-07-08 20:02:24 -07003823 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003824 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003825 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003826 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3827 if not pingResult:
3828 main.log.warn("First pingall failed. Retrying...")
3829 time.sleep(main.pingSleep)
3830 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003831
Hari Krishnac195f3b2015-07-08 20:02:24 -07003832 time2 = time.time()
3833 timeDiff = round( ( time2 - time1 ), 2 )
3834 main.log.report(
3835 "Time taken for Ping All: " +
3836 str( timeDiff ) +
3837 " seconds" )
3838
GlennRCfa69a2a2015-10-02 15:54:06 -07003839 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003840 utilities.assert_equals(
3841 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003842 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003843 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3844 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3845
GlennRCfa69a2a2015-10-02 15:54:06 -07003846 if not intentState:
3847 main.log.debug( "Intents failed to install completely" )
3848 if not pingResult:
3849 main.log.debug( "Pingall failed" )
3850 if not checkFlowsState:
3851 main.log.debug( "Flows failed to add completely" )
3852
3853 if not caseResult and main.failSwitch:
3854 main.log.report("Stopping test")
3855 main.stop( email=main.emailOnStop )
3856
Hari Krishnac195f3b2015-07-08 20:02:24 -07003857 def CASE97( self ):
3858 """
3859 Install single-multi point intents and verify Ping all works
3860 for Chordal topology
3861 """
3862 import copy
3863 main.log.report( "Install single-multi point intents and verify Ping all" )
3864 main.log.report( "___________________________________________" )
3865 main.case( "Install single-multi point intents and Ping all" )
3866 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3867 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3868 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003869 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003870 time1 = time.time()
3871 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3872 pool = []
3873 for cli in main.CLIs:
3874 ingressDevice = deviceDPIDsCopy[i]
3875 egressDeviceList = copy.copy(deviceDPIDsCopy)
3876 egressDeviceList.remove(ingressDevice)
3877 if i >= len( deviceDPIDsCopy ):
3878 break
3879 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3880 threadID=main.threadID,
3881 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003882 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003883 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003884 t.start()
3885 i = i + 1
3886 main.threadID = main.threadID + 1
3887 for thread in pool:
3888 thread.join()
3889 intentIdList.append(thread.result)
3890 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003891 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003892
3893 main.step("Verify intents are installed")
3894
GlennRC1dde1712015-10-02 11:03:08 -07003895 # Giving onos multiple chances to install intents
3896 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003897 if i != 0:
3898 main.log.warn( "Verification failed. Retrying..." )
3899 main.log.info("Waiting for onos to install intents...")
3900 time.sleep( main.checkIntentsDelay )
3901
3902 intentState = main.TRUE
3903 for e in range(int(main.numCtrls)):
3904 main.log.info( "Checking intents on CLI %s" % (e+1) )
3905 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3906 intentState
3907 if not intentState:
3908 main.log.warn( "Not all intents installed" )
3909 if intentState:
3910 break
3911 else:
3912 #Dumping intent summary
3913 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3914
GlennRCdb2c8422015-09-29 12:21:59 -07003915 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3916 onpass="INTENTS INSTALLED",
3917 onfail="SOME INTENTS NOT INSTALLED" )
3918
GlennRCfa69a2a2015-10-02 15:54:06 -07003919 main.step("Verify flows are all added")
3920
3921 for i in range( main.flowCheck ):
3922 if i != 0:
3923 main.log.warn( "verification failed. Retrying..." )
3924 main.log.info( "Waiting for onos to add flows..." )
3925 time.sleep( main.checkFlowsDelay )
3926
3927 flowState = main.TRUE
3928 for cli in main.CLIs:
3929 flowState = cli.checkFlowState()
3930 if not flowState:
3931 main.log.warn( "Not all flows added" )
3932 if flowState:
3933 break
3934 else:
3935 #Dumping summary
3936 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3937
3938 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3939 onpass="FLOWS INSTALLED",
3940 onfail="SOME FLOWS NOT ADDED" )
3941
Hari Krishnac195f3b2015-07-08 20:02:24 -07003942 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003943 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003944 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003945 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3946 if not pingResult:
3947 main.log.warn("First pingall failed. Retrying...")
3948 time.sleep(main.pingSleep)
3949 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003950
Hari Krishnac195f3b2015-07-08 20:02:24 -07003951 time2 = time.time()
3952 timeDiff = round( ( time2 - time1 ), 2 )
3953 main.log.report(
3954 "Time taken for Ping All: " +
3955 str( timeDiff ) +
3956 " seconds" )
3957
GlennRCfa69a2a2015-10-02 15:54:06 -07003958 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003959 utilities.assert_equals(
3960 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003961 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003962 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3963 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3964
GlennRCfa69a2a2015-10-02 15:54:06 -07003965 if not intentState:
3966 main.log.debug( "Intents failed to install completely" )
3967 if not pingResult:
3968 main.log.debug( "Pingall failed" )
3969 if not checkFlowsState:
3970 main.log.debug( "Flows failed to add completely" )
3971
3972 if not caseResult and main.failSwitch:
3973 main.log.report("Stopping test")
3974 main.stop( email=main.emailOnStop )
3975
Hari Krishnac195f3b2015-07-08 20:02:24 -07003976 def CASE98( self ):
3977 """
3978 Install single-multi point intents and verify Ping all works
3979 for Spine topology
3980 """
3981 import copy
3982 main.log.report( "Install single-multi point intents and verify Ping all" )
3983 main.log.report( "___________________________________________" )
3984 main.case( "Install single-multi point intents and Ping all" )
3985 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3986 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3987 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3988 intentIdList = []
3989 MACsDictCopy = {}
3990 for i in range( len( deviceDPIDsCopy ) ):
3991 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3992
GlennRCfa69a2a2015-10-02 15:54:06 -07003993 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3994 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003995 time1 = time.time()
3996 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3997 pool = []
3998 for cli in main.CLIs:
3999 if i >= len( deviceDPIDsCopy ):
4000 break
4001 ingressDevice = deviceDPIDsCopy[i]
4002 egressDeviceList = copy.copy(deviceDPIDsCopy)
4003 egressDeviceList.remove(ingressDevice)
4004 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4005 threadID=main.threadID,
4006 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004007 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004008 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004009 t.start()
4010 i = i + 1
4011 main.threadID = main.threadID + 1
4012 for thread in pool:
4013 thread.join()
4014 intentIdList.append(thread.result)
4015 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004016 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004017
4018 main.step("Verify intents are installed")
4019
GlennRC1dde1712015-10-02 11:03:08 -07004020 # Giving onos multiple chances to install intents
4021 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004022 if i != 0:
4023 main.log.warn( "Verification failed. Retrying..." )
4024 main.log.info("Waiting for onos to install intents...")
4025 time.sleep( main.checkIntentsDelay )
4026
4027 intentState = main.TRUE
4028 for e in range(int(main.numCtrls)):
4029 main.log.info( "Checking intents on CLI %s" % (e+1) )
4030 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4031 intentState
4032 if not intentState:
4033 main.log.warn( "Not all intents installed" )
4034 if intentState:
4035 break
4036 else:
4037 #Dumping intent summary
4038 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4039
GlennRCdb2c8422015-09-29 12:21:59 -07004040 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4041 onpass="INTENTS INSTALLED",
4042 onfail="SOME INTENTS NOT INSTALLED" )
4043
GlennRCfa69a2a2015-10-02 15:54:06 -07004044 main.step("Verify flows are all added")
4045
4046 for i in range( main.flowCheck ):
4047 if i != 0:
4048 main.log.warn( "verification failed. Retrying..." )
4049 main.log.info( "Waiting for onos to add flows..." )
4050 time.sleep( main.checkFlowsDelay )
4051
4052 flowState = main.TRUE
4053 for cli in main.CLIs:
4054 flowState = cli.checkFlowState()
4055 if not flowState:
4056 main.log.warn( "Not all flows added" )
4057 if flowState:
4058 break
4059 else:
4060 #Dumping summary
4061 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4062
4063 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4064 onpass="FLOWS INSTALLED",
4065 onfail="SOME FLOWS NOT ADDED" )
4066
Hari Krishnac195f3b2015-07-08 20:02:24 -07004067 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004068 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004069 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004070 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4071 if not pingResult:
4072 main.log.warn("First pingall failed. Retrying...")
4073 time.sleep(main.pingSleep)
4074 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004075
Hari Krishnac195f3b2015-07-08 20:02:24 -07004076 time2 = time.time()
4077 timeDiff = round( ( time2 - time1 ), 2 )
4078 main.log.report(
4079 "Time taken for Ping All: " +
4080 str( timeDiff ) +
4081 " seconds" )
4082
GlennRCfa69a2a2015-10-02 15:54:06 -07004083 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004084 utilities.assert_equals(
4085 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004086 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004087 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4088 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4089
GlennRCfa69a2a2015-10-02 15:54:06 -07004090 if not intentState:
4091 main.log.debug( "Intents failed to install completely" )
4092 if not pingResult:
4093 main.log.debug( "Pingall failed" )
4094 if not checkFlowsState:
4095 main.log.debug( "Flows failed to add completely" )
4096
4097 if not caseResult and main.failSwitch:
4098 main.log.report("Stopping test")
4099 main.stop( email=main.emailOnStop )
4100
Hari Krishna4223dbd2015-08-13 16:29:53 -07004101 def CASE190( self ):
4102 """
4103 Verify IPv6 ping across 600 Point intents (Att Topology)
4104 """
4105 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4106 main.log.report( "_________________________________________________" )
4107 import itertools
4108 import time
4109 main.case( "IPv6 ping all 600 Point intents" )
4110 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004111 pingResult = main.FALSE
4112 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004113 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004114 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004115 main.log.warn("First pingall failed. Retrying...")
4116 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004117 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004118 time2 = time.time()
4119 timeDiff = round( ( time2 - time1 ), 2 )
4120 main.log.report(
4121 "Time taken for IPv6 Ping All: " +
4122 str( timeDiff ) +
4123 " seconds" )
4124 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4125 onpass="PING ALL PASS",
4126 onfail="PING ALL FAIL" )
4127
GlennRCbddd58f2015-10-01 15:45:25 -07004128 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004129 utilities.assert_equals(
4130 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004131 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004132 onpass="IPv6 Ping across 600 Point intents test PASS",
4133 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4134
4135 def CASE191( self ):
4136 """
4137 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4138 """
4139 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4140 main.log.report( "_________________________________________________" )
4141 import itertools
4142 import time
4143 main.case( "IPv6 ping all 600 Point intents" )
4144 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004145 pingResult = main.FALSE
4146 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004147 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004148 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004149 main.log.warn("First pingall failed. Retrying...")
4150 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004151 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004152 time2 = time.time()
4153 timeDiff = round( ( time2 - time1 ), 2 )
4154 main.log.report(
4155 "Time taken for IPv6 Ping All: " +
4156 str( timeDiff ) +
4157 " seconds" )
4158 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4159 onpass="PING ALL PASS",
4160 onfail="PING ALL FAIL" )
4161
GlennRCbddd58f2015-10-01 15:45:25 -07004162 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004163 utilities.assert_equals(
4164 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004165 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004166 onpass="IPv6 Ping across 600 Point intents test PASS",
4167 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4168
4169 def CASE192( self ):
4170 """
4171 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4172 """
4173 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4174 main.log.report( "_________________________________________________" )
4175 import itertools
4176 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004177 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004178 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004179 pingResult = main.FALSE
4180 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004181 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004182 if not pingResult:
4183 main.log.warn("First pingall failed. Retrying...")
4184 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004185 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004186 time2 = time.time()
4187 timeDiff = round( ( time2 - time1 ), 2 )
4188 main.log.report(
4189 "Time taken for IPv6 Ping All: " +
4190 str( timeDiff ) +
4191 " seconds" )
4192 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4193 onpass="PING ALL PASS",
4194 onfail="PING ALL FAIL" )
4195
GlennRCbddd58f2015-10-01 15:45:25 -07004196 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004197 utilities.assert_equals(
4198 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004199 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004200 onpass="IPv6 Ping across 4556 Point intents test PASS",
4201 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004202
Hari Krishnac195f3b2015-07-08 20:02:24 -07004203 def CASE10( self ):
4204 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004205 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004206 """
4207 Remove all Intents
4208 """
4209 main.log.report( "Remove all intents that were installed previously" )
4210 main.log.report( "______________________________________________" )
4211 main.log.info( "Remove all intents" )
4212 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004213 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004214 main.step( "Obtain the intent id's first" )
4215 intentsList = main.ONOScli1.getAllIntentIds()
4216 ansi_escape = re.compile( r'\x1b[^m]*m' )
4217 intentsList = ansi_escape.sub( '', intentsList )
4218 intentsList = intentsList.replace(
4219 " onos:intents | grep id=",
4220 "" ).replace(
4221 "id=",
4222 "" ).replace(
4223 "\r\r",
4224 "" )
4225 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004226 intentIdList = []
4227 step1Result = main.TRUE
4228 moreIntents = main.TRUE
4229 removeIntentCount = 0
4230 intentsCount = len(intentsList)
4231 main.log.info ( "Current number of intents: " + str(intentsCount) )
4232 if ( len( intentsList ) > 1 ):
4233 results = main.TRUE
4234 main.log.info("Removing intent...")
4235 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004236 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004237 if removeIntentCount == 5:
4238 break
4239 removeIntentCount = removeIntentCount + 1
4240 intentsList1 = main.ONOScli1.getAllIntentIds()
4241 if len( intentsList1 ) == 0:
4242 break
4243 ansi_escape = re.compile( r'\x1b[^m]*m' )
4244 intentsList1 = ansi_escape.sub( '', intentsList1 )
4245 intentsList1 = intentsList1.replace(
4246 " onos:intents | grep id=",
4247 "" ).replace(
4248 " state=",
4249 "" ).replace(
4250 "\r\r",
4251 "" )
4252 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004253 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4254 print intentsList1
4255 intentIdList1 = []
4256 if ( len( intentsList1 ) > 0 ):
4257 moreIntents = main.TRUE
4258 for i in range( len( intentsList1 ) ):
4259 intentsTemp1 = intentsList1[ i ].split( ',' )
4260 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4261 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4262 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4263 time1 = time.time()
4264 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4265 pool = []
4266 for cli in main.CLIs:
4267 if i >= len( intentIdList1 ):
4268 break
4269 t = main.Thread( target=cli.removeIntent,
4270 threadID=main.threadID,
4271 name="removeIntent",
4272 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4273 pool.append(t)
4274 t.start()
4275 i = i + 1
4276 main.threadID = main.threadID + 1
4277 for thread in pool:
4278 thread.join()
4279 intentIdList.append(thread.result)
4280 #time.sleep(2)
4281 time2 = time.time()
4282 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004283 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004284 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004285 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004286 else:
4287 time.sleep(10)
4288 if len( main.ONOScli1.intents()):
4289 continue
4290 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004291 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004292 else:
4293 print "Removed %d intents" %(intentsCount)
4294 step1Result = main.TRUE
4295 else:
4296 print "No Intent IDs found in Intents list: ", intentsList
4297 step1Result = main.FALSE
4298
4299 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004300 caseResult = step1Result
4301 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004302 onpass="Intent removal test successful",
4303 onfail="Intent removal test failed" )
4304
4305 def CASE12( self, main ):
4306 """
4307 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4308 """
4309 import re
4310 import copy
4311 import time
4312
Hari Krishnac195f3b2015-07-08 20:02:24 -07004313 threadID = 0
4314
4315 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4316 main.log.report( "_____________________________________________________" )
4317 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4318 main.step( "Enable intent based Reactive forwarding" )
4319 installResult = main.FALSE
4320 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004321
Hari Krishnac195f3b2015-07-08 20:02:24 -07004322 pool = []
4323 time1 = time.time()
4324 for cli,feature in main.CLIs:
4325 t = main.Thread(target=cli,threadID=threadID,
4326 name="featureInstall",args=[feature])
4327 pool.append(t)
4328 t.start()
4329 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004330
Hari Krishnac195f3b2015-07-08 20:02:24 -07004331 results = []
4332 for thread in pool:
4333 thread.join()
4334 results.append(thread.result)
4335 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004336
Hari Krishnac195f3b2015-07-08 20:02:24 -07004337 if( all(result == main.TRUE for result in results) == False):
4338 main.log.info("Did not install onos-app-ifwd feature properly")
4339 #main.cleanup()
4340 #main.exit()
4341 else:
4342 main.log.info("Successful feature:install onos-app-ifwd")
4343 installResult = main.TRUE
4344 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004345
GlennRC6ac11b12015-10-21 17:41:28 -07004346 main.step( "Verify Ping across all hosts" )
4347 for i in range(main.numPings):
4348 time1 = time.time()
4349 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4350 if not pingResult:
4351 main.log.warn("First pingall failed. Retrying...")
4352 time.sleep(main.pingSleep)
4353 else: break
4354
Hari Krishnac195f3b2015-07-08 20:02:24 -07004355 time2 = time.time()
4356 timeDiff = round( ( time2 - time1 ), 2 )
4357 main.log.report(
4358 "Time taken for Ping All: " +
4359 str( timeDiff ) +
4360 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004361
GlennRC626ba132015-09-18 16:16:31 -07004362 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004363 main.log.report( "Pingall Test in Reactive mode successful" )
4364 else:
4365 main.log.report( "Pingall Test in Reactive mode failed" )
4366
4367 main.step( "Disable Intent based Reactive forwarding" )
4368 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004369
Hari Krishnac195f3b2015-07-08 20:02:24 -07004370 pool = []
4371 time1 = time.time()
4372 for cli,feature in main.CLIs:
4373 t = main.Thread(target=cli,threadID=threadID,
4374 name="featureUninstall",args=[feature])
4375 pool.append(t)
4376 t.start()
4377 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004378
Hari Krishnac195f3b2015-07-08 20:02:24 -07004379 results = []
4380 for thread in pool:
4381 thread.join()
4382 results.append(thread.result)
4383 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004384
Hari Krishnac195f3b2015-07-08 20:02:24 -07004385 if( all(result == main.TRUE for result in results) == False):
4386 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4387 uninstallResult = main.FALSE
4388 #main.cleanup()
4389 #main.exit()
4390 else:
4391 main.log.info("Successful feature:uninstall onos-app-ifwd")
4392 uninstallResult = main.TRUE
4393 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4394
4395 # Waiting for reative flows to be cleared.
4396 time.sleep( 10 )
4397
GlennRCbddd58f2015-10-01 15:45:25 -07004398 caseResult = installResult and pingResult and uninstallResult
4399 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004400 onpass="Intent based Reactive forwarding Pingall test PASS",
4401 onfail="Intent based Reactive forwarding Pingall test FAIL" )