blob: c3966c5764188dd2d2cb5c5b5ba097a7422a7f5a [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
GlennRC026dba62016-01-07 18:42:33 -0800699 def CASE47( self, main ):
700 import time
701 main.log.report( "Verify Reactive forwarding" )
702 main.log.report( "______________________________________________" )
703 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
704
705 main.step( "Enable Reactive forwarding" )
706 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
707 utilities.assert_equals( expect=main.TRUE, actual=appResult,
708 onpass="Successfully install fwd app",
709 onfail="Failed to install fwd app" )
710
711 numHosts = int( main.params['TOPO1']['numHosts'] )
712 wait = 1
713
714 for i in range(numHosts):
715 src = "h1"
716 dest = "h" + str(i+1)
717 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
718 main.Mininet1.handle.expect( "mininet>" )
719 main.log.info( main.Mininet1.handle.before )
720
721 hosts = main.CLIs[0].hosts( jsonFormat=False )
722
723 main.log.info( hosts )
724
725 main.step( "Disable Reactive forwarding" )
726 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
727 utilities.assert_equals( expect=main.TRUE, actual=appResult,
728 onpass="Successfully deactivated fwd app",
729 onfail="Failed to deactivate fwd app" )
730
731 def CASE48( self, main ):
732 import time
733 main.log.report( "Verify Reactive forwarding" )
734 main.log.report( "______________________________________________" )
735 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
736
737 main.step( "Enable Reactive forwarding" )
738 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
739 utilities.assert_equals( expect=main.TRUE, actual=appResult,
740 onpass="Successfully install fwd app",
741 onfail="Failed to install fwd app" )
742
743 numHosts = int( main.params['TOPO2']['numHosts'] )
744 wait = 1
745
746 for i in range(numHosts):
747 src = "h1"
748 dest = "h" + str(i+1)
749 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
750 main.Mininet1.handle.expect( "mininet>" )
751 main.log.info( main.Mininet1.handle.before )
752
753 hosts = main.CLIs[0].hosts( jsonFormat=False )
754
755 main.log.info( hosts )
756
757 main.step( "Disable Reactive forwarding" )
758 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
759 utilities.assert_equals( expect=main.TRUE, actual=appResult,
760 onpass="Successfully deactivated fwd app",
761 onfail="Failed to deactivate fwd app" )
762
763 def CASE49( self, main ):
764 import time
765 main.log.report( "Verify Reactive forwarding" )
766 main.log.report( "______________________________________________" )
767 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
768
769 main.step( "Enable Reactive forwarding" )
770 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
771 utilities.assert_equals( expect=main.TRUE, actual=appResult,
772 onpass="Successfully install fwd app",
773 onfail="Failed to install fwd app" )
774
775 numHosts = int( main.params['TOPO3']['numHosts'] )
776 wait = 1
777
778 for i in range(12, numHosts+11):
779 src = "h11"
780 dest = "h" + str(i)
781 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
782 main.Mininet1.handle.expect( "mininet>" )
783 main.log.info( main.Mininet1.handle.before )
784
785 hosts = main.CLIs[0].hosts( jsonFormat=False )
786
787 main.log.info( hosts )
788
789 main.step( "Disable Reactive forwarding" )
790 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
791 utilities.assert_equals( expect=main.TRUE, actual=appResult,
792 onpass="Successfully deactivated fwd app",
793 onfail="Failed to deactivate fwd app" )
794
Hari Krishna4223dbd2015-08-13 16:29:53 -0700795 def CASE140( self, main ):
796 """
797 Verify IPv6 Reactive forwarding (Att Topology)
798 """
799 import re
800 import copy
801 import time
802 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
803 main.log.report( "______________________________________________" )
804 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
805 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
806
807 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
808 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
809 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
810 cfgResult = cfgResult1 and cfgResult2
811 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
812 onpass="Reactive mode ipv6Fowarding cfg is set to true",
813 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
814
815 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700816 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700817 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700818 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
819 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700820 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700821 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700822 time2 = time.time()
823 timeDiff = round( ( time2 - time1 ), 2 )
824 main.log.report(
825 "Time taken for IPv6 Ping All: " +
826 str( timeDiff ) +
827 " seconds" )
828
GlennRC626ba132015-09-18 16:16:31 -0700829 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700830 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
831 else:
832 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700833
Jon Hall4ba53f02015-07-29 13:07:41 -0700834
GlennRC15d164c2015-12-15 17:12:25 -0800835 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700836 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700837 onpass="Reactive Mode IPv6 Pingall test PASS",
838 onfail="Reactive Mode IPv6 Pingall test FAIL" )
839
840 def CASE141( self, main ):
841 """
842 Verify IPv6 Reactive forwarding (Chordal Topology)
843 """
844 import re
845 import copy
846 import time
847 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
848 main.log.report( "______________________________________________" )
849 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
850 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
851
852 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
853 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
854 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
855 cfgResult = cfgResult1 and cfgResult2
856 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
857 onpass="Reactive mode ipv6Fowarding cfg is set to true",
858 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
859
860 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700861 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700862 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700863 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
864 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700865 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700866 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700867 time2 = time.time()
868 timeDiff = round( ( time2 - time1 ), 2 )
869 main.log.report(
870 "Time taken for IPv6 Ping All: " +
871 str( timeDiff ) +
872 " seconds" )
873
GlennRC626ba132015-09-18 16:16:31 -0700874 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700875 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
876 else:
877 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
878
879 main.step( "Disable Reactive forwarding" )
880
881 main.log.info( "Uninstall reactive forwarding app" )
882 appCheck = main.TRUE
883 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
884 pool = []
885 for cli in main.CLIs:
886 t = main.Thread( target=cli.appToIDCheck,
887 name="appToIDCheck-" + str( i ),
888 args=[] )
889 pool.append( t )
890 t.start()
891
892 for t in pool:
893 t.join()
894 appCheck = appCheck and t.result
895 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
896 onpass="App Ids seem to be correct",
897 onfail="Something is wrong with app Ids" )
898 if appCheck != main.TRUE:
899 main.log.warn( main.CLIs[0].apps() )
900 main.log.warn( main.CLIs[0].appIDs() )
901
902 # Waiting for reative flows to be cleared.
903 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700904 caseResult = appCheck and cfgResult and pingResult
905 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700906 onpass="Reactive Mode IPv6 Pingall test PASS",
907 onfail="Reactive Mode IPv6 Pingall test FAIL" )
908
909 def CASE142( self, main ):
910 """
911 Verify IPv6 Reactive forwarding (Spine Topology)
912 """
913 import re
914 import copy
915 import time
916 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
917 main.log.report( "______________________________________________" )
918 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
919 # Spine topology do not have hosts h1-h10
920 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
921 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
922 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
923 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
924 cfgResult = cfgResult1 and cfgResult2
925 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
926 onpass="Reactive mode ipv6Fowarding cfg is set to true",
927 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
928
929 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700930 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700931 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700932 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
933 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700934 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700935 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700936 time2 = time.time()
937 timeDiff = round( ( time2 - time1 ), 2 )
938 main.log.report(
939 "Time taken for IPv6 Ping All: " +
940 str( timeDiff ) +
941 " seconds" )
942
GlennRC626ba132015-09-18 16:16:31 -0700943 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700944 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
945 else:
946 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
947
948 main.step( "Disable Reactive forwarding" )
949
950 main.log.info( "Uninstall reactive forwarding app" )
951 appCheck = main.TRUE
952 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
953 pool = []
954 for cli in main.CLIs:
955 t = main.Thread( target=cli.appToIDCheck,
956 name="appToIDCheck-" + str( i ),
957 args=[] )
958 pool.append( t )
959 t.start()
960
961 for t in pool:
962 t.join()
963 appCheck = appCheck and t.result
964 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
965 onpass="App Ids seem to be correct",
966 onfail="Something is wrong with app Ids" )
967 if appCheck != main.TRUE:
968 main.log.warn( main.CLIs[0].apps() )
969 main.log.warn( main.CLIs[0].appIDs() )
970
971 # Waiting for reative flows to be cleared.
972 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700973 caseResult = appCheck and cfgResult and pingResult
974 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700975 onpass="Reactive Mode IPv6 Pingall test PASS",
976 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700977
978 def CASE5( self, main ):
979 """
980 Compare current ONOS topology with reference data
981 """
982 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700983
Hari Krishnac195f3b2015-07-08 20:02:24 -0700984 devicesDPIDTemp = []
985 hostMACsTemp = []
986 deviceLinksTemp = []
987 deviceActiveLinksCountTemp = []
988 devicePortsEnabledCountTemp = []
989
990 main.log.report(
991 "Compare ONOS topology with reference data in Stores" )
992 main.log.report( "__________________________________________________" )
993 main.case( "Compare ONOS topology with reference data" )
994
995 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700996
GlennRC289c1b62015-12-12 10:45:43 -0800997 for check in range(main.topoCheck):
998 time1 = time.time()
999 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
1000 pool = []
1001 for cli in main.CLIs:
1002 if i >= main.numMNswitches + 1:
1003 break
GlennRC20fc6522015-12-23 23:26:57 -08001004 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001005 t = main.Thread(target = cli.getDevicePortsEnabledCount,
1006 threadID = main.threadID,
1007 name = "getDevicePortsEnabledCount",
1008 args = [dpid])
1009 t.start()
1010 pool.append(t)
1011 i = i + 1
1012 main.threadID = main.threadID + 1
1013 for thread in pool:
1014 thread.join()
1015 portResult = thread.result
1016 #portTemp = re.split( r'\t+', portResult )
1017 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1018 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001019
GlennRC289c1b62015-12-12 10:45:43 -08001020 time2 = time.time()
1021 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
1022 main.log.info (
1023 "Device Enabled ports EXPECTED: %s" %
1024 str( main.devicePortsEnabledCount ) )
1025 main.log.info (
1026 "Device Enabled ports ACTUAL: %s" %
1027 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001028
GlennRC289c1b62015-12-12 10:45:43 -08001029 if ( cmp( main.devicePortsEnabledCount,
1030 devicePortsEnabledCountTemp ) == 0 ):
1031 stepResult1 = main.TRUE
1032 else:
1033 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001034
GlennRC289c1b62015-12-12 10:45:43 -08001035 main.step( "Compare Device active links with reference" )
1036 time1 = time.time()
1037 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
1038 pool = []
1039 for cli in main.CLIs:
1040 if i >= main.numMNswitches + 1:
1041 break
GlennRC20fc6522015-12-23 23:26:57 -08001042 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001043 t = main.Thread(target = cli.getDeviceLinksActiveCount,
1044 threadID = main.threadID,
1045 name = "getDeviceLinksActiveCount",
1046 args = [dpid])
1047 t.start()
1048 pool.append(t)
1049 i = i + 1
1050 main.threadID = main.threadID + 1
1051 for thread in pool:
1052 thread.join()
1053 linkCountResult = thread.result
1054 #linkCountTemp = re.split( r'\t+', linkCountResult )
1055 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1056 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001057
GlennRC289c1b62015-12-12 10:45:43 -08001058 time2 = time.time()
1059 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
1060 main.log.info (
1061 "Device Active links EXPECTED: %s" %
1062 str( main.deviceActiveLinksCount ) )
1063 main.log.info (
1064 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1065 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1066 stepResult2 = main.TRUE
1067 else:
1068 stepResult2 = main.FALSE
1069
1070 """
1071 place holder for comparing devices, hosts, paths and intents if required.
1072 Links and ports data would be incorrect with out devices anyways.
1073 """
1074 caseResult = ( stepResult1 and stepResult2 )
1075
1076 if caseResult:
1077 break
1078 else:
1079 time.sleep( main.topoCheckDelay )
1080 main.log.warn( "Topology check failed. Trying again..." )
1081
1082
1083 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001084 onpass="Compare Topology test PASS",
1085 onfail="Compare Topology test FAIL" )
1086
1087 def CASE60( self ):
1088 """
1089 Install 300 host intents and verify ping all (Att Topology)
1090 """
1091 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1092 main.log.report( "_______________________________________" )
1093 import itertools
1094 import time
1095 main.case( "Install 300 host intents" )
1096 main.step( "Add host Intents" )
1097 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001098 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1099
Hari Krishnac195f3b2015-07-08 20:02:24 -07001100 intentIdList = []
1101 time1 = time.time()
1102 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1103 pool = []
1104 for cli in main.CLIs:
1105 if i >= len( hostCombos ):
1106 break
1107 t = main.Thread( target=cli.addHostIntent,
1108 threadID=main.threadID,
1109 name="addHostIntent",
1110 args=[hostCombos[i][0],hostCombos[i][1]])
1111 pool.append(t)
1112 t.start()
1113 i = i + 1
1114 main.threadID = main.threadID + 1
1115 for thread in pool:
1116 thread.join()
1117 intentIdList.append(thread.result)
1118 time2 = time.time()
1119 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1120
GlennRCfcfdc4f2015-09-30 16:01:57 -07001121 # Saving intent ids to check intents in later cases
1122 main.intentIds = list(intentIdList)
1123
GlennRCa8d786a2015-09-23 17:40:11 -07001124 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001125
GlennRC1dde1712015-10-02 11:03:08 -07001126 # Giving onos multiple chances to install intents
1127 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001128 if i != 0:
1129 main.log.warn( "Verification failed. Retrying..." )
1130 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001131 time.sleep( main.checkIntentsDelay )
1132
1133 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001134 for e in range(int(main.numCtrls)):
1135 main.log.info( "Checking intents on CLI %s" % (e+1) )
1136 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1137 intentState
1138 if not intentState:
1139 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001140 if intentState:
1141 break
GlennRCdb2c8422015-09-29 12:21:59 -07001142 else:
1143 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001144 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001145
GlennRCa8d786a2015-09-23 17:40:11 -07001146
1147 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1148 onpass="INTENTS INSTALLED",
1149 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001150
1151 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001152 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001153 time1 = time.time()
1154 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001155 if not pingResult:
1156 main.log.warn("First pingall failed. Retrying...")
1157 time.sleep(3)
1158 else: break
1159
Hari Krishnac195f3b2015-07-08 20:02:24 -07001160 time2 = time.time()
1161 timeDiff = round( ( time2 - time1 ), 2 )
1162 main.log.report(
1163 "Time taken for Ping All: " +
1164 str( timeDiff ) +
1165 " seconds" )
1166 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1167 onpass="PING ALL PASS",
1168 onfail="PING ALL FAIL" )
1169
GlennRCbddd58f2015-10-01 15:45:25 -07001170 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001171 utilities.assert_equals(
1172 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001173 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001174 onpass="Install 300 Host Intents and Ping All test PASS",
1175 onfail="Install 300 Host Intents and Ping All test FAIL" )
1176
GlennRCfcfdc4f2015-09-30 16:01:57 -07001177 if not intentState:
1178 main.log.debug( "Intents failed to install completely" )
1179 if not pingResult:
1180 main.log.debug( "Pingall failed" )
1181
GlennRCbddd58f2015-10-01 15:45:25 -07001182 if not caseResult and main.failSwitch:
1183 main.log.report("Stopping test")
1184 main.stop( email=main.emailOnStop )
1185
Hari Krishnac195f3b2015-07-08 20:02:24 -07001186 def CASE61( self ):
1187 """
1188 Install 600 host intents and verify ping all for Chordal Topology
1189 """
1190 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1191 main.log.report( "_______________________________________" )
1192 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001193
Hari Krishnac195f3b2015-07-08 20:02:24 -07001194 main.case( "Install 600 host intents" )
1195 main.step( "Add host Intents" )
1196 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001197 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1198
Hari Krishnac195f3b2015-07-08 20:02:24 -07001199 intentIdList = []
1200 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001201
Hari Krishnac195f3b2015-07-08 20:02:24 -07001202 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1203 pool = []
1204 for cli in main.CLIs:
1205 if i >= len( hostCombos ):
1206 break
1207 t = main.Thread( target=cli.addHostIntent,
1208 threadID=main.threadID,
1209 name="addHostIntent",
1210 args=[hostCombos[i][0],hostCombos[i][1]])
1211 pool.append(t)
1212 t.start()
1213 i = i + 1
1214 main.threadID = main.threadID + 1
1215 for thread in pool:
1216 thread.join()
1217 intentIdList.append(thread.result)
1218 time2 = time.time()
1219 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001220
GlennRCfcfdc4f2015-09-30 16:01:57 -07001221 # Saving intent ids to check intents in later cases
1222 main.intentIds = list(intentIdList)
1223
GlennRCa8d786a2015-09-23 17:40:11 -07001224 main.step("Verify intents are installed")
1225
GlennRC1dde1712015-10-02 11:03:08 -07001226 # Giving onos multiple chances to install intents
1227 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001228 if i != 0:
1229 main.log.warn( "Verification failed. Retrying..." )
1230 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001231 time.sleep( main.checkIntentsDelay )
1232
1233 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001234 for e in range(int(main.numCtrls)):
1235 main.log.info( "Checking intents on CLI %s" % (e+1) )
1236 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1237 intentState
1238 if not intentState:
1239 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001240 if intentState:
1241 break
GlennRCdb2c8422015-09-29 12:21:59 -07001242 else:
1243 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001244 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001245
1246 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1247 onpass="INTENTS INSTALLED",
1248 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001249
1250 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001251 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001252 time1 = time.time()
1253 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001254 if not pingResult:
1255 main.log.warn("First pingall failed. Retrying...")
1256 time.sleep(main.pingSleep)
1257 else: break
1258
Hari Krishnac195f3b2015-07-08 20:02:24 -07001259 time2 = time.time()
1260 timeDiff = round( ( time2 - time1 ), 2 )
1261 main.log.report(
1262 "Time taken for Ping All: " +
1263 str( timeDiff ) +
1264 " seconds" )
1265 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1266 onpass="PING ALL PASS",
1267 onfail="PING ALL FAIL" )
1268
GlennRCbddd58f2015-10-01 15:45:25 -07001269 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001270
Hari Krishnac195f3b2015-07-08 20:02:24 -07001271 utilities.assert_equals(
1272 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001273 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001274 onpass="Install 300 Host Intents and Ping All test PASS",
1275 onfail="Install 300 Host Intents and Ping All test FAIL" )
1276
GlennRCfcfdc4f2015-09-30 16:01:57 -07001277 if not intentState:
1278 main.log.debug( "Intents failed to install completely" )
1279 if not pingResult:
1280 main.log.debug( "Pingall failed" )
1281
GlennRCbddd58f2015-10-01 15:45:25 -07001282 if not caseResult and main.failSwitch:
1283 main.log.report("Stopping test")
1284 main.stop( email=main.emailOnStop )
1285
Hari Krishnac195f3b2015-07-08 20:02:24 -07001286 def CASE62( self ):
1287 """
1288 Install 2278 host intents and verify ping all for Spine Topology
1289 """
1290 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1291 main.log.report( "_______________________________________" )
1292 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001293
Hari Krishnac195f3b2015-07-08 20:02:24 -07001294 main.case( "Install 2278 host intents" )
1295 main.step( "Add host Intents" )
1296 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001297 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001298 main.pingTimeout = 300
1299 intentIdList = []
1300 time1 = time.time()
1301 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1302 pool = []
1303 for cli in main.CLIs:
1304 if i >= len( hostCombos ):
1305 break
1306 t = main.Thread( target=cli.addHostIntent,
1307 threadID=main.threadID,
1308 name="addHostIntent",
1309 args=[hostCombos[i][0],hostCombos[i][1]])
1310 pool.append(t)
1311 t.start()
1312 i = i + 1
1313 main.threadID = main.threadID + 1
1314 for thread in pool:
1315 thread.join()
1316 intentIdList.append(thread.result)
1317 time2 = time.time()
1318 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001319
GlennRCfcfdc4f2015-09-30 16:01:57 -07001320 # Saving intent ids to check intents in later cases
1321 main.intentIds = list(intentIdList)
1322
GlennRCa8d786a2015-09-23 17:40:11 -07001323 main.step("Verify intents are installed")
1324
GlennRC1dde1712015-10-02 11:03:08 -07001325 # Giving onos multiple chances to install intents
1326 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001327 if i != 0:
1328 main.log.warn( "Verification failed. Retrying..." )
1329 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001330 time.sleep( main.checkIntentsDelay )
1331
1332 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001333 for e in range(int(main.numCtrls)):
1334 main.log.info( "Checking intents on CLI %s" % (e+1) )
1335 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1336 intentState
1337 if not intentState:
1338 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001339 if intentState:
1340 break
GlennRCdb2c8422015-09-29 12:21:59 -07001341 else:
1342 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001343 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001344
1345 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1346 onpass="INTENTS INSTALLED",
1347 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001348
1349 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001350 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001351 time1 = time.time()
1352 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001353 if not pingResult:
1354 main.log.warn("First pingall failed. Retrying...")
1355 time.sleep(main.pingSleep)
1356 else: break
1357
Hari Krishnac195f3b2015-07-08 20:02:24 -07001358 time2 = time.time()
1359 timeDiff = round( ( time2 - time1 ), 2 )
1360 main.log.report(
1361 "Time taken for Ping All: " +
1362 str( timeDiff ) +
1363 " seconds" )
1364 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1365 onpass="PING ALL PASS",
1366 onfail="PING ALL FAIL" )
1367
GlennRCbddd58f2015-10-01 15:45:25 -07001368 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001369
Hari Krishnac195f3b2015-07-08 20:02:24 -07001370 utilities.assert_equals(
1371 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001372 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001373 onpass="Install 2278 Host Intents and Ping All test PASS",
1374 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1375
GlennRCfcfdc4f2015-09-30 16:01:57 -07001376 if not intentState:
1377 main.log.debug( "Intents failed to install completely" )
1378 if not pingResult:
1379 main.log.debug( "Pingall failed" )
1380
GlennRCbddd58f2015-10-01 15:45:25 -07001381 if not caseResult and main.failSwitch:
1382 main.log.report("Stopping test")
1383 main.stop( email=main.emailOnStop )
1384
Hari Krishna4223dbd2015-08-13 16:29:53 -07001385 def CASE160( self ):
1386 """
1387 Verify IPv6 ping across 300 host intents (Att Topology)
1388 """
1389 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1390 main.log.report( "_________________________________________________" )
1391 import itertools
1392 import time
1393 main.case( "IPv6 ping all 300 host intents" )
1394 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001395 pingResult = main.FALSE
1396 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001397 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001398 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001399 main.log.warn("First pingall failed. Retrying...")
1400 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001401 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001402 time2 = time.time()
1403 timeDiff = round( ( time2 - time1 ), 2 )
1404 main.log.report(
1405 "Time taken for IPv6 Ping All: " +
1406 str( timeDiff ) +
1407 " seconds" )
1408 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1409 onpass="PING ALL PASS",
1410 onfail="PING ALL FAIL" )
1411
GlennRCbddd58f2015-10-01 15:45:25 -07001412 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001413 utilities.assert_equals(
1414 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001415 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001416 onpass="IPv6 Ping across 300 host intents test PASS",
1417 onfail="IPv6 Ping across 300 host intents test FAIL" )
1418
1419 def CASE161( self ):
1420 """
1421 Verify IPv6 ping across 600 host intents (Chordal Topology)
1422 """
1423 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1424 main.log.report( "_________________________________________________" )
1425 import itertools
1426 import time
1427 main.case( "IPv6 ping all 600 host intents" )
1428 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001429 pingResult = main.FALSE
1430 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001431 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001432 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001433 main.log.warn("First pingall failed. Retrying...")
1434 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001435 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001436 time2 = time.time()
1437 timeDiff = round( ( time2 - time1 ), 2 )
1438 main.log.report(
1439 "Time taken for IPv6 Ping All: " +
1440 str( timeDiff ) +
1441 " seconds" )
1442 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1443 onpass="PING ALL PASS",
1444 onfail="PING ALL FAIL" )
1445
GlennRCbddd58f2015-10-01 15:45:25 -07001446 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001447 utilities.assert_equals(
1448 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001449 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001450 onpass="IPv6 Ping across 600 host intents test PASS",
1451 onfail="IPv6 Ping across 600 host intents test FAIL" )
1452
1453 def CASE162( self ):
1454 """
1455 Verify IPv6 ping across 2278 host intents (Spine Topology)
1456 """
1457 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1458 main.log.report( "_________________________________________________" )
1459 import itertools
1460 import time
1461 main.case( "IPv6 ping all 600 host intents" )
1462 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001463 pingResult = main.FALSE
1464 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001465 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001466 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001467 main.log.warn("First pingall failed. Retrying...")
1468 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001469 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001470 time2 = time.time()
1471 timeDiff = round( ( time2 - time1 ), 2 )
1472 main.log.report(
1473 "Time taken for IPv6 Ping All: " +
1474 str( timeDiff ) +
1475 " seconds" )
1476 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1477 onpass="PING ALL PASS",
1478 onfail="PING ALL FAIL" )
1479
GlennRCbddd58f2015-10-01 15:45:25 -07001480 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001481 utilities.assert_equals(
1482 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001483 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001484 onpass="IPv6 Ping across 600 host intents test PASS",
1485 onfail="IPv6 Ping across 600 host intents test FAIL" )
1486
Hari Krishnac195f3b2015-07-08 20:02:24 -07001487 def CASE70( self, main ):
1488 """
1489 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1490 """
1491 import random
1492 main.randomLink1 = []
1493 main.randomLink2 = []
1494 main.randomLink3 = []
1495 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1496 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1497 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1498 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1499 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1500 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1501 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1502 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1503
1504 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1505 main.log.report( "___________________________________________________________________________" )
1506 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1507 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1508 if ( int( switchLinksToToggle ) ==
1509 0 or int( switchLinksToToggle ) > 5 ):
1510 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1511 #main.cleanup()
1512 #main.exit()
1513 else:
1514 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1515
1516 main.step( "Cut links on Core devices using user provided range" )
1517 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1518 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1519 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1520 for i in range( int( switchLinksToToggle ) ):
1521 main.Mininet1.link(
1522 END1=link1End1,
1523 END2=main.randomLink1[ i ],
1524 OPTION="down" )
1525 time.sleep( link_sleep )
1526 main.Mininet1.link(
1527 END1=link2End1,
1528 END2=main.randomLink2[ i ],
1529 OPTION="down" )
1530 time.sleep( link_sleep )
1531 main.Mininet1.link(
1532 END1=link3End1,
1533 END2=main.randomLink3[ i ],
1534 OPTION="down" )
1535 time.sleep( link_sleep )
1536
Hari Krishna6185fc12015-07-13 15:42:31 -07001537 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001538 linkDown = main.ONOSbench.checkStatus(
1539 topology_output, main.numMNswitches, str(
1540 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1541 utilities.assert_equals(
1542 expect=main.TRUE,
1543 actual=linkDown,
1544 onpass="Link Down discovered properly",
1545 onfail="Link down was not discovered in " +
1546 str( link_sleep ) +
1547 " seconds" )
1548
GlennRCfcfdc4f2015-09-30 16:01:57 -07001549 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001550 # Giving onos multiple chances to install intents
1551 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001552 if i != 0:
1553 main.log.warn( "Verification failed. Retrying..." )
1554 main.log.info("Giving onos some time...")
1555 time.sleep( main.checkIntentsDelay )
1556
1557 intentState = main.TRUE
1558 for e in range(int(main.numCtrls)):
1559 main.log.info( "Checking intents on CLI %s" % (e+1) )
1560 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1561 intentState
1562 if not intentState:
1563 main.log.warn( "Not all intents installed" )
1564 if intentState:
1565 break
1566 else:
1567 #Dumping intent summary
1568 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1569
1570
1571 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1572 onpass="INTENTS INSTALLED",
1573 onfail="SOME INTENTS NOT INSTALLED" )
1574
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001576 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001577 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001578 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1579 if not pingResult:
1580 main.log.warn("First pingall failed. Retrying...")
1581 time.sleep(main.pingSleep)
1582 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001583
Hari Krishnac195f3b2015-07-08 20:02:24 -07001584 time2 = time.time()
1585 timeDiff = round( ( time2 - time1 ), 2 )
1586 main.log.report(
1587 "Time taken for Ping All: " +
1588 str( timeDiff ) +
1589 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001590 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591 onpass="PING ALL PASS",
1592 onfail="PING ALL FAIL" )
1593
GlennRCbddd58f2015-10-01 15:45:25 -07001594 caseResult = linkDown and pingResult and intentState
1595 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001596 onpass="Random Link cut Test PASS",
1597 onfail="Random Link cut Test FAIL" )
1598
GlennRCfcfdc4f2015-09-30 16:01:57 -07001599 # Printing what exactly failed
1600 if not linkDown:
1601 main.log.debug( "Link down was not discovered correctly" )
1602 if not pingResult:
1603 main.log.debug( "Pingall failed" )
1604 if not intentState:
1605 main.log.debug( "Intents are not all installed" )
1606
GlennRCbddd58f2015-10-01 15:45:25 -07001607 if not caseResult and main.failSwitch:
1608 main.log.report("Stopping test")
1609 main.stop( email=main.emailOnStop )
1610
Hari Krishnac195f3b2015-07-08 20:02:24 -07001611 def CASE80( self, main ):
1612 """
1613 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1614 """
1615 import random
1616 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1617 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1618 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1619 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1620 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1621
1622 main.log.report(
1623 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1624 main.log.report(
1625 "__________________________________________________________________" )
1626 main.case(
1627 "Host intents - Bring the core links up that are down and verify ping all" )
1628 main.step( "Bring randomly cut links on Core devices up" )
1629 for i in range( int( switchLinksToToggle ) ):
1630 main.Mininet1.link(
1631 END1=link1End1,
1632 END2=main.randomLink1[ i ],
1633 OPTION="up" )
1634 time.sleep( link_sleep )
1635 main.Mininet1.link(
1636 END1=link2End1,
1637 END2=main.randomLink2[ i ],
1638 OPTION="up" )
1639 time.sleep( link_sleep )
1640 main.Mininet1.link(
1641 END1=link3End1,
1642 END2=main.randomLink3[ i ],
1643 OPTION="up" )
1644 time.sleep( link_sleep )
1645
Hari Krishna6185fc12015-07-13 15:42:31 -07001646 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001647 linkUp = main.ONOSbench.checkStatus(
1648 topology_output,
1649 main.numMNswitches,
1650 str( main.numMNlinks ) )
1651 utilities.assert_equals(
1652 expect=main.TRUE,
1653 actual=linkUp,
1654 onpass="Link up discovered properly",
1655 onfail="Link up was not discovered in " +
1656 str( link_sleep ) +
1657 " seconds" )
1658
GlennRCfcfdc4f2015-09-30 16:01:57 -07001659 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001660 # Giving onos multiple chances to install intents
1661 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001662 if i != 0:
1663 main.log.warn( "Verification failed. Retrying..." )
1664 main.log.info("Giving onos some time...")
1665 time.sleep( main.checkIntentsDelay )
1666
1667 intentState = main.TRUE
1668 for e in range(int(main.numCtrls)):
1669 main.log.info( "Checking intents on CLI %s" % (e+1) )
1670 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1671 intentState
1672 if not intentState:
1673 main.log.warn( "Not all intents installed" )
1674 if intentState:
1675 break
1676 else:
1677 #Dumping intent summary
1678 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1679
1680
1681 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1682 onpass="INTENTS INSTALLED",
1683 onfail="SOME INTENTS NOT INSTALLED" )
1684
Hari Krishnac195f3b2015-07-08 20:02:24 -07001685 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001686 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001687 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001688 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1689 if not pingResult:
1690 main.log.warn("First pingall failed. Retrying...")
1691 time.sleep(main.pingSleep)
1692 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001693
Hari Krishnac195f3b2015-07-08 20:02:24 -07001694 time2 = time.time()
1695 timeDiff = round( ( time2 - time1 ), 2 )
1696 main.log.report(
1697 "Time taken for Ping All: " +
1698 str( timeDiff ) +
1699 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001700 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001701 onpass="PING ALL PASS",
1702 onfail="PING ALL FAIL" )
1703
GlennRCbddd58f2015-10-01 15:45:25 -07001704 caseResult = linkUp and pingResult
1705 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001706 onpass="Link Up Test PASS",
1707 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001708 # Printing what exactly failed
1709 if not linkUp:
1710 main.log.debug( "Link down was not discovered correctly" )
1711 if not pingResult:
1712 main.log.debug( "Pingall failed" )
1713 if not intentState:
1714 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001715
GlennRCbddd58f2015-10-01 15:45:25 -07001716 if not caseResult and main.failSwitch:
1717 main.log.report("Stopping test")
1718 main.stop( email=main.emailOnStop )
1719
Hari Krishnac195f3b2015-07-08 20:02:24 -07001720 def CASE71( self, main ):
1721 """
1722 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1723 """
1724 import random
1725 main.randomLink1 = []
1726 main.randomLink2 = []
1727 main.randomLink3 = []
1728 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1729 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1730 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1731 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1732 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1733 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1734 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1735 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1736
1737 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1738 main.log.report( "___________________________________________________________________________" )
1739 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1740 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1741 if ( int( switchLinksToToggle ) ==
1742 0 or int( switchLinksToToggle ) > 5 ):
1743 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1744 #main.cleanup()
1745 #main.exit()
1746 else:
1747 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1748
1749 main.step( "Cut links on Core devices using user provided range" )
1750 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1751 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1752 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1753 for i in range( int( switchLinksToToggle ) ):
1754 main.Mininet1.link(
1755 END1=link1End1,
1756 END2=main.randomLink1[ i ],
1757 OPTION="down" )
1758 time.sleep( link_sleep )
1759 main.Mininet1.link(
1760 END1=link2End1,
1761 END2=main.randomLink2[ i ],
1762 OPTION="down" )
1763 time.sleep( link_sleep )
1764 main.Mininet1.link(
1765 END1=link3End1,
1766 END2=main.randomLink3[ i ],
1767 OPTION="down" )
1768 time.sleep( link_sleep )
1769
Hari Krishna6185fc12015-07-13 15:42:31 -07001770 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001771 linkDown = main.ONOSbench.checkStatus(
1772 topology_output, main.numMNswitches, str(
1773 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1774 utilities.assert_equals(
1775 expect=main.TRUE,
1776 actual=linkDown,
1777 onpass="Link Down discovered properly",
1778 onfail="Link down was not discovered in " +
1779 str( link_sleep ) +
1780 " seconds" )
1781
GlennRCfcfdc4f2015-09-30 16:01:57 -07001782 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001783 # Giving onos multiple chances to install intents
1784 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001785 if i != 0:
1786 main.log.warn( "Verification failed. Retrying..." )
1787 main.log.info("Giving onos some time...")
1788 time.sleep( main.checkIntentsDelay )
1789
1790 intentState = main.TRUE
1791 for e in range(int(main.numCtrls)):
1792 main.log.info( "Checking intents on CLI %s" % (e+1) )
1793 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1794 intentState
1795 if not intentState:
1796 main.log.warn( "Not all intents installed" )
1797 if intentState:
1798 break
1799 else:
1800 #Dumping intent summary
1801 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1802
1803
1804 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1805 onpass="INTENTS INSTALLED",
1806 onfail="SOME INTENTS NOT INSTALLED" )
1807
Hari Krishnac195f3b2015-07-08 20:02:24 -07001808 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001809 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001810 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001811 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1812 if not pingResult:
1813 main.log.warn("First pingall failed. Retrying...")
1814 time.sleep(main.pingSleep)
1815 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001816
Hari Krishnac195f3b2015-07-08 20:02:24 -07001817 time2 = time.time()
1818 timeDiff = round( ( time2 - time1 ), 2 )
1819 main.log.report(
1820 "Time taken for Ping All: " +
1821 str( timeDiff ) +
1822 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001823 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824 onpass="PING ALL PASS",
1825 onfail="PING ALL FAIL" )
1826
GlennRCbddd58f2015-10-01 15:45:25 -07001827 caseResult = linkDown and pingResult and intentState
1828 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001829 onpass="Random Link cut Test PASS",
1830 onfail="Random Link cut Test FAIL" )
1831
GlennRCfcfdc4f2015-09-30 16:01:57 -07001832 # Printing what exactly failed
1833 if not linkDown:
1834 main.log.debug( "Link down was not discovered correctly" )
1835 if not pingResult:
1836 main.log.debug( "Pingall failed" )
1837 if not intentState:
1838 main.log.debug( "Intents are not all installed" )
1839
GlennRCbddd58f2015-10-01 15:45:25 -07001840 if not caseResult and main.failSwitch:
1841 main.log.report("Stopping test")
1842 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001843
Hari Krishnac195f3b2015-07-08 20:02:24 -07001844 def CASE81( self, main ):
1845 """
1846 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1847 """
1848 import random
1849 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1850 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1851 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1852 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1853 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1854
1855 main.log.report(
1856 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1857 main.log.report(
1858 "__________________________________________________________________" )
1859 main.case(
1860 "Point intents - Bring the core links up that are down and verify ping all" )
1861 main.step( "Bring randomly cut links on Core devices up" )
1862 for i in range( int( switchLinksToToggle ) ):
1863 main.Mininet1.link(
1864 END1=link1End1,
1865 END2=main.randomLink1[ i ],
1866 OPTION="up" )
1867 time.sleep( link_sleep )
1868 main.Mininet1.link(
1869 END1=link2End1,
1870 END2=main.randomLink2[ i ],
1871 OPTION="up" )
1872 time.sleep( link_sleep )
1873 main.Mininet1.link(
1874 END1=link3End1,
1875 END2=main.randomLink3[ i ],
1876 OPTION="up" )
1877 time.sleep( link_sleep )
1878
Hari Krishna6185fc12015-07-13 15:42:31 -07001879 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001880 linkUp = main.ONOSbench.checkStatus(
1881 topology_output,
1882 main.numMNswitches,
1883 str( main.numMNlinks ) )
1884 utilities.assert_equals(
1885 expect=main.TRUE,
1886 actual=linkUp,
1887 onpass="Link up discovered properly",
1888 onfail="Link up was not discovered in " +
1889 str( link_sleep ) +
1890 " seconds" )
1891
GlennRCfcfdc4f2015-09-30 16:01:57 -07001892 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001893 # Giving onos multiple chances to install intents
1894 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001895 if i != 0:
1896 main.log.warn( "Verification failed. Retrying..." )
1897 main.log.info("Giving onos some time...")
1898 time.sleep( main.checkIntentsDelay )
1899
1900 intentState = main.TRUE
1901 for e in range(int(main.numCtrls)):
1902 main.log.info( "Checking intents on CLI %s" % (e+1) )
1903 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1904 intentState
1905 if not intentState:
1906 main.log.warn( "Not all intents installed" )
1907 if intentState:
1908 break
1909 else:
1910 #Dumping intent summary
1911 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1912
1913
1914 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1915 onpass="INTENTS INSTALLED",
1916 onfail="SOME INTENTS NOT INSTALLED" )
1917
Hari Krishnac195f3b2015-07-08 20:02:24 -07001918 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001919 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001920 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001921 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1922 if not pingResult:
1923 main.log.warn("First pingall failed. Retrying...")
1924 time.sleep(main.pingSleep)
1925 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001926
Hari Krishnac195f3b2015-07-08 20:02:24 -07001927 time2 = time.time()
1928 timeDiff = round( ( time2 - time1 ), 2 )
1929 main.log.report(
1930 "Time taken for Ping All: " +
1931 str( timeDiff ) +
1932 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001933 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001934 onpass="PING ALL PASS",
1935 onfail="PING ALL FAIL" )
1936
GlennRCbddd58f2015-10-01 15:45:25 -07001937 caseResult = linkUp and pingResult
1938 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001939 onpass="Link Up Test PASS",
1940 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001941 # Printing what exactly failed
1942 if not linkUp:
1943 main.log.debug( "Link down was not discovered correctly" )
1944 if not pingResult:
1945 main.log.debug( "Pingall failed" )
1946 if not intentState:
1947 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001948
GlennRCbddd58f2015-10-01 15:45:25 -07001949 if not caseResult and main.failSwitch:
1950 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001951 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001952
Hari Krishnac195f3b2015-07-08 20:02:24 -07001953 def CASE72( self, main ):
1954 """
1955 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1956 """
1957 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001958 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001959 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001960
Hari Krishnac195f3b2015-07-08 20:02:24 -07001961 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1962 main.log.report( "___________________________________________________________________________" )
1963 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1964 switches = []
1965 switchesComb = []
1966 for i in range( main.numMNswitches ):
1967 switches.append('s%d'%(i+1))
1968 switchesLinksComb = list(itertools.combinations(switches,2))
1969 main.randomLinks = random.sample(switchesLinksComb, 5 )
1970 print main.randomLinks
1971 main.step( "Cut links on random devices" )
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="down")
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 linkDown = main.ONOSbench.checkStatus(
1982 topology_output, main.numMNswitches, str(
1983 int( main.numMNlinks ) - 5 * 2 ) )
1984 utilities.assert_equals(
1985 expect=main.TRUE,
1986 actual=linkDown,
1987 onpass="Link Down discovered properly",
1988 onfail="Link down was not discovered in " +
1989 str( link_sleep ) +
1990 " seconds" )
1991
GlennRCfcfdc4f2015-09-30 16:01:57 -07001992 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001993 # Giving onos multiple chances to install intents
1994 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001995 if i != 0:
1996 main.log.warn( "Verification failed. Retrying..." )
1997 main.log.info("Giving onos some time...")
1998 time.sleep( main.checkIntentsDelay )
1999
2000 intentState = main.TRUE
2001 for e in range(int(main.numCtrls)):
2002 main.log.info( "Checking intents on CLI %s" % (e+1) )
2003 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2004 intentState
2005 if not intentState:
2006 main.log.warn( "Not all intents installed" )
2007 if intentState:
2008 break
2009 else:
2010 #Dumping intent summary
2011 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2012
2013
2014 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2015 onpass="INTENTS INSTALLED",
2016 onfail="SOME INTENTS NOT INSTALLED" )
2017
Hari Krishnac195f3b2015-07-08 20:02:24 -07002018 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002019 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002020 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002021 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2022 if not pingResult:
2023 main.log.warn("First pingall failed. Retrying...")
2024 time.sleep(main.pingSleep)
2025 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002026
Hari Krishnac195f3b2015-07-08 20:02:24 -07002027 time2 = time.time()
2028 timeDiff = round( ( time2 - time1 ), 2 )
2029 main.log.report(
2030 "Time taken for Ping All: " +
2031 str( timeDiff ) +
2032 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002033 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002034 onpass="PING ALL PASS",
2035 onfail="PING ALL FAIL" )
2036
GlennRCbddd58f2015-10-01 15:45:25 -07002037 caseResult = linkDown and pingResult and intentState
2038 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002039 onpass="Random Link cut Test PASS",
2040 onfail="Random Link cut Test FAIL" )
2041
GlennRCfcfdc4f2015-09-30 16:01:57 -07002042 # Printing what exactly failed
2043 if not linkDown:
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" )
2049
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 CASE82( self, main ):
2055 """
2056 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
2057 """
2058 import random
2059 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002060
Hari Krishnac195f3b2015-07-08 20:02:24 -07002061 main.log.report(
2062 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
2063 main.log.report(
2064 "__________________________________________________________________" )
2065 main.case(
2066 "Host intents - Bring the core links up that are down and verify ping all" )
2067 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002068
Hari Krishnac195f3b2015-07-08 20:02:24 -07002069 for switch in main.randomLinks:
2070 main.Mininet1.link(
2071 END1=switch[0],
2072 END2=switch[1],
2073 OPTION="up")
2074 time.sleep( link_sleep )
2075
Hari Krishna6185fc12015-07-13 15:42:31 -07002076 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002077 linkUp = main.ONOSbench.checkStatus(
2078 topology_output,
2079 main.numMNswitches,
2080 str( main.numMNlinks ) )
2081 utilities.assert_equals(
2082 expect=main.TRUE,
2083 actual=linkUp,
2084 onpass="Link up discovered properly",
2085 onfail="Link up was not discovered in " +
2086 str( link_sleep ) +
2087 " seconds" )
2088
GlennRCfcfdc4f2015-09-30 16:01:57 -07002089 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002090 # Giving onos multiple chances to install intents
2091 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 if i != 0:
2093 main.log.warn( "Verification failed. Retrying..." )
2094 main.log.info("Giving onos some time...")
2095 time.sleep( main.checkIntentsDelay )
2096
2097 intentState = main.TRUE
2098 for e in range(int(main.numCtrls)):
2099 main.log.info( "Checking intents on CLI %s" % (e+1) )
2100 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2101 intentState
2102 if not intentState:
2103 main.log.warn( "Not all intents installed" )
2104 if intentState:
2105 break
2106 else:
2107 #Dumping intent summary
2108 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2109
2110
2111 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2112 onpass="INTENTS INSTALLED",
2113 onfail="SOME INTENTS NOT INSTALLED" )
2114
Hari Krishnac195f3b2015-07-08 20:02:24 -07002115 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002116 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002117 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002118 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2119 if not pingResult:
2120 main.log.warn("First pingall failed. Retrying...")
2121 time.sleep(main.pingSleep)
2122 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002123
Hari Krishnac195f3b2015-07-08 20:02:24 -07002124 time2 = time.time()
2125 timeDiff = round( ( time2 - time1 ), 2 )
2126 main.log.report(
2127 "Time taken for Ping All: " +
2128 str( timeDiff ) +
2129 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002130 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002131 onpass="PING ALL PASS",
2132 onfail="PING ALL FAIL" )
2133
GlennRCbddd58f2015-10-01 15:45:25 -07002134 caseResult = linkUp and pingResult
2135 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002136 onpass="Link Up Test PASS",
2137 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002138 # Printing what exactly failed
2139 if not linkUp:
2140 main.log.debug( "Link down was not discovered correctly" )
2141 if not pingResult:
2142 main.log.debug( "Pingall failed" )
2143 if not intentState:
2144 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002145
GlennRCbddd58f2015-10-01 15:45:25 -07002146 if not caseResult and main.failSwitch:
2147 main.log.report("Stopping test")
2148 main.stop( email=main.emailOnStop )
2149
Hari Krishnac195f3b2015-07-08 20:02:24 -07002150 def CASE73( self, main ):
2151 """
2152 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2153 """
2154 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002155 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002156 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002157
Hari Krishnac195f3b2015-07-08 20:02:24 -07002158 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2159 main.log.report( "___________________________________________________________________________" )
2160 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2161 switches = []
2162 switchesComb = []
2163 for i in range( main.numMNswitches ):
2164 switches.append('s%d'%(i+1))
2165 switchesLinksComb = list(itertools.combinations(switches,2))
2166 main.randomLinks = random.sample(switchesLinksComb, 5 )
2167 print main.randomLinks
2168 main.step( "Cut links on random devices" )
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="down")
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 linkDown = main.ONOSbench.checkStatus(
2179 topology_output, main.numMNswitches, str(
2180 int( main.numMNlinks ) - 5 * 2 ) )
2181 utilities.assert_equals(
2182 expect=main.TRUE,
2183 actual=linkDown,
2184 onpass="Link Down discovered properly",
2185 onfail="Link down was not discovered in " +
2186 str( link_sleep ) +
2187 " seconds" )
2188
GlennRCfcfdc4f2015-09-30 16:01:57 -07002189 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002190 # Giving onos multiple chances to install intents
2191 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002192 if i != 0:
2193 main.log.warn( "Verification failed. Retrying..." )
2194 main.log.info("Giving onos some time...")
2195 time.sleep( main.checkIntentsDelay )
2196
2197 intentState = main.TRUE
2198 for e in range(int(main.numCtrls)):
2199 main.log.info( "Checking intents on CLI %s" % (e+1) )
2200 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2201 intentState
2202 if not intentState:
2203 main.log.warn( "Not all intents installed" )
2204 if intentState:
2205 break
2206 else:
2207 #Dumping intent summary
2208 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2209
2210
2211 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2212 onpass="INTENTS INSTALLED",
2213 onfail="SOME INTENTS NOT INSTALLED" )
2214
Hari Krishnac195f3b2015-07-08 20:02:24 -07002215 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002216 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002217 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002218 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2219 if not pingResult:
2220 main.log.warn("First pingall failed. Retrying...")
2221 time.sleep(main.pingSleep)
2222 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002223
Hari Krishnac195f3b2015-07-08 20:02:24 -07002224 time2 = time.time()
2225 timeDiff = round( ( time2 - time1 ), 2 )
2226 main.log.report(
2227 "Time taken for Ping All: " +
2228 str( timeDiff ) +
2229 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002230 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002231 onpass="PING ALL PASS",
2232 onfail="PING ALL FAIL" )
2233
GlennRCbddd58f2015-10-01 15:45:25 -07002234 caseResult = linkDown and pingResult and intentState
2235 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002236 onpass="Random Link cut Test PASS",
2237 onfail="Random Link cut Test FAIL" )
2238
GlennRCfcfdc4f2015-09-30 16:01:57 -07002239 # Printing what exactly failed
2240 if not linkDown:
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" )
2246
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 CASE83( self, main ):
2252 """
2253 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2254 """
2255 import random
2256 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002257
Hari Krishnac195f3b2015-07-08 20:02:24 -07002258 main.log.report(
2259 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2260 main.log.report(
2261 "__________________________________________________________________" )
2262 main.case(
2263 "Point intents - Bring the core links up that are down and verify ping all" )
2264 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002265
Hari Krishnac195f3b2015-07-08 20:02:24 -07002266 for switch in main.randomLinks:
2267 main.Mininet1.link(
2268 END1=switch[0],
2269 END2=switch[1],
2270 OPTION="up")
2271 time.sleep( link_sleep )
2272
Hari Krishna6185fc12015-07-13 15:42:31 -07002273 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002274 linkUp = main.ONOSbench.checkStatus(
2275 topology_output,
2276 main.numMNswitches,
2277 str( main.numMNlinks ) )
2278 utilities.assert_equals(
2279 expect=main.TRUE,
2280 actual=linkUp,
2281 onpass="Link up discovered properly",
2282 onfail="Link up was not discovered in " +
2283 str( link_sleep ) +
2284 " seconds" )
2285
GlennRCfcfdc4f2015-09-30 16:01:57 -07002286 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002287 # Giving onos multiple chances to install intents
2288 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002289 if i != 0:
2290 main.log.warn( "Verification failed. Retrying..." )
2291 main.log.info("Giving onos some time...")
2292 time.sleep( main.checkIntentsDelay )
2293
2294 intentState = main.TRUE
2295 for e in range(int(main.numCtrls)):
2296 main.log.info( "Checking intents on CLI %s" % (e+1) )
2297 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2298 intentState
2299 if not intentState:
2300 main.log.warn( "Not all intents installed" )
2301 if intentState:
2302 break
2303 else:
2304 #Dumping intent summary
2305 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2306
2307
2308 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2309 onpass="INTENTS INSTALLED",
2310 onfail="SOME INTENTS NOT INSTALLED" )
2311
Hari Krishnac195f3b2015-07-08 20:02:24 -07002312 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002313 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002314 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002315 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2316 if not pingResult:
2317 main.log.warn("First pingall failed. Retrying...")
2318 time.sleep(main.pingSleep)
2319 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002320
Hari Krishnac195f3b2015-07-08 20:02:24 -07002321 time2 = time.time()
2322 timeDiff = round( ( time2 - time1 ), 2 )
2323 main.log.report(
2324 "Time taken for Ping All: " +
2325 str( timeDiff ) +
2326 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002327 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002328 onpass="PING ALL PASS",
2329 onfail="PING ALL FAIL" )
2330
GlennRCbddd58f2015-10-01 15:45:25 -07002331 caseResult = linkUp and pingResult
2332 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002333 onpass="Link Up Test PASS",
2334 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002335 # Printing what exactly failed
2336 if not linkUp:
2337 main.log.debug( "Link down was not discovered correctly" )
2338 if not pingResult:
2339 main.log.debug( "Pingall failed" )
2340 if not intentState:
2341 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002342
GlennRCbddd58f2015-10-01 15:45:25 -07002343 if not caseResult and main.failSwitch:
2344 main.log.report("Stopping test")
2345 main.stop( email=main.emailOnStop )
2346
Hari Krishnac195f3b2015-07-08 20:02:24 -07002347 def CASE74( self, main ):
2348 """
2349 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2350 """
2351 import random
2352 main.randomLink1 = []
2353 main.randomLink2 = []
2354 main.randomLink3 = []
2355 main.randomLink4 = []
2356 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2357 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2358 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2359 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2360 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2361 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2362 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002363
Hari Krishnac195f3b2015-07-08 20:02:24 -07002364 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2365 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002366 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002367 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002368 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002369 linkIndex.remove(linkIndexS9)
2370 linkIndexS10 = random.sample(linkIndex,1)[0]
2371 main.randomLink1 = link1End2top[linkIndexS9]
2372 main.randomLink2 = link2End2top[linkIndexS10]
2373 main.randomLink3 = random.sample(link1End2bot,1)[0]
2374 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002375
2376 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002377 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2378 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2379 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2380 time.sleep( link_sleep )
2381 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2382 time.sleep( link_sleep )
2383
Hari Krishna6185fc12015-07-13 15:42:31 -07002384 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002385 linkDown = main.ONOSbench.checkStatus(
2386 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002387 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002388 utilities.assert_equals(
2389 expect=main.TRUE,
2390 actual=linkDown,
2391 onpass="Link Down discovered properly",
2392 onfail="Link down was not discovered in " +
2393 str( link_sleep ) +
2394 " seconds" )
2395
GlennRCfcfdc4f2015-09-30 16:01:57 -07002396 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002397 # Giving onos multiple chances to install intents
2398 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002399 if i != 0:
2400 main.log.warn( "Verification failed. Retrying..." )
2401 main.log.info("Giving onos some time...")
2402 time.sleep( main.checkIntentsDelay )
2403
2404 intentState = main.TRUE
2405 for e in range(int(main.numCtrls)):
2406 main.log.info( "Checking intents on CLI %s" % (e+1) )
2407 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2408 intentState
2409 if not intentState:
2410 main.log.warn( "Not all intents installed" )
2411 if intentState:
2412 break
2413 else:
2414 #Dumping intent summary
2415 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2416
2417
2418 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2419 onpass="INTENTS INSTALLED",
2420 onfail="SOME INTENTS NOT INSTALLED" )
2421
Hari Krishnac195f3b2015-07-08 20:02:24 -07002422 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002423 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002424 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002425 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2426 if not pingResult:
2427 main.log.warn("First pingall failed. Retrying...")
2428 time.sleep(main.pingSleep)
2429 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002430
Hari Krishnac195f3b2015-07-08 20:02:24 -07002431 time2 = time.time()
2432 timeDiff = round( ( time2 - time1 ), 2 )
2433 main.log.report(
2434 "Time taken for Ping All: " +
2435 str( timeDiff ) +
2436 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002437 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002438 onpass="PING ALL PASS",
2439 onfail="PING ALL FAIL" )
2440
GlennRCbddd58f2015-10-01 15:45:25 -07002441 caseResult = linkDown and pingResult and intentState
2442 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002443 onpass="Random Link cut Test PASS",
2444 onfail="Random Link cut Test FAIL" )
2445
GlennRCfcfdc4f2015-09-30 16:01:57 -07002446 # Printing what exactly failed
2447 if not linkDown:
2448 main.log.debug( "Link down was not discovered correctly" )
2449 if not pingResult:
2450 main.log.debug( "Pingall failed" )
2451 if not intentState:
2452 main.log.debug( "Intents are not all installed" )
2453
GlennRCbddd58f2015-10-01 15:45:25 -07002454 if not caseResult and main.failSwitch:
2455 main.log.report("Stopping test")
2456 main.stop( email=main.emailOnStop )
2457
Hari Krishnac195f3b2015-07-08 20:02:24 -07002458 def CASE84( self, main ):
2459 """
2460 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2461 """
2462 import random
2463 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2464 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2465 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2466 main.log.report(
2467 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2468 main.log.report(
2469 "__________________________________________________________________" )
2470 main.case(
2471 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002472
2473 # Work around for link state propagation delay. Added some sleep time.
2474 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2475 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002476 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2477 time.sleep( link_sleep )
2478 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2479 time.sleep( link_sleep )
2480
Hari Krishna6185fc12015-07-13 15:42:31 -07002481 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002482 linkUp = main.ONOSbench.checkStatus(
2483 topology_output,
2484 main.numMNswitches,
2485 str( main.numMNlinks ) )
2486 utilities.assert_equals(
2487 expect=main.TRUE,
2488 actual=linkUp,
2489 onpass="Link up discovered properly",
2490 onfail="Link up was not discovered in " +
2491 str( link_sleep ) +
2492 " seconds" )
2493
GlennRCfcfdc4f2015-09-30 16:01:57 -07002494 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002495 # Giving onos multiple chances to install intents
2496 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002497 if i != 0:
2498 main.log.warn( "Verification failed. Retrying..." )
2499 main.log.info("Giving onos some time...")
2500 time.sleep( main.checkIntentsDelay )
2501
2502 intentState = main.TRUE
2503 for e in range(int(main.numCtrls)):
2504 main.log.info( "Checking intents on CLI %s" % (e+1) )
2505 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2506 intentState
2507 if not intentState:
2508 main.log.warn( "Not all intents installed" )
2509 if intentState:
2510 break
2511 else:
2512 #Dumping intent summary
2513 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2514
2515
2516 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2517 onpass="INTENTS INSTALLED",
2518 onfail="SOME INTENTS NOT INSTALLED" )
2519
Hari Krishnac195f3b2015-07-08 20:02:24 -07002520 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002521 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002522 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002523 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2524 if not pingResult:
2525 main.log.warn("First pingall failed. Retrying...")
2526 time.sleep(main.pingSleep)
2527 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002528
Hari Krishnac195f3b2015-07-08 20:02:24 -07002529 time2 = time.time()
2530 timeDiff = round( ( time2 - time1 ), 2 )
2531 main.log.report(
2532 "Time taken for Ping All: " +
2533 str( timeDiff ) +
2534 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002535 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002536 onpass="PING ALL PASS",
2537 onfail="PING ALL FAIL" )
2538
GlennRCbddd58f2015-10-01 15:45:25 -07002539 caseResult = linkUp and pingResult
2540 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002541 onpass="Link Up Test PASS",
2542 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002543 # Printing what exactly failed
2544 if not linkUp:
2545 main.log.debug( "Link down was not discovered correctly" )
2546 if not pingResult:
2547 main.log.debug( "Pingall failed" )
2548 if not intentState:
2549 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002550
GlennRCbddd58f2015-10-01 15:45:25 -07002551 if not caseResult and main.failSwitch:
2552 main.log.report("Stopping test")
2553 main.stop( email=main.emailOnStop )
2554
Hari Krishnab79d0822015-08-20 09:48:43 -07002555 def CASE75( self, main ):
2556 """
2557 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2558 """
2559 import random
2560 main.randomLink1 = []
2561 main.randomLink2 = []
2562 main.randomLink3 = []
2563 main.randomLink4 = []
2564 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2565 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2566 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2567 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2568 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2569 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2570 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2571 main.pingTimeout = 400
2572
2573 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2574 main.log.report( "___________________________________________________________________________" )
2575 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2576 linkIndex = range(4)
2577 linkIndexS9 = random.sample(linkIndex,1)[0]
2578 linkIndex.remove(linkIndexS9)
2579 linkIndexS10 = random.sample(linkIndex,1)[0]
2580 main.randomLink1 = link1End2top[linkIndexS9]
2581 main.randomLink2 = link2End2top[linkIndexS10]
2582 main.randomLink3 = random.sample(link1End2bot,1)[0]
2583 main.randomLink4 = random.sample(link2End2bot,1)[0]
2584
2585 # Work around for link state propagation delay. Added some sleep time.
2586 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2587 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2588 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2589 time.sleep( link_sleep )
2590 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2591 time.sleep( link_sleep )
2592
2593 topology_output = main.ONOScli1.topology()
2594 linkDown = main.ONOSbench.checkStatus(
2595 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002596 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002597 utilities.assert_equals(
2598 expect=main.TRUE,
2599 actual=linkDown,
2600 onpass="Link Down discovered properly",
2601 onfail="Link down was not discovered in " +
2602 str( link_sleep ) +
2603 " seconds" )
2604
GlennRCfcfdc4f2015-09-30 16:01:57 -07002605 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002606 # Giving onos multiple chances to install intents
2607 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002608 if i != 0:
2609 main.log.warn( "Verification failed. Retrying..." )
2610 main.log.info("Giving onos some time...")
2611 time.sleep( main.checkIntentsDelay )
2612
2613 intentState = main.TRUE
2614 for e in range(int(main.numCtrls)):
2615 main.log.info( "Checking intents on CLI %s" % (e+1) )
2616 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2617 intentState
2618 if not intentState:
2619 main.log.warn( "Not all intents installed" )
2620 if intentState:
2621 break
2622 else:
2623 #Dumping intent summary
2624 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2625
2626
2627 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2628 onpass="INTENTS INSTALLED",
2629 onfail="SOME INTENTS NOT INSTALLED" )
2630
Hari Krishnab79d0822015-08-20 09:48:43 -07002631 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002632 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002633 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002634 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2635 if not pingResult:
2636 main.log.warn("First pingall failed. Retrying...")
2637 time.sleep(main.pingSleep)
2638 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002639
Hari Krishnab79d0822015-08-20 09:48:43 -07002640 time2 = time.time()
2641 timeDiff = round( ( time2 - time1 ), 2 )
2642 main.log.report(
2643 "Time taken for Ping All: " +
2644 str( timeDiff ) +
2645 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002646 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002647 onpass="PING ALL PASS",
2648 onfail="PING ALL FAIL" )
2649
GlennRCbddd58f2015-10-01 15:45:25 -07002650 caseResult = linkDown and pingResult and intentState
2651 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002652 onpass="Random Link cut Test PASS",
2653 onfail="Random Link cut Test FAIL" )
2654
GlennRCfcfdc4f2015-09-30 16:01:57 -07002655 # Printing what exactly failed
2656 if not linkDown:
2657 main.log.debug( "Link down was not discovered correctly" )
2658 if not pingResult:
2659 main.log.debug( "Pingall failed" )
2660 if not intentState:
2661 main.log.debug( "Intents are not all installed" )
2662
GlennRCbddd58f2015-10-01 15:45:25 -07002663 if not caseResult and main.failSwitch:
2664 main.log.report("Stopping test")
2665 main.stop( email=main.emailOnStop )
2666
Hari Krishnab79d0822015-08-20 09:48:43 -07002667 def CASE85( self, main ):
2668 """
2669 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2670 """
2671 import random
2672 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2673 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2674 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2675 main.log.report(
2676 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2677 main.log.report(
2678 "__________________________________________________________________" )
2679 main.case(
2680 "Point intents - Bring the core links up that are down and verify ping all" )
2681
2682 # Work around for link state propagation delay. Added some sleep time.
2683 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2684 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2685 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2686 time.sleep( link_sleep )
2687 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2688 time.sleep( link_sleep )
2689
2690 topology_output = main.ONOScli1.topology()
2691 linkUp = main.ONOSbench.checkStatus(
2692 topology_output,
2693 main.numMNswitches,
2694 str( main.numMNlinks ) )
2695 utilities.assert_equals(
2696 expect=main.TRUE,
2697 actual=linkUp,
2698 onpass="Link up discovered properly",
2699 onfail="Link up was not discovered in " +
2700 str( link_sleep ) +
2701 " seconds" )
2702
GlennRCfcfdc4f2015-09-30 16:01:57 -07002703 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002704 # Giving onos multiple chances to install intents
2705 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002706 if i != 0:
2707 main.log.warn( "Verification failed. Retrying..." )
2708 main.log.info("Giving onos some time...")
2709 time.sleep( main.checkIntentsDelay )
2710
2711 intentState = main.TRUE
2712 for e in range(int(main.numCtrls)):
2713 main.log.info( "Checking intents on CLI %s" % (e+1) )
2714 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2715 intentState
2716 if not intentState:
2717 main.log.warn( "Not all intents installed" )
2718 if intentState:
2719 break
2720 else:
2721 #Dumping intent summary
2722 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2723
2724
2725 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2726 onpass="INTENTS INSTALLED",
2727 onfail="SOME INTENTS NOT INSTALLED" )
2728
Hari Krishnab79d0822015-08-20 09:48:43 -07002729 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002730 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002731 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002732 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2733 if not pingResult:
2734 main.log.warn("First pingall failed. Retrying...")
2735 time.sleep(main.pingSleep)
2736 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002737
Hari Krishnab79d0822015-08-20 09:48:43 -07002738 time2 = time.time()
2739 timeDiff = round( ( time2 - time1 ), 2 )
2740 main.log.report(
2741 "Time taken for Ping All: " +
2742 str( timeDiff ) +
2743 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002744 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002745 onpass="PING ALL PASS",
2746 onfail="PING ALL FAIL" )
2747
GlennRCbddd58f2015-10-01 15:45:25 -07002748 caseResult = linkUp and pingResult
2749 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002750 onpass="Link Up Test PASS",
2751 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002752 # Printing what exactly failed
2753 if not linkUp:
2754 main.log.debug( "Link down was not discovered correctly" )
2755 if not pingResult:
2756 main.log.debug( "Pingall failed" )
2757 if not intentState:
2758 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002759
GlennRCbddd58f2015-10-01 15:45:25 -07002760 if not caseResult and main.failSwitch:
2761 main.log.report("Stopping test")
2762 main.stop( email=main.emailOnStop )
2763
Hari Krishna4223dbd2015-08-13 16:29:53 -07002764 def CASE170( self ):
2765 """
2766 IPv6 ping all with some core links down( Host Intents-Att Topo)
2767 """
2768 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2769 main.log.report( "_________________________________________________" )
2770 import itertools
2771 import time
2772 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2773 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002774 pingResult = main.FALSE
2775 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002776 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002777 if not pingResult:
2778 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002779 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002780 time2 = time.time()
2781 timeDiff = round( ( time2 - time1 ), 2 )
2782 main.log.report(
2783 "Time taken for IPv6 Ping All: " +
2784 str( timeDiff ) +
2785 " seconds" )
2786 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2787 onpass="PING ALL PASS",
2788 onfail="PING ALL FAIL" )
2789
GlennRCbddd58f2015-10-01 15:45:25 -07002790 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002791 utilities.assert_equals(
2792 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002793 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002794 onpass="IPv6 Ping across 300 host intents test PASS",
2795 onfail="IPv6 Ping across 300 host intents test FAIL" )
2796
2797 def CASE180( self ):
2798 """
2799 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2800 """
2801 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2802 main.log.report( "_________________________________________________" )
2803 import itertools
2804 import time
2805 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2806 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002807 pingResult = main.FALSE
2808 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002809 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002810 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002811 main.log.warn("First ping failed. Retrying...")
2812 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002813 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002814 time2 = time.time()
2815 timeDiff = round( ( time2 - time1 ), 2 )
2816 main.log.report(
2817 "Time taken for IPv6 Ping All: " +
2818 str( timeDiff ) +
2819 " seconds" )
2820 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2821 onpass="PING ALL PASS",
2822 onfail="PING ALL FAIL" )
2823
GlennRCbddd58f2015-10-01 15:45:25 -07002824 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002825 utilities.assert_equals(
2826 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002827 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002828 onpass="IPv6 Ping across 300 host intents test PASS",
2829 onfail="IPv6 Ping across 300 host intents test FAIL" )
2830
2831 def CASE171( self ):
2832 """
2833 IPv6 ping all with some core links down( Point Intents-Att Topo)
2834 """
2835 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2836 main.log.report( "_________________________________________________" )
2837 import itertools
2838 import time
2839 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2840 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002841 pingResult = main.FALSE
2842 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002843 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002844 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002845 main.log.warn("First ping failed. Retrying...")
2846 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002847 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002848 time2 = time.time()
2849 timeDiff = round( ( time2 - time1 ), 2 )
2850 main.log.report(
2851 "Time taken for IPv6 Ping All: " +
2852 str( timeDiff ) +
2853 " seconds" )
2854 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2855 onpass="PING ALL PASS",
2856 onfail="PING ALL FAIL" )
2857
GlennRCbddd58f2015-10-01 15:45:25 -07002858 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002859 utilities.assert_equals(
2860 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002861 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002862 onpass="IPv6 Ping across 600 point intents test PASS",
2863 onfail="IPv6 Ping across 600 point intents test FAIL" )
2864
2865 def CASE181( self ):
2866 """
2867 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2868 """
2869 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2870 main.log.report( "_________________________________________________" )
2871 import itertools
2872 import time
2873 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2874 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002875 pingResult = main.FALSE
2876 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002877 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002878 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002879 main.log.warn("First ping failed. Retrying...")
2880 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002881 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002882 time2 = time.time()
2883 timeDiff = round( ( time2 - time1 ), 2 )
2884 main.log.report(
2885 "Time taken for IPv6 Ping All: " +
2886 str( timeDiff ) +
2887 " seconds" )
2888 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2889 onpass="PING ALL PASS",
2890 onfail="PING ALL FAIL" )
2891
GlennRCbddd58f2015-10-01 15:45:25 -07002892 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002893 utilities.assert_equals(
2894 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002895 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002896 onpass="IPv6 Ping across 600 Point intents test PASS",
2897 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2898
2899 def CASE172( self ):
2900 """
2901 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2902 """
2903 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2904 main.log.report( "_________________________________________________" )
2905 import itertools
2906 import time
2907 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2908 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002909 pingResult = main.FALSE
2910 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002911 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002912 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002913 main.log.warn("First ping failed. Retrying...")
2914 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002915 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002916 time2 = time.time()
2917 timeDiff = round( ( time2 - time1 ), 2 )
2918 main.log.report(
2919 "Time taken for IPv6 Ping All: " +
2920 str( timeDiff ) +
2921 " seconds" )
2922 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2923 onpass="PING ALL PASS",
2924 onfail="PING ALL FAIL" )
2925
GlennRCbddd58f2015-10-01 15:45:25 -07002926 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002927 utilities.assert_equals(
2928 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002929 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002930 onpass="IPv6 Ping across 300 host intents test PASS",
2931 onfail="IPv6 Ping across 300 host intents test FAIL" )
2932
2933 def CASE182( self ):
2934 """
2935 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2936 """
2937 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2938 main.log.report( "_________________________________________________" )
2939 import itertools
2940 import time
2941 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2942 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002943 pingResult = main.FALSE
2944 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002945 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002946 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002947 main.log.warn("First ping failed. Retrying...")
2948 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002949 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002950 time2 = time.time()
2951 timeDiff = round( ( time2 - time1 ), 2 )
2952 main.log.report(
2953 "Time taken for IPv6 Ping All: " +
2954 str( timeDiff ) +
2955 " seconds" )
2956 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2957 onpass="PING ALL PASS",
2958 onfail="PING ALL FAIL" )
2959
GlennRCbddd58f2015-10-01 15:45:25 -07002960 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002961 utilities.assert_equals(
2962 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002963 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002964 onpass="IPv6 Ping across 300 host intents test PASS",
2965 onfail="IPv6 Ping across 300 host intents test FAIL" )
2966
2967 def CASE173( self ):
2968 """
2969 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2970 """
2971 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2972 main.log.report( "_________________________________________________" )
2973 import itertools
2974 import time
2975 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2976 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002977 pingResult = main.FALSE
2978 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002979 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002980 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002981 main.log.warn("First ping failed. Retrying...")
2982 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002983 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002984 time2 = time.time()
2985 timeDiff = round( ( time2 - time1 ), 2 )
2986 main.log.report(
2987 "Time taken for IPv6 Ping All: " +
2988 str( timeDiff ) +
2989 " seconds" )
2990 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2991 onpass="PING ALL PASS",
2992 onfail="PING ALL FAIL" )
2993
GlennRCbddd58f2015-10-01 15:45:25 -07002994 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002995 utilities.assert_equals(
2996 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002997 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002998 onpass="IPv6 Ping across 600 point intents test PASS",
2999 onfail="IPv6 Ping across 600 point intents test FAIL" )
3000
3001 def CASE183( self ):
3002 """
3003 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
3004 """
3005 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
3006 main.log.report( "_________________________________________________" )
3007 import itertools
3008 import time
3009 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
3010 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003011 pingResult = main.FALSE
3012 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003013 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003014 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003015 main.log.warn("First ping failed. Retrying...")
3016 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003017 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003018 time2 = time.time()
3019 timeDiff = round( ( time2 - time1 ), 2 )
3020 main.log.report(
3021 "Time taken for IPv6 Ping All: " +
3022 str( timeDiff ) +
3023 " seconds" )
3024 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3025 onpass="PING ALL PASS",
3026 onfail="PING ALL FAIL" )
3027
GlennRCbddd58f2015-10-01 15:45:25 -07003028 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003029 utilities.assert_equals(
3030 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003031 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003032 onpass="IPv6 Ping across 600 Point intents test PASS",
3033 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3034
3035 def CASE174( self ):
3036 """
3037 IPv6 ping all with some core links down( Host Intents-Spine Topo)
3038 """
3039 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
3040 main.log.report( "_________________________________________________" )
3041 import itertools
3042 import time
3043 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
3044 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003045 pingResult = main.FALSE
3046 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003047 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003048 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003049 main.log.warn("First ping failed. Retrying...")
3050 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003051 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003052 time2 = time.time()
3053 timeDiff = round( ( time2 - time1 ), 2 )
3054 main.log.report(
3055 "Time taken for IPv6 Ping All: " +
3056 str( timeDiff ) +
3057 " seconds" )
3058 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3059 onpass="PING ALL PASS",
3060 onfail="PING ALL FAIL" )
3061
GlennRCbddd58f2015-10-01 15:45:25 -07003062 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003063 utilities.assert_equals(
3064 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003065 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003066 onpass="IPv6 Ping across 2278 host intents test PASS",
3067 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3068
3069 def CASE184( self ):
3070 """
3071 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
3072 """
3073 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
3074 main.log.report( "_________________________________________________" )
3075 import itertools
3076 import time
3077 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
3078 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003079 pingResult = main.FALSE
3080 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003081 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003082 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003083 main.log.warn("First ping failed. Retrying...")
3084 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003085 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003086 time2 = time.time()
3087 timeDiff = round( ( time2 - time1 ), 2 )
3088 main.log.report(
3089 "Time taken for IPv6 Ping All: " +
3090 str( timeDiff ) +
3091 " seconds" )
3092 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3093 onpass="PING ALL PASS",
3094 onfail="PING ALL FAIL" )
3095
GlennRCbddd58f2015-10-01 15:45:25 -07003096 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003097 utilities.assert_equals(
3098 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003099 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003100 onpass="IPv6 Ping across 2278 host intents test PASS",
3101 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3102
3103 def CASE175( self ):
3104 """
3105 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3106 """
3107 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3108 main.log.report( "_________________________________________________" )
3109 import itertools
3110 import time
3111 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3112 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003113 pingResult = main.FALSE
3114 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003115 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003116 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003117 main.log.warn("First ping failed. Retrying...")
3118 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003119 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003120 time2 = time.time()
3121 timeDiff = round( ( time2 - time1 ), 2 )
3122 main.log.report(
3123 "Time taken for IPv6 Ping All: " +
3124 str( timeDiff ) +
3125 " seconds" )
3126 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3127 onpass="PING ALL PASS",
3128 onfail="PING ALL FAIL" )
3129
GlennRCbddd58f2015-10-01 15:45:25 -07003130 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003131 utilities.assert_equals(
3132 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003133 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003134 onpass="IPv6 Ping across 4556 point intents test PASS",
3135 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3136
3137 def CASE185( self ):
3138 """
3139 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3140 """
3141 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3142 main.log.report( "_________________________________________________" )
3143 import itertools
3144 import time
3145 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3146 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003147 pingResult = main.FALSE
3148 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003149 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003150 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003151 main.log.warn("First ping failed. Retrying...")
3152 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003153 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003154 time2 = time.time()
3155 timeDiff = round( ( time2 - time1 ), 2 )
3156 main.log.report(
3157 "Time taken for IPv6 Ping All: " +
3158 str( timeDiff ) +
3159 " seconds" )
3160 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3161 onpass="PING ALL PASS",
3162 onfail="PING ALL FAIL" )
3163
GlennRCbddd58f2015-10-01 15:45:25 -07003164 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003165 utilities.assert_equals(
3166 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003167 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003168 onpass="IPv6 Ping across 4556 Point intents test PASS",
3169 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3170
Hari Krishnac195f3b2015-07-08 20:02:24 -07003171 def CASE90( self ):
3172 """
3173 Install 600 point intents and verify ping all (Att Topology)
3174 """
3175 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3176 main.log.report( "_______________________________________" )
3177 import itertools
3178 import time
3179 main.case( "Install 600 point intents" )
3180 main.step( "Add point Intents" )
3181 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003182 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3183
Hari Krishnac195f3b2015-07-08 20:02:24 -07003184 intentIdList = []
3185 time1 = time.time()
3186 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3187 pool = []
3188 for cli in main.CLIs:
3189 if i >= len( deviceCombos ):
3190 break
3191 t = main.Thread( target=cli.addPointIntent,
3192 threadID=main.threadID,
3193 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003194 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 -07003195 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003196 t.start()
3197 i = i + 1
3198 main.threadID = main.threadID + 1
3199 for thread in pool:
3200 thread.join()
3201 intentIdList.append(thread.result)
3202 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003203 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003204
GlennRCfcfdc4f2015-09-30 16:01:57 -07003205 # Saving intent ids to check intents in later case
3206 main.intentIds = list(intentIdList)
3207
GlennRCa8d786a2015-09-23 17:40:11 -07003208 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003209
GlennRC1dde1712015-10-02 11:03:08 -07003210 # Giving onos multiple chances to install intents
3211 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003212 if i != 0:
3213 main.log.warn( "Verification failed. Retrying..." )
3214 main.log.info("Waiting for onos to install intents...")
3215 time.sleep( main.checkIntentsDelay )
3216
GlennRCa8d786a2015-09-23 17:40:11 -07003217 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003218 for e in range(int(main.numCtrls)):
3219 main.log.info( "Checking intents on CLI %s" % (e+1) )
3220 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3221 intentState
3222 if not intentState:
3223 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003224 if intentState:
3225 break
GlennRCdb2c8422015-09-29 12:21:59 -07003226 else:
3227 #Dumping intent summary
3228 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003229
3230 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3231 onpass="INTENTS INSTALLED",
3232 onfail="SOME INTENTS NOT INSTALLED" )
3233
Hari Krishnac195f3b2015-07-08 20:02:24 -07003234 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003235 for i in range(main.numPings):
3236 time1 = time.time()
3237 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3238 if not pingResult:
3239 main.log.warn("First pingall failed. Retrying...")
3240 time.sleep(main.pingSleep)
3241 else: break
3242
Hari Krishnac195f3b2015-07-08 20:02:24 -07003243 time2 = time.time()
3244 timeDiff = round( ( time2 - time1 ), 2 )
3245 main.log.report(
3246 "Time taken for Ping All: " +
3247 str( timeDiff ) +
3248 " seconds" )
3249 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003250 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003251 onfail="PING ALL FAIL" )
3252
GlennRCbddd58f2015-10-01 15:45:25 -07003253 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003254
Hari Krishnac195f3b2015-07-08 20:02:24 -07003255 utilities.assert_equals(
3256 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003257 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003258 onpass="Install 600 point Intents and Ping All test PASS",
3259 onfail="Install 600 point Intents and Ping All test FAIL" )
3260
GlennRCbddd58f2015-10-01 15:45:25 -07003261 if not intentState:
3262 main.log.debug( "Intents failed to install completely" )
3263 if not pingResult:
3264 main.log.debug( "Pingall failed" )
3265
3266 if not caseResult and main.failSwitch:
3267 main.log.report("Stopping test")
3268 main.stop( email=main.emailOnStop )
3269
Hari Krishnac195f3b2015-07-08 20:02:24 -07003270 def CASE91( self ):
3271 """
3272 Install 600 point intents and verify ping all (Chordal Topology)
3273 """
3274 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3275 main.log.report( "_______________________________________" )
3276 import itertools
3277 import time
3278 main.case( "Install 600 point intents" )
3279 main.step( "Add point Intents" )
3280 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003281 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3282
Hari Krishnac195f3b2015-07-08 20:02:24 -07003283 intentIdList = []
3284 time1 = time.time()
3285 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3286 pool = []
3287 for cli in main.CLIs:
3288 if i >= len( deviceCombos ):
3289 break
3290 t = main.Thread( target=cli.addPointIntent,
3291 threadID=main.threadID,
3292 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003293 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 -07003294 pool.append(t)
3295 #time.sleep(1)
3296 t.start()
3297 i = i + 1
3298 main.threadID = main.threadID + 1
3299 for thread in pool:
3300 thread.join()
3301 intentIdList.append(thread.result)
3302 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003303 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003304
GlennRCfcfdc4f2015-09-30 16:01:57 -07003305 # Saving intent ids to check intents in later case
3306 main.intentIds = list(intentIdList)
3307
GlennRCa8d786a2015-09-23 17:40:11 -07003308 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003309
GlennRC1dde1712015-10-02 11:03:08 -07003310 # Giving onos multiple chances to install intents
3311 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003312 if i != 0:
3313 main.log.warn( "Verification failed. Retrying..." )
3314 main.log.info("Waiting for onos to install intents...")
3315 time.sleep( main.checkIntentsDelay )
3316
GlennRCa8d786a2015-09-23 17:40:11 -07003317 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003318 for e in range(int(main.numCtrls)):
3319 main.log.info( "Checking intents on CLI %s" % (e+1) )
3320 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3321 intentState
3322 if not intentState:
3323 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003324 if intentState:
3325 break
GlennRCdb2c8422015-09-29 12:21:59 -07003326 else:
3327 #Dumping intent summary
3328 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003329
3330 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3331 onpass="INTENTS INSTALLED",
3332 onfail="SOME INTENTS NOT INSTALLED" )
3333
Hari Krishnac195f3b2015-07-08 20:02:24 -07003334 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003335 for i in range(main.numPings):
3336 time1 = time.time()
3337 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3338 if not pingResult:
3339 main.log.warn("First pingall failed. Retrying...")
3340 time.sleep(main.pingSleep)
3341 else: break
3342
Hari Krishnac195f3b2015-07-08 20:02:24 -07003343 time2 = time.time()
3344 timeDiff = round( ( time2 - time1 ), 2 )
3345 main.log.report(
3346 "Time taken for Ping All: " +
3347 str( timeDiff ) +
3348 " seconds" )
3349 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3350 onpass="PING ALL PASS",
3351 onfail="PING ALL FAIL" )
3352
GlennRCbddd58f2015-10-01 15:45:25 -07003353 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003354
Hari Krishnac195f3b2015-07-08 20:02:24 -07003355 utilities.assert_equals(
3356 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003357 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003358 onpass="Install 600 point Intents and Ping All test PASS",
3359 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003360
GlennRCbddd58f2015-10-01 15:45:25 -07003361 if not intentState:
3362 main.log.debug( "Intents failed to install completely" )
3363 if not pingResult:
3364 main.log.debug( "Pingall failed" )
3365
3366 if not caseResult and main.failSwitch:
3367 main.log.report("Stopping test")
3368 main.stop( email=main.emailOnStop )
3369
Hari Krishnac195f3b2015-07-08 20:02:24 -07003370 def CASE92( self ):
3371 """
3372 Install 4556 point intents and verify ping all (Spine Topology)
3373 """
3374 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3375 main.log.report( "_______________________________________" )
3376 import itertools
3377 import time
3378 main.case( "Install 4556 point intents" )
3379 main.step( "Add point Intents" )
3380 intentResult = main.TRUE
3381 main.pingTimeout = 600
3382 for i in range(len(main.hostMACs)):
3383 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3384 print main.MACsDict
3385 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3386 intentIdList = []
3387 time1 = time.time()
3388 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3389 pool = []
3390 for cli in main.CLIs:
3391 if i >= len( deviceCombos ):
3392 break
3393 t = main.Thread( target=cli.addPointIntent,
3394 threadID=main.threadID,
3395 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003396 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 -07003397 pool.append(t)
3398 #time.sleep(1)
3399 t.start()
3400 i = i + 1
3401 main.threadID = main.threadID + 1
3402 for thread in pool:
3403 thread.join()
3404 intentIdList.append(thread.result)
3405 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003406 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003407
GlennRCfcfdc4f2015-09-30 16:01:57 -07003408 # Saving intent ids to check intents in later case
3409 main.intentIds = list(intentIdList)
3410
GlennRCa8d786a2015-09-23 17:40:11 -07003411 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003412
GlennRC1dde1712015-10-02 11:03:08 -07003413 # Giving onos multiple chances to install intents
3414 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003415 if i != 0:
3416 main.log.warn( "Verification failed. Retrying..." )
3417 main.log.info("Waiting for onos to install intents...")
3418 time.sleep( main.checkIntentsDelay )
3419
GlennRCa8d786a2015-09-23 17:40:11 -07003420 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003421 for e in range(int(main.numCtrls)):
3422 main.log.info( "Checking intents on CLI %s" % (e+1) )
3423 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3424 intentState
3425 if not intentState:
3426 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003427 if intentState:
3428 break
GlennRCdb2c8422015-09-29 12:21:59 -07003429 else:
3430 #Dumping intent summary
3431 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003432
3433 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3434 onpass="INTENTS INSTALLED",
3435 onfail="SOME INTENTS NOT INSTALLED" )
3436
Hari Krishnac195f3b2015-07-08 20:02:24 -07003437 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003438 for i in range(main.numPings):
3439 time1 = time.time()
3440 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3441 if not pingResult:
3442 main.log.warn("First pingall failed. Retrying...")
3443 time.sleep(main.pingSleep)
3444 else: break
3445
Hari Krishnac195f3b2015-07-08 20:02:24 -07003446 time2 = time.time()
3447 timeDiff = round( ( time2 - time1 ), 2 )
3448 main.log.report(
3449 "Time taken for Ping All: " +
3450 str( timeDiff ) +
3451 " seconds" )
3452 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3453 onpass="PING ALL PASS",
3454 onfail="PING ALL FAIL" )
3455
GlennRCbddd58f2015-10-01 15:45:25 -07003456 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003457
Hari Krishnac195f3b2015-07-08 20:02:24 -07003458 utilities.assert_equals(
3459 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003460 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003461 onpass="Install 4556 point Intents and Ping All test PASS",
3462 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003463
GlennRCbddd58f2015-10-01 15:45:25 -07003464 if not intentState:
3465 main.log.debug( "Intents failed to install completely" )
3466 if not pingResult:
3467 main.log.debug( "Pingall failed" )
3468
3469 if not caseResult and main.failSwitch:
3470 main.log.report("Stopping test")
3471 main.stop( email=main.emailOnStop )
3472
Hari Krishnac195f3b2015-07-08 20:02:24 -07003473 def CASE93( self ):
3474 """
3475 Install multi-single point intents and verify Ping all works
3476 for att topology
3477 """
3478 import copy
3479 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003480 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003481 main.log.report( "Install multi-single point intents and verify Ping all" )
3482 main.log.report( "___________________________________________" )
3483 main.case( "Install multi-single point intents and Ping all" )
3484 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3485 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3486 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003487 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003488 time1 = time.time()
3489 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3490 pool = []
3491 for cli in main.CLIs:
3492 egressDevice = deviceDPIDsCopy[i]
3493 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3494 ingressDeviceList.remove(egressDevice)
3495 if i >= len( deviceDPIDsCopy ):
3496 break
3497 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3498 threadID=main.threadID,
3499 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003500 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003501 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003502 t.start()
3503 i = i + 1
3504 main.threadID = main.threadID + 1
3505 for thread in pool:
3506 thread.join()
3507 intentIdList.append(thread.result)
3508 time2 = time.time()
3509 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003510
GlennRCdb2c8422015-09-29 12:21:59 -07003511 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003512
GlennRC1dde1712015-10-02 11:03:08 -07003513 # Giving onos multiple chances to install intents
3514 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003515 if i != 0:
3516 main.log.warn( "Verification failed. Retrying..." )
3517 main.log.info("Waiting for onos to install intents...")
3518 time.sleep( main.checkIntentsDelay )
3519
3520 intentState = main.TRUE
3521 for e in range(int(main.numCtrls)):
3522 main.log.info( "Checking intents on CLI %s" % (e+1) )
3523 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3524 intentState
3525 if not intentState:
3526 main.log.warn( "Not all intents installed" )
3527 if intentState:
3528 break
3529 else:
3530 #Dumping intent summary
3531 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3532
3533 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3534 onpass="INTENTS INSTALLED",
3535 onfail="SOME INTENTS NOT INSTALLED" )
3536
GlennRCfa69a2a2015-10-02 15:54:06 -07003537 main.step("Verify flows are all added")
3538
3539 for i in range( main.flowCheck ):
3540 if i != 0:
3541 main.log.warn( "verification failed. Retrying..." )
3542 main.log.info( "Waiting for onos to add flows..." )
3543 time.sleep( main.checkFlowsDelay )
3544
3545 flowState = main.TRUE
3546 for cli in main.CLIs:
3547 flowState = cli.checkFlowState()
3548 if not flowState:
3549 main.log.warn( "Not all flows added" )
3550 if flowState:
3551 break
3552 else:
3553 #Dumping summary
3554 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3555
3556 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3557 onpass="FLOWS INSTALLED",
3558 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003559
Hari Krishnac195f3b2015-07-08 20:02:24 -07003560 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003561 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003562 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003563 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3564 if not pingResult:
3565 main.log.warn("First pingall failed. Retrying...")
3566 time.sleep(main.pingSleep)
3567 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003568
Hari Krishnac195f3b2015-07-08 20:02:24 -07003569 time2 = time.time()
3570 timeDiff = round( ( time2 - time1 ), 2 )
3571 main.log.report(
3572 "Time taken for Ping All: " +
3573 str( timeDiff ) +
3574 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003575
GlennRCbddd58f2015-10-01 15:45:25 -07003576 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003577 utilities.assert_equals(
3578 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003579 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003580 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3581 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003582
GlennRCfa69a2a2015-10-02 15:54:06 -07003583 if not intentState:
3584 main.log.debug( "Intents failed to install completely" )
3585 if not pingResult:
3586 main.log.debug( "Pingall failed" )
3587 if not checkFlowsState:
3588 main.log.debug( "Flows failed to add completely" )
3589
3590 if not caseResult and main.failSwitch:
3591 main.log.report("Stopping test")
3592 main.stop( email=main.emailOnStop )
3593
Hari Krishnac195f3b2015-07-08 20:02:24 -07003594 def CASE94( self ):
3595 """
3596 Install multi-single point intents and verify Ping all works
3597 for Chordal topology
3598 """
3599 import copy
3600 import time
3601 main.log.report( "Install multi-single point intents and verify Ping all" )
3602 main.log.report( "___________________________________________" )
3603 main.case( "Install multi-single point intents and Ping all" )
3604 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3605 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3606 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003607 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003608 time1 = time.time()
3609 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3610 pool = []
3611 for cli in main.CLIs:
3612 egressDevice = deviceDPIDsCopy[i]
3613 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3614 ingressDeviceList.remove(egressDevice)
3615 if i >= len( deviceDPIDsCopy ):
3616 break
3617 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3618 threadID=main.threadID,
3619 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003620 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003621 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003622 t.start()
3623 i = i + 1
3624 main.threadID = main.threadID + 1
3625 for thread in pool:
3626 thread.join()
3627 intentIdList.append(thread.result)
3628 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003629 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003630
3631 main.step("Verify intents are installed")
3632
GlennRC1dde1712015-10-02 11:03:08 -07003633 # Giving onos multiple chances to install intents
3634 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003635 if i != 0:
3636 main.log.warn( "Verification failed. Retrying..." )
3637 main.log.info("Waiting for onos to install intents...")
3638 time.sleep( main.checkIntentsDelay )
3639
3640 intentState = main.TRUE
3641 for e in range(int(main.numCtrls)):
3642 main.log.info( "Checking intents on CLI %s" % (e+1) )
3643 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3644 intentState
3645 if not intentState:
3646 main.log.warn( "Not all intents installed" )
3647 if intentState:
3648 break
3649 else:
3650 #Dumping intent summary
3651 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3652
GlennRCdb2c8422015-09-29 12:21:59 -07003653 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3654 onpass="INTENTS INSTALLED",
3655 onfail="SOME INTENTS NOT INSTALLED" )
3656
GlennRCfa69a2a2015-10-02 15:54:06 -07003657 main.step("Verify flows are all added")
3658
3659 for i in range( main.flowCheck ):
3660 if i != 0:
3661 main.log.warn( "verification failed. Retrying..." )
3662 main.log.info( "Waiting for onos to add flows..." )
3663 time.sleep( main.checkFlowsDelay )
3664
3665 flowState = main.TRUE
3666 for cli in main.CLIs:
3667 flowState = cli.checkFlowState()
3668 if not flowState:
3669 main.log.warn( "Not all flows added" )
3670 if flowState:
3671 break
3672 else:
3673 #Dumping summary
3674 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3675
3676 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3677 onpass="FLOWS INSTALLED",
3678 onfail="SOME FLOWS NOT ADDED" )
3679
Hari Krishnac195f3b2015-07-08 20:02:24 -07003680 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003681 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003682 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003683 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3684 if not pingResult:
3685 main.log.warn("First pingall failed. Retrying...")
3686 time.sleep(main.pingSleep)
3687 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003688
Hari Krishnac195f3b2015-07-08 20:02:24 -07003689 time2 = time.time()
3690 timeDiff = round( ( time2 - time1 ), 2 )
3691 main.log.report(
3692 "Time taken for Ping All: " +
3693 str( timeDiff ) +
3694 " seconds" )
3695
GlennRCfa69a2a2015-10-02 15:54:06 -07003696 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003697 utilities.assert_equals(
3698 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003699 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003700 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3701 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003702
GlennRCfa69a2a2015-10-02 15:54:06 -07003703 if not intentState:
3704 main.log.debug( "Intents failed to install completely" )
3705 if not pingResult:
3706 main.log.debug( "Pingall failed" )
3707 if not checkFlowsState:
3708 main.log.debug( "Flows failed to add completely" )
3709
3710 if not caseResult and main.failSwitch:
3711 main.log.report("Stopping test")
3712 main.stop( email=main.emailOnStop )
3713
3714 def CASE95( self ):
3715 """
3716 Install multi-single point intents and verify Ping all works
3717 for Spine topology
3718 """
3719 import copy
3720 import time
3721 main.log.report( "Install multi-single point intents and verify Ping all" )
3722 main.log.report( "___________________________________________" )
3723 main.case( "Install multi-single point intents and Ping all" )
3724 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3725 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3726 intentIdList = []
3727 main.log.info( "MACsDict" + str(main.MACsDict) )
3728 time1 = time.time()
3729 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3730 pool = []
3731 for cli in main.CLIs:
3732 egressDevice = deviceDPIDsCopy[i]
3733 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3734 ingressDeviceList.remove(egressDevice)
3735 if i >= len( deviceDPIDsCopy ):
3736 break
3737 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3738 threadID=main.threadID,
3739 name="addMultipointToSinglepointIntent",
3740 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3741 pool.append(t)
3742 t.start()
3743 i = i + 1
3744 main.threadID = main.threadID + 1
3745 for thread in pool:
3746 thread.join()
3747 intentIdList.append(thread.result)
3748 time2 = time.time()
3749 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3750
3751 main.step("Verify intents are installed")
3752
3753 # Giving onos multiple chances to install intents
3754 for i in range( main.intentCheck ):
3755 if i != 0:
3756 main.log.warn( "Verification failed. Retrying..." )
3757 main.log.info("Waiting for onos to install intents...")
3758 time.sleep( main.checkIntentsDelay )
3759
3760 intentState = main.TRUE
3761 for e in range(int(main.numCtrls)):
3762 main.log.info( "Checking intents on CLI %s" % (e+1) )
3763 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3764 intentState
3765 if not intentState:
3766 main.log.warn( "Not all intents installed" )
3767 if intentState:
3768 break
3769 else:
3770 #Dumping intent summary
3771 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3772
3773 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3774 onpass="INTENTS INSTALLED",
3775 onfail="SOME INTENTS NOT INSTALLED" )
3776
3777 main.step("Verify flows are all added")
3778
3779 for i in range( main.flowCheck ):
3780 if i != 0:
3781 main.log.warn( "verification failed. Retrying..." )
3782 main.log.info( "Waiting for onos to add flows..." )
3783 time.sleep( main.checkFlowsDelay )
3784
3785 flowState = main.TRUE
3786 for cli in main.CLIs:
3787 flowState = cli.checkFlowState()
3788 if not flowState:
3789 main.log.warn( "Not all flows added" )
3790 if flowState:
3791 break
3792 else:
3793 #Dumping summary
3794 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3795
3796 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3797 onpass="FLOWS INSTALLED",
3798 onfail="SOME FLOWS NOT ADDED" )
3799
3800 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003801 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07003802 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003803 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3804 if not pingResult:
3805 main.log.warn("First pingall failed. Retrying...")
3806 time.sleep(main.pingSleep)
3807 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003808
3809 time2 = time.time()
3810 timeDiff = round( ( time2 - time1 ), 2 )
3811 main.log.report(
3812 "Time taken for Ping All: " +
3813 str( timeDiff ) +
3814 " seconds" )
3815
3816 caseResult = ( checkFlowsState and pingResult and intentState )
3817 utilities.assert_equals(
3818 expect=main.TRUE,
3819 actual=caseResult,
3820 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3821 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3822
3823 if not intentState:
3824 main.log.debug( "Intents failed to install completely" )
3825 if not pingResult:
3826 main.log.debug( "Pingall failed" )
3827 if not checkFlowsState:
3828 main.log.debug( "Flows failed to add completely" )
3829
3830 if not caseResult and main.failSwitch:
3831 main.log.report("Stopping test")
3832 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003833
3834 def CASE96( self ):
3835 """
3836 Install single-multi point intents and verify Ping all works
3837 for att topology
3838 """
3839 import copy
3840 main.log.report( "Install single-multi point intents and verify Ping all" )
3841 main.log.report( "___________________________________________" )
3842 main.case( "Install single-multi point intents and Ping all" )
3843 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3844 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3845 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003846 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003847 time1 = time.time()
3848 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3849 pool = []
3850 for cli in main.CLIs:
3851 ingressDevice = deviceDPIDsCopy[i]
3852 egressDeviceList = copy.copy(deviceDPIDsCopy)
3853 egressDeviceList.remove(ingressDevice)
3854 if i >= len( deviceDPIDsCopy ):
3855 break
3856 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3857 threadID=main.threadID,
3858 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003859 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003860 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003861 t.start()
3862 i = i + 1
3863 main.threadID = main.threadID + 1
3864 for thread in pool:
3865 thread.join()
3866 intentIdList.append(thread.result)
3867 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003868 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003869
3870 main.step("Verify intents are installed")
3871
GlennRC1dde1712015-10-02 11:03:08 -07003872 # Giving onos multiple chances to install intents
3873 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003874 if i != 0:
3875 main.log.warn( "Verification failed. Retrying..." )
3876 main.log.info("Waiting for onos to install intents...")
3877 time.sleep( main.checkIntentsDelay )
3878
3879 intentState = main.TRUE
3880 for e in range(int(main.numCtrls)):
3881 main.log.info( "Checking intents on CLI %s" % (e+1) )
3882 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3883 intentState
3884 if not intentState:
3885 main.log.warn( "Not all intents installed" )
3886 if intentState:
3887 break
3888 else:
3889 #Dumping intent summary
3890 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3891
GlennRCdb2c8422015-09-29 12:21:59 -07003892 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3893 onpass="INTENTS INSTALLED",
3894 onfail="SOME INTENTS NOT INSTALLED" )
3895
GlennRCfa69a2a2015-10-02 15:54:06 -07003896 main.step("Verify flows are all added")
3897
3898 for i in range( main.flowCheck ):
3899 if i != 0:
3900 main.log.warn( "verification failed. Retrying..." )
3901 main.log.info( "Waiting for onos to add flows..." )
3902 time.sleep( main.checkFlowsDelay )
3903
3904 flowState = main.TRUE
3905 for cli in main.CLIs:
3906 flowState = cli.checkFlowState()
3907 if not flowState:
3908 main.log.warn( "Not all flows added" )
3909 if flowState:
3910 break
3911 else:
3912 #Dumping summary
3913 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3914
3915 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3916 onpass="FLOWS INSTALLED",
3917 onfail="SOME FLOWS NOT ADDED" )
3918
Hari Krishnac195f3b2015-07-08 20:02:24 -07003919 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003920 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003921 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003922 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3923 if not pingResult:
3924 main.log.warn("First pingall failed. Retrying...")
3925 time.sleep(main.pingSleep)
3926 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07003927
Hari Krishnac195f3b2015-07-08 20:02:24 -07003928 time2 = time.time()
3929 timeDiff = round( ( time2 - time1 ), 2 )
3930 main.log.report(
3931 "Time taken for Ping All: " +
3932 str( timeDiff ) +
3933 " seconds" )
3934
GlennRCfa69a2a2015-10-02 15:54:06 -07003935 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003936 utilities.assert_equals(
3937 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003938 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003939 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3940 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3941
GlennRCfa69a2a2015-10-02 15:54:06 -07003942 if not intentState:
3943 main.log.debug( "Intents failed to install completely" )
3944 if not pingResult:
3945 main.log.debug( "Pingall failed" )
3946 if not checkFlowsState:
3947 main.log.debug( "Flows failed to add completely" )
3948
3949 if not caseResult and main.failSwitch:
3950 main.log.report("Stopping test")
3951 main.stop( email=main.emailOnStop )
3952
Hari Krishnac195f3b2015-07-08 20:02:24 -07003953 def CASE97( self ):
3954 """
3955 Install single-multi point intents and verify Ping all works
3956 for Chordal topology
3957 """
3958 import copy
3959 main.log.report( "Install single-multi point intents and verify Ping all" )
3960 main.log.report( "___________________________________________" )
3961 main.case( "Install single-multi point intents and Ping all" )
3962 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3963 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3964 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003965 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003966 time1 = time.time()
3967 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3968 pool = []
3969 for cli in main.CLIs:
3970 ingressDevice = deviceDPIDsCopy[i]
3971 egressDeviceList = copy.copy(deviceDPIDsCopy)
3972 egressDeviceList.remove(ingressDevice)
3973 if i >= len( deviceDPIDsCopy ):
3974 break
3975 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3976 threadID=main.threadID,
3977 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003978 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003979 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003980 t.start()
3981 i = i + 1
3982 main.threadID = main.threadID + 1
3983 for thread in pool:
3984 thread.join()
3985 intentIdList.append(thread.result)
3986 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003987 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003988
3989 main.step("Verify intents are installed")
3990
GlennRC1dde1712015-10-02 11:03:08 -07003991 # Giving onos multiple chances to install intents
3992 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003993 if i != 0:
3994 main.log.warn( "Verification failed. Retrying..." )
3995 main.log.info("Waiting for onos to install intents...")
3996 time.sleep( main.checkIntentsDelay )
3997
3998 intentState = main.TRUE
3999 for e in range(int(main.numCtrls)):
4000 main.log.info( "Checking intents on CLI %s" % (e+1) )
4001 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4002 intentState
4003 if not intentState:
4004 main.log.warn( "Not all intents installed" )
4005 if intentState:
4006 break
4007 else:
4008 #Dumping intent summary
4009 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4010
GlennRCdb2c8422015-09-29 12:21:59 -07004011 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4012 onpass="INTENTS INSTALLED",
4013 onfail="SOME INTENTS NOT INSTALLED" )
4014
GlennRCfa69a2a2015-10-02 15:54:06 -07004015 main.step("Verify flows are all added")
4016
4017 for i in range( main.flowCheck ):
4018 if i != 0:
4019 main.log.warn( "verification failed. Retrying..." )
4020 main.log.info( "Waiting for onos to add flows..." )
4021 time.sleep( main.checkFlowsDelay )
4022
4023 flowState = main.TRUE
4024 for cli in main.CLIs:
4025 flowState = cli.checkFlowState()
4026 if not flowState:
4027 main.log.warn( "Not all flows added" )
4028 if flowState:
4029 break
4030 else:
4031 #Dumping summary
4032 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4033
4034 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4035 onpass="FLOWS INSTALLED",
4036 onfail="SOME FLOWS NOT ADDED" )
4037
Hari Krishnac195f3b2015-07-08 20:02:24 -07004038 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004039 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004040 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004041 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4042 if not pingResult:
4043 main.log.warn("First pingall failed. Retrying...")
4044 time.sleep(main.pingSleep)
4045 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004046
Hari Krishnac195f3b2015-07-08 20:02:24 -07004047 time2 = time.time()
4048 timeDiff = round( ( time2 - time1 ), 2 )
4049 main.log.report(
4050 "Time taken for Ping All: " +
4051 str( timeDiff ) +
4052 " seconds" )
4053
GlennRCfa69a2a2015-10-02 15:54:06 -07004054 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004055 utilities.assert_equals(
4056 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004057 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004058 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4059 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4060
GlennRCfa69a2a2015-10-02 15:54:06 -07004061 if not intentState:
4062 main.log.debug( "Intents failed to install completely" )
4063 if not pingResult:
4064 main.log.debug( "Pingall failed" )
4065 if not checkFlowsState:
4066 main.log.debug( "Flows failed to add completely" )
4067
4068 if not caseResult and main.failSwitch:
4069 main.log.report("Stopping test")
4070 main.stop( email=main.emailOnStop )
4071
Hari Krishnac195f3b2015-07-08 20:02:24 -07004072 def CASE98( self ):
4073 """
4074 Install single-multi point intents and verify Ping all works
4075 for Spine topology
4076 """
4077 import copy
4078 main.log.report( "Install single-multi point intents and verify Ping all" )
4079 main.log.report( "___________________________________________" )
4080 main.case( "Install single-multi point intents and Ping all" )
4081 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
4082 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
4083 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
4084 intentIdList = []
4085 MACsDictCopy = {}
4086 for i in range( len( deviceDPIDsCopy ) ):
4087 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
4088
GlennRCfa69a2a2015-10-02 15:54:06 -07004089 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
4090 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004091 time1 = time.time()
4092 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
4093 pool = []
4094 for cli in main.CLIs:
4095 if i >= len( deviceDPIDsCopy ):
4096 break
4097 ingressDevice = deviceDPIDsCopy[i]
4098 egressDeviceList = copy.copy(deviceDPIDsCopy)
4099 egressDeviceList.remove(ingressDevice)
4100 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4101 threadID=main.threadID,
4102 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004103 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004104 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004105 t.start()
4106 i = i + 1
4107 main.threadID = main.threadID + 1
4108 for thread in pool:
4109 thread.join()
4110 intentIdList.append(thread.result)
4111 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004112 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004113
4114 main.step("Verify intents are installed")
4115
GlennRC1dde1712015-10-02 11:03:08 -07004116 # Giving onos multiple chances to install intents
4117 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004118 if i != 0:
4119 main.log.warn( "Verification failed. Retrying..." )
4120 main.log.info("Waiting for onos to install intents...")
4121 time.sleep( main.checkIntentsDelay )
4122
4123 intentState = main.TRUE
4124 for e in range(int(main.numCtrls)):
4125 main.log.info( "Checking intents on CLI %s" % (e+1) )
4126 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4127 intentState
4128 if not intentState:
4129 main.log.warn( "Not all intents installed" )
4130 if intentState:
4131 break
4132 else:
4133 #Dumping intent summary
4134 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4135
GlennRCdb2c8422015-09-29 12:21:59 -07004136 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4137 onpass="INTENTS INSTALLED",
4138 onfail="SOME INTENTS NOT INSTALLED" )
4139
GlennRCfa69a2a2015-10-02 15:54:06 -07004140 main.step("Verify flows are all added")
4141
4142 for i in range( main.flowCheck ):
4143 if i != 0:
4144 main.log.warn( "verification failed. Retrying..." )
4145 main.log.info( "Waiting for onos to add flows..." )
4146 time.sleep( main.checkFlowsDelay )
4147
4148 flowState = main.TRUE
4149 for cli in main.CLIs:
4150 flowState = cli.checkFlowState()
4151 if not flowState:
4152 main.log.warn( "Not all flows added" )
4153 if flowState:
4154 break
4155 else:
4156 #Dumping summary
4157 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4158
4159 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4160 onpass="FLOWS INSTALLED",
4161 onfail="SOME FLOWS NOT ADDED" )
4162
Hari Krishnac195f3b2015-07-08 20:02:24 -07004163 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004164 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004165 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004166 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4167 if not pingResult:
4168 main.log.warn("First pingall failed. Retrying...")
4169 time.sleep(main.pingSleep)
4170 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004171
Hari Krishnac195f3b2015-07-08 20:02:24 -07004172 time2 = time.time()
4173 timeDiff = round( ( time2 - time1 ), 2 )
4174 main.log.report(
4175 "Time taken for Ping All: " +
4176 str( timeDiff ) +
4177 " seconds" )
4178
GlennRCfa69a2a2015-10-02 15:54:06 -07004179 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004180 utilities.assert_equals(
4181 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004182 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004183 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4184 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4185
GlennRCfa69a2a2015-10-02 15:54:06 -07004186 if not intentState:
4187 main.log.debug( "Intents failed to install completely" )
4188 if not pingResult:
4189 main.log.debug( "Pingall failed" )
4190 if not checkFlowsState:
4191 main.log.debug( "Flows failed to add completely" )
4192
4193 if not caseResult and main.failSwitch:
4194 main.log.report("Stopping test")
4195 main.stop( email=main.emailOnStop )
4196
Hari Krishna4223dbd2015-08-13 16:29:53 -07004197 def CASE190( self ):
4198 """
4199 Verify IPv6 ping across 600 Point intents (Att Topology)
4200 """
4201 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4202 main.log.report( "_________________________________________________" )
4203 import itertools
4204 import time
4205 main.case( "IPv6 ping all 600 Point intents" )
4206 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004207 pingResult = main.FALSE
4208 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004209 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004210 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004211 main.log.warn("First pingall failed. Retrying...")
4212 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004213 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004214 time2 = time.time()
4215 timeDiff = round( ( time2 - time1 ), 2 )
4216 main.log.report(
4217 "Time taken for IPv6 Ping All: " +
4218 str( timeDiff ) +
4219 " seconds" )
4220 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4221 onpass="PING ALL PASS",
4222 onfail="PING ALL FAIL" )
4223
GlennRCbddd58f2015-10-01 15:45:25 -07004224 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004225 utilities.assert_equals(
4226 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004227 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004228 onpass="IPv6 Ping across 600 Point intents test PASS",
4229 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4230
4231 def CASE191( self ):
4232 """
4233 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4234 """
4235 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4236 main.log.report( "_________________________________________________" )
4237 import itertools
4238 import time
4239 main.case( "IPv6 ping all 600 Point intents" )
4240 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004241 pingResult = main.FALSE
4242 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004243 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004244 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004245 main.log.warn("First pingall failed. Retrying...")
4246 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004247 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004248 time2 = time.time()
4249 timeDiff = round( ( time2 - time1 ), 2 )
4250 main.log.report(
4251 "Time taken for IPv6 Ping All: " +
4252 str( timeDiff ) +
4253 " seconds" )
4254 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4255 onpass="PING ALL PASS",
4256 onfail="PING ALL FAIL" )
4257
GlennRCbddd58f2015-10-01 15:45:25 -07004258 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004259 utilities.assert_equals(
4260 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004261 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004262 onpass="IPv6 Ping across 600 Point intents test PASS",
4263 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4264
4265 def CASE192( self ):
4266 """
4267 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4268 """
4269 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4270 main.log.report( "_________________________________________________" )
4271 import itertools
4272 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004273 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004274 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004275 pingResult = main.FALSE
4276 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004277 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004278 if not pingResult:
4279 main.log.warn("First pingall failed. Retrying...")
4280 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004281 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004282 time2 = time.time()
4283 timeDiff = round( ( time2 - time1 ), 2 )
4284 main.log.report(
4285 "Time taken for IPv6 Ping All: " +
4286 str( timeDiff ) +
4287 " seconds" )
4288 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4289 onpass="PING ALL PASS",
4290 onfail="PING ALL FAIL" )
4291
GlennRCbddd58f2015-10-01 15:45:25 -07004292 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004293 utilities.assert_equals(
4294 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004295 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004296 onpass="IPv6 Ping across 4556 Point intents test PASS",
4297 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004298
Hari Krishnac195f3b2015-07-08 20:02:24 -07004299 def CASE10( self ):
4300 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004301 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004302 """
4303 Remove all Intents
4304 """
4305 main.log.report( "Remove all intents that were installed previously" )
4306 main.log.report( "______________________________________________" )
4307 main.log.info( "Remove all intents" )
4308 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004309 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004310 main.step( "Obtain the intent id's first" )
4311 intentsList = main.ONOScli1.getAllIntentIds()
4312 ansi_escape = re.compile( r'\x1b[^m]*m' )
4313 intentsList = ansi_escape.sub( '', intentsList )
4314 intentsList = intentsList.replace(
4315 " onos:intents | grep id=",
4316 "" ).replace(
4317 "id=",
4318 "" ).replace(
4319 "\r\r",
4320 "" )
4321 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004322 intentIdList = []
4323 step1Result = main.TRUE
4324 moreIntents = main.TRUE
4325 removeIntentCount = 0
4326 intentsCount = len(intentsList)
4327 main.log.info ( "Current number of intents: " + str(intentsCount) )
4328 if ( len( intentsList ) > 1 ):
4329 results = main.TRUE
4330 main.log.info("Removing intent...")
4331 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004332 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004333 if removeIntentCount == 5:
4334 break
4335 removeIntentCount = removeIntentCount + 1
4336 intentsList1 = main.ONOScli1.getAllIntentIds()
4337 if len( intentsList1 ) == 0:
4338 break
4339 ansi_escape = re.compile( r'\x1b[^m]*m' )
4340 intentsList1 = ansi_escape.sub( '', intentsList1 )
4341 intentsList1 = intentsList1.replace(
4342 " onos:intents | grep id=",
4343 "" ).replace(
4344 " state=",
4345 "" ).replace(
4346 "\r\r",
4347 "" )
4348 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004349 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4350 print intentsList1
4351 intentIdList1 = []
4352 if ( len( intentsList1 ) > 0 ):
4353 moreIntents = main.TRUE
4354 for i in range( len( intentsList1 ) ):
4355 intentsTemp1 = intentsList1[ i ].split( ',' )
4356 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4357 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4358 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4359 time1 = time.time()
4360 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4361 pool = []
4362 for cli in main.CLIs:
4363 if i >= len( intentIdList1 ):
4364 break
4365 t = main.Thread( target=cli.removeIntent,
4366 threadID=main.threadID,
4367 name="removeIntent",
4368 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4369 pool.append(t)
4370 t.start()
4371 i = i + 1
4372 main.threadID = main.threadID + 1
4373 for thread in pool:
4374 thread.join()
4375 intentIdList.append(thread.result)
4376 #time.sleep(2)
4377 time2 = time.time()
4378 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004379 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004380 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004381 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004382 else:
4383 time.sleep(10)
4384 if len( main.ONOScli1.intents()):
4385 continue
4386 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004387 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004388 else:
4389 print "Removed %d intents" %(intentsCount)
4390 step1Result = main.TRUE
4391 else:
4392 print "No Intent IDs found in Intents list: ", intentsList
4393 step1Result = main.FALSE
4394
4395 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004396 caseResult = step1Result
4397 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004398 onpass="Intent removal test successful",
4399 onfail="Intent removal test failed" )
4400
4401 def CASE12( self, main ):
4402 """
4403 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4404 """
4405 import re
4406 import copy
4407 import time
4408
Hari Krishnac195f3b2015-07-08 20:02:24 -07004409 threadID = 0
4410
4411 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4412 main.log.report( "_____________________________________________________" )
4413 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4414 main.step( "Enable intent based Reactive forwarding" )
4415 installResult = main.FALSE
4416 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004417
Hari Krishnac195f3b2015-07-08 20:02:24 -07004418 pool = []
4419 time1 = time.time()
4420 for cli,feature in main.CLIs:
4421 t = main.Thread(target=cli,threadID=threadID,
4422 name="featureInstall",args=[feature])
4423 pool.append(t)
4424 t.start()
4425 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004426
Hari Krishnac195f3b2015-07-08 20:02:24 -07004427 results = []
4428 for thread in pool:
4429 thread.join()
4430 results.append(thread.result)
4431 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004432
Hari Krishnac195f3b2015-07-08 20:02:24 -07004433 if( all(result == main.TRUE for result in results) == False):
4434 main.log.info("Did not install onos-app-ifwd feature properly")
4435 #main.cleanup()
4436 #main.exit()
4437 else:
4438 main.log.info("Successful feature:install onos-app-ifwd")
4439 installResult = main.TRUE
4440 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004441
GlennRC6ac11b12015-10-21 17:41:28 -07004442 main.step( "Verify Ping across all hosts" )
4443 for i in range(main.numPings):
4444 time1 = time.time()
4445 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4446 if not pingResult:
4447 main.log.warn("First pingall failed. Retrying...")
4448 time.sleep(main.pingSleep)
4449 else: break
4450
Hari Krishnac195f3b2015-07-08 20:02:24 -07004451 time2 = time.time()
4452 timeDiff = round( ( time2 - time1 ), 2 )
4453 main.log.report(
4454 "Time taken for Ping All: " +
4455 str( timeDiff ) +
4456 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004457
GlennRC626ba132015-09-18 16:16:31 -07004458 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004459 main.log.report( "Pingall Test in Reactive mode successful" )
4460 else:
4461 main.log.report( "Pingall Test in Reactive mode failed" )
4462
4463 main.step( "Disable Intent based Reactive forwarding" )
4464 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004465
Hari Krishnac195f3b2015-07-08 20:02:24 -07004466 pool = []
4467 time1 = time.time()
4468 for cli,feature in main.CLIs:
4469 t = main.Thread(target=cli,threadID=threadID,
4470 name="featureUninstall",args=[feature])
4471 pool.append(t)
4472 t.start()
4473 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004474
Hari Krishnac195f3b2015-07-08 20:02:24 -07004475 results = []
4476 for thread in pool:
4477 thread.join()
4478 results.append(thread.result)
4479 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004480
Hari Krishnac195f3b2015-07-08 20:02:24 -07004481 if( all(result == main.TRUE for result in results) == False):
4482 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4483 uninstallResult = main.FALSE
4484 #main.cleanup()
4485 #main.exit()
4486 else:
4487 main.log.info("Successful feature:uninstall onos-app-ifwd")
4488 uninstallResult = main.TRUE
4489 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4490
4491 # Waiting for reative flows to be cleared.
4492 time.sleep( 10 )
4493
GlennRCbddd58f2015-10-01 15:45:25 -07004494 caseResult = installResult and pingResult and uninstallResult
4495 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004496 onpass="Intent based Reactive forwarding Pingall test PASS",
4497 onfail="Intent based Reactive forwarding Pingall test FAIL" )