blob: 547cb0a7ebbc452ecaa989050c723ec0bf931096 [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-onlabc2dcd3f2015-04-09 16:40:02 -0700568 ping_result = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
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-onlabc2dcd3f2015-04-09 16:40:02 -0700648 ping_result = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
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-onlabc2dcd3f2015-04-09 16:40:02 -0700728 ping_result = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
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-onlabc2dcd3f2015-04-09 16:40:02 -07001930 print "Checking intents state"
1931 checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList )
1932 #checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList )
1933 #checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList )
1934 #checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList )
1935 #checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList )
1936 if checkIntentStateResult:
1937 main.log.info( "All intents are installed correctly " )
1938 time.sleep(50)
kelvin-onlab77d6c302015-03-31 11:33:32 -07001939 main.step( "Verify Ping across all hosts" )
1940 pingResult = main.FALSE
1941 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001942 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab77d6c302015-03-31 11:33:32 -07001943 time2 = time.time()
1944 timeDiff = round( ( time2 - time1 ), 2 )
1945 main.log.report(
1946 "Time taken for Ping All: " +
1947 str( timeDiff ) +
1948 " seconds" )
1949
1950 case93Result = pingResult
1951 utilities.assert_equals(
1952 expect=main.TRUE,
1953 actual=case93Result,
1954 onpass="Install 25 multi to single point Intents and Ping All test PASS",
1955 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
1956
kelvin-onlab20c712a2015-03-31 12:55:34 -07001957 def CASE94( self ):
1958 """
1959 Install multi-single point intents and verify Ping all works
kelvin-onlabd9a8ed32015-04-03 13:55:28 -07001960 for Chordal topology
kelvin-onlab20c712a2015-03-31 12:55:34 -07001961 """
1962 import copy
1963 import time
1964 main.log.report( "Install multi-single point intents and verify Ping all" )
1965 main.log.report( "___________________________________________" )
1966 main.case( "Install multi-single point intents and Ping all" )
1967 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
1968 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
1969 intentIdList = []
1970 print "MACsDict", main.MACsDict
1971 time1 = time.time()
1972 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
1973 pool = []
1974 for cli in main.CLIs:
1975 egressDevice = deviceDPIDsCopy[i]
1976 ingressDeviceList = copy.copy(deviceDPIDsCopy)
1977 ingressDeviceList.remove(egressDevice)
1978 if i >= len( deviceDPIDsCopy ):
1979 break
1980 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
1981 threadID=main.threadID,
1982 name="addMultipointToSinglepointIntent",
1983 args =[ingressDeviceList,egressDevice,portIngressList,'1','IPV4','',main.MACsDict.get(egressDevice)])
1984 pool.append(t)
1985 #time.sleep(1)
1986 t.start()
1987 i = i + 1
1988 main.threadID = main.threadID + 1
1989 for thread in pool:
1990 thread.join()
1991 intentIdList.append(thread.result)
1992 time2 = time.time()
1993 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1994 time.sleep(5)
1995 main.step( "Verify Ping across all hosts" )
1996 pingResult = main.FALSE
1997 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07001998 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlab20c712a2015-03-31 12:55:34 -07001999 time2 = time.time()
2000 timeDiff = round( ( time2 - time1 ), 2 )
2001 main.log.report(
2002 "Time taken for Ping All: " +
2003 str( timeDiff ) +
2004 " seconds" )
2005
2006 case94Result = pingResult
2007 utilities.assert_equals(
2008 expect=main.TRUE,
2009 actual=case94Result,
2010 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2011 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
kelvin-onlab06ade552015-03-31 18:09:27 -07002012
2013 #def CASE95 multi-single point intent for Spine
2014
kelvin-onlab77d6c302015-03-31 11:33:32 -07002015 def CASE96( self ):
2016 """
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002017 Install single-multi point intents and verify Ping all works
2018 for att topology
2019 """
2020 import copy
2021 main.log.report( "Install single-multi point intents and verify Ping all" )
2022 main.log.report( "___________________________________________" )
2023 main.case( "Install single-multi point intents and Ping all" )
kelvin-onlab06ade552015-03-31 18:09:27 -07002024 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2025 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002026 intentIdList = []
kelvin-onlab06ade552015-03-31 18:09:27 -07002027 print "MACsDict", main.MACsDict
2028 time1 = time.time()
2029 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2030 pool = []
2031 for cli in main.CLIs:
2032 ingressDevice = deviceDPIDsCopy[i]
2033 egressDeviceList = copy.copy(deviceDPIDsCopy)
2034 egressDeviceList.remove(ingressDevice)
2035 if i >= len( deviceDPIDsCopy ):
2036 break
2037 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2038 threadID=main.threadID,
2039 name="addSinglepointToMultipointIntent",
2040 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice)])
2041 pool.append(t)
2042 #time.sleep(1)
2043 t.start()
2044 i = i + 1
2045 main.threadID = main.threadID + 1
2046 for thread in pool:
2047 thread.join()
2048 intentIdList.append(thread.result)
2049 time2 = time.time()
2050 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2051 time.sleep(5)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002052 main.step( "Verify Ping across all hosts" )
2053 pingResult = main.FALSE
2054 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002055 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002056 time2 = time.time()
2057 timeDiff = round( ( time2 - time1 ), 2 )
2058 main.log.report(
2059 "Time taken for Ping All: " +
2060 str( timeDiff ) +
2061 " seconds" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002062
kelvin-onlab06ade552015-03-31 18:09:27 -07002063 case96Result = pingResult
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002064 utilities.assert_equals(
2065 expect=main.TRUE,
kelvin-onlab06ade552015-03-31 18:09:27 -07002066 actual=case96Result,
2067 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2068 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002069
kelvin-onlab77d6c302015-03-31 11:33:32 -07002070 def CASE97( self ):
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002071 """
2072 Install single-multi point intents and verify Ping all works
kelvin-onlab06ade552015-03-31 18:09:27 -07002073 for Chordal topology
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002074 """
2075 import copy
2076 main.log.report( "Install single-multi point intents and verify Ping all" )
2077 main.log.report( "___________________________________________" )
2078 main.case( "Install single-multi point intents and Ping all" )
kelvin-onlab06ade552015-03-31 18:09:27 -07002079 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
2080 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002081 intentIdList = []
kelvin-onlab06ade552015-03-31 18:09:27 -07002082 print "MACsDict", main.MACsDict
2083 time1 = time.time()
2084 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2085 pool = []
2086 for cli in main.CLIs:
2087 ingressDevice = deviceDPIDsCopy[i]
2088 egressDeviceList = copy.copy(deviceDPIDsCopy)
2089 egressDeviceList.remove(ingressDevice)
2090 if i >= len( deviceDPIDsCopy ):
2091 break
2092 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2093 threadID=main.threadID,
2094 name="addSinglepointToMultipointIntent",
2095 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',main.MACsDict.get(ingressDevice),''])
2096 pool.append(t)
2097 #time.sleep(1)
2098 t.start()
2099 i = i + 1
2100 main.threadID = main.threadID + 1
2101 for thread in pool:
2102 thread.join()
2103 intentIdList.append(thread.result)
2104 time2 = time.time()
2105 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2106 time.sleep(5)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002107 main.step( "Verify Ping across all hosts" )
2108 pingResult = main.FALSE
2109 time1 = time.time()
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002110 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002111 time2 = time.time()
2112 timeDiff = round( ( time2 - time1 ), 2 )
2113 main.log.report(
2114 "Time taken for Ping All: " +
2115 str( timeDiff ) +
2116 " seconds" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002117
kelvin-onlab06ade552015-03-31 18:09:27 -07002118 case97Result = pingResult
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002119 utilities.assert_equals(
2120 expect=main.TRUE,
kelvin-onlab06ade552015-03-31 18:09:27 -07002121 actual=case97Result,
2122 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2123 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002124
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002125 def CASE98( self ):
2126 """
2127 Install single-multi point intents and verify Ping all works
2128 for Spine topology
2129 """
2130 import copy
2131 main.log.report( "Install single-multi point intents and verify Ping all" )
2132 main.log.report( "___________________________________________" )
2133 main.case( "Install single-multi point intents and Ping all" )
2134 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2135 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
2136 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
2137 intentIdList = []
2138 MACsDictCopy = {}
2139 for i in range( len( deviceDPIDsCopy ) ):
2140 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
2141
2142 print "deviceDPIDsCopy", deviceDPIDsCopy
2143 print ""
2144 print "MACsDictCopy", MACsDictCopy
2145 time1 = time.time()
2146 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
2147 pool = []
2148 for cli in main.CLIs:
2149 if i >= len( deviceDPIDsCopy ):
2150 break
2151 ingressDevice = deviceDPIDsCopy[i]
2152 egressDeviceList = copy.copy(deviceDPIDsCopy)
2153 egressDeviceList.remove(ingressDevice)
2154 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
2155 threadID=main.threadID,
2156 name="addSinglepointToMultipointIntent",
2157 args =[ingressDevice,egressDeviceList,'1',portEgressList,'IPV4',MACsDictCopy.get(ingressDevice),''])
2158 pool.append(t)
2159 #time.sleep(1)
2160 t.start()
2161 i = i + 1
2162 main.threadID = main.threadID + 1
2163 for thread in pool:
2164 thread.join()
2165 intentIdList.append(thread.result)
2166 time2 = time.time()
2167 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
2168 time.sleep(5)
2169 main.step( "Verify Ping across all hosts" )
2170 pingResult = main.FALSE
2171 time1 = time.time()
2172 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=True,acceptableFailed=5)
2173 time2 = time.time()
2174 timeDiff = round( ( time2 - time1 ), 2 )
2175 main.log.report(
2176 "Time taken for Ping All: " +
2177 str( timeDiff ) +
2178 " seconds" )
2179
2180 case98Result = pingResult
2181 utilities.assert_equals(
2182 expect=main.TRUE,
2183 actual=case98Result,
2184 onpass="Install 25 single to multi point Intents and Ping All test PASS",
2185 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
2186
kelvin-onlab8a832582015-01-16 17:06:11 -08002187 def CASE10( self ):
kelvin-onlab7642bb12015-02-27 13:48:17 -08002188 import time
kelvin-onlab8a832582015-01-16 17:06:11 -08002189 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002190 Remove all Intents
kelvin-onlab8a832582015-01-16 17:06:11 -08002191 """
2192 main.log.report( "Remove all intents that were installed previously" )
2193 main.log.report( "______________________________________________" )
2194 main.log.info( "Remove all intents" )
2195 main.case( "Removing intents" )
2196 main.step( "Obtain the intent id's first" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002197 intentsList = main.ONOScli1.getAllIntentIds()
kelvin-onlab8a832582015-01-16 17:06:11 -08002198 ansi_escape = re.compile( r'\x1b[^m]*m' )
2199 intentsList = ansi_escape.sub( '', intentsList )
2200 intentsList = intentsList.replace(
2201 " onos:intents | grep id=",
2202 "" ).replace(
2203 "id=",
2204 "" ).replace(
2205 "\r\r",
2206 "" )
2207 intentsList = intentsList.splitlines()
2208 intentsList = intentsList[ 1: ]
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002209 intentIdList = []
2210 step1Result = main.TRUE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002211 moreIntents = main.TRUE
2212 removeIntentCount = 0
kelvin-onlab65a72d22015-03-26 13:46:32 -07002213 intentsCount = len(intentsList)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002214 print "Current number of intents" , len(intentsList)
kelvin-onlab8a832582015-01-16 17:06:11 -08002215 if ( len( intentsList ) > 1 ):
kelvin-onlab54400a92015-02-26 18:05:51 -08002216 results = main.TRUE
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002217 main.log.info("Removing intent...")
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002218 while moreIntents:
Hari Krishnab35c6d02015-03-18 11:13:51 -07002219 if removeIntentCount == 5:
2220 break
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002221 removeIntentCount = removeIntentCount + 1
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002222 intentsList1 = main.ONOScli1.getAllIntentIds()
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002223 if len( intentsList1 ) == 0:
2224 break
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002225 ansi_escape = re.compile( r'\x1b[^m]*m' )
2226 intentsList1 = ansi_escape.sub( '', intentsList1 )
2227 intentsList1 = intentsList1.replace(
2228 " onos:intents | grep id=",
2229 "" ).replace(
2230 " state=",
2231 "" ).replace(
2232 "\r\r",
2233 "" )
2234 intentsList1 = intentsList1.splitlines()
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002235 intentsList1 = intentsList1[ 1: ]
2236 print "Round %d intents to remove: " %(removeIntentCount)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002237 print intentsList1
2238 intentIdList1 = []
Hari Krishnab35c6d02015-03-18 11:13:51 -07002239 if ( len( intentsList1 ) > 0 ):
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07002240 moreIntents = main.TRUE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002241 for i in range( len( intentsList1 ) ):
2242 intentsTemp1 = intentsList1[ i ].split( ',' )
2243 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
2244 print "Leftover Intent IDs: ", intentIdList1
2245 print len(intentIdList1)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07002246 time1 = time.time()
2247 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
2248 pool = []
2249 for cli in main.CLIs:
2250 if i >= len( intentIdList1 ):
2251 break
2252 t = main.Thread( target=cli.removeIntent,
2253 threadID=main.threadID,
2254 name="removeIntent",
2255 args=[intentIdList1[i],'org.onosproject.cli',True,False])
2256 pool.append(t)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07002257 t.start()
2258 i = i + 1
2259 main.threadID = main.threadID + 1
2260 for thread in pool:
2261 thread.join()
2262 intentIdList.append(thread.result)
2263 time2 = time.time()
2264 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnab35c6d02015-03-18 11:13:51 -07002265 time.sleep(10)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002266 else:
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07002267 time.sleep(15)
Hari Krishnab35c6d02015-03-18 11:13:51 -07002268 if len( main.ONOScli1.intents()):
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07002269 continue
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002270 break
kelvin-onlab36c02b12015-03-11 11:25:55 -07002271
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002272 else:
kelvin-onlab65a72d22015-03-26 13:46:32 -07002273 print "Removed %d intents" %(intentsCount)
Hari Krishnaa43d4e92014-12-19 13:22:40 -08002274 step1Result = main.TRUE
2275 else:
2276 print "No Intent IDs found in Intents list: ", intentsList
2277 step1Result = main.FALSE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002278
kelvin-onlabdc8719b2015-03-02 14:01:52 -08002279 print main.ONOScli1.intents()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002280 caseResult10 = step1Result
2281 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
kelvin-onlab8a832582015-01-16 17:06:11 -08002282 onpass="Intent removal test successful",
2283 onfail="Intent removal test failed" )
Hari Krishna22c3d412015-02-17 16:48:12 -08002284
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002285 def CASE12( self, main ):
Hari Krishna22c3d412015-02-17 16:48:12 -08002286 """
2287 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
2288 """
2289 import re
2290 import copy
2291 import time
2292
kelvin-onlab54400a92015-02-26 18:05:51 -08002293 Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
2294 threadID = 0
2295
Hari Krishna22c3d412015-02-17 16:48:12 -08002296 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
2297 main.log.report( "_____________________________________________________" )
2298 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
2299 main.step( "Enable intent based Reactive forwarding" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002300 installResult = main.FALSE
2301 feature = "onos-app-ifwd"
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002302
kelvin-onlab54400a92015-02-26 18:05:51 -08002303 pool = []
2304 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002305 for cli,feature in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -08002306 t = main.Thread(target=cli,threadID=threadID,
2307 name="featureInstall",args=[feature])
2308 pool.append(t)
2309 t.start()
2310 threadID = threadID + 1
2311
2312 results = []
2313 for thread in pool:
2314 thread.join()
2315 results.append(thread.result)
2316 time2 = time.time()
2317
2318 if( all(result == main.TRUE for result in results) == False):
2319 main.log.info("Did not install onos-app-ifwd feature properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -07002320 #main.cleanup()
2321 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -08002322 else:
2323 main.log.info("Successful feature:install onos-app-ifwd")
2324 installResult = main.TRUE
2325 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
2326
Hari Krishna22c3d412015-02-17 16:48:12 -08002327 main.step( "Verify Pingall" )
2328 ping_result = main.FALSE
2329 time1 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -08002330 ping_result = main.Mininet1.pingall(timeout=600)
Hari Krishna22c3d412015-02-17 16:48:12 -08002331 time2 = time.time()
2332 timeDiff = round( ( time2 - time1 ), 2 )
2333 main.log.report(
2334 "Time taken for Ping All: " +
2335 str( timeDiff ) +
2336 " seconds" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002337
Hari Krishna22c3d412015-02-17 16:48:12 -08002338 if ping_result == main.TRUE:
2339 main.log.report( "Pingall Test in Reactive mode successful" )
2340 else:
2341 main.log.report( "Pingall Test in Reactive mode failed" )
2342
2343 main.step( "Disable Intent based Reactive forwarding" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002344 uninstallResult = main.FALSE
2345
kelvin-onlab54400a92015-02-26 18:05:51 -08002346 pool = []
2347 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002348 for cli,feature in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -08002349 t = main.Thread(target=cli,threadID=threadID,
2350 name="featureUninstall",args=[feature])
2351 pool.append(t)
2352 t.start()
2353 threadID = threadID + 1
2354
2355 results = []
2356 for thread in pool:
2357 thread.join()
2358 results.append(thread.result)
2359 time2 = time.time()
2360
2361 if( all(result == main.TRUE for result in results) == False):
2362 main.log.info("Did not uninstall onos-app-ifwd feature properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -07002363 uninstallResult = main.FALSE
2364 #main.cleanup()
2365 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -08002366 else:
2367 main.log.info("Successful feature:uninstall onos-app-ifwd")
2368 uninstallResult = main.TRUE
2369 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
Hari Krishna22c3d412015-02-17 16:48:12 -08002370
2371 # Waiting for reative flows to be cleared.
2372 time.sleep( 10 )
2373
2374 case11Result = installResult and ping_result and uninstallResult
2375 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
2376 onpass="Intent based Reactive forwarding Pingall test PASS",
2377 onfail="Intent based Reactive forwarding Pingall test FAIL" )
2378
Hari Krishnab35c6d02015-03-18 11:13:51 -07002379 def CASE99(self):
2380 import time
2381 # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
2382 main.step( "Stop ONOS on all Nodes" )
2383 stopResult = main.TRUE
2384 for i in range( 1, int( main.numCtrls ) + 1 ):
2385 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2386 main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
2387 sresult = main.ONOSbench.onosStop( ONOS_ip )
2388 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2389 onpass="Test step PASS",
2390 onfail="Test step FAIL" )
2391 stopResult = ( stopResult and sresult )
2392
2393 main.step( "Start ONOS on all Nodes" )
2394 startResult = main.TRUE
2395 for i in range( 1, int( main.numCtrls ) + 1 ):
2396 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2397 main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
2398 sresult = main.ONOSbench.onosStart( ONOS_ip )
2399 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2400 onpass="Test step PASS",
2401 onfail="Test step FAIL" )
2402 startResult = ( startResult and sresult )
2403
2404 main.step( "Start ONOS CLI on all nodes" )
2405 cliResult = main.TRUE
2406 time.sleep( 30 )
2407 main.log.step(" Start ONOS cli using thread ")
2408 pool = []
2409 time1 = time.time()
2410 for i in range( int( main.numCtrls ) ):
2411 t = main.Thread(target=main.CLIs[i].startOnosCli,
2412 threadID=main.threadID,
2413 name="startOnosCli",
2414 args=[main.nodes[i].ip_address])
2415 pool.append(t)
2416 t.start()
2417 main.threadID = main.threadID + 1
2418 for t in pool:
2419 t.join()
2420 cliResult = cliResult and t.result
2421 time2 = time.time()
2422
2423 if not cliResult:
2424 main.log.info("ONOS CLI did not start up properly")
2425 #main.cleanup()
2426 #main.exit()
2427 else:
2428 main.log.info("Successful CLI startup")
2429 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
2430
2431 case99Result = ( startResult and cliResult )
2432 time.sleep(30)
2433 utilities.assert_equals(
2434 expect=main.TRUE,
2435 actual=case99Result,
2436 onpass="Starting new Chordal topology test PASS",
2437 onfail="Starting new Chordal topology test FAIL" )
2438
2439
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002440
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002441
kelvin-onlabc2dcd3f2015-04-09 16:40:02 -07002442