blob: d5b9400106918cbc9d6081f5bc8f8208a4f159f6 [file] [log] [blame]
pingping-lin763ee042015-05-20 17:45:30 -07001
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002import sys
3import os
4import re
5import time
6import json
7import itertools
8
kelvin8ec71442015-01-15 16:57:00 -08009
Hari Krishnaa43d4e92014-12-19 13:22:40 -080010class OnosCHO:
kelvin8ec71442015-01-15 16:57:00 -080011
kelvin-onlab8a832582015-01-16 17:06:11 -080012 def __init__( self ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -080013 self.default = ''
kelvin8ec71442015-01-15 16:57:00 -080014
kelvin-onlab8a832582015-01-16 17:06:11 -080015 def CASE1( self, main ):
16 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -080017 Startup sequence:
18 git pull
19 mvn clean install
20 onos-package
21 cell <name>
22 onos-verify-cell
23 onos-install -f
24 onos-wait-for-start
kelvin-onlab8a832582015-01-16 17:06:11 -080025 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -080026 import time
pingping-lin763ee042015-05-20 17:45:30 -070027
28 global intentState
29 main.threadID = 0
30 main.pingTimeout = 300
31 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
32 main.ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
33 main.ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
34 main.ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
35 main.ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
36 main.ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
37 main.ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
38 main.ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
39 main.ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
40 main.ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
41 main.ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
kelvin-onlab8a832582015-01-16 17:06:11 -080042 cell_name = main.params[ 'ENV' ][ 'cellName' ]
43 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
kelvin-onlab8a832582015-01-16 17:06:11 -080044 git_branch = main.params[ 'GIT' ][ 'branch' ]
pingping-lin763ee042015-05-20 17:45:30 -070045 main.newTopo = ""
46 main.CLIs = []
47 main.nodes = []
48 for i in range( 1, int(main.numCtrls) + 1 ):
49 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
50 main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
51
kelvin-onlab8a832582015-01-16 17:06:11 -080052 main.case( "Set up test environment" )
53 main.log.report( "Set up test environment" )
54 main.log.report( "_______________________" )
55
56 main.step( "Git checkout and pull " + git_branch )
Hari Krishnaa43d4e92014-12-19 13:22:40 -080057 if git_pull == 'on':
pingping-lin763ee042015-05-20 17:45:30 -070058 checkout_result = main.ONOSbench.gitCheckout( git_branch )
59 pull_result = main.ONOSbench.gitPull()
kelvin-onlab8a832582015-01-16 17:06:11 -080060 cp_result = ( checkout_result and pull_result )
Hari Krishnaa43d4e92014-12-19 13:22:40 -080061 else:
62 checkout_result = main.TRUE
63 pull_result = main.TRUE
kelvin-onlab8a832582015-01-16 17:06:11 -080064 main.log.info( "Skipped git checkout and pull" )
65 cp_result = ( checkout_result and pull_result )
66 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
67 onpass="Test step PASS",
68 onfail="Test step FAIL" )
69
70 main.step( "mvn clean & install" )
pingping-lin763ee042015-05-20 17:45:30 -070071 if git_pull == 'on':
72 mvn_result = main.ONOSbench.cleanInstall()
73 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
kelvin-onlab8a832582015-01-16 17:06:11 -080074 onpass="Test step PASS",
75 onfail="Test step FAIL" )
pingping-lin763ee042015-05-20 17:45:30 -070076 else:
77 mvn_result = main.TRUE
78 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
Hari Krishnaa43d4e92014-12-19 13:22:40 -080079
pingping-lin763ee042015-05-20 17:45:30 -070080 main.ONOSbench.getVersion( report=True )
Hari Krishnaa43d4e92014-12-19 13:22:40 -080081
kelvin-onlab8a832582015-01-16 17:06:11 -080082 main.step( "Apply Cell environment for ONOS" )
pingping-lin763ee042015-05-20 17:45:30 -070083 cell_result = main.ONOSbench.setCell( cell_name )
kelvin-onlab8a832582015-01-16 17:06:11 -080084 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
85 onpass="Test step PASS",
86 onfail="Test step FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -080087
kelvin-onlab8a832582015-01-16 17:06:11 -080088 main.step( "Create ONOS package" )
pingping-lin763ee042015-05-20 17:45:30 -070089 packageResult = main.ONOSbench.onosPackage()
kelvin-onlab8a832582015-01-16 17:06:11 -080090 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
91 onpass="Test step PASS",
92 onfail="Test step FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -080093
kelvin-onlab8a832582015-01-16 17:06:11 -080094 main.step( "Uninstall ONOS package on all Nodes" )
95 uninstallResult = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -070096 for i in range( 1, int( main.numCtrls ) + 1 ):
kelvin-onlab8a832582015-01-16 17:06:11 -080097 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
pingping-lin763ee042015-05-20 17:45:30 -070098 main.log.info( "Uninstalling package on ONOS Node IP: " + ONOS_ip )
99 u_result = main.ONOSbench.onosUninstall( ONOS_ip )
kelvin-onlab8a832582015-01-16 17:06:11 -0800100 utilities.assert_equals( expect=main.TRUE, actual=u_result,
101 onpass="Test step PASS",
102 onfail="Test step FAIL" )
103 uninstallResult = ( uninstallResult and u_result )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800104
pingping-lin763ee042015-05-20 17:45:30 -0700105 #main.step( "Removing copy-cat logs from ONOS nodes" )
106 #main.ONOSbench.onosRemoveRaftLogs()
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800107
kelvin-onlab8a832582015-01-16 17:06:11 -0800108 main.step( "Install ONOS package on all Nodes" )
109 installResult = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -0700110 for i in range( 1, int( main.numCtrls ) + 1 ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800111 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
112 main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip )
pingping-lin763ee042015-05-20 17:45:30 -0700113 i_result = main.ONOSbench.onosInstall( node=ONOS_ip )
kelvin-onlab8a832582015-01-16 17:06:11 -0800114 utilities.assert_equals( expect=main.TRUE, actual=i_result,
115 onpass="Test step PASS",
116 onfail="Test step FAIL" )
117 installResult = ( installResult and i_result )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800118
kelvin-onlab8a832582015-01-16 17:06:11 -0800119 main.step( "Verify ONOS nodes UP status" )
120 statusResult = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -0700121 for i in range( 1, int( main.numCtrls ) + 1 ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800122 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
123 main.log.info( "ONOS Node " + ONOS_ip + " status:" )
pingping-lin763ee042015-05-20 17:45:30 -0700124 onos_status = main.ONOSbench.onosStatus( node=ONOS_ip )
kelvin-onlab8a832582015-01-16 17:06:11 -0800125 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
126 onpass="Test step PASS",
127 onfail="Test step FAIL" )
128 statusResult = ( statusResult and onos_status )
pingping-lin763ee042015-05-20 17:45:30 -0700129
kelvin-onlab8a832582015-01-16 17:06:11 -0800130 main.step( "Start ONOS CLI on all nodes" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800131 cliResult = main.TRUE
kelvin8ec71442015-01-15 16:57:00 -0800132 karafTimeout = "3600000"
kelvin-onlab8a832582015-01-16 17:06:11 -0800133 # need to wait here for sometime. This will be removed once ONOS is
134 # stable enough
pingping-lin763ee042015-05-20 17:45:30 -0700135 time.sleep( 25 )
136 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.nodes[i].ip_address, 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()
152
153 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
160 case1Result = installResult and uninstallResult and statusResult and startCliResult
161
162 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
kelvin-onlab8a832582015-01-16 17:06:11 -0800163 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
164 onpass="Set up test environment PASS",
165 onfail="Set up test environment FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800166
pingping-lin763ee042015-05-20 17:45:30 -0700167 def CASE20( self, main ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800168 """
pingping-lin763ee042015-05-20 17:45:30 -0700169 This test script Loads a new Topology (Att) on CHO setup and balances all switches
kelvin-onlab8a832582015-01-16 17:06:11 -0800170 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800171 import re
172 import time
173 import copy
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800174
pingping-lin763ee042015-05-20 17:45:30 -0700175 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
176 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
177 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
178 main.pingTimeout = 60
kelvin-onlab8a832582015-01-16 17:06:11 -0800179 main.log.report(
pingping-lin763ee042015-05-20 17:45:30 -0700180 "Load Att topology and Balance all Mininet switches across controllers" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800181 main.log.report(
pingping-lin763ee042015-05-20 17:45:30 -0700182 "________________________________________________________________________" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800183 main.case(
184 "Assign and Balance all Mininet switches across controllers" )
pingping-lin763ee042015-05-20 17:45:30 -0700185 main.step( "Stop any previous Mininet network topology" )
186 cliResult = main.TRUE
187 if main.newTopo == main.params['TOPO3']['topo']:
188 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
189
190 main.step( "Start Mininet with Att topology" )
191 main.newTopo = main.params['TOPO1']['topo']
192 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
193
kelvin-onlab8a832582015-01-16 17:06:11 -0800194 main.step( "Assign switches to controllers" )
pingping-lin763ee042015-05-20 17:45:30 -0700195 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
196 main.Mininet1.assignSwController(
kelvin-onlab8a832582015-01-16 17:06:11 -0800197 sw=str( i ),
pingping-lin763ee042015-05-20 17:45:30 -0700198 count= 1 ,
199 ip1=main.ONOS1_ip,
200 port1=main.ONOS1_port,
201 ip2=main.ONOS2_ip,
202 port2=main.ONOS2_port,
203 ip3=main.ONOS3_ip,
204 port3=main.ONOS3_port,
205 ip4=main.ONOS4_ip,
206 port4=main.ONOS4_port,
207 ip5=main.ONOS5_ip,
208 port5=main.ONOS5_port )
209 time.sleep(2)
210 switch_mastership = main.TRUE
211 for i in range( 1, ( main.numMNswitches + 1 ) ):
212 response = main.Mininet1.getSwController( "s" + str( i ) )
213 print( "Response is " + str( response ) )
214 if re.search( "tcp:" + main.ONOS1_ip, response ):
215 switch_mastership = switch_mastership and main.TRUE
216 else:
217 switch_mastership = main.FALSE
218
219 if switch_mastership == main.TRUE:
220 main.log.report( "Controller assignment successfull" )
221 else:
222 main.log.report( "Controller assignment failed" )
223
224 """topoFailed = main.FALSE
225 checkCount = 0
226 while(topoFailed == main.FALSE):
227 topology_output = main.ONOScli1.topology()
228 topology_result = main.ONOSbench.getTopology( topology_output )
229 numOnosDevices = topology_result[ 'deviceCount' ]
230 numOnosLinks = topology_result[ 'linkCount' ]
231 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
232 main.log.info("Att topology is now ready!")
233 break
234 else:
235 main.log.info("Att topology is not ready yet!")
236 checkCount = checkCount + 1
237 time.sleep(2)
238 if checkCount == 10:
239 topoFailed = main.TRUE
240 if topoFailed:
241 main.log.info("Att topology failed to start correctly")
242 """
243 time.sleep(15)
244 #Don't balance master for now..
245 """main.step( "Balance devices across controllers" )
246 for i in range( int( main.numCtrls ) ):
247 balanceResult = main.ONOScli1.balanceMasters()
248 # giving some breathing time for ONOS to complete re-balance
249 time.sleep( 3 )
250 topology_output = main.ONOScli1.topology()
251 topology_result = main.ONOSbench.getTopology( topology_output )
252 """
253 case2Result = ( switch_mastership and startStatus )
254 utilities.assert_equals(
255 expect=main.TRUE,
256 actual=case2Result,
257 onpass="Starting new Att topology test PASS",
258 onfail="Starting new Att topology test FAIL" )
259
260 def CASE21( self, main ):
261 """
262 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
263 """
264 import re
265 import time
266 import copy
267
268 main.newTopo = main.params['TOPO2']['topo']
269 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
270 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
271 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
272 main.pingTimeout = 120
273 main.log.report(
274 "Load Chordal topology and Balance all Mininet switches across controllers" )
275 main.log.report(
276 "________________________________________________________________________" )
277 main.case(
278 "Assign and Balance all Mininet switches across controllers" )
279 main.step( "Stop any previous Mininet network topology" )
280 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
281 #time.sleep(10)
282 main.step( "Start Mininet with Chordal topology" )
283 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
284 time.sleep(15)
285 main.step( "Assign switches to controllers" )
286 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
287 main.Mininet1.assignSwController(
288 sw=str( i ),
289 count=int( main.numCtrls ),
290 ip1=main.ONOS1_ip,
291 port1=main.ONOS1_port,
292 ip2=main.ONOS2_ip,
293 port2=main.ONOS2_port,
294 ip3=main.ONOS3_ip,
295 port3=main.ONOS3_port,
296 ip4=main.ONOS4_ip,
297 port4=main.ONOS4_port,
298 ip5=main.ONOS5_ip,
299 port5=main.ONOS5_port )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800300
301 switch_mastership = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -0700302 for i in range( 1, ( main.numMNswitches + 1 ) ):
303 response = main.Mininet1.getSwController( "s" + str( i ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800304 print( "Response is " + str( response ) )
pingping-lin763ee042015-05-20 17:45:30 -0700305 if re.search( "tcp:" + main.ONOS1_ip, response ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800306 switch_mastership = switch_mastership and main.TRUE
307 else:
308 switch_mastership = main.FALSE
309
310 if switch_mastership == main.TRUE:
kelvin-onlab8a832582015-01-16 17:06:11 -0800311 main.log.report( "Controller assignment successfull" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800312 else:
kelvin-onlab8a832582015-01-16 17:06:11 -0800313 main.log.report( "Controller assignment failed" )
314 time.sleep( 5 )
pingping-lin763ee042015-05-20 17:45:30 -0700315
316 #Don't balance master for now..
317 """
kelvin-onlab8a832582015-01-16 17:06:11 -0800318 main.step( "Balance devices across controllers" )
pingping-lin763ee042015-05-20 17:45:30 -0700319 for i in range( int( main.numCtrls ) ):
320 balanceResult = main.ONOScli1.balanceMasters()
321 # giving some breathing time for ONOS to complete re-balance
322 time.sleep( 3 )
323 """
324 case21Result = switch_mastership
325 time.sleep(30)
326 utilities.assert_equals(
327 expect=main.TRUE,
328 actual=case21Result,
329 onpass="Starting new Chordal topology test PASS",
330 onfail="Starting new Chordal topology test FAIL" )
331
332 def CASE22( self, main ):
333 """
334 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
335 """
336 import re
337 import time
338 import copy
339
340 main.newTopo = main.params['TOPO3']['topo']
341 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
342 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
343 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
344 main.pingTimeout = 400
345
346 main.log.report(
347 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
348 main.log.report(
349 "________________________________________________________________________" )
350 # need to wait here for sometime until ONOS bootup
351 main.case(
352 "Assign and Balance all Mininet switches across controllers" )
353 main.step( "Stop any previous Mininet network topology" )
354 #stopStatus = main.Mininet1.stopNet(fileName = "topoSpine" )
355 main.step( "Start Mininet with Spine topology" )
356 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
357 time.sleep(20)
358 main.step( "Assign switches to controllers" )
359 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
360 main.Mininet1.assignSwController(
361 sw=str( i ),
362 count= 1,
363 ip1=main.ONOS1_ip,
364 port1=main.ONOS1_port,
365 ip2=main.ONOS2_ip,
366 port2=main.ONOS2_port,
367 ip3=main.ONOS3_ip,
368 port3=main.ONOS3_port,
369 ip4=main.ONOS4_ip,
370 port4=main.ONOS4_port,
371 ip5=main.ONOS5_ip,
372 port5=main.ONOS5_port )
373
374 switch_mastership = main.TRUE
375 for i in range( 1, ( main.numMNswitches + 1 ) ):
376 response = main.Mininet1.getSwController( "s" + str( i ) )
377 print( "Response is " + str( response ) )
378 if re.search( "tcp:" + main.ONOS1_ip, response ):
379 switch_mastership = switch_mastership and main.TRUE
380 else:
381 switch_mastership = main.FALSE
382
383 if switch_mastership == main.TRUE:
384 main.log.report( "Controller assignment successfull" )
385 else:
386 main.log.report( "Controller assignment failed" )
387 time.sleep( 5 )
388 """
389 main.step( "Balance devices across controllers" )
390
391 for i in range( int( main.numCtrls ) ):
392 balanceResult = main.ONOScli1.balanceMasters()
kelvin-onlab8a832582015-01-16 17:06:11 -0800393 # giving some breathing time for ONOS to complete re-balance
394 time.sleep( 3 )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800395
pingping-lin763ee042015-05-20 17:45:30 -0700396 main.step( "Balance devices across controllers" )
397 for i in range( int( main.numCtrls ) ):
398 balanceResult = main.ONOScli1.balanceMasters()
399 # giving some breathing time for ONOS to complete re-balance
400 time.sleep( 3 )
401 """
402 case22Result = switch_mastership
403 time.sleep(30)
kelvin-onlab8a832582015-01-16 17:06:11 -0800404 utilities.assert_equals(
405 expect=main.TRUE,
pingping-lin763ee042015-05-20 17:45:30 -0700406 actual=case22Result,
407 onpass="Starting new Spine topology test PASS",
408 onfail="Starting new Spine topology test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800409
kelvin-onlab8a832582015-01-16 17:06:11 -0800410 def CASE3( self, main ):
411 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800412 This Test case will be extended to collect and store more data related
413 ONOS state.
kelvin-onlab8a832582015-01-16 17:06:11 -0800414 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800415 import re
416 import copy
pingping-lin763ee042015-05-20 17:45:30 -0700417 main.deviceDPIDs = []
418 main.hostMACs = []
419 main.deviceLinks = []
420 main.deviceActiveLinksCount = []
421 main.devicePortsEnabledCount = []
422
kelvin-onlab8a832582015-01-16 17:06:11 -0800423 main.log.report(
424 "Collect and Store topology details from ONOS before running any Tests" )
425 main.log.report(
426 "____________________________________________________________________" )
pingping-lin763ee042015-05-20 17:45:30 -0700427 main.case( "Collect and Store Topology Details from ONOS" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800428 main.step( "Collect and store current number of switches and links" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800429 topology_output = main.ONOScli1.topology()
pingping-lin763ee042015-05-20 17:45:30 -0700430 topology_result = main.ONOSbench.getTopology( topology_output )
431 numOnosDevices = topology_result[ 'deviceCount' ]
432 numOnosLinks = topology_result[ 'linkCount' ]
433 topoResult = main.TRUE
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800434
pingping-lin763ee042015-05-20 17:45:30 -0700435 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
436 main.step( "Store Device DPIDs" )
437 for i in range( 1, (main.numMNswitches+1) ):
438 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
439 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800440
pingping-lin763ee042015-05-20 17:45:30 -0700441 main.step( "Store Host MACs" )
442 for i in range( 1, ( main.numMNhosts + 1 ) ):
443 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
444 print "Host MACs in Store: \n", str( main.hostMACs )
445 main.MACsDict = {}
446 print "Creating dictionary of DPID and HostMacs"
447 for i in range(len(main.hostMACs)):
448 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
449 print main.MACsDict
450 main.step( "Collect and store all Devices Links" )
451 linksResult = main.ONOScli1.links( jsonFormat=False )
452 ansi_escape = re.compile( r'\x1b[^m]*m' )
453 linksResult = ansi_escape.sub( '', linksResult )
454 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
455 linksResult = linksResult.splitlines()
456 linksResult = linksResult[ 1: ]
457 main.deviceLinks = copy.copy( linksResult )
458 print "Device Links Stored: \n", str( main.deviceLinks )
459 # this will be asserted to check with the params provided count of
460 # links
461 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800462
pingping-lin763ee042015-05-20 17:45:30 -0700463 main.step( "Collect and store each Device ports enabled Count" )
464 time1 = time.time()
465 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
466 pool = []
467 for cli in main.CLIs:
468 if i >= main.numMNswitches + 1:
469 break
470 dpid = "of:00000000000000" + format( i,'02x' )
471 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
472 t.start()
473 pool.append(t)
474 i = i + 1
475 main.threadID = main.threadID + 1
476 for thread in pool:
477 thread.join()
478 portResult = thread.result
479 portTemp = re.split( r'\t+', portResult )
480 portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
481 main.devicePortsEnabledCount.append( portCount )
482 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
483 time2 = time.time()
484 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800485
pingping-lin763ee042015-05-20 17:45:30 -0700486 main.step( "Collect and store each Device active links Count" )
487 time1 = time.time()
488
489 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
490 pool = []
491 for cli in main.CLIs:
492 if i >= main.numMNswitches + 1:
493 break
494 dpid = "of:00000000000000" + format( i,'02x' )
495 t = main.Thread( target = cli.getDeviceLinksActiveCount,
496 threadID = main.threadID,
497 name = "getDevicePortsEnabledCount",
498 args = [dpid])
499 t.start()
500 pool.append(t)
501 i = i + 1
502 main.threadID = main.threadID + 1
503 for thread in pool:
504 thread.join()
505 linkCountResult = thread.result
506 linkCountTemp = re.split( r'\t+', linkCountResult )
507 linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
508 main.deviceActiveLinksCount.append( linkCount )
509 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
510 time2 = time.time()
511 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800512
pingping-lin763ee042015-05-20 17:45:30 -0700513 else:
514 main.log.info("Devices (expected): %s, Links (expected): %s" %
515 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
516 main.log.info("Devices (actual): %s, Links (actual): %s" %
517 ( numOnosDevices , numOnosLinks ) )
518 main.log.info("Topology does not match, exiting CHO test...")
519 topoResult = main.FALSE
520
521 #time.sleep(300)
522 #main.cleanup()
523 #main.exit()
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800524
kelvin-onlab8a832582015-01-16 17:06:11 -0800525 # just returning TRUE for now as this one just collects data
pingping-lin763ee042015-05-20 17:45:30 -0700526 case3Result = topoResult
527 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800528 onpass="Saving ONOS topology data test PASS",
529 onfail="Saving ONOS topology data test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800530
pingping-lin763ee042015-05-20 17:45:30 -0700531 def CASE40( self, main ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800532 """
pingping-lin763ee042015-05-20 17:45:30 -0700533 Verify Reactive forwarding (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -0800534 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800535 import re
536 import copy
537 import time
pingping-lin763ee042015-05-20 17:45:30 -0700538 main.log.report( "Verify Reactive forwarding (Att Topology)" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800539 main.log.report( "______________________________________________" )
540 main.case( "Enable Reactive forwarding and Verify ping all" )
541 main.step( "Enable Reactive forwarding" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800542 installResult = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -0700543 # Activate fwd app
544 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
545 appCheck = main.TRUE
546 pool = []
547 for cli in main.CLIs:
548 t = main.Thread( target=cli.appToIDCheck,
549 name="appToIDCheck-" + str( i ),
550 args=[] )
551 pool.append( t )
552 t.start()
553 for t in pool:
554 t.join()
555 appCheck = appCheck and t.result
556 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
557 onpass="App Ids seem to be correct",
558 onfail="Something is wrong with app Ids" )
559 if appCheck != main.TRUE:
560 main.log.warn( main.CLIs[0].apps() )
561 main.log.warn( main.CLIs[0].appIDs() )
562
563 time.sleep( 10 )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800564
kelvin-onlab8a832582015-01-16 17:06:11 -0800565 main.step( "Verify Pingall" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800566 ping_result = main.FALSE
567 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -0700568 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800569 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800570 timeDiff = round( ( time2 - time1 ), 2 )
571 main.log.report(
572 "Time taken for Ping All: " +
573 str( timeDiff ) +
574 " seconds" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800575
576 if ping_result == main.TRUE:
kelvin-onlab8a832582015-01-16 17:06:11 -0800577 main.log.report( "Pingall Test in Reactive mode successful" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800578 else:
kelvin-onlab8a832582015-01-16 17:06:11 -0800579 main.log.report( "Pingall Test in Reactive mode failed" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800580
kelvin-onlab8a832582015-01-16 17:06:11 -0800581 main.step( "Disable Reactive forwarding" )
pingping-lin763ee042015-05-20 17:45:30 -0700582
583 main.log.info( "Uninstall reactive forwarding app" )
584 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
585 pool = []
586 for cli in main.CLIs:
587 t = main.Thread( target=cli.appToIDCheck,
588 name="appToIDCheck-" + str( i ),
589 args=[] )
590 pool.append( t )
591 t.start()
592
593 for t in pool:
594 t.join()
595 appCheck = appCheck and t.result
596 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
597 onpass="App Ids seem to be correct",
598 onfail="Something is wrong with app Ids" )
599 if appCheck != main.TRUE:
600 main.log.warn( main.CLIs[0].apps() )
601 main.log.warn( main.CLIs[0].appIDs() )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800602
kelvin-onlab8a832582015-01-16 17:06:11 -0800603 # Waiting for reative flows to be cleared.
604 time.sleep( 10 )
pingping-lin763ee042015-05-20 17:45:30 -0700605 case40Result = installResult and uninstallResult and ping_result
606 utilities.assert_equals( expect=main.TRUE, actual=case40Result,
607 onpass="Reactive Mode Pingall test PASS",
608 onfail="Reactive Mode Pingall test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800609
pingping-lin763ee042015-05-20 17:45:30 -0700610 def CASE41( self, main ):
611 """
612 Verify Reactive forwarding (Chordal Topology)
613 """
614 import re
615 import copy
616 import time
617 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
618 main.log.report( "______________________________________________" )
619 main.case( "Enable Reactive forwarding and Verify ping all" )
620 main.step( "Enable Reactive forwarding" )
621 installResult = main.TRUE
622 # Activate fwd app
623 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
624
625 appCheck = main.TRUE
626 pool = []
627 for cli in main.CLIs:
628 t = main.Thread( target=cli.appToIDCheck,
629 name="appToIDCheck-" + str( i ),
630 args=[] )
631 pool.append( t )
632 t.start()
633 for t in pool:
634 t.join()
635 appCheck = appCheck and t.result
636 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
637 onpass="App Ids seem to be correct",
638 onfail="Something is wrong with app Ids" )
639 if appCheck != main.TRUE:
640 main.log.warn( main.CLIs[0].apps() )
641 main.log.warn( main.CLIs[0].appIDs() )
642
643 time.sleep( 10 )
644
645 main.step( "Verify Pingall" )
646 ping_result = main.FALSE
647 time1 = time.time()
648 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
649 time2 = time.time()
650 timeDiff = round( ( time2 - time1 ), 2 )
651 main.log.report(
652 "Time taken for Ping All: " +
653 str( timeDiff ) +
654 " seconds" )
655
656 if ping_result == main.TRUE:
657 main.log.report( "Pingall Test in Reactive mode successful" )
658 else:
659 main.log.report( "Pingall Test in Reactive mode failed" )
660
661 main.step( "Disable Reactive forwarding" )
662
663 main.log.info( "Uninstall reactive forwarding app" )
664 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
665 pool = []
666 for cli in main.CLIs:
667 t = main.Thread( target=cli.appToIDCheck,
668 name="appToIDCheck-" + str( i ),
669 args=[] )
670 pool.append( t )
671 t.start()
672
673 for t in pool:
674 t.join()
675 appCheck = appCheck and t.result
676 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
677 onpass="App Ids seem to be correct",
678 onfail="Something is wrong with app Ids" )
679 if appCheck != main.TRUE:
680 main.log.warn( main.CLIs[0].apps() )
681 main.log.warn( main.CLIs[0].appIDs() )
682
683 # Waiting for reative flows to be cleared.
684 time.sleep( 10 )
685 case41Result = installResult and uninstallResult and ping_result
686 utilities.assert_equals( expect=main.TRUE, actual=case41Result,
687 onpass="Reactive Mode Pingall test PASS",
688 onfail="Reactive Mode Pingall test FAIL" )
689
690 def CASE42( self, main ):
691 """
692 Verify Reactive forwarding (Spine Topology)
693 """
694 import re
695 import copy
696 import time
697 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
698 main.log.report( "______________________________________________" )
699 main.case( "Enable Reactive forwarding and Verify ping all" )
700 main.step( "Enable Reactive forwarding" )
701 installResult = main.TRUE
702 # Activate fwd app
703 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
704
705 appCheck = main.TRUE
706 pool = []
707 for cli in main.CLIs:
708 t = main.Thread( target=cli.appToIDCheck,
709 name="appToIDCheck-" + str( i ),
710 args=[] )
711 pool.append( t )
712 t.start()
713 for t in pool:
714 t.join()
715 appCheck = appCheck and t.result
716 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
717 onpass="App Ids seem to be correct",
718 onfail="Something is wrong with app Ids" )
719 if appCheck != main.TRUE:
720 main.log.warn( main.CLIs[0].apps() )
721 main.log.warn( main.CLIs[0].appIDs() )
722
723 time.sleep( 10 )
724
725 main.step( "Verify Pingall" )
726 ping_result = main.FALSE
727 time1 = time.time()
728 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
729 time2 = time.time()
730 timeDiff = round( ( time2 - time1 ), 2 )
731 main.log.report(
732 "Time taken for Ping All: " +
733 str( timeDiff ) +
734 " seconds" )
735
736 if ping_result == main.TRUE:
737 main.log.report( "Pingall Test in Reactive mode successful" )
738 else:
739 main.log.report( "Pingall Test in Reactive mode failed" )
740
741 main.step( "Disable Reactive forwarding" )
742
743 main.log.info( "Uninstall reactive forwarding app" )
744 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
745 pool = []
746 for cli in main.CLIs:
747 t = main.Thread( target=cli.appToIDCheck,
748 name="appToIDCheck-" + str( i ),
749 args=[] )
750 pool.append( t )
751 t.start()
752
753 for t in pool:
754 t.join()
755 appCheck = appCheck and t.result
756 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
757 onpass="App Ids seem to be correct",
758 onfail="Something is wrong with app Ids" )
759 if appCheck != main.TRUE:
760 main.log.warn( main.CLIs[0].apps() )
761 main.log.warn( main.CLIs[0].appIDs() )
762
763 # Waiting for reative flows to be cleared.
764 time.sleep( 10 )
765 case42Result = installResult and uninstallResult and ping_result
766 utilities.assert_equals( expect=main.TRUE, actual=case42Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800767 onpass="Reactive Mode Pingall test PASS",
768 onfail="Reactive Mode Pingall test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800769
kelvin-onlab8a832582015-01-16 17:06:11 -0800770 def CASE5( self, main ):
771 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800772 Compare current ONOS topology with reference data
kelvin-onlab8a832582015-01-16 17:06:11 -0800773 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800774 import re
pingping-lin763ee042015-05-20 17:45:30 -0700775
776 devicesDPIDTemp = []
777 hostMACsTemp = []
778 deviceLinksTemp = []
779 deviceActiveLinksCountTemp = []
780 devicePortsEnabledCountTemp = []
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800781
kelvin-onlab8a832582015-01-16 17:06:11 -0800782 main.log.report(
783 "Compare ONOS topology with reference data in Stores" )
784 main.log.report( "__________________________________________________" )
785 main.case( "Compare ONOS topology with reference data" )
786
787 main.step( "Compare current Device ports enabled with reference" )
pingping-lin763ee042015-05-20 17:45:30 -0700788 time1 = time.time()
789 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
790 pool = []
791 for cli in main.CLIs:
792 if i >= main.numMNswitches + 1:
793 break
794 dpid = "of:00000000000000" + format( i,'02x' )
795 t = main.Thread(target = cli.getDevicePortsEnabledCount,
796 threadID = main.threadID,
797 name = "getDevicePortsEnabledCount",
798 args = [dpid])
799 t.start()
800 pool.append(t)
801 i = i + 1
802 main.threadID = main.threadID + 1
803 for thread in pool:
804 thread.join()
805 portResult = thread.result
806 portTemp = re.split( r'\t+', portResult )
807 portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
808 devicePortsEnabledCountTemp.append( portCount )
809 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
810 time2 = time.time()
811 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
812 main.log.info (
813 "Device Enabled ports EXPECTED: %s" %
814 str( main.devicePortsEnabledCount ) )
815 main.log.info (
816 "Device Enabled ports ACTUAL: %s" %
817 str( devicePortsEnabledCountTemp ) )
818
819 if ( cmp( main.devicePortsEnabledCount,
820 devicePortsEnabledCountTemp ) == 0 ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800821 stepResult1 = main.TRUE
822 else:
823 stepResult1 = main.FALSE
824
kelvin-onlab8a832582015-01-16 17:06:11 -0800825 main.step( "Compare Device active links with reference" )
pingping-lin763ee042015-05-20 17:45:30 -0700826 time1 = time.time()
827 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
828 pool = []
829 for cli in main.CLIs:
830 dpid = "of:00000000000000" + format( i,'02x' )
831 t = main.Thread(target = cli.getDeviceLinksActiveCount,
832 threadID = main.threadID,
833 name = "getDevicePortsEnabledCount",
834 args = [dpid])
835 t.start()
836 pool.append(t)
837 i = i + 1
838 main.threadID = main.threadID + 1
839 for thread in pool:
840 thread.join()
841 linkCountResult = thread.result
842 linkCountTemp = re.split( r'\t+', linkCountResult )
843 linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
844 deviceActiveLinksCountTemp.append( linkCount )
845 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
846 time2 = time.time()
847 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
848 main.log.info (
849 "Device Active links EXPECTED: %s" %
850 str( main.deviceActiveLinksCount ) )
851 main.log.info (
852 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
853 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800854 stepResult2 = main.TRUE
855 else:
856 stepResult2 = main.FALSE
857
kelvin-onlab8a832582015-01-16 17:06:11 -0800858 """
pingping-lin763ee042015-05-20 17:45:30 -0700859 place holder for comparing devices, hosts, paths and intents if required.
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800860 Links and ports data would be incorrect with out devices anyways.
kelvin-onlab8a832582015-01-16 17:06:11 -0800861 """
pingping-lin763ee042015-05-20 17:45:30 -0700862 case5Result = ( stepResult1 and stepResult2 )
863 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800864 onpass="Compare Topology test PASS",
865 onfail="Compare Topology test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800866
pingping-lin763ee042015-05-20 17:45:30 -0700867 def CASE60( self ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800868 """
pingping-lin763ee042015-05-20 17:45:30 -0700869 Install 300 host intents and verify ping all (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -0800870 """
pingping-lin763ee042015-05-20 17:45:30 -0700871 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800872 main.log.report( "_______________________________________" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800873 import itertools
pingping-lin763ee042015-05-20 17:45:30 -0700874 import time
kelvin-onlab8a832582015-01-16 17:06:11 -0800875 main.case( "Install 300 host intents" )
876 main.step( "Add host Intents" )
877 intentResult = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -0700878 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
879
880 intentIdList = []
881 time1 = time.time()
882 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
883 pool = []
884 for cli in main.CLIs:
885 if i >= len( hostCombos ):
886 break
887 t = main.Thread( target=cli.addHostIntent,
888 threadID=main.threadID,
889 name="addHostIntent",
890 args=[hostCombos[i][0],hostCombos[i][1]])
891 pool.append(t)
892 t.start()
893 i = i + 1
894 main.threadID = main.threadID + 1
895 for thread in pool:
896 thread.join()
897 intentIdList.append(thread.result)
898 time2 = time.time()
899 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
900
901 intentResult = main.TRUE
902 intentsJson = main.ONOScli2.intents()
903 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
904 intentsJson = intentsJson)
905 print "len of intent ID", str(len(intentIdList))
906 print "len of intent state results", str(len(getIntentStateResult))
907 print getIntentStateResult
908 # Takes awhile for all the onos to get the intents
909 time.sleep( 15 )
910 """intentState = main.TRUE
911 for i in getIntentStateResult:
912 if getIntentStateResult.get( 'state' ) != 'INSTALLED':
913 """
914
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800915
kelvin-onlab8a832582015-01-16 17:06:11 -0800916 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800917 pingResult = main.FALSE
918 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -0700919 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800920 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800921 timeDiff = round( ( time2 - time1 ), 2 )
922 main.log.report(
923 "Time taken for Ping All: " +
924 str( timeDiff ) +
925 " seconds" )
926 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
927 onpass="PING ALL PASS",
928 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800929
pingping-lin763ee042015-05-20 17:45:30 -0700930 case60Result = ( intentResult and pingResult )
931
kelvin-onlab8a832582015-01-16 17:06:11 -0800932 utilities.assert_equals(
933 expect=main.TRUE,
pingping-lin763ee042015-05-20 17:45:30 -0700934 actual=case60Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800935 onpass="Install 300 Host Intents and Ping All test PASS",
936 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800937
pingping-lin763ee042015-05-20 17:45:30 -0700938 def CASE61( self ):
939 """
940 Install 600 host intents and verify ping all for Chordal Topology
941 """
942 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
943 main.log.report( "_______________________________________" )
944 import itertools
945
946 main.case( "Install 600 host intents" )
947 main.step( "Add host Intents" )
948 intentResult = main.TRUE
949 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
950
951 intentIdList = []
952 time1 = time.time()
953
954 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
955 pool = []
956 for cli in main.CLIs:
957 if i >= len( hostCombos ):
958 break
959 t = main.Thread( target=cli.addHostIntent,
960 threadID=main.threadID,
961 name="addHostIntent",
962 args=[hostCombos[i][0],hostCombos[i][1]])
963 pool.append(t)
964 t.start()
965 i = i + 1
966 main.threadID = main.threadID + 1
967 for thread in pool:
968 thread.join()
969 intentIdList.append(thread.result)
970 time2 = time.time()
971 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
972 intentResult = main.TRUE
973 intentsJson = main.ONOScli2.intents()
974 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
975 intentsJson = intentsJson)
976 print getIntentStateResult
977
978 main.step( "Verify Ping across all hosts" )
979 pingResult = main.FALSE
980 time1 = time.time()
981 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
982 time2 = time.time()
983 timeDiff = round( ( time2 - time1 ), 2 )
984 main.log.report(
985 "Time taken for Ping All: " +
986 str( timeDiff ) +
987 " seconds" )
988 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
989 onpass="PING ALL PASS",
990 onfail="PING ALL FAIL" )
991
992 case14Result = ( intentResult and pingResult )
993
994 utilities.assert_equals(
995 expect=main.TRUE,
996 actual=case14Result,
997 onpass="Install 300 Host Intents and Ping All test PASS",
998 onfail="Install 300 Host Intents and Ping All test FAIL" )
999
1000 def CASE62( self ):
1001 """
1002 Install 2278 host intents and verify ping all for Spine Topology
1003 """
1004 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1005 main.log.report( "_______________________________________" )
1006 import itertools
1007
1008 main.case( "Install 2278 host intents" )
1009 main.step( "Add host Intents" )
1010 intentResult = main.TRUE
1011 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1012 main.pingTimeout = 300
1013 intentIdList = []
1014 time1 = time.time()
1015 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1016 pool = []
1017 for cli in main.CLIs:
1018 if i >= len( hostCombos ):
1019 break
1020 t = main.Thread( target=cli.addHostIntent,
1021 threadID=main.threadID,
1022 name="addHostIntent",
1023 args=[hostCombos[i][0],hostCombos[i][1]])
1024 pool.append(t)
1025 t.start()
1026 i = i + 1
1027 main.threadID = main.threadID + 1
1028 for thread in pool:
1029 thread.join()
1030 intentIdList.append(thread.result)
1031 time2 = time.time()
1032 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
1033 intentResult = main.TRUE
1034 intentsJson = main.ONOScli2.intents()
1035 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1036 intentsJson = intentsJson)
1037 print getIntentStateResult
1038
1039 main.step( "Verify Ping across all hosts" )
1040 pingResult = main.FALSE
1041 time1 = time.time()
1042 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1043 time2 = time.time()
1044 timeDiff = round( ( time2 - time1 ), 2 )
1045 main.log.report(
1046 "Time taken for Ping All: " +
1047 str( timeDiff ) +
1048 " seconds" )
1049 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1050 onpass="PING ALL PASS",
1051 onfail="PING ALL FAIL" )
1052
1053 case15Result = ( intentResult and pingResult )
1054
1055 utilities.assert_equals(
1056 expect=main.TRUE,
1057 actual=case15Result,
1058 onpass="Install 2278 Host Intents and Ping All test PASS",
1059 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1060
kelvin-onlab8a832582015-01-16 17:06:11 -08001061 def CASE70( self, main ):
1062 """
pingping-lin763ee042015-05-20 17:45:30 -07001063 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
kelvin-onlab8a832582015-01-16 17:06:11 -08001064 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001065 import random
pingping-lin763ee042015-05-20 17:45:30 -07001066 main.randomLink1 = []
1067 main.randomLink2 = []
1068 main.randomLink3 = []
1069 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1070 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1071 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1072 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1073 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1074 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1075 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
kelvin-onlab8a832582015-01-16 17:06:11 -08001076 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001077
pingping-lin763ee042015-05-20 17:45:30 -07001078 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1079 main.log.report( "___________________________________________________________________________" )
1080 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1081 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001082 if ( int( switchLinksToToggle ) ==
1083 0 or int( switchLinksToToggle ) > 5 ):
pingping-lin763ee042015-05-20 17:45:30 -07001084 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1085 #main.cleanup()
1086 #main.exit()
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001087 else:
pingping-lin763ee042015-05-20 17:45:30 -07001088 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001089
kelvin-onlab8a832582015-01-16 17:06:11 -08001090 main.step( "Cut links on Core devices using user provided range" )
pingping-lin763ee042015-05-20 17:45:30 -07001091 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1092 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1093 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001094 for i in range( int( switchLinksToToggle ) ):
1095 main.Mininet1.link(
1096 END1=link1End1,
pingping-lin763ee042015-05-20 17:45:30 -07001097 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001098 OPTION="down" )
1099 main.Mininet1.link(
1100 END1=link2End1,
pingping-lin763ee042015-05-20 17:45:30 -07001101 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001102 OPTION="down" )
1103 main.Mininet1.link(
1104 END1=link3End1,
pingping-lin763ee042015-05-20 17:45:30 -07001105 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001106 OPTION="down" )
1107 time.sleep( link_sleep )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001108
1109 topology_output = main.ONOScli2.topology()
pingping-lin763ee042015-05-20 17:45:30 -07001110 linkDown = main.ONOSbench.checkStatus(
1111 topology_output, main.numMNswitches, str(
1112 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001113 utilities.assert_equals(
1114 expect=main.TRUE,
1115 actual=linkDown,
1116 onpass="Link Down discovered properly",
1117 onfail="Link down was not discovered in " +
1118 str( link_sleep ) +
1119 " seconds" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001120
kelvin-onlab8a832582015-01-16 17:06:11 -08001121 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001122 pingResultLinkDown = main.FALSE
1123 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -07001124 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001125 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001126 timeDiff = round( ( time2 - time1 ), 2 )
1127 main.log.report(
1128 "Time taken for Ping All: " +
1129 str( timeDiff ) +
1130 " seconds" )
1131 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1132 onpass="PING ALL PASS",
1133 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001134
pingping-lin763ee042015-05-20 17:45:30 -07001135 caseResult70 = linkDown and pingResultLinkDown
1136 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
kelvin-onlab8a832582015-01-16 17:06:11 -08001137 onpass="Random Link cut Test PASS",
1138 onfail="Random Link cut Test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001139
kelvin-onlab8a832582015-01-16 17:06:11 -08001140 def CASE80( self, main ):
1141 """
pingping-lin763ee042015-05-20 17:45:30 -07001142 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
kelvin-onlab8a832582015-01-16 17:06:11 -08001143 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001144 import random
pingping-lin763ee042015-05-20 17:45:30 -07001145 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1146 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1147 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
kelvin-onlab8a832582015-01-16 17:06:11 -08001148 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
pingping-lin763ee042015-05-20 17:45:30 -07001149 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001150
kelvin-onlab8a832582015-01-16 17:06:11 -08001151 main.log.report(
pingping-lin763ee042015-05-20 17:45:30 -07001152 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001153 main.log.report(
1154 "__________________________________________________________________" )
1155 main.case(
1156 "Host intents - Bring the core links up that are down and verify ping all" )
1157 main.step( "Bring randomly cut links on Core devices up" )
1158 for i in range( int( switchLinksToToggle ) ):
1159 main.Mininet1.link(
1160 END1=link1End1,
pingping-lin763ee042015-05-20 17:45:30 -07001161 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001162 OPTION="up" )
1163 main.Mininet1.link(
1164 END1=link2End1,
pingping-lin763ee042015-05-20 17:45:30 -07001165 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001166 OPTION="up" )
1167 main.Mininet1.link(
1168 END1=link3End1,
pingping-lin763ee042015-05-20 17:45:30 -07001169 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001170 OPTION="up" )
1171 time.sleep( link_sleep )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001172
1173 topology_output = main.ONOScli2.topology()
pingping-lin763ee042015-05-20 17:45:30 -07001174 linkUp = main.ONOSbench.checkStatus(
kelvin-onlab8a832582015-01-16 17:06:11 -08001175 topology_output,
pingping-lin763ee042015-05-20 17:45:30 -07001176 main.numMNswitches,
1177 str( main.numMNlinks ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001178 utilities.assert_equals(
1179 expect=main.TRUE,
1180 actual=linkUp,
1181 onpass="Link up discovered properly",
1182 onfail="Link up was not discovered in " +
1183 str( link_sleep ) +
1184 " seconds" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001185
kelvin-onlab8a832582015-01-16 17:06:11 -08001186 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001187 pingResultLinkUp = main.FALSE
1188 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -07001189 pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001190 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001191 timeDiff = round( ( time2 - time1 ), 2 )
1192 main.log.report(
1193 "Time taken for Ping All: " +
1194 str( timeDiff ) +
1195 " seconds" )
1196 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1197 onpass="PING ALL PASS",
1198 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001199
pingping-lin763ee042015-05-20 17:45:30 -07001200 caseResult80 = linkUp and pingResultLinkUp
1201 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
kelvin-onlab8a832582015-01-16 17:06:11 -08001202 onpass="Link Up Test PASS",
1203 onfail="Link Up Test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001204
kelvin-onlab8a832582015-01-16 17:06:11 -08001205 def CASE71( self, main ):
1206 """
pingping-lin763ee042015-05-20 17:45:30 -07001207 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
kelvin-onlab8a832582015-01-16 17:06:11 -08001208 """
kelvin8ec71442015-01-15 16:57:00 -08001209 import random
pingping-lin763ee042015-05-20 17:45:30 -07001210 main.randomLink1 = []
1211 main.randomLink2 = []
1212 main.randomLink3 = []
1213 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1214 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1215 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1216 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1217 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1218 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1219 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
kelvin-onlab8a832582015-01-16 17:06:11 -08001220 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
kelvin8ec71442015-01-15 16:57:00 -08001221
pingping-lin763ee042015-05-20 17:45:30 -07001222 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1223 main.log.report( "___________________________________________________________________________" )
1224 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1225 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001226 if ( int( switchLinksToToggle ) ==
1227 0 or int( switchLinksToToggle ) > 5 ):
pingping-lin763ee042015-05-20 17:45:30 -07001228 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1229 #main.cleanup()
1230 #main.exit()
kelvin8ec71442015-01-15 16:57:00 -08001231 else:
pingping-lin763ee042015-05-20 17:45:30 -07001232 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
kelvin8ec71442015-01-15 16:57:00 -08001233
kelvin-onlab8a832582015-01-16 17:06:11 -08001234 main.step( "Cut links on Core devices using user provided range" )
pingping-lin763ee042015-05-20 17:45:30 -07001235 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1236 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1237 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001238 for i in range( int( switchLinksToToggle ) ):
1239 main.Mininet1.link(
1240 END1=link1End1,
pingping-lin763ee042015-05-20 17:45:30 -07001241 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001242 OPTION="down" )
1243 main.Mininet1.link(
1244 END1=link2End1,
pingping-lin763ee042015-05-20 17:45:30 -07001245 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001246 OPTION="down" )
1247 main.Mininet1.link(
1248 END1=link3End1,
pingping-lin763ee042015-05-20 17:45:30 -07001249 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001250 OPTION="down" )
1251 time.sleep( link_sleep )
kelvin8ec71442015-01-15 16:57:00 -08001252
1253 topology_output = main.ONOScli2.topology()
pingping-lin763ee042015-05-20 17:45:30 -07001254 linkDown = main.ONOSbench.checkStatus(
1255 topology_output, main.numMNswitches, str(
1256 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001257 utilities.assert_equals(
1258 expect=main.TRUE,
1259 actual=linkDown,
1260 onpass="Link Down discovered properly",
1261 onfail="Link down was not discovered in " +
1262 str( link_sleep ) +
1263 " seconds" )
kelvin8ec71442015-01-15 16:57:00 -08001264
kelvin-onlab8a832582015-01-16 17:06:11 -08001265 main.step( "Verify Ping across all hosts" )
kelvin8ec71442015-01-15 16:57:00 -08001266 pingResultLinkDown = main.FALSE
1267 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -07001268 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
kelvin8ec71442015-01-15 16:57:00 -08001269 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001270 timeDiff = round( ( time2 - time1 ), 2 )
1271 main.log.report(
1272 "Time taken for Ping All: " +
1273 str( timeDiff ) +
1274 " seconds" )
1275 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1276 onpass="PING ALL PASS",
1277 onfail="PING ALL FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001278
pingping-lin763ee042015-05-20 17:45:30 -07001279 caseResult71 = linkDown and pingResultLinkDown
1280 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
kelvin-onlab8a832582015-01-16 17:06:11 -08001281 onpass="Random Link cut Test PASS",
1282 onfail="Random Link cut Test FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001283
kelvin-onlab8a832582015-01-16 17:06:11 -08001284 def CASE81( self, main ):
1285 """
pingping-lin763ee042015-05-20 17:45:30 -07001286 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
kelvin-onlab8a832582015-01-16 17:06:11 -08001287 """
kelvin8ec71442015-01-15 16:57:00 -08001288 import random
pingping-lin763ee042015-05-20 17:45:30 -07001289 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1290 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1291 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
kelvin-onlab8a832582015-01-16 17:06:11 -08001292 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
pingping-lin763ee042015-05-20 17:45:30 -07001293 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
kelvin8ec71442015-01-15 16:57:00 -08001294
kelvin-onlab8a832582015-01-16 17:06:11 -08001295 main.log.report(
pingping-lin763ee042015-05-20 17:45:30 -07001296 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001297 main.log.report(
pingping-lin763ee042015-05-20 17:45:30 -07001298 "__________________________________________________________________" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001299 main.case(
1300 "Point intents - Bring the core links up that are down and verify ping all" )
1301 main.step( "Bring randomly cut links on Core devices up" )
1302 for i in range( int( switchLinksToToggle ) ):
1303 main.Mininet1.link(
1304 END1=link1End1,
pingping-lin763ee042015-05-20 17:45:30 -07001305 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001306 OPTION="up" )
1307 main.Mininet1.link(
1308 END1=link2End1,
pingping-lin763ee042015-05-20 17:45:30 -07001309 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001310 OPTION="up" )
1311 main.Mininet1.link(
1312 END1=link3End1,
pingping-lin763ee042015-05-20 17:45:30 -07001313 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001314 OPTION="up" )
1315 time.sleep( link_sleep )
kelvin8ec71442015-01-15 16:57:00 -08001316
1317 topology_output = main.ONOScli2.topology()
pingping-lin763ee042015-05-20 17:45:30 -07001318 linkUp = main.ONOSbench.checkStatus(
kelvin-onlab8a832582015-01-16 17:06:11 -08001319 topology_output,
pingping-lin763ee042015-05-20 17:45:30 -07001320 main.numMNswitches,
1321 str( main.numMNlinks ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001322 utilities.assert_equals(
1323 expect=main.TRUE,
1324 actual=linkUp,
1325 onpass="Link up discovered properly",
1326 onfail="Link up was not discovered in " +
1327 str( link_sleep ) +
1328 " seconds" )
kelvin8ec71442015-01-15 16:57:00 -08001329
kelvin-onlab8a832582015-01-16 17:06:11 -08001330 main.step( "Verify Ping across all hosts" )
kelvin8ec71442015-01-15 16:57:00 -08001331 pingResultLinkUp = main.FALSE
1332 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -07001333 pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout )
kelvin8ec71442015-01-15 16:57:00 -08001334 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001335 timeDiff = round( ( time2 - time1 ), 2 )
1336 main.log.report(
1337 "Time taken for Ping All: " +
1338 str( timeDiff ) +
1339 " seconds" )
1340 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1341 onpass="PING ALL PASS",
1342 onfail="PING ALL FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001343
pingping-lin763ee042015-05-20 17:45:30 -07001344 caseResult81 = linkUp and pingResultLinkUp
1345 utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
kelvin-onlab8a832582015-01-16 17:06:11 -08001346 onpass="Link Up Test PASS",
1347 onfail="Link Up Test FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001348
pingping-lin763ee042015-05-20 17:45:30 -07001349 def CASE72( self, main ):
kelvin-onlab8a832582015-01-16 17:06:11 -08001350 """
pingping-lin763ee042015-05-20 17:45:30 -07001351 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
kelvin-onlab8a832582015-01-16 17:06:11 -08001352 """
pingping-lin763ee042015-05-20 17:45:30 -07001353 import random
1354 import itertools
1355 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1356
1357 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1358 main.log.report( "___________________________________________________________________________" )
1359 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1360 switches = []
1361 switchesComb = []
1362 for i in range( main.numMNswitches ):
1363 switches.append('s%d'%(i+1))
1364 switchesLinksComb = list(itertools.combinations(switches,2))
1365 main.randomLinks = random.sample(switchesLinksComb, 5 )
1366 print main.randomLinks
1367 main.step( "Cut links on random devices" )
1368
1369 for switch in main.randomLinks:
1370 main.Mininet1.link(
1371 END1=switch[0],
1372 END2=switch[1],
1373 OPTION="down")
1374 time.sleep( link_sleep )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001375
pingping-lin763ee042015-05-20 17:45:30 -07001376 topology_output = main.ONOScli2.topology()
1377 linkDown = main.ONOSbench.checkStatus(
1378 topology_output, main.numMNswitches, str(
1379 int( main.numMNlinks ) - 5 * 2 ) )
1380 utilities.assert_equals(
1381 expect=main.TRUE,
1382 actual=linkDown,
1383 onpass="Link Down discovered properly",
1384 onfail="Link down was not discovered in " +
1385 str( link_sleep ) +
1386 " seconds" )
1387
1388 main.step( "Verify Ping across all hosts" )
1389 pingResultLinkDown = main.FALSE
1390 time1 = time.time()
1391 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1392 time2 = time.time()
1393 timeDiff = round( ( time2 - time1 ), 2 )
1394 main.log.report(
1395 "Time taken for Ping All: " +
1396 str( timeDiff ) +
1397 " seconds" )
1398 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1399 onpass="PING ALL PASS",
1400 onfail="PING ALL FAIL" )
1401
1402 caseResult71 = pingResultLinkDown
1403 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
1404 onpass="Random Link cut Test PASS",
1405 onfail="Random Link cut Test FAIL" )
1406
1407 def CASE82( self, main ):
1408 """
1409 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1410 """
1411 import random
1412 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1413
1414 main.log.report(
1415 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1416 main.log.report(
1417 "__________________________________________________________________" )
1418 main.case(
1419 "Host intents - Bring the core links up that are down and verify ping all" )
1420 main.step( "Bring randomly cut links on devices up" )
1421
1422 for switch in main.randomLinks:
1423 main.Mininet1.link(
1424 END1=switch[0],
1425 END2=switch[1],
1426 OPTION="up")
1427
1428 time.sleep( link_sleep )
1429
1430 topology_output = main.ONOScli2.topology()
1431 linkUp = main.ONOSbench.checkStatus(
1432 topology_output,
1433 main.numMNswitches,
1434 str( main.numMNlinks ) )
1435 utilities.assert_equals(
1436 expect=main.TRUE,
1437 actual=linkUp,
1438 onpass="Link up discovered properly",
1439 onfail="Link up was not discovered in " +
1440 str( link_sleep ) +
1441 " seconds" )
1442
1443 main.step( "Verify Ping across all hosts" )
1444 pingResultLinkUp = main.FALSE
1445 time1 = time.time()
1446 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1447 time2 = time.time()
1448 timeDiff = round( ( time2 - time1 ), 2 )
1449 main.log.report(
1450 "Time taken for Ping All: " +
1451 str( timeDiff ) +
1452 " seconds" )
1453 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1454 onpass="PING ALL PASS",
1455 onfail="PING ALL FAIL" )
1456
1457 caseResult82 = linkUp and pingResultLinkUp
1458 utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
1459 onpass="Link Up Test PASS",
1460 onfail="Link Up Test FAIL" )
1461
1462 def CASE73( self, main ):
1463 """
1464 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
1465 """
1466 import random
1467 import itertools
1468 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1469
1470 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1471 main.log.report( "___________________________________________________________________________" )
1472 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1473 switches = []
1474 switchesComb = []
1475 for i in range( main.numMNswitches ):
1476 switches.append('s%d'%(i+1))
1477 switchesLinksComb = list(itertools.combinations(switches,2))
1478 main.randomLinks = random.sample(switchesLinksComb, 5 )
1479 print main.randomLinks
1480 main.step( "Cut links on random devices" )
1481
1482 for switch in main.randomLinks:
1483 main.Mininet1.link(
1484 END1=switch[0],
1485 END2=switch[1],
1486 OPTION="down")
1487 time.sleep( link_sleep )
1488
1489 topology_output = main.ONOScli2.topology()
1490 linkDown = main.ONOSbench.checkStatus(
1491 topology_output, main.numMNswitches, str(
1492 int( main.numMNlinks ) - 5 * 2 ) )
1493 utilities.assert_equals(
1494 expect=main.TRUE,
1495 actual=linkDown,
1496 onpass="Link Down discovered properly",
1497 onfail="Link down was not discovered in " +
1498 str( link_sleep ) +
1499 " seconds" )
1500
1501 main.step( "Verify Ping across all hosts" )
1502 pingResultLinkDown = main.FALSE
1503 time1 = time.time()
1504 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1505 time2 = time.time()
1506 timeDiff = round( ( time2 - time1 ), 2 )
1507 main.log.report(
1508 "Time taken for Ping All: " +
1509 str( timeDiff ) +
1510 " seconds" )
1511 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1512 onpass="PING ALL PASS",
1513 onfail="PING ALL FAIL" )
1514
1515 caseResult73 = pingResultLinkDown
1516 utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
1517 onpass="Random Link cut Test PASS",
1518 onfail="Random Link cut Test FAIL" )
1519
1520 def CASE83( self, main ):
1521 """
1522 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
1523 """
1524 import random
1525 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1526
1527 main.log.report(
1528 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
1529 main.log.report(
1530 "__________________________________________________________________" )
1531 main.case(
1532 "Point intents - Bring the core links up that are down and verify ping all" )
1533 main.step( "Bring randomly cut links on devices up" )
1534
1535 for switch in main.randomLinks:
1536 main.Mininet1.link(
1537 END1=switch[0],
1538 END2=switch[1],
1539 OPTION="up")
1540
1541 time.sleep( link_sleep )
1542
1543 topology_output = main.ONOScli2.topology()
1544 linkUp = main.ONOSbench.checkStatus(
1545 topology_output,
1546 main.numMNswitches,
1547 str( main.numMNlinks ) )
1548 utilities.assert_equals(
1549 expect=main.TRUE,
1550 actual=linkUp,
1551 onpass="Link up discovered properly",
1552 onfail="Link up was not discovered in " +
1553 str( link_sleep ) +
1554 " seconds" )
1555
1556 main.step( "Verify Ping across all hosts" )
1557 pingResultLinkUp = main.FALSE
1558 time1 = time.time()
1559 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1560 time2 = time.time()
1561 timeDiff = round( ( time2 - time1 ), 2 )
1562 main.log.report(
1563 "Time taken for Ping All: " +
1564 str( timeDiff ) +
1565 " seconds" )
1566 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1567 onpass="PING ALL PASS",
1568 onfail="PING ALL FAIL" )
1569
1570 caseResult83 = linkUp and pingResultLinkUp
1571 utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
1572 onpass="Link Up Test PASS",
1573 onfail="Link Up Test FAIL" )
1574
1575 def CASE74( self, main ):
1576 """
1577 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
1578 """
1579 import random
1580 main.randomLink1 = []
1581 main.randomLink2 = []
1582 main.randomLink3 = []
1583 main.randomLink4 = []
1584 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1585 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
1586 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
1587 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1588 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
1589 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
1590 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1591 main.pingTimeout = 400
1592
1593 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
1594 main.log.report( "___________________________________________________________________________" )
1595
1596 linkIndex = range(4)
1597 linkIndexS9 = random.sample(linkIndex,1)[0]
1598 linkIndex.remove(linkIndexS9)
1599 linkIndexS10 = random.sample(linkIndex,1)[0]
1600 main.randomLink1 = link1End2top[linkIndexS9]
1601 main.randomLink2 = link2End2top[linkIndexS10]
1602 main.randomLink3 = random.sample(link1End2bot,1)[0]
1603 main.randomLink4 = random.sample(link2End2bot,1)[0]
1604 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
1605 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
1606 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
1607 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
1608
1609 time.sleep( link_sleep )
1610
1611 topology_output = main.ONOScli2.topology()
1612 linkDown = main.ONOSbench.checkStatus(
1613 topology_output, main.numMNswitches, str(
1614 int( main.numMNlinks ) - 8 ))
1615 utilities.assert_equals(
1616 expect=main.TRUE,
1617 actual=linkDown,
1618 onpass="Link Down discovered properly",
1619 onfail="Link down was not discovered in " +
1620 str( link_sleep ) +
1621 " seconds" )
1622
1623 main.step( "Verify Ping across all hosts" )
1624 pingResultLinkDown = main.FALSE
1625 time1 = time.time()
1626 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1627 time2 = time.time()
1628 timeDiff = round( ( time2 - time1 ), 2 )
1629 main.log.report(
1630 "Time taken for Ping All: " +
1631 str( timeDiff ) +
1632 " seconds" )
1633 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1634 onpass="PING ALL PASS",
1635 onfail="PING ALL FAIL" )
1636
1637 caseResult74 = linkDown and pingResultLinkDown
1638 utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
1639 onpass="Random Link cut Test PASS",
1640 onfail="Random Link cut Test FAIL" )
1641
1642 def CASE84( self, main ):
1643 """
1644 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
1645 """
1646 import random
1647 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
1648 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
1649 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1650 main.log.report(
1651 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
1652 main.log.report(
1653 "__________________________________________________________________" )
1654 main.case(
1655 "Host intents - Bring the core links up that are down and verify ping all" )
1656
1657 #main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
1658 #main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
1659 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
1660 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
1661
1662 time.sleep( link_sleep )
1663 topology_output = main.ONOScli2.topology()
1664 linkUp = main.ONOSbench.checkStatus(
1665 topology_output,
1666 main.numMNswitches,
1667 str( main.numMNlinks ) )
1668 utilities.assert_equals(
1669 expect=main.TRUE,
1670 actual=linkUp,
1671 onpass="Link up discovered properly",
1672 onfail="Link up was not discovered in " +
1673 str( link_sleep ) +
1674 " seconds" )
1675
1676 main.step( "Verify Ping across all hosts" )
1677 pingResultLinkUp = main.FALSE
1678 time1 = time.time()
1679 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1680 time2 = time.time()
1681 timeDiff = round( ( time2 - time1 ), 2 )
1682 main.log.report(
1683 "Time taken for Ping All: " +
1684 str( timeDiff ) +
1685 " seconds" )
1686 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1687 onpass="PING ALL PASS",
1688 onfail="PING ALL FAIL" )
1689
1690 caseResult84 = linkUp and pingResultLinkUp
1691 utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
1692 onpass="Link Up Test PASS",
1693 onfail="Link Up Test FAIL" )
1694
1695 def CASE90( self ):
1696 """
1697 Install 600 point intents and verify ping all (Att Topology)
1698 """
1699 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
1700 main.log.report( "_______________________________________" )
1701 import itertools
1702 import time
1703 main.case( "Install 600 point intents" )
1704 main.step( "Add point Intents" )
1705 intentResult = main.TRUE
1706 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1707
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001708 intentIdList = []
pingping-lin763ee042015-05-20 17:45:30 -07001709 time1 = time.time()
1710 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1711 pool = []
1712 for cli in main.CLIs:
1713 if i >= len( deviceCombos ):
1714 break
1715 t = main.Thread( target=cli.addPointIntent,
1716 threadID=main.threadID,
1717 name="addPointIntent",
1718 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1719 pool.append(t)
1720 #time.sleep(1)
1721 t.start()
1722 i = i + 1
1723 main.threadID = main.threadID + 1
1724 for thread in pool:
1725 thread.join()
1726 intentIdList.append(thread.result)
1727 time2 = time.time()
1728 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1729 intentResult = main.TRUE
1730 intentsJson = main.ONOScli2.intents()
1731 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1732 intentsJson = intentsJson)
1733 print getIntentStateResult
1734 # Takes awhile for all the onos to get the intents
1735 time.sleep(30)
kelvin-onlab8a832582015-01-16 17:06:11 -08001736 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001737 pingResult = main.FALSE
1738 time1 = time.time()
pingping-lin763ee042015-05-20 17:45:30 -07001739 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001740 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001741 timeDiff = round( ( time2 - time1 ), 2 )
1742 main.log.report(
1743 "Time taken for Ping All: " +
1744 str( timeDiff ) +
1745 " seconds" )
1746 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1747 onpass="PING ALL PASS",
1748 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001749
pingping-lin763ee042015-05-20 17:45:30 -07001750 case90Result = ( intentResult and pingResult )
1751
kelvin-onlab8a832582015-01-16 17:06:11 -08001752 utilities.assert_equals(
1753 expect=main.TRUE,
pingping-lin763ee042015-05-20 17:45:30 -07001754 actual=case90Result,
1755 onpass="Install 600 point Intents and Ping All test PASS",
1756 onfail="Install 600 point Intents and Ping All test FAIL" )
1757
1758 def CASE91( self ):
1759 """
1760 Install ###$$$ point intents and verify ping all (Chordal Topology)
1761 """
1762 main.log.report( "Add ###$$$ point intents and verify pingall (Chordal Topology)" )
1763 main.log.report( "_______________________________________" )
1764 import itertools
1765 import time
1766 main.case( "Install ###$$$ point intents" )
1767 main.step( "Add point Intents" )
1768 intentResult = main.TRUE
1769 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1770
1771 intentIdList = []
1772 time1 = time.time()
1773 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1774 pool = []
1775 for cli in main.CLIs:
1776 if i >= len( deviceCombos ):
1777 break
1778 t = main.Thread( target=cli.addPointIntent,
1779 threadID=main.threadID,
1780 name="addPointIntent",
1781 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1782 pool.append(t)
1783 #time.sleep(1)
1784 t.start()
1785 i = i + 1
1786 main.threadID = main.threadID + 1
1787 for thread in pool:
1788 thread.join()
1789 intentIdList.append(thread.result)
1790 time2 = time.time()
1791 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1792 intentResult = main.TRUE
1793 intentsJson = main.ONOScli2.intents()
1794 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1795 intentsJson = intentsJson)
1796 print getIntentStateResult
1797 # Takes awhile for all the onos to get the intents
1798 time.sleep(30)
1799 main.step( "Verify Ping across all hosts" )
1800 pingResult = main.FALSE
1801 time1 = time.time()
1802 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1803 time2 = time.time()
1804 timeDiff = round( ( time2 - time1 ), 2 )
1805 main.log.report(
1806 "Time taken for Ping All: " +
1807 str( timeDiff ) +
1808 " seconds" )
1809 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1810 onpass="PING ALL PASS",
1811 onfail="PING ALL FAIL" )
1812
1813 case91Result = ( intentResult and pingResult )
1814
1815 utilities.assert_equals(
1816 expect=main.TRUE,
1817 actual=case91Result,
1818 onpass="Install ###$$$ point Intents and Ping All test PASS",
1819 onfail="Install ###$$$ point Intents and Ping All test FAIL" )
1820
1821 def CASE92( self ):
1822 """
1823 Install 4556 point intents and verify ping all (Spine Topology)
1824 """
1825 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
1826 main.log.report( "_______________________________________" )
1827 import itertools
1828 import time
1829 main.case( "Install 4556 point intents" )
1830 main.step( "Add point Intents" )
1831 intentResult = main.TRUE
1832 main.pingTimeout = 600
1833 for i in range(len(main.hostMACs)):
1834 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
1835 print main.MACsDict
1836 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
1837 intentIdList = []
1838 time1 = time.time()
1839 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1840 pool = []
1841 for cli in main.CLIs:
1842 if i >= len( deviceCombos ):
1843 break
1844 t = main.Thread( target=cli.addPointIntent,
1845 threadID=main.threadID,
1846 name="addPointIntent",
1847 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1848 pool.append(t)
1849 #time.sleep(1)
1850 t.start()
1851 i = i + 1
1852 main.threadID = main.threadID + 1
1853 for thread in pool:
1854 thread.join()
1855 intentIdList.append(thread.result)
1856 time2 = time.time()
1857 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1858 intentResult = main.TRUE
1859 intentsJson = main.ONOScli2.intents()
1860 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1861 intentsJson = intentsJson)
1862 #print getIntentStateResult
1863 # Takes awhile for all the onos to get the intents
1864 time.sleep(60)
1865 main.step( "Verify Ping across all hosts" )
1866 pingResult = main.FALSE
1867 time1 = time.time()
1868 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1869 time2 = time.time()
1870 timeDiff = round( ( time2 - time1 ), 2 )
1871 main.log.report(
1872 "Time taken for Ping All: " +
1873 str( timeDiff ) +
1874 " seconds" )
1875 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1876 onpass="PING ALL PASS",
1877 onfail="PING ALL FAIL" )
1878
1879 case92Result = ( intentResult and pingResult )
1880
1881 utilities.assert_equals(
1882 expect=main.TRUE,
1883 actual=case92Result,
1884 onpass="Install 4556 point Intents and Ping All test PASS",
1885 onfail="Install 4556 point Intents and Ping All test FAIL" )
1886
1887 def CASE93( self ):
1888 """
1889 Install multi-single point intents and verify Ping all works
1890 for att topology
1891 """
1892 import copy
1893 import time
1894 main.log.report( "Install multi-single point intents and verify Ping all" )
1895 main.log.report( "___________________________________________" )
1896 main.case( "Install multi-single point intents and Ping all" )
1897 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
1898 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
1899 intentIdList = []
1900 print "MACsDict", main.MACsDict
1901 time1 = time.time()
1902 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
1903 pool = []
1904 for cli in main.CLIs:
1905 egressDevice = deviceDPIDsCopy[i]
1906 ingressDeviceList = copy.copy(deviceDPIDsCopy)
1907 ingressDeviceList.remove(egressDevice)
1908 if i >= len( deviceDPIDsCopy ):
1909 break
1910 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
1911 threadID=main.threadID,
1912 name="addMultipointToSinglepointIntent",
1913 args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
1914 pool.append(t)
1915 #time.sleep(1)
1916 t.start()
1917 i = i + 1
1918 main.threadID = main.threadID + 1
1919 for thread in pool:
1920 thread.join()
1921 intentIdList.append(thread.result)
1922 time2 = time.time()
1923 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1924 time.sleep(30)
1925 print "getting all intents ID"
1926 intentIdTemp = main.ONOScli1.getAllIntentsId()
1927 print intentIdTemp
1928 print len(intentIdList)
1929 print intentIdList
1930 checkIntentStateResult = main.TRUE
1931 print "Checking intents state"
1932 checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1933 checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1934 checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1935 checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1936 checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
1937
1938 if checkIntentStateResult:
1939 main.log.info( "All intents are installed correctly " )
1940
1941 print "Checking flows state "
1942 checkFlowsState = main.ONOScli1.checkFlowsState()
1943 time.sleep(50)
1944 main.step( "Verify Ping across all hosts" )
1945 pingResult = main.FALSE
1946 time1 = time.time()
1947 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
1948 time2 = time.time()
1949 timeDiff = round( ( time2 - time1 ), 2 )
1950 main.log.report(
1951 "Time taken for Ping All: " +
1952 str( timeDiff ) +
1953 " seconds" )
1954 checkFlowsState = main.ONOScli1.checkFlowsState()
1955 case93Result = pingResult
1956 utilities.assert_equals(
1957 expect=main.TRUE,
1958 actual=case93Result,
1959 onpass="Install 25 multi to single point Intents and Ping All test PASS",
1960 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
1961
1962 def CASE94( self ):
1963 """
1964 Install multi-single point intents and verify Ping all works
1965 for Chordal topology
1966 """
1967 import copy
1968 import time
1969 main.log.report( "Install multi-single point intents and verify Ping all" )
1970 main.log.report( "___________________________________________" )
1971 main.case( "Install multi-single point intents and Ping all" )
1972 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
1973 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
1974 intentIdList = []
1975 print "MACsDict", main.MACsDict
1976 time1 = time.time()
1977 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
1978 pool = []
1979 for cli in main.CLIs:
1980 egressDevice = deviceDPIDsCopy[i]
1981 ingressDeviceList = copy.copy(deviceDPIDsCopy)
1982 ingressDeviceList.remove(egressDevice)
1983 if i >= len( deviceDPIDsCopy ):
1984 break
1985 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
1986 threadID=main.threadID,
1987 name="addMultipointToSinglepointIntent",
1988 args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
1989 pool.append(t)
1990 #time.sleep(1)
1991 t.start()
1992 i = i + 1
1993 main.threadID = main.threadID + 1
1994 for thread in pool:
1995 thread.join()
1996 intentIdList.append(thread.result)
1997 time2 = time.time()
1998 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1999 time.sleep(5)
2000 main.step( "Verify Ping across all hosts" )
2001 pingResult = main.FALSE
2002 time1 = time.time()
2003 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
2004 time2 = time.time()
2005 timeDiff = round( ( time2 - time1 ), 2 )
2006 main.log.report(
2007 "Time taken for Ping All: " +
2008 str( timeDiff ) +
2009 " seconds" )
2010
2011 case94Result = pingResult
2012 utilities.assert_equals(
2013 expect=main.TRUE,
2014 actual=case94Result,
2015 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2016 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
2017
2018 #def CASE95 multi-single point intent for Spine
2019
2020 def CASE96( self ):
2021 """
2022 Install single-multi point intents and verify Ping all works
2023 for att topology
2024 """
2025 import copy
2026 main.log.report( "Install single-multi point intents and verify Ping all" )
2027 main.log.report( "___________________________________________" )
2028 main.case( "Install single-multi point intents and Ping all" )
2029 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2030 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
2031 intentIdList = []
2032 print "MACsDict", main.MACsDict
2033 time1 = time.time()
2034 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2035 pool = []
2036 for cli in main.CLIs:
2037 ingressDevice = deviceDPIDsCopy[i]
2038 egressDeviceList = copy.copy(deviceDPIDsCopy)
2039 egressDeviceList.remove(ingressDevice)
2040 if i >= len( deviceDPIDsCopy ):
2041 break
2042 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2043 threadID=main.threadID,
2044 name="addSinglepointToMultipointIntent",
2045 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice)])
2046 pool.append(t)
2047 #time.sleep(1)
2048 t.start()
2049 i = i + 1
2050 main.threadID = main.threadID + 1
2051 for thread in pool:
2052 thread.join()
2053 intentIdList.append(thread.result)
2054 time2 = time.time()
2055 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2056 time.sleep(5)
2057 main.step( "Verify Ping across all hosts" )
2058 pingResult = main.FALSE
2059 time1 = time.time()
2060 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
2061 time2 = time.time()
2062 timeDiff = round( ( time2 - time1 ), 2 )
2063 main.log.report(
2064 "Time taken for Ping All: " +
2065 str( timeDiff ) +
2066 " seconds" )
2067
2068 case96Result = pingResult
2069 utilities.assert_equals(
2070 expect=main.TRUE,
2071 actual=case96Result,
2072 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2073 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2074
2075 def CASE97( self ):
2076 """
2077 Install single-multi point intents and verify Ping all works
2078 for Chordal topology
2079 """
2080 import copy
2081 main.log.report( "Install single-multi point intents and verify Ping all" )
2082 main.log.report( "___________________________________________" )
2083 main.case( "Install single-multi point intents and Ping all" )
2084 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2085 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
2086 intentIdList = []
2087 print "MACsDict", main.MACsDict
2088 time1 = time.time()
2089 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2090 pool = []
2091 for cli in main.CLIs:
2092 ingressDevice = deviceDPIDsCopy[i]
2093 egressDeviceList = copy.copy(deviceDPIDsCopy)
2094 egressDeviceList.remove(ingressDevice)
2095 if i >= len( deviceDPIDsCopy ):
2096 break
2097 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2098 threadID=main.threadID,
2099 name="addSinglepointToMultipointIntent",
2100 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice),''])
2101 pool.append(t)
2102 #time.sleep(1)
2103 t.start()
2104 i = i + 1
2105 main.threadID = main.threadID + 1
2106 for thread in pool:
2107 thread.join()
2108 intentIdList.append(thread.result)
2109 time2 = time.time()
2110 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2111 time.sleep(5)
2112 main.step( "Verify Ping across all hosts" )
2113 pingResult = main.FALSE
2114 time1 = time.time()
2115 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
2116 time2 = time.time()
2117 timeDiff = round( ( time2 - time1 ), 2 )
2118 main.log.report(
2119 "Time taken for Ping All: " +
2120 str( timeDiff ) +
2121 " seconds" )
2122
2123 case97Result = pingResult
2124 utilities.assert_equals(
2125 expect=main.TRUE,
2126 actual=case97Result,
2127 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2128 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2129
2130 def CASE98( self ):
2131 """
2132 Install single-multi point intents and verify Ping all works
2133 for Spine topology
2134 """
2135 import copy
2136 main.log.report( "Install single-multi point intents and verify Ping all" )
2137 main.log.report( "___________________________________________" )
2138 main.case( "Install single-multi point intents and Ping all" )
2139 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2140 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
2141 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
2142 intentIdList = []
2143 MACsDictCopy = {}
2144 for i in range( len( deviceDPIDsCopy ) ):
2145 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
2146
2147 print "deviceDPIDsCopy", deviceDPIDsCopy
2148 print ""
2149 print "MACsDictCopy", MACsDictCopy
2150 time1 = time.time()
2151 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2152 pool = []
2153 for cli in main.CLIs:
2154 if i >= len( deviceDPIDsCopy ):
2155 break
2156 ingressDevice = deviceDPIDsCopy[i]
2157 egressDeviceList = copy.copy(deviceDPIDsCopy)
2158 egressDeviceList.remove(ingressDevice)
2159 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2160 threadID=main.threadID,
2161 name="addSinglepointToMultipointIntent",
2162 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',MACsDictCopy.get(ingressDevice),''])
2163 pool.append(t)
2164 #time.sleep(1)
2165 t.start()
2166 i = i + 1
2167 main.threadID = main.threadID + 1
2168 for thread in pool:
2169 thread.join()
2170 intentIdList.append(thread.result)
2171 time2 = time.time()
2172 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2173 time.sleep(5)
2174 main.step( "Verify Ping across all hosts" )
2175 pingResult = main.FALSE
2176 time1 = time.time()
2177 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
2178 time2 = time.time()
2179 timeDiff = round( ( time2 - time1 ), 2 )
2180 main.log.report(
2181 "Time taken for Ping All: " +
2182 str( timeDiff ) +
2183 " seconds" )
2184
2185 case98Result = pingResult
2186 utilities.assert_equals(
2187 expect=main.TRUE,
2188 actual=case98Result,
2189 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2190 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002191
kelvin-onlab8a832582015-01-16 17:06:11 -08002192 def CASE10( self ):
pingping-lin763ee042015-05-20 17:45:30 -07002193 import time
kelvin-onlab8a832582015-01-16 17:06:11 -08002194 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002195 Remove all Intents
kelvin-onlab8a832582015-01-16 17:06:11 -08002196 """
2197 main.log.report( "Remove all intents that were installed previously" )
2198 main.log.report( "______________________________________________" )
2199 main.log.info( "Remove all intents" )
2200 main.case( "Removing intents" )
2201 main.step( "Obtain the intent id's first" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002202 intentsList = main.ONOScli1.getAllIntentIds()
kelvin-onlab8a832582015-01-16 17:06:11 -08002203 ansi_escape = re.compile( r'\x1b[^m]*m' )
2204 intentsList = ansi_escape.sub( '', intentsList )
2205 intentsList = intentsList.replace(
2206 " onos:intents | grep id=",
2207 "" ).replace(
2208 "id=",
2209 "" ).replace(
2210 "\r\r",
2211 "" )
2212 intentsList = intentsList.splitlines()
2213 intentsList = intentsList[ 1: ]
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002214 intentIdList = []
2215 step1Result = main.TRUE
pingping-lin763ee042015-05-20 17:45:30 -07002216 moreIntents = main.TRUE
2217 removeIntentCount = 0
2218 intentsCount = len(intentsList)
2219 print "Current number of intents" , len(intentsList)
kelvin-onlab8a832582015-01-16 17:06:11 -08002220 if ( len( intentsList ) > 1 ):
pingping-lin763ee042015-05-20 17:45:30 -07002221 results = main.TRUE
2222 main.log.info("Removing intent...")
2223 while moreIntents:
2224 if removeIntentCount == 5:
2225 break
2226 removeIntentCount = removeIntentCount + 1
2227 intentsList1 = main.ONOScli1.getAllIntentIds()
2228 if len( intentsList1 ) == 0:
2229 break
2230 ansi_escape = re.compile( r'\x1b[^m]*m' )
2231 intentsList1 = ansi_escape.sub( '', intentsList1 )
2232 intentsList1 = intentsList1.replace(
2233 " onos:intents | grep id=",
2234 "" ).replace(
2235 " state=",
2236 "" ).replace(
2237 "\r\r",
2238 "" )
2239 intentsList1 = intentsList1.splitlines()
2240 intentsList1 = intentsList1[ 1: ]
2241 print "Round %d intents to remove: " %(removeIntentCount)
2242 print intentsList1
2243 intentIdList1 = []
2244 if ( len( intentsList1 ) > 0 ):
2245 moreIntents = main.TRUE
2246 for i in range( len( intentsList1 ) ):
2247 intentsTemp1 = intentsList1[ i ].split( ',' )
2248 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
2249 print "Leftover Intent IDs: ", intentIdList1
2250 print len(intentIdList1)
2251 time1 = time.time()
2252 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
2253 pool = []
2254 for cli in main.CLIs:
2255 if i >= len( intentIdList1 ):
2256 break
2257 t = main.Thread( target=cli.removeIntent,
2258 threadID=main.threadID,
2259 name="removeIntent",
2260 args=[intentIdList1[i],'org.onosproject.cli',True,False])
2261 pool.append(t)
2262 t.start()
2263 i = i + 1
2264 main.threadID = main.threadID + 1
2265 for thread in pool:
2266 thread.join()
2267 intentIdList.append(thread.result)
2268 time2 = time.time()
2269 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
2270 time.sleep(10)
2271 else:
2272 time.sleep(15)
2273 if len( main.ONOScli1.intents()):
2274 continue
2275 break
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002276
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002277 else:
pingping-lin763ee042015-05-20 17:45:30 -07002278 print "Removed %d intents" %(intentsCount)
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002279 step1Result = main.TRUE
2280 else:
2281 print "No Intent IDs found in Intents list: ", intentsList
2282 step1Result = main.FALSE
2283
pingping-lin763ee042015-05-20 17:45:30 -07002284 print main.ONOScli1.intents()
2285 caseResult10 = step1Result
2286 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
kelvin-onlab8a832582015-01-16 17:06:11 -08002287 onpass="Intent removal test successful",
2288 onfail="Intent removal test failed" )
pingping-lin763ee042015-05-20 17:45:30 -07002289
2290 def CASE12( self, main ):
2291 """
2292 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
2293 """
2294 import re
2295 import copy
2296 import time
2297
2298 Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
2299 threadID = 0
2300
2301 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
2302 main.log.report( "_____________________________________________________" )
2303 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
2304 main.step( "Enable intent based Reactive forwarding" )
2305 installResult = main.FALSE
2306 feature = "onos-app-ifwd"
2307
2308 pool = []
2309 time1 = time.time()
2310 for cli,feature in main.CLIs:
2311 t = main.Thread(target=cli,threadID=threadID,
2312 name="featureInstall",args=[feature])
2313 pool.append(t)
2314 t.start()
2315 threadID = threadID + 1
2316
2317 results = []
2318 for thread in pool:
2319 thread.join()
2320 results.append(thread.result)
2321 time2 = time.time()
2322
2323 if( all(result == main.TRUE for result in results) == False):
2324 main.log.info("Did not install onos-app-ifwd feature properly")
2325 #main.cleanup()
2326 #main.exit()
2327 else:
2328 main.log.info("Successful feature:install onos-app-ifwd")
2329 installResult = main.TRUE
2330 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
2331
2332 main.step( "Verify Pingall" )
2333 ping_result = main.FALSE
2334 time1 = time.time()
2335 ping_result = main.Mininet1.pingall(timeout=600)
2336 time2 = time.time()
2337 timeDiff = round( ( time2 - time1 ), 2 )
2338 main.log.report(
2339 "Time taken for Ping All: " +
2340 str( timeDiff ) +
2341 " seconds" )
2342
2343 if ping_result == main.TRUE:
2344 main.log.report( "Pingall Test in Reactive mode successful" )
2345 else:
2346 main.log.report( "Pingall Test in Reactive mode failed" )
2347
2348 main.step( "Disable Intent based Reactive forwarding" )
2349 uninstallResult = main.FALSE
2350
2351 pool = []
2352 time1 = time.time()
2353 for cli,feature in main.CLIs:
2354 t = main.Thread(target=cli,threadID=threadID,
2355 name="featureUninstall",args=[feature])
2356 pool.append(t)
2357 t.start()
2358 threadID = threadID + 1
2359
2360 results = []
2361 for thread in pool:
2362 thread.join()
2363 results.append(thread.result)
2364 time2 = time.time()
2365
2366 if( all(result == main.TRUE for result in results) == False):
2367 main.log.info("Did not uninstall onos-app-ifwd feature properly")
2368 uninstallResult = main.FALSE
2369 #main.cleanup()
2370 #main.exit()
2371 else:
2372 main.log.info("Successful feature:uninstall onos-app-ifwd")
2373 uninstallResult = main.TRUE
2374 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
2375
2376 # Waiting for reative flows to be cleared.
2377 time.sleep( 10 )
2378
2379 case11Result = installResult and ping_result and uninstallResult
2380 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
2381 onpass="Intent based Reactive forwarding Pingall test PASS",
2382 onfail="Intent based Reactive forwarding Pingall test FAIL" )
2383
2384 def CASE99(self):
2385 import time
2386 # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
2387 main.step( "Stop ONOS on all Nodes" )
2388 stopResult = main.TRUE
2389 for i in range( 1, int( main.numCtrls ) + 1 ):
2390 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2391 main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
2392 sresult = main.ONOSbench.onosStop( ONOS_ip )
2393 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2394 onpass="Test step PASS",
2395 onfail="Test step FAIL" )
2396 stopResult = ( stopResult and sresult )
2397
2398 main.step( "Start ONOS on all Nodes" )
2399 startResult = main.TRUE
2400 for i in range( 1, int( main.numCtrls ) + 1 ):
2401 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2402 main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
2403 sresult = main.ONOSbench.onosStart( ONOS_ip )
2404 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2405 onpass="Test step PASS",
2406 onfail="Test step FAIL" )
2407 startResult = ( startResult and sresult )
2408
2409 main.step( "Start ONOS CLI on all nodes" )
2410 cliResult = main.TRUE
2411 time.sleep( 30 )
2412 main.log.step(" Start ONOS cli using thread ")
2413 pool = []
2414 time1 = time.time()
2415 for i in range( int( main.numCtrls ) ):
2416 t = main.Thread(target=main.CLIs[i].startOnosCli,
2417 threadID=main.threadID,
2418 name="startOnosCli",
2419 args=[main.nodes[i].ip_address])
2420 pool.append(t)
2421 t.start()
2422 main.threadID = main.threadID + 1
2423 for t in pool:
2424 t.join()
2425 cliResult = cliResult and t.result
2426 time2 = time.time()
2427
2428 if not cliResult:
2429 main.log.info("ONOS CLI did not start up properly")
2430 #main.cleanup()
2431 #main.exit()
2432 else:
2433 main.log.info("Successful CLI startup")
2434 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
2435
2436 case99Result = ( startResult and cliResult )
2437 time.sleep(30)
2438 utilities.assert_equals(
2439 expect=main.TRUE,
2440 actual=case99Result,
2441 onpass="Starting new Chordal topology test PASS",
2442 onfail="Starting new Chordal topology test FAIL" )
2443
2444
2445
2446
2447