blob: d5b9400106918cbc9d6081f5bc8f8208a4f159f6 [file] [log] [blame]
kelvin-onlab65a72d22015-03-26 13:46:32 -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
kelvin-onlab78f7d2d2015-03-02 17:37:35 -080027
28 global intentState
kelvin-onlab54400a92015-02-26 18:05:51 -080029 main.threadID = 0
30 main.pingTimeout = 300
Hari Krishna22c3d412015-02-17 16:48:12 -080031 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' ]
Hari Krishnab35c6d02015-03-18 11:13:51 -070045 main.newTopo = ""
kelvin-onlab78f7d2d2015-03-02 17:37:35 -080046 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':
Hari Krishnad97213e2015-01-24 19:30:14 -080058 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" )
Hari Krishna22c3d412015-02-17 16:48:12 -080071 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" )
Hari Krishna22c3d412015-02-17 16:48:12 -080076 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
Hari Krishnad97213e2015-01-24 19:30:14 -080080 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" )
Hari Krishnad97213e2015-01-24 19:30:14 -080083 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" )
Hari Krishnad97213e2015-01-24 19:30:14 -080089 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
Hari Krishna22c3d412015-02-17 16:48:12 -080096 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 ) ]
kelvin-onlab54400a92015-02-26 18:05:51 -080098 main.log.info( "Uninstalling package on ONOS Node IP: " + ONOS_ip )
Hari Krishnad97213e2015-01-24 19:30:14 -080099 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
Hari Krishnab35c6d02015-03-18 11:13:51 -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
Hari Krishna22c3d412015-02-17 16:48:12 -0800110 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 )
Hari Krishnad97213e2015-01-24 19:30:14 -0800113 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
Hari Krishna22c3d412015-02-17 16:48:12 -0800121 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:" )
Hari Krishnad97213e2015-01-24 19:30:14 -0800124 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 )
Hari Krishnab35c6d02015-03-18 11:13:51 -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
kelvin-onlab54400a92015-02-26 18:05:51 -0800135 time.sleep( 25 )
kelvin-onlab54400a92015-02-26 18:05:51 -0800136 main.log.step(" Start ONOS cli using thread ")
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800137 startCliResult = main.TRUE
kelvin-onlab54400a92015-02-26 18:05:51 -0800138 pool = []
139 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800140 for i in range( int( main.numCtrls) ):
141 t = main.Thread( target=main.CLIs[i].startOnosCli,
142 threadID=main.threadID,
143 name="startOnosCli",
kelvin-onlabc44f0192015-04-02 22:08:41 -0700144 args=[ main.nodes[i].ip_address, karafTimeout ] )
kelvin-onlab54400a92015-02-26 18:05:51 -0800145 pool.append(t)
146 t.start()
147 main.threadID = main.threadID + 1
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800148 for t in pool:
149 t.join()
150 startCliResult = startCliResult and t.result
kelvin-onlab54400a92015-02-26 18:05:51 -0800151 time2 = time.time()
152
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800153 if not startCliResult:
kelvin-onlab54400a92015-02-26 18:05:51 -0800154 main.log.info("ONOS CLI did not start up properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -0700155 #main.cleanup()
156 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -0800157 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 Krishnab35c6d02015-03-18 11:13:51 -0700166
kelvin-onlab65a72d22015-03-26 13:46:32 -0700167 def CASE20( self, main ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800168 """
Hari Krishnab35c6d02015-03-18 11:13:51 -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 Krishnab35c6d02015-03-18 11:13:51 -0700174
Hari Krishna22c3d412015-02-17 16:48:12 -0800175 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
176 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
177 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700178 main.pingTimeout = 60
kelvin-onlab8a832582015-01-16 17:06:11 -0800179 main.log.report(
Hari Krishnab35c6d02015-03-18 11:13:51 -0700180 "Load Att topology and Balance all Mininet switches across controllers" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800181 main.log.report(
Hari Krishnab35c6d02015-03-18 11:13:51 -0700182 "________________________________________________________________________" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800183 main.case(
184 "Assign and Balance all Mininet switches across controllers" )
Hari Krishnab35c6d02015-03-18 11:13:51 -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" )
Hari Krishna22c3d412015-02-17 16:48:12 -0800195 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
Hari Krishnad97213e2015-01-24 19:30:14 -0800196 main.Mininet1.assignSwController(
kelvin-onlab8a832582015-01-16 17:06:11 -0800197 sw=str( i ),
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700198 count= 1 ,
Hari Krishna22c3d412015-02-17 16:48:12 -0800199 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 )
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700209 time.sleep(2)
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800210 switch_mastership = main.TRUE
Hari Krishna22c3d412015-02-17 16:48:12 -0800211 for i in range( 1, ( main.numMNswitches + 1 ) ):
Hari Krishnad97213e2015-01-24 19:30:14 -0800212 response = main.Mininet1.getSwController( "s" + str( i ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800213 print( "Response is " + str( response ) )
Hari Krishna22c3d412015-02-17 16:48:12 -0800214 if re.search( "tcp:" + main.ONOS1_ip, response ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800215 switch_mastership = switch_mastership and main.TRUE
216 else:
217 switch_mastership = main.FALSE
218
219 if switch_mastership == main.TRUE:
kelvin-onlab8a832582015-01-16 17:06:11 -0800220 main.log.report( "Controller assignment successfull" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800221 else:
kelvin-onlab8a832582015-01-16 17:06:11 -0800222 main.log.report( "Controller assignment failed" )
kelvin-onlab77d6c302015-03-31 11:33:32 -0700223
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")
Hari Krishnab35c6d02015-03-18 11:13:51 -0700242 """
kelvin-onlab77d6c302015-03-31 11:33:32 -0700243 time.sleep(15)
244 #Don't balance master for now..
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700245 """main.step( "Balance devices across controllers" )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700246 for i in range( int( main.numCtrls ) ):
247 balanceResult = main.ONOScli1.balanceMasters()
kelvin-onlab8a832582015-01-16 17:06:11 -0800248 # giving some breathing time for ONOS to complete re-balance
Hari Krishnab35c6d02015-03-18 11:13:51 -0700249 time.sleep( 3 )
kelvin-onlab77d6c302015-03-31 11:33:32 -0700250 topology_output = main.ONOScli1.topology()
251 topology_result = main.ONOSbench.getTopology( topology_output )
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700252 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700253 case2Result = ( switch_mastership and startStatus )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700254 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" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800259
kelvin-onlab65a72d22015-03-26 13:46:32 -0700260 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" )
kelvin-onlabb9408212015-04-01 13:34:04 -0700280 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
kelvin-onlab65a72d22015-03-26 13:46:32 -0700281 #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 )
300
301 switch_mastership = main.TRUE
302 for i in range( 1, ( main.numMNswitches + 1 ) ):
303 response = main.Mininet1.getSwController( "s" + str( i ) )
304 print( "Response is " + str( response ) )
305 if re.search( "tcp:" + main.ONOS1_ip, response ):
306 switch_mastership = switch_mastership and main.TRUE
307 else:
308 switch_mastership = main.FALSE
309
310 if switch_mastership == main.TRUE:
311 main.log.report( "Controller assignment successfull" )
312 else:
313 main.log.report( "Controller assignment failed" )
314 time.sleep( 5 )
315
316 #Don't balance master for now..
317 """
318 main.step( "Balance devices across controllers" )
319 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" )
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700354 #stopStatus = main.Mininet1.stopNet(fileName = "topoSpine" )
kelvin-onlab65a72d22015-03-26 13:46:32 -0700355 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()
393 # giving some breathing time for ONOS to complete re-balance
394 time.sleep( 3 )
395
396 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)
404 utilities.assert_equals(
405 expect=main.TRUE,
406 actual=case22Result,
407 onpass="Starting new Spine topology test PASS",
408 onfail="Starting new Spine topology test FAIL" )
409
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
Hari Krishna22c3d412015-02-17 16:48:12 -0800417 main.deviceDPIDs = []
418 main.hostMACs = []
419 main.deviceLinks = []
420 main.deviceActiveLinksCount = []
421 main.devicePortsEnabledCount = []
kelvin-onlab54400a92015-02-26 18:05:51 -0800422
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 "____________________________________________________________________" )
Hari Krishna5afb4cc2015-03-23 15:35:15 -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()
Hari Krishnad97213e2015-01-24 19:30:14 -0800430 topology_result = main.ONOSbench.getTopology( topology_output )
Hari Krishnaef1bd4e2015-03-12 16:55:30 -0700431 numOnosDevices = topology_result[ 'deviceCount' ]
432 numOnosLinks = topology_result[ 'linkCount' ]
Hari Krishnab35c6d02015-03-18 11:13:51 -0700433 topoResult = main.TRUE
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800434
kelvin-onlab54400a92015-02-26 18:05:51 -0800435 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
Hari Krishna22c3d412015-02-17 16:48:12 -0800436 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
Hari Krishna22c3d412015-02-17 16:48:12 -0800441 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 )
Hari Krishna5afb4cc2015-03-23 15:35:15 -0700445 main.MACsDict = {}
kelvin-onlab65a72d22015-03-26 13:46:32 -0700446 print "Creating dictionary of DPID and HostMacs"
447 for i in range(len(main.hostMACs)):
Hari Krishna5afb4cc2015-03-23 15:35:15 -0700448 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
449 print main.MACsDict
Hari Krishna22c3d412015-02-17 16:48:12 -0800450 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
Hari Krishna22c3d412015-02-17 16:48:12 -0800463 main.step( "Collect and store each Device ports enabled Count" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800464 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800465 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800466 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800467 for cli in main.CLIs:
kelvin-onlabc44f0192015-04-02 22:08:41 -0700468 if i >= main.numMNswitches + 1:
kelvin-onlabfbcd82f2015-04-02 12:06:00 -0700469 break
kelvin-onlab54400a92015-02-26 18:05:51 -0800470 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 )
Hari Krishna22c3d412015-02-17 16:48:12 -0800482 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
kelvin-onlab54400a92015-02-26 18:05:51 -0800483 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
Hari Krishna22c3d412015-02-17 16:48:12 -0800486 main.step( "Collect and store each Device active links Count" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800487 time1 = time.time()
488
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800489 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800490 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800491 for cli in main.CLIs:
kelvin-onlabc44f0192015-04-02 22:08:41 -0700492 if i >= main.numMNswitches + 1:
kelvin-onlabfbcd82f2015-04-02 12:06:00 -0700493 break
kelvin-onlab54400a92015-02-26 18:05:51 -0800494 dpid = "of:00000000000000" + format( i,'02x' )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800495 t = main.Thread( target = cli.getDeviceLinksActiveCount,
496 threadID = main.threadID,
497 name = "getDevicePortsEnabledCount",
498 args = [dpid])
kelvin-onlab54400a92015-02-26 18:05:51 -0800499 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 )
kelvin-onlabfbcd82f2015-04-02 12:06:00 -0700509 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
kelvin-onlab54400a92015-02-26 18:05:51 -0800510 time2 = time.time()
511 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishna22c3d412015-02-17 16:48:12 -0800512
513 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...")
Hari Krishnab35c6d02015-03-18 11:13:51 -0700519 topoResult = main.FALSE
520
kelvin-onlab54400a92015-02-26 18:05:51 -0800521 #time.sleep(300)
Hari Krishnab35c6d02015-03-18 11:13:51 -0700522 #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
Hari Krishnab35c6d02015-03-18 11:13:51 -0700526 case3Result = topoResult
Hari Krishna22c3d412015-02-17 16:48:12 -0800527 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
kelvin-onlab65a72d22015-03-26 13:46:32 -0700531 def CASE40( self, main ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800532 """
Hari Krishnab35c6d02015-03-18 11:13:51 -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
Hari Krishnab35c6d02015-03-18 11:13:51 -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
kelvin-onlab06ade552015-03-31 18:09:27 -0700543 # Activate fwd app
544 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
kelvin-onlab06ade552015-03-31 18:09:27 -0700545 appCheck = main.TRUE
kelvin-onlab54400a92015-02-26 18:05:51 -0800546 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800547 for cli in main.CLIs:
kelvin-onlab06ade552015-03-31 18:09:27 -0700548 t = main.Thread( target=cli.appToIDCheck,
549 name="appToIDCheck-" + str( i ),
550 args=[] )
551 pool.append( t )
kelvin-onlab54400a92015-02-26 18:05:51 -0800552 t.start()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800553 for t in pool:
554 t.join()
kelvin-onlab06ade552015-03-31 18:09:27 -0700555 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()
kelvin-onlab4df89f22015-04-13 18:10:23 -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" )
kelvin-onlab06ade552015-03-31 18:09:27 -0700582
583 main.log.info( "Uninstall reactive forwarding app" )
584 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800585 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800586 for cli in main.CLIs:
kelvin-onlab06ade552015-03-31 18:09:27 -0700587 t = main.Thread( target=cli.appToIDCheck,
588 name="appToIDCheck-" + str( i ),
589 args=[] )
590 pool.append( t )
kelvin-onlab54400a92015-02-26 18:05:51 -0800591 t.start()
kelvin-onlab06ade552015-03-31 18:09:27 -0700592
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800593 for t in pool:
594 t.join()
kelvin-onlab06ade552015-03-31 18:09:27 -0700595 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.
kelvin-onlab06ade552015-03-31 18:09:27 -0700604 time.sleep( 10 )
605 case40Result = installResult and uninstallResult and ping_result
606 utilities.assert_equals( expect=main.TRUE, actual=case40Result,
Hari Krishnab35c6d02015-03-18 11:13:51 -0700607 onpass="Reactive Mode Pingall test PASS",
608 onfail="Reactive Mode Pingall test FAIL" )
609
610 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
kelvin-onlab06ade552015-03-31 18:09:27 -0700622 # Activate fwd app
623 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
624
625 appCheck = main.TRUE
Hari Krishnab35c6d02015-03-18 11:13:51 -0700626 pool = []
Hari Krishnab35c6d02015-03-18 11:13:51 -0700627 for cli in main.CLIs:
kelvin-onlab06ade552015-03-31 18:09:27 -0700628 t = main.Thread( target=cli.appToIDCheck,
629 name="appToIDCheck-" + str( i ),
630 args=[] )
631 pool.append( t )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700632 t.start()
Hari Krishnab35c6d02015-03-18 11:13:51 -0700633 for t in pool:
634 t.join()
kelvin-onlab06ade552015-03-31 18:09:27 -0700635 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 )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700644
645 main.step( "Verify Pingall" )
646 ping_result = main.FALSE
647 time1 = time.time()
kelvin-onlab4df89f22015-04-13 18:10:23 -0700648 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700649 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" )
kelvin-onlab06ade552015-03-31 18:09:27 -0700662
663 main.log.info( "Uninstall reactive forwarding app" )
664 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700665 pool = []
Hari Krishnab35c6d02015-03-18 11:13:51 -0700666 for cli in main.CLIs:
kelvin-onlab06ade552015-03-31 18:09:27 -0700667 t = main.Thread( target=cli.appToIDCheck,
668 name="appToIDCheck-" + str( i ),
669 args=[] )
670 pool.append( t )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700671 t.start()
kelvin-onlab06ade552015-03-31 18:09:27 -0700672
Hari Krishnab35c6d02015-03-18 11:13:51 -0700673 for t in pool:
674 t.join()
kelvin-onlab06ade552015-03-31 18:09:27 -0700675 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() )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700682
683 # Waiting for reative flows to be cleared.
kelvin-onlab06ade552015-03-31 18:09:27 -0700684 time.sleep( 10 )
685 case41Result = installResult and uninstallResult and ping_result
686 utilities.assert_equals( expect=main.TRUE, actual=case41Result,
Hari Krishnab35c6d02015-03-18 11:13:51 -0700687 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
kelvin-onlab06ade552015-03-31 18:09:27 -0700702 # Activate fwd app
703 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
704
705 appCheck = main.TRUE
Hari Krishnab35c6d02015-03-18 11:13:51 -0700706 pool = []
Hari Krishnab35c6d02015-03-18 11:13:51 -0700707 for cli in main.CLIs:
kelvin-onlab06ade552015-03-31 18:09:27 -0700708 t = main.Thread( target=cli.appToIDCheck,
709 name="appToIDCheck-" + str( i ),
710 args=[] )
711 pool.append( t )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700712 t.start()
Hari Krishnab35c6d02015-03-18 11:13:51 -0700713 for t in pool:
714 t.join()
kelvin-onlab06ade552015-03-31 18:09:27 -0700715 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 )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700724
725 main.step( "Verify Pingall" )
726 ping_result = main.FALSE
727 time1 = time.time()
kelvin-onlab4df89f22015-04-13 18:10:23 -0700728 ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700729 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" )
kelvin-onlab06ade552015-03-31 18:09:27 -0700742
743 main.log.info( "Uninstall reactive forwarding app" )
744 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700745 pool = []
Hari Krishnab35c6d02015-03-18 11:13:51 -0700746 for cli in main.CLIs:
kelvin-onlab06ade552015-03-31 18:09:27 -0700747 t = main.Thread( target=cli.appToIDCheck,
748 name="appToIDCheck-" + str( i ),
749 args=[] )
750 pool.append( t )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700751 t.start()
kelvin-onlab06ade552015-03-31 18:09:27 -0700752
Hari Krishnab35c6d02015-03-18 11:13:51 -0700753 for t in pool:
754 t.join()
kelvin-onlab06ade552015-03-31 18:09:27 -0700755 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() )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700762
763 # Waiting for reative flows to be cleared.
kelvin-onlab06ade552015-03-31 18:09:27 -0700764 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" )
kelvin-onlab06ade552015-03-31 18:09:27 -0700769
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
kelvin-onlab54400a92015-02-26 18:05:51 -0800775
Hari Krishna22c3d412015-02-17 16:48:12 -0800776 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" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800788 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800789 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800790 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800791 for cli in main.CLIs:
kelvin-onlabc44f0192015-04-02 22:08:41 -0700792 if i >= main.numMNswitches + 1:
793 break
kelvin-onlab54400a92015-02-26 18:05:51 -0800794 dpid = "of:00000000000000" + format( i,'02x' )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800795 t = main.Thread(target = cli.getDevicePortsEnabledCount,
796 threadID = main.threadID,
797 name = "getDevicePortsEnabledCount",
798 args = [dpid])
kelvin-onlab54400a92015-02-26 18:05:51 -0800799 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))
Hari Krishna22c3d412015-02-17 16:48:12 -0800812 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 ) )
kelvin-onlab54400a92015-02-26 18:05:51 -0800818
Hari Krishna22c3d412015-02-17 16:48:12 -0800819 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" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800826 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800827 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800828 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800829 for cli in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -0800830 dpid = "of:00000000000000" + format( i,'02x' )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800831 t = main.Thread(target = cli.getDeviceLinksActiveCount,
832 threadID = main.threadID,
833 name = "getDevicePortsEnabledCount",
834 args = [dpid])
kelvin-onlab54400a92015-02-26 18:05:51 -0800835 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))
Hari Krishna22c3d412015-02-17 16:48:12 -0800848 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 """
Hari Krishna22c3d412015-02-17 16:48:12 -0800859 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 """
Hari Krishna22c3d412015-02-17 16:48:12 -0800862 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
kelvin-onlab65a72d22015-03-26 13:46:32 -0700867 def CASE60( self ):
kelvin-onlab8a832582015-01-16 17:06:11 -0800868 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700869 Install 300 host intents and verify ping all (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -0800870 """
Hari Krishnab35c6d02015-03-18 11:13:51 -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
Hari Krishnaef1bd4e2015-03-12 16:55: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
kelvin-onlab54400a92015-02-26 18:05:51 -0800878 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800879
kelvin-onlab54400a92015-02-26 18:05:51 -0800880 intentIdList = []
881 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800882 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800883 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800884 for cli in main.CLIs:
885 if i >= len( hostCombos ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800886 break
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800887 t = main.Thread( target=cli.addHostIntent,
888 threadID=main.threadID,
kelvin-onlab54400a92015-02-26 18:05:51 -0800889 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()
kelvin-onlabadfc8db2015-03-24 15:52:48 -0700899 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
900
kelvin-onlab54400a92015-02-26 18:05:51 -0800901 intentResult = main.TRUE
902 intentsJson = main.ONOScli2.intents()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800903 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
kelvin-onlab54400a92015-02-26 18:05:51 -0800904 intentsJson = intentsJson)
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700905 print "len of intent ID", str(len(intentIdList))
906 print "len of intent state results", str(len(getIntentStateResult))
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800907 print getIntentStateResult
Hari Krishnab35c6d02015-03-18 11:13:51 -0700908 # Takes awhile for all the onos to get the intents
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700909 time.sleep( 15 )
910 """intentState = main.TRUE
911 for i in getIntentStateResult:
912 if getIntentStateResult.get( 'state' ) != 'INSTALLED':
913 """
914
915
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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -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
kelvin-onlab65a72d22015-03-26 13:46:32 -0700930 case60Result = ( intentResult and pingResult )
kelvin-onlab54400a92015-02-26 18:05:51 -0800931
kelvin-onlab8a832582015-01-16 17:06:11 -0800932 utilities.assert_equals(
933 expect=main.TRUE,
kelvin-onlab65a72d22015-03-26 13:46:32 -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
kelvin-onlab65a72d22015-03-26 13:46:32 -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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -0700981 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab65a72d22015-03-26 13:46:32 -0700982 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001042 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab65a72d22015-03-26 13:46:32 -07001043 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 """
Hari Krishnab35c6d02015-03-18 11:13:51 -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
Hari Krishna22c3d412015-02-17 16:48:12 -08001066 main.randomLink1 = []
1067 main.randomLink2 = []
1068 main.randomLink3 = []
kelvin-onlab65a72d22015-03-26 13:46:32 -07001069 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
Hari Krishnab35c6d02015-03-18 11:13:51 -07001078 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1079 main.log.report( "___________________________________________________________________________" )
Hari Krishnad97213e2015-01-24 19:30:14 -08001080 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 ):
Hari Krishna46997e02015-01-27 11:23:07 -08001084 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001085 #main.cleanup()
1086 #main.exit()
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001087 else:
Hari Krishnad97213e2015-01-24 19:30:14 -08001088 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" )
Hari Krishna22c3d412015-02-17 16:48:12 -08001091 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,
Hari Krishna22c3d412015-02-17 16:48:12 -08001097 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001098 OPTION="down" )
1099 main.Mininet1.link(
1100 END1=link2End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001101 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001102 OPTION="down" )
1103 main.Mininet1.link(
1104 END1=link3End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001105 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()
Hari Krishnad97213e2015-01-24 19:30:14 -08001110 linkDown = main.ONOSbench.checkStatus(
Hari Krishna22c3d412015-02-17 16:48:12 -08001111 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -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
Hari Krishna22c3d412015-02-17 16:48:12 -08001135 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 """
Hari Krishnab35c6d02015-03-18 11:13:51 -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
kelvin-onlab65a72d22015-03-26 13:46:32 -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' ] )
kelvin-onlab65a72d22015-03-26 13:46:32 -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(
Hari Krishnab35c6d02015-03-18 11:13:51 -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,
kelvin-onlab54400a92015-02-26 18:05:51 -08001161 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001162 OPTION="up" )
1163 main.Mininet1.link(
1164 END1=link2End1,
kelvin-onlab54400a92015-02-26 18:05:51 -08001165 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001166 OPTION="up" )
1167 main.Mininet1.link(
1168 END1=link3End1,
kelvin-onlab54400a92015-02-26 18:05:51 -08001169 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()
Hari Krishnad97213e2015-01-24 19:30:14 -08001174 linkUp = main.ONOSbench.checkStatus(
kelvin-onlab8a832582015-01-16 17:06:11 -08001175 topology_output,
Hari Krishna22c3d412015-02-17 16:48:12 -08001176 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -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
Hari Krishna22c3d412015-02-17 16:48:12 -08001200 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 """
kelvin-onlabfbcd82f2015-04-02 12:06:00 -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
Hari Krishna22c3d412015-02-17 16:48:12 -08001210 main.randomLink1 = []
1211 main.randomLink2 = []
1212 main.randomLink3 = []
kelvin-onlab65a72d22015-03-26 13:46:32 -07001213 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
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001222 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001223 main.log.report( "___________________________________________________________________________" )
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001224 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
Hari Krishnad97213e2015-01-24 19:30:14 -08001225 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 ):
kelvin-onlab65a72d22015-03-26 13:46:32 -07001228 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001229 #main.cleanup()
1230 #main.exit()
kelvin8ec71442015-01-15 16:57:00 -08001231 else:
kelvin-onlab65a72d22015-03-26 13:46:32 -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" )
kelvin-onlab65a72d22015-03-26 13:46:32 -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,
Hari Krishna22c3d412015-02-17 16:48:12 -08001241 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001242 OPTION="down" )
1243 main.Mininet1.link(
1244 END1=link2End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001245 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001246 OPTION="down" )
1247 main.Mininet1.link(
1248 END1=link3End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001249 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()
Hari Krishnad97213e2015-01-24 19:30:14 -08001254 linkDown = main.ONOSbench.checkStatus(
kelvin-onlab65a72d22015-03-26 13:46:32 -07001255 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -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
kelvin-onlab65a72d22015-03-26 13:46:32 -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 """
kelvin-onlabfbcd82f2015-04-02 12:06:00 -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
kelvin-onlab65a72d22015-03-26 13:46:32 -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' ] )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001293 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
kelvin8ec71442015-01-15 16:57:00 -08001294
kelvin-onlab8a832582015-01-16 17:06:11 -08001295 main.log.report(
kelvin-onlabfbcd82f2015-04-02 12:06:00 -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(
kelvin-onlab65a72d22015-03-26 13:46:32 -07001298 "__________________________________________________________________" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001299 main.case(
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001300 "Point intents - Bring the core links up that are down and verify ping all" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001301 main.step( "Bring randomly cut links on Core devices up" )
1302 for i in range( int( switchLinksToToggle ) ):
1303 main.Mininet1.link(
1304 END1=link1End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001305 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001306 OPTION="up" )
1307 main.Mininet1.link(
1308 END1=link2End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001309 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001310 OPTION="up" )
1311 main.Mininet1.link(
1312 END1=link3End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001313 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()
Hari Krishnad97213e2015-01-24 19:30:14 -08001318 linkUp = main.ONOSbench.checkStatus(
kelvin-onlab8a832582015-01-16 17:06:11 -08001319 topology_output,
Hari Krishna22c3d412015-02-17 16:48:12 -08001320 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -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
Hari Krishna22c3d412015-02-17 16:48:12 -08001344 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
Hari Krishnab35c6d02015-03-18 11:13:51 -07001349 def CASE72( self, main ):
1350 """
1351 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1352 """
1353 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 )
1375
1376 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001391 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001392 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
kelvin-onlab65a72d22015-03-26 13:46:32 -07001402 caseResult71 = pingResultLinkDown
1403 utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
Hari Krishnab35c6d02015-03-18 11:13:51 -07001404 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001446 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001447 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" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001461
Hari Krishnab35c6d02015-03-18 11:13:51 -07001462 def CASE73( self, main ):
1463 """
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001464 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001465 """
1466 import random
kelvin-onlab65a72d22015-03-26 13:46:32 -07001467 import itertools
Hari Krishnab35c6d02015-03-18 11:13:51 -07001468 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001469
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001470 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001471 main.log.report( "___________________________________________________________________________" )
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001472 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001473 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:
Hari Krishnab35c6d02015-03-18 11:13:51 -07001483 main.Mininet1.link(
1484 END1=switch[0],
1485 END2=switch[1],
kelvin-onlab65a72d22015-03-26 13:46:32 -07001486 OPTION="down")
Hari Krishnab35c6d02015-03-18 11:13:51 -07001487 time.sleep( link_sleep )
1488
1489 topology_output = main.ONOScli2.topology()
1490 linkDown = main.ONOSbench.checkStatus(
1491 topology_output, main.numMNswitches, str(
kelvin-onlab65a72d22015-03-26 13:46:32 -07001492 int( main.numMNlinks ) - 5 * 2 ) )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001493 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001504 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001505 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
kelvin-onlab65a72d22015-03-26 13:46:32 -07001515 caseResult73 = pingResultLinkDown
Hari Krishnab35c6d02015-03-18 11:13:51 -07001516 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 """
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001522 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001523 """
1524 import random
Hari Krishnab35c6d02015-03-18 11:13:51 -07001525 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001526
Hari Krishnab35c6d02015-03-18 11:13:51 -07001527 main.log.report(
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001528 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001529 main.log.report(
1530 "__________________________________________________________________" )
1531 main.case(
kelvin-onlabfbcd82f2015-04-02 12:06:00 -07001532 "Point intents - Bring the core links up that are down and verify ping all" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001533 main.step( "Bring randomly cut links on devices up" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001534
kelvin-onlab65a72d22015-03-26 13:46:32 -07001535 for switch in main.randomLinks:
Hari Krishnab35c6d02015-03-18 11:13:51 -07001536 main.Mininet1.link(
1537 END1=switch[0],
1538 END2=switch[1],
1539 OPTION="up")
kelvin-onlab65a72d22015-03-26 13:46:32 -07001540
Hari Krishnab35c6d02015-03-18 11:13:51 -07001541 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001559 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001560 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" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001574
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]
kelvin-onlab77d6c302015-03-31 11:33:32 -07001604 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
1605 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001606 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
1607 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
kelvin-onlabd878fc22015-03-27 13:33:41 -07001608
kelvin-onlab65a72d22015-03-26 13:46:32 -07001609 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001626 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab65a72d22015-03-26 13:46:32 -07001627 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
kelvin-onlab77d6c302015-03-31 11:33:32 -07001657 #main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
1658 #main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
kelvin-onlab65a72d22015-03-26 13:46:32 -07001659 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001679 pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab65a72d22015-03-26 13:46:32 -07001680 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" )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001694
1695 def CASE90( self ):
kelvin-onlab8a832582015-01-16 17:06:11 -08001696 """
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001697 Install 600 point intents and verify ping all (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -08001698 """
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001699 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001700 main.log.report( "_______________________________________" )
1701 import itertools
1702 import time
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001703 main.case( "Install 600 point intents" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001704 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 = []
Hari Krishnab35c6d02015-03-18 11:13:51 -07001709 time1 = time.time()
Hari Krishnab35c6d02015-03-18 11:13:51 -07001710 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",
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001718 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnab35c6d02015-03-18 11:13:51 -07001719 pool.append(t)
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001720 #time.sleep(1)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001721 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -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
kelvin-onlab65a72d22015-03-26 13:46:32 -07001750 case90Result = ( intentResult and pingResult )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001751
kelvin-onlab8a832582015-01-16 17:06:11 -08001752 utilities.assert_equals(
1753 expect=main.TRUE,
kelvin-onlab65a72d22015-03-26 13:46:32 -07001754 actual=case90Result,
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001755 onpass="Install 600 point Intents and Ping All test PASS",
1756 onfail="Install 600 point Intents and Ping All test FAIL" )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001757
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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001802 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001803 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
kelvin-onlab65a72d22015-03-26 13:46:32 -07001813 case91Result = ( intentResult and pingResult )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001814
1815 utilities.assert_equals(
1816 expect=main.TRUE,
kelvin-onlabd878fc22015-03-27 13:33:41 -07001817 actual=case91Result,
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001818 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 """
kelvin-onlab77d6c302015-03-31 11:33:32 -07001823 Install 4556 point intents and verify ping all (Spine Topology)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001824 """
kelvin-onlab77d6c302015-03-31 11:33:32 -07001825 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001826 main.log.report( "_______________________________________" )
1827 import itertools
1828 import time
kelvin-onlab77d6c302015-03-31 11:33:32 -07001829 main.case( "Install 4556 point intents" )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001830 main.step( "Add point Intents" )
1831 intentResult = main.TRUE
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001832 main.pingTimeout = 600
kelvin-onlab77d6c302015-03-31 11:33:32 -07001833 for i in range(len(main.hostMACs)):
1834 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
1835 print main.MACsDict
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001836 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001837 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)
kelvin-onlab77d6c302015-03-31 11:33:32 -07001862 #print getIntentStateResult
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001863 # Takes awhile for all the onos to get the intents
kelvin-onlab77d6c302015-03-31 11:33:32 -07001864 time.sleep(60)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001865 main.step( "Verify Ping across all hosts" )
1866 pingResult = main.FALSE
1867 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001868 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001869 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
kelvin-onlab65a72d22015-03-26 13:46:32 -07001879 case92Result = ( intentResult and pingResult )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001880
1881 utilities.assert_equals(
1882 expect=main.TRUE,
kelvin-onlab65a72d22015-03-26 13:46:32 -07001883 actual=case92Result,
kelvin-onlab77d6c302015-03-31 11:33:32 -07001884 onpass="Install 4556 point Intents and Ping All test PASS",
1885 onfail="Install 4556 point Intents and Ping All test FAIL" )
1886
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001887 def CASE93( self ):
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001888 """
kelvin-onlab77d6c302015-03-31 11:33:32 -07001889 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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001923 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)
kelvin-onlab06ade552015-03-31 18:09:27 -07001929 print intentIdList
kelvin-onlab4df89f22015-04-13 18:10:23 -07001930 checkIntentStateResult = main.TRUE
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001931 print "Checking intents state"
kelvin-onlab4df89f22015-04-13 18:10:23 -07001932 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
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001938 if checkIntentStateResult:
1939 main.log.info( "All intents are installed correctly " )
kelvin-onlab4df89f22015-04-13 18:10:23 -07001940
1941 print "Checking flows state "
1942 checkFlowsState = main.ONOScli1.checkFlowsState()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001943 time.sleep(50)
kelvin-onlab77d6c302015-03-31 11:33:32 -07001944 main.step( "Verify Ping across all hosts" )
1945 pingResult = main.FALSE
1946 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001947 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab77d6c302015-03-31 11:33:32 -07001948 time2 = time.time()
1949 timeDiff = round( ( time2 - time1 ), 2 )
1950 main.log.report(
1951 "Time taken for Ping All: " +
1952 str( timeDiff ) +
1953 " seconds" )
kelvin-onlab4df89f22015-04-13 18:10:23 -07001954 checkFlowsState = main.ONOScli1.checkFlowsState()
kelvin-onlab77d6c302015-03-31 11:33:32 -07001955 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
kelvin-onlab20c712a2015-03-31 12:55:34 -07001962 def CASE94( self ):
1963 """
1964 Install multi-single point intents and verify Ping all works
kelvin-onlabd9a8ed32015-04-03 13:55:28 -07001965 for Chordal topology
kelvin-onlab20c712a2015-03-31 12:55:34 -07001966 """
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()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002003 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab20c712a2015-03-31 12:55:34 -07002004 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" )
kelvin-onlab06ade552015-03-31 18:09:27 -07002017
2018 #def CASE95 multi-single point intent for Spine
2019
kelvin-onlab77d6c302015-03-31 11:33:32 -07002020 def CASE96( self ):
2021 """
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002022 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" )
kelvin-onlab06ade552015-03-31 18:09:27 -07002029 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2030 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002031 intentIdList = []
kelvin-onlab06ade552015-03-31 18:09:27 -07002032 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)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002057 main.step( "Verify Ping across all hosts" )
2058 pingResult = main.FALSE
2059 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002060 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002061 time2 = time.time()
2062 timeDiff = round( ( time2 - time1 ), 2 )
2063 main.log.report(
2064 "Time taken for Ping All: " +
2065 str( timeDiff ) +
2066 " seconds" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002067
kelvin-onlab06ade552015-03-31 18:09:27 -07002068 case96Result = pingResult
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002069 utilities.assert_equals(
2070 expect=main.TRUE,
kelvin-onlab06ade552015-03-31 18:09:27 -07002071 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" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002074
kelvin-onlab77d6c302015-03-31 11:33:32 -07002075 def CASE97( self ):
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002076 """
2077 Install single-multi point intents and verify Ping all works
kelvin-onlab06ade552015-03-31 18:09:27 -07002078 for Chordal topology
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002079 """
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" )
kelvin-onlab06ade552015-03-31 18:09:27 -07002084 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2085 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002086 intentIdList = []
kelvin-onlab06ade552015-03-31 18:09:27 -07002087 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)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002112 main.step( "Verify Ping across all hosts" )
2113 pingResult = main.FALSE
2114 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002115 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002116 time2 = time.time()
2117 timeDiff = round( ( time2 - time1 ), 2 )
2118 main.log.report(
2119 "Time taken for Ping All: " +
2120 str( timeDiff ) +
2121 " seconds" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002122
kelvin-onlab06ade552015-03-31 18:09:27 -07002123 case97Result = pingResult
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002124 utilities.assert_equals(
2125 expect=main.TRUE,
kelvin-onlab06ade552015-03-31 18:09:27 -07002126 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" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002129
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002130 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" )
2191
kelvin-onlab8a832582015-01-16 17:06:11 -08002192 def CASE10( self ):
kelvin-onlab7642bb12015-02-27 13:48:17 -08002193 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
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002216 moreIntents = main.TRUE
2217 removeIntentCount = 0
kelvin-onlab65a72d22015-03-26 13:46:32 -07002218 intentsCount = len(intentsList)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002219 print "Current number of intents" , len(intentsList)
kelvin-onlab8a832582015-01-16 17:06:11 -08002220 if ( len( intentsList ) > 1 ):
kelvin-onlab54400a92015-02-26 18:05:51 -08002221 results = main.TRUE
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002222 main.log.info("Removing intent...")
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002223 while moreIntents:
Hari Krishnab35c6d02015-03-18 11:13:51 -07002224 if removeIntentCount == 5:
2225 break
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002226 removeIntentCount = removeIntentCount + 1
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002227 intentsList1 = main.ONOScli1.getAllIntentIds()
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002228 if len( intentsList1 ) == 0:
2229 break
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002230 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()
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002240 intentsList1 = intentsList1[ 1: ]
2241 print "Round %d intents to remove: " %(removeIntentCount)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002242 print intentsList1
2243 intentIdList1 = []
Hari Krishnab35c6d02015-03-18 11:13:51 -07002244 if ( len( intentsList1 ) > 0 ):
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002245 moreIntents = main.TRUE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002246 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)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07002251 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)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07002262 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))
Hari Krishnab35c6d02015-03-18 11:13:51 -07002270 time.sleep(10)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002271 else:
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07002272 time.sleep(15)
Hari Krishnab35c6d02015-03-18 11:13:51 -07002273 if len( main.ONOScli1.intents()):
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07002274 continue
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002275 break
kelvin-onlab36c02b12015-03-11 11:25:55 -07002276
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002277 else:
kelvin-onlab65a72d22015-03-26 13:46:32 -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
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002283
kelvin-onlabdc8719b2015-03-02 14:01:52 -08002284 print main.ONOScli1.intents()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002285 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" )
Hari Krishna22c3d412015-02-17 16:48:12 -08002289
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002290 def CASE12( self, main ):
Hari Krishna22c3d412015-02-17 16:48:12 -08002291 """
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
kelvin-onlab54400a92015-02-26 18:05:51 -08002298 Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
2299 threadID = 0
2300
Hari Krishna22c3d412015-02-17 16:48:12 -08002301 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" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002305 installResult = main.FALSE
2306 feature = "onos-app-ifwd"
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002307
kelvin-onlab54400a92015-02-26 18:05:51 -08002308 pool = []
2309 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002310 for cli,feature in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -08002311 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")
Hari Krishnab35c6d02015-03-18 11:13:51 -07002325 #main.cleanup()
2326 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -08002327 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
Hari Krishna22c3d412015-02-17 16:48:12 -08002332 main.step( "Verify Pingall" )
2333 ping_result = main.FALSE
2334 time1 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -08002335 ping_result = main.Mininet1.pingall(timeout=600)
Hari Krishna22c3d412015-02-17 16:48:12 -08002336 time2 = time.time()
2337 timeDiff = round( ( time2 - time1 ), 2 )
2338 main.log.report(
2339 "Time taken for Ping All: " +
2340 str( timeDiff ) +
2341 " seconds" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002342
Hari Krishna22c3d412015-02-17 16:48:12 -08002343 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" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002349 uninstallResult = main.FALSE
2350
kelvin-onlab54400a92015-02-26 18:05:51 -08002351 pool = []
2352 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002353 for cli,feature in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -08002354 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")
Hari Krishnab35c6d02015-03-18 11:13:51 -07002368 uninstallResult = main.FALSE
2369 #main.cleanup()
2370 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -08002371 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))
Hari Krishna22c3d412015-02-17 16:48:12 -08002375
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
Hari Krishnab35c6d02015-03-18 11:13:51 -07002384 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
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002445
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002446
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002447