blob: 403cc460c2b573e410b78948d44a27991fef1d65 [file] [log] [blame]
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001import time
2import 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",
144 args=[ main.nodes[i].ip_address ] )
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" )
kelvin-onlab01f1b2c2015-03-11 10:41:06 -0700166 time.sleep(30)
Hari Krishnab35c6d02015-03-18 11:13:51 -0700167
kelvin-onlab8a832582015-01-16 17:06:11 -0800168 def CASE2( self, main ):
169 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700170 This test script Loads a new Topology (Att) on CHO setup and balances all switches
kelvin-onlab8a832582015-01-16 17:06:11 -0800171 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800172 import re
173 import time
174 import copy
Hari Krishnab35c6d02015-03-18 11:13:51 -0700175
Hari Krishna22c3d412015-02-17 16:48:12 -0800176 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
177 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
178 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700179 main.pingTimeout = 60
kelvin-onlab8a832582015-01-16 17:06:11 -0800180 main.log.report(
Hari Krishnab35c6d02015-03-18 11:13:51 -0700181 "Load Att topology and Balance all Mininet switches across controllers" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800182 main.log.report(
Hari Krishnab35c6d02015-03-18 11:13:51 -0700183 "________________________________________________________________________" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800184 main.case(
185 "Assign and Balance all Mininet switches across controllers" )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700186 main.step( "Stop any previous Mininet network topology" )
187 cliResult = main.TRUE
188 if main.newTopo == main.params['TOPO3']['topo']:
189 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
190
191 main.step( "Start Mininet with Att topology" )
192 main.newTopo = main.params['TOPO1']['topo']
193 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
194
kelvin-onlab8a832582015-01-16 17:06:11 -0800195 main.step( "Assign switches to controllers" )
Hari Krishna22c3d412015-02-17 16:48:12 -0800196 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
Hari Krishnad97213e2015-01-24 19:30:14 -0800197 main.Mininet1.assignSwController(
kelvin-onlab8a832582015-01-16 17:06:11 -0800198 sw=str( i ),
Hari Krishna22c3d412015-02-17 16:48:12 -0800199 count=int( main.numCtrls ),
200 ip1=main.ONOS1_ip,
201 port1=main.ONOS1_port,
202 ip2=main.ONOS2_ip,
203 port2=main.ONOS2_port,
204 ip3=main.ONOS3_ip,
205 port3=main.ONOS3_port,
206 ip4=main.ONOS4_ip,
207 port4=main.ONOS4_port,
208 ip5=main.ONOS5_ip,
209 port5=main.ONOS5_port )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800210
211 switch_mastership = main.TRUE
Hari Krishna22c3d412015-02-17 16:48:12 -0800212 for i in range( 1, ( main.numMNswitches + 1 ) ):
Hari Krishnad97213e2015-01-24 19:30:14 -0800213 response = main.Mininet1.getSwController( "s" + str( i ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800214 print( "Response is " + str( response ) )
Hari Krishna22c3d412015-02-17 16:48:12 -0800215 if re.search( "tcp:" + main.ONOS1_ip, response ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800216 switch_mastership = switch_mastership and main.TRUE
217 else:
218 switch_mastership = main.FALSE
219
220 if switch_mastership == main.TRUE:
kelvin-onlab8a832582015-01-16 17:06:11 -0800221 main.log.report( "Controller assignment successfull" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800222 else:
kelvin-onlab8a832582015-01-16 17:06:11 -0800223 main.log.report( "Controller assignment failed" )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700224 time.sleep( 5 )
225 #Don't balance master for now..
226 """
227 main.step( "Balance devices across controllers" )
228 for i in range( int( main.numCtrls ) ):
229 balanceResult = main.ONOScli1.balanceMasters()
kelvin-onlab8a832582015-01-16 17:06:11 -0800230 # giving some breathing time for ONOS to complete re-balance
Hari Krishnab35c6d02015-03-18 11:13:51 -0700231 time.sleep( 3 )
232 """
233 case2Result = ( switch_mastership and startStatus )
234 time.sleep(45)
235 utilities.assert_equals(
236 expect=main.TRUE,
237 actual=case2Result,
238 onpass="Starting new Att topology test PASS",
239 onfail="Starting new Att topology test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800240
kelvin-onlab8a832582015-01-16 17:06:11 -0800241 def CASE3( self, main ):
242 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800243 This Test case will be extended to collect and store more data related
244 ONOS state.
kelvin-onlab8a832582015-01-16 17:06:11 -0800245 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800246 import re
247 import copy
Hari Krishna22c3d412015-02-17 16:48:12 -0800248 main.deviceDPIDs = []
249 main.hostMACs = []
250 main.deviceLinks = []
251 main.deviceActiveLinksCount = []
252 main.devicePortsEnabledCount = []
kelvin-onlab54400a92015-02-26 18:05:51 -0800253
kelvin-onlab8a832582015-01-16 17:06:11 -0800254 main.log.report(
255 "Collect and Store topology details from ONOS before running any Tests" )
256 main.log.report(
257 "____________________________________________________________________" )
Hari Krishna5afb4cc2015-03-23 15:35:15 -0700258 main.case( "Collect and Store Topology Details from ONOS" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800259 main.step( "Collect and store current number of switches and links" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800260 topology_output = main.ONOScli1.topology()
Hari Krishnad97213e2015-01-24 19:30:14 -0800261 topology_result = main.ONOSbench.getTopology( topology_output )
Hari Krishnaef1bd4e2015-03-12 16:55:30 -0700262 numOnosDevices = topology_result[ 'deviceCount' ]
263 numOnosLinks = topology_result[ 'linkCount' ]
Hari Krishnab35c6d02015-03-18 11:13:51 -0700264 topoResult = main.TRUE
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800265
kelvin-onlab54400a92015-02-26 18:05:51 -0800266 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks >= int(numOnosLinks) ) ):
Hari Krishna22c3d412015-02-17 16:48:12 -0800267 main.step( "Store Device DPIDs" )
268 for i in range( 1, (main.numMNswitches+1) ):
269 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
270 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800271
Hari Krishna22c3d412015-02-17 16:48:12 -0800272 main.step( "Store Host MACs" )
273 for i in range( 1, ( main.numMNhosts + 1 ) ):
274 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
275 print "Host MACs in Store: \n", str( main.hostMACs )
Hari Krishna5afb4cc2015-03-23 15:35:15 -0700276 main.MACsDict = {}
277 for i in range(len(main.deviceDPIDs)):
278 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
279 print main.MACsDict
Hari Krishna22c3d412015-02-17 16:48:12 -0800280 main.step( "Collect and store all Devices Links" )
281 linksResult = main.ONOScli1.links( jsonFormat=False )
282 ansi_escape = re.compile( r'\x1b[^m]*m' )
283 linksResult = ansi_escape.sub( '', linksResult )
284 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
285 linksResult = linksResult.splitlines()
286 linksResult = linksResult[ 1: ]
287 main.deviceLinks = copy.copy( linksResult )
288 print "Device Links Stored: \n", str( main.deviceLinks )
289 # this will be asserted to check with the params provided count of
290 # links
291 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800292
Hari Krishna22c3d412015-02-17 16:48:12 -0800293 main.step( "Collect and store each Device ports enabled Count" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800294 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800295 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800296 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800297 for cli in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -0800298 dpid = "of:00000000000000" + format( i,'02x' )
299 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
300 t.start()
301 pool.append(t)
302 i = i + 1
303 main.threadID = main.threadID + 1
304 for thread in pool:
305 thread.join()
306 portResult = thread.result
307 portTemp = re.split( r'\t+', portResult )
308 portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
309 main.devicePortsEnabledCount.append( portCount )
Hari Krishna22c3d412015-02-17 16:48:12 -0800310 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
kelvin-onlab54400a92015-02-26 18:05:51 -0800311 time2 = time.time()
312 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800313
Hari Krishna22c3d412015-02-17 16:48:12 -0800314 main.step( "Collect and store each Device active links Count" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800315 time1 = time.time()
316
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800317 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800318 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800319 for cli in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -0800320 dpid = "of:00000000000000" + format( i,'02x' )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800321 t = main.Thread( target = cli.getDeviceLinksActiveCount,
322 threadID = main.threadID,
323 name = "getDevicePortsEnabledCount",
324 args = [dpid])
kelvin-onlab54400a92015-02-26 18:05:51 -0800325 t.start()
326 pool.append(t)
327 i = i + 1
328 main.threadID = main.threadID + 1
329 for thread in pool:
330 thread.join()
331 linkCountResult = thread.result
332 linkCountTemp = re.split( r'\t+', linkCountResult )
333 linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
334 main.deviceActiveLinksCount.append( linkCount )
335 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
336 time2 = time.time()
337 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishna22c3d412015-02-17 16:48:12 -0800338
339 else:
340 main.log.info("Devices (expected): %s, Links (expected): %s" %
341 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
342 main.log.info("Devices (actual): %s, Links (actual): %s" %
343 ( numOnosDevices , numOnosLinks ) )
344 main.log.info("Topology does not match, exiting CHO test...")
Hari Krishnab35c6d02015-03-18 11:13:51 -0700345 topoResult = main.FALSE
346
kelvin-onlab54400a92015-02-26 18:05:51 -0800347 #time.sleep(300)
Hari Krishnab35c6d02015-03-18 11:13:51 -0700348 #main.cleanup()
349 #main.exit()
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800350
kelvin-onlab8a832582015-01-16 17:06:11 -0800351 # just returning TRUE for now as this one just collects data
Hari Krishnab35c6d02015-03-18 11:13:51 -0700352 case3Result = topoResult
Hari Krishna22c3d412015-02-17 16:48:12 -0800353 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800354 onpass="Saving ONOS topology data test PASS",
355 onfail="Saving ONOS topology data test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800356
kelvin-onlab8a832582015-01-16 17:06:11 -0800357 def CASE4( self, main ):
358 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700359 Verify Reactive forwarding (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -0800360 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800361 import re
362 import copy
363 import time
Hari Krishnab35c6d02015-03-18 11:13:51 -0700364 main.log.report( "Verify Reactive forwarding (Att Topology)" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800365 main.log.report( "______________________________________________" )
366 main.case( "Enable Reactive forwarding and Verify ping all" )
367 main.step( "Enable Reactive forwarding" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800368 installResult = main.TRUE
kelvin-onlab54400a92015-02-26 18:05:51 -0800369 feature = "onos-app-fwd"
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800370
kelvin-onlab54400a92015-02-26 18:05:51 -0800371 pool = []
372 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800373 for cli in main.CLIs:
374 t = main.Thread( target=cli.featureInstall,
375 threadID=main.threadID,
376 name="featureInstall",
377 args=['onos-app-fwd'])
kelvin-onlab54400a92015-02-26 18:05:51 -0800378 pool.append(t)
379 t.start()
380 main.threadID = main.threadID + 1
381
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800382 installResult = main.TRUE
383 for t in pool:
384 t.join()
385 installResult = installResult and t.result
kelvin-onlab54400a92015-02-26 18:05:51 -0800386 time2 = time.time()
387
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800388 if not installResult:
kelvin-onlab54400a92015-02-26 18:05:51 -0800389 main.log.info("Did not install onos-app-fwd feature properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -0700390 #main.cleanup()
391 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -0800392 else:
393 main.log.info("Successful feature:install onos-app-fwd")
kelvin-onlab54400a92015-02-26 18:05:51 -0800394 main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1))
395
kelvin-onlab8a832582015-01-16 17:06:11 -0800396 time.sleep( 5 )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800397
kelvin-onlab8a832582015-01-16 17:06:11 -0800398 main.step( "Verify Pingall" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800399 ping_result = main.FALSE
400 time1 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -0800401 ping_result = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800402 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800403 timeDiff = round( ( time2 - time1 ), 2 )
404 main.log.report(
405 "Time taken for Ping All: " +
406 str( timeDiff ) +
407 " seconds" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800408
409 if ping_result == main.TRUE:
kelvin-onlab8a832582015-01-16 17:06:11 -0800410 main.log.report( "Pingall Test in Reactive mode successful" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800411 else:
kelvin-onlab8a832582015-01-16 17:06:11 -0800412 main.log.report( "Pingall Test in Reactive mode failed" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800413
kelvin-onlab8a832582015-01-16 17:06:11 -0800414 main.step( "Disable Reactive forwarding" )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800415 uninstallResult = main.TRUE
kelvin-onlab54400a92015-02-26 18:05:51 -0800416 pool = []
417 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800418 for cli in main.CLIs:
419 t = main.Thread( target=cli.featureUninstall,
420 threadID=main.threadID,
421 name="featureUninstall",
422 args=['onos-app-fwd'])
kelvin-onlab54400a92015-02-26 18:05:51 -0800423 pool.append(t)
424 t.start()
425 main.threadID = main.threadID + 1
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800426 for t in pool:
427 t.join()
428 uninstallResult = uninstallResult and t.result
kelvin-onlab54400a92015-02-26 18:05:51 -0800429 time2 = time.time()
430
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800431 if not uninstallResult:
kelvin-onlab54400a92015-02-26 18:05:51 -0800432 main.log.info("Did not uninstall onos-app-fwd feature properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -0700433 #main.cleanup()
434 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -0800435 else:
436 main.log.info("Successful feature:uninstall onos-app-fwd")
kelvin-onlab54400a92015-02-26 18:05:51 -0800437 main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1))
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800438
kelvin-onlab8a832582015-01-16 17:06:11 -0800439 # Waiting for reative flows to be cleared.
Hari Krishnab35c6d02015-03-18 11:13:51 -0700440 time.sleep( 20 )
441 case4Result = installResult and uninstallResult and ping_result
442 utilities.assert_equals( expect=main.TRUE, actual=case4Result,
443 onpass="Reactive Mode Pingall test PASS",
444 onfail="Reactive Mode Pingall test FAIL" )
445
446 def CASE41( self, main ):
447 """
448 Verify Reactive forwarding (Chordal Topology)
449 """
450 import re
451 import copy
452 import time
453 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
454 main.log.report( "______________________________________________" )
455 main.case( "Enable Reactive forwarding and Verify ping all" )
456 main.step( "Enable Reactive forwarding" )
457 installResult = main.TRUE
458 feature = "onos-app-fwd"
459
460 pool = []
461 time1 = time.time()
462 for cli in main.CLIs:
463 t = main.Thread( target=cli.featureInstall,
464 threadID=main.threadID,
465 name="featureInstall",
466 args=['onos-app-fwd'])
467 pool.append(t)
468 t.start()
469 main.threadID = main.threadID + 1
470
471 installResult = main.TRUE
472 for t in pool:
473 t.join()
474 installResult = installResult and t.result
475 time2 = time.time()
476
477 if not installResult:
478 main.log.info("Did not install onos-app-fwd feature properly")
479 #main.cleanup()
480 #main.exit()
481 else:
482 main.log.info("Successful feature:install onos-app-fwd")
483 main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1))
484
kelvin-onlab54400a92015-02-26 18:05:51 -0800485 time.sleep( 5 )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700486
487 main.step( "Verify Pingall" )
488 ping_result = main.FALSE
489 time1 = time.time()
490 ping_result = main.Mininet1.pingall(timeout=main.pingTimeout)
491 time2 = time.time()
492 timeDiff = round( ( time2 - time1 ), 2 )
493 main.log.report(
494 "Time taken for Ping All: " +
495 str( timeDiff ) +
496 " seconds" )
497
498 if ping_result == main.TRUE:
499 main.log.report( "Pingall Test in Reactive mode successful" )
500 else:
501 main.log.report( "Pingall Test in Reactive mode failed" )
502
503 main.step( "Disable Reactive forwarding" )
504 uninstallResult = main.TRUE
505 pool = []
506 time1 = time.time()
507 for cli in main.CLIs:
508 t = main.Thread( target=cli.featureUninstall,
509 threadID=main.threadID,
510 name="featureUninstall",
511 args=['onos-app-fwd'])
512 pool.append(t)
513 t.start()
514 main.threadID = main.threadID + 1
515 for t in pool:
516 t.join()
517 uninstallResult = uninstallResult and t.result
518 time2 = time.time()
519
520 if not uninstallResult:
521 main.log.info("Did not uninstall onos-app-fwd feature properly")
522 #main.cleanup()
523 #main.exit()
524 else:
525 main.log.info("Successful feature:uninstall onos-app-fwd")
526 main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1))
527
528 # Waiting for reative flows to be cleared.
529 time.sleep( 20 )
530 case4Result = installResult and uninstallResult and ping_result
531 utilities.assert_equals( expect=main.TRUE, actual=case4Result,
532 onpass="Reactive Mode Pingall test PASS",
533 onfail="Reactive Mode Pingall test FAIL" )
534
535 def CASE42( self, main ):
536 """
537 Verify Reactive forwarding (Spine Topology)
538 """
539 import re
540 import copy
541 import time
542 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
543 main.log.report( "______________________________________________" )
544 main.case( "Enable Reactive forwarding and Verify ping all" )
545 main.step( "Enable Reactive forwarding" )
546 installResult = main.TRUE
547 feature = "onos-app-fwd"
548
549 pool = []
550 time1 = time.time()
551 for cli in main.CLIs:
552 t = main.Thread( target=cli.featureInstall,
553 threadID=main.threadID,
554 name="featureInstall",
555 args=['onos-app-fwd'])
556 pool.append(t)
557 t.start()
558 main.threadID = main.threadID + 1
559
560 installResult = main.TRUE
561 for t in pool:
562 t.join()
563 installResult = installResult and t.result
564 time2 = time.time()
565
566 if not installResult:
567 main.log.info("Did not install onos-app-fwd feature properly")
568 #main.cleanup()
569 #main.exit()
570 else:
571 main.log.info("Successful feature:install onos-app-fwd")
572 main.log.info("Time for feature:install onos-app-fwd: %2f seconds" %(time2-time1))
573
574 time.sleep( 5 )
575
576 main.step( "Verify Pingall" )
577 ping_result = main.FALSE
578 time1 = time.time()
579 ping_result = main.Mininet1.pingall(timeout=main.pingTimeout)
580 time2 = time.time()
581 timeDiff = round( ( time2 - time1 ), 2 )
582 main.log.report(
583 "Time taken for Ping All: " +
584 str( timeDiff ) +
585 " seconds" )
586
587 if ping_result == main.TRUE:
588 main.log.report( "Pingall Test in Reactive mode successful" )
589 else:
590 main.log.report( "Pingall Test in Reactive mode failed" )
591
592 main.step( "Disable Reactive forwarding" )
593 uninstallResult = main.TRUE
594 pool = []
595 time1 = time.time()
596 for cli in main.CLIs:
597 t = main.Thread( target=cli.featureUninstall,
598 threadID=main.threadID,
599 name="featureUninstall",
600 args=['onos-app-fwd'])
601 pool.append(t)
602 t.start()
603 main.threadID = main.threadID + 1
604 for t in pool:
605 t.join()
606 uninstallResult = uninstallResult and t.result
607 time2 = time.time()
608
609 if not uninstallResult:
610 main.log.info("Did not uninstall onos-app-fwd feature properly")
611 #main.cleanup()
612 #main.exit()
613 else:
614 main.log.info("Successful feature:uninstall onos-app-fwd")
615 main.log.info("Time for feature:uninstall onos-app-fwd: %2f seconds" %(time2-time1))
616
617 # Waiting for reative flows to be cleared.
618 time.sleep( 20 )
kelvin-onlab54400a92015-02-26 18:05:51 -0800619 case4Result = installResult and uninstallResult and ping_result
620 utilities.assert_equals( expect=main.TRUE, actual=case4Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800621 onpass="Reactive Mode Pingall test PASS",
622 onfail="Reactive Mode Pingall test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800623
kelvin-onlab8a832582015-01-16 17:06:11 -0800624 def CASE5( self, main ):
625 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800626 Compare current ONOS topology with reference data
kelvin-onlab8a832582015-01-16 17:06:11 -0800627 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800628 import re
kelvin-onlab54400a92015-02-26 18:05:51 -0800629
Hari Krishna22c3d412015-02-17 16:48:12 -0800630 devicesDPIDTemp = []
631 hostMACsTemp = []
632 deviceLinksTemp = []
633 deviceActiveLinksCountTemp = []
634 devicePortsEnabledCountTemp = []
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800635
kelvin-onlab8a832582015-01-16 17:06:11 -0800636 main.log.report(
637 "Compare ONOS topology with reference data in Stores" )
638 main.log.report( "__________________________________________________" )
639 main.case( "Compare ONOS topology with reference data" )
640
641 main.step( "Compare current Device ports enabled with reference" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800642 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800643 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800644 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800645 for cli in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -0800646 dpid = "of:00000000000000" + format( i,'02x' )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800647 t = main.Thread(target = cli.getDevicePortsEnabledCount,
648 threadID = main.threadID,
649 name = "getDevicePortsEnabledCount",
650 args = [dpid])
kelvin-onlab54400a92015-02-26 18:05:51 -0800651 t.start()
652 pool.append(t)
653 i = i + 1
654 main.threadID = main.threadID + 1
655 for thread in pool:
656 thread.join()
657 portResult = thread.result
658 portTemp = re.split( r'\t+', portResult )
659 portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
660 devicePortsEnabledCountTemp.append( portCount )
661 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
662 time2 = time.time()
663 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
Hari Krishna22c3d412015-02-17 16:48:12 -0800664 main.log.info (
665 "Device Enabled ports EXPECTED: %s" %
666 str( main.devicePortsEnabledCount ) )
667 main.log.info (
668 "Device Enabled ports ACTUAL: %s" %
669 str( devicePortsEnabledCountTemp ) )
kelvin-onlab54400a92015-02-26 18:05:51 -0800670
Hari Krishna22c3d412015-02-17 16:48:12 -0800671 if ( cmp( main.devicePortsEnabledCount,
672 devicePortsEnabledCountTemp ) == 0 ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800673 stepResult1 = main.TRUE
674 else:
675 stepResult1 = main.FALSE
676
kelvin-onlab8a832582015-01-16 17:06:11 -0800677 main.step( "Compare Device active links with reference" )
kelvin-onlab54400a92015-02-26 18:05:51 -0800678 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800679 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800680 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800681 for cli in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -0800682 dpid = "of:00000000000000" + format( i,'02x' )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800683 t = main.Thread(target = cli.getDeviceLinksActiveCount,
684 threadID = main.threadID,
685 name = "getDevicePortsEnabledCount",
686 args = [dpid])
kelvin-onlab54400a92015-02-26 18:05:51 -0800687 t.start()
688 pool.append(t)
689 i = i + 1
690 main.threadID = main.threadID + 1
691 for thread in pool:
692 thread.join()
693 linkCountResult = thread.result
694 linkCountTemp = re.split( r'\t+', linkCountResult )
695 linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
696 deviceActiveLinksCountTemp.append( linkCount )
697 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
698 time2 = time.time()
699 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
Hari Krishna22c3d412015-02-17 16:48:12 -0800700 main.log.info (
701 "Device Active links EXPECTED: %s" %
702 str( main.deviceActiveLinksCount ) )
703 main.log.info (
704 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
705 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800706 stepResult2 = main.TRUE
707 else:
708 stepResult2 = main.FALSE
709
kelvin-onlab8a832582015-01-16 17:06:11 -0800710 """
Hari Krishna22c3d412015-02-17 16:48:12 -0800711 place holder for comparing devices, hosts, paths and intents if required.
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800712 Links and ports data would be incorrect with out devices anyways.
kelvin-onlab8a832582015-01-16 17:06:11 -0800713 """
Hari Krishna22c3d412015-02-17 16:48:12 -0800714 case5Result = ( stepResult1 and stepResult2 )
715 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800716 onpass="Compare Topology test PASS",
717 onfail="Compare Topology test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800718
kelvin-onlab8a832582015-01-16 17:06:11 -0800719 def CASE6( self ):
720 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700721 Install 300 host intents and verify ping all (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -0800722 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700723 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800724 main.log.report( "_______________________________________" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800725 import itertools
Hari Krishnaef1bd4e2015-03-12 16:55:30 -0700726 import time
kelvin-onlab8a832582015-01-16 17:06:11 -0800727 main.case( "Install 300 host intents" )
728 main.step( "Add host Intents" )
729 intentResult = main.TRUE
kelvin-onlab54400a92015-02-26 18:05:51 -0800730 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800731
kelvin-onlab54400a92015-02-26 18:05:51 -0800732 intentIdList = []
733 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800734 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800735 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800736 for cli in main.CLIs:
737 if i >= len( hostCombos ):
kelvin-onlab54400a92015-02-26 18:05:51 -0800738 break
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800739 t = main.Thread( target=cli.addHostIntent,
740 threadID=main.threadID,
kelvin-onlab54400a92015-02-26 18:05:51 -0800741 name="addHostIntent",
742 args=[hostCombos[i][0],hostCombos[i][1]])
743 pool.append(t)
744 t.start()
745 i = i + 1
746 main.threadID = main.threadID + 1
747 for thread in pool:
748 thread.join()
749 intentIdList.append(thread.result)
750 time2 = time.time()
kelvin-onlabadfc8db2015-03-24 15:52:48 -0700751 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
752
kelvin-onlab54400a92015-02-26 18:05:51 -0800753 intentResult = main.TRUE
754 intentsJson = main.ONOScli2.intents()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800755 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
kelvin-onlab54400a92015-02-26 18:05:51 -0800756 intentsJson = intentsJson)
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800757 print getIntentStateResult
Hari Krishnab35c6d02015-03-18 11:13:51 -0700758 # Takes awhile for all the onos to get the intents
Hari Krishnaef1bd4e2015-03-12 16:55:30 -0700759 time.sleep(30)
kelvin-onlab8a832582015-01-16 17:06:11 -0800760 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800761 pingResult = main.FALSE
762 time1 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -0800763 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800764 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800765 timeDiff = round( ( time2 - time1 ), 2 )
766 main.log.report(
767 "Time taken for Ping All: " +
768 str( timeDiff ) +
769 " seconds" )
770 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
771 onpass="PING ALL PASS",
772 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800773
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800774 case6Result = ( intentResult and pingResult )
kelvin-onlab54400a92015-02-26 18:05:51 -0800775
kelvin-onlab8a832582015-01-16 17:06:11 -0800776 utilities.assert_equals(
777 expect=main.TRUE,
kelvin-onlab78f7d2d2015-03-02 17:37:35 -0800778 actual=case6Result,
kelvin-onlab8a832582015-01-16 17:06:11 -0800779 onpass="Install 300 Host Intents and Ping All test PASS",
780 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800781
kelvin-onlab8a832582015-01-16 17:06:11 -0800782 def CASE70( self, main ):
783 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700784 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
kelvin-onlab8a832582015-01-16 17:06:11 -0800785 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800786 import random
Hari Krishna22c3d412015-02-17 16:48:12 -0800787 main.randomLink1 = []
788 main.randomLink2 = []
789 main.randomLink3 = []
kelvin-onlab8a832582015-01-16 17:06:11 -0800790 link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
791 link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
792 link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
793 link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' )
794 link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
795 link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' )
796 switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
797 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800798
Hari Krishnab35c6d02015-03-18 11:13:51 -0700799 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
800 main.log.report( "___________________________________________________________________________" )
Hari Krishnad97213e2015-01-24 19:30:14 -0800801 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
802 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800803 if ( int( switchLinksToToggle ) ==
804 0 or int( switchLinksToToggle ) > 5 ):
Hari Krishna46997e02015-01-27 11:23:07 -0800805 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 -0700806 #main.cleanup()
807 #main.exit()
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800808 else:
Hari Krishnad97213e2015-01-24 19:30:14 -0800809 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 -0800810
kelvin-onlab8a832582015-01-16 17:06:11 -0800811 main.step( "Cut links on Core devices using user provided range" )
Hari Krishna22c3d412015-02-17 16:48:12 -0800812 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
813 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
814 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800815 for i in range( int( switchLinksToToggle ) ):
816 main.Mininet1.link(
817 END1=link1End1,
Hari Krishna22c3d412015-02-17 16:48:12 -0800818 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800819 OPTION="down" )
820 main.Mininet1.link(
821 END1=link2End1,
Hari Krishna22c3d412015-02-17 16:48:12 -0800822 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800823 OPTION="down" )
824 main.Mininet1.link(
825 END1=link3End1,
Hari Krishna22c3d412015-02-17 16:48:12 -0800826 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800827 OPTION="down" )
828 time.sleep( link_sleep )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800829
830 topology_output = main.ONOScli2.topology()
Hari Krishnad97213e2015-01-24 19:30:14 -0800831 linkDown = main.ONOSbench.checkStatus(
Hari Krishna22c3d412015-02-17 16:48:12 -0800832 topology_output, main.numMNswitches, str(
833 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800834 utilities.assert_equals(
835 expect=main.TRUE,
836 actual=linkDown,
837 onpass="Link Down discovered properly",
838 onfail="Link down was not discovered in " +
839 str( link_sleep ) +
840 " seconds" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800841
kelvin-onlab8a832582015-01-16 17:06:11 -0800842 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800843 pingResultLinkDown = main.FALSE
844 time1 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -0800845 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800846 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800847 timeDiff = round( ( time2 - time1 ), 2 )
848 main.log.report(
849 "Time taken for Ping All: " +
850 str( timeDiff ) +
851 " seconds" )
852 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
853 onpass="PING ALL PASS",
854 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800855
Hari Krishna22c3d412015-02-17 16:48:12 -0800856 caseResult70 = linkDown and pingResultLinkDown
857 utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
kelvin-onlab8a832582015-01-16 17:06:11 -0800858 onpass="Random Link cut Test PASS",
859 onfail="Random Link cut Test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800860
kelvin-onlab8a832582015-01-16 17:06:11 -0800861 def CASE80( self, main ):
862 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700863 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
kelvin-onlab8a832582015-01-16 17:06:11 -0800864 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800865 import random
kelvin-onlab8a832582015-01-16 17:06:11 -0800866 link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
867 link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
868 link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
869 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
870 switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800871
kelvin-onlab8a832582015-01-16 17:06:11 -0800872 main.log.report(
Hari Krishnab35c6d02015-03-18 11:13:51 -0700873 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800874 main.log.report(
875 "__________________________________________________________________" )
876 main.case(
877 "Host intents - Bring the core links up that are down and verify ping all" )
878 main.step( "Bring randomly cut links on Core devices up" )
879 for i in range( int( switchLinksToToggle ) ):
880 main.Mininet1.link(
881 END1=link1End1,
kelvin-onlab54400a92015-02-26 18:05:51 -0800882 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800883 OPTION="up" )
884 main.Mininet1.link(
885 END1=link2End1,
kelvin-onlab54400a92015-02-26 18:05:51 -0800886 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800887 OPTION="up" )
888 main.Mininet1.link(
889 END1=link3End1,
kelvin-onlab54400a92015-02-26 18:05:51 -0800890 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800891 OPTION="up" )
892 time.sleep( link_sleep )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800893
894 topology_output = main.ONOScli2.topology()
Hari Krishnad97213e2015-01-24 19:30:14 -0800895 linkUp = main.ONOSbench.checkStatus(
kelvin-onlab8a832582015-01-16 17:06:11 -0800896 topology_output,
Hari Krishna22c3d412015-02-17 16:48:12 -0800897 main.numMNswitches,
898 str( main.numMNlinks ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800899 utilities.assert_equals(
900 expect=main.TRUE,
901 actual=linkUp,
902 onpass="Link up discovered properly",
903 onfail="Link up was not discovered in " +
904 str( link_sleep ) +
905 " seconds" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800906
kelvin-onlab8a832582015-01-16 17:06:11 -0800907 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800908 pingResultLinkUp = main.FALSE
909 time1 = time.time()
910 pingResultLinkUp = main.Mininet1.pingall()
911 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800912 timeDiff = round( ( time2 - time1 ), 2 )
913 main.log.report(
914 "Time taken for Ping All: " +
915 str( timeDiff ) +
916 " seconds" )
917 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
918 onpass="PING ALL PASS",
919 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800920
Hari Krishna22c3d412015-02-17 16:48:12 -0800921 caseResult80 = linkUp and pingResultLinkUp
922 utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
kelvin-onlab8a832582015-01-16 17:06:11 -0800923 onpass="Link Up Test PASS",
924 onfail="Link Up Test FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -0800925
kelvin-onlab8a832582015-01-16 17:06:11 -0800926 def CASE71( self, main ):
927 """
Hari Krishnab35c6d02015-03-18 11:13:51 -0700928 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo )
kelvin-onlab8a832582015-01-16 17:06:11 -0800929 """
kelvin8ec71442015-01-15 16:57:00 -0800930 import random
Hari Krishna22c3d412015-02-17 16:48:12 -0800931 main.randomLink1 = []
932 main.randomLink2 = []
933 main.randomLink3 = []
kelvin-onlab8a832582015-01-16 17:06:11 -0800934 link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
935 link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
936 link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
937 link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' )
938 link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
939 link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' )
940 switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
941 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
kelvin8ec71442015-01-15 16:57:00 -0800942
Hari Krishnab35c6d02015-03-18 11:13:51 -0700943 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo" )
Hari Krishnad97213e2015-01-24 19:30:14 -0800944 main.log.report( "__________________________________________________________________" )
945 main.case( "Point Intents - Randomly bring some core links down and verify ping all" )
946 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
kelvin-onlab8a832582015-01-16 17:06:11 -0800947 if ( int( switchLinksToToggle ) ==
948 0 or int( switchLinksToToggle ) > 5 ):
949 main.log.info(
950 "Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
Hari Krishnab35c6d02015-03-18 11:13:51 -0700951 #main.cleanup()
952 #main.exit()
kelvin8ec71442015-01-15 16:57:00 -0800953 else:
kelvin-onlab8a832582015-01-16 17:06:11 -0800954 main.log.info(
955 "User provided Core switch links range to toggle is correct, proceeding to run the test" )
kelvin8ec71442015-01-15 16:57:00 -0800956
kelvin-onlab8a832582015-01-16 17:06:11 -0800957 main.step( "Cut links on Core devices using user provided range" )
958 randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
959 randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
960 randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
961 for i in range( int( switchLinksToToggle ) ):
962 main.Mininet1.link(
963 END1=link1End1,
Hari Krishna22c3d412015-02-17 16:48:12 -0800964 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800965 OPTION="down" )
966 main.Mininet1.link(
967 END1=link2End1,
Hari Krishna22c3d412015-02-17 16:48:12 -0800968 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800969 OPTION="down" )
970 main.Mininet1.link(
971 END1=link3End1,
Hari Krishna22c3d412015-02-17 16:48:12 -0800972 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -0800973 OPTION="down" )
974 time.sleep( link_sleep )
kelvin8ec71442015-01-15 16:57:00 -0800975
976 topology_output = main.ONOScli2.topology()
Hari Krishnad97213e2015-01-24 19:30:14 -0800977 linkDown = main.ONOSbench.checkStatus(
Hari Krishna22c3d412015-02-17 16:48:12 -0800978 topology_output, main.numSwitches, str(
979 int( main.numLinks ) - int( switchLinksToToggle ) * 6 ) )
kelvin-onlab8a832582015-01-16 17:06:11 -0800980 utilities.assert_equals(
981 expect=main.TRUE,
982 actual=linkDown,
983 onpass="Link Down discovered properly",
984 onfail="Link down was not discovered in " +
985 str( link_sleep ) +
986 " seconds" )
kelvin8ec71442015-01-15 16:57:00 -0800987
kelvin-onlab8a832582015-01-16 17:06:11 -0800988 main.step( "Verify Ping across all hosts" )
kelvin8ec71442015-01-15 16:57:00 -0800989 pingResultLinkDown = main.FALSE
990 time1 = time.time()
991 pingResultLinkDown = main.Mininet1.pingall()
992 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -0800993 timeDiff = round( ( time2 - time1 ), 2 )
994 main.log.report(
995 "Time taken for Ping All: " +
996 str( timeDiff ) +
997 " seconds" )
998 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
999 onpass="PING ALL PASS",
1000 onfail="PING ALL FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001001
1002 caseResult7 = linkDown and pingResultLinkDown
kelvin-onlab8a832582015-01-16 17:06:11 -08001003 utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
1004 onpass="Random Link cut Test PASS",
1005 onfail="Random Link cut Test FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001006
kelvin-onlab8a832582015-01-16 17:06:11 -08001007 def CASE81( self, main ):
1008 """
Hari Krishnab35c6d02015-03-18 11:13:51 -07001009 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
kelvin-onlab8a832582015-01-16 17:06:11 -08001010 """
kelvin8ec71442015-01-15 16:57:00 -08001011 import random
kelvin-onlab8a832582015-01-16 17:06:11 -08001012 link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
1013 link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
1014 link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
1015 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1016 switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
kelvin8ec71442015-01-15 16:57:00 -08001017
kelvin-onlab8a832582015-01-16 17:06:11 -08001018 main.log.report(
Hari Krishnab35c6d02015-03-18 11:13:51 -07001019 "Bring the core links up that are down and verify ping all (Point Intents-Att Topo" )
kelvin-onlab8a832582015-01-16 17:06:11 -08001020 main.log.report(
1021 "___________________________________________________________________" )
1022 main.case(
1023 "Point intents - Bring the core links up that are down and verify ping all" )
1024 main.step( "Bring randomly cut links on Core devices up" )
1025 for i in range( int( switchLinksToToggle ) ):
1026 main.Mininet1.link(
1027 END1=link1End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001028 END2=main.randomLink1[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001029 OPTION="up" )
1030 main.Mininet1.link(
1031 END1=link2End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001032 END2=main.randomLink2[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001033 OPTION="up" )
1034 main.Mininet1.link(
1035 END1=link3End1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001036 END2=main.randomLink3[ i ],
kelvin-onlab8a832582015-01-16 17:06:11 -08001037 OPTION="up" )
1038 time.sleep( link_sleep )
kelvin8ec71442015-01-15 16:57:00 -08001039
1040 topology_output = main.ONOScli2.topology()
Hari Krishnad97213e2015-01-24 19:30:14 -08001041 linkUp = main.ONOSbench.checkStatus(
kelvin-onlab8a832582015-01-16 17:06:11 -08001042 topology_output,
Hari Krishna22c3d412015-02-17 16:48:12 -08001043 main.numMNswitches,
1044 str( main.numMNlinks ) )
kelvin-onlab8a832582015-01-16 17:06:11 -08001045 utilities.assert_equals(
1046 expect=main.TRUE,
1047 actual=linkUp,
1048 onpass="Link up discovered properly",
1049 onfail="Link up was not discovered in " +
1050 str( link_sleep ) +
1051 " seconds" )
kelvin8ec71442015-01-15 16:57:00 -08001052
kelvin-onlab8a832582015-01-16 17:06:11 -08001053 main.step( "Verify Ping across all hosts" )
kelvin8ec71442015-01-15 16:57:00 -08001054 pingResultLinkUp = main.FALSE
1055 time1 = time.time()
1056 pingResultLinkUp = main.Mininet1.pingall()
1057 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001058 timeDiff = round( ( time2 - time1 ), 2 )
1059 main.log.report(
1060 "Time taken for Ping All: " +
1061 str( timeDiff ) +
1062 " seconds" )
1063 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1064 onpass="PING ALL PASS",
1065 onfail="PING ALL FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001066
Hari Krishna22c3d412015-02-17 16:48:12 -08001067 caseResult81 = linkUp and pingResultLinkUp
1068 utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
kelvin-onlab8a832582015-01-16 17:06:11 -08001069 onpass="Link Up Test PASS",
1070 onfail="Link Up Test FAIL" )
kelvin8ec71442015-01-15 16:57:00 -08001071
Hari Krishnab35c6d02015-03-18 11:13:51 -07001072 def CASE72( self, main ):
1073 """
1074 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1075 """
1076 import random
1077 import itertools
1078 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1079
1080 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1081 main.log.report( "___________________________________________________________________________" )
1082 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1083 switches = []
1084 switchesComb = []
1085 for i in range( main.numMNswitches ):
1086 switches.append('s%d'%(i+1))
1087 switchesLinksComb = list(itertools.combinations(switches,2))
1088 main.randomLinks = random.sample(switchesLinksComb, 5 )
1089 print main.randomLinks
1090 main.step( "Cut links on random devices" )
1091
1092 for switch in main.randomLinks:
1093 main.Mininet1.link(
1094 END1=switch[0],
1095 END2=switch[1],
1096 OPTION="down")
1097 time.sleep( link_sleep )
1098
1099 topology_output = main.ONOScli2.topology()
1100 linkDown = main.ONOSbench.checkStatus(
1101 topology_output, main.numMNswitches, str(
1102 int( main.numMNlinks ) - 5 * 2 ) )
1103 utilities.assert_equals(
1104 expect=main.TRUE,
1105 actual=linkDown,
1106 onpass="Link Down discovered properly",
1107 onfail="Link down was not discovered in " +
1108 str( link_sleep ) +
1109 " seconds" )
1110
1111 main.step( "Verify Ping across all hosts" )
1112 pingResultLinkDown = main.FALSE
1113 time1 = time.time()
1114 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
1115 time2 = time.time()
1116 timeDiff = round( ( time2 - time1 ), 2 )
1117 main.log.report(
1118 "Time taken for Ping All: " +
1119 str( timeDiff ) +
1120 " seconds" )
1121 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1122 onpass="PING ALL PASS",
1123 onfail="PING ALL FAIL" )
1124
1125 caseResult72 = pingResultLinkDown
1126 utilities.assert_equals( expect=main.TRUE, actual=caseResult72,
1127 onpass="Random Link cut Test PASS",
1128 onfail="Random Link cut Test FAIL" )
1129
1130 def CASE82( self, main ):
1131 """
1132 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1133 """
1134 import random
1135 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1136
1137 main.log.report(
1138 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1139 main.log.report(
1140 "__________________________________________________________________" )
1141 main.case(
1142 "Host intents - Bring the core links up that are down and verify ping all" )
1143 main.step( "Bring randomly cut links on devices up" )
1144
1145 for switch in main.randomLinks:
1146 main.Mininet1.link(
1147 END1=switch[0],
1148 END2=switch[1],
1149 OPTION="up")
1150
1151 time.sleep( link_sleep )
1152
1153 topology_output = main.ONOScli2.topology()
1154 linkUp = main.ONOSbench.checkStatus(
1155 topology_output,
1156 main.numMNswitches,
1157 str( main.numMNlinks ) )
1158 utilities.assert_equals(
1159 expect=main.TRUE,
1160 actual=linkUp,
1161 onpass="Link up discovered properly",
1162 onfail="Link up was not discovered in " +
1163 str( link_sleep ) +
1164 " seconds" )
1165
1166 main.step( "Verify Ping across all hosts" )
1167 pingResultLinkUp = main.FALSE
1168 time1 = time.time()
1169 pingResultLinkUp = main.Mininet1.pingall()
1170 time2 = time.time()
1171 timeDiff = round( ( time2 - time1 ), 2 )
1172 main.log.report(
1173 "Time taken for Ping All: " +
1174 str( timeDiff ) +
1175 " seconds" )
1176 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1177 onpass="PING ALL PASS",
1178 onfail="PING ALL FAIL" )
1179
1180 caseResult82 = linkUp and pingResultLinkUp
1181 utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
1182 onpass="Link Up Test PASS",
1183 onfail="Link Up Test FAIL" )
1184
1185 def CASE73( self, main ):
1186 """
1187 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
1188 """
1189 import random
1190 main.pingTimeout = 600
1191 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1192
1193 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
1194 main.log.report( "___________________________________________________________________________" )
1195
1196 main.someLinks = [('s1','s9'),('s3','s9'),('s6','s10'),('s8','s10')]
1197 for switch in main.someLinks:
1198 main.Mininet1.link(
1199 END1=switch[0],
1200 END2=switch[1],
1201 OPTION="down" )
1202 time.sleep( link_sleep )
1203
1204 topology_output = main.ONOScli2.topology()
1205 linkDown = main.ONOSbench.checkStatus(
1206 topology_output, main.numMNswitches, str(
1207 int( main.numMNlinks ) - 8 ))
1208 utilities.assert_equals(
1209 expect=main.TRUE,
1210 actual=linkDown,
1211 onpass="Link Down discovered properly",
1212 onfail="Link down was not discovered in " +
1213 str( link_sleep ) +
1214 " seconds" )
1215
1216 main.step( "Verify Ping across all hosts" )
1217 pingResultLinkDown = main.FALSE
1218 time1 = time.time()
1219 pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
1220 time2 = time.time()
1221 timeDiff = round( ( time2 - time1 ), 2 )
1222 main.log.report(
1223 "Time taken for Ping All: " +
1224 str( timeDiff ) +
1225 " seconds" )
1226 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
1227 onpass="PING ALL PASS",
1228 onfail="PING ALL FAIL" )
1229
1230 caseResult73 = linkDown and pingResultLinkDown
1231 utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
1232 onpass="Random Link cut Test PASS",
1233 onfail="Random Link cut Test FAIL" )
1234
1235 def CASE83( self, main ):
1236 """
1237 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
1238 """
1239 import random
1240
1241 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1242 main.log.report(
1243 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
1244 main.log.report(
1245 "__________________________________________________________________" )
1246 main.case(
1247 "Host intents - Bring the core links up that are down and verify ping all" )
1248
1249 for switch in main.someLinks:
1250 main.Mininet1.link(
1251 END1=switch[0],
1252 END2=switch[1],
1253 OPTION="up")
1254 time.sleep( link_sleep )
1255
1256 topology_output = main.ONOScli2.topology()
1257 linkUp = main.ONOSbench.checkStatus(
1258 topology_output,
1259 main.numMNswitches,
1260 str( main.numMNlinks ) )
1261 utilities.assert_equals(
1262 expect=main.TRUE,
1263 actual=linkUp,
1264 onpass="Link up discovered properly",
1265 onfail="Link up was not discovered in " +
1266 str( link_sleep ) +
1267 " seconds" )
1268
1269 main.step( "Verify Ping across all hosts" )
1270 pingResultLinkUp = main.FALSE
1271 time1 = time.time()
1272 pingResultLinkUp = main.Mininet1.pingall()
1273 time2 = time.time()
1274 timeDiff = round( ( time2 - time1 ), 2 )
1275 main.log.report(
1276 "Time taken for Ping All: " +
1277 str( timeDiff ) +
1278 " seconds" )
1279 utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
1280 onpass="PING ALL PASS",
1281 onfail="PING ALL FAIL" )
1282
1283 caseResult83 = linkUp and pingResultLinkUp
1284 utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
1285 onpass="Link Up Test PASS",
1286 onfail="Link Up Test FAIL" )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001287
1288 def CASE90( self ):
kelvin-onlab8a832582015-01-16 17:06:11 -08001289 """
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001290 Install 600 point intents and verify ping all (Att Topology)
kelvin-onlab8a832582015-01-16 17:06:11 -08001291 """
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001292 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001293 main.log.report( "_______________________________________" )
1294 import itertools
1295 import time
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001296 main.case( "Install 600 point intents" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001297 main.step( "Add point Intents" )
1298 intentResult = main.TRUE
1299 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1300
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001301 intentIdList = []
Hari Krishnab35c6d02015-03-18 11:13:51 -07001302 time1 = time.time()
Hari Krishnab35c6d02015-03-18 11:13:51 -07001303 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1304 pool = []
1305 for cli in main.CLIs:
1306 if i >= len( deviceCombos ):
1307 break
1308 t = main.Thread( target=cli.addPointIntent,
1309 threadID=main.threadID,
1310 name="addPointIntent",
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001311 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnab35c6d02015-03-18 11:13:51 -07001312 pool.append(t)
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001313 #time.sleep(1)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001314 t.start()
1315 i = i + 1
1316 main.threadID = main.threadID + 1
1317 for thread in pool:
1318 thread.join()
1319 intentIdList.append(thread.result)
1320 time2 = time.time()
1321 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1322 intentResult = main.TRUE
1323 intentsJson = main.ONOScli2.intents()
1324 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1325 intentsJson = intentsJson)
1326 print getIntentStateResult
1327 # Takes awhile for all the onos to get the intents
1328 time.sleep(30)
kelvin-onlab8a832582015-01-16 17:06:11 -08001329 main.step( "Verify Ping across all hosts" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001330 pingResult = main.FALSE
1331 time1 = time.time()
Hari Krishnab35c6d02015-03-18 11:13:51 -07001332 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001333 time2 = time.time()
kelvin-onlab8a832582015-01-16 17:06:11 -08001334 timeDiff = round( ( time2 - time1 ), 2 )
1335 main.log.report(
1336 "Time taken for Ping All: " +
1337 str( timeDiff ) +
1338 " seconds" )
1339 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1340 onpass="PING ALL PASS",
1341 onfail="PING ALL FAIL" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001342
Hari Krishnab35c6d02015-03-18 11:13:51 -07001343 case6Result = ( intentResult and pingResult )
1344
kelvin-onlab8a832582015-01-16 17:06:11 -08001345 utilities.assert_equals(
1346 expect=main.TRUE,
Hari Krishnab35c6d02015-03-18 11:13:51 -07001347 actual=case6Result,
Hari Krishna5afb4cc2015-03-23 15:35:15 -07001348 onpass="Install 600 point Intents and Ping All test PASS",
1349 onfail="Install 600 point Intents and Ping All test FAIL" )
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001350
1351 def CASE91( self ):
1352 """
1353 Install ###$$$ point intents and verify ping all (Chordal Topology)
1354 """
1355 main.log.report( "Add ###$$$ point intents and verify pingall (Chordal Topology)" )
1356 main.log.report( "_______________________________________" )
1357 import itertools
1358 import time
1359 main.case( "Install ###$$$ point intents" )
1360 main.step( "Add point Intents" )
1361 intentResult = main.TRUE
1362 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1363
1364 intentIdList = []
1365 time1 = time.time()
1366 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1367 pool = []
1368 for cli in main.CLIs:
1369 if i >= len( deviceCombos ):
1370 break
1371 t = main.Thread( target=cli.addPointIntent,
1372 threadID=main.threadID,
1373 name="addPointIntent",
1374 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1375 pool.append(t)
1376 #time.sleep(1)
1377 t.start()
1378 i = i + 1
1379 main.threadID = main.threadID + 1
1380 for thread in pool:
1381 thread.join()
1382 intentIdList.append(thread.result)
1383 time2 = time.time()
1384 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1385 intentResult = main.TRUE
1386 intentsJson = main.ONOScli2.intents()
1387 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1388 intentsJson = intentsJson)
1389 print getIntentStateResult
1390 # Takes awhile for all the onos to get the intents
1391 time.sleep(30)
1392 main.step( "Verify Ping across all hosts" )
1393 pingResult = main.FALSE
1394 time1 = time.time()
1395 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1396 time2 = time.time()
1397 timeDiff = round( ( time2 - time1 ), 2 )
1398 main.log.report(
1399 "Time taken for Ping All: " +
1400 str( timeDiff ) +
1401 " seconds" )
1402 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1403 onpass="PING ALL PASS",
1404 onfail="PING ALL FAIL" )
1405
1406 case6Result = ( intentResult and pingResult )
1407
1408 utilities.assert_equals(
1409 expect=main.TRUE,
1410 actual=case6Result,
1411 onpass="Install ###$$$ point Intents and Ping All test PASS",
1412 onfail="Install ###$$$ point Intents and Ping All test FAIL" )
1413
1414 def CASE92( self ):
1415 """
1416 Install $$$### point intents and verify ping all (Spine Topology)
1417 """
1418 main.log.report( "Add $$$### point intents and verify pingall (Spine Topology)" )
1419 main.log.report( "_______________________________________" )
1420 import itertools
1421 import time
1422 main.case( "Install $$$### point intents" )
1423 main.step( "Add point Intents" )
1424 intentResult = main.TRUE
1425 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
1426
1427 intentIdList = []
1428 time1 = time.time()
1429 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
1430 pool = []
1431 for cli in main.CLIs:
1432 if i >= len( deviceCombos ):
1433 break
1434 t = main.Thread( target=cli.addPointIntent,
1435 threadID=main.threadID,
1436 name="addPointIntent",
1437 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,"IPV4","",main.MACsDict.get(deviceCombos[i][1])])
1438 pool.append(t)
1439 #time.sleep(1)
1440 t.start()
1441 i = i + 1
1442 main.threadID = main.threadID + 1
1443 for thread in pool:
1444 thread.join()
1445 intentIdList.append(thread.result)
1446 time2 = time.time()
1447 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
1448 intentResult = main.TRUE
1449 intentsJson = main.ONOScli2.intents()
1450 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1451 intentsJson = intentsJson)
1452 print getIntentStateResult
1453 # Takes awhile for all the onos to get the intents
1454 time.sleep(30)
1455 main.step( "Verify Ping across all hosts" )
1456 pingResult = main.FALSE
1457 time1 = time.time()
1458 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1459 time2 = time.time()
1460 timeDiff = round( ( time2 - time1 ), 2 )
1461 main.log.report(
1462 "Time taken for Ping All: " +
1463 str( timeDiff ) +
1464 " seconds" )
1465 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1466 onpass="PING ALL PASS",
1467 onfail="PING ALL FAIL" )
1468
1469 case6Result = ( intentResult and pingResult )
1470
1471 utilities.assert_equals(
1472 expect=main.TRUE,
1473 actual=case6Result,
1474 onpass="Install $$$### point Intents and Ping All test PASS",
1475 onfail="Install $$$### point Intents and Ping All test FAIL" )
1476
1477 def CASE93( self ):
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001478 """
1479 Install single-multi point intents and verify Ping all works
1480 for att topology
1481 """
1482 import copy
1483 main.log.report( "Install single-multi point intents and verify Ping all" )
1484 main.log.report( "___________________________________________" )
1485 main.case( "Install single-multi point intents and Ping all" )
1486 deviceLinksCopy = copy.copy( main.deviceLinks )
1487 main.step( "Install single-multi point intents" )
1488 for i in range( len( deviceLinksCopy ) ):
1489 pointLink = str(
1490 deviceLinksCopy[ i ] ).replace(
1491 "src=",
1492 "" ).replace(
1493 "dst=",
1494 "" ).split( ',' )
1495 point1 = pointLink[ 0 ].split( '/' )
1496 point2 = pointLink[ 1 ].split( '/' )
1497 installResult = main.ONOScli1.addPointIntent(
1498 point1[ 0 ], point2[ 0 ], int(
1499 point1[ 1 ] ), int(
1500 point2[ 1 ] ) )
1501 if installResult == main.TRUE:
1502 print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
1503
1504 main.step( "Obtain the intent id's" )
1505 intentsList = main.ONOScli1.getAllIntentIds()
1506 ansi_escape = re.compile( r'\x1b[^m]*m' )
1507 intentsList = ansi_escape.sub( '', intentsList )
1508 intentsList = intentsList.replace(
1509 " onos:intents | grep id=",
1510 "" ).replace(
1511 "id=",
1512 "" ).replace(
1513 "\r\r",
1514 "" )
1515 intentsList = intentsList.splitlines()
1516 intentsList = intentsList[ 1: ]
1517 intentIdList = []
1518 for i in range( len( intentsList ) ):
1519 intentsTemp = intentsList[ i ].split( ',' )
1520 intentIdList.append( intentsTemp[ 0 ] )
1521 print "Intent IDs: ", intentIdList
1522 print "Total Intents installed: ", len( intentIdList )
1523
1524 main.step( "Verify Ping across all hosts" )
1525 pingResult = main.FALSE
1526 time1 = time.time()
1527 pingResult = main.Mininet1.pingall()
1528 time2 = time.time()
1529 timeDiff = round( ( time2 - time1 ), 2 )
1530 main.log.report(
1531 "Time taken for Ping All: " +
1532 str( timeDiff ) +
1533 " seconds" )
1534 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1535 onpass="PING ALL PASS",
1536 onfail="PING ALL FAIL" )
1537
1538 case8_result = installResult and pingResult
1539 utilities.assert_equals(
1540 expect=main.TRUE,
1541 actual=case8_result,
1542 onpass="Ping all test after Point intents addition successful",
1543 onfail="Ping all test after Point intents addition failed" )
1544
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001545 def CASE94( self ):
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001546 """
1547 Install single-multi point intents and verify Ping all works
1548 """
1549 import copy
1550 main.log.report( "Install single-multi point intents and verify Ping all" )
1551 main.log.report( "___________________________________________" )
1552 main.case( "Install single-multi point intents and Ping all" )
1553 deviceLinksCopy = copy.copy( main.deviceLinks )
1554 main.step( "Install single-multi point intents" )
1555 for i in range( len( deviceLinksCopy ) ):
1556 pointLink = str(
1557 deviceLinksCopy[ i ] ).replace(
1558 "src=",
1559 "" ).replace(
1560 "dst=",
1561 "" ).split( ',' )
1562 point1 = pointLink[ 0 ].split( '/' )
1563 point2 = pointLink[ 1 ].split( '/' )
1564 installResult = main.ONOScli1.addPointIntent(
1565 point1[ 0 ], point2[ 0 ], int(
1566 point1[ 1 ] ), int(
1567 point2[ 1 ] ) )
1568 if installResult == main.TRUE:
1569 print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
1570
1571 main.step( "Obtain the intent id's" )
1572 intentsList = main.ONOScli1.getAllIntentIds()
1573 ansi_escape = re.compile( r'\x1b[^m]*m' )
1574 intentsList = ansi_escape.sub( '', intentsList )
1575 intentsList = intentsList.replace(
1576 " onos:intents | grep id=",
1577 "" ).replace(
1578 "id=",
1579 "" ).replace(
1580 "\r\r",
1581 "" )
1582 intentsList = intentsList.splitlines()
1583 intentsList = intentsList[ 1: ]
1584 intentIdList = []
1585 for i in range( len( intentsList ) ):
1586 intentsTemp = intentsList[ i ].split( ',' )
1587 intentIdList.append( intentsTemp[ 0 ] )
1588 print "Intent IDs: ", intentIdList
1589 print "Total Intents installed: ", len( intentIdList )
1590
1591 main.step( "Verify Ping across all hosts" )
1592 pingResult = main.FALSE
1593 time1 = time.time()
1594 pingResult = main.Mininet1.pingall()
1595 time2 = time.time()
1596 timeDiff = round( ( time2 - time1 ), 2 )
1597 main.log.report(
1598 "Time taken for Ping All: " +
1599 str( timeDiff ) +
1600 " seconds" )
1601 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1602 onpass="PING ALL PASS",
1603 onfail="PING ALL FAIL" )
1604
1605 case8_result = installResult and pingResult
1606 utilities.assert_equals(
1607 expect=main.TRUE,
1608 actual=case8_result,
1609 onpass="Ping all test after Point intents addition successful",
1610 onfail="Ping all test after Point intents addition failed" )
1611
kelvin-onlab8a832582015-01-16 17:06:11 -08001612 def CASE10( self ):
kelvin-onlab7642bb12015-02-27 13:48:17 -08001613 import time
kelvin-onlab8a832582015-01-16 17:06:11 -08001614 """
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001615 Remove all Intents
kelvin-onlab8a832582015-01-16 17:06:11 -08001616 """
1617 main.log.report( "Remove all intents that were installed previously" )
1618 main.log.report( "______________________________________________" )
1619 main.log.info( "Remove all intents" )
1620 main.case( "Removing intents" )
1621 main.step( "Obtain the intent id's first" )
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001622 intentsList = main.ONOScli1.getAllIntentIds()
kelvin-onlab8a832582015-01-16 17:06:11 -08001623 ansi_escape = re.compile( r'\x1b[^m]*m' )
1624 intentsList = ansi_escape.sub( '', intentsList )
1625 intentsList = intentsList.replace(
1626 " onos:intents | grep id=",
1627 "" ).replace(
1628 "id=",
1629 "" ).replace(
1630 "\r\r",
1631 "" )
1632 intentsList = intentsList.splitlines()
1633 intentsList = intentsList[ 1: ]
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001634 intentIdList = []
1635 step1Result = main.TRUE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001636 moreIntents = main.TRUE
1637 removeIntentCount = 0
1638 print "Current number of intents" , len(intentsList)
kelvin-onlab8a832582015-01-16 17:06:11 -08001639 if ( len( intentsList ) > 1 ):
kelvin-onlab54400a92015-02-26 18:05:51 -08001640 results = main.TRUE
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07001641 main.log.info("Removing intent...")
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001642 while moreIntents:
Hari Krishnab35c6d02015-03-18 11:13:51 -07001643 if removeIntentCount == 5:
1644 break
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001645 removeIntentCount = removeIntentCount + 1
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001646 intentsList1 = main.ONOScli1.getAllIntentIds()
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07001647 if len( intentsList1 ) == 0:
1648 break
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001649 ansi_escape = re.compile( r'\x1b[^m]*m' )
1650 intentsList1 = ansi_escape.sub( '', intentsList1 )
1651 intentsList1 = intentsList1.replace(
1652 " onos:intents | grep id=",
1653 "" ).replace(
1654 " state=",
1655 "" ).replace(
1656 "\r\r",
1657 "" )
1658 intentsList1 = intentsList1.splitlines()
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07001659 intentsList1 = intentsList1[ 1: ]
1660 print "Round %d intents to remove: " %(removeIntentCount)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001661 print intentsList1
1662 intentIdList1 = []
Hari Krishnab35c6d02015-03-18 11:13:51 -07001663 if ( len( intentsList1 ) > 0 ):
kelvin-onlab01f1b2c2015-03-11 10:41:06 -07001664 moreIntents = main.TRUE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001665 for i in range( len( intentsList1 ) ):
1666 intentsTemp1 = intentsList1[ i ].split( ',' )
1667 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
1668 print "Leftover Intent IDs: ", intentIdList1
1669 print len(intentIdList1)
kelvin-onlabadfc8db2015-03-24 15:52:48 -07001670 time1 = time.time()
1671 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
1672 pool = []
1673 for cli in main.CLIs:
1674 if i >= len( intentIdList1 ):
1675 break
1676 t = main.Thread( target=cli.removeIntent,
1677 threadID=main.threadID,
1678 name="removeIntent",
1679 args=[intentIdList1[i],'org.onosproject.cli',True,False])
1680 pool.append(t)
1681 #time.sleep(1)
1682 t.start()
1683 i = i + 1
1684 main.threadID = main.threadID + 1
1685 for thread in pool:
1686 thread.join()
1687 intentIdList.append(thread.result)
1688 time2 = time.time()
1689 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnab35c6d02015-03-18 11:13:51 -07001690 time.sleep(10)
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001691 else:
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07001692 time.sleep(15)
Hari Krishnab35c6d02015-03-18 11:13:51 -07001693 if len( main.ONOScli1.intents()):
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07001694 continue
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001695 break
kelvin-onlab36c02b12015-03-11 11:25:55 -07001696
Hari Krishnaa43d4e92014-12-19 13:22:40 -08001697 else:
1698 print "There are no more intents that need to be removed"
1699 step1Result = main.TRUE
1700 else:
1701 print "No Intent IDs found in Intents list: ", intentsList
1702 step1Result = main.FALSE
kelvin-onlabc3ab3012015-03-10 15:04:46 -07001703
kelvin-onlabdc8719b2015-03-02 14:01:52 -08001704 print main.ONOScli1.intents()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001705 caseResult10 = step1Result
1706 utilities.assert_equals( expect=main.TRUE, actual=caseResult10,
kelvin-onlab8a832582015-01-16 17:06:11 -08001707 onpass="Intent removal test successful",
1708 onfail="Intent removal test failed" )
Hari Krishna22c3d412015-02-17 16:48:12 -08001709
1710 def CASE11( self, main ):
1711 """
1712 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
1713 """
1714 import re
1715 import copy
1716 import time
1717
kelvin-onlab54400a92015-02-26 18:05:51 -08001718 Thread = imp.load_source('Thread','/home/admin/ONLabTest/TestON/tests/OnosCHO/Thread.py')
1719 threadID = 0
1720
Hari Krishna22c3d412015-02-17 16:48:12 -08001721 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
1722 main.log.report( "_____________________________________________________" )
1723 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
1724 main.step( "Enable intent based Reactive forwarding" )
kelvin-onlab54400a92015-02-26 18:05:51 -08001725 installResult = main.FALSE
1726 feature = "onos-app-ifwd"
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001727
kelvin-onlab54400a92015-02-26 18:05:51 -08001728 pool = []
1729 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001730 for cli,feature in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -08001731 t = main.Thread(target=cli,threadID=threadID,
1732 name="featureInstall",args=[feature])
1733 pool.append(t)
1734 t.start()
1735 threadID = threadID + 1
1736
1737 results = []
1738 for thread in pool:
1739 thread.join()
1740 results.append(thread.result)
1741 time2 = time.time()
1742
1743 if( all(result == main.TRUE for result in results) == False):
1744 main.log.info("Did not install onos-app-ifwd feature properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -07001745 #main.cleanup()
1746 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -08001747 else:
1748 main.log.info("Successful feature:install onos-app-ifwd")
1749 installResult = main.TRUE
1750 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
1751
Hari Krishna22c3d412015-02-17 16:48:12 -08001752 main.step( "Verify Pingall" )
1753 ping_result = main.FALSE
1754 time1 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -08001755 ping_result = main.Mininet1.pingall(timeout=600)
Hari Krishna22c3d412015-02-17 16:48:12 -08001756 time2 = time.time()
1757 timeDiff = round( ( time2 - time1 ), 2 )
1758 main.log.report(
1759 "Time taken for Ping All: " +
1760 str( timeDiff ) +
1761 " seconds" )
kelvin-onlab54400a92015-02-26 18:05:51 -08001762
Hari Krishna22c3d412015-02-17 16:48:12 -08001763 if ping_result == main.TRUE:
1764 main.log.report( "Pingall Test in Reactive mode successful" )
1765 else:
1766 main.log.report( "Pingall Test in Reactive mode failed" )
1767
1768 main.step( "Disable Intent based Reactive forwarding" )
kelvin-onlab54400a92015-02-26 18:05:51 -08001769 uninstallResult = main.FALSE
1770
kelvin-onlab54400a92015-02-26 18:05:51 -08001771 pool = []
1772 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001773 for cli,feature in main.CLIs:
kelvin-onlab54400a92015-02-26 18:05:51 -08001774 t = main.Thread(target=cli,threadID=threadID,
1775 name="featureUninstall",args=[feature])
1776 pool.append(t)
1777 t.start()
1778 threadID = threadID + 1
1779
1780 results = []
1781 for thread in pool:
1782 thread.join()
1783 results.append(thread.result)
1784 time2 = time.time()
1785
1786 if( all(result == main.TRUE for result in results) == False):
1787 main.log.info("Did not uninstall onos-app-ifwd feature properly")
Hari Krishnab35c6d02015-03-18 11:13:51 -07001788 uninstallResult = main.FALSE
1789 #main.cleanup()
1790 #main.exit()
kelvin-onlab54400a92015-02-26 18:05:51 -08001791 else:
1792 main.log.info("Successful feature:uninstall onos-app-ifwd")
1793 uninstallResult = main.TRUE
1794 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
Hari Krishna22c3d412015-02-17 16:48:12 -08001795
1796 # Waiting for reative flows to be cleared.
1797 time.sleep( 10 )
1798
1799 case11Result = installResult and ping_result and uninstallResult
1800 utilities.assert_equals( expect=main.TRUE, actual=case11Result,
1801 onpass="Intent based Reactive forwarding Pingall test PASS",
1802 onfail="Intent based Reactive forwarding Pingall test FAIL" )
1803
1804 def CASE12( self, main ):
1805 """
1806 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
1807 """
1808 import re
1809 import time
1810 import copy
1811
Hari Krishnab35c6d02015-03-18 11:13:51 -07001812 main.newTopo = main.params['TOPO2']['topo']
Hari Krishna22c3d412015-02-17 16:48:12 -08001813 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
1814 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
1815 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001816 main.pingTimeout = 120
Hari Krishna22c3d412015-02-17 16:48:12 -08001817 main.log.report(
1818 "Load Chordal topology and Balance all Mininet switches across controllers" )
1819 main.log.report(
1820 "________________________________________________________________________" )
Hari Krishna22c3d412015-02-17 16:48:12 -08001821 main.case(
1822 "Assign and Balance all Mininet switches across controllers" )
1823 main.step( "Stop any previous Mininet network topology" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001824 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
1825 time.sleep(10)
Hari Krishna22c3d412015-02-17 16:48:12 -08001826 main.step( "Start Mininet with Chordal topology" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001827 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
1828 time.sleep(15)
Hari Krishna22c3d412015-02-17 16:48:12 -08001829 main.step( "Assign switches to controllers" )
1830 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
1831 main.Mininet1.assignSwController(
1832 sw=str( i ),
1833 count=int( main.numCtrls ),
1834 ip1=main.ONOS1_ip,
1835 port1=main.ONOS1_port,
1836 ip2=main.ONOS2_ip,
1837 port2=main.ONOS2_port,
1838 ip3=main.ONOS3_ip,
1839 port3=main.ONOS3_port,
1840 ip4=main.ONOS4_ip,
1841 port4=main.ONOS4_port,
1842 ip5=main.ONOS5_ip,
1843 port5=main.ONOS5_port )
1844
1845 switch_mastership = main.TRUE
1846 for i in range( 1, ( main.numMNswitches + 1 ) ):
1847 response = main.Mininet1.getSwController( "s" + str( i ) )
1848 print( "Response is " + str( response ) )
1849 if re.search( "tcp:" + main.ONOS1_ip, response ):
1850 switch_mastership = switch_mastership and main.TRUE
1851 else:
1852 switch_mastership = main.FALSE
1853
1854 if switch_mastership == main.TRUE:
1855 main.log.report( "Controller assignment successfull" )
1856 else:
1857 main.log.report( "Controller assignment failed" )
1858 time.sleep( 5 )
kelvin-onlab54400a92015-02-26 18:05:51 -08001859
Hari Krishnab35c6d02015-03-18 11:13:51 -07001860 #Don't balance master for now..
1861 """
Hari Krishna22c3d412015-02-17 16:48:12 -08001862 main.step( "Balance devices across controllers" )
1863 for i in range( int( main.numCtrls ) ):
1864 balanceResult = main.ONOScli1.balanceMasters()
1865 # giving some breathing time for ONOS to complete re-balance
1866 time.sleep( 3 )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001867 """
1868 case12Result = switch_mastership
1869 time.sleep(30)
Hari Krishna22c3d412015-02-17 16:48:12 -08001870 utilities.assert_equals(
1871 expect=main.TRUE,
1872 actual=case12Result,
1873 onpass="Starting new Chordal topology test PASS",
1874 onfail="Starting new Chordal topology test FAIL" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001875
Hari Krishna22c3d412015-02-17 16:48:12 -08001876 def CASE13( self, main ):
1877 """
1878 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
1879 """
1880 import re
1881 import time
1882 import copy
1883
Hari Krishnab35c6d02015-03-18 11:13:51 -07001884 main.newTopo = main.params['TOPO3']['topo']
Hari Krishna22c3d412015-02-17 16:48:12 -08001885 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
1886 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
1887 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
kelvin-onlab54400a92015-02-26 18:05:51 -08001888 main.pingTimeout = 600
Hari Krishnaef1bd4e2015-03-12 16:55:30 -07001889
Hari Krishna22c3d412015-02-17 16:48:12 -08001890 main.log.report(
1891 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
1892 main.log.report(
1893 "________________________________________________________________________" )
1894 # need to wait here for sometime until ONOS bootup
Hari Krishna22c3d412015-02-17 16:48:12 -08001895 main.case(
1896 "Assign and Balance all Mininet switches across controllers" )
1897 main.step( "Stop any previous Mininet network topology" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001898 stopStatus = main.Mininet1.stopNet(fileName = "topoSpine" )
Hari Krishna22c3d412015-02-17 16:48:12 -08001899 main.step( "Start Mininet with Spine topology" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001900 startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
1901 time.sleep(20)
Hari Krishna22c3d412015-02-17 16:48:12 -08001902 main.step( "Assign switches to controllers" )
1903 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
1904 main.Mininet1.assignSwController(
1905 sw=str( i ),
Hari Krishnab35c6d02015-03-18 11:13:51 -07001906 count= 1,
Hari Krishna22c3d412015-02-17 16:48:12 -08001907 ip1=main.ONOS1_ip,
1908 port1=main.ONOS1_port,
1909 ip2=main.ONOS2_ip,
1910 port2=main.ONOS2_port,
1911 ip3=main.ONOS3_ip,
1912 port3=main.ONOS3_port,
1913 ip4=main.ONOS4_ip,
1914 port4=main.ONOS4_port,
1915 ip5=main.ONOS5_ip,
1916 port5=main.ONOS5_port )
1917
1918 switch_mastership = main.TRUE
1919 for i in range( 1, ( main.numMNswitches + 1 ) ):
1920 response = main.Mininet1.getSwController( "s" + str( i ) )
1921 print( "Response is " + str( response ) )
1922 if re.search( "tcp:" + main.ONOS1_ip, response ):
1923 switch_mastership = switch_mastership and main.TRUE
1924 else:
1925 switch_mastership = main.FALSE
Hari Krishnab35c6d02015-03-18 11:13:51 -07001926
Hari Krishna22c3d412015-02-17 16:48:12 -08001927 if switch_mastership == main.TRUE:
1928 main.log.report( "Controller assignment successfull" )
1929 else:
1930 main.log.report( "Controller assignment failed" )
1931 time.sleep( 5 )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001932 """
kelvin-onlab54400a92015-02-26 18:05:51 -08001933 main.step( "Balance devices across controllers" )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001934
kelvin-onlab54400a92015-02-26 18:05:51 -08001935 for i in range( int( main.numCtrls ) ):
1936 balanceResult = main.ONOScli1.balanceMasters()
1937 # giving some breathing time for ONOS to complete re-balance
1938 time.sleep( 3 )
Hari Krishna22c3d412015-02-17 16:48:12 -08001939
1940 main.step( "Balance devices across controllers" )
1941 for i in range( int( main.numCtrls ) ):
1942 balanceResult = main.ONOScli1.balanceMasters()
1943 # giving some breathing time for ONOS to complete re-balance
1944 time.sleep( 3 )
Hari Krishnab35c6d02015-03-18 11:13:51 -07001945 """
1946 case13Result = switch_mastership
1947 time.sleep(30)
Hari Krishna22c3d412015-02-17 16:48:12 -08001948 utilities.assert_equals(
1949 expect=main.TRUE,
1950 actual=case13Result,
1951 onpass="Starting new Spine topology test PASS",
1952 onfail="Starting new Spine topology test FAIL" )
kelvin-onlab54400a92015-02-26 18:05:51 -08001953
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001954 def CASE14( self ):
kelvin-onlab54400a92015-02-26 18:05:51 -08001955 """
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001956 Install 300 host intents and verify ping all for Chordal Topology
kelvin-onlab54400a92015-02-26 18:05:51 -08001957 """
Hari Krishnab35c6d02015-03-18 11:13:51 -07001958 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
kelvin-onlab54400a92015-02-26 18:05:51 -08001959 main.log.report( "_______________________________________" )
1960 import itertools
1961
1962 main.case( "Install 300 host intents" )
1963 main.step( "Add host Intents" )
1964 intentResult = main.TRUE
1965 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1966
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001967 intentIdList = []
kelvin-onlab54400a92015-02-26 18:05:51 -08001968 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001969
1970 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
kelvin-onlab54400a92015-02-26 18:05:51 -08001971 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001972 for cli in main.CLIs:
1973 if i >= len( hostCombos ):
kelvin-onlab54400a92015-02-26 18:05:51 -08001974 break
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001975 t = main.Thread( target=cli.addHostIntent,
1976 threadID=main.threadID,
kelvin-onlab54400a92015-02-26 18:05:51 -08001977 name="addHostIntent",
1978 args=[hostCombos[i][0],hostCombos[i][1]])
1979 pool.append(t)
1980 t.start()
1981 i = i + 1
1982 main.threadID = main.threadID + 1
kelvin-onlab54400a92015-02-26 18:05:51 -08001983 for thread in pool:
1984 thread.join()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001985 intentIdList.append(thread.result)
kelvin-onlab54400a92015-02-26 18:05:51 -08001986 time2 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -08001987 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08001988 intentResult = main.TRUE
1989 intentsJson = main.ONOScli2.intents()
1990 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
1991 intentsJson = intentsJson)
1992 print getIntentStateResult
1993
kelvin-onlab54400a92015-02-26 18:05:51 -08001994 main.step( "Verify Ping across all hosts" )
1995 pingResult = main.FALSE
1996 time1 = time.time()
1997 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1998 time2 = time.time()
1999 timeDiff = round( ( time2 - time1 ), 2 )
2000 main.log.report(
2001 "Time taken for Ping All: " +
2002 str( timeDiff ) +
2003 " seconds" )
2004 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2005 onpass="PING ALL PASS",
2006 onfail="PING ALL FAIL" )
2007
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002008 case14Result = ( intentResult and pingResult )
kelvin-onlab54400a92015-02-26 18:05:51 -08002009
kelvin-onlab54400a92015-02-26 18:05:51 -08002010 utilities.assert_equals(
2011 expect=main.TRUE,
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002012 actual=case14Result,
kelvin-onlab54400a92015-02-26 18:05:51 -08002013 onpass="Install 300 Host Intents and Ping All test PASS",
2014 onfail="Install 300 Host Intents and Ping All test FAIL" )
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002015
2016 def CASE15( self ):
kelvin-onlab54400a92015-02-26 18:05:51 -08002017 """
Hari Krishnab35c6d02015-03-18 11:13:51 -07002018 Install 2278 host intents and verify ping all for Spine Topology
kelvin-onlab54400a92015-02-26 18:05:51 -08002019 """
Hari Krishnab35c6d02015-03-18 11:13:51 -07002020 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002021 main.log.report( "_______________________________________" )
2022 import itertools
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002023
Hari Krishnab35c6d02015-03-18 11:13:51 -07002024 main.case( "Install 2278 host intents" )
kelvin-onlab54400a92015-02-26 18:05:51 -08002025 main.step( "Add host Intents" )
2026 intentResult = main.TRUE
2027 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnab35c6d02015-03-18 11:13:51 -07002028 main.pingTimeout = 300
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002029 intentIdList = []
kelvin-onlab54400a92015-02-26 18:05:51 -08002030 time1 = time.time()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002031 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
kelvin-onlab54400a92015-02-26 18:05:51 -08002032 pool = []
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002033 for cli in main.CLIs:
2034 if i >= len( hostCombos ):
kelvin-onlab54400a92015-02-26 18:05:51 -08002035 break
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002036 t = main.Thread( target=cli.addHostIntent,
2037 threadID=main.threadID,
kelvin-onlab54400a92015-02-26 18:05:51 -08002038 name="addHostIntent",
2039 args=[hostCombos[i][0],hostCombos[i][1]])
2040 pool.append(t)
2041 t.start()
2042 i = i + 1
2043 main.threadID = main.threadID + 1
kelvin-onlab54400a92015-02-26 18:05:51 -08002044 for thread in pool:
2045 thread.join()
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002046 intentIdList.append(thread.result)
kelvin-onlab54400a92015-02-26 18:05:51 -08002047 time2 = time.time()
kelvin-onlab54400a92015-02-26 18:05:51 -08002048 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002049 intentResult = main.TRUE
2050 intentsJson = main.ONOScli2.intents()
2051 getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
2052 intentsJson = intentsJson)
2053 print getIntentStateResult
2054
kelvin-onlab54400a92015-02-26 18:05:51 -08002055 main.step( "Verify Ping across all hosts" )
2056 pingResult = main.FALSE
2057 time1 = time.time()
2058 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
2059 time2 = time.time()
2060 timeDiff = round( ( time2 - time1 ), 2 )
2061 main.log.report(
2062 "Time taken for Ping All: " +
2063 str( timeDiff ) +
2064 " seconds" )
2065 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2066 onpass="PING ALL PASS",
2067 onfail="PING ALL FAIL" )
2068
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002069 case15Result = ( intentResult and pingResult )
kelvin-onlab54400a92015-02-26 18:05:51 -08002070
kelvin-onlab54400a92015-02-26 18:05:51 -08002071 utilities.assert_equals(
2072 expect=main.TRUE,
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002073 actual=case15Result,
Hari Krishnab35c6d02015-03-18 11:13:51 -07002074 onpass="Install 2278 Host Intents and Ping All test PASS",
2075 onfail="Install 2278 Host Intents and Ping All test FAIL" )
2076
2077 def CASE99(self):
2078 import time
2079 # WORK AROUND FOR ONOS-581. STOP ONOS BEFORE ASSIGNING CONTROLLERS AT MININET & START ONCE DONE
2080 main.step( "Stop ONOS on all Nodes" )
2081 stopResult = main.TRUE
2082 for i in range( 1, int( main.numCtrls ) + 1 ):
2083 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2084 main.log.info( "Stopping ONOS Node IP: " + ONOS_ip )
2085 sresult = main.ONOSbench.onosStop( ONOS_ip )
2086 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2087 onpass="Test step PASS",
2088 onfail="Test step FAIL" )
2089 stopResult = ( stopResult and sresult )
2090
2091 main.step( "Start ONOS on all Nodes" )
2092 startResult = main.TRUE
2093 for i in range( 1, int( main.numCtrls ) + 1 ):
2094 ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
2095 main.log.info( "Starting ONOS Node IP: " + ONOS_ip )
2096 sresult = main.ONOSbench.onosStart( ONOS_ip )
2097 utilities.assert_equals( expect=main.TRUE, actual=sresult,
2098 onpass="Test step PASS",
2099 onfail="Test step FAIL" )
2100 startResult = ( startResult and sresult )
2101
2102 main.step( "Start ONOS CLI on all nodes" )
2103 cliResult = main.TRUE
2104 time.sleep( 30 )
2105 main.log.step(" Start ONOS cli using thread ")
2106 pool = []
2107 time1 = time.time()
2108 for i in range( int( main.numCtrls ) ):
2109 t = main.Thread(target=main.CLIs[i].startOnosCli,
2110 threadID=main.threadID,
2111 name="startOnosCli",
2112 args=[main.nodes[i].ip_address])
2113 pool.append(t)
2114 t.start()
2115 main.threadID = main.threadID + 1
2116 for t in pool:
2117 t.join()
2118 cliResult = cliResult and t.result
2119 time2 = time.time()
2120
2121 if not cliResult:
2122 main.log.info("ONOS CLI did not start up properly")
2123 #main.cleanup()
2124 #main.exit()
2125 else:
2126 main.log.info("Successful CLI startup")
2127 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
2128
2129 case99Result = ( startResult and cliResult )
2130 time.sleep(30)
2131 utilities.assert_equals(
2132 expect=main.TRUE,
2133 actual=case99Result,
2134 onpass="Starting new Chordal topology test PASS",
2135 onfail="Starting new Chordal topology test FAIL" )
2136
2137
kelvin-onlab78f7d2d2015-03-02 17:37:35 -08002138
kelvin-onlabc3ab3012015-03-10 15:04:46 -07002139