blob: 40bd549e0f92d2d2b1099d8b7d2fbe3e36d326a5 [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'] )
You Wang0779bac2016-01-27 16:32:33 -080038 main.linkCheck = int( main.params['TEST']['linkChecks'] )
GlennRC289c1b62015-12-12 10:45:43 -080039 main.topoCheck = int( main.params['TEST']['topoChecks'] )
GlennRCf7be6632015-10-20 13:04:07 -070040 main.numPings = int( main.params['TEST']['numPings'] )
GlennRC6ac11b12015-10-21 17:41:28 -070041 main.pingSleep = int( main.params['timers']['pingSleep'] )
GlennRC289c1b62015-12-12 10:45:43 -080042 main.topoCheckDelay = int( main.params['timers']['topoCheckDelay'] )
GlennRC3de72232015-12-16 10:48:35 -080043 main.pingTimeout = int( main.params['timers']['pingTimeout'] )
GlennRC20fc6522015-12-23 23:26:57 -080044 main.remHostDelay = int( main.params['timers']['remHostDelay'] )
45 main.remDevDelay = int( main.params['timers']['remDevDelay'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070046 main.newTopo = ""
47 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070048
GlennRC9e7465e2015-10-02 13:50:36 -070049 main.failSwitch = True if main.failSwitch == "on" else False
50 main.emailOnStop = True if main.emailOnStop == "on" else False
51
Hari Krishnac195f3b2015-07-08 20:02:24 -070052 for i in range( 1, int(main.numCtrls) + 1 ):
53 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070054
55 main.case( "Set up test environment" )
56 main.log.report( "Set up test environment" )
57 main.log.report( "_______________________" )
58
Hari Krishna6185fc12015-07-13 15:42:31 -070059 main.step( "Apply Cell environment for ONOS" )
60 if ( main.onoscell ):
61 cellName = main.onoscell
62 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070063 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
64 onpass="Test step PASS",
65 onfail="Test step FAIL" )
66 else:
67 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
68 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080069 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070070 main.exit()
71
Hari Krishnac195f3b2015-07-08 20:02:24 -070072 main.step( "Git checkout and pull " + git_branch )
73 if git_pull == 'on':
74 checkout_result = main.ONOSbench.gitCheckout( git_branch )
75 pull_result = main.ONOSbench.gitPull()
76 cp_result = ( checkout_result and pull_result )
77 else:
78 checkout_result = main.TRUE
79 pull_result = main.TRUE
80 main.log.info( "Skipped git checkout and pull" )
81 cp_result = ( checkout_result and pull_result )
82 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
83 onpass="Test step PASS",
84 onfail="Test step FAIL" )
85
86 main.step( "mvn clean & install" )
87 if git_pull == 'on':
88 mvn_result = main.ONOSbench.cleanInstall()
89 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
90 onpass="Test step PASS",
91 onfail="Test step FAIL" )
92 else:
93 mvn_result = main.TRUE
94 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
95
96 main.ONOSbench.getVersion( report=True )
97
Hari Krishnac195f3b2015-07-08 20:02:24 -070098 main.step( "Create ONOS package" )
99 packageResult = main.ONOSbench.onosPackage()
100 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
101 onpass="Test step PASS",
102 onfail="Test step FAIL" )
103
104 main.step( "Uninstall ONOS package on all Nodes" )
105 uninstallResult = main.TRUE
106 for i in range( int( main.numCtrls ) ):
107 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
108 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
109 utilities.assert_equals( expect=main.TRUE, actual=u_result,
110 onpass="Test step PASS",
111 onfail="Test step FAIL" )
112 uninstallResult = ( uninstallResult and u_result )
113
114 main.step( "Install ONOS package on all Nodes" )
115 installResult = main.TRUE
116 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700117 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700118 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
119 utilities.assert_equals( expect=main.TRUE, actual=i_result,
120 onpass="Test step PASS",
121 onfail="Test step FAIL" )
122 installResult = ( installResult and i_result )
123
124 main.step( "Verify ONOS nodes UP status" )
125 statusResult = main.TRUE
126 for i in range( int( main.numCtrls ) ):
127 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
128 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
129 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
130 onpass="Test step PASS",
131 onfail="Test step FAIL" )
132 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700133
Hari Krishnac195f3b2015-07-08 20:02:24 -0700134 main.step( "Start ONOS CLI on all nodes" )
135 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700136 main.log.step(" Start ONOS cli using thread ")
137 startCliResult = main.TRUE
138 pool = []
139 time1 = time.time()
140 for i in range( int( main.numCtrls) ):
141 t = main.Thread( target=main.CLIs[i].startOnosCli,
142 threadID=main.threadID,
143 name="startOnosCli",
144 args=[ main.onosIPs[i], karafTimeout ] )
145 pool.append(t)
146 t.start()
147 main.threadID = main.threadID + 1
148 for t in pool:
149 t.join()
150 startCliResult = startCliResult and t.result
151 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700152
Hari Krishnac195f3b2015-07-08 20:02:24 -0700153 if not startCliResult:
154 main.log.info("ONOS CLI did not start up properly")
155 main.cleanup()
156 main.exit()
157 else:
158 main.log.info("Successful CLI startup")
159 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700160
161 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
162 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
163 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
164 cfgResult = cfgResult1 and cfgResult2
165 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
166 onpass="ipv6NeighborDiscovery cfg is set to true",
167 onfail="Failed to cfg set ipv6NeighborDiscovery" )
168
169 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700170 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
171 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
172 onpass="Set up test environment PASS",
173 onfail="Set up test environment FAIL" )
174
175 def CASE20( self, main ):
176 """
177 This test script Loads a new Topology (Att) on CHO setup and balances all switches
178 """
179 import re
180 import time
181 import copy
182
GlennRC3de72232015-12-16 10:48:35 -0800183 main.prefix = 0
184
Hari Krishnac195f3b2015-07-08 20:02:24 -0700185 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
186 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
187 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700188 main.log.report(
189 "Load Att topology and Balance all Mininet switches across controllers" )
190 main.log.report(
191 "________________________________________________________________________" )
192 main.case(
193 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700194
Hari Krishnac195f3b2015-07-08 20:02:24 -0700195 main.step( "Start Mininet with Att topology" )
196 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700197 mininetDir = main.Mininet1.home + "/custom/"
198 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
199 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
200 topoPath = mininetDir + main.newTopo
201 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700202
Hari Krishnac195f3b2015-07-08 20:02:24 -0700203 main.step( "Assign switches to controllers" )
204 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
205 main.Mininet1.assignSwController(
206 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700207 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700208
209 switch_mastership = main.TRUE
210 for i in range( 1, ( main.numMNswitches + 1 ) ):
211 response = main.Mininet1.getSwController( "s" + str( i ) )
212 print( "Response is " + str( response ) )
213 if re.search( "tcp:" + main.onosIPs[0], response ):
214 switch_mastership = switch_mastership and main.TRUE
215 else:
216 switch_mastership = main.FALSE
217
218 if switch_mastership == main.TRUE:
219 main.log.report( "Controller assignment successfull" )
220 else:
221 main.log.report( "Controller assignment failed" )
222
223 time.sleep(30) # waiting here to make sure topology converges across all nodes
224
225 main.step( "Balance devices across controllers" )
226 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700227 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700228 time.sleep( 5 )
229
230 topology_output = main.ONOScli1.topology()
231 topology_result = main.ONOSbench.getTopology( topology_output )
232 case2Result = ( switch_mastership and startStatus )
233 utilities.assert_equals(
234 expect=main.TRUE,
235 actual=case2Result,
236 onpass="Starting new Att topology test PASS",
237 onfail="Starting new Att topology test FAIL" )
238
239 def CASE21( self, main ):
240 """
241 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
242 """
243 import re
244 import time
245 import copy
246
GlennRC3de72232015-12-16 10:48:35 -0800247 main.prefix = 1
GlennRC2db29952015-12-14 12:00:29 -0800248
Hari Krishnac195f3b2015-07-08 20:02:24 -0700249 main.newTopo = main.params['TOPO2']['topo']
250 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
251 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
252 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700253 main.log.report(
254 "Load Chordal topology and Balance all Mininet switches across controllers" )
255 main.log.report(
256 "________________________________________________________________________" )
257 main.case(
258 "Assign and Balance all Mininet switches across controllers" )
259
GlennRCc6cd2a62015-08-10 16:08:22 -0700260 main.step("Start Mininet with Chordal topology")
261 mininetDir = main.Mininet1.home + "/custom/"
262 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
263 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
264 topoPath = mininetDir + main.newTopo
265 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700266
267 main.step( "Assign switches to controllers" )
268
269 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
270 main.Mininet1.assignSwController(
271 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700272 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700273
274 switch_mastership = main.TRUE
275 for i in range( 1, ( main.numMNswitches + 1 ) ):
276 response = main.Mininet1.getSwController( "s" + str( i ) )
277 print( "Response is " + str( response ) )
278 if re.search( "tcp:" + main.onosIPs[0], response ):
279 switch_mastership = switch_mastership and main.TRUE
280 else:
281 switch_mastership = main.FALSE
282
283 if switch_mastership == main.TRUE:
284 main.log.report( "Controller assignment successfull" )
285 else:
286 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700287
Hari Krishnac195f3b2015-07-08 20:02:24 -0700288 main.step( "Balance devices across controllers" )
289 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700290 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700291 time.sleep( 5 )
292
GlennRCbddd58f2015-10-01 15:45:25 -0700293 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 time.sleep(30)
295 utilities.assert_equals(
296 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700297 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700298 onpass="Starting new Chordal topology test PASS",
299 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700300
Hari Krishnac195f3b2015-07-08 20:02:24 -0700301 def CASE22( self, main ):
302 """
303 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
304 """
305 import re
306 import time
307 import copy
308
GlennRC3de72232015-12-16 10:48:35 -0800309 main.prefix = 2
GlennRC2db29952015-12-14 12:00:29 -0800310
Hari Krishnac195f3b2015-07-08 20:02:24 -0700311 main.newTopo = main.params['TOPO3']['topo']
312 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
313 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
314 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
315 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700316
Hari Krishnac195f3b2015-07-08 20:02:24 -0700317 main.log.report(
318 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
319 main.log.report(
320 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800321 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700322
323 main.step("Start Mininet with Spine topology")
324 mininetDir = main.Mininet1.home + "/custom/"
325 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
326 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
327 topoPath = mininetDir + main.newTopo
328 startStatus = main.Mininet1.startNet(topoFile = topoPath)
329
Hari Krishnac195f3b2015-07-08 20:02:24 -0700330 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
331 main.Mininet1.assignSwController(
332 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700333 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700334
335 switch_mastership = main.TRUE
336 for i in range( 1, ( main.numMNswitches + 1 ) ):
337 response = main.Mininet1.getSwController( "s" + str( i ) )
338 print( "Response is " + str( response ) )
339 if re.search( "tcp:" + main.onosIPs[0], response ):
340 switch_mastership = switch_mastership and main.TRUE
341 else:
342 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700343
Hari Krishnac195f3b2015-07-08 20:02:24 -0700344 if switch_mastership == main.TRUE:
345 main.log.report( "Controller assignment successfull" )
346 else:
347 main.log.report( "Controller assignment failed" )
348 time.sleep( 5 )
349
350 main.step( "Balance devices across controllers" )
351 for i in range( int( main.numCtrls ) ):
352 balanceResult = main.ONOScli1.balanceMasters()
353 # giving some breathing time for ONOS to complete re-balance
354 time.sleep( 3 )
355
GlennRCbddd58f2015-10-01 15:45:25 -0700356 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700357 time.sleep(60)
358 utilities.assert_equals(
359 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700360 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700361 onpass="Starting new Spine topology test PASS",
362 onfail="Starting new Spine topology test FAIL" )
363
364 def CASE3( self, main ):
365 """
366 This Test case will be extended to collect and store more data related
367 ONOS state.
368 """
369 import re
370 import copy
371 main.deviceDPIDs = []
372 main.hostMACs = []
373 main.deviceLinks = []
374 main.deviceActiveLinksCount = []
375 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700376
Hari Krishnac195f3b2015-07-08 20:02:24 -0700377 main.log.report(
378 "Collect and Store topology details from ONOS before running any Tests" )
379 main.log.report(
380 "____________________________________________________________________" )
381 main.case( "Collect and Store Topology Details from ONOS" )
382 main.step( "Collect and store current number of switches and links" )
383 topology_output = main.ONOScli1.topology()
384 topology_result = main.ONOSbench.getTopology( topology_output )
385 numOnosDevices = topology_result[ 'devices' ]
386 numOnosLinks = topology_result[ 'links' ]
387 topoResult = main.TRUE
388
GlennRCee8f3bf2015-12-14 16:18:39 -0800389 for check in range(main.topoCheck):
390 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
391 main.step( "Store Device DPIDs" )
392 for i in range( 1, (main.numMNswitches+1) ):
GlennRC20fc6522015-12-23 23:26:57 -0800393 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800394 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700395
GlennRCee8f3bf2015-12-14 16:18:39 -0800396 main.step( "Store Host MACs" )
397 for i in range( 1, ( main.numMNhosts + 1 ) ):
398 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
399 print "Host MACs in Store: \n", str( main.hostMACs )
400 main.MACsDict = {}
401 print "Creating dictionary of DPID and HostMacs"
402 for i in range(len(main.hostMACs)):
403 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
404 print main.MACsDict
405 main.step( "Collect and store all Devices Links" )
406 linksResult = main.ONOScli1.links( jsonFormat=False )
407 ansi_escape = re.compile( r'\x1b[^m]*m' )
408 linksResult = ansi_escape.sub( '', linksResult )
409 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
410 linksResult = linksResult.splitlines()
411 main.deviceLinks = copy.copy( linksResult )
412 print "Device Links Stored: \n", str( main.deviceLinks )
413 # this will be asserted to check with the params provided count of
414 # links
415 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700416
GlennRCee8f3bf2015-12-14 16:18:39 -0800417 main.step( "Collect and store each Device ports enabled Count" )
418 time1 = time.time()
419 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
420 pool = []
421 for cli in main.CLIs:
422 if i >= main.numMNswitches + 1:
423 break
GlennRC20fc6522015-12-23 23:26:57 -0800424 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800425 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
426 t.start()
427 pool.append(t)
428 i = i + 1
429 main.threadID = main.threadID + 1
430 for thread in pool:
431 thread.join()
432 portResult = thread.result
433 main.devicePortsEnabledCount.append( portResult )
434 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
435 time2 = time.time()
436 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700437
GlennRCee8f3bf2015-12-14 16:18:39 -0800438 main.step( "Collect and store each Device active links Count" )
439 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700440
GlennRCee8f3bf2015-12-14 16:18:39 -0800441 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
442 pool = []
443 for cli in main.CLIs:
444 if i >= main.numMNswitches + 1:
445 break
GlennRC20fc6522015-12-23 23:26:57 -0800446 dpid = "of:00000000000000" + format( i, "02x" )
GlennRCee8f3bf2015-12-14 16:18:39 -0800447 t = main.Thread( target = cli.getDeviceLinksActiveCount,
448 threadID = main.threadID,
449 name = "getDevicePortsEnabledCount",
450 args = [dpid])
451 t.start()
452 pool.append(t)
453 i = i + 1
454 main.threadID = main.threadID + 1
455 for thread in pool:
456 thread.join()
457 linkCountResult = thread.result
458 main.deviceActiveLinksCount.append( linkCountResult )
459 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
460 time2 = time.time()
461 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnac195f3b2015-07-08 20:02:24 -0700462
GlennRCee8f3bf2015-12-14 16:18:39 -0800463 # Exit out of the topo check loop
464 break
465
466 else:
467 main.log.info("Devices (expected): %s, Links (expected): %s" %
468 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
469 main.log.info("Devices (actual): %s, Links (actual): %s" %
470 ( numOnosDevices , numOnosLinks ) )
471 main.log.info("Topology does not match, trying again...")
472 topoResult = main.FALSE
473 time.sleep(main.topoCheckDelay)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700474
475 # just returning TRUE for now as this one just collects data
476 case3Result = topoResult
477 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
478 onpass="Saving ONOS topology data test PASS",
479 onfail="Saving ONOS topology data test FAIL" )
480
GlennRC186b7362015-12-11 18:20:16 -0800481
GlennRC20fc6522015-12-23 23:26:57 -0800482
483 def CASE200( self, main ):
484
485 import time
486 main.log.report( "Clean up ONOS" )
487 main.log.case( "Stop topology and remove hosts and devices" )
488
489 main.step( "Stop Topology" )
490 stopStatus = main.Mininet1.stopNet()
491 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
492 onpass="Stopped mininet",
493 onfail="Failed to stop mininet" )
494
495
496 main.log.info( "Constructing host id list" )
497 hosts = []
498 for i in range( main.numMNhosts ):
499 hosts.append( "h" + str(i+1) )
500
501 main.step( "Getting host ids" )
502 hostList = main.CLIs[0].getHostsId( hosts )
503 hostIdResult = True if hostList else False
504 utilities.assert_equals( expect=True, actual=hostIdResult,
505 onpass="Successfully obtained the host ids.",
506 onfail="Failed to obtain the host ids" )
507
508 main.step( "Removing hosts" )
509 hostResult = main.CLIs[0].removeHost( hostList )
510 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
511 onpass="Successfully removed hosts",
512 onfail="Failed remove hosts" )
513
514 time.sleep( main.remHostDelay )
515
516 main.log.info( "Constructing device uri list" )
517 deviceList = []
518 for i in range( main.numMNswitches ):
519 deviceList.append( "of:00000000000000" + format( i+1, "02x" ) )
520
521 main.step( "Removing devices" )
522 deviceResult = main.CLIs[0].removeDevice( deviceList )
523 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
524 onpass="Successfully removed devices",
525 onfail="Failed remove devices" )
526
527 time.sleep( main.remDevDelay )
528
529 main.log.info( "Summary\n{}".format( main.CLIs[0].summary( jsonFormat=False ) ) )
530
531
Hari Krishnac195f3b2015-07-08 20:02:24 -0700532 def CASE40( self, main ):
533 """
GlennRC15d164c2015-12-15 17:12:25 -0800534 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700535 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700536 import time
GlennRC15d164c2015-12-15 17:12:25 -0800537 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700538 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800539 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700540
GlennRC15d164c2015-12-15 17:12:25 -0800541 main.step( "Enable Reactive forwarding" )
542 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
543 utilities.assert_equals( expect=main.TRUE, actual=appResult,
544 onpass="Successfully install fwd app",
545 onfail="Failed to install fwd app" )
546
Hari Krishnac195f3b2015-07-08 20:02:24 -0700547
GlennRC6ac11b12015-10-21 17:41:28 -0700548 main.step( "Verify Ping across all hosts" )
549 for i in range(main.numPings):
550 time1 = time.time()
551 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
552 if not pingResult:
553 main.log.warn("First pingall failed. Retrying...")
554 time.sleep(main.pingSleep)
GlennRC15d164c2015-12-15 17:12:25 -0800555 else:
556 break
GlennRC6ac11b12015-10-21 17:41:28 -0700557
Hari Krishnac195f3b2015-07-08 20:02:24 -0700558 time2 = time.time()
559 timeDiff = round( ( time2 - time1 ), 2 )
560 main.log.report(
561 "Time taken for Ping All: " +
562 str( timeDiff ) +
563 " seconds" )
564
GlennRC3de72232015-12-16 10:48:35 -0800565 if not pingResult:
566 main.stop()
567
GlennRC15d164c2015-12-15 17:12:25 -0800568 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700569 onpass="Reactive Mode IPv4 Pingall test PASS",
570 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700571
GlennRC15d164c2015-12-15 17:12:25 -0800572 main.step( "Disable Reactive forwarding" )
573 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
574 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800575 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800576 onfail="Failed to deactivate fwd app" )
577
Hari Krishnac195f3b2015-07-08 20:02:24 -0700578 def CASE41( self, main ):
579 """
580 Verify Reactive forwarding (Chordal Topology)
581 """
582 import re
583 import copy
584 import time
585 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
586 main.log.report( "______________________________________________" )
587 main.case( "Enable Reactive forwarding and Verify ping all" )
588 main.step( "Enable Reactive forwarding" )
589 installResult = main.TRUE
590 # Activate fwd app
591 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
592
593 appCheck = main.TRUE
594 pool = []
595 for cli in main.CLIs:
596 t = main.Thread( target=cli.appToIDCheck,
597 name="appToIDCheck-" + str( i ),
598 args=[] )
599 pool.append( t )
600 t.start()
601 for t in pool:
602 t.join()
603 appCheck = appCheck and t.result
604 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
605 onpass="App Ids seem to be correct",
606 onfail="Something is wrong with app Ids" )
607 if appCheck != main.TRUE:
608 main.log.warn( main.CLIs[0].apps() )
609 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700610
Hari Krishnac195f3b2015-07-08 20:02:24 -0700611 time.sleep( 10 )
612
GlennRC6ac11b12015-10-21 17:41:28 -0700613 main.step( "Verify Ping across all hosts" )
614 for i in range(main.numPings):
615 time1 = time.time()
616 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
617 if not pingResult:
618 main.log.warn("First pingall failed. Retrying...")
619 time.sleep(main.pingSleep)
620 else: break
621
Hari Krishnac195f3b2015-07-08 20:02:24 -0700622 time2 = time.time()
623 timeDiff = round( ( time2 - time1 ), 2 )
624 main.log.report(
625 "Time taken for Ping All: " +
626 str( timeDiff ) +
627 " seconds" )
628
GlennRC626ba132015-09-18 16:16:31 -0700629 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700630 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700631 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700632 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700633
GlennRCbddd58f2015-10-01 15:45:25 -0700634 caseResult = appCheck and pingResult
635 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700636 onpass="Reactive Mode IPv4 Pingall test PASS",
637 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700638
639 def CASE42( self, main ):
640 """
641 Verify Reactive forwarding (Spine Topology)
642 """
643 import re
644 import copy
645 import time
646 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
647 main.log.report( "______________________________________________" )
648 main.case( "Enable Reactive forwarding and Verify ping all" )
649 main.step( "Enable Reactive forwarding" )
650 installResult = main.TRUE
651 # Activate fwd app
652 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
653
654 appCheck = main.TRUE
655 pool = []
656 for cli in main.CLIs:
657 t = main.Thread( target=cli.appToIDCheck,
658 name="appToIDCheck-" + str( i ),
659 args=[] )
660 pool.append( t )
661 t.start()
662 for t in pool:
663 t.join()
664 appCheck = appCheck and t.result
665 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
666 onpass="App Ids seem to be correct",
667 onfail="Something is wrong with app Ids" )
668 if appCheck != main.TRUE:
669 main.log.warn( main.CLIs[0].apps() )
670 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700671
Hari Krishnac195f3b2015-07-08 20:02:24 -0700672 time.sleep( 10 )
673
GlennRC6ac11b12015-10-21 17:41:28 -0700674 main.step( "Verify Ping across all hosts" )
675 for i in range(main.numPings):
676 time1 = time.time()
677 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
678 if not pingResult:
679 main.log.warn("First pingall failed. Retrying...")
680 time.sleep(main.pingSleep)
681 else: break
682
Hari Krishnac195f3b2015-07-08 20:02:24 -0700683 time2 = time.time()
684 timeDiff = round( ( time2 - time1 ), 2 )
685 main.log.report(
686 "Time taken for Ping All: " +
687 str( timeDiff ) +
688 " seconds" )
689
GlennRC626ba132015-09-18 16:16:31 -0700690 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700691 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700692 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700693 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
694
GlennRCbddd58f2015-10-01 15:45:25 -0700695 caseResult = appCheck and pingResult
696 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700697 onpass="Reactive Mode IPv4 Pingall test PASS",
698 onfail="Reactive Mode IPv4 Pingall test FAIL" )
699
GlennRC026dba62016-01-07 18:42:33 -0800700 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800701 """
702 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
703 """
GlennRC026dba62016-01-07 18:42:33 -0800704 import time
You Wang0779bac2016-01-27 16:32:33 -0800705 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800706 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800707 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800708
709 main.step( "Enable Reactive forwarding" )
710 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
711 utilities.assert_equals( expect=main.TRUE, actual=appResult,
712 onpass="Successfully install fwd app",
713 onfail="Failed to install fwd app" )
714
715 numHosts = int( main.params['TOPO1']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800716
717 for i in range(numHosts):
718 src = "h1"
719 dest = "h" + str(i+1)
720 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
721 main.Mininet1.handle.expect( "mininet>" )
722 main.log.info( main.Mininet1.handle.before )
723
724 hosts = main.CLIs[0].hosts( jsonFormat=False )
725
726 main.log.info( hosts )
727
728 main.step( "Disable Reactive forwarding" )
729 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
730 utilities.assert_equals( expect=main.TRUE, actual=appResult,
731 onpass="Successfully deactivated fwd app",
732 onfail="Failed to deactivate fwd app" )
733
734 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800735 """
736 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
737 """
GlennRC026dba62016-01-07 18:42:33 -0800738 import time
You Wang0779bac2016-01-27 16:32:33 -0800739 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800740 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800741 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800742
743 main.step( "Enable Reactive forwarding" )
744 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
745 utilities.assert_equals( expect=main.TRUE, actual=appResult,
746 onpass="Successfully install fwd app",
747 onfail="Failed to install fwd app" )
748
749 numHosts = int( main.params['TOPO2']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800750
751 for i in range(numHosts):
752 src = "h1"
753 dest = "h" + str(i+1)
754 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
755 main.Mininet1.handle.expect( "mininet>" )
756 main.log.info( main.Mininet1.handle.before )
757
758 hosts = main.CLIs[0].hosts( jsonFormat=False )
759
760 main.log.info( hosts )
761
762 main.step( "Disable Reactive forwarding" )
763 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
764 utilities.assert_equals( expect=main.TRUE, actual=appResult,
765 onpass="Successfully deactivated fwd app",
766 onfail="Failed to deactivate fwd app" )
767
768 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800769 """
770 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
771 """
GlennRC026dba62016-01-07 18:42:33 -0800772 import time
You Wang0779bac2016-01-27 16:32:33 -0800773 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800774 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800775 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800776
777 main.step( "Enable Reactive forwarding" )
778 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
779 utilities.assert_equals( expect=main.TRUE, actual=appResult,
780 onpass="Successfully install fwd app",
781 onfail="Failed to install fwd app" )
782
783 numHosts = int( main.params['TOPO3']['numHosts'] )
GlennRC026dba62016-01-07 18:42:33 -0800784
You Wang0779bac2016-01-27 16:32:33 -0800785 for i in range(11, numHosts+10):
GlennRC026dba62016-01-07 18:42:33 -0800786 src = "h11"
You Wang0779bac2016-01-27 16:32:33 -0800787 dest = "h" + str(i+1)
GlennRC026dba62016-01-07 18:42:33 -0800788 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
789 main.Mininet1.handle.expect( "mininet>" )
790 main.log.info( main.Mininet1.handle.before )
791
792 hosts = main.CLIs[0].hosts( jsonFormat=False )
793
794 main.log.info( hosts )
795
796 main.step( "Disable Reactive forwarding" )
797 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
798 utilities.assert_equals( expect=main.TRUE, actual=appResult,
799 onpass="Successfully deactivated fwd app",
800 onfail="Failed to deactivate fwd app" )
801
Hari Krishna4223dbd2015-08-13 16:29:53 -0700802 def CASE140( self, main ):
803 """
804 Verify IPv6 Reactive forwarding (Att Topology)
805 """
806 import re
807 import copy
808 import time
809 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
810 main.log.report( "______________________________________________" )
811 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
812 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
813
814 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
815 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
816 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
817 cfgResult = cfgResult1 and cfgResult2
818 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
819 onpass="Reactive mode ipv6Fowarding cfg is set to true",
820 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
821
822 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700823 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700824 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700825 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
826 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700827 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700828 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700829 time2 = time.time()
830 timeDiff = round( ( time2 - time1 ), 2 )
831 main.log.report(
832 "Time taken for IPv6 Ping All: " +
833 str( timeDiff ) +
834 " seconds" )
835
GlennRC626ba132015-09-18 16:16:31 -0700836 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700837 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
838 else:
839 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700840
Jon Hall4ba53f02015-07-29 13:07:41 -0700841
GlennRC15d164c2015-12-15 17:12:25 -0800842 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700843 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700844 onpass="Reactive Mode IPv6 Pingall test PASS",
845 onfail="Reactive Mode IPv6 Pingall test FAIL" )
846
847 def CASE141( self, main ):
848 """
849 Verify IPv6 Reactive forwarding (Chordal Topology)
850 """
851 import re
852 import copy
853 import time
854 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
855 main.log.report( "______________________________________________" )
856 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
857 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
858
859 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
860 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
861 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
862 cfgResult = cfgResult1 and cfgResult2
863 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
864 onpass="Reactive mode ipv6Fowarding cfg is set to true",
865 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
866
867 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700868 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700869 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700870 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
871 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700872 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700873 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700874 time2 = time.time()
875 timeDiff = round( ( time2 - time1 ), 2 )
876 main.log.report(
877 "Time taken for IPv6 Ping All: " +
878 str( timeDiff ) +
879 " seconds" )
880
GlennRC626ba132015-09-18 16:16:31 -0700881 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700882 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
883 else:
884 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
885
886 main.step( "Disable Reactive forwarding" )
887
888 main.log.info( "Uninstall reactive forwarding app" )
889 appCheck = main.TRUE
890 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
891 pool = []
892 for cli in main.CLIs:
893 t = main.Thread( target=cli.appToIDCheck,
894 name="appToIDCheck-" + str( i ),
895 args=[] )
896 pool.append( t )
897 t.start()
898
899 for t in pool:
900 t.join()
901 appCheck = appCheck and t.result
902 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
903 onpass="App Ids seem to be correct",
904 onfail="Something is wrong with app Ids" )
905 if appCheck != main.TRUE:
906 main.log.warn( main.CLIs[0].apps() )
907 main.log.warn( main.CLIs[0].appIDs() )
908
909 # Waiting for reative flows to be cleared.
910 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700911 caseResult = appCheck and cfgResult and pingResult
912 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700913 onpass="Reactive Mode IPv6 Pingall test PASS",
914 onfail="Reactive Mode IPv6 Pingall test FAIL" )
915
916 def CASE142( self, main ):
917 """
918 Verify IPv6 Reactive forwarding (Spine Topology)
919 """
920 import re
921 import copy
922 import time
923 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
924 main.log.report( "______________________________________________" )
925 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
926 # Spine topology do not have hosts h1-h10
927 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
928 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
929 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
930 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
931 cfgResult = cfgResult1 and cfgResult2
932 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
933 onpass="Reactive mode ipv6Fowarding cfg is set to true",
934 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
935
936 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700937 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700938 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700939 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
940 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700941 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700942 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700943 time2 = time.time()
944 timeDiff = round( ( time2 - time1 ), 2 )
945 main.log.report(
946 "Time taken for IPv6 Ping All: " +
947 str( timeDiff ) +
948 " seconds" )
949
GlennRC626ba132015-09-18 16:16:31 -0700950 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700951 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
952 else:
953 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
954
955 main.step( "Disable Reactive forwarding" )
956
957 main.log.info( "Uninstall reactive forwarding app" )
958 appCheck = main.TRUE
959 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
960 pool = []
961 for cli in main.CLIs:
962 t = main.Thread( target=cli.appToIDCheck,
963 name="appToIDCheck-" + str( i ),
964 args=[] )
965 pool.append( t )
966 t.start()
967
968 for t in pool:
969 t.join()
970 appCheck = appCheck and t.result
971 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
972 onpass="App Ids seem to be correct",
973 onfail="Something is wrong with app Ids" )
974 if appCheck != main.TRUE:
975 main.log.warn( main.CLIs[0].apps() )
976 main.log.warn( main.CLIs[0].appIDs() )
977
978 # Waiting for reative flows to be cleared.
979 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700980 caseResult = appCheck and cfgResult and pingResult
981 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700982 onpass="Reactive Mode IPv6 Pingall test PASS",
983 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700984
You Wang0779bac2016-01-27 16:32:33 -0800985 def CASE147( self, main ):
986 """
987 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
988 """
989 import time
990 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
991 main.log.report( "______________________________________________" )
992 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
993
994 main.step( "Enable IPv4 Reactive forwarding" )
995 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
996 utilities.assert_equals( expect=main.TRUE, actual=appResult,
997 onpass="Successfully install fwd app",
998 onfail="Failed to install fwd app" )
999
1000 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1001 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1002 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1003 cfgResult = cfgResult1 and cfgResult2
1004 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1005 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1006 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1007
1008
1009 numHosts = int( main.params['TOPO1']['numHosts'] )
1010
1011 for i in range(numHosts):
1012 src = "h1"
1013 dest = "1000::" + str(i+1)
1014 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1015 main.Mininet1.handle.expect( "mininet>" )
1016 main.log.info( main.Mininet1.handle.before )
1017
1018 hosts = main.CLIs[0].hosts( jsonFormat=False )
1019
1020 main.log.info( hosts )
1021
1022 main.step( "Disable Reactive forwarding" )
1023
1024 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1025 appCheck = main.TRUE
1026 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1027 pool = []
1028 for cli in main.CLIs:
1029 t = main.Thread( target=cli.appToIDCheck,
1030 name="appToIDCheck-" + str( i ),
1031 args=[] )
1032 pool.append( t )
1033 t.start()
1034
1035 for t in pool:
1036 t.join()
1037 appCheck = appCheck and t.result
1038 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1039 onpass="App Ids seem to be correct",
1040 onfail="Something is wrong with app Ids" )
1041
1042 if appCheck != main.TRUE:
1043 main.log.warn( main.CLIs[0].apps() )
1044 main.log.warn( main.CLIs[0].appIDs() )
1045
1046 # Waiting for reative flows to be cleared.
1047 time.sleep( 30 )
1048
1049 main.step( "Disable IPv4 Reactive forwarding" )
1050 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1051 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1052 onpass="Successfully deactivated IPv4 fwd app",
1053 onfail="Failed to deactivate IPv4 fwd app" )
1054
1055 def CASE148( self, main ):
1056 """
1057 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1058 """
1059 import time
1060 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1061 main.log.report( "______________________________________________" )
1062 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1063
1064 main.step( "Enable IPv4 Reactive forwarding" )
1065 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1066 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1067 onpass="Successfully install fwd app",
1068 onfail="Failed to install fwd app" )
1069
1070 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1071 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1072 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1073 cfgResult = cfgResult1 and cfgResult2
1074 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1075 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1076 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1077
1078
1079 numHosts = int( main.params['TOPO2']['numHosts'] )
1080
1081 for i in range(numHosts):
1082 src = "h1"
1083 dest = "1000::" + str(i+1)
1084 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1085 main.Mininet1.handle.expect( "mininet>" )
1086 main.log.info( main.Mininet1.handle.before )
1087
1088 hosts = main.CLIs[0].hosts( jsonFormat=False )
1089
1090 main.log.info( hosts )
1091
1092 main.step( "Disable Reactive forwarding" )
1093
1094 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1095 appCheck = main.TRUE
1096 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1097 pool = []
1098 for cli in main.CLIs:
1099 t = main.Thread( target=cli.appToIDCheck,
1100 name="appToIDCheck-" + str( i ),
1101 args=[] )
1102 pool.append( t )
1103 t.start()
1104
1105 for t in pool:
1106 t.join()
1107 appCheck = appCheck and t.result
1108 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1109 onpass="App Ids seem to be correct",
1110 onfail="Something is wrong with app Ids" )
1111
1112 if appCheck != main.TRUE:
1113 main.log.warn( main.CLIs[0].apps() )
1114 main.log.warn( main.CLIs[0].appIDs() )
1115
1116 # Waiting for reative flows to be cleared.
1117 time.sleep( 30 )
1118
1119 main.step( "Disable IPv4 Reactive forwarding" )
1120 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1121 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1122 onpass="Successfully deactivated IPv4 fwd app",
1123 onfail="Failed to deactivate IPv4 fwd app" )
1124
1125 def CASE149( self, main ):
1126 """
1127 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1128 """
1129 import time
1130 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1131 main.log.report( "______________________________________________" )
1132 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1133
1134 main.step( "Enable IPv4 Reactive forwarding" )
1135 appResult = main.CLIs[0].activateApp( "org.onosproject.fwd" )
1136 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1137 onpass="Successfully install fwd app",
1138 onfail="Failed to install fwd app" )
1139
1140 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
1141 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1142 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
1143 cfgResult = cfgResult1 and cfgResult2
1144 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1145 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1146 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1147
1148
1149 numHosts = int( main.params['TOPO3']['numHosts'] )
1150
1151 for i in range(11, numHosts+10):
1152 src = "h11"
1153 dest = "1000::" + str(i+1)
1154 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1")
1155 main.Mininet1.handle.expect( "mininet>" )
1156 main.log.info( main.Mininet1.handle.before )
1157
1158 hosts = main.CLIs[0].hosts( jsonFormat=False )
1159
1160 main.log.info( hosts )
1161
1162 main.step( "Disable Reactive forwarding" )
1163
1164 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1165 appCheck = main.TRUE
1166 appResults = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1167 pool = []
1168 for cli in main.CLIs:
1169 t = main.Thread( target=cli.appToIDCheck,
1170 name="appToIDCheck-" + str( i ),
1171 args=[] )
1172 pool.append( t )
1173 t.start()
1174
1175 for t in pool:
1176 t.join()
1177 appCheck = appCheck and t.result
1178 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1179 onpass="App Ids seem to be correct",
1180 onfail="Something is wrong with app Ids" )
1181
1182 if appCheck != main.TRUE:
1183 main.log.warn( main.CLIs[0].apps() )
1184 main.log.warn( main.CLIs[0].appIDs() )
1185
1186 # Waiting for reative flows to be cleared.
1187 time.sleep( 30 )
1188
1189 main.step( "Disable IPv4 Reactive forwarding" )
1190 appResult = main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
1191 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1192 onpass="Successfully deactivated IPv4 fwd app",
1193 onfail="Failed to deactivate IPv4 fwd app" )
1194
Hari Krishnac195f3b2015-07-08 20:02:24 -07001195 def CASE5( self, main ):
1196 """
1197 Compare current ONOS topology with reference data
1198 """
1199 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001200
Hari Krishnac195f3b2015-07-08 20:02:24 -07001201 devicesDPIDTemp = []
1202 hostMACsTemp = []
1203 deviceLinksTemp = []
1204 deviceActiveLinksCountTemp = []
1205 devicePortsEnabledCountTemp = []
1206
1207 main.log.report(
1208 "Compare ONOS topology with reference data in Stores" )
1209 main.log.report( "__________________________________________________" )
1210 main.case( "Compare ONOS topology with reference data" )
1211
1212 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001213
GlennRC289c1b62015-12-12 10:45:43 -08001214 for check in range(main.topoCheck):
1215 time1 = time.time()
1216 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
1217 pool = []
1218 for cli in main.CLIs:
1219 if i >= main.numMNswitches + 1:
1220 break
GlennRC20fc6522015-12-23 23:26:57 -08001221 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001222 t = main.Thread(target = cli.getDevicePortsEnabledCount,
1223 threadID = main.threadID,
1224 name = "getDevicePortsEnabledCount",
1225 args = [dpid])
1226 t.start()
1227 pool.append(t)
1228 i = i + 1
1229 main.threadID = main.threadID + 1
1230 for thread in pool:
1231 thread.join()
1232 portResult = thread.result
1233 #portTemp = re.split( r'\t+', portResult )
1234 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1235 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001236
GlennRC289c1b62015-12-12 10:45:43 -08001237 time2 = time.time()
1238 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
1239 main.log.info (
1240 "Device Enabled ports EXPECTED: %s" %
1241 str( main.devicePortsEnabledCount ) )
1242 main.log.info (
1243 "Device Enabled ports ACTUAL: %s" %
1244 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001245
GlennRC289c1b62015-12-12 10:45:43 -08001246 if ( cmp( main.devicePortsEnabledCount,
1247 devicePortsEnabledCountTemp ) == 0 ):
1248 stepResult1 = main.TRUE
1249 else:
1250 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001251
GlennRC289c1b62015-12-12 10:45:43 -08001252 main.step( "Compare Device active links with reference" )
1253 time1 = time.time()
1254 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
1255 pool = []
1256 for cli in main.CLIs:
1257 if i >= main.numMNswitches + 1:
1258 break
GlennRC20fc6522015-12-23 23:26:57 -08001259 dpid = "of:00000000000000" + format( i, "02x" )
GlennRC289c1b62015-12-12 10:45:43 -08001260 t = main.Thread(target = cli.getDeviceLinksActiveCount,
1261 threadID = main.threadID,
1262 name = "getDeviceLinksActiveCount",
1263 args = [dpid])
1264 t.start()
1265 pool.append(t)
1266 i = i + 1
1267 main.threadID = main.threadID + 1
1268 for thread in pool:
1269 thread.join()
1270 linkCountResult = thread.result
1271 #linkCountTemp = re.split( r'\t+', linkCountResult )
1272 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1273 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001274
GlennRC289c1b62015-12-12 10:45:43 -08001275 time2 = time.time()
1276 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
1277 main.log.info (
1278 "Device Active links EXPECTED: %s" %
1279 str( main.deviceActiveLinksCount ) )
1280 main.log.info (
1281 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1282 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1283 stepResult2 = main.TRUE
1284 else:
1285 stepResult2 = main.FALSE
1286
1287 """
1288 place holder for comparing devices, hosts, paths and intents if required.
1289 Links and ports data would be incorrect with out devices anyways.
1290 """
1291 caseResult = ( stepResult1 and stepResult2 )
1292
1293 if caseResult:
1294 break
1295 else:
1296 time.sleep( main.topoCheckDelay )
1297 main.log.warn( "Topology check failed. Trying again..." )
1298
1299
1300 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001301 onpass="Compare Topology test PASS",
1302 onfail="Compare Topology test FAIL" )
1303
1304 def CASE60( self ):
1305 """
1306 Install 300 host intents and verify ping all (Att Topology)
1307 """
1308 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1309 main.log.report( "_______________________________________" )
1310 import itertools
1311 import time
1312 main.case( "Install 300 host intents" )
1313 main.step( "Add host Intents" )
1314 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001315 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1316
Hari Krishnac195f3b2015-07-08 20:02:24 -07001317 intentIdList = []
1318 time1 = time.time()
1319 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1320 pool = []
1321 for cli in main.CLIs:
1322 if i >= len( hostCombos ):
1323 break
1324 t = main.Thread( target=cli.addHostIntent,
1325 threadID=main.threadID,
1326 name="addHostIntent",
1327 args=[hostCombos[i][0],hostCombos[i][1]])
1328 pool.append(t)
1329 t.start()
1330 i = i + 1
1331 main.threadID = main.threadID + 1
1332 for thread in pool:
1333 thread.join()
1334 intentIdList.append(thread.result)
1335 time2 = time.time()
1336 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1337
GlennRCfcfdc4f2015-09-30 16:01:57 -07001338 # Saving intent ids to check intents in later cases
1339 main.intentIds = list(intentIdList)
1340
GlennRCa8d786a2015-09-23 17:40:11 -07001341 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001342
GlennRC1dde1712015-10-02 11:03:08 -07001343 # Giving onos multiple chances to install intents
1344 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001345 if i != 0:
1346 main.log.warn( "Verification failed. Retrying..." )
1347 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001348 time.sleep( main.checkIntentsDelay )
1349
1350 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001351 for e in range(int(main.numCtrls)):
1352 main.log.info( "Checking intents on CLI %s" % (e+1) )
1353 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1354 intentState
1355 if not intentState:
1356 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001357 if intentState:
1358 break
GlennRCdb2c8422015-09-29 12:21:59 -07001359 else:
1360 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001361 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001362
GlennRCa8d786a2015-09-23 17:40:11 -07001363
1364 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1365 onpass="INTENTS INSTALLED",
1366 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001367
1368 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001369 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001370 time1 = time.time()
1371 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001372 if not pingResult:
1373 main.log.warn("First pingall failed. Retrying...")
1374 time.sleep(3)
1375 else: break
1376
Hari Krishnac195f3b2015-07-08 20:02:24 -07001377 time2 = time.time()
1378 timeDiff = round( ( time2 - time1 ), 2 )
1379 main.log.report(
1380 "Time taken for Ping All: " +
1381 str( timeDiff ) +
1382 " seconds" )
1383 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1384 onpass="PING ALL PASS",
1385 onfail="PING ALL FAIL" )
1386
GlennRCbddd58f2015-10-01 15:45:25 -07001387 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001388 utilities.assert_equals(
1389 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001390 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001391 onpass="Install 300 Host Intents and Ping All test PASS",
1392 onfail="Install 300 Host Intents and Ping All test FAIL" )
1393
GlennRCfcfdc4f2015-09-30 16:01:57 -07001394 if not intentState:
1395 main.log.debug( "Intents failed to install completely" )
1396 if not pingResult:
1397 main.log.debug( "Pingall failed" )
1398
GlennRCbddd58f2015-10-01 15:45:25 -07001399 if not caseResult and main.failSwitch:
1400 main.log.report("Stopping test")
1401 main.stop( email=main.emailOnStop )
1402
Hari Krishnac195f3b2015-07-08 20:02:24 -07001403 def CASE61( self ):
1404 """
You Wang0779bac2016-01-27 16:32:33 -08001405 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001406 """
You Wang0779bac2016-01-27 16:32:33 -08001407 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001408 main.log.report( "_______________________________________" )
1409 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001410
You Wang0779bac2016-01-27 16:32:33 -08001411 main.case( "Install 300 host intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001412 main.step( "Add host Intents" )
1413 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001414 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1415
Hari Krishnac195f3b2015-07-08 20:02:24 -07001416 intentIdList = []
1417 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001418
Hari Krishnac195f3b2015-07-08 20:02:24 -07001419 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1420 pool = []
1421 for cli in main.CLIs:
1422 if i >= len( hostCombos ):
1423 break
1424 t = main.Thread( target=cli.addHostIntent,
1425 threadID=main.threadID,
1426 name="addHostIntent",
1427 args=[hostCombos[i][0],hostCombos[i][1]])
1428 pool.append(t)
1429 t.start()
1430 i = i + 1
1431 main.threadID = main.threadID + 1
1432 for thread in pool:
1433 thread.join()
1434 intentIdList.append(thread.result)
1435 time2 = time.time()
1436 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001437
GlennRCfcfdc4f2015-09-30 16:01:57 -07001438 # Saving intent ids to check intents in later cases
1439 main.intentIds = list(intentIdList)
1440
GlennRCa8d786a2015-09-23 17:40:11 -07001441 main.step("Verify intents are installed")
1442
GlennRC1dde1712015-10-02 11:03:08 -07001443 # Giving onos multiple chances to install intents
1444 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001445 if i != 0:
1446 main.log.warn( "Verification failed. Retrying..." )
1447 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001448 time.sleep( main.checkIntentsDelay )
1449
1450 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001451 for e in range(int(main.numCtrls)):
1452 main.log.info( "Checking intents on CLI %s" % (e+1) )
1453 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1454 intentState
1455 if not intentState:
1456 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001457 if intentState:
1458 break
GlennRCdb2c8422015-09-29 12:21:59 -07001459 else:
1460 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001461 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001462
1463 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1464 onpass="INTENTS INSTALLED",
1465 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001466
1467 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001468 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001469 time1 = time.time()
1470 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001471 if not pingResult:
1472 main.log.warn("First pingall failed. Retrying...")
1473 time.sleep(main.pingSleep)
1474 else: break
1475
Hari Krishnac195f3b2015-07-08 20:02:24 -07001476 time2 = time.time()
1477 timeDiff = round( ( time2 - time1 ), 2 )
1478 main.log.report(
1479 "Time taken for Ping All: " +
1480 str( timeDiff ) +
1481 " seconds" )
1482 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1483 onpass="PING ALL PASS",
1484 onfail="PING ALL FAIL" )
1485
GlennRCbddd58f2015-10-01 15:45:25 -07001486 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001487
Hari Krishnac195f3b2015-07-08 20:02:24 -07001488 utilities.assert_equals(
1489 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001490 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001491 onpass="Install 300 Host Intents and Ping All test PASS",
1492 onfail="Install 300 Host Intents and Ping All test FAIL" )
1493
GlennRCfcfdc4f2015-09-30 16:01:57 -07001494 if not intentState:
1495 main.log.debug( "Intents failed to install completely" )
1496 if not pingResult:
1497 main.log.debug( "Pingall failed" )
1498
GlennRCbddd58f2015-10-01 15:45:25 -07001499 if not caseResult and main.failSwitch:
1500 main.log.report("Stopping test")
1501 main.stop( email=main.emailOnStop )
1502
Hari Krishnac195f3b2015-07-08 20:02:24 -07001503 def CASE62( self ):
1504 """
1505 Install 2278 host intents and verify ping all for Spine Topology
1506 """
1507 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1508 main.log.report( "_______________________________________" )
1509 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001510
Hari Krishnac195f3b2015-07-08 20:02:24 -07001511 main.case( "Install 2278 host intents" )
1512 main.step( "Add host Intents" )
1513 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001514 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001515 main.pingTimeout = 300
1516 intentIdList = []
1517 time1 = time.time()
1518 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1519 pool = []
1520 for cli in main.CLIs:
1521 if i >= len( hostCombos ):
1522 break
1523 t = main.Thread( target=cli.addHostIntent,
1524 threadID=main.threadID,
1525 name="addHostIntent",
1526 args=[hostCombos[i][0],hostCombos[i][1]])
1527 pool.append(t)
1528 t.start()
1529 i = i + 1
1530 main.threadID = main.threadID + 1
1531 for thread in pool:
1532 thread.join()
1533 intentIdList.append(thread.result)
1534 time2 = time.time()
1535 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001536
GlennRCfcfdc4f2015-09-30 16:01:57 -07001537 # Saving intent ids to check intents in later cases
1538 main.intentIds = list(intentIdList)
1539
GlennRCa8d786a2015-09-23 17:40:11 -07001540 main.step("Verify intents are installed")
1541
GlennRC1dde1712015-10-02 11:03:08 -07001542 # Giving onos multiple chances to install intents
1543 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001544 if i != 0:
1545 main.log.warn( "Verification failed. Retrying..." )
1546 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001547 time.sleep( main.checkIntentsDelay )
1548
1549 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001550 for e in range(int(main.numCtrls)):
1551 main.log.info( "Checking intents on CLI %s" % (e+1) )
1552 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1553 intentState
1554 if not intentState:
1555 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001556 if intentState:
1557 break
GlennRCdb2c8422015-09-29 12:21:59 -07001558 else:
1559 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001560 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001561
1562 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1563 onpass="INTENTS INSTALLED",
1564 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001565
1566 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001567 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001568 time1 = time.time()
1569 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRC6ac11b12015-10-21 17:41:28 -07001570 if not pingResult:
1571 main.log.warn("First pingall failed. Retrying...")
1572 time.sleep(main.pingSleep)
1573 else: break
1574
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575 time2 = time.time()
1576 timeDiff = round( ( time2 - time1 ), 2 )
1577 main.log.report(
1578 "Time taken for Ping All: " +
1579 str( timeDiff ) +
1580 " seconds" )
1581 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1582 onpass="PING ALL PASS",
1583 onfail="PING ALL FAIL" )
1584
GlennRCbddd58f2015-10-01 15:45:25 -07001585 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001586
Hari Krishnac195f3b2015-07-08 20:02:24 -07001587 utilities.assert_equals(
1588 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001589 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001590 onpass="Install 2278 Host Intents and Ping All test PASS",
1591 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1592
GlennRCfcfdc4f2015-09-30 16:01:57 -07001593 if not intentState:
1594 main.log.debug( "Intents failed to install completely" )
1595 if not pingResult:
1596 main.log.debug( "Pingall failed" )
1597
GlennRCbddd58f2015-10-01 15:45:25 -07001598 if not caseResult and main.failSwitch:
1599 main.log.report("Stopping test")
1600 main.stop( email=main.emailOnStop )
1601
Hari Krishna4223dbd2015-08-13 16:29:53 -07001602 def CASE160( self ):
1603 """
1604 Verify IPv6 ping across 300 host intents (Att Topology)
1605 """
1606 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1607 main.log.report( "_________________________________________________" )
1608 import itertools
1609 import time
1610 main.case( "IPv6 ping all 300 host intents" )
1611 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001612 pingResult = main.FALSE
1613 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001614 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001615 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001616 main.log.warn("First pingall failed. Retrying...")
1617 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001618 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001619 time2 = time.time()
1620 timeDiff = round( ( time2 - time1 ), 2 )
1621 main.log.report(
1622 "Time taken for IPv6 Ping All: " +
1623 str( timeDiff ) +
1624 " seconds" )
1625 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1626 onpass="PING ALL PASS",
1627 onfail="PING ALL FAIL" )
1628
GlennRCbddd58f2015-10-01 15:45:25 -07001629 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001630 utilities.assert_equals(
1631 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001632 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001633 onpass="IPv6 Ping across 300 host intents test PASS",
1634 onfail="IPv6 Ping across 300 host intents test FAIL" )
1635
1636 def CASE161( self ):
1637 """
You Wang0779bac2016-01-27 16:32:33 -08001638 Verify IPv6 ping across 300 host intents (Chordal Topology)
Hari Krishna4223dbd2015-08-13 16:29:53 -07001639 """
You Wang0779bac2016-01-27 16:32:33 -08001640 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001641 main.log.report( "_________________________________________________" )
1642 import itertools
1643 import time
You Wang0779bac2016-01-27 16:32:33 -08001644 main.case( "IPv6 ping all 300 host intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001645 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001646 pingResult = main.FALSE
1647 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001648 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001649 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001650 main.log.warn("First pingall failed. Retrying...")
1651 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001652 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001653 time2 = time.time()
1654 timeDiff = round( ( time2 - time1 ), 2 )
1655 main.log.report(
1656 "Time taken for IPv6 Ping All: " +
1657 str( timeDiff ) +
1658 " seconds" )
1659 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1660 onpass="PING ALL PASS",
1661 onfail="PING ALL FAIL" )
1662
GlennRCbddd58f2015-10-01 15:45:25 -07001663 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001664 utilities.assert_equals(
1665 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001666 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001667 onpass="IPv6 Ping across 300 host intents test PASS",
1668 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001669
1670 def CASE162( self ):
1671 """
1672 Verify IPv6 ping across 2278 host intents (Spine Topology)
1673 """
1674 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1675 main.log.report( "_________________________________________________" )
1676 import itertools
1677 import time
You Wang0779bac2016-01-27 16:32:33 -08001678 main.case( "IPv6 ping all 2278 host intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001679 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001680 pingResult = main.FALSE
1681 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001682 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001683 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001684 main.log.warn("First pingall failed. Retrying...")
1685 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001686 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001687 time2 = time.time()
1688 timeDiff = round( ( time2 - time1 ), 2 )
1689 main.log.report(
1690 "Time taken for IPv6 Ping All: " +
1691 str( timeDiff ) +
1692 " seconds" )
1693 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1694 onpass="PING ALL PASS",
1695 onfail="PING ALL FAIL" )
1696
GlennRCbddd58f2015-10-01 15:45:25 -07001697 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001698 utilities.assert_equals(
1699 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001700 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001701 onpass="IPv6 Ping across 2278 host intents test PASS",
1702 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001703
Hari Krishnac195f3b2015-07-08 20:02:24 -07001704 def CASE70( self, main ):
1705 """
1706 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1707 """
1708 import random
1709 main.randomLink1 = []
1710 main.randomLink2 = []
1711 main.randomLink3 = []
1712 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1713 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1714 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1715 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1716 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1717 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1718 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1719 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1720
1721 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1722 main.log.report( "___________________________________________________________________________" )
1723 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1724 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1725 if ( int( switchLinksToToggle ) ==
1726 0 or int( switchLinksToToggle ) > 5 ):
1727 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1728 #main.cleanup()
1729 #main.exit()
1730 else:
1731 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1732
1733 main.step( "Cut links on Core devices using user provided range" )
1734 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1735 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1736 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1737 for i in range( int( switchLinksToToggle ) ):
1738 main.Mininet1.link(
1739 END1=link1End1,
1740 END2=main.randomLink1[ i ],
1741 OPTION="down" )
1742 time.sleep( link_sleep )
1743 main.Mininet1.link(
1744 END1=link2End1,
1745 END2=main.randomLink2[ i ],
1746 OPTION="down" )
1747 time.sleep( link_sleep )
1748 main.Mininet1.link(
1749 END1=link3End1,
1750 END2=main.randomLink3[ i ],
1751 OPTION="down" )
1752 time.sleep( link_sleep )
1753
You Wang0779bac2016-01-27 16:32:33 -08001754 main.step("Verify link down is discoverd by onos")
1755 # Giving onos multiple chances to discover link events
1756 for i in range( main.linkCheck ):
1757 if i != 0:
1758 main.log.warn( "Verification failed. Retrying..." )
1759 main.log.info("Giving onos some time...")
1760 time.sleep( link_sleep )
1761
1762 topology_output = main.ONOScli1.topology()
1763 linkDown = main.ONOSbench.checkStatus(
Hari Krishnac195f3b2015-07-08 20:02:24 -07001764 topology_output, main.numMNswitches, str(
1765 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
You Wang0779bac2016-01-27 16:32:33 -08001766 if linkDown:
1767 break
1768
Hari Krishnac195f3b2015-07-08 20:02:24 -07001769 utilities.assert_equals(
1770 expect=main.TRUE,
1771 actual=linkDown,
You Wang0779bac2016-01-27 16:32:33 -08001772 onpass="Link down discovered properly",
Hari Krishnac195f3b2015-07-08 20:02:24 -07001773 onfail="Link down was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08001774 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07001775 " seconds" )
1776
GlennRCfcfdc4f2015-09-30 16:01:57 -07001777 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001778 # Giving onos multiple chances to install intents
1779 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001780 if i != 0:
1781 main.log.warn( "Verification failed. Retrying..." )
1782 main.log.info("Giving onos some time...")
1783 time.sleep( main.checkIntentsDelay )
1784
1785 intentState = main.TRUE
1786 for e in range(int(main.numCtrls)):
1787 main.log.info( "Checking intents on CLI %s" % (e+1) )
1788 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1789 intentState
1790 if not intentState:
1791 main.log.warn( "Not all intents installed" )
1792 if intentState:
1793 break
1794 else:
1795 #Dumping intent summary
1796 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1797
1798
1799 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1800 onpass="INTENTS INSTALLED",
1801 onfail="SOME INTENTS NOT INSTALLED" )
1802
Hari Krishnac195f3b2015-07-08 20:02:24 -07001803 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001804 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001805 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001806 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1807 if not pingResult:
1808 main.log.warn("First pingall failed. Retrying...")
1809 time.sleep(main.pingSleep)
1810 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001811
Hari Krishnac195f3b2015-07-08 20:02:24 -07001812 time2 = time.time()
1813 timeDiff = round( ( time2 - time1 ), 2 )
1814 main.log.report(
1815 "Time taken for Ping All: " +
1816 str( timeDiff ) +
1817 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001818 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819 onpass="PING ALL PASS",
1820 onfail="PING ALL FAIL" )
1821
GlennRCbddd58f2015-10-01 15:45:25 -07001822 caseResult = linkDown and pingResult and intentState
1823 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824 onpass="Random Link cut Test PASS",
1825 onfail="Random Link cut Test FAIL" )
1826
GlennRCfcfdc4f2015-09-30 16:01:57 -07001827 # Printing what exactly failed
1828 if not linkDown:
1829 main.log.debug( "Link down was not discovered correctly" )
1830 if not pingResult:
1831 main.log.debug( "Pingall failed" )
1832 if not intentState:
1833 main.log.debug( "Intents are not all installed" )
1834
GlennRCbddd58f2015-10-01 15:45:25 -07001835 if not caseResult and main.failSwitch:
1836 main.log.report("Stopping test")
1837 main.stop( email=main.emailOnStop )
1838
Hari Krishnac195f3b2015-07-08 20:02:24 -07001839 def CASE80( self, main ):
1840 """
1841 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1842 """
1843 import random
1844 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1845 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1846 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1847 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1848 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1849
1850 main.log.report(
1851 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1852 main.log.report(
1853 "__________________________________________________________________" )
1854 main.case(
1855 "Host intents - Bring the core links up that are down and verify ping all" )
1856 main.step( "Bring randomly cut links on Core devices up" )
1857 for i in range( int( switchLinksToToggle ) ):
1858 main.Mininet1.link(
1859 END1=link1End1,
1860 END2=main.randomLink1[ i ],
1861 OPTION="up" )
1862 time.sleep( link_sleep )
1863 main.Mininet1.link(
1864 END1=link2End1,
1865 END2=main.randomLink2[ i ],
1866 OPTION="up" )
1867 time.sleep( link_sleep )
1868 main.Mininet1.link(
1869 END1=link3End1,
1870 END2=main.randomLink3[ i ],
1871 OPTION="up" )
1872 time.sleep( link_sleep )
1873
You Wang0779bac2016-01-27 16:32:33 -08001874 main.step("Verify link up is discoverd by onos")
1875 # Giving onos multiple chances to discover link events
1876 for i in range( main.linkCheck ):
1877 if i != 0:
1878 main.log.warn( "Verification failed. Retrying..." )
1879 main.log.info("Giving onos some time...")
1880 time.sleep( link_sleep )
1881
1882 topology_output = main.ONOScli1.topology()
1883 linkUp = main.ONOSbench.checkStatus(
1884 topology_output,
1885 main.numMNswitches,
1886 str( main.numMNlinks ) )
1887 if linkUp:
1888 break
1889
Hari Krishnac195f3b2015-07-08 20:02:24 -07001890 utilities.assert_equals(
1891 expect=main.TRUE,
1892 actual=linkUp,
1893 onpass="Link up discovered properly",
1894 onfail="Link up was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08001895 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07001896 " seconds" )
1897
GlennRCfcfdc4f2015-09-30 16:01:57 -07001898 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001899 # Giving onos multiple chances to install intents
1900 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001901 if i != 0:
1902 main.log.warn( "Verification failed. Retrying..." )
1903 main.log.info("Giving onos some time...")
1904 time.sleep( main.checkIntentsDelay )
1905
1906 intentState = main.TRUE
1907 for e in range(int(main.numCtrls)):
1908 main.log.info( "Checking intents on CLI %s" % (e+1) )
1909 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1910 intentState
1911 if not intentState:
1912 main.log.warn( "Not all intents installed" )
1913 if intentState:
1914 break
1915 else:
1916 #Dumping intent summary
1917 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1918
1919
1920 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1921 onpass="INTENTS INSTALLED",
1922 onfail="SOME INTENTS NOT INSTALLED" )
1923
Hari Krishnac195f3b2015-07-08 20:02:24 -07001924 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07001925 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001926 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07001927 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1928 if not pingResult:
1929 main.log.warn("First pingall failed. Retrying...")
1930 time.sleep(main.pingSleep)
1931 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07001932
Hari Krishnac195f3b2015-07-08 20:02:24 -07001933 time2 = time.time()
1934 timeDiff = round( ( time2 - time1 ), 2 )
1935 main.log.report(
1936 "Time taken for Ping All: " +
1937 str( timeDiff ) +
1938 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001939 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001940 onpass="PING ALL PASS",
1941 onfail="PING ALL FAIL" )
1942
GlennRCbddd58f2015-10-01 15:45:25 -07001943 caseResult = linkUp and pingResult
1944 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001945 onpass="Link Up Test PASS",
1946 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001947 # Printing what exactly failed
1948 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001949 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001950 if not pingResult:
1951 main.log.debug( "Pingall failed" )
1952 if not intentState:
1953 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001954
GlennRCbddd58f2015-10-01 15:45:25 -07001955 if not caseResult and main.failSwitch:
1956 main.log.report("Stopping test")
1957 main.stop( email=main.emailOnStop )
1958
Hari Krishnac195f3b2015-07-08 20:02:24 -07001959 def CASE71( self, main ):
1960 """
1961 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1962 """
1963 import random
1964 main.randomLink1 = []
1965 main.randomLink2 = []
1966 main.randomLink3 = []
1967 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1968 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1969 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1970 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1971 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1972 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1973 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1974 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1975
1976 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1977 main.log.report( "___________________________________________________________________________" )
1978 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1979 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1980 if ( int( switchLinksToToggle ) ==
1981 0 or int( switchLinksToToggle ) > 5 ):
1982 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1983 #main.cleanup()
1984 #main.exit()
1985 else:
1986 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1987
1988 main.step( "Cut links on Core devices using user provided range" )
1989 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1990 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1991 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1992 for i in range( int( switchLinksToToggle ) ):
1993 main.Mininet1.link(
1994 END1=link1End1,
1995 END2=main.randomLink1[ i ],
1996 OPTION="down" )
1997 time.sleep( link_sleep )
1998 main.Mininet1.link(
1999 END1=link2End1,
2000 END2=main.randomLink2[ i ],
2001 OPTION="down" )
2002 time.sleep( link_sleep )
2003 main.Mininet1.link(
2004 END1=link3End1,
2005 END2=main.randomLink3[ i ],
2006 OPTION="down" )
2007 time.sleep( link_sleep )
2008
You Wang0779bac2016-01-27 16:32:33 -08002009 main.step("Verify link down is discoverd by onos")
2010 # Giving onos multiple chances to discover link events
2011 for i in range( main.linkCheck ):
2012 if i != 0:
2013 main.log.warn( "Verification failed. Retrying..." )
2014 main.log.info("Giving onos some time...")
2015 time.sleep( link_sleep )
2016
2017 topology_output = main.ONOScli1.topology()
2018 linkDown = main.ONOSbench.checkStatus(
Hari Krishnac195f3b2015-07-08 20:02:24 -07002019 topology_output, main.numMNswitches, str(
2020 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
You Wang0779bac2016-01-27 16:32:33 -08002021 if linkDown:
2022 break
2023
Hari Krishnac195f3b2015-07-08 20:02:24 -07002024 utilities.assert_equals(
2025 expect=main.TRUE,
2026 actual=linkDown,
You Wang0779bac2016-01-27 16:32:33 -08002027 onpass="Link down discovered properly",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002028 onfail="Link down was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002029 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030 " seconds" )
2031
GlennRCfcfdc4f2015-09-30 16:01:57 -07002032 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002033 # Giving onos multiple chances to install intents
2034 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002035 if i != 0:
2036 main.log.warn( "Verification failed. Retrying..." )
2037 main.log.info("Giving onos some time...")
2038 time.sleep( main.checkIntentsDelay )
2039
2040 intentState = main.TRUE
2041 for e in range(int(main.numCtrls)):
2042 main.log.info( "Checking intents on CLI %s" % (e+1) )
2043 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2044 intentState
2045 if not intentState:
2046 main.log.warn( "Not all intents installed" )
2047 if intentState:
2048 break
2049 else:
2050 #Dumping intent summary
2051 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2052
2053
2054 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2055 onpass="INTENTS INSTALLED",
2056 onfail="SOME INTENTS NOT INSTALLED" )
2057
Hari Krishnac195f3b2015-07-08 20:02:24 -07002058 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002059 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002060 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002061 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2062 if not pingResult:
2063 main.log.warn("First pingall failed. Retrying...")
2064 time.sleep(main.pingSleep)
2065 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002066
Hari Krishnac195f3b2015-07-08 20:02:24 -07002067 time2 = time.time()
2068 timeDiff = round( ( time2 - time1 ), 2 )
2069 main.log.report(
2070 "Time taken for Ping All: " +
2071 str( timeDiff ) +
2072 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002073 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002074 onpass="PING ALL PASS",
2075 onfail="PING ALL FAIL" )
2076
GlennRCbddd58f2015-10-01 15:45:25 -07002077 caseResult = linkDown and pingResult and intentState
2078 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002079 onpass="Random Link cut Test PASS",
2080 onfail="Random Link cut Test FAIL" )
2081
GlennRCfcfdc4f2015-09-30 16:01:57 -07002082 # Printing what exactly failed
2083 if not linkDown:
2084 main.log.debug( "Link down was not discovered correctly" )
2085 if not pingResult:
2086 main.log.debug( "Pingall failed" )
2087 if not intentState:
2088 main.log.debug( "Intents are not all installed" )
2089
GlennRCbddd58f2015-10-01 15:45:25 -07002090 if not caseResult and main.failSwitch:
2091 main.log.report("Stopping test")
2092 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002093
Hari Krishnac195f3b2015-07-08 20:02:24 -07002094 def CASE81( self, main ):
2095 """
2096 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
2097 """
2098 import random
2099 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
2100 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
2101 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
2102 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2103 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
2104
2105 main.log.report(
2106 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
2107 main.log.report(
2108 "__________________________________________________________________" )
2109 main.case(
2110 "Point intents - Bring the core links up that are down and verify ping all" )
2111 main.step( "Bring randomly cut links on Core devices up" )
2112 for i in range( int( switchLinksToToggle ) ):
2113 main.Mininet1.link(
2114 END1=link1End1,
2115 END2=main.randomLink1[ i ],
2116 OPTION="up" )
2117 time.sleep( link_sleep )
2118 main.Mininet1.link(
2119 END1=link2End1,
2120 END2=main.randomLink2[ i ],
2121 OPTION="up" )
2122 time.sleep( link_sleep )
2123 main.Mininet1.link(
2124 END1=link3End1,
2125 END2=main.randomLink3[ i ],
2126 OPTION="up" )
2127 time.sleep( link_sleep )
2128
You Wang0779bac2016-01-27 16:32:33 -08002129 main.step("Verify link up is discoverd by onos")
2130 # Giving onos multiple chances to discover link events
2131 for i in range( main.linkCheck ):
2132 if i != 0:
2133 main.log.warn( "Verification failed. Retrying..." )
2134 main.log.info("Giving onos some time...")
2135 time.sleep( link_sleep )
2136
2137 topology_output = main.ONOScli1.topology()
2138 linkUp = main.ONOSbench.checkStatus(
2139 topology_output,
2140 main.numMNswitches,
2141 str( main.numMNlinks ) )
2142 if linkUp:
2143 break
2144
Hari Krishnac195f3b2015-07-08 20:02:24 -07002145 utilities.assert_equals(
2146 expect=main.TRUE,
2147 actual=linkUp,
2148 onpass="Link up discovered properly",
2149 onfail="Link up was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002150 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002151 " seconds" )
2152
GlennRCfcfdc4f2015-09-30 16:01:57 -07002153 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002154 # Giving onos multiple chances to install intents
2155 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002156 if i != 0:
2157 main.log.warn( "Verification failed. Retrying..." )
2158 main.log.info("Giving onos some time...")
2159 time.sleep( main.checkIntentsDelay )
2160
2161 intentState = main.TRUE
2162 for e in range(int(main.numCtrls)):
2163 main.log.info( "Checking intents on CLI %s" % (e+1) )
2164 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2165 intentState
2166 if not intentState:
2167 main.log.warn( "Not all intents installed" )
2168 if intentState:
2169 break
2170 else:
2171 #Dumping intent summary
2172 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2173
2174
2175 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2176 onpass="INTENTS INSTALLED",
2177 onfail="SOME INTENTS NOT INSTALLED" )
2178
Hari Krishnac195f3b2015-07-08 20:02:24 -07002179 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002180 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002181 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002182 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2183 if not pingResult:
2184 main.log.warn("First pingall failed. Retrying...")
2185 time.sleep(main.pingSleep)
2186 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002187
Hari Krishnac195f3b2015-07-08 20:02:24 -07002188 time2 = time.time()
2189 timeDiff = round( ( time2 - time1 ), 2 )
2190 main.log.report(
2191 "Time taken for Ping All: " +
2192 str( timeDiff ) +
2193 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002194 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002195 onpass="PING ALL PASS",
2196 onfail="PING ALL FAIL" )
2197
GlennRCbddd58f2015-10-01 15:45:25 -07002198 caseResult = linkUp and pingResult
2199 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002200 onpass="Link Up Test PASS",
2201 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002202 # Printing what exactly failed
2203 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002204 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002205 if not pingResult:
2206 main.log.debug( "Pingall failed" )
2207 if not intentState:
2208 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002209
GlennRCbddd58f2015-10-01 15:45:25 -07002210 if not caseResult and main.failSwitch:
2211 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07002212 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07002213
Hari Krishnac195f3b2015-07-08 20:02:24 -07002214 def CASE72( self, main ):
2215 """
2216 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
2217 """
2218 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002219 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002220 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002221
Hari Krishnac195f3b2015-07-08 20:02:24 -07002222 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
2223 main.log.report( "___________________________________________________________________________" )
2224 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
2225 switches = []
2226 switchesComb = []
2227 for i in range( main.numMNswitches ):
2228 switches.append('s%d'%(i+1))
2229 switchesLinksComb = list(itertools.combinations(switches,2))
2230 main.randomLinks = random.sample(switchesLinksComb, 5 )
2231 print main.randomLinks
2232 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002233
Hari Krishnac195f3b2015-07-08 20:02:24 -07002234 for switch in main.randomLinks:
2235 main.Mininet1.link(
2236 END1=switch[0],
2237 END2=switch[1],
2238 OPTION="down")
2239 time.sleep( link_sleep )
2240
You Wang0779bac2016-01-27 16:32:33 -08002241 main.step("Verify link down is discoverd by onos")
2242 # Giving onos multiple chances to discover link events
2243 for i in range( main.linkCheck ):
2244 if i != 0:
2245 main.log.warn( "Verification failed. Retrying..." )
2246 main.log.info("Giving onos some time...")
2247 time.sleep( link_sleep )
2248
2249 topology_output = main.ONOScli1.topology()
2250 linkDown = main.ONOSbench.checkStatus(
Hari Krishnac195f3b2015-07-08 20:02:24 -07002251 topology_output, main.numMNswitches, str(
2252 int( main.numMNlinks ) - 5 * 2 ) )
You Wang0779bac2016-01-27 16:32:33 -08002253 if linkDown:
2254 break
2255
Hari Krishnac195f3b2015-07-08 20:02:24 -07002256 utilities.assert_equals(
2257 expect=main.TRUE,
2258 actual=linkDown,
You Wang0779bac2016-01-27 16:32:33 -08002259 onpass="Link down discovered properly",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002260 onfail="Link down was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002261 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002262 " seconds" )
2263
GlennRCfcfdc4f2015-09-30 16:01:57 -07002264 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002265 # Giving onos multiple chances to install intents
2266 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002267 if i != 0:
2268 main.log.warn( "Verification failed. Retrying..." )
2269 main.log.info("Giving onos some time...")
2270 time.sleep( main.checkIntentsDelay )
2271
2272 intentState = main.TRUE
2273 for e in range(int(main.numCtrls)):
2274 main.log.info( "Checking intents on CLI %s" % (e+1) )
2275 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2276 intentState
2277 if not intentState:
2278 main.log.warn( "Not all intents installed" )
2279 if intentState:
2280 break
2281 else:
2282 #Dumping intent summary
2283 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2284
2285
2286 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2287 onpass="INTENTS INSTALLED",
2288 onfail="SOME INTENTS NOT INSTALLED" )
2289
Hari Krishnac195f3b2015-07-08 20:02:24 -07002290 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002291 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002292 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002293 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2294 if not pingResult:
2295 main.log.warn("First pingall failed. Retrying...")
2296 time.sleep(main.pingSleep)
2297 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002298
Hari Krishnac195f3b2015-07-08 20:02:24 -07002299 time2 = time.time()
2300 timeDiff = round( ( time2 - time1 ), 2 )
2301 main.log.report(
2302 "Time taken for Ping All: " +
2303 str( timeDiff ) +
2304 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002305 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002306 onpass="PING ALL PASS",
2307 onfail="PING ALL FAIL" )
2308
GlennRCbddd58f2015-10-01 15:45:25 -07002309 caseResult = linkDown and pingResult and intentState
2310 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002311 onpass="Random Link cut Test PASS",
2312 onfail="Random Link cut Test FAIL" )
2313
GlennRCfcfdc4f2015-09-30 16:01:57 -07002314 # Printing what exactly failed
2315 if not linkDown:
2316 main.log.debug( "Link down was not discovered correctly" )
2317 if not pingResult:
2318 main.log.debug( "Pingall failed" )
2319 if not intentState:
2320 main.log.debug( "Intents are not all installed" )
2321
GlennRCbddd58f2015-10-01 15:45:25 -07002322 if not caseResult and main.failSwitch:
2323 main.log.report("Stopping test")
2324 main.stop( email=main.emailOnStop )
2325
Hari Krishnac195f3b2015-07-08 20:02:24 -07002326 def CASE82( self, main ):
2327 """
2328 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
2329 """
2330 import random
2331 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002332
Hari Krishnac195f3b2015-07-08 20:02:24 -07002333 main.log.report(
2334 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
2335 main.log.report(
2336 "__________________________________________________________________" )
2337 main.case(
2338 "Host intents - Bring the core links up that are down and verify ping all" )
2339 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002340
Hari Krishnac195f3b2015-07-08 20:02:24 -07002341 for switch in main.randomLinks:
2342 main.Mininet1.link(
2343 END1=switch[0],
2344 END2=switch[1],
2345 OPTION="up")
2346 time.sleep( link_sleep )
2347
You Wang0779bac2016-01-27 16:32:33 -08002348 main.step("Verify link up is discoverd by onos")
2349 # Giving onos multiple chances to discover link events
2350 for i in range( main.linkCheck ):
2351 if i != 0:
2352 main.log.warn( "Verification failed. Retrying..." )
2353 main.log.info("Giving onos some time...")
2354 time.sleep( link_sleep )
2355
2356 topology_output = main.ONOScli1.topology()
2357 linkUp = main.ONOSbench.checkStatus(
2358 topology_output,
2359 main.numMNswitches,
2360 str( main.numMNlinks ) )
2361 if linkUp:
2362 break
2363
Hari Krishnac195f3b2015-07-08 20:02:24 -07002364 utilities.assert_equals(
2365 expect=main.TRUE,
2366 actual=linkUp,
2367 onpass="Link up discovered properly",
2368 onfail="Link up was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002369 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002370 " seconds" )
2371
GlennRCfcfdc4f2015-09-30 16:01:57 -07002372 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002373 # Giving onos multiple chances to install intents
2374 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002375 if i != 0:
2376 main.log.warn( "Verification failed. Retrying..." )
2377 main.log.info("Giving onos some time...")
2378 time.sleep( main.checkIntentsDelay )
2379
2380 intentState = main.TRUE
2381 for e in range(int(main.numCtrls)):
2382 main.log.info( "Checking intents on CLI %s" % (e+1) )
2383 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2384 intentState
2385 if not intentState:
2386 main.log.warn( "Not all intents installed" )
2387 if intentState:
2388 break
2389 else:
2390 #Dumping intent summary
2391 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2392
2393
2394 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2395 onpass="INTENTS INSTALLED",
2396 onfail="SOME INTENTS NOT INSTALLED" )
2397
Hari Krishnac195f3b2015-07-08 20:02:24 -07002398 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002399 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002400 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002401 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2402 if not pingResult:
2403 main.log.warn("First pingall failed. Retrying...")
2404 time.sleep(main.pingSleep)
2405 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002406
Hari Krishnac195f3b2015-07-08 20:02:24 -07002407 time2 = time.time()
2408 timeDiff = round( ( time2 - time1 ), 2 )
2409 main.log.report(
2410 "Time taken for Ping All: " +
2411 str( timeDiff ) +
2412 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002413 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002414 onpass="PING ALL PASS",
2415 onfail="PING ALL FAIL" )
2416
GlennRCbddd58f2015-10-01 15:45:25 -07002417 caseResult = linkUp and pingResult
2418 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002419 onpass="Link Up Test PASS",
2420 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002421 # Printing what exactly failed
2422 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002423 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002424 if not pingResult:
2425 main.log.debug( "Pingall failed" )
2426 if not intentState:
2427 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002428
GlennRCbddd58f2015-10-01 15:45:25 -07002429 if not caseResult and main.failSwitch:
2430 main.log.report("Stopping test")
2431 main.stop( email=main.emailOnStop )
2432
Hari Krishnac195f3b2015-07-08 20:02:24 -07002433 def CASE73( self, main ):
2434 """
2435 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2436 """
2437 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002438 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002439 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002440
Hari Krishnac195f3b2015-07-08 20:02:24 -07002441 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2442 main.log.report( "___________________________________________________________________________" )
2443 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2444 switches = []
2445 switchesComb = []
2446 for i in range( main.numMNswitches ):
2447 switches.append('s%d'%(i+1))
2448 switchesLinksComb = list(itertools.combinations(switches,2))
2449 main.randomLinks = random.sample(switchesLinksComb, 5 )
2450 print main.randomLinks
2451 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002452
Hari Krishnac195f3b2015-07-08 20:02:24 -07002453 for switch in main.randomLinks:
2454 main.Mininet1.link(
2455 END1=switch[0],
2456 END2=switch[1],
2457 OPTION="down")
2458 time.sleep( link_sleep )
2459
You Wang0779bac2016-01-27 16:32:33 -08002460 main.step("Verify link down is discoverd by onos")
2461 # Giving onos multiple chances to discover link events
2462 for i in range( main.linkCheck ):
2463 if i != 0:
2464 main.log.warn( "Verification failed. Retrying..." )
2465 main.log.info("Giving onos some time...")
2466 time.sleep( link_sleep )
2467
2468 topology_output = main.ONOScli1.topology()
2469 linkDown = main.ONOSbench.checkStatus(
Hari Krishnac195f3b2015-07-08 20:02:24 -07002470 topology_output, main.numMNswitches, str(
2471 int( main.numMNlinks ) - 5 * 2 ) )
You Wang0779bac2016-01-27 16:32:33 -08002472 if linkDown:
2473 break
2474
Hari Krishnac195f3b2015-07-08 20:02:24 -07002475 utilities.assert_equals(
2476 expect=main.TRUE,
2477 actual=linkDown,
You Wang0779bac2016-01-27 16:32:33 -08002478 onpass="Link down discovered properly",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002479 onfail="Link down was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002480 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002481 " seconds" )
2482
GlennRCfcfdc4f2015-09-30 16:01:57 -07002483 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002484 # Giving onos multiple chances to install intents
2485 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002486 if i != 0:
2487 main.log.warn( "Verification failed. Retrying..." )
2488 main.log.info("Giving onos some time...")
2489 time.sleep( main.checkIntentsDelay )
2490
2491 intentState = main.TRUE
2492 for e in range(int(main.numCtrls)):
2493 main.log.info( "Checking intents on CLI %s" % (e+1) )
2494 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2495 intentState
2496 if not intentState:
2497 main.log.warn( "Not all intents installed" )
2498 if intentState:
2499 break
2500 else:
2501 #Dumping intent summary
2502 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2503
2504
2505 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2506 onpass="INTENTS INSTALLED",
2507 onfail="SOME INTENTS NOT INSTALLED" )
2508
Hari Krishnac195f3b2015-07-08 20:02:24 -07002509 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002510 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002511 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002512 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2513 if not pingResult:
2514 main.log.warn("First pingall failed. Retrying...")
2515 time.sleep(main.pingSleep)
2516 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002517
Hari Krishnac195f3b2015-07-08 20:02:24 -07002518 time2 = time.time()
2519 timeDiff = round( ( time2 - time1 ), 2 )
2520 main.log.report(
2521 "Time taken for Ping All: " +
2522 str( timeDiff ) +
2523 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002524 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002525 onpass="PING ALL PASS",
2526 onfail="PING ALL FAIL" )
2527
GlennRCbddd58f2015-10-01 15:45:25 -07002528 caseResult = linkDown and pingResult and intentState
2529 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002530 onpass="Random Link cut Test PASS",
2531 onfail="Random Link cut Test FAIL" )
2532
GlennRCfcfdc4f2015-09-30 16:01:57 -07002533 # Printing what exactly failed
2534 if not linkDown:
2535 main.log.debug( "Link down was not discovered correctly" )
2536 if not pingResult:
2537 main.log.debug( "Pingall failed" )
2538 if not intentState:
2539 main.log.debug( "Intents are not all installed" )
2540
GlennRCbddd58f2015-10-01 15:45:25 -07002541 if not caseResult and main.failSwitch:
2542 main.log.report("Stopping test")
2543 main.stop( email=main.emailOnStop )
2544
Hari Krishnac195f3b2015-07-08 20:02:24 -07002545 def CASE83( self, main ):
2546 """
2547 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2548 """
2549 import random
2550 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002551
Hari Krishnac195f3b2015-07-08 20:02:24 -07002552 main.log.report(
2553 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2554 main.log.report(
2555 "__________________________________________________________________" )
2556 main.case(
2557 "Point intents - Bring the core links up that are down and verify ping all" )
2558 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002559
Hari Krishnac195f3b2015-07-08 20:02:24 -07002560 for switch in main.randomLinks:
2561 main.Mininet1.link(
2562 END1=switch[0],
2563 END2=switch[1],
2564 OPTION="up")
2565 time.sleep( link_sleep )
2566
You Wang0779bac2016-01-27 16:32:33 -08002567 main.step("Verify link up is discoverd by onos")
2568 # Giving onos multiple chances to discover link events
2569 for i in range( main.linkCheck ):
2570 if i != 0:
2571 main.log.warn( "Verification failed. Retrying..." )
2572 main.log.info("Giving onos some time...")
2573 time.sleep( link_sleep )
2574
2575 topology_output = main.ONOScli1.topology()
2576 linkUp = main.ONOSbench.checkStatus(
2577 topology_output,
2578 main.numMNswitches,
2579 str( main.numMNlinks ) )
2580 if linkUp:
2581 break
2582
Hari Krishnac195f3b2015-07-08 20:02:24 -07002583 utilities.assert_equals(
2584 expect=main.TRUE,
2585 actual=linkUp,
2586 onpass="Link up discovered properly",
2587 onfail="Link up was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002588 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002589 " seconds" )
2590
GlennRCfcfdc4f2015-09-30 16:01:57 -07002591 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002592 # Giving onos multiple chances to install intents
2593 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002594 if i != 0:
2595 main.log.warn( "Verification failed. Retrying..." )
2596 main.log.info("Giving onos some time...")
2597 time.sleep( main.checkIntentsDelay )
2598
2599 intentState = main.TRUE
2600 for e in range(int(main.numCtrls)):
2601 main.log.info( "Checking intents on CLI %s" % (e+1) )
2602 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2603 intentState
2604 if not intentState:
2605 main.log.warn( "Not all intents installed" )
2606 if intentState:
2607 break
2608 else:
2609 #Dumping intent summary
2610 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2611
2612
2613 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2614 onpass="INTENTS INSTALLED",
2615 onfail="SOME INTENTS NOT INSTALLED" )
2616
Hari Krishnac195f3b2015-07-08 20:02:24 -07002617 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002618 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002619 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002620 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2621 if not pingResult:
2622 main.log.warn("First pingall failed. Retrying...")
2623 time.sleep(main.pingSleep)
2624 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002625
Hari Krishnac195f3b2015-07-08 20:02:24 -07002626 time2 = time.time()
2627 timeDiff = round( ( time2 - time1 ), 2 )
2628 main.log.report(
2629 "Time taken for Ping All: " +
2630 str( timeDiff ) +
2631 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002632 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002633 onpass="PING ALL PASS",
2634 onfail="PING ALL FAIL" )
2635
GlennRCbddd58f2015-10-01 15:45:25 -07002636 caseResult = linkUp and pingResult
2637 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002638 onpass="Link Up Test PASS",
2639 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002640 # Printing what exactly failed
2641 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002642 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002643 if not pingResult:
2644 main.log.debug( "Pingall failed" )
2645 if not intentState:
2646 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002647
GlennRCbddd58f2015-10-01 15:45:25 -07002648 if not caseResult and main.failSwitch:
2649 main.log.report("Stopping test")
2650 main.stop( email=main.emailOnStop )
2651
Hari Krishnac195f3b2015-07-08 20:02:24 -07002652 def CASE74( self, main ):
2653 """
2654 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2655 """
2656 import random
2657 main.randomLink1 = []
2658 main.randomLink2 = []
2659 main.randomLink3 = []
2660 main.randomLink4 = []
2661 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2662 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2663 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2664 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2665 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2666 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2667 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002668
Hari Krishnac195f3b2015-07-08 20:02:24 -07002669 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2670 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002671 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002672
2673 main.step( "Bring some core links down" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002674 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002675 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002676 linkIndex.remove(linkIndexS9)
2677 linkIndexS10 = random.sample(linkIndex,1)[0]
2678 main.randomLink1 = link1End2top[linkIndexS9]
2679 main.randomLink2 = link2End2top[linkIndexS10]
2680 main.randomLink3 = random.sample(link1End2bot,1)[0]
2681 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002682
2683 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002684 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2685 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2686 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2687 time.sleep( link_sleep )
2688 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2689 time.sleep( link_sleep )
2690
You Wang0779bac2016-01-27 16:32:33 -08002691 main.step("Verify link down is discoverd by onos")
2692 # Giving onos multiple chances to discover link events
2693 for i in range( main.linkCheck ):
2694 if i != 0:
2695 main.log.warn( "Verification failed. Retrying..." )
2696 main.log.info("Giving onos some time...")
2697 time.sleep( link_sleep )
2698
2699 topology_output = main.ONOScli1.topology()
2700 linkDown = main.ONOSbench.checkStatus(
Hari Krishnac195f3b2015-07-08 20:02:24 -07002701 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002702 int( main.numMNlinks ) - 4 ))
You Wang0779bac2016-01-27 16:32:33 -08002703 if linkDown:
2704 break
2705
Hari Krishnac195f3b2015-07-08 20:02:24 -07002706 utilities.assert_equals(
2707 expect=main.TRUE,
2708 actual=linkDown,
You Wang0779bac2016-01-27 16:32:33 -08002709 onpass="Link down discovered properly",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002710 onfail="Link down was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002711 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002712 " seconds" )
2713
GlennRCfcfdc4f2015-09-30 16:01:57 -07002714 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002715 # Giving onos multiple chances to install intents
2716 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002717 if i != 0:
2718 main.log.warn( "Verification failed. Retrying..." )
2719 main.log.info("Giving onos some time...")
2720 time.sleep( main.checkIntentsDelay )
2721
2722 intentState = main.TRUE
2723 for e in range(int(main.numCtrls)):
2724 main.log.info( "Checking intents on CLI %s" % (e+1) )
2725 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2726 intentState
2727 if not intentState:
2728 main.log.warn( "Not all intents installed" )
2729 if intentState:
2730 break
2731 else:
2732 #Dumping intent summary
2733 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2734
2735
2736 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2737 onpass="INTENTS INSTALLED",
2738 onfail="SOME INTENTS NOT INSTALLED" )
2739
Hari Krishnac195f3b2015-07-08 20:02:24 -07002740 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002741 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002742 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002743 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2744 if not pingResult:
2745 main.log.warn("First pingall failed. Retrying...")
2746 time.sleep(main.pingSleep)
2747 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002748
Hari Krishnac195f3b2015-07-08 20:02:24 -07002749 time2 = time.time()
2750 timeDiff = round( ( time2 - time1 ), 2 )
2751 main.log.report(
2752 "Time taken for Ping All: " +
2753 str( timeDiff ) +
2754 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002755 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002756 onpass="PING ALL PASS",
2757 onfail="PING ALL FAIL" )
2758
GlennRCbddd58f2015-10-01 15:45:25 -07002759 caseResult = linkDown and pingResult and intentState
2760 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002761 onpass="Random Link cut Test PASS",
2762 onfail="Random Link cut Test FAIL" )
2763
GlennRCfcfdc4f2015-09-30 16:01:57 -07002764 # Printing what exactly failed
2765 if not linkDown:
2766 main.log.debug( "Link down was not discovered correctly" )
2767 if not pingResult:
2768 main.log.debug( "Pingall failed" )
2769 if not intentState:
2770 main.log.debug( "Intents are not all installed" )
2771
GlennRCbddd58f2015-10-01 15:45:25 -07002772 if not caseResult and main.failSwitch:
2773 main.log.report("Stopping test")
2774 main.stop( email=main.emailOnStop )
2775
Hari Krishnac195f3b2015-07-08 20:02:24 -07002776 def CASE84( self, main ):
2777 """
2778 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2779 """
2780 import random
2781 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2782 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2783 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2784 main.log.report(
2785 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2786 main.log.report(
2787 "__________________________________________________________________" )
2788 main.case(
2789 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002790
You Wang0779bac2016-01-27 16:32:33 -08002791 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002792 # Work around for link state propagation delay. Added some sleep time.
2793 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2794 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002795 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2796 time.sleep( link_sleep )
2797 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2798 time.sleep( link_sleep )
2799
You Wang0779bac2016-01-27 16:32:33 -08002800 main.step("Verify link up is discoverd by onos")
2801 # Giving onos multiple chances to discover link events
2802 for i in range( main.linkCheck ):
2803 if i != 0:
2804 main.log.warn( "Verification failed. Retrying..." )
2805 main.log.info("Giving onos some time...")
2806 time.sleep( link_sleep )
2807
2808 topology_output = main.ONOScli1.topology()
2809 linkUp = main.ONOSbench.checkStatus(
2810 topology_output,
2811 main.numMNswitches,
2812 str( main.numMNlinks ) )
2813 if linkUp:
2814 break
2815
Hari Krishnac195f3b2015-07-08 20:02:24 -07002816 utilities.assert_equals(
2817 expect=main.TRUE,
2818 actual=linkUp,
2819 onpass="Link up discovered properly",
2820 onfail="Link up was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002821 str( link_sleep * main.linkCheck ) +
Hari Krishnac195f3b2015-07-08 20:02:24 -07002822 " seconds" )
2823
GlennRCfcfdc4f2015-09-30 16:01:57 -07002824 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002825 # Giving onos multiple chances to install intents
2826 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002827 if i != 0:
2828 main.log.warn( "Verification failed. Retrying..." )
2829 main.log.info("Giving onos some time...")
2830 time.sleep( main.checkIntentsDelay )
2831
2832 intentState = main.TRUE
2833 for e in range(int(main.numCtrls)):
2834 main.log.info( "Checking intents on CLI %s" % (e+1) )
2835 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2836 intentState
2837 if not intentState:
2838 main.log.warn( "Not all intents installed" )
2839 if intentState:
2840 break
2841 else:
2842 #Dumping intent summary
2843 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2844
2845
2846 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2847 onpass="INTENTS INSTALLED",
2848 onfail="SOME INTENTS NOT INSTALLED" )
2849
Hari Krishnac195f3b2015-07-08 20:02:24 -07002850 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002851 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002852 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002853 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2854 if not pingResult:
2855 main.log.warn("First pingall failed. Retrying...")
2856 time.sleep(main.pingSleep)
2857 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002858
Hari Krishnac195f3b2015-07-08 20:02:24 -07002859 time2 = time.time()
2860 timeDiff = round( ( time2 - time1 ), 2 )
2861 main.log.report(
2862 "Time taken for Ping All: " +
2863 str( timeDiff ) +
2864 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002865 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002866 onpass="PING ALL PASS",
2867 onfail="PING ALL FAIL" )
2868
GlennRCbddd58f2015-10-01 15:45:25 -07002869 caseResult = linkUp and pingResult
2870 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002871 onpass="Link Up Test PASS",
2872 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002873 # Printing what exactly failed
2874 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002875 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002876 if not pingResult:
2877 main.log.debug( "Pingall failed" )
2878 if not intentState:
2879 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002880
GlennRCbddd58f2015-10-01 15:45:25 -07002881 if not caseResult and main.failSwitch:
2882 main.log.report("Stopping test")
2883 main.stop( email=main.emailOnStop )
2884
Hari Krishnab79d0822015-08-20 09:48:43 -07002885 def CASE75( self, main ):
2886 """
2887 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2888 """
2889 import random
2890 main.randomLink1 = []
2891 main.randomLink2 = []
2892 main.randomLink3 = []
2893 main.randomLink4 = []
2894 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2895 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2896 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2897 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2898 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2899 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2900 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2901 main.pingTimeout = 400
2902
2903 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2904 main.log.report( "___________________________________________________________________________" )
2905 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002906
2907 main.step( "Bring some core links down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002908 linkIndex = range(4)
2909 linkIndexS9 = random.sample(linkIndex,1)[0]
2910 linkIndex.remove(linkIndexS9)
2911 linkIndexS10 = random.sample(linkIndex,1)[0]
2912 main.randomLink1 = link1End2top[linkIndexS9]
2913 main.randomLink2 = link2End2top[linkIndexS10]
2914 main.randomLink3 = random.sample(link1End2bot,1)[0]
2915 main.randomLink4 = random.sample(link2End2bot,1)[0]
2916
2917 # Work around for link state propagation delay. Added some sleep time.
2918 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2919 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2920 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2921 time.sleep( link_sleep )
2922 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2923 time.sleep( link_sleep )
2924
You Wang0779bac2016-01-27 16:32:33 -08002925 main.step("Verify link down is discoverd by onos")
2926 # Giving onos multiple chances to discover link events
2927 for i in range( main.linkCheck ):
2928 if i != 0:
2929 main.log.warn( "Verification failed. Retrying..." )
2930 main.log.info("Giving onos some time...")
2931 time.sleep( link_sleep )
2932
2933 topology_output = main.ONOScli1.topology()
2934 linkDown = main.ONOSbench.checkStatus(
Hari Krishnab79d0822015-08-20 09:48:43 -07002935 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002936 int( main.numMNlinks ) - 4 ))
You Wang0779bac2016-01-27 16:32:33 -08002937 if linkDown:
2938 break
2939
Hari Krishnab79d0822015-08-20 09:48:43 -07002940 utilities.assert_equals(
2941 expect=main.TRUE,
2942 actual=linkDown,
You Wang0779bac2016-01-27 16:32:33 -08002943 onpass="Link down discovered properly",
Hari Krishnab79d0822015-08-20 09:48:43 -07002944 onfail="Link down was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08002945 str( link_sleep * main.linkCheck ) +
Hari Krishnab79d0822015-08-20 09:48:43 -07002946 " seconds" )
2947
GlennRCfcfdc4f2015-09-30 16:01:57 -07002948 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002949 # Giving onos multiple chances to install intents
2950 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002951 if i != 0:
2952 main.log.warn( "Verification failed. Retrying..." )
2953 main.log.info("Giving onos some time...")
2954 time.sleep( main.checkIntentsDelay )
2955
2956 intentState = main.TRUE
2957 for e in range(int(main.numCtrls)):
2958 main.log.info( "Checking intents on CLI %s" % (e+1) )
2959 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2960 intentState
2961 if not intentState:
2962 main.log.warn( "Not all intents installed" )
2963 if intentState:
2964 break
2965 else:
2966 #Dumping intent summary
2967 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2968
2969
2970 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2971 onpass="INTENTS INSTALLED",
2972 onfail="SOME INTENTS NOT INSTALLED" )
2973
Hari Krishnab79d0822015-08-20 09:48:43 -07002974 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07002975 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07002976 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07002977 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2978 if not pingResult:
2979 main.log.warn("First pingall failed. Retrying...")
2980 time.sleep(main.pingSleep)
2981 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07002982
Hari Krishnab79d0822015-08-20 09:48:43 -07002983 time2 = time.time()
2984 timeDiff = round( ( time2 - time1 ), 2 )
2985 main.log.report(
2986 "Time taken for Ping All: " +
2987 str( timeDiff ) +
2988 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002989 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002990 onpass="PING ALL PASS",
2991 onfail="PING ALL FAIL" )
2992
GlennRCbddd58f2015-10-01 15:45:25 -07002993 caseResult = linkDown and pingResult and intentState
2994 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002995 onpass="Random Link cut Test PASS",
2996 onfail="Random Link cut Test FAIL" )
2997
GlennRCfcfdc4f2015-09-30 16:01:57 -07002998 # Printing what exactly failed
2999 if not linkDown:
3000 main.log.debug( "Link down was not discovered correctly" )
3001 if not pingResult:
3002 main.log.debug( "Pingall failed" )
3003 if not intentState:
3004 main.log.debug( "Intents are not all installed" )
3005
GlennRCbddd58f2015-10-01 15:45:25 -07003006 if not caseResult and main.failSwitch:
3007 main.log.report("Stopping test")
3008 main.stop( email=main.emailOnStop )
3009
Hari Krishnab79d0822015-08-20 09:48:43 -07003010 def CASE85( self, main ):
3011 """
3012 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
3013 """
3014 import random
3015 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
3016 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
3017 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
3018 main.log.report(
3019 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
3020 main.log.report(
3021 "__________________________________________________________________" )
3022 main.case(
3023 "Point intents - Bring the core links up that are down and verify ping all" )
3024
You Wang0779bac2016-01-27 16:32:33 -08003025 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07003026 # Work around for link state propagation delay. Added some sleep time.
3027 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
3028 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
3029 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
3030 time.sleep( link_sleep )
3031 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
3032 time.sleep( link_sleep )
3033
You Wang0779bac2016-01-27 16:32:33 -08003034 main.step("Verify link up is discoverd by onos")
3035 # Giving onos multiple chances to discover link events
3036 for i in range( main.linkCheck ):
3037 if i != 0:
3038 main.log.warn( "Verification failed. Retrying..." )
3039 main.log.info("Giving onos some time...")
3040 time.sleep( link_sleep )
3041
3042 topology_output = main.ONOScli1.topology()
3043 linkUp = main.ONOSbench.checkStatus(
3044 topology_output,
3045 main.numMNswitches,
3046 str( main.numMNlinks ) )
3047 if linkUp:
3048 break
3049
Hari Krishnab79d0822015-08-20 09:48:43 -07003050 utilities.assert_equals(
3051 expect=main.TRUE,
3052 actual=linkUp,
3053 onpass="Link up discovered properly",
3054 onfail="Link up was not discovered in " +
You Wang0779bac2016-01-27 16:32:33 -08003055 str( link_sleep * main.linkCheck ) +
Hari Krishnab79d0822015-08-20 09:48:43 -07003056 " seconds" )
3057
GlennRCfcfdc4f2015-09-30 16:01:57 -07003058 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07003059 # Giving onos multiple chances to install intents
3060 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07003061 if i != 0:
3062 main.log.warn( "Verification failed. Retrying..." )
3063 main.log.info("Giving onos some time...")
3064 time.sleep( main.checkIntentsDelay )
3065
3066 intentState = main.TRUE
3067 for e in range(int(main.numCtrls)):
3068 main.log.info( "Checking intents on CLI %s" % (e+1) )
3069 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
3070 intentState
3071 if not intentState:
3072 main.log.warn( "Not all intents installed" )
3073 if intentState:
3074 break
3075 else:
3076 #Dumping intent summary
3077 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
3078
3079
3080 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3081 onpass="INTENTS INSTALLED",
3082 onfail="SOME INTENTS NOT INSTALLED" )
3083
Hari Krishnab79d0822015-08-20 09:48:43 -07003084 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003085 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07003086 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003087 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3088 if not pingResult:
3089 main.log.warn("First pingall failed. Retrying...")
3090 time.sleep(main.pingSleep)
3091 else: break
GlennRCa8d786a2015-09-23 17:40:11 -07003092
Hari Krishnab79d0822015-08-20 09:48:43 -07003093 time2 = time.time()
3094 timeDiff = round( ( time2 - time1 ), 2 )
3095 main.log.report(
3096 "Time taken for Ping All: " +
3097 str( timeDiff ) +
3098 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07003099 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07003100 onpass="PING ALL PASS",
3101 onfail="PING ALL FAIL" )
3102
GlennRCbddd58f2015-10-01 15:45:25 -07003103 caseResult = linkUp and pingResult
3104 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07003105 onpass="Link Up Test PASS",
3106 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07003107 # Printing what exactly failed
3108 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08003109 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07003110 if not pingResult:
3111 main.log.debug( "Pingall failed" )
3112 if not intentState:
3113 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07003114
GlennRCbddd58f2015-10-01 15:45:25 -07003115 if not caseResult and main.failSwitch:
3116 main.log.report("Stopping test")
3117 main.stop( email=main.emailOnStop )
3118
Hari Krishna4223dbd2015-08-13 16:29:53 -07003119 def CASE170( self ):
3120 """
3121 IPv6 ping all with some core links down( Host Intents-Att Topo)
3122 """
3123 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
3124 main.log.report( "_________________________________________________" )
3125 import itertools
3126 import time
3127 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
3128 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003129 pingResult = main.FALSE
3130 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003131 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003132 if not pingResult:
3133 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07003134 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003135 time2 = time.time()
3136 timeDiff = round( ( time2 - time1 ), 2 )
3137 main.log.report(
3138 "Time taken for IPv6 Ping All: " +
3139 str( timeDiff ) +
3140 " seconds" )
3141 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3142 onpass="PING ALL PASS",
3143 onfail="PING ALL FAIL" )
3144
GlennRCbddd58f2015-10-01 15:45:25 -07003145 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003146 utilities.assert_equals(
3147 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003148 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003149 onpass="IPv6 Ping across 300 host intents test PASS",
3150 onfail="IPv6 Ping across 300 host intents test FAIL" )
3151
3152 def CASE180( self ):
3153 """
3154 IPv6 ping all with after core links back up( Host Intents-Att Topo)
3155 """
3156 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
3157 main.log.report( "_________________________________________________" )
3158 import itertools
3159 import time
3160 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
3161 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003162 pingResult = main.FALSE
3163 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003164 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003165 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003166 main.log.warn("First ping failed. Retrying...")
3167 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003168 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003169 time2 = time.time()
3170 timeDiff = round( ( time2 - time1 ), 2 )
3171 main.log.report(
3172 "Time taken for IPv6 Ping All: " +
3173 str( timeDiff ) +
3174 " seconds" )
3175 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3176 onpass="PING ALL PASS",
3177 onfail="PING ALL FAIL" )
3178
GlennRCbddd58f2015-10-01 15:45:25 -07003179 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003180 utilities.assert_equals(
3181 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003182 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003183 onpass="IPv6 Ping across 300 host intents test PASS",
3184 onfail="IPv6 Ping across 300 host intents test FAIL" )
3185
3186 def CASE171( self ):
3187 """
3188 IPv6 ping all with some core links down( Point Intents-Att Topo)
3189 """
3190 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
3191 main.log.report( "_________________________________________________" )
3192 import itertools
3193 import time
3194 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
3195 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003196 pingResult = main.FALSE
3197 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003198 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003199 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003200 main.log.warn("First ping failed. Retrying...")
3201 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003202 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003203 time2 = time.time()
3204 timeDiff = round( ( time2 - time1 ), 2 )
3205 main.log.report(
3206 "Time taken for IPv6 Ping All: " +
3207 str( timeDiff ) +
3208 " seconds" )
3209 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3210 onpass="PING ALL PASS",
3211 onfail="PING ALL FAIL" )
3212
GlennRCbddd58f2015-10-01 15:45:25 -07003213 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003214 utilities.assert_equals(
3215 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003216 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003217 onpass="IPv6 Ping across 600 point intents test PASS",
3218 onfail="IPv6 Ping across 600 point intents test FAIL" )
3219
3220 def CASE181( self ):
3221 """
3222 IPv6 ping all with after core links back up( Point Intents-Att Topo)
3223 """
3224 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
3225 main.log.report( "_________________________________________________" )
3226 import itertools
3227 import time
3228 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
3229 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003230 pingResult = main.FALSE
3231 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003232 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003233 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003234 main.log.warn("First ping failed. Retrying...")
3235 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003236 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003237 time2 = time.time()
3238 timeDiff = round( ( time2 - time1 ), 2 )
3239 main.log.report(
3240 "Time taken for IPv6 Ping All: " +
3241 str( timeDiff ) +
3242 " seconds" )
3243 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3244 onpass="PING ALL PASS",
3245 onfail="PING ALL FAIL" )
3246
GlennRCbddd58f2015-10-01 15:45:25 -07003247 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003248 utilities.assert_equals(
3249 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003250 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003251 onpass="IPv6 Ping across 600 Point intents test PASS",
3252 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3253
3254 def CASE172( self ):
3255 """
3256 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
3257 """
3258 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
3259 main.log.report( "_________________________________________________" )
3260 import itertools
3261 import time
3262 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
3263 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003264 pingResult = main.FALSE
3265 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003266 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003267 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003268 main.log.warn("First ping failed. Retrying...")
3269 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003270 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003271 time2 = time.time()
3272 timeDiff = round( ( time2 - time1 ), 2 )
3273 main.log.report(
3274 "Time taken for IPv6 Ping All: " +
3275 str( timeDiff ) +
3276 " seconds" )
3277 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3278 onpass="PING ALL PASS",
3279 onfail="PING ALL FAIL" )
3280
GlennRCbddd58f2015-10-01 15:45:25 -07003281 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003282 utilities.assert_equals(
3283 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003284 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003285 onpass="IPv6 Ping across 300 host intents test PASS",
3286 onfail="IPv6 Ping across 300 host intents test FAIL" )
3287
3288 def CASE182( self ):
3289 """
3290 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
3291 """
3292 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
3293 main.log.report( "_________________________________________________" )
3294 import itertools
3295 import time
3296 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
3297 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003298 pingResult = main.FALSE
3299 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003300 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003301 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003302 main.log.warn("First ping failed. Retrying...")
3303 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003304 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003305 time2 = time.time()
3306 timeDiff = round( ( time2 - time1 ), 2 )
3307 main.log.report(
3308 "Time taken for IPv6 Ping All: " +
3309 str( timeDiff ) +
3310 " seconds" )
3311 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3312 onpass="PING ALL PASS",
3313 onfail="PING ALL FAIL" )
3314
GlennRCbddd58f2015-10-01 15:45:25 -07003315 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003316 utilities.assert_equals(
3317 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003318 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003319 onpass="IPv6 Ping across 300 host intents test PASS",
3320 onfail="IPv6 Ping across 300 host intents test FAIL" )
3321
3322 def CASE173( self ):
3323 """
3324 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
3325 """
3326 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
3327 main.log.report( "_________________________________________________" )
3328 import itertools
3329 import time
3330 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
3331 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003332 pingResult = main.FALSE
3333 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003334 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003335 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003336 main.log.warn("First ping failed. Retrying...")
3337 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003338 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003339 time2 = time.time()
3340 timeDiff = round( ( time2 - time1 ), 2 )
3341 main.log.report(
3342 "Time taken for IPv6 Ping All: " +
3343 str( timeDiff ) +
3344 " seconds" )
3345 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3346 onpass="PING ALL PASS",
3347 onfail="PING ALL FAIL" )
3348
GlennRCbddd58f2015-10-01 15:45:25 -07003349 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003350 utilities.assert_equals(
3351 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003352 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003353 onpass="IPv6 Ping across 600 point intents test PASS",
3354 onfail="IPv6 Ping across 600 point intents test FAIL" )
3355
3356 def CASE183( self ):
3357 """
3358 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
3359 """
3360 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
3361 main.log.report( "_________________________________________________" )
3362 import itertools
3363 import time
3364 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
3365 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003366 pingResult = main.FALSE
3367 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003368 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003369 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003370 main.log.warn("First ping failed. Retrying...")
3371 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003372 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003373 time2 = time.time()
3374 timeDiff = round( ( time2 - time1 ), 2 )
3375 main.log.report(
3376 "Time taken for IPv6 Ping All: " +
3377 str( timeDiff ) +
3378 " seconds" )
3379 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3380 onpass="PING ALL PASS",
3381 onfail="PING ALL FAIL" )
3382
GlennRCbddd58f2015-10-01 15:45:25 -07003383 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003384 utilities.assert_equals(
3385 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003386 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003387 onpass="IPv6 Ping across 600 Point intents test PASS",
3388 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3389
3390 def CASE174( self ):
3391 """
3392 IPv6 ping all with some core links down( Host Intents-Spine Topo)
3393 """
3394 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
3395 main.log.report( "_________________________________________________" )
3396 import itertools
3397 import time
3398 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
3399 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003400 pingResult = main.FALSE
3401 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003402 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003403 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003404 main.log.warn("First ping failed. Retrying...")
3405 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003406 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003407 time2 = time.time()
3408 timeDiff = round( ( time2 - time1 ), 2 )
3409 main.log.report(
3410 "Time taken for IPv6 Ping All: " +
3411 str( timeDiff ) +
3412 " seconds" )
3413 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3414 onpass="PING ALL PASS",
3415 onfail="PING ALL FAIL" )
3416
GlennRCbddd58f2015-10-01 15:45:25 -07003417 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003418 utilities.assert_equals(
3419 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003420 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003421 onpass="IPv6 Ping across 2278 host intents test PASS",
3422 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3423
3424 def CASE184( self ):
3425 """
3426 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
3427 """
3428 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
3429 main.log.report( "_________________________________________________" )
3430 import itertools
3431 import time
3432 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
3433 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003434 pingResult = main.FALSE
3435 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003436 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003437 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003438 main.log.warn("First ping failed. Retrying...")
3439 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003440 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003441 time2 = time.time()
3442 timeDiff = round( ( time2 - time1 ), 2 )
3443 main.log.report(
3444 "Time taken for IPv6 Ping All: " +
3445 str( timeDiff ) +
3446 " seconds" )
3447 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3448 onpass="PING ALL PASS",
3449 onfail="PING ALL FAIL" )
3450
GlennRCbddd58f2015-10-01 15:45:25 -07003451 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003452 utilities.assert_equals(
3453 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003454 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003455 onpass="IPv6 Ping across 2278 host intents test PASS",
3456 onfail="IPv6 Ping across 2278 host intents test FAIL" )
3457
3458 def CASE175( self ):
3459 """
3460 IPv6 ping all with some core links down( Point Intents-Spine Topo)
3461 """
3462 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3463 main.log.report( "_________________________________________________" )
3464 import itertools
3465 import time
3466 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
3467 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003468 pingResult = main.FALSE
3469 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003470 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003471 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003472 main.log.warn("First ping failed. Retrying...")
3473 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003474 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003475 time2 = time.time()
3476 timeDiff = round( ( time2 - time1 ), 2 )
3477 main.log.report(
3478 "Time taken for IPv6 Ping All: " +
3479 str( timeDiff ) +
3480 " seconds" )
3481 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3482 onpass="PING ALL PASS",
3483 onfail="PING ALL FAIL" )
3484
GlennRCbddd58f2015-10-01 15:45:25 -07003485 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003486 utilities.assert_equals(
3487 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003488 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003489 onpass="IPv6 Ping across 4556 point intents test PASS",
3490 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3491
3492 def CASE185( self ):
3493 """
3494 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3495 """
3496 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3497 main.log.report( "_________________________________________________" )
3498 import itertools
3499 import time
3500 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3501 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003502 pingResult = main.FALSE
3503 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003504 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003505 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003506 main.log.warn("First ping failed. Retrying...")
3507 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003508 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003509 time2 = time.time()
3510 timeDiff = round( ( time2 - time1 ), 2 )
3511 main.log.report(
3512 "Time taken for IPv6 Ping All: " +
3513 str( timeDiff ) +
3514 " seconds" )
3515 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3516 onpass="PING ALL PASS",
3517 onfail="PING ALL FAIL" )
3518
GlennRCbddd58f2015-10-01 15:45:25 -07003519 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003520 utilities.assert_equals(
3521 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003522 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003523 onpass="IPv6 Ping across 4556 Point intents test PASS",
3524 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3525
Hari Krishnac195f3b2015-07-08 20:02:24 -07003526 def CASE90( self ):
3527 """
3528 Install 600 point intents and verify ping all (Att Topology)
3529 """
3530 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3531 main.log.report( "_______________________________________" )
3532 import itertools
3533 import time
3534 main.case( "Install 600 point intents" )
3535 main.step( "Add point Intents" )
3536 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003537 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3538
Hari Krishnac195f3b2015-07-08 20:02:24 -07003539 intentIdList = []
3540 time1 = time.time()
3541 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3542 pool = []
3543 for cli in main.CLIs:
3544 if i >= len( deviceCombos ):
3545 break
3546 t = main.Thread( target=cli.addPointIntent,
3547 threadID=main.threadID,
3548 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003549 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 -07003550 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003551 t.start()
3552 i = i + 1
3553 main.threadID = main.threadID + 1
3554 for thread in pool:
3555 thread.join()
3556 intentIdList.append(thread.result)
3557 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003558 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003559
GlennRCfcfdc4f2015-09-30 16:01:57 -07003560 # Saving intent ids to check intents in later case
3561 main.intentIds = list(intentIdList)
3562
GlennRCa8d786a2015-09-23 17:40:11 -07003563 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003564
GlennRC1dde1712015-10-02 11:03:08 -07003565 # Giving onos multiple chances to install intents
3566 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003567 if i != 0:
3568 main.log.warn( "Verification failed. Retrying..." )
3569 main.log.info("Waiting for onos to install intents...")
3570 time.sleep( main.checkIntentsDelay )
3571
GlennRCa8d786a2015-09-23 17:40:11 -07003572 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003573 for e in range(int(main.numCtrls)):
3574 main.log.info( "Checking intents on CLI %s" % (e+1) )
3575 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3576 intentState
3577 if not intentState:
3578 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003579 if intentState:
3580 break
GlennRCdb2c8422015-09-29 12:21:59 -07003581 else:
3582 #Dumping intent summary
3583 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003584
3585 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3586 onpass="INTENTS INSTALLED",
3587 onfail="SOME INTENTS NOT INSTALLED" )
3588
Hari Krishnac195f3b2015-07-08 20:02:24 -07003589 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003590 for i in range(main.numPings):
3591 time1 = time.time()
3592 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3593 if not pingResult:
3594 main.log.warn("First pingall failed. Retrying...")
3595 time.sleep(main.pingSleep)
3596 else: break
3597
Hari Krishnac195f3b2015-07-08 20:02:24 -07003598 time2 = time.time()
3599 timeDiff = round( ( time2 - time1 ), 2 )
3600 main.log.report(
3601 "Time taken for Ping All: " +
3602 str( timeDiff ) +
3603 " seconds" )
3604 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07003605 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07003606 onfail="PING ALL FAIL" )
3607
GlennRCbddd58f2015-10-01 15:45:25 -07003608 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003609
Hari Krishnac195f3b2015-07-08 20:02:24 -07003610 utilities.assert_equals(
3611 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003612 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003613 onpass="Install 600 point Intents and Ping All test PASS",
3614 onfail="Install 600 point Intents and Ping All test FAIL" )
3615
GlennRCbddd58f2015-10-01 15:45:25 -07003616 if not intentState:
3617 main.log.debug( "Intents failed to install completely" )
3618 if not pingResult:
3619 main.log.debug( "Pingall failed" )
3620
3621 if not caseResult and main.failSwitch:
3622 main.log.report("Stopping test")
3623 main.stop( email=main.emailOnStop )
3624
Hari Krishnac195f3b2015-07-08 20:02:24 -07003625 def CASE91( self ):
3626 """
3627 Install 600 point intents and verify ping all (Chordal Topology)
3628 """
3629 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3630 main.log.report( "_______________________________________" )
3631 import itertools
3632 import time
3633 main.case( "Install 600 point intents" )
3634 main.step( "Add point Intents" )
3635 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003636 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3637
Hari Krishnac195f3b2015-07-08 20:02:24 -07003638 intentIdList = []
3639 time1 = time.time()
3640 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3641 pool = []
3642 for cli in main.CLIs:
3643 if i >= len( deviceCombos ):
3644 break
3645 t = main.Thread( target=cli.addPointIntent,
3646 threadID=main.threadID,
3647 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003648 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 -07003649 pool.append(t)
3650 #time.sleep(1)
3651 t.start()
3652 i = i + 1
3653 main.threadID = main.threadID + 1
3654 for thread in pool:
3655 thread.join()
3656 intentIdList.append(thread.result)
3657 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003658 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003659
GlennRCfcfdc4f2015-09-30 16:01:57 -07003660 # Saving intent ids to check intents in later case
3661 main.intentIds = list(intentIdList)
3662
GlennRCa8d786a2015-09-23 17:40:11 -07003663 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003664
GlennRC1dde1712015-10-02 11:03:08 -07003665 # Giving onos multiple chances to install intents
3666 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003667 if i != 0:
3668 main.log.warn( "Verification failed. Retrying..." )
3669 main.log.info("Waiting for onos to install intents...")
3670 time.sleep( main.checkIntentsDelay )
3671
GlennRCa8d786a2015-09-23 17:40:11 -07003672 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003673 for e in range(int(main.numCtrls)):
3674 main.log.info( "Checking intents on CLI %s" % (e+1) )
3675 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3676 intentState
3677 if not intentState:
3678 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003679 if intentState:
3680 break
GlennRCdb2c8422015-09-29 12:21:59 -07003681 else:
3682 #Dumping intent summary
3683 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003684
3685 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3686 onpass="INTENTS INSTALLED",
3687 onfail="SOME INTENTS NOT INSTALLED" )
3688
Hari Krishnac195f3b2015-07-08 20:02:24 -07003689 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003690 for i in range(main.numPings):
3691 time1 = time.time()
3692 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3693 if not pingResult:
3694 main.log.warn("First pingall failed. Retrying...")
3695 time.sleep(main.pingSleep)
3696 else: break
3697
Hari Krishnac195f3b2015-07-08 20:02:24 -07003698 time2 = time.time()
3699 timeDiff = round( ( time2 - time1 ), 2 )
3700 main.log.report(
3701 "Time taken for Ping All: " +
3702 str( timeDiff ) +
3703 " seconds" )
3704 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3705 onpass="PING ALL PASS",
3706 onfail="PING ALL FAIL" )
3707
GlennRCbddd58f2015-10-01 15:45:25 -07003708 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003709
Hari Krishnac195f3b2015-07-08 20:02:24 -07003710 utilities.assert_equals(
3711 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003712 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003713 onpass="Install 600 point Intents and Ping All test PASS",
3714 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003715
GlennRCbddd58f2015-10-01 15:45:25 -07003716 if not intentState:
3717 main.log.debug( "Intents failed to install completely" )
3718 if not pingResult:
3719 main.log.debug( "Pingall failed" )
3720
3721 if not caseResult and main.failSwitch:
3722 main.log.report("Stopping test")
3723 main.stop( email=main.emailOnStop )
3724
Hari Krishnac195f3b2015-07-08 20:02:24 -07003725 def CASE92( self ):
3726 """
3727 Install 4556 point intents and verify ping all (Spine Topology)
3728 """
3729 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3730 main.log.report( "_______________________________________" )
3731 import itertools
3732 import time
3733 main.case( "Install 4556 point intents" )
3734 main.step( "Add point Intents" )
3735 intentResult = main.TRUE
3736 main.pingTimeout = 600
3737 for i in range(len(main.hostMACs)):
3738 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3739 print main.MACsDict
3740 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3741 intentIdList = []
3742 time1 = time.time()
3743 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3744 pool = []
3745 for cli in main.CLIs:
3746 if i >= len( deviceCombos ):
3747 break
3748 t = main.Thread( target=cli.addPointIntent,
3749 threadID=main.threadID,
3750 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003751 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 -07003752 pool.append(t)
3753 #time.sleep(1)
3754 t.start()
3755 i = i + 1
3756 main.threadID = main.threadID + 1
3757 for thread in pool:
3758 thread.join()
3759 intentIdList.append(thread.result)
3760 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003761 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003762
GlennRCfcfdc4f2015-09-30 16:01:57 -07003763 # Saving intent ids to check intents in later case
3764 main.intentIds = list(intentIdList)
3765
GlennRCa8d786a2015-09-23 17:40:11 -07003766 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003767
GlennRC1dde1712015-10-02 11:03:08 -07003768 # Giving onos multiple chances to install intents
3769 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003770 if i != 0:
3771 main.log.warn( "Verification failed. Retrying..." )
3772 main.log.info("Waiting for onos to install intents...")
3773 time.sleep( main.checkIntentsDelay )
3774
GlennRCa8d786a2015-09-23 17:40:11 -07003775 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003776 for e in range(int(main.numCtrls)):
3777 main.log.info( "Checking intents on CLI %s" % (e+1) )
3778 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3779 intentState
3780 if not intentState:
3781 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003782 if intentState:
3783 break
GlennRCdb2c8422015-09-29 12:21:59 -07003784 else:
3785 #Dumping intent summary
3786 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003787
3788 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3789 onpass="INTENTS INSTALLED",
3790 onfail="SOME INTENTS NOT INSTALLED" )
3791
Hari Krishnac195f3b2015-07-08 20:02:24 -07003792 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003793 for i in range(main.numPings):
3794 time1 = time.time()
3795 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3796 if not pingResult:
3797 main.log.warn("First pingall failed. Retrying...")
3798 time.sleep(main.pingSleep)
3799 else: break
3800
Hari Krishnac195f3b2015-07-08 20:02:24 -07003801 time2 = time.time()
3802 timeDiff = round( ( time2 - time1 ), 2 )
3803 main.log.report(
3804 "Time taken for Ping All: " +
3805 str( timeDiff ) +
3806 " seconds" )
3807 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3808 onpass="PING ALL PASS",
3809 onfail="PING ALL FAIL" )
3810
GlennRCbddd58f2015-10-01 15:45:25 -07003811 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003812
Hari Krishnac195f3b2015-07-08 20:02:24 -07003813 utilities.assert_equals(
3814 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003815 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003816 onpass="Install 4556 point Intents and Ping All test PASS",
3817 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003818
GlennRCbddd58f2015-10-01 15:45:25 -07003819 if not intentState:
3820 main.log.debug( "Intents failed to install completely" )
3821 if not pingResult:
3822 main.log.debug( "Pingall failed" )
3823
3824 if not caseResult and main.failSwitch:
3825 main.log.report("Stopping test")
3826 main.stop( email=main.emailOnStop )
3827
Hari Krishnac195f3b2015-07-08 20:02:24 -07003828 def CASE93( self ):
3829 """
3830 Install multi-single point intents and verify Ping all works
3831 for att topology
3832 """
3833 import copy
3834 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003835 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003836 main.log.report( "Install multi-single point intents and verify Ping all" )
3837 main.log.report( "___________________________________________" )
3838 main.case( "Install multi-single point intents and Ping all" )
3839 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3840 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3841 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003842 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003843 time1 = time.time()
3844 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3845 pool = []
3846 for cli in main.CLIs:
3847 egressDevice = deviceDPIDsCopy[i]
3848 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3849 ingressDeviceList.remove(egressDevice)
3850 if i >= len( deviceDPIDsCopy ):
3851 break
3852 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3853 threadID=main.threadID,
3854 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003855 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003856 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003857 t.start()
3858 i = i + 1
3859 main.threadID = main.threadID + 1
3860 for thread in pool:
3861 thread.join()
3862 intentIdList.append(thread.result)
3863 time2 = time.time()
3864 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003865
GlennRCdb2c8422015-09-29 12:21:59 -07003866 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003867
GlennRC1dde1712015-10-02 11:03:08 -07003868 # Giving onos multiple chances to install intents
3869 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003870 if i != 0:
3871 main.log.warn( "Verification failed. Retrying..." )
3872 main.log.info("Waiting for onos to install intents...")
3873 time.sleep( main.checkIntentsDelay )
3874
3875 intentState = main.TRUE
3876 for e in range(int(main.numCtrls)):
3877 main.log.info( "Checking intents on CLI %s" % (e+1) )
3878 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3879 intentState
3880 if not intentState:
3881 main.log.warn( "Not all intents installed" )
3882 if intentState:
3883 break
3884 else:
3885 #Dumping intent summary
3886 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3887
3888 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3889 onpass="INTENTS INSTALLED",
3890 onfail="SOME INTENTS NOT INSTALLED" )
3891
GlennRCfa69a2a2015-10-02 15:54:06 -07003892 main.step("Verify flows are all added")
3893
3894 for i in range( main.flowCheck ):
3895 if i != 0:
3896 main.log.warn( "verification failed. Retrying..." )
3897 main.log.info( "Waiting for onos to add flows..." )
3898 time.sleep( main.checkFlowsDelay )
3899
3900 flowState = main.TRUE
3901 for cli in main.CLIs:
3902 flowState = cli.checkFlowState()
3903 if not flowState:
3904 main.log.warn( "Not all flows added" )
3905 if flowState:
3906 break
3907 else:
3908 #Dumping summary
3909 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3910
3911 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3912 onpass="FLOWS INSTALLED",
3913 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003914
Hari Krishnac195f3b2015-07-08 20:02:24 -07003915 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07003916 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07003917 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07003918 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
3919 if not pingResult:
3920 main.log.warn("First pingall failed. Retrying...")
3921 time.sleep(main.pingSleep)
3922 else: break
GlennRCdb2c8422015-09-29 12:21:59 -07003923
Hari Krishnac195f3b2015-07-08 20:02:24 -07003924 time2 = time.time()
3925 timeDiff = round( ( time2 - time1 ), 2 )
3926 main.log.report(
3927 "Time taken for Ping All: " +
3928 str( timeDiff ) +
3929 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003930
GlennRCbddd58f2015-10-01 15:45:25 -07003931 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003932 utilities.assert_equals(
3933 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003934 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003935 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3936 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003937
GlennRCfa69a2a2015-10-02 15:54:06 -07003938 if not intentState:
3939 main.log.debug( "Intents failed to install completely" )
3940 if not pingResult:
3941 main.log.debug( "Pingall failed" )
3942 if not checkFlowsState:
3943 main.log.debug( "Flows failed to add completely" )
3944
3945 if not caseResult and main.failSwitch:
3946 main.log.report("Stopping test")
3947 main.stop( email=main.emailOnStop )
3948
Hari Krishnac195f3b2015-07-08 20:02:24 -07003949 def CASE94( self ):
3950 """
3951 Install multi-single point intents and verify Ping all works
3952 for Chordal topology
3953 """
3954 import copy
3955 import time
3956 main.log.report( "Install multi-single point intents and verify Ping all" )
3957 main.log.report( "___________________________________________" )
3958 main.case( "Install multi-single point intents and Ping all" )
3959 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3960 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3961 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003962 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003963 time1 = time.time()
3964 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3965 pool = []
3966 for cli in main.CLIs:
3967 egressDevice = deviceDPIDsCopy[i]
3968 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3969 ingressDeviceList.remove(egressDevice)
3970 if i >= len( deviceDPIDsCopy ):
3971 break
3972 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3973 threadID=main.threadID,
3974 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003975 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003976 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003977 t.start()
3978 i = i + 1
3979 main.threadID = main.threadID + 1
3980 for thread in pool:
3981 thread.join()
3982 intentIdList.append(thread.result)
3983 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003984 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003985
3986 main.step("Verify intents are installed")
3987
GlennRC1dde1712015-10-02 11:03:08 -07003988 # Giving onos multiple chances to install intents
3989 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003990 if i != 0:
3991 main.log.warn( "Verification failed. Retrying..." )
3992 main.log.info("Waiting for onos to install intents...")
3993 time.sleep( main.checkIntentsDelay )
3994
3995 intentState = main.TRUE
3996 for e in range(int(main.numCtrls)):
3997 main.log.info( "Checking intents on CLI %s" % (e+1) )
3998 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3999 intentState
4000 if not intentState:
4001 main.log.warn( "Not all intents installed" )
4002 if intentState:
4003 break
4004 else:
4005 #Dumping intent summary
4006 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4007
GlennRCdb2c8422015-09-29 12:21:59 -07004008 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4009 onpass="INTENTS INSTALLED",
4010 onfail="SOME INTENTS NOT INSTALLED" )
4011
GlennRCfa69a2a2015-10-02 15:54:06 -07004012 main.step("Verify flows are all added")
4013
4014 for i in range( main.flowCheck ):
4015 if i != 0:
4016 main.log.warn( "verification failed. Retrying..." )
4017 main.log.info( "Waiting for onos to add flows..." )
4018 time.sleep( main.checkFlowsDelay )
4019
4020 flowState = main.TRUE
4021 for cli in main.CLIs:
4022 flowState = cli.checkFlowState()
4023 if not flowState:
4024 main.log.warn( "Not all flows added" )
4025 if flowState:
4026 break
4027 else:
4028 #Dumping summary
4029 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4030
4031 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4032 onpass="FLOWS INSTALLED",
4033 onfail="SOME FLOWS NOT ADDED" )
4034
Hari Krishnac195f3b2015-07-08 20:02:24 -07004035 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004036 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004037 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004038 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4039 if not pingResult:
4040 main.log.warn("First pingall failed. Retrying...")
4041 time.sleep(main.pingSleep)
4042 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004043
Hari Krishnac195f3b2015-07-08 20:02:24 -07004044 time2 = time.time()
4045 timeDiff = round( ( time2 - time1 ), 2 )
4046 main.log.report(
4047 "Time taken for Ping All: " +
4048 str( timeDiff ) +
4049 " seconds" )
4050
GlennRCfa69a2a2015-10-02 15:54:06 -07004051 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004052 utilities.assert_equals(
4053 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004054 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004055 onpass="Install 25 multi to single point Intents and Ping All test PASS",
4056 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004057
GlennRCfa69a2a2015-10-02 15:54:06 -07004058 if not intentState:
4059 main.log.debug( "Intents failed to install completely" )
4060 if not pingResult:
4061 main.log.debug( "Pingall failed" )
4062 if not checkFlowsState:
4063 main.log.debug( "Flows failed to add completely" )
4064
4065 if not caseResult and main.failSwitch:
4066 main.log.report("Stopping test")
4067 main.stop( email=main.emailOnStop )
4068
4069 def CASE95( self ):
4070 """
4071 Install multi-single point intents and verify Ping all works
4072 for Spine topology
4073 """
4074 import copy
4075 import time
4076 main.log.report( "Install multi-single point intents and verify Ping all" )
4077 main.log.report( "___________________________________________" )
4078 main.case( "Install multi-single point intents and Ping all" )
4079 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
4080 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
4081 intentIdList = []
4082 main.log.info( "MACsDict" + str(main.MACsDict) )
4083 time1 = time.time()
4084 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
4085 pool = []
4086 for cli in main.CLIs:
4087 egressDevice = deviceDPIDsCopy[i]
4088 ingressDeviceList = copy.copy(deviceDPIDsCopy)
4089 ingressDeviceList.remove(egressDevice)
4090 if i >= len( deviceDPIDsCopy ):
4091 break
4092 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
4093 threadID=main.threadID,
4094 name="addMultipointToSinglepointIntent",
4095 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
4096 pool.append(t)
4097 t.start()
4098 i = i + 1
4099 main.threadID = main.threadID + 1
4100 for thread in pool:
4101 thread.join()
4102 intentIdList.append(thread.result)
4103 time2 = time.time()
4104 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
4105
4106 main.step("Verify intents are installed")
4107
4108 # Giving onos multiple chances to install intents
4109 for i in range( main.intentCheck ):
4110 if i != 0:
4111 main.log.warn( "Verification failed. Retrying..." )
4112 main.log.info("Waiting for onos to install intents...")
4113 time.sleep( main.checkIntentsDelay )
4114
4115 intentState = main.TRUE
4116 for e in range(int(main.numCtrls)):
4117 main.log.info( "Checking intents on CLI %s" % (e+1) )
4118 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4119 intentState
4120 if not intentState:
4121 main.log.warn( "Not all intents installed" )
4122 if intentState:
4123 break
4124 else:
4125 #Dumping intent summary
4126 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4127
4128 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4129 onpass="INTENTS INSTALLED",
4130 onfail="SOME INTENTS NOT INSTALLED" )
4131
4132 main.step("Verify flows are all added")
4133
4134 for i in range( main.flowCheck ):
4135 if i != 0:
4136 main.log.warn( "verification failed. Retrying..." )
4137 main.log.info( "Waiting for onos to add flows..." )
4138 time.sleep( main.checkFlowsDelay )
4139
4140 flowState = main.TRUE
4141 for cli in main.CLIs:
4142 flowState = cli.checkFlowState()
4143 if not flowState:
4144 main.log.warn( "Not all flows added" )
4145 if flowState:
4146 break
4147 else:
4148 #Dumping summary
4149 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4150
4151 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4152 onpass="FLOWS INSTALLED",
4153 onfail="SOME FLOWS NOT ADDED" )
4154
4155 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004156 for i in range(main.numPings):
GlennRCfa69a2a2015-10-02 15:54:06 -07004157 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004158 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4159 if not pingResult:
4160 main.log.warn("First pingall failed. Retrying...")
4161 time.sleep(main.pingSleep)
4162 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004163
4164 time2 = time.time()
4165 timeDiff = round( ( time2 - time1 ), 2 )
4166 main.log.report(
4167 "Time taken for Ping All: " +
4168 str( timeDiff ) +
4169 " seconds" )
4170
4171 caseResult = ( checkFlowsState and pingResult and intentState )
4172 utilities.assert_equals(
4173 expect=main.TRUE,
4174 actual=caseResult,
4175 onpass="Install 25 multi to single point Intents and Ping All test PASS",
4176 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
4177
4178 if not intentState:
4179 main.log.debug( "Intents failed to install completely" )
4180 if not pingResult:
4181 main.log.debug( "Pingall failed" )
4182 if not checkFlowsState:
4183 main.log.debug( "Flows failed to add completely" )
4184
4185 if not caseResult and main.failSwitch:
4186 main.log.report("Stopping test")
4187 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004188
4189 def CASE96( self ):
4190 """
4191 Install single-multi point intents and verify Ping all works
4192 for att topology
4193 """
4194 import copy
4195 main.log.report( "Install single-multi point intents and verify Ping all" )
4196 main.log.report( "___________________________________________" )
4197 main.case( "Install single-multi point intents and Ping all" )
4198 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
4199 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
4200 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07004201 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004202 time1 = time.time()
4203 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
4204 pool = []
4205 for cli in main.CLIs:
4206 ingressDevice = deviceDPIDsCopy[i]
4207 egressDeviceList = copy.copy(deviceDPIDsCopy)
4208 egressDeviceList.remove(ingressDevice)
4209 if i >= len( deviceDPIDsCopy ):
4210 break
4211 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4212 threadID=main.threadID,
4213 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004214 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004215 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004216 t.start()
4217 i = i + 1
4218 main.threadID = main.threadID + 1
4219 for thread in pool:
4220 thread.join()
4221 intentIdList.append(thread.result)
4222 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004223 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004224
4225 main.step("Verify intents are installed")
4226
GlennRC1dde1712015-10-02 11:03:08 -07004227 # Giving onos multiple chances to install intents
4228 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004229 if i != 0:
4230 main.log.warn( "Verification failed. Retrying..." )
4231 main.log.info("Waiting for onos to install intents...")
4232 time.sleep( main.checkIntentsDelay )
4233
4234 intentState = main.TRUE
4235 for e in range(int(main.numCtrls)):
4236 main.log.info( "Checking intents on CLI %s" % (e+1) )
4237 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4238 intentState
4239 if not intentState:
4240 main.log.warn( "Not all intents installed" )
4241 if intentState:
4242 break
4243 else:
4244 #Dumping intent summary
4245 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4246
GlennRCdb2c8422015-09-29 12:21:59 -07004247 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4248 onpass="INTENTS INSTALLED",
4249 onfail="SOME INTENTS NOT INSTALLED" )
4250
GlennRCfa69a2a2015-10-02 15:54:06 -07004251 main.step("Verify flows are all added")
4252
4253 for i in range( main.flowCheck ):
4254 if i != 0:
4255 main.log.warn( "verification failed. Retrying..." )
4256 main.log.info( "Waiting for onos to add flows..." )
4257 time.sleep( main.checkFlowsDelay )
4258
4259 flowState = main.TRUE
4260 for cli in main.CLIs:
4261 flowState = cli.checkFlowState()
4262 if not flowState:
4263 main.log.warn( "Not all flows added" )
4264 if flowState:
4265 break
4266 else:
4267 #Dumping summary
4268 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4269
4270 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4271 onpass="FLOWS INSTALLED",
4272 onfail="SOME FLOWS NOT ADDED" )
4273
Hari Krishnac195f3b2015-07-08 20:02:24 -07004274 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004275 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004276 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004277 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4278 if not pingResult:
4279 main.log.warn("First pingall failed. Retrying...")
4280 time.sleep(main.pingSleep)
4281 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004282
Hari Krishnac195f3b2015-07-08 20:02:24 -07004283 time2 = time.time()
4284 timeDiff = round( ( time2 - time1 ), 2 )
4285 main.log.report(
4286 "Time taken for Ping All: " +
4287 str( timeDiff ) +
4288 " seconds" )
4289
GlennRCfa69a2a2015-10-02 15:54:06 -07004290 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004291 utilities.assert_equals(
4292 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004293 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004294 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4295 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4296
GlennRCfa69a2a2015-10-02 15:54:06 -07004297 if not intentState:
4298 main.log.debug( "Intents failed to install completely" )
4299 if not pingResult:
4300 main.log.debug( "Pingall failed" )
4301 if not checkFlowsState:
4302 main.log.debug( "Flows failed to add completely" )
4303
4304 if not caseResult and main.failSwitch:
4305 main.log.report("Stopping test")
4306 main.stop( email=main.emailOnStop )
4307
Hari Krishnac195f3b2015-07-08 20:02:24 -07004308 def CASE97( self ):
4309 """
4310 Install single-multi point intents and verify Ping all works
4311 for Chordal topology
4312 """
4313 import copy
4314 main.log.report( "Install single-multi point intents and verify Ping all" )
4315 main.log.report( "___________________________________________" )
4316 main.case( "Install single-multi point intents and Ping all" )
4317 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
4318 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
4319 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07004320 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004321 time1 = time.time()
4322 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
4323 pool = []
4324 for cli in main.CLIs:
4325 ingressDevice = deviceDPIDsCopy[i]
4326 egressDeviceList = copy.copy(deviceDPIDsCopy)
4327 egressDeviceList.remove(ingressDevice)
4328 if i >= len( deviceDPIDsCopy ):
4329 break
4330 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4331 threadID=main.threadID,
4332 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004333 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004334 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004335 t.start()
4336 i = i + 1
4337 main.threadID = main.threadID + 1
4338 for thread in pool:
4339 thread.join()
4340 intentIdList.append(thread.result)
4341 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004342 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004343
4344 main.step("Verify intents are installed")
4345
GlennRC1dde1712015-10-02 11:03:08 -07004346 # Giving onos multiple chances to install intents
4347 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004348 if i != 0:
4349 main.log.warn( "Verification failed. Retrying..." )
4350 main.log.info("Waiting for onos to install intents...")
4351 time.sleep( main.checkIntentsDelay )
4352
4353 intentState = main.TRUE
4354 for e in range(int(main.numCtrls)):
4355 main.log.info( "Checking intents on CLI %s" % (e+1) )
4356 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4357 intentState
4358 if not intentState:
4359 main.log.warn( "Not all intents installed" )
4360 if intentState:
4361 break
4362 else:
4363 #Dumping intent summary
4364 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4365
GlennRCdb2c8422015-09-29 12:21:59 -07004366 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4367 onpass="INTENTS INSTALLED",
4368 onfail="SOME INTENTS NOT INSTALLED" )
4369
GlennRCfa69a2a2015-10-02 15:54:06 -07004370 main.step("Verify flows are all added")
4371
4372 for i in range( main.flowCheck ):
4373 if i != 0:
4374 main.log.warn( "verification failed. Retrying..." )
4375 main.log.info( "Waiting for onos to add flows..." )
4376 time.sleep( main.checkFlowsDelay )
4377
4378 flowState = main.TRUE
4379 for cli in main.CLIs:
4380 flowState = cli.checkFlowState()
4381 if not flowState:
4382 main.log.warn( "Not all flows added" )
4383 if flowState:
4384 break
4385 else:
4386 #Dumping summary
4387 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4388
4389 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4390 onpass="FLOWS INSTALLED",
4391 onfail="SOME FLOWS NOT ADDED" )
4392
Hari Krishnac195f3b2015-07-08 20:02:24 -07004393 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004394 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004395 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004396 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4397 if not pingResult:
4398 main.log.warn("First pingall failed. Retrying...")
4399 time.sleep(main.pingSleep)
4400 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004401
Hari Krishnac195f3b2015-07-08 20:02:24 -07004402 time2 = time.time()
4403 timeDiff = round( ( time2 - time1 ), 2 )
4404 main.log.report(
4405 "Time taken for Ping All: " +
4406 str( timeDiff ) +
4407 " seconds" )
4408
GlennRCfa69a2a2015-10-02 15:54:06 -07004409 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004410 utilities.assert_equals(
4411 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004412 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004413 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4414 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4415
GlennRCfa69a2a2015-10-02 15:54:06 -07004416 if not intentState:
4417 main.log.debug( "Intents failed to install completely" )
4418 if not pingResult:
4419 main.log.debug( "Pingall failed" )
4420 if not checkFlowsState:
4421 main.log.debug( "Flows failed to add completely" )
4422
4423 if not caseResult and main.failSwitch:
4424 main.log.report("Stopping test")
4425 main.stop( email=main.emailOnStop )
4426
Hari Krishnac195f3b2015-07-08 20:02:24 -07004427 def CASE98( self ):
4428 """
4429 Install single-multi point intents and verify Ping all works
4430 for Spine topology
4431 """
4432 import copy
4433 main.log.report( "Install single-multi point intents and verify Ping all" )
4434 main.log.report( "___________________________________________" )
4435 main.case( "Install single-multi point intents and Ping all" )
4436 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
4437 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
4438 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
4439 intentIdList = []
4440 MACsDictCopy = {}
4441 for i in range( len( deviceDPIDsCopy ) ):
4442 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
4443
GlennRCfa69a2a2015-10-02 15:54:06 -07004444 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
4445 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004446 time1 = time.time()
4447 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
4448 pool = []
4449 for cli in main.CLIs:
4450 if i >= len( deviceDPIDsCopy ):
4451 break
4452 ingressDevice = deviceDPIDsCopy[i]
4453 egressDeviceList = copy.copy(deviceDPIDsCopy)
4454 egressDeviceList.remove(ingressDevice)
4455 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
4456 threadID=main.threadID,
4457 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07004458 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07004459 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004460 t.start()
4461 i = i + 1
4462 main.threadID = main.threadID + 1
4463 for thread in pool:
4464 thread.join()
4465 intentIdList.append(thread.result)
4466 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004467 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07004468
4469 main.step("Verify intents are installed")
4470
GlennRC1dde1712015-10-02 11:03:08 -07004471 # Giving onos multiple chances to install intents
4472 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07004473 if i != 0:
4474 main.log.warn( "Verification failed. Retrying..." )
4475 main.log.info("Waiting for onos to install intents...")
4476 time.sleep( main.checkIntentsDelay )
4477
4478 intentState = main.TRUE
4479 for e in range(int(main.numCtrls)):
4480 main.log.info( "Checking intents on CLI %s" % (e+1) )
4481 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
4482 intentState
4483 if not intentState:
4484 main.log.warn( "Not all intents installed" )
4485 if intentState:
4486 break
4487 else:
4488 #Dumping intent summary
4489 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
4490
GlennRCdb2c8422015-09-29 12:21:59 -07004491 utilities.assert_equals( expect=main.TRUE, actual=intentState,
4492 onpass="INTENTS INSTALLED",
4493 onfail="SOME INTENTS NOT INSTALLED" )
4494
GlennRCfa69a2a2015-10-02 15:54:06 -07004495 main.step("Verify flows are all added")
4496
4497 for i in range( main.flowCheck ):
4498 if i != 0:
4499 main.log.warn( "verification failed. Retrying..." )
4500 main.log.info( "Waiting for onos to add flows..." )
4501 time.sleep( main.checkFlowsDelay )
4502
4503 flowState = main.TRUE
4504 for cli in main.CLIs:
4505 flowState = cli.checkFlowState()
4506 if not flowState:
4507 main.log.warn( "Not all flows added" )
4508 if flowState:
4509 break
4510 else:
4511 #Dumping summary
4512 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4513
4514 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4515 onpass="FLOWS INSTALLED",
4516 onfail="SOME FLOWS NOT ADDED" )
4517
Hari Krishnac195f3b2015-07-08 20:02:24 -07004518 main.step( "Verify Ping across all hosts" )
GlennRC6ac11b12015-10-21 17:41:28 -07004519 for i in range(main.numPings):
GlennRCdb2c8422015-09-29 12:21:59 -07004520 time1 = time.time()
GlennRC6ac11b12015-10-21 17:41:28 -07004521 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4522 if not pingResult:
4523 main.log.warn("First pingall failed. Retrying...")
4524 time.sleep(main.pingSleep)
4525 else: break
GlennRCfa69a2a2015-10-02 15:54:06 -07004526
Hari Krishnac195f3b2015-07-08 20:02:24 -07004527 time2 = time.time()
4528 timeDiff = round( ( time2 - time1 ), 2 )
4529 main.log.report(
4530 "Time taken for Ping All: " +
4531 str( timeDiff ) +
4532 " seconds" )
4533
GlennRCfa69a2a2015-10-02 15:54:06 -07004534 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004535 utilities.assert_equals(
4536 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004537 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004538 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4539 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4540
GlennRCfa69a2a2015-10-02 15:54:06 -07004541 if not intentState:
4542 main.log.debug( "Intents failed to install completely" )
4543 if not pingResult:
4544 main.log.debug( "Pingall failed" )
4545 if not checkFlowsState:
4546 main.log.debug( "Flows failed to add completely" )
4547
4548 if not caseResult and main.failSwitch:
4549 main.log.report("Stopping test")
4550 main.stop( email=main.emailOnStop )
4551
Hari Krishna4223dbd2015-08-13 16:29:53 -07004552 def CASE190( self ):
4553 """
4554 Verify IPv6 ping across 600 Point intents (Att Topology)
4555 """
4556 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4557 main.log.report( "_________________________________________________" )
4558 import itertools
4559 import time
4560 main.case( "IPv6 ping all 600 Point intents" )
4561 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004562 pingResult = main.FALSE
4563 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004564 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004565 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004566 main.log.warn("First pingall failed. Retrying...")
4567 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004568 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004569 time2 = time.time()
4570 timeDiff = round( ( time2 - time1 ), 2 )
4571 main.log.report(
4572 "Time taken for IPv6 Ping All: " +
4573 str( timeDiff ) +
4574 " seconds" )
4575 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4576 onpass="PING ALL PASS",
4577 onfail="PING ALL FAIL" )
4578
GlennRCbddd58f2015-10-01 15:45:25 -07004579 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004580 utilities.assert_equals(
4581 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004582 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004583 onpass="IPv6 Ping across 600 Point intents test PASS",
4584 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4585
4586 def CASE191( self ):
4587 """
4588 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4589 """
4590 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4591 main.log.report( "_________________________________________________" )
4592 import itertools
4593 import time
4594 main.case( "IPv6 ping all 600 Point intents" )
4595 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004596 pingResult = main.FALSE
4597 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004598 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004599 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004600 main.log.warn("First pingall failed. Retrying...")
4601 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004602 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004603 time2 = time.time()
4604 timeDiff = round( ( time2 - time1 ), 2 )
4605 main.log.report(
4606 "Time taken for IPv6 Ping All: " +
4607 str( timeDiff ) +
4608 " seconds" )
4609 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4610 onpass="PING ALL PASS",
4611 onfail="PING ALL FAIL" )
4612
GlennRCbddd58f2015-10-01 15:45:25 -07004613 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004614 utilities.assert_equals(
4615 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004616 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004617 onpass="IPv6 Ping across 600 Point intents test PASS",
4618 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4619
4620 def CASE192( self ):
4621 """
4622 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4623 """
4624 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4625 main.log.report( "_________________________________________________" )
4626 import itertools
4627 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004628 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004629 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004630 pingResult = main.FALSE
4631 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004632 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004633 if not pingResult:
4634 main.log.warn("First pingall failed. Retrying...")
4635 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004636 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004637 time2 = time.time()
4638 timeDiff = round( ( time2 - time1 ), 2 )
4639 main.log.report(
4640 "Time taken for IPv6 Ping All: " +
4641 str( timeDiff ) +
4642 " seconds" )
4643 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4644 onpass="PING ALL PASS",
4645 onfail="PING ALL FAIL" )
4646
GlennRCbddd58f2015-10-01 15:45:25 -07004647 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004648 utilities.assert_equals(
4649 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004650 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004651 onpass="IPv6 Ping across 4556 Point intents test PASS",
4652 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004653
Hari Krishnac195f3b2015-07-08 20:02:24 -07004654 def CASE10( self ):
4655 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004656 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004657 """
4658 Remove all Intents
4659 """
4660 main.log.report( "Remove all intents that were installed previously" )
4661 main.log.report( "______________________________________________" )
4662 main.log.info( "Remove all intents" )
4663 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004664 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004665 main.step( "Obtain the intent id's first" )
4666 intentsList = main.ONOScli1.getAllIntentIds()
4667 ansi_escape = re.compile( r'\x1b[^m]*m' )
4668 intentsList = ansi_escape.sub( '', intentsList )
4669 intentsList = intentsList.replace(
4670 " onos:intents | grep id=",
4671 "" ).replace(
4672 "id=",
4673 "" ).replace(
4674 "\r\r",
4675 "" )
4676 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004677 intentIdList = []
4678 step1Result = main.TRUE
4679 moreIntents = main.TRUE
4680 removeIntentCount = 0
4681 intentsCount = len(intentsList)
4682 main.log.info ( "Current number of intents: " + str(intentsCount) )
4683 if ( len( intentsList ) > 1 ):
4684 results = main.TRUE
4685 main.log.info("Removing intent...")
4686 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004687 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004688 if removeIntentCount == 5:
4689 break
4690 removeIntentCount = removeIntentCount + 1
4691 intentsList1 = main.ONOScli1.getAllIntentIds()
4692 if len( intentsList1 ) == 0:
4693 break
4694 ansi_escape = re.compile( r'\x1b[^m]*m' )
4695 intentsList1 = ansi_escape.sub( '', intentsList1 )
4696 intentsList1 = intentsList1.replace(
4697 " onos:intents | grep id=",
4698 "" ).replace(
4699 " state=",
4700 "" ).replace(
4701 "\r\r",
4702 "" )
4703 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004704 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4705 print intentsList1
4706 intentIdList1 = []
4707 if ( len( intentsList1 ) > 0 ):
4708 moreIntents = main.TRUE
4709 for i in range( len( intentsList1 ) ):
4710 intentsTemp1 = intentsList1[ i ].split( ',' )
4711 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4712 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4713 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4714 time1 = time.time()
4715 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4716 pool = []
4717 for cli in main.CLIs:
4718 if i >= len( intentIdList1 ):
4719 break
4720 t = main.Thread( target=cli.removeIntent,
4721 threadID=main.threadID,
4722 name="removeIntent",
4723 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4724 pool.append(t)
4725 t.start()
4726 i = i + 1
4727 main.threadID = main.threadID + 1
4728 for thread in pool:
4729 thread.join()
4730 intentIdList.append(thread.result)
4731 #time.sleep(2)
4732 time2 = time.time()
4733 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004734 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004735 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004736 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004737 else:
4738 time.sleep(10)
4739 if len( main.ONOScli1.intents()):
4740 continue
4741 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004742 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004743 else:
4744 print "Removed %d intents" %(intentsCount)
4745 step1Result = main.TRUE
4746 else:
4747 print "No Intent IDs found in Intents list: ", intentsList
4748 step1Result = main.FALSE
4749
4750 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004751 caseResult = step1Result
4752 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004753 onpass="Intent removal test successful",
4754 onfail="Intent removal test failed" )
4755
4756 def CASE12( self, main ):
4757 """
4758 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4759 """
4760 import re
4761 import copy
4762 import time
4763
Hari Krishnac195f3b2015-07-08 20:02:24 -07004764 threadID = 0
4765
4766 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4767 main.log.report( "_____________________________________________________" )
4768 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4769 main.step( "Enable intent based Reactive forwarding" )
4770 installResult = main.FALSE
4771 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004772
Hari Krishnac195f3b2015-07-08 20:02:24 -07004773 pool = []
4774 time1 = time.time()
4775 for cli,feature in main.CLIs:
4776 t = main.Thread(target=cli,threadID=threadID,
4777 name="featureInstall",args=[feature])
4778 pool.append(t)
4779 t.start()
4780 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004781
Hari Krishnac195f3b2015-07-08 20:02:24 -07004782 results = []
4783 for thread in pool:
4784 thread.join()
4785 results.append(thread.result)
4786 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004787
Hari Krishnac195f3b2015-07-08 20:02:24 -07004788 if( all(result == main.TRUE for result in results) == False):
4789 main.log.info("Did not install onos-app-ifwd feature properly")
4790 #main.cleanup()
4791 #main.exit()
4792 else:
4793 main.log.info("Successful feature:install onos-app-ifwd")
4794 installResult = main.TRUE
4795 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004796
GlennRC6ac11b12015-10-21 17:41:28 -07004797 main.step( "Verify Ping across all hosts" )
4798 for i in range(main.numPings):
4799 time1 = time.time()
4800 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
4801 if not pingResult:
4802 main.log.warn("First pingall failed. Retrying...")
4803 time.sleep(main.pingSleep)
4804 else: break
4805
Hari Krishnac195f3b2015-07-08 20:02:24 -07004806 time2 = time.time()
4807 timeDiff = round( ( time2 - time1 ), 2 )
4808 main.log.report(
4809 "Time taken for Ping All: " +
4810 str( timeDiff ) +
4811 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004812
GlennRC626ba132015-09-18 16:16:31 -07004813 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004814 main.log.report( "Pingall Test in Reactive mode successful" )
4815 else:
4816 main.log.report( "Pingall Test in Reactive mode failed" )
4817
4818 main.step( "Disable Intent based Reactive forwarding" )
4819 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004820
Hari Krishnac195f3b2015-07-08 20:02:24 -07004821 pool = []
4822 time1 = time.time()
4823 for cli,feature in main.CLIs:
4824 t = main.Thread(target=cli,threadID=threadID,
4825 name="featureUninstall",args=[feature])
4826 pool.append(t)
4827 t.start()
4828 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004829
Hari Krishnac195f3b2015-07-08 20:02:24 -07004830 results = []
4831 for thread in pool:
4832 thread.join()
4833 results.append(thread.result)
4834 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004835
Hari Krishnac195f3b2015-07-08 20:02:24 -07004836 if( all(result == main.TRUE for result in results) == False):
4837 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4838 uninstallResult = main.FALSE
4839 #main.cleanup()
4840 #main.exit()
4841 else:
4842 main.log.info("Successful feature:uninstall onos-app-ifwd")
4843 uninstallResult = main.TRUE
4844 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4845
4846 # Waiting for reative flows to be cleared.
4847 time.sleep( 10 )
4848
GlennRCbddd58f2015-10-01 15:45:25 -07004849 caseResult = installResult and pingResult and uninstallResult
4850 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004851 onpass="Intent based Reactive forwarding Pingall test PASS",
4852 onfail="Intent based Reactive forwarding Pingall test FAIL" )