blob: 44f7bc9874c5a23c9cc0248877d04e2a8d2d4422 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
19 mvn clean install
20 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070021 onos-verify-cell
22 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070023 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070024 onos-start-cli
25 """
26 import time
27
28 global intentState
29 main.threadID = 0
30 main.pingTimeout = 300
31 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070032 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
33 git_branch = main.params[ 'GIT' ][ 'branch' ]
Hari Krishna10065772015-07-10 15:55:53 -070034 karafTimeout = main.params['CTRL']['karafCliTimeout']
GlennRCa8d786a2015-09-23 17:40:11 -070035 main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] )
GlennRCf7be6632015-10-20 13:04:07 -070036 main.failSwitch = main.params['TEST']['pauseTest']
GlennRC9e7465e2015-10-02 13:50:36 -070037 main.emailOnStop = main.params['TEST']['email']
GlennRCf7be6632015-10-20 13:04:07 -070038 main.intentCheck = int( main.params['TEST']['intentChecks'] )
39 main.numPings = int( main.params['TEST']['numPings'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070040 main.newTopo = ""
41 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070042
GlennRC9e7465e2015-10-02 13:50:36 -070043 main.failSwitch = True if main.failSwitch == "on" else False
44 main.emailOnStop = True if main.emailOnStop == "on" else False
45
Hari Krishnac195f3b2015-07-08 20:02:24 -070046 for i in range( 1, int(main.numCtrls) + 1 ):
47 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070048
49 main.case( "Set up test environment" )
50 main.log.report( "Set up test environment" )
51 main.log.report( "_______________________" )
52
Hari Krishna6185fc12015-07-13 15:42:31 -070053 main.step( "Apply Cell environment for ONOS" )
54 if ( main.onoscell ):
55 cellName = main.onoscell
56 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070057 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
58 onpass="Test step PASS",
59 onfail="Test step FAIL" )
60 else:
61 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
62 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
63 main.clean()
64 main.exit()
65
Hari Krishnac195f3b2015-07-08 20:02:24 -070066 main.step( "Git checkout and pull " + git_branch )
67 if git_pull == 'on':
68 checkout_result = main.ONOSbench.gitCheckout( git_branch )
69 pull_result = main.ONOSbench.gitPull()
70 cp_result = ( checkout_result and pull_result )
71 else:
72 checkout_result = main.TRUE
73 pull_result = main.TRUE
74 main.log.info( "Skipped git checkout and pull" )
75 cp_result = ( checkout_result and pull_result )
76 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
77 onpass="Test step PASS",
78 onfail="Test step FAIL" )
79
80 main.step( "mvn clean & install" )
81 if git_pull == 'on':
82 mvn_result = main.ONOSbench.cleanInstall()
83 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
84 onpass="Test step PASS",
85 onfail="Test step FAIL" )
86 else:
87 mvn_result = main.TRUE
88 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
89
90 main.ONOSbench.getVersion( report=True )
91
Hari Krishnac195f3b2015-07-08 20:02:24 -070092 main.step( "Create ONOS package" )
93 packageResult = main.ONOSbench.onosPackage()
94 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
95 onpass="Test step PASS",
96 onfail="Test step FAIL" )
97
98 main.step( "Uninstall ONOS package on all Nodes" )
99 uninstallResult = main.TRUE
100 for i in range( int( main.numCtrls ) ):
101 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
102 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
103 utilities.assert_equals( expect=main.TRUE, actual=u_result,
104 onpass="Test step PASS",
105 onfail="Test step FAIL" )
106 uninstallResult = ( uninstallResult and u_result )
107
108 main.step( "Install ONOS package on all Nodes" )
109 installResult = main.TRUE
110 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700111 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700112 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
113 utilities.assert_equals( expect=main.TRUE, actual=i_result,
114 onpass="Test step PASS",
115 onfail="Test step FAIL" )
116 installResult = ( installResult and i_result )
117
118 main.step( "Verify ONOS nodes UP status" )
119 statusResult = main.TRUE
120 for i in range( int( main.numCtrls ) ):
121 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
122 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
123 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
124 onpass="Test step PASS",
125 onfail="Test step FAIL" )
126 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700127
Hari Krishnac195f3b2015-07-08 20:02:24 -0700128 main.step( "Start ONOS CLI on all nodes" )
129 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700130 main.log.step(" Start ONOS cli using thread ")
131 startCliResult = main.TRUE
132 pool = []
133 time1 = time.time()
134 for i in range( int( main.numCtrls) ):
135 t = main.Thread( target=main.CLIs[i].startOnosCli,
136 threadID=main.threadID,
137 name="startOnosCli",
138 args=[ main.onosIPs[i], karafTimeout ] )
139 pool.append(t)
140 t.start()
141 main.threadID = main.threadID + 1
142 for t in pool:
143 t.join()
144 startCliResult = startCliResult and t.result
145 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700146
Hari Krishnac195f3b2015-07-08 20:02:24 -0700147 if not startCliResult:
148 main.log.info("ONOS CLI did not start up properly")
149 main.cleanup()
150 main.exit()
151 else:
152 main.log.info("Successful CLI startup")
153 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700154
155 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
156 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
157 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
158 cfgResult = cfgResult1 and cfgResult2
159 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
160 onpass="ipv6NeighborDiscovery cfg is set to true",
161 onfail="Failed to cfg set ipv6NeighborDiscovery" )
162
163 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700164 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
165 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
166 onpass="Set up test environment PASS",
167 onfail="Set up test environment FAIL" )
168
169 def CASE20( self, main ):
170 """
171 This test script Loads a new Topology (Att) on CHO setup and balances all switches
172 """
173 import re
174 import time
175 import copy
176
177 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
178 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
179 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
180 main.pingTimeout = 300
181 main.log.report(
182 "Load Att topology and Balance all Mininet switches across controllers" )
183 main.log.report(
184 "________________________________________________________________________" )
185 main.case(
186 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700187
Hari Krishnac195f3b2015-07-08 20:02:24 -0700188 main.step( "Stop any previous Mininet network topology" )
189 cliResult = main.TRUE
190 if main.newTopo == main.params['TOPO3']['topo']:
191 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
192
193 main.step( "Start Mininet with Att topology" )
194 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700195 mininetDir = main.Mininet1.home + "/custom/"
196 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
197 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
198 topoPath = mininetDir + main.newTopo
199 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700200
Hari Krishnac195f3b2015-07-08 20:02:24 -0700201 main.step( "Assign switches to controllers" )
202 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
203 main.Mininet1.assignSwController(
204 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700205 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700206
207 switch_mastership = main.TRUE
208 for i in range( 1, ( main.numMNswitches + 1 ) ):
209 response = main.Mininet1.getSwController( "s" + str( i ) )
210 print( "Response is " + str( response ) )
211 if re.search( "tcp:" + main.onosIPs[0], response ):
212 switch_mastership = switch_mastership and main.TRUE
213 else:
214 switch_mastership = main.FALSE
215
216 if switch_mastership == main.TRUE:
217 main.log.report( "Controller assignment successfull" )
218 else:
219 main.log.report( "Controller assignment failed" )
220
221 time.sleep(30) # waiting here to make sure topology converges across all nodes
222
223 main.step( "Balance devices across controllers" )
224 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700225 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700226 time.sleep( 5 )
227
228 topology_output = main.ONOScli1.topology()
229 topology_result = main.ONOSbench.getTopology( topology_output )
230 case2Result = ( switch_mastership and startStatus )
231 utilities.assert_equals(
232 expect=main.TRUE,
233 actual=case2Result,
234 onpass="Starting new Att topology test PASS",
235 onfail="Starting new Att topology test FAIL" )
236
237 def CASE21( self, main ):
238 """
239 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
240 """
241 import re
242 import time
243 import copy
244
245 main.newTopo = main.params['TOPO2']['topo']
246 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
247 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
248 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
249 main.pingTimeout = 300
250 main.log.report(
251 "Load Chordal topology and Balance all Mininet switches across controllers" )
252 main.log.report(
253 "________________________________________________________________________" )
254 main.case(
255 "Assign and Balance all Mininet switches across controllers" )
256
257 main.step( "Stop any previous Mininet network topology" )
258 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
259
GlennRCc6cd2a62015-08-10 16:08:22 -0700260 main.step("Start Mininet with Chordal topology")
261 mininetDir = main.Mininet1.home + "/custom/"
262 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
263 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
264 topoPath = mininetDir + main.newTopo
265 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700266
267 main.step( "Assign switches to controllers" )
268
269 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
270 main.Mininet1.assignSwController(
271 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700272 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700273
274 switch_mastership = main.TRUE
275 for i in range( 1, ( main.numMNswitches + 1 ) ):
276 response = main.Mininet1.getSwController( "s" + str( i ) )
277 print( "Response is " + str( response ) )
278 if re.search( "tcp:" + main.onosIPs[0], response ):
279 switch_mastership = switch_mastership and main.TRUE
280 else:
281 switch_mastership = main.FALSE
282
283 if switch_mastership == main.TRUE:
284 main.log.report( "Controller assignment successfull" )
285 else:
286 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700287
Hari Krishnac195f3b2015-07-08 20:02:24 -0700288 main.step( "Balance devices across controllers" )
289 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700290 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700291 time.sleep( 5 )
292
GlennRCbddd58f2015-10-01 15:45:25 -0700293 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700294 time.sleep(30)
295 utilities.assert_equals(
296 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700297 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700298 onpass="Starting new Chordal topology test PASS",
299 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700300
Hari Krishnac195f3b2015-07-08 20:02:24 -0700301 def CASE22( self, main ):
302 """
303 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
304 """
305 import re
306 import time
307 import copy
308
309 main.newTopo = main.params['TOPO3']['topo']
310 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
311 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
312 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
313 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700314
Hari Krishnac195f3b2015-07-08 20:02:24 -0700315 main.log.report(
316 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
317 main.log.report(
318 "________________________________________________________________________" )
319 main.case(
320 "Assign and Balance all Mininet switches across controllers" )
321 main.step( "Stop any previous Mininet network topology" )
322 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700323
324 main.step("Start Mininet with Spine topology")
325 mininetDir = main.Mininet1.home + "/custom/"
326 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
327 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
328 topoPath = mininetDir + main.newTopo
329 startStatus = main.Mininet1.startNet(topoFile = topoPath)
330
Hari Krishnac195f3b2015-07-08 20:02:24 -0700331 time.sleep(60)
332 main.step( "Assign switches to controllers" )
333
334 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
335 main.Mininet1.assignSwController(
336 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700337 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700338
339 switch_mastership = main.TRUE
340 for i in range( 1, ( main.numMNswitches + 1 ) ):
341 response = main.Mininet1.getSwController( "s" + str( i ) )
342 print( "Response is " + str( response ) )
343 if re.search( "tcp:" + main.onosIPs[0], response ):
344 switch_mastership = switch_mastership and main.TRUE
345 else:
346 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700347
Hari Krishnac195f3b2015-07-08 20:02:24 -0700348 if switch_mastership == main.TRUE:
349 main.log.report( "Controller assignment successfull" )
350 else:
351 main.log.report( "Controller assignment failed" )
352 time.sleep( 5 )
353
354 main.step( "Balance devices across controllers" )
355 for i in range( int( main.numCtrls ) ):
356 balanceResult = main.ONOScli1.balanceMasters()
357 # giving some breathing time for ONOS to complete re-balance
358 time.sleep( 3 )
359
GlennRCbddd58f2015-10-01 15:45:25 -0700360 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700361 time.sleep(60)
362 utilities.assert_equals(
363 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700364 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700365 onpass="Starting new Spine topology test PASS",
366 onfail="Starting new Spine topology test FAIL" )
367
368 def CASE3( self, main ):
369 """
370 This Test case will be extended to collect and store more data related
371 ONOS state.
372 """
373 import re
374 import copy
375 main.deviceDPIDs = []
376 main.hostMACs = []
377 main.deviceLinks = []
378 main.deviceActiveLinksCount = []
379 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700380
Hari Krishnac195f3b2015-07-08 20:02:24 -0700381 main.log.report(
382 "Collect and Store topology details from ONOS before running any Tests" )
383 main.log.report(
384 "____________________________________________________________________" )
385 main.case( "Collect and Store Topology Details from ONOS" )
386 main.step( "Collect and store current number of switches and links" )
387 topology_output = main.ONOScli1.topology()
388 topology_result = main.ONOSbench.getTopology( topology_output )
389 numOnosDevices = topology_result[ 'devices' ]
390 numOnosLinks = topology_result[ 'links' ]
391 topoResult = main.TRUE
392
393 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
394 main.step( "Store Device DPIDs" )
395 for i in range( 1, (main.numMNswitches+1) ):
396 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
397 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
398
399 main.step( "Store Host MACs" )
400 for i in range( 1, ( main.numMNhosts + 1 ) ):
401 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
402 print "Host MACs in Store: \n", str( main.hostMACs )
403 main.MACsDict = {}
404 print "Creating dictionary of DPID and HostMacs"
405 for i in range(len(main.hostMACs)):
406 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
407 print main.MACsDict
408 main.step( "Collect and store all Devices Links" )
409 linksResult = main.ONOScli1.links( jsonFormat=False )
410 ansi_escape = re.compile( r'\x1b[^m]*m' )
411 linksResult = ansi_escape.sub( '', linksResult )
412 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
413 linksResult = linksResult.splitlines()
414 main.deviceLinks = copy.copy( linksResult )
415 print "Device Links Stored: \n", str( main.deviceLinks )
416 # this will be asserted to check with the params provided count of
417 # links
418 print "Length of Links Store", len( main.deviceLinks )
419
420 main.step( "Collect and store each Device ports enabled Count" )
421 time1 = time.time()
422 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
423 pool = []
424 for cli in main.CLIs:
425 if i >= main.numMNswitches + 1:
426 break
427 dpid = "of:00000000000000" + format( i,'02x' )
428 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
429 t.start()
430 pool.append(t)
431 i = i + 1
432 main.threadID = main.threadID + 1
433 for thread in pool:
434 thread.join()
435 portResult = thread.result
436 main.devicePortsEnabledCount.append( portResult )
437 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
438 time2 = time.time()
439 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
440
441 main.step( "Collect and store each Device active links Count" )
442 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700443
Hari Krishnac195f3b2015-07-08 20:02:24 -0700444 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
445 pool = []
446 for cli in main.CLIs:
447 if i >= main.numMNswitches + 1:
448 break
449 dpid = "of:00000000000000" + format( i,'02x' )
450 t = main.Thread( target = cli.getDeviceLinksActiveCount,
451 threadID = main.threadID,
452 name = "getDevicePortsEnabledCount",
453 args = [dpid])
454 t.start()
455 pool.append(t)
456 i = i + 1
457 main.threadID = main.threadID + 1
458 for thread in pool:
459 thread.join()
460 linkCountResult = thread.result
461 main.deviceActiveLinksCount.append( linkCountResult )
462 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
463 time2 = time.time()
464 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
465
466 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700467 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700468 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
469 main.log.info("Devices (actual): %s, Links (actual): %s" %
470 ( numOnosDevices , numOnosLinks ) )
471 main.log.info("Topology does not match, exiting CHO test...")
472 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700473 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700474 main.cleanup()
475 main.exit()
476
477 # just returning TRUE for now as this one just collects data
478 case3Result = topoResult
479 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
480 onpass="Saving ONOS topology data test PASS",
481 onfail="Saving ONOS topology data test FAIL" )
482
483 def CASE40( self, main ):
484 """
485 Verify Reactive forwarding (Att Topology)
486 """
487 import re
488 import copy
489 import time
490 main.log.report( "Verify Reactive forwarding (Att Topology)" )
491 main.log.report( "______________________________________________" )
492 main.case( "Enable Reactive forwarding and Verify ping all" )
493 main.step( "Enable Reactive forwarding" )
494 installResult = main.TRUE
495 # Activate fwd app
496 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
497 appCheck = main.TRUE
498 pool = []
499 for cli in main.CLIs:
500 t = main.Thread( target=cli.appToIDCheck,
501 name="appToIDCheck-" + str( i ),
502 args=[] )
503 pool.append( t )
504 t.start()
505 for t in pool:
506 t.join()
507 appCheck = appCheck and t.result
508 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
509 onpass="App Ids seem to be correct",
510 onfail="Something is wrong with app Ids" )
511 if appCheck != main.TRUE:
512 main.log.warn( main.CLIs[0].apps() )
513 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700514
Hari Krishnac195f3b2015-07-08 20:02:24 -0700515 time.sleep( 10 )
516
517 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700518 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700519 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700520 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
521 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700522 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700523 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700524 time2 = time.time()
525 timeDiff = round( ( time2 - time1 ), 2 )
526 main.log.report(
527 "Time taken for Ping All: " +
528 str( timeDiff ) +
529 " seconds" )
530
GlennRC626ba132015-09-18 16:16:31 -0700531 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700532 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700533 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700534 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700535
GlennRCbddd58f2015-10-01 15:45:25 -0700536 caseResult = appCheck and pingResult
537 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700538 onpass="Reactive Mode IPv4 Pingall test PASS",
539 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700540
541 def CASE41( self, main ):
542 """
543 Verify Reactive forwarding (Chordal Topology)
544 """
545 import re
546 import copy
547 import time
548 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
549 main.log.report( "______________________________________________" )
550 main.case( "Enable Reactive forwarding and Verify ping all" )
551 main.step( "Enable Reactive forwarding" )
552 installResult = main.TRUE
553 # Activate fwd app
554 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
555
556 appCheck = main.TRUE
557 pool = []
558 for cli in main.CLIs:
559 t = main.Thread( target=cli.appToIDCheck,
560 name="appToIDCheck-" + str( i ),
561 args=[] )
562 pool.append( t )
563 t.start()
564 for t in pool:
565 t.join()
566 appCheck = appCheck and t.result
567 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
568 onpass="App Ids seem to be correct",
569 onfail="Something is wrong with app Ids" )
570 if appCheck != main.TRUE:
571 main.log.warn( main.CLIs[0].apps() )
572 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700573
Hari Krishnac195f3b2015-07-08 20:02:24 -0700574 time.sleep( 10 )
575
576 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700577 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700578 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700579 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
580 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700581 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700582 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700583 time2 = time.time()
584 timeDiff = round( ( time2 - time1 ), 2 )
585 main.log.report(
586 "Time taken for Ping All: " +
587 str( timeDiff ) +
588 " seconds" )
589
GlennRC626ba132015-09-18 16:16:31 -0700590 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700591 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700592 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700593 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700594
GlennRCbddd58f2015-10-01 15:45:25 -0700595 caseResult = appCheck and pingResult
596 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700597 onpass="Reactive Mode IPv4 Pingall test PASS",
598 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700599
600 def CASE42( self, main ):
601 """
602 Verify Reactive forwarding (Spine Topology)
603 """
604 import re
605 import copy
606 import time
607 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
608 main.log.report( "______________________________________________" )
609 main.case( "Enable Reactive forwarding and Verify ping all" )
610 main.step( "Enable Reactive forwarding" )
611 installResult = main.TRUE
612 # Activate fwd app
613 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
614
615 appCheck = main.TRUE
616 pool = []
617 for cli in main.CLIs:
618 t = main.Thread( target=cli.appToIDCheck,
619 name="appToIDCheck-" + str( i ),
620 args=[] )
621 pool.append( t )
622 t.start()
623 for t in pool:
624 t.join()
625 appCheck = appCheck and t.result
626 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
627 onpass="App Ids seem to be correct",
628 onfail="Something is wrong with app Ids" )
629 if appCheck != main.TRUE:
630 main.log.warn( main.CLIs[0].apps() )
631 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700632
Hari Krishnac195f3b2015-07-08 20:02:24 -0700633 time.sleep( 10 )
634
635 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700636 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700637 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700638 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
639 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700640 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700641 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700642 time2 = time.time()
643 timeDiff = round( ( time2 - time1 ), 2 )
644 main.log.report(
645 "Time taken for Ping All: " +
646 str( timeDiff ) +
647 " seconds" )
648
GlennRC626ba132015-09-18 16:16:31 -0700649 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700650 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700651 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700652 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
653
GlennRCbddd58f2015-10-01 15:45:25 -0700654 caseResult = appCheck and pingResult
655 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700656 onpass="Reactive Mode IPv4 Pingall test PASS",
657 onfail="Reactive Mode IPv4 Pingall test FAIL" )
658
659 def CASE140( self, main ):
660 """
661 Verify IPv6 Reactive forwarding (Att Topology)
662 """
663 import re
664 import copy
665 import time
666 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
667 main.log.report( "______________________________________________" )
668 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
669 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
670
671 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
672 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
673 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
674 cfgResult = cfgResult1 and cfgResult2
675 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
676 onpass="Reactive mode ipv6Fowarding cfg is set to true",
677 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
678
679 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700680 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700681 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700682 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
683 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700684 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700685 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700686 time2 = time.time()
687 timeDiff = round( ( time2 - time1 ), 2 )
688 main.log.report(
689 "Time taken for IPv6 Ping All: " +
690 str( timeDiff ) +
691 " seconds" )
692
GlennRC626ba132015-09-18 16:16:31 -0700693 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700694 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
695 else:
696 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700697
698 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700699
Hari Krishnac195f3b2015-07-08 20:02:24 -0700700 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700701 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700702 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
703 pool = []
704 for cli in main.CLIs:
705 t = main.Thread( target=cli.appToIDCheck,
706 name="appToIDCheck-" + str( i ),
707 args=[] )
708 pool.append( t )
709 t.start()
710
711 for t in pool:
712 t.join()
713 appCheck = appCheck and t.result
714 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
715 onpass="App Ids seem to be correct",
716 onfail="Something is wrong with app Ids" )
717 if appCheck != main.TRUE:
718 main.log.warn( main.CLIs[0].apps() )
719 main.log.warn( main.CLIs[0].appIDs() )
720
721 # Waiting for reative flows to be cleared.
722 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700723 caseResult = appCheck and cfgResult and pingResult
724 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700725 onpass="Reactive Mode IPv6 Pingall test PASS",
726 onfail="Reactive Mode IPv6 Pingall test FAIL" )
727
728 def CASE141( self, main ):
729 """
730 Verify IPv6 Reactive forwarding (Chordal Topology)
731 """
732 import re
733 import copy
734 import time
735 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
736 main.log.report( "______________________________________________" )
737 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
738 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
739
740 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
741 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
742 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
743 cfgResult = cfgResult1 and cfgResult2
744 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
745 onpass="Reactive mode ipv6Fowarding cfg is set to true",
746 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
747
748 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700749 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700750 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700751 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
752 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700753 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700754 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700755 time2 = time.time()
756 timeDiff = round( ( time2 - time1 ), 2 )
757 main.log.report(
758 "Time taken for IPv6 Ping All: " +
759 str( timeDiff ) +
760 " seconds" )
761
GlennRC626ba132015-09-18 16:16:31 -0700762 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700763 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
764 else:
765 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
766
767 main.step( "Disable Reactive forwarding" )
768
769 main.log.info( "Uninstall reactive forwarding app" )
770 appCheck = main.TRUE
771 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
772 pool = []
773 for cli in main.CLIs:
774 t = main.Thread( target=cli.appToIDCheck,
775 name="appToIDCheck-" + str( i ),
776 args=[] )
777 pool.append( t )
778 t.start()
779
780 for t in pool:
781 t.join()
782 appCheck = appCheck and t.result
783 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
784 onpass="App Ids seem to be correct",
785 onfail="Something is wrong with app Ids" )
786 if appCheck != main.TRUE:
787 main.log.warn( main.CLIs[0].apps() )
788 main.log.warn( main.CLIs[0].appIDs() )
789
790 # Waiting for reative flows to be cleared.
791 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700792 caseResult = appCheck and cfgResult and pingResult
793 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700794 onpass="Reactive Mode IPv6 Pingall test PASS",
795 onfail="Reactive Mode IPv6 Pingall test FAIL" )
796
797 def CASE142( self, main ):
798 """
799 Verify IPv6 Reactive forwarding (Spine Topology)
800 """
801 import re
802 import copy
803 import time
804 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
805 main.log.report( "______________________________________________" )
806 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
807 # Spine topology do not have hosts h1-h10
808 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
809 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
810 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
811 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
812 cfgResult = cfgResult1 and cfgResult2
813 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
814 onpass="Reactive mode ipv6Fowarding cfg is set to true",
815 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
816
817 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700818 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700819 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700820 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
821 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700822 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700823 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700824 time2 = time.time()
825 timeDiff = round( ( time2 - time1 ), 2 )
826 main.log.report(
827 "Time taken for IPv6 Ping All: " +
828 str( timeDiff ) +
829 " seconds" )
830
GlennRC626ba132015-09-18 16:16:31 -0700831 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700832 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
833 else:
834 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
835
836 main.step( "Disable Reactive forwarding" )
837
838 main.log.info( "Uninstall reactive forwarding app" )
839 appCheck = main.TRUE
840 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
841 pool = []
842 for cli in main.CLIs:
843 t = main.Thread( target=cli.appToIDCheck,
844 name="appToIDCheck-" + str( i ),
845 args=[] )
846 pool.append( t )
847 t.start()
848
849 for t in pool:
850 t.join()
851 appCheck = appCheck and t.result
852 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
853 onpass="App Ids seem to be correct",
854 onfail="Something is wrong with app Ids" )
855 if appCheck != main.TRUE:
856 main.log.warn( main.CLIs[0].apps() )
857 main.log.warn( main.CLIs[0].appIDs() )
858
859 # Waiting for reative flows to be cleared.
860 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700861 caseResult = appCheck and cfgResult and pingResult
862 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700863 onpass="Reactive Mode IPv6 Pingall test PASS",
864 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700865
866 def CASE5( self, main ):
867 """
868 Compare current ONOS topology with reference data
869 """
870 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700871
Hari Krishnac195f3b2015-07-08 20:02:24 -0700872 devicesDPIDTemp = []
873 hostMACsTemp = []
874 deviceLinksTemp = []
875 deviceActiveLinksCountTemp = []
876 devicePortsEnabledCountTemp = []
877
878 main.log.report(
879 "Compare ONOS topology with reference data in Stores" )
880 main.log.report( "__________________________________________________" )
881 main.case( "Compare ONOS topology with reference data" )
882
883 main.step( "Compare current Device ports enabled with reference" )
884 time1 = time.time()
885 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
886 pool = []
887 for cli in main.CLIs:
888 if i >= main.numMNswitches + 1:
889 break
890 dpid = "of:00000000000000" + format( i,'02x' )
891 t = main.Thread(target = cli.getDevicePortsEnabledCount,
892 threadID = main.threadID,
893 name = "getDevicePortsEnabledCount",
894 args = [dpid])
895 t.start()
896 pool.append(t)
897 i = i + 1
898 main.threadID = main.threadID + 1
899 for thread in pool:
900 thread.join()
901 portResult = thread.result
902 #portTemp = re.split( r'\t+', portResult )
903 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
904 devicePortsEnabledCountTemp.append( portResult )
905
906 time2 = time.time()
907 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
908 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700909 "Device Enabled ports EXPECTED: %s" %
910 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700911 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700912 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700913 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700914
Hari Krishnac195f3b2015-07-08 20:02:24 -0700915 if ( cmp( main.devicePortsEnabledCount,
916 devicePortsEnabledCountTemp ) == 0 ):
917 stepResult1 = main.TRUE
918 else:
919 stepResult1 = main.FALSE
920
921 main.step( "Compare Device active links with reference" )
922 time1 = time.time()
923 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
924 pool = []
925 for cli in main.CLIs:
926 if i >= main.numMNswitches + 1:
927 break
928 dpid = "of:00000000000000" + format( i,'02x' )
929 t = main.Thread(target = cli.getDeviceLinksActiveCount,
930 threadID = main.threadID,
931 name = "getDeviceLinksActiveCount",
932 args = [dpid])
933 t.start()
934 pool.append(t)
935 i = i + 1
936 main.threadID = main.threadID + 1
937 for thread in pool:
938 thread.join()
939 linkCountResult = thread.result
940 #linkCountTemp = re.split( r'\t+', linkCountResult )
941 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
942 deviceActiveLinksCountTemp.append( linkCountResult )
943
944 time2 = time.time()
945 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
946 main.log.info (
947 "Device Active links EXPECTED: %s" %
948 str( main.deviceActiveLinksCount ) )
949 main.log.info (
950 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
951 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
952 stepResult2 = main.TRUE
953 else:
954 stepResult2 = main.FALSE
955
956 """
957 place holder for comparing devices, hosts, paths and intents if required.
958 Links and ports data would be incorrect with out devices anyways.
959 """
960 case5Result = ( stepResult1 and stepResult2 )
961 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
962 onpass="Compare Topology test PASS",
963 onfail="Compare Topology test FAIL" )
964
965 def CASE60( self ):
966 """
967 Install 300 host intents and verify ping all (Att Topology)
968 """
969 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
970 main.log.report( "_______________________________________" )
971 import itertools
972 import time
973 main.case( "Install 300 host intents" )
974 main.step( "Add host Intents" )
975 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700976 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
977
Hari Krishnac195f3b2015-07-08 20:02:24 -0700978 intentIdList = []
979 time1 = time.time()
980 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
981 pool = []
982 for cli in main.CLIs:
983 if i >= len( hostCombos ):
984 break
985 t = main.Thread( target=cli.addHostIntent,
986 threadID=main.threadID,
987 name="addHostIntent",
988 args=[hostCombos[i][0],hostCombos[i][1]])
989 pool.append(t)
990 t.start()
991 i = i + 1
992 main.threadID = main.threadID + 1
993 for thread in pool:
994 thread.join()
995 intentIdList.append(thread.result)
996 time2 = time.time()
997 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
998
GlennRCfcfdc4f2015-09-30 16:01:57 -0700999 # Saving intent ids to check intents in later cases
1000 main.intentIds = list(intentIdList)
1001
GlennRCa8d786a2015-09-23 17:40:11 -07001002 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001003
GlennRC1dde1712015-10-02 11:03:08 -07001004 # Giving onos multiple chances to install intents
1005 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001006 if i != 0:
1007 main.log.warn( "Verification failed. Retrying..." )
1008 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001009 time.sleep( main.checkIntentsDelay )
1010
1011 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001012 for e in range(int(main.numCtrls)):
1013 main.log.info( "Checking intents on CLI %s" % (e+1) )
1014 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1015 intentState
1016 if not intentState:
1017 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001018 if intentState:
1019 break
GlennRCdb2c8422015-09-29 12:21:59 -07001020 else:
1021 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001022 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001023
GlennRCa8d786a2015-09-23 17:40:11 -07001024
1025 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1026 onpass="INTENTS INSTALLED",
1027 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001028
1029 main.step( "Verify Ping across all hosts" )
GlennRCf7be6632015-10-20 13:04:07 -07001030 for i in range(main.numPings):
GlennRCa8d786a2015-09-23 17:40:11 -07001031 time1 = time.time()
1032 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
GlennRCf7be6632015-10-20 13:04:07 -07001033 if not pingResult:
1034 main.log.warn("First pingall failed. Retrying...")
1035 time.sleep(3)
1036 else: break
1037
Hari Krishnac195f3b2015-07-08 20:02:24 -07001038 time2 = time.time()
1039 timeDiff = round( ( time2 - time1 ), 2 )
1040 main.log.report(
1041 "Time taken for Ping All: " +
1042 str( timeDiff ) +
1043 " seconds" )
1044 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1045 onpass="PING ALL PASS",
1046 onfail="PING ALL FAIL" )
1047
GlennRCbddd58f2015-10-01 15:45:25 -07001048 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001049 utilities.assert_equals(
1050 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001051 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001052 onpass="Install 300 Host Intents and Ping All test PASS",
1053 onfail="Install 300 Host Intents and Ping All test FAIL" )
1054
GlennRCfcfdc4f2015-09-30 16:01:57 -07001055 if not intentState:
1056 main.log.debug( "Intents failed to install completely" )
1057 if not pingResult:
1058 main.log.debug( "Pingall failed" )
1059
GlennRCbddd58f2015-10-01 15:45:25 -07001060 if not caseResult and main.failSwitch:
1061 main.log.report("Stopping test")
1062 main.stop( email=main.emailOnStop )
1063
Hari Krishnac195f3b2015-07-08 20:02:24 -07001064 def CASE61( self ):
1065 """
1066 Install 600 host intents and verify ping all for Chordal Topology
1067 """
1068 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1069 main.log.report( "_______________________________________" )
1070 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001071
Hari Krishnac195f3b2015-07-08 20:02:24 -07001072 main.case( "Install 600 host intents" )
1073 main.step( "Add host Intents" )
1074 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001075 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1076
Hari Krishnac195f3b2015-07-08 20:02:24 -07001077 intentIdList = []
1078 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001079
Hari Krishnac195f3b2015-07-08 20:02:24 -07001080 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1081 pool = []
1082 for cli in main.CLIs:
1083 if i >= len( hostCombos ):
1084 break
1085 t = main.Thread( target=cli.addHostIntent,
1086 threadID=main.threadID,
1087 name="addHostIntent",
1088 args=[hostCombos[i][0],hostCombos[i][1]])
1089 pool.append(t)
1090 t.start()
1091 i = i + 1
1092 main.threadID = main.threadID + 1
1093 for thread in pool:
1094 thread.join()
1095 intentIdList.append(thread.result)
1096 time2 = time.time()
1097 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001098
GlennRCfcfdc4f2015-09-30 16:01:57 -07001099 # Saving intent ids to check intents in later cases
1100 main.intentIds = list(intentIdList)
1101
GlennRCa8d786a2015-09-23 17:40:11 -07001102 main.step("Verify intents are installed")
1103
GlennRC1dde1712015-10-02 11:03:08 -07001104 # Giving onos multiple chances to install intents
1105 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001106 if i != 0:
1107 main.log.warn( "Verification failed. Retrying..." )
1108 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001109 time.sleep( main.checkIntentsDelay )
1110
1111 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001112 for e in range(int(main.numCtrls)):
1113 main.log.info( "Checking intents on CLI %s" % (e+1) )
1114 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1115 intentState
1116 if not intentState:
1117 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001118 if intentState:
1119 break
GlennRCdb2c8422015-09-29 12:21:59 -07001120 else:
1121 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001122 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001123
1124 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1125 onpass="INTENTS INSTALLED",
1126 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001127
1128 main.step( "Verify Ping across all hosts" )
1129 pingResult = main.FALSE
1130 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001131 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1132 if not pingResult:
1133 main.log.warn("First pingall failed. Retrying...")
1134 time1 = time.time()
1135 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001136 time2 = time.time()
1137 timeDiff = round( ( time2 - time1 ), 2 )
1138 main.log.report(
1139 "Time taken for Ping All: " +
1140 str( timeDiff ) +
1141 " seconds" )
1142 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1143 onpass="PING ALL PASS",
1144 onfail="PING ALL FAIL" )
1145
GlennRCbddd58f2015-10-01 15:45:25 -07001146 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001147
Hari Krishnac195f3b2015-07-08 20:02:24 -07001148 utilities.assert_equals(
1149 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001150 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001151 onpass="Install 300 Host Intents and Ping All test PASS",
1152 onfail="Install 300 Host Intents and Ping All test FAIL" )
1153
GlennRCfcfdc4f2015-09-30 16:01:57 -07001154 if not intentState:
1155 main.log.debug( "Intents failed to install completely" )
1156 if not pingResult:
1157 main.log.debug( "Pingall failed" )
1158
GlennRCbddd58f2015-10-01 15:45:25 -07001159 if not caseResult and main.failSwitch:
1160 main.log.report("Stopping test")
1161 main.stop( email=main.emailOnStop )
1162
Hari Krishnac195f3b2015-07-08 20:02:24 -07001163 def CASE62( self ):
1164 """
1165 Install 2278 host intents and verify ping all for Spine Topology
1166 """
1167 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1168 main.log.report( "_______________________________________" )
1169 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001170
Hari Krishnac195f3b2015-07-08 20:02:24 -07001171 main.case( "Install 2278 host intents" )
1172 main.step( "Add host Intents" )
1173 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001174 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001175 main.pingTimeout = 300
1176 intentIdList = []
1177 time1 = time.time()
1178 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1179 pool = []
1180 for cli in main.CLIs:
1181 if i >= len( hostCombos ):
1182 break
1183 t = main.Thread( target=cli.addHostIntent,
1184 threadID=main.threadID,
1185 name="addHostIntent",
1186 args=[hostCombos[i][0],hostCombos[i][1]])
1187 pool.append(t)
1188 t.start()
1189 i = i + 1
1190 main.threadID = main.threadID + 1
1191 for thread in pool:
1192 thread.join()
1193 intentIdList.append(thread.result)
1194 time2 = time.time()
1195 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001196
GlennRCfcfdc4f2015-09-30 16:01:57 -07001197 # Saving intent ids to check intents in later cases
1198 main.intentIds = list(intentIdList)
1199
GlennRCa8d786a2015-09-23 17:40:11 -07001200 main.step("Verify intents are installed")
1201
GlennRC1dde1712015-10-02 11:03:08 -07001202 # Giving onos multiple chances to install intents
1203 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001204 if i != 0:
1205 main.log.warn( "Verification failed. Retrying..." )
1206 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001207 time.sleep( main.checkIntentsDelay )
1208
1209 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001210 for e in range(int(main.numCtrls)):
1211 main.log.info( "Checking intents on CLI %s" % (e+1) )
1212 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1213 intentState
1214 if not intentState:
1215 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001216 if intentState:
1217 break
GlennRCdb2c8422015-09-29 12:21:59 -07001218 else:
1219 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001220 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001221
1222 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1223 onpass="INTENTS INSTALLED",
1224 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001225
1226 main.step( "Verify Ping across all hosts" )
1227 pingResult = main.FALSE
1228 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001229 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1230 if not pingResult:
1231 main.log.warn("First pingall failed. Retrying...")
1232 time1 = time.time()
1233 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001234 time2 = time.time()
1235 timeDiff = round( ( time2 - time1 ), 2 )
1236 main.log.report(
1237 "Time taken for Ping All: " +
1238 str( timeDiff ) +
1239 " seconds" )
1240 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1241 onpass="PING ALL PASS",
1242 onfail="PING ALL FAIL" )
1243
GlennRCbddd58f2015-10-01 15:45:25 -07001244 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001245
Hari Krishnac195f3b2015-07-08 20:02:24 -07001246 utilities.assert_equals(
1247 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001248 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001249 onpass="Install 2278 Host Intents and Ping All test PASS",
1250 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1251
GlennRCfcfdc4f2015-09-30 16:01:57 -07001252 if not intentState:
1253 main.log.debug( "Intents failed to install completely" )
1254 if not pingResult:
1255 main.log.debug( "Pingall failed" )
1256
GlennRCbddd58f2015-10-01 15:45:25 -07001257 if not caseResult and main.failSwitch:
1258 main.log.report("Stopping test")
1259 main.stop( email=main.emailOnStop )
1260
Hari Krishna4223dbd2015-08-13 16:29:53 -07001261 def CASE160( self ):
1262 """
1263 Verify IPv6 ping across 300 host intents (Att Topology)
1264 """
1265 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1266 main.log.report( "_________________________________________________" )
1267 import itertools
1268 import time
1269 main.case( "IPv6 ping all 300 host intents" )
1270 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001271 pingResult = main.FALSE
1272 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001273 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001274 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001275 main.log.warn("First pingall failed. Retrying...")
1276 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001277 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001278 time2 = time.time()
1279 timeDiff = round( ( time2 - time1 ), 2 )
1280 main.log.report(
1281 "Time taken for IPv6 Ping All: " +
1282 str( timeDiff ) +
1283 " seconds" )
1284 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1285 onpass="PING ALL PASS",
1286 onfail="PING ALL FAIL" )
1287
GlennRCbddd58f2015-10-01 15:45:25 -07001288 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001289 utilities.assert_equals(
1290 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001291 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001292 onpass="IPv6 Ping across 300 host intents test PASS",
1293 onfail="IPv6 Ping across 300 host intents test FAIL" )
1294
1295 def CASE161( self ):
1296 """
1297 Verify IPv6 ping across 600 host intents (Chordal Topology)
1298 """
1299 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1300 main.log.report( "_________________________________________________" )
1301 import itertools
1302 import time
1303 main.case( "IPv6 ping all 600 host intents" )
1304 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001305 pingResult = main.FALSE
1306 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001307 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001308 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001309 main.log.warn("First pingall failed. Retrying...")
1310 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001311 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001312 time2 = time.time()
1313 timeDiff = round( ( time2 - time1 ), 2 )
1314 main.log.report(
1315 "Time taken for IPv6 Ping All: " +
1316 str( timeDiff ) +
1317 " seconds" )
1318 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1319 onpass="PING ALL PASS",
1320 onfail="PING ALL FAIL" )
1321
GlennRCbddd58f2015-10-01 15:45:25 -07001322 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001323 utilities.assert_equals(
1324 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001325 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001326 onpass="IPv6 Ping across 600 host intents test PASS",
1327 onfail="IPv6 Ping across 600 host intents test FAIL" )
1328
1329 def CASE162( self ):
1330 """
1331 Verify IPv6 ping across 2278 host intents (Spine Topology)
1332 """
1333 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1334 main.log.report( "_________________________________________________" )
1335 import itertools
1336 import time
1337 main.case( "IPv6 ping all 600 host intents" )
1338 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001339 pingResult = main.FALSE
1340 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001341 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001342 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001343 main.log.warn("First pingall failed. Retrying...")
1344 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001345 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001346 time2 = time.time()
1347 timeDiff = round( ( time2 - time1 ), 2 )
1348 main.log.report(
1349 "Time taken for IPv6 Ping All: " +
1350 str( timeDiff ) +
1351 " seconds" )
1352 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1353 onpass="PING ALL PASS",
1354 onfail="PING ALL FAIL" )
1355
GlennRCbddd58f2015-10-01 15:45:25 -07001356 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001357 utilities.assert_equals(
1358 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001359 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001360 onpass="IPv6 Ping across 600 host intents test PASS",
1361 onfail="IPv6 Ping across 600 host intents test FAIL" )
1362
Hari Krishnac195f3b2015-07-08 20:02:24 -07001363 def CASE70( self, main ):
1364 """
1365 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1366 """
1367 import random
1368 main.randomLink1 = []
1369 main.randomLink2 = []
1370 main.randomLink3 = []
1371 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1372 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1373 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1374 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1375 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1376 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1377 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1378 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1379
1380 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1381 main.log.report( "___________________________________________________________________________" )
1382 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1383 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1384 if ( int( switchLinksToToggle ) ==
1385 0 or int( switchLinksToToggle ) > 5 ):
1386 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1387 #main.cleanup()
1388 #main.exit()
1389 else:
1390 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1391
1392 main.step( "Cut links on Core devices using user provided range" )
1393 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1394 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1395 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1396 for i in range( int( switchLinksToToggle ) ):
1397 main.Mininet1.link(
1398 END1=link1End1,
1399 END2=main.randomLink1[ i ],
1400 OPTION="down" )
1401 time.sleep( link_sleep )
1402 main.Mininet1.link(
1403 END1=link2End1,
1404 END2=main.randomLink2[ i ],
1405 OPTION="down" )
1406 time.sleep( link_sleep )
1407 main.Mininet1.link(
1408 END1=link3End1,
1409 END2=main.randomLink3[ i ],
1410 OPTION="down" )
1411 time.sleep( link_sleep )
1412
Hari Krishna6185fc12015-07-13 15:42:31 -07001413 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001414 linkDown = main.ONOSbench.checkStatus(
1415 topology_output, main.numMNswitches, str(
1416 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1417 utilities.assert_equals(
1418 expect=main.TRUE,
1419 actual=linkDown,
1420 onpass="Link Down discovered properly",
1421 onfail="Link down was not discovered in " +
1422 str( link_sleep ) +
1423 " seconds" )
1424
GlennRCfcfdc4f2015-09-30 16:01:57 -07001425 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001426 # Giving onos multiple chances to install intents
1427 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001428 if i != 0:
1429 main.log.warn( "Verification failed. Retrying..." )
1430 main.log.info("Giving onos some time...")
1431 time.sleep( main.checkIntentsDelay )
1432
1433 intentState = main.TRUE
1434 for e in range(int(main.numCtrls)):
1435 main.log.info( "Checking intents on CLI %s" % (e+1) )
1436 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1437 intentState
1438 if not intentState:
1439 main.log.warn( "Not all intents installed" )
1440 if intentState:
1441 break
1442 else:
1443 #Dumping intent summary
1444 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1445
1446
1447 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1448 onpass="INTENTS INSTALLED",
1449 onfail="SOME INTENTS NOT INSTALLED" )
1450
Hari Krishnac195f3b2015-07-08 20:02:24 -07001451 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001452 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001453 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001454 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1455 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001456 main.log.warn("First pingall failed. Retrying...")
1457 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001458 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001459
Hari Krishnac195f3b2015-07-08 20:02:24 -07001460 time2 = time.time()
1461 timeDiff = round( ( time2 - time1 ), 2 )
1462 main.log.report(
1463 "Time taken for Ping All: " +
1464 str( timeDiff ) +
1465 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001466 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001467 onpass="PING ALL PASS",
1468 onfail="PING ALL FAIL" )
1469
GlennRCbddd58f2015-10-01 15:45:25 -07001470 caseResult = linkDown and pingResult and intentState
1471 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001472 onpass="Random Link cut Test PASS",
1473 onfail="Random Link cut Test FAIL" )
1474
GlennRCfcfdc4f2015-09-30 16:01:57 -07001475 # Printing what exactly failed
1476 if not linkDown:
1477 main.log.debug( "Link down was not discovered correctly" )
1478 if not pingResult:
1479 main.log.debug( "Pingall failed" )
1480 if not intentState:
1481 main.log.debug( "Intents are not all installed" )
1482
GlennRCbddd58f2015-10-01 15:45:25 -07001483 if not caseResult and main.failSwitch:
1484 main.log.report("Stopping test")
1485 main.stop( email=main.emailOnStop )
1486
Hari Krishnac195f3b2015-07-08 20:02:24 -07001487 def CASE80( self, main ):
1488 """
1489 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1490 """
1491 import random
1492 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1493 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1494 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1495 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1496 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1497
1498 main.log.report(
1499 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1500 main.log.report(
1501 "__________________________________________________________________" )
1502 main.case(
1503 "Host intents - Bring the core links up that are down and verify ping all" )
1504 main.step( "Bring randomly cut links on Core devices up" )
1505 for i in range( int( switchLinksToToggle ) ):
1506 main.Mininet1.link(
1507 END1=link1End1,
1508 END2=main.randomLink1[ i ],
1509 OPTION="up" )
1510 time.sleep( link_sleep )
1511 main.Mininet1.link(
1512 END1=link2End1,
1513 END2=main.randomLink2[ i ],
1514 OPTION="up" )
1515 time.sleep( link_sleep )
1516 main.Mininet1.link(
1517 END1=link3End1,
1518 END2=main.randomLink3[ i ],
1519 OPTION="up" )
1520 time.sleep( link_sleep )
1521
Hari Krishna6185fc12015-07-13 15:42:31 -07001522 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001523 linkUp = main.ONOSbench.checkStatus(
1524 topology_output,
1525 main.numMNswitches,
1526 str( main.numMNlinks ) )
1527 utilities.assert_equals(
1528 expect=main.TRUE,
1529 actual=linkUp,
1530 onpass="Link up discovered properly",
1531 onfail="Link up was not discovered in " +
1532 str( link_sleep ) +
1533 " seconds" )
1534
GlennRCfcfdc4f2015-09-30 16:01:57 -07001535 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001536 # Giving onos multiple chances to install intents
1537 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001538 if i != 0:
1539 main.log.warn( "Verification failed. Retrying..." )
1540 main.log.info("Giving onos some time...")
1541 time.sleep( main.checkIntentsDelay )
1542
1543 intentState = main.TRUE
1544 for e in range(int(main.numCtrls)):
1545 main.log.info( "Checking intents on CLI %s" % (e+1) )
1546 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1547 intentState
1548 if not intentState:
1549 main.log.warn( "Not all intents installed" )
1550 if intentState:
1551 break
1552 else:
1553 #Dumping intent summary
1554 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1555
1556
1557 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1558 onpass="INTENTS INSTALLED",
1559 onfail="SOME INTENTS NOT INSTALLED" )
1560
Hari Krishnac195f3b2015-07-08 20:02:24 -07001561 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001562 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001563 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001564 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1565 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001566 main.log.warn("First pingall failed. Retrying...")
1567 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001568 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001569
Hari Krishnac195f3b2015-07-08 20:02:24 -07001570 time2 = time.time()
1571 timeDiff = round( ( time2 - time1 ), 2 )
1572 main.log.report(
1573 "Time taken for Ping All: " +
1574 str( timeDiff ) +
1575 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001576 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001577 onpass="PING ALL PASS",
1578 onfail="PING ALL FAIL" )
1579
GlennRCbddd58f2015-10-01 15:45:25 -07001580 caseResult = linkUp and pingResult
1581 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001582 onpass="Link Up Test PASS",
1583 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001584 # Printing what exactly failed
1585 if not linkUp:
1586 main.log.debug( "Link down was not discovered correctly" )
1587 if not pingResult:
1588 main.log.debug( "Pingall failed" )
1589 if not intentState:
1590 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591
GlennRCbddd58f2015-10-01 15:45:25 -07001592 if not caseResult and main.failSwitch:
1593 main.log.report("Stopping test")
1594 main.stop( email=main.emailOnStop )
1595
Hari Krishnac195f3b2015-07-08 20:02:24 -07001596 def CASE71( self, main ):
1597 """
1598 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1599 """
1600 import random
1601 main.randomLink1 = []
1602 main.randomLink2 = []
1603 main.randomLink3 = []
1604 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1605 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1606 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1607 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1608 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1609 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1610 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1611 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1612
1613 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1614 main.log.report( "___________________________________________________________________________" )
1615 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1616 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1617 if ( int( switchLinksToToggle ) ==
1618 0 or int( switchLinksToToggle ) > 5 ):
1619 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1620 #main.cleanup()
1621 #main.exit()
1622 else:
1623 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1624
1625 main.step( "Cut links on Core devices using user provided range" )
1626 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1627 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1628 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1629 for i in range( int( switchLinksToToggle ) ):
1630 main.Mininet1.link(
1631 END1=link1End1,
1632 END2=main.randomLink1[ i ],
1633 OPTION="down" )
1634 time.sleep( link_sleep )
1635 main.Mininet1.link(
1636 END1=link2End1,
1637 END2=main.randomLink2[ i ],
1638 OPTION="down" )
1639 time.sleep( link_sleep )
1640 main.Mininet1.link(
1641 END1=link3End1,
1642 END2=main.randomLink3[ i ],
1643 OPTION="down" )
1644 time.sleep( link_sleep )
1645
Hari Krishna6185fc12015-07-13 15:42:31 -07001646 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001647 linkDown = main.ONOSbench.checkStatus(
1648 topology_output, main.numMNswitches, str(
1649 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1650 utilities.assert_equals(
1651 expect=main.TRUE,
1652 actual=linkDown,
1653 onpass="Link Down discovered properly",
1654 onfail="Link down was not discovered in " +
1655 str( link_sleep ) +
1656 " seconds" )
1657
GlennRCfcfdc4f2015-09-30 16:01:57 -07001658 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001659 # Giving onos multiple chances to install intents
1660 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001661 if i != 0:
1662 main.log.warn( "Verification failed. Retrying..." )
1663 main.log.info("Giving onos some time...")
1664 time.sleep( main.checkIntentsDelay )
1665
1666 intentState = main.TRUE
1667 for e in range(int(main.numCtrls)):
1668 main.log.info( "Checking intents on CLI %s" % (e+1) )
1669 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1670 intentState
1671 if not intentState:
1672 main.log.warn( "Not all intents installed" )
1673 if intentState:
1674 break
1675 else:
1676 #Dumping intent summary
1677 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1678
1679
1680 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1681 onpass="INTENTS INSTALLED",
1682 onfail="SOME INTENTS NOT INSTALLED" )
1683
Hari Krishnac195f3b2015-07-08 20:02:24 -07001684 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001686 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001687 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1688 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001689 main.log.warn("First pingall failed. Retrying...")
1690 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001691 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001692
Hari Krishnac195f3b2015-07-08 20:02:24 -07001693 time2 = time.time()
1694 timeDiff = round( ( time2 - time1 ), 2 )
1695 main.log.report(
1696 "Time taken for Ping All: " +
1697 str( timeDiff ) +
1698 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001699 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001700 onpass="PING ALL PASS",
1701 onfail="PING ALL FAIL" )
1702
GlennRCbddd58f2015-10-01 15:45:25 -07001703 caseResult = linkDown and pingResult and intentState
1704 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001705 onpass="Random Link cut Test PASS",
1706 onfail="Random Link cut Test FAIL" )
1707
GlennRCfcfdc4f2015-09-30 16:01:57 -07001708 # Printing what exactly failed
1709 if not linkDown:
1710 main.log.debug( "Link down was not discovered correctly" )
1711 if not pingResult:
1712 main.log.debug( "Pingall failed" )
1713 if not intentState:
1714 main.log.debug( "Intents are not all installed" )
1715
GlennRCbddd58f2015-10-01 15:45:25 -07001716 if not caseResult and main.failSwitch:
1717 main.log.report("Stopping test")
1718 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001719
Hari Krishnac195f3b2015-07-08 20:02:24 -07001720 def CASE81( self, main ):
1721 """
1722 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1723 """
1724 import random
1725 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1726 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1727 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1728 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1729 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1730
1731 main.log.report(
1732 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1733 main.log.report(
1734 "__________________________________________________________________" )
1735 main.case(
1736 "Point intents - Bring the core links up that are down and verify ping all" )
1737 main.step( "Bring randomly cut links on Core devices up" )
1738 for i in range( int( switchLinksToToggle ) ):
1739 main.Mininet1.link(
1740 END1=link1End1,
1741 END2=main.randomLink1[ i ],
1742 OPTION="up" )
1743 time.sleep( link_sleep )
1744 main.Mininet1.link(
1745 END1=link2End1,
1746 END2=main.randomLink2[ i ],
1747 OPTION="up" )
1748 time.sleep( link_sleep )
1749 main.Mininet1.link(
1750 END1=link3End1,
1751 END2=main.randomLink3[ i ],
1752 OPTION="up" )
1753 time.sleep( link_sleep )
1754
Hari Krishna6185fc12015-07-13 15:42:31 -07001755 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001756 linkUp = main.ONOSbench.checkStatus(
1757 topology_output,
1758 main.numMNswitches,
1759 str( main.numMNlinks ) )
1760 utilities.assert_equals(
1761 expect=main.TRUE,
1762 actual=linkUp,
1763 onpass="Link up discovered properly",
1764 onfail="Link up was not discovered in " +
1765 str( link_sleep ) +
1766 " seconds" )
1767
GlennRCfcfdc4f2015-09-30 16:01:57 -07001768 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001769 # Giving onos multiple chances to install intents
1770 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001771 if i != 0:
1772 main.log.warn( "Verification failed. Retrying..." )
1773 main.log.info("Giving onos some time...")
1774 time.sleep( main.checkIntentsDelay )
1775
1776 intentState = main.TRUE
1777 for e in range(int(main.numCtrls)):
1778 main.log.info( "Checking intents on CLI %s" % (e+1) )
1779 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1780 intentState
1781 if not intentState:
1782 main.log.warn( "Not all intents installed" )
1783 if intentState:
1784 break
1785 else:
1786 #Dumping intent summary
1787 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1788
1789
1790 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1791 onpass="INTENTS INSTALLED",
1792 onfail="SOME INTENTS NOT INSTALLED" )
1793
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001795 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001796 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001797 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1798 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001799 main.log.warn("First pingall failed. Retrying...")
1800 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001801 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001802
Hari Krishnac195f3b2015-07-08 20:02:24 -07001803 time2 = time.time()
1804 timeDiff = round( ( time2 - time1 ), 2 )
1805 main.log.report(
1806 "Time taken for Ping All: " +
1807 str( timeDiff ) +
1808 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001809 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001810 onpass="PING ALL PASS",
1811 onfail="PING ALL FAIL" )
1812
GlennRCbddd58f2015-10-01 15:45:25 -07001813 caseResult = linkUp and pingResult
1814 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001815 onpass="Link Up Test PASS",
1816 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001817 # Printing what exactly failed
1818 if not linkUp:
1819 main.log.debug( "Link down was not discovered correctly" )
1820 if not pingResult:
1821 main.log.debug( "Pingall failed" )
1822 if not intentState:
1823 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001824
GlennRCbddd58f2015-10-01 15:45:25 -07001825 if not caseResult and main.failSwitch:
1826 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001827 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001828
Hari Krishnac195f3b2015-07-08 20:02:24 -07001829 def CASE72( self, main ):
1830 """
1831 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1832 """
1833 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001834 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001835 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001836
Hari Krishnac195f3b2015-07-08 20:02:24 -07001837 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1838 main.log.report( "___________________________________________________________________________" )
1839 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1840 switches = []
1841 switchesComb = []
1842 for i in range( main.numMNswitches ):
1843 switches.append('s%d'%(i+1))
1844 switchesLinksComb = list(itertools.combinations(switches,2))
1845 main.randomLinks = random.sample(switchesLinksComb, 5 )
1846 print main.randomLinks
1847 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001848
Hari Krishnac195f3b2015-07-08 20:02:24 -07001849 for switch in main.randomLinks:
1850 main.Mininet1.link(
1851 END1=switch[0],
1852 END2=switch[1],
1853 OPTION="down")
1854 time.sleep( link_sleep )
1855
Hari Krishna6185fc12015-07-13 15:42:31 -07001856 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001857 linkDown = main.ONOSbench.checkStatus(
1858 topology_output, main.numMNswitches, str(
1859 int( main.numMNlinks ) - 5 * 2 ) )
1860 utilities.assert_equals(
1861 expect=main.TRUE,
1862 actual=linkDown,
1863 onpass="Link Down discovered properly",
1864 onfail="Link down was not discovered in " +
1865 str( link_sleep ) +
1866 " seconds" )
1867
GlennRCfcfdc4f2015-09-30 16:01:57 -07001868 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001869 # Giving onos multiple chances to install intents
1870 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001871 if i != 0:
1872 main.log.warn( "Verification failed. Retrying..." )
1873 main.log.info("Giving onos some time...")
1874 time.sleep( main.checkIntentsDelay )
1875
1876 intentState = main.TRUE
1877 for e in range(int(main.numCtrls)):
1878 main.log.info( "Checking intents on CLI %s" % (e+1) )
1879 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1880 intentState
1881 if not intentState:
1882 main.log.warn( "Not all intents installed" )
1883 if intentState:
1884 break
1885 else:
1886 #Dumping intent summary
1887 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1888
1889
1890 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1891 onpass="INTENTS INSTALLED",
1892 onfail="SOME INTENTS NOT INSTALLED" )
1893
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001895 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001896 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001897 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1898 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001899 main.log.warn("First pingall failed. Retrying...")
1900 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001901 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001902
Hari Krishnac195f3b2015-07-08 20:02:24 -07001903 time2 = time.time()
1904 timeDiff = round( ( time2 - time1 ), 2 )
1905 main.log.report(
1906 "Time taken for Ping All: " +
1907 str( timeDiff ) +
1908 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001909 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001910 onpass="PING ALL PASS",
1911 onfail="PING ALL FAIL" )
1912
GlennRCbddd58f2015-10-01 15:45:25 -07001913 caseResult = linkDown and pingResult and intentState
1914 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001915 onpass="Random Link cut Test PASS",
1916 onfail="Random Link cut Test FAIL" )
1917
GlennRCfcfdc4f2015-09-30 16:01:57 -07001918 # Printing what exactly failed
1919 if not linkDown:
1920 main.log.debug( "Link down was not discovered correctly" )
1921 if not pingResult:
1922 main.log.debug( "Pingall failed" )
1923 if not intentState:
1924 main.log.debug( "Intents are not all installed" )
1925
GlennRCbddd58f2015-10-01 15:45:25 -07001926 if not caseResult and main.failSwitch:
1927 main.log.report("Stopping test")
1928 main.stop( email=main.emailOnStop )
1929
Hari Krishnac195f3b2015-07-08 20:02:24 -07001930 def CASE82( self, main ):
1931 """
1932 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1933 """
1934 import random
1935 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001936
Hari Krishnac195f3b2015-07-08 20:02:24 -07001937 main.log.report(
1938 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1939 main.log.report(
1940 "__________________________________________________________________" )
1941 main.case(
1942 "Host intents - Bring the core links up that are down and verify ping all" )
1943 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001944
Hari Krishnac195f3b2015-07-08 20:02:24 -07001945 for switch in main.randomLinks:
1946 main.Mininet1.link(
1947 END1=switch[0],
1948 END2=switch[1],
1949 OPTION="up")
1950 time.sleep( link_sleep )
1951
Hari Krishna6185fc12015-07-13 15:42:31 -07001952 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001953 linkUp = main.ONOSbench.checkStatus(
1954 topology_output,
1955 main.numMNswitches,
1956 str( main.numMNlinks ) )
1957 utilities.assert_equals(
1958 expect=main.TRUE,
1959 actual=linkUp,
1960 onpass="Link up discovered properly",
1961 onfail="Link up was not discovered in " +
1962 str( link_sleep ) +
1963 " seconds" )
1964
GlennRCfcfdc4f2015-09-30 16:01:57 -07001965 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001966 # Giving onos multiple chances to install intents
1967 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001968 if i != 0:
1969 main.log.warn( "Verification failed. Retrying..." )
1970 main.log.info("Giving onos some time...")
1971 time.sleep( main.checkIntentsDelay )
1972
1973 intentState = main.TRUE
1974 for e in range(int(main.numCtrls)):
1975 main.log.info( "Checking intents on CLI %s" % (e+1) )
1976 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1977 intentState
1978 if not intentState:
1979 main.log.warn( "Not all intents installed" )
1980 if intentState:
1981 break
1982 else:
1983 #Dumping intent summary
1984 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1985
1986
1987 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1988 onpass="INTENTS INSTALLED",
1989 onfail="SOME INTENTS NOT INSTALLED" )
1990
Hari Krishnac195f3b2015-07-08 20:02:24 -07001991 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001992 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001993 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001994 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1995 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001996 main.log.warn("First pingall failed. Retrying...")
1997 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001998 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001999
Hari Krishnac195f3b2015-07-08 20:02:24 -07002000 time2 = time.time()
2001 timeDiff = round( ( time2 - time1 ), 2 )
2002 main.log.report(
2003 "Time taken for Ping All: " +
2004 str( timeDiff ) +
2005 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002006 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002007 onpass="PING ALL PASS",
2008 onfail="PING ALL FAIL" )
2009
GlennRCbddd58f2015-10-01 15:45:25 -07002010 caseResult = linkUp and pingResult
2011 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002012 onpass="Link Up Test PASS",
2013 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002014 # Printing what exactly failed
2015 if not linkUp:
2016 main.log.debug( "Link down was not discovered correctly" )
2017 if not pingResult:
2018 main.log.debug( "Pingall failed" )
2019 if not intentState:
2020 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002021
GlennRCbddd58f2015-10-01 15:45:25 -07002022 if not caseResult and main.failSwitch:
2023 main.log.report("Stopping test")
2024 main.stop( email=main.emailOnStop )
2025
Hari Krishnac195f3b2015-07-08 20:02:24 -07002026 def CASE73( self, main ):
2027 """
2028 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2029 """
2030 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002031 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002032 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002033
Hari Krishnac195f3b2015-07-08 20:02:24 -07002034 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2035 main.log.report( "___________________________________________________________________________" )
2036 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2037 switches = []
2038 switchesComb = []
2039 for i in range( main.numMNswitches ):
2040 switches.append('s%d'%(i+1))
2041 switchesLinksComb = list(itertools.combinations(switches,2))
2042 main.randomLinks = random.sample(switchesLinksComb, 5 )
2043 print main.randomLinks
2044 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002045
Hari Krishnac195f3b2015-07-08 20:02:24 -07002046 for switch in main.randomLinks:
2047 main.Mininet1.link(
2048 END1=switch[0],
2049 END2=switch[1],
2050 OPTION="down")
2051 time.sleep( link_sleep )
2052
Hari Krishna6185fc12015-07-13 15:42:31 -07002053 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002054 linkDown = main.ONOSbench.checkStatus(
2055 topology_output, main.numMNswitches, str(
2056 int( main.numMNlinks ) - 5 * 2 ) )
2057 utilities.assert_equals(
2058 expect=main.TRUE,
2059 actual=linkDown,
2060 onpass="Link Down discovered properly",
2061 onfail="Link down was not discovered in " +
2062 str( link_sleep ) +
2063 " seconds" )
2064
GlennRCfcfdc4f2015-09-30 16:01:57 -07002065 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002066 # Giving onos multiple chances to install intents
2067 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002068 if i != 0:
2069 main.log.warn( "Verification failed. Retrying..." )
2070 main.log.info("Giving onos some time...")
2071 time.sleep( main.checkIntentsDelay )
2072
2073 intentState = main.TRUE
2074 for e in range(int(main.numCtrls)):
2075 main.log.info( "Checking intents on CLI %s" % (e+1) )
2076 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2077 intentState
2078 if not intentState:
2079 main.log.warn( "Not all intents installed" )
2080 if intentState:
2081 break
2082 else:
2083 #Dumping intent summary
2084 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2085
2086
2087 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2088 onpass="INTENTS INSTALLED",
2089 onfail="SOME INTENTS NOT INSTALLED" )
2090
Hari Krishnac195f3b2015-07-08 20:02:24 -07002091 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002093 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002094 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2095 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002096 main.log.warn("First pingall failed. Retrying...")
2097 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002098 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002099
Hari Krishnac195f3b2015-07-08 20:02:24 -07002100 time2 = time.time()
2101 timeDiff = round( ( time2 - time1 ), 2 )
2102 main.log.report(
2103 "Time taken for Ping All: " +
2104 str( timeDiff ) +
2105 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002106 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002107 onpass="PING ALL PASS",
2108 onfail="PING ALL FAIL" )
2109
GlennRCbddd58f2015-10-01 15:45:25 -07002110 caseResult = linkDown and pingResult and intentState
2111 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002112 onpass="Random Link cut Test PASS",
2113 onfail="Random Link cut Test FAIL" )
2114
GlennRCfcfdc4f2015-09-30 16:01:57 -07002115 # Printing what exactly failed
2116 if not linkDown:
2117 main.log.debug( "Link down was not discovered correctly" )
2118 if not pingResult:
2119 main.log.debug( "Pingall failed" )
2120 if not intentState:
2121 main.log.debug( "Intents are not all installed" )
2122
GlennRCbddd58f2015-10-01 15:45:25 -07002123 if not caseResult and main.failSwitch:
2124 main.log.report("Stopping test")
2125 main.stop( email=main.emailOnStop )
2126
Hari Krishnac195f3b2015-07-08 20:02:24 -07002127 def CASE83( self, main ):
2128 """
2129 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2130 """
2131 import random
2132 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002133
Hari Krishnac195f3b2015-07-08 20:02:24 -07002134 main.log.report(
2135 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2136 main.log.report(
2137 "__________________________________________________________________" )
2138 main.case(
2139 "Point intents - Bring the core links up that are down and verify ping all" )
2140 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002141
Hari Krishnac195f3b2015-07-08 20:02:24 -07002142 for switch in main.randomLinks:
2143 main.Mininet1.link(
2144 END1=switch[0],
2145 END2=switch[1],
2146 OPTION="up")
2147 time.sleep( link_sleep )
2148
Hari Krishna6185fc12015-07-13 15:42:31 -07002149 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002150 linkUp = main.ONOSbench.checkStatus(
2151 topology_output,
2152 main.numMNswitches,
2153 str( main.numMNlinks ) )
2154 utilities.assert_equals(
2155 expect=main.TRUE,
2156 actual=linkUp,
2157 onpass="Link up discovered properly",
2158 onfail="Link up was not discovered in " +
2159 str( link_sleep ) +
2160 " seconds" )
2161
GlennRCfcfdc4f2015-09-30 16:01:57 -07002162 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002163 # Giving onos multiple chances to install intents
2164 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002165 if i != 0:
2166 main.log.warn( "Verification failed. Retrying..." )
2167 main.log.info("Giving onos some time...")
2168 time.sleep( main.checkIntentsDelay )
2169
2170 intentState = main.TRUE
2171 for e in range(int(main.numCtrls)):
2172 main.log.info( "Checking intents on CLI %s" % (e+1) )
2173 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2174 intentState
2175 if not intentState:
2176 main.log.warn( "Not all intents installed" )
2177 if intentState:
2178 break
2179 else:
2180 #Dumping intent summary
2181 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2182
2183
2184 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2185 onpass="INTENTS INSTALLED",
2186 onfail="SOME INTENTS NOT INSTALLED" )
2187
Hari Krishnac195f3b2015-07-08 20:02:24 -07002188 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002189 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002190 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002191 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2192 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002193 main.log.warn("First pingall failed. Retrying...")
2194 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002195 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002196
Hari Krishnac195f3b2015-07-08 20:02:24 -07002197 time2 = time.time()
2198 timeDiff = round( ( time2 - time1 ), 2 )
2199 main.log.report(
2200 "Time taken for Ping All: " +
2201 str( timeDiff ) +
2202 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002203 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002204 onpass="PING ALL PASS",
2205 onfail="PING ALL FAIL" )
2206
GlennRCbddd58f2015-10-01 15:45:25 -07002207 caseResult = linkUp and pingResult
2208 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002209 onpass="Link Up Test PASS",
2210 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002211 # Printing what exactly failed
2212 if not linkUp:
2213 main.log.debug( "Link down was not discovered correctly" )
2214 if not pingResult:
2215 main.log.debug( "Pingall failed" )
2216 if not intentState:
2217 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002218
GlennRCbddd58f2015-10-01 15:45:25 -07002219 if not caseResult and main.failSwitch:
2220 main.log.report("Stopping test")
2221 main.stop( email=main.emailOnStop )
2222
Hari Krishnac195f3b2015-07-08 20:02:24 -07002223 def CASE74( self, main ):
2224 """
2225 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2226 """
2227 import random
2228 main.randomLink1 = []
2229 main.randomLink2 = []
2230 main.randomLink3 = []
2231 main.randomLink4 = []
2232 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2233 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2234 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2235 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2236 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2237 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2238 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2239 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002240
Hari Krishnac195f3b2015-07-08 20:02:24 -07002241 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2242 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002243 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002244 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002245 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002246 linkIndex.remove(linkIndexS9)
2247 linkIndexS10 = random.sample(linkIndex,1)[0]
2248 main.randomLink1 = link1End2top[linkIndexS9]
2249 main.randomLink2 = link2End2top[linkIndexS10]
2250 main.randomLink3 = random.sample(link1End2bot,1)[0]
2251 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002252
2253 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002254 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2255 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2256 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2257 time.sleep( link_sleep )
2258 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2259 time.sleep( link_sleep )
2260
Hari Krishna6185fc12015-07-13 15:42:31 -07002261 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002262 linkDown = main.ONOSbench.checkStatus(
2263 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002264 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002265 utilities.assert_equals(
2266 expect=main.TRUE,
2267 actual=linkDown,
2268 onpass="Link Down discovered properly",
2269 onfail="Link down was not discovered in " +
2270 str( link_sleep ) +
2271 " seconds" )
2272
GlennRCfcfdc4f2015-09-30 16:01:57 -07002273 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002274 # Giving onos multiple chances to install intents
2275 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002276 if i != 0:
2277 main.log.warn( "Verification failed. Retrying..." )
2278 main.log.info("Giving onos some time...")
2279 time.sleep( main.checkIntentsDelay )
2280
2281 intentState = main.TRUE
2282 for e in range(int(main.numCtrls)):
2283 main.log.info( "Checking intents on CLI %s" % (e+1) )
2284 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2285 intentState
2286 if not intentState:
2287 main.log.warn( "Not all intents installed" )
2288 if intentState:
2289 break
2290 else:
2291 #Dumping intent summary
2292 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2293
2294
2295 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2296 onpass="INTENTS INSTALLED",
2297 onfail="SOME INTENTS NOT INSTALLED" )
2298
Hari Krishnac195f3b2015-07-08 20:02:24 -07002299 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002301 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002302 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2303 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002304 main.log.warn("First pingall failed. Retrying...")
2305 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002306 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002307
Hari Krishnac195f3b2015-07-08 20:02:24 -07002308 time2 = time.time()
2309 timeDiff = round( ( time2 - time1 ), 2 )
2310 main.log.report(
2311 "Time taken for Ping All: " +
2312 str( timeDiff ) +
2313 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002314 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002315 onpass="PING ALL PASS",
2316 onfail="PING ALL FAIL" )
2317
GlennRCbddd58f2015-10-01 15:45:25 -07002318 caseResult = linkDown and pingResult and intentState
2319 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002320 onpass="Random Link cut Test PASS",
2321 onfail="Random Link cut Test FAIL" )
2322
GlennRCfcfdc4f2015-09-30 16:01:57 -07002323 # Printing what exactly failed
2324 if not linkDown:
2325 main.log.debug( "Link down was not discovered correctly" )
2326 if not pingResult:
2327 main.log.debug( "Pingall failed" )
2328 if not intentState:
2329 main.log.debug( "Intents are not all installed" )
2330
GlennRCbddd58f2015-10-01 15:45:25 -07002331 if not caseResult and main.failSwitch:
2332 main.log.report("Stopping test")
2333 main.stop( email=main.emailOnStop )
2334
Hari Krishnac195f3b2015-07-08 20:02:24 -07002335 def CASE84( self, main ):
2336 """
2337 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2338 """
2339 import random
2340 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2341 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2342 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2343 main.log.report(
2344 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2345 main.log.report(
2346 "__________________________________________________________________" )
2347 main.case(
2348 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002349
2350 # Work around for link state propagation delay. Added some sleep time.
2351 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2352 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002353 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2354 time.sleep( link_sleep )
2355 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2356 time.sleep( link_sleep )
2357
Hari Krishna6185fc12015-07-13 15:42:31 -07002358 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002359 linkUp = main.ONOSbench.checkStatus(
2360 topology_output,
2361 main.numMNswitches,
2362 str( main.numMNlinks ) )
2363 utilities.assert_equals(
2364 expect=main.TRUE,
2365 actual=linkUp,
2366 onpass="Link up discovered properly",
2367 onfail="Link up was not discovered in " +
2368 str( link_sleep ) +
2369 " seconds" )
2370
GlennRCfcfdc4f2015-09-30 16:01:57 -07002371 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002372 # Giving onos multiple chances to install intents
2373 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002374 if i != 0:
2375 main.log.warn( "Verification failed. Retrying..." )
2376 main.log.info("Giving onos some time...")
2377 time.sleep( main.checkIntentsDelay )
2378
2379 intentState = main.TRUE
2380 for e in range(int(main.numCtrls)):
2381 main.log.info( "Checking intents on CLI %s" % (e+1) )
2382 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2383 intentState
2384 if not intentState:
2385 main.log.warn( "Not all intents installed" )
2386 if intentState:
2387 break
2388 else:
2389 #Dumping intent summary
2390 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2391
2392
2393 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2394 onpass="INTENTS INSTALLED",
2395 onfail="SOME INTENTS NOT INSTALLED" )
2396
Hari Krishnac195f3b2015-07-08 20:02:24 -07002397 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002398 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002399 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002400 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2401 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002402 main.log.warn("First pingall failed. Retrying...")
2403 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002404 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002405
Hari Krishnac195f3b2015-07-08 20:02:24 -07002406 time2 = time.time()
2407 timeDiff = round( ( time2 - time1 ), 2 )
2408 main.log.report(
2409 "Time taken for Ping All: " +
2410 str( timeDiff ) +
2411 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002412 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002413 onpass="PING ALL PASS",
2414 onfail="PING ALL FAIL" )
2415
GlennRCbddd58f2015-10-01 15:45:25 -07002416 caseResult = linkUp and pingResult
2417 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002418 onpass="Link Up Test PASS",
2419 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002420 # Printing what exactly failed
2421 if not linkUp:
2422 main.log.debug( "Link down was not discovered correctly" )
2423 if not pingResult:
2424 main.log.debug( "Pingall failed" )
2425 if not intentState:
2426 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002427
GlennRCbddd58f2015-10-01 15:45:25 -07002428 if not caseResult and main.failSwitch:
2429 main.log.report("Stopping test")
2430 main.stop( email=main.emailOnStop )
2431
Hari Krishnab79d0822015-08-20 09:48:43 -07002432 def CASE75( self, main ):
2433 """
2434 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2435 """
2436 import random
2437 main.randomLink1 = []
2438 main.randomLink2 = []
2439 main.randomLink3 = []
2440 main.randomLink4 = []
2441 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2442 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2443 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2444 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2445 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2446 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2447 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2448 main.pingTimeout = 400
2449
2450 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2451 main.log.report( "___________________________________________________________________________" )
2452 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2453 linkIndex = range(4)
2454 linkIndexS9 = random.sample(linkIndex,1)[0]
2455 linkIndex.remove(linkIndexS9)
2456 linkIndexS10 = random.sample(linkIndex,1)[0]
2457 main.randomLink1 = link1End2top[linkIndexS9]
2458 main.randomLink2 = link2End2top[linkIndexS10]
2459 main.randomLink3 = random.sample(link1End2bot,1)[0]
2460 main.randomLink4 = random.sample(link2End2bot,1)[0]
2461
2462 # Work around for link state propagation delay. Added some sleep time.
2463 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2464 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2465 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2466 time.sleep( link_sleep )
2467 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2468 time.sleep( link_sleep )
2469
2470 topology_output = main.ONOScli1.topology()
2471 linkDown = main.ONOSbench.checkStatus(
2472 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002473 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002474 utilities.assert_equals(
2475 expect=main.TRUE,
2476 actual=linkDown,
2477 onpass="Link Down discovered properly",
2478 onfail="Link down was not discovered in " +
2479 str( link_sleep ) +
2480 " seconds" )
2481
GlennRCfcfdc4f2015-09-30 16:01:57 -07002482 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002483 # Giving onos multiple chances to install intents
2484 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002485 if i != 0:
2486 main.log.warn( "Verification failed. Retrying..." )
2487 main.log.info("Giving onos some time...")
2488 time.sleep( main.checkIntentsDelay )
2489
2490 intentState = main.TRUE
2491 for e in range(int(main.numCtrls)):
2492 main.log.info( "Checking intents on CLI %s" % (e+1) )
2493 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2494 intentState
2495 if not intentState:
2496 main.log.warn( "Not all intents installed" )
2497 if intentState:
2498 break
2499 else:
2500 #Dumping intent summary
2501 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2502
2503
2504 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2505 onpass="INTENTS INSTALLED",
2506 onfail="SOME INTENTS NOT INSTALLED" )
2507
Hari Krishnab79d0822015-08-20 09:48:43 -07002508 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002509 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002510 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002511 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2512 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002513 main.log.warn("First pingall failed. Retrying...")
2514 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002515 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002516
Hari Krishnab79d0822015-08-20 09:48:43 -07002517 time2 = time.time()
2518 timeDiff = round( ( time2 - time1 ), 2 )
2519 main.log.report(
2520 "Time taken for Ping All: " +
2521 str( timeDiff ) +
2522 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002523 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002524 onpass="PING ALL PASS",
2525 onfail="PING ALL FAIL" )
2526
GlennRCbddd58f2015-10-01 15:45:25 -07002527 caseResult = linkDown and pingResult and intentState
2528 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002529 onpass="Random Link cut Test PASS",
2530 onfail="Random Link cut Test FAIL" )
2531
GlennRCfcfdc4f2015-09-30 16:01:57 -07002532 # Printing what exactly failed
2533 if not linkDown:
2534 main.log.debug( "Link down was not discovered correctly" )
2535 if not pingResult:
2536 main.log.debug( "Pingall failed" )
2537 if not intentState:
2538 main.log.debug( "Intents are not all installed" )
2539
GlennRCbddd58f2015-10-01 15:45:25 -07002540 if not caseResult and main.failSwitch:
2541 main.log.report("Stopping test")
2542 main.stop( email=main.emailOnStop )
2543
Hari Krishnab79d0822015-08-20 09:48:43 -07002544 def CASE85( self, main ):
2545 """
2546 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2547 """
2548 import random
2549 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2550 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2551 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2552 main.log.report(
2553 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2554 main.log.report(
2555 "__________________________________________________________________" )
2556 main.case(
2557 "Point intents - Bring the core links up that are down and verify ping all" )
2558
2559 # Work around for link state propagation delay. Added some sleep time.
2560 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2561 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2562 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2563 time.sleep( link_sleep )
2564 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2565 time.sleep( link_sleep )
2566
2567 topology_output = main.ONOScli1.topology()
2568 linkUp = main.ONOSbench.checkStatus(
2569 topology_output,
2570 main.numMNswitches,
2571 str( main.numMNlinks ) )
2572 utilities.assert_equals(
2573 expect=main.TRUE,
2574 actual=linkUp,
2575 onpass="Link up discovered properly",
2576 onfail="Link up was not discovered in " +
2577 str( link_sleep ) +
2578 " seconds" )
2579
GlennRCfcfdc4f2015-09-30 16:01:57 -07002580 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002581 # Giving onos multiple chances to install intents
2582 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002583 if i != 0:
2584 main.log.warn( "Verification failed. Retrying..." )
2585 main.log.info("Giving onos some time...")
2586 time.sleep( main.checkIntentsDelay )
2587
2588 intentState = main.TRUE
2589 for e in range(int(main.numCtrls)):
2590 main.log.info( "Checking intents on CLI %s" % (e+1) )
2591 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2592 intentState
2593 if not intentState:
2594 main.log.warn( "Not all intents installed" )
2595 if intentState:
2596 break
2597 else:
2598 #Dumping intent summary
2599 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2600
2601
2602 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2603 onpass="INTENTS INSTALLED",
2604 onfail="SOME INTENTS NOT INSTALLED" )
2605
Hari Krishnab79d0822015-08-20 09:48:43 -07002606 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002607 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002608 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002609 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2610 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002611 main.log.warn("First pingall failed. Retrying...")
2612 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002613 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002614
Hari Krishnab79d0822015-08-20 09:48:43 -07002615 time2 = time.time()
2616 timeDiff = round( ( time2 - time1 ), 2 )
2617 main.log.report(
2618 "Time taken for Ping All: " +
2619 str( timeDiff ) +
2620 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002621 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002622 onpass="PING ALL PASS",
2623 onfail="PING ALL FAIL" )
2624
GlennRCbddd58f2015-10-01 15:45:25 -07002625 caseResult = linkUp and pingResult
2626 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002627 onpass="Link Up Test PASS",
2628 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002629 # Printing what exactly failed
2630 if not linkUp:
2631 main.log.debug( "Link down was not discovered correctly" )
2632 if not pingResult:
2633 main.log.debug( "Pingall failed" )
2634 if not intentState:
2635 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002636
GlennRCbddd58f2015-10-01 15:45:25 -07002637 if not caseResult and main.failSwitch:
2638 main.log.report("Stopping test")
2639 main.stop( email=main.emailOnStop )
2640
Hari Krishna4223dbd2015-08-13 16:29:53 -07002641 def CASE170( self ):
2642 """
2643 IPv6 ping all with some core links down( Host Intents-Att Topo)
2644 """
2645 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2646 main.log.report( "_________________________________________________" )
2647 import itertools
2648 import time
2649 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2650 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002651 pingResult = main.FALSE
2652 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002653 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002654 if not pingResult:
2655 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002656 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002657 time2 = time.time()
2658 timeDiff = round( ( time2 - time1 ), 2 )
2659 main.log.report(
2660 "Time taken for IPv6 Ping All: " +
2661 str( timeDiff ) +
2662 " seconds" )
2663 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2664 onpass="PING ALL PASS",
2665 onfail="PING ALL FAIL" )
2666
GlennRCbddd58f2015-10-01 15:45:25 -07002667 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002668 utilities.assert_equals(
2669 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002670 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002671 onpass="IPv6 Ping across 300 host intents test PASS",
2672 onfail="IPv6 Ping across 300 host intents test FAIL" )
2673
2674 def CASE180( self ):
2675 """
2676 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2677 """
2678 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2679 main.log.report( "_________________________________________________" )
2680 import itertools
2681 import time
2682 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2683 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002684 pingResult = main.FALSE
2685 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002686 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002687 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002688 main.log.warn("First ping failed. Retrying...")
2689 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002690 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002691 time2 = time.time()
2692 timeDiff = round( ( time2 - time1 ), 2 )
2693 main.log.report(
2694 "Time taken for IPv6 Ping All: " +
2695 str( timeDiff ) +
2696 " seconds" )
2697 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2698 onpass="PING ALL PASS",
2699 onfail="PING ALL FAIL" )
2700
GlennRCbddd58f2015-10-01 15:45:25 -07002701 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002702 utilities.assert_equals(
2703 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002704 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002705 onpass="IPv6 Ping across 300 host intents test PASS",
2706 onfail="IPv6 Ping across 300 host intents test FAIL" )
2707
2708 def CASE171( self ):
2709 """
2710 IPv6 ping all with some core links down( Point Intents-Att Topo)
2711 """
2712 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2713 main.log.report( "_________________________________________________" )
2714 import itertools
2715 import time
2716 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2717 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002718 pingResult = main.FALSE
2719 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002720 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002721 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002722 main.log.warn("First ping failed. Retrying...")
2723 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002724 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002725 time2 = time.time()
2726 timeDiff = round( ( time2 - time1 ), 2 )
2727 main.log.report(
2728 "Time taken for IPv6 Ping All: " +
2729 str( timeDiff ) +
2730 " seconds" )
2731 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2732 onpass="PING ALL PASS",
2733 onfail="PING ALL FAIL" )
2734
GlennRCbddd58f2015-10-01 15:45:25 -07002735 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002736 utilities.assert_equals(
2737 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002738 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002739 onpass="IPv6 Ping across 600 point intents test PASS",
2740 onfail="IPv6 Ping across 600 point intents test FAIL" )
2741
2742 def CASE181( self ):
2743 """
2744 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2745 """
2746 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2747 main.log.report( "_________________________________________________" )
2748 import itertools
2749 import time
2750 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2751 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002752 pingResult = main.FALSE
2753 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002754 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002755 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002756 main.log.warn("First ping failed. Retrying...")
2757 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002758 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002759 time2 = time.time()
2760 timeDiff = round( ( time2 - time1 ), 2 )
2761 main.log.report(
2762 "Time taken for IPv6 Ping All: " +
2763 str( timeDiff ) +
2764 " seconds" )
2765 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2766 onpass="PING ALL PASS",
2767 onfail="PING ALL FAIL" )
2768
GlennRCbddd58f2015-10-01 15:45:25 -07002769 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002770 utilities.assert_equals(
2771 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002772 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002773 onpass="IPv6 Ping across 600 Point intents test PASS",
2774 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2775
2776 def CASE172( self ):
2777 """
2778 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2779 """
2780 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2781 main.log.report( "_________________________________________________" )
2782 import itertools
2783 import time
2784 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2785 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002786 pingResult = main.FALSE
2787 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002788 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002789 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002790 main.log.warn("First ping failed. Retrying...")
2791 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002792 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002793 time2 = time.time()
2794 timeDiff = round( ( time2 - time1 ), 2 )
2795 main.log.report(
2796 "Time taken for IPv6 Ping All: " +
2797 str( timeDiff ) +
2798 " seconds" )
2799 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2800 onpass="PING ALL PASS",
2801 onfail="PING ALL FAIL" )
2802
GlennRCbddd58f2015-10-01 15:45:25 -07002803 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002804 utilities.assert_equals(
2805 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002806 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002807 onpass="IPv6 Ping across 300 host intents test PASS",
2808 onfail="IPv6 Ping across 300 host intents test FAIL" )
2809
2810 def CASE182( self ):
2811 """
2812 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2813 """
2814 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2815 main.log.report( "_________________________________________________" )
2816 import itertools
2817 import time
2818 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2819 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002820 pingResult = main.FALSE
2821 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002822 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002823 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002824 main.log.warn("First ping failed. Retrying...")
2825 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002826 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002827 time2 = time.time()
2828 timeDiff = round( ( time2 - time1 ), 2 )
2829 main.log.report(
2830 "Time taken for IPv6 Ping All: " +
2831 str( timeDiff ) +
2832 " seconds" )
2833 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2834 onpass="PING ALL PASS",
2835 onfail="PING ALL FAIL" )
2836
GlennRCbddd58f2015-10-01 15:45:25 -07002837 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002838 utilities.assert_equals(
2839 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002840 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002841 onpass="IPv6 Ping across 300 host intents test PASS",
2842 onfail="IPv6 Ping across 300 host intents test FAIL" )
2843
2844 def CASE173( self ):
2845 """
2846 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2847 """
2848 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2849 main.log.report( "_________________________________________________" )
2850 import itertools
2851 import time
2852 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2853 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002854 pingResult = main.FALSE
2855 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002856 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002857 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002858 main.log.warn("First ping failed. Retrying...")
2859 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002860 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002861 time2 = time.time()
2862 timeDiff = round( ( time2 - time1 ), 2 )
2863 main.log.report(
2864 "Time taken for IPv6 Ping All: " +
2865 str( timeDiff ) +
2866 " seconds" )
2867 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2868 onpass="PING ALL PASS",
2869 onfail="PING ALL FAIL" )
2870
GlennRCbddd58f2015-10-01 15:45:25 -07002871 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002872 utilities.assert_equals(
2873 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002874 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002875 onpass="IPv6 Ping across 600 point intents test PASS",
2876 onfail="IPv6 Ping across 600 point intents test FAIL" )
2877
2878 def CASE183( self ):
2879 """
2880 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2881 """
2882 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2883 main.log.report( "_________________________________________________" )
2884 import itertools
2885 import time
2886 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2887 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002888 pingResult = main.FALSE
2889 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002890 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002891 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002892 main.log.warn("First ping failed. Retrying...")
2893 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002894 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002895 time2 = time.time()
2896 timeDiff = round( ( time2 - time1 ), 2 )
2897 main.log.report(
2898 "Time taken for IPv6 Ping All: " +
2899 str( timeDiff ) +
2900 " seconds" )
2901 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2902 onpass="PING ALL PASS",
2903 onfail="PING ALL FAIL" )
2904
GlennRCbddd58f2015-10-01 15:45:25 -07002905 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002906 utilities.assert_equals(
2907 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002908 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002909 onpass="IPv6 Ping across 600 Point intents test PASS",
2910 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2911
2912 def CASE174( self ):
2913 """
2914 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2915 """
2916 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2917 main.log.report( "_________________________________________________" )
2918 import itertools
2919 import time
2920 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2921 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002922 pingResult = main.FALSE
2923 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002924 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002925 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002926 main.log.warn("First ping failed. Retrying...")
2927 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002928 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002929 time2 = time.time()
2930 timeDiff = round( ( time2 - time1 ), 2 )
2931 main.log.report(
2932 "Time taken for IPv6 Ping All: " +
2933 str( timeDiff ) +
2934 " seconds" )
2935 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2936 onpass="PING ALL PASS",
2937 onfail="PING ALL FAIL" )
2938
GlennRCbddd58f2015-10-01 15:45:25 -07002939 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002940 utilities.assert_equals(
2941 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002942 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002943 onpass="IPv6 Ping across 2278 host intents test PASS",
2944 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2945
2946 def CASE184( self ):
2947 """
2948 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2949 """
2950 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2951 main.log.report( "_________________________________________________" )
2952 import itertools
2953 import time
2954 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2955 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002956 pingResult = main.FALSE
2957 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002958 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002959 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002960 main.log.warn("First ping failed. Retrying...")
2961 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002962 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002963 time2 = time.time()
2964 timeDiff = round( ( time2 - time1 ), 2 )
2965 main.log.report(
2966 "Time taken for IPv6 Ping All: " +
2967 str( timeDiff ) +
2968 " seconds" )
2969 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2970 onpass="PING ALL PASS",
2971 onfail="PING ALL FAIL" )
2972
GlennRCbddd58f2015-10-01 15:45:25 -07002973 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002974 utilities.assert_equals(
2975 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002976 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002977 onpass="IPv6 Ping across 2278 host intents test PASS",
2978 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2979
2980 def CASE175( self ):
2981 """
2982 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2983 """
2984 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2985 main.log.report( "_________________________________________________" )
2986 import itertools
2987 import time
2988 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2989 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002990 pingResult = main.FALSE
2991 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002992 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002993 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002994 main.log.warn("First ping failed. Retrying...")
2995 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002996 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002997 time2 = time.time()
2998 timeDiff = round( ( time2 - time1 ), 2 )
2999 main.log.report(
3000 "Time taken for IPv6 Ping All: " +
3001 str( timeDiff ) +
3002 " seconds" )
3003 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3004 onpass="PING ALL PASS",
3005 onfail="PING ALL FAIL" )
3006
GlennRCbddd58f2015-10-01 15:45:25 -07003007 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003008 utilities.assert_equals(
3009 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003010 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003011 onpass="IPv6 Ping across 4556 point intents test PASS",
3012 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3013
3014 def CASE185( self ):
3015 """
3016 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3017 """
3018 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3019 main.log.report( "_________________________________________________" )
3020 import itertools
3021 import time
3022 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3023 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003024 pingResult = main.FALSE
3025 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003026 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003027 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003028 main.log.warn("First ping failed. Retrying...")
3029 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003030 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003031 time2 = time.time()
3032 timeDiff = round( ( time2 - time1 ), 2 )
3033 main.log.report(
3034 "Time taken for IPv6 Ping All: " +
3035 str( timeDiff ) +
3036 " seconds" )
3037 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3038 onpass="PING ALL PASS",
3039 onfail="PING ALL FAIL" )
3040
GlennRCbddd58f2015-10-01 15:45:25 -07003041 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003042 utilities.assert_equals(
3043 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003044 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003045 onpass="IPv6 Ping across 4556 Point intents test PASS",
3046 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3047
Hari Krishnac195f3b2015-07-08 20:02:24 -07003048 def CASE90( self ):
3049 """
3050 Install 600 point intents and verify ping all (Att Topology)
3051 """
3052 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3053 main.log.report( "_______________________________________" )
3054 import itertools
3055 import time
3056 main.case( "Install 600 point intents" )
3057 main.step( "Add point Intents" )
3058 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003059 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3060
Hari Krishnac195f3b2015-07-08 20:02:24 -07003061 intentIdList = []
3062 time1 = time.time()
3063 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3064 pool = []
3065 for cli in main.CLIs:
3066 if i >= len( deviceCombos ):
3067 break
3068 t = main.Thread( target=cli.addPointIntent,
3069 threadID=main.threadID,
3070 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003071 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003072 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003073 t.start()
3074 i = i + 1
3075 main.threadID = main.threadID + 1
3076 for thread in pool:
3077 thread.join()
3078 intentIdList.append(thread.result)
3079 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003080 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003081
GlennRCfcfdc4f2015-09-30 16:01:57 -07003082 # Saving intent ids to check intents in later case
3083 main.intentIds = list(intentIdList)
3084
GlennRCa8d786a2015-09-23 17:40:11 -07003085 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003086
GlennRC1dde1712015-10-02 11:03:08 -07003087 # Giving onos multiple chances to install intents
3088 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003089 if i != 0:
3090 main.log.warn( "Verification failed. Retrying..." )
3091 main.log.info("Waiting for onos to install intents...")
3092 time.sleep( main.checkIntentsDelay )
3093
GlennRCa8d786a2015-09-23 17:40:11 -07003094 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003095 for e in range(int(main.numCtrls)):
3096 main.log.info( "Checking intents on CLI %s" % (e+1) )
3097 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3098 intentState
3099 if not intentState:
3100 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003101 if intentState:
3102 break
GlennRCdb2c8422015-09-29 12:21:59 -07003103 else:
3104 #Dumping intent summary
3105 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003106
3107 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3108 onpass="INTENTS INSTALLED",
3109 onfail="SOME INTENTS NOT INSTALLED" )
3110
Hari Krishnac195f3b2015-07-08 20:02:24 -07003111 main.step( "Verify Ping across all hosts" )
3112 pingResult = main.FALSE
3113 time1 = time.time()
3114 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3115 time2 = time.time()
3116 timeDiff = round( ( time2 - time1 ), 2 )
3117 main.log.report(
3118 "Time taken for Ping All: " +
3119 str( timeDiff ) +
3120 " seconds" )
3121 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3122 onpass="PING tALL PASS",
3123 onfail="PING ALL FAIL" )
3124
GlennRCbddd58f2015-10-01 15:45:25 -07003125 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003126
Hari Krishnac195f3b2015-07-08 20:02:24 -07003127 utilities.assert_equals(
3128 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003129 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003130 onpass="Install 600 point Intents and Ping All test PASS",
3131 onfail="Install 600 point Intents and Ping All test FAIL" )
3132
GlennRCbddd58f2015-10-01 15:45:25 -07003133 if not intentState:
3134 main.log.debug( "Intents failed to install completely" )
3135 if not pingResult:
3136 main.log.debug( "Pingall failed" )
3137
3138 if not caseResult and main.failSwitch:
3139 main.log.report("Stopping test")
3140 main.stop( email=main.emailOnStop )
3141
Hari Krishnac195f3b2015-07-08 20:02:24 -07003142 def CASE91( self ):
3143 """
3144 Install 600 point intents and verify ping all (Chordal Topology)
3145 """
3146 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3147 main.log.report( "_______________________________________" )
3148 import itertools
3149 import time
3150 main.case( "Install 600 point intents" )
3151 main.step( "Add point Intents" )
3152 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003153 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3154
Hari Krishnac195f3b2015-07-08 20:02:24 -07003155 intentIdList = []
3156 time1 = time.time()
3157 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3158 pool = []
3159 for cli in main.CLIs:
3160 if i >= len( deviceCombos ):
3161 break
3162 t = main.Thread( target=cli.addPointIntent,
3163 threadID=main.threadID,
3164 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003165 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003166 pool.append(t)
3167 #time.sleep(1)
3168 t.start()
3169 i = i + 1
3170 main.threadID = main.threadID + 1
3171 for thread in pool:
3172 thread.join()
3173 intentIdList.append(thread.result)
3174 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003175 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003176
GlennRCfcfdc4f2015-09-30 16:01:57 -07003177 # Saving intent ids to check intents in later case
3178 main.intentIds = list(intentIdList)
3179
GlennRCa8d786a2015-09-23 17:40:11 -07003180 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003181
GlennRC1dde1712015-10-02 11:03:08 -07003182 # Giving onos multiple chances to install intents
3183 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003184 if i != 0:
3185 main.log.warn( "Verification failed. Retrying..." )
3186 main.log.info("Waiting for onos to install intents...")
3187 time.sleep( main.checkIntentsDelay )
3188
GlennRCa8d786a2015-09-23 17:40:11 -07003189 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003190 for e in range(int(main.numCtrls)):
3191 main.log.info( "Checking intents on CLI %s" % (e+1) )
3192 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3193 intentState
3194 if not intentState:
3195 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003196 if intentState:
3197 break
GlennRCdb2c8422015-09-29 12:21:59 -07003198 else:
3199 #Dumping intent summary
3200 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003201
3202 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3203 onpass="INTENTS INSTALLED",
3204 onfail="SOME INTENTS NOT INSTALLED" )
3205
Hari Krishnac195f3b2015-07-08 20:02:24 -07003206 main.step( "Verify Ping across all hosts" )
3207 pingResult = main.FALSE
3208 time1 = time.time()
3209 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3210 time2 = time.time()
3211 timeDiff = round( ( time2 - time1 ), 2 )
3212 main.log.report(
3213 "Time taken for Ping All: " +
3214 str( timeDiff ) +
3215 " seconds" )
3216 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3217 onpass="PING ALL PASS",
3218 onfail="PING ALL FAIL" )
3219
GlennRCbddd58f2015-10-01 15:45:25 -07003220 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003221
Hari Krishnac195f3b2015-07-08 20:02:24 -07003222 utilities.assert_equals(
3223 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003224 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003225 onpass="Install 600 point Intents and Ping All test PASS",
3226 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003227
GlennRCbddd58f2015-10-01 15:45:25 -07003228 if not intentState:
3229 main.log.debug( "Intents failed to install completely" )
3230 if not pingResult:
3231 main.log.debug( "Pingall failed" )
3232
3233 if not caseResult and main.failSwitch:
3234 main.log.report("Stopping test")
3235 main.stop( email=main.emailOnStop )
3236
Hari Krishnac195f3b2015-07-08 20:02:24 -07003237 def CASE92( self ):
3238 """
3239 Install 4556 point intents and verify ping all (Spine Topology)
3240 """
3241 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3242 main.log.report( "_______________________________________" )
3243 import itertools
3244 import time
3245 main.case( "Install 4556 point intents" )
3246 main.step( "Add point Intents" )
3247 intentResult = main.TRUE
3248 main.pingTimeout = 600
3249 for i in range(len(main.hostMACs)):
3250 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3251 print main.MACsDict
3252 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3253 intentIdList = []
3254 time1 = time.time()
3255 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3256 pool = []
3257 for cli in main.CLIs:
3258 if i >= len( deviceCombos ):
3259 break
3260 t = main.Thread( target=cli.addPointIntent,
3261 threadID=main.threadID,
3262 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003263 args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003264 pool.append(t)
3265 #time.sleep(1)
3266 t.start()
3267 i = i + 1
3268 main.threadID = main.threadID + 1
3269 for thread in pool:
3270 thread.join()
3271 intentIdList.append(thread.result)
3272 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003273 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003274
GlennRCfcfdc4f2015-09-30 16:01:57 -07003275 # Saving intent ids to check intents in later case
3276 main.intentIds = list(intentIdList)
3277
GlennRCa8d786a2015-09-23 17:40:11 -07003278 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003279
GlennRC1dde1712015-10-02 11:03:08 -07003280 # Giving onos multiple chances to install intents
3281 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003282 if i != 0:
3283 main.log.warn( "Verification failed. Retrying..." )
3284 main.log.info("Waiting for onos to install intents...")
3285 time.sleep( main.checkIntentsDelay )
3286
GlennRCa8d786a2015-09-23 17:40:11 -07003287 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003288 for e in range(int(main.numCtrls)):
3289 main.log.info( "Checking intents on CLI %s" % (e+1) )
3290 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3291 intentState
3292 if not intentState:
3293 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003294 if intentState:
3295 break
GlennRCdb2c8422015-09-29 12:21:59 -07003296 else:
3297 #Dumping intent summary
3298 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003299
3300 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3301 onpass="INTENTS INSTALLED",
3302 onfail="SOME INTENTS NOT INSTALLED" )
3303
Hari Krishnac195f3b2015-07-08 20:02:24 -07003304 main.step( "Verify Ping across all hosts" )
3305 pingResult = main.FALSE
3306 time1 = time.time()
3307 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3308 time2 = time.time()
3309 timeDiff = round( ( time2 - time1 ), 2 )
3310 main.log.report(
3311 "Time taken for Ping All: " +
3312 str( timeDiff ) +
3313 " seconds" )
3314 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3315 onpass="PING ALL PASS",
3316 onfail="PING ALL FAIL" )
3317
GlennRCbddd58f2015-10-01 15:45:25 -07003318 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003319
Hari Krishnac195f3b2015-07-08 20:02:24 -07003320 utilities.assert_equals(
3321 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003322 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003323 onpass="Install 4556 point Intents and Ping All test PASS",
3324 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003325
GlennRCbddd58f2015-10-01 15:45:25 -07003326 if not intentState:
3327 main.log.debug( "Intents failed to install completely" )
3328 if not pingResult:
3329 main.log.debug( "Pingall failed" )
3330
3331 if not caseResult and main.failSwitch:
3332 main.log.report("Stopping test")
3333 main.stop( email=main.emailOnStop )
3334
Hari Krishnac195f3b2015-07-08 20:02:24 -07003335 def CASE93( self ):
3336 """
3337 Install multi-single point intents and verify Ping all works
3338 for att topology
3339 """
3340 import copy
3341 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003342 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003343 main.log.report( "Install multi-single point intents and verify Ping all" )
3344 main.log.report( "___________________________________________" )
3345 main.case( "Install multi-single point intents and Ping all" )
3346 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3347 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3348 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003349 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003350 time1 = time.time()
3351 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3352 pool = []
3353 for cli in main.CLIs:
3354 egressDevice = deviceDPIDsCopy[i]
3355 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3356 ingressDeviceList.remove(egressDevice)
3357 if i >= len( deviceDPIDsCopy ):
3358 break
3359 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3360 threadID=main.threadID,
3361 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003362 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003363 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003364 t.start()
3365 i = i + 1
3366 main.threadID = main.threadID + 1
3367 for thread in pool:
3368 thread.join()
3369 intentIdList.append(thread.result)
3370 time2 = time.time()
3371 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003372
GlennRCdb2c8422015-09-29 12:21:59 -07003373 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003374
GlennRC1dde1712015-10-02 11:03:08 -07003375 # Giving onos multiple chances to install intents
3376 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003377 if i != 0:
3378 main.log.warn( "Verification failed. Retrying..." )
3379 main.log.info("Waiting for onos to install intents...")
3380 time.sleep( main.checkIntentsDelay )
3381
3382 intentState = main.TRUE
3383 for e in range(int(main.numCtrls)):
3384 main.log.info( "Checking intents on CLI %s" % (e+1) )
3385 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3386 intentState
3387 if not intentState:
3388 main.log.warn( "Not all intents installed" )
3389 if intentState:
3390 break
3391 else:
3392 #Dumping intent summary
3393 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3394
3395 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3396 onpass="INTENTS INSTALLED",
3397 onfail="SOME INTENTS NOT INSTALLED" )
3398
GlennRCfa69a2a2015-10-02 15:54:06 -07003399 main.step("Verify flows are all added")
3400
3401 for i in range( main.flowCheck ):
3402 if i != 0:
3403 main.log.warn( "verification failed. Retrying..." )
3404 main.log.info( "Waiting for onos to add flows..." )
3405 time.sleep( main.checkFlowsDelay )
3406
3407 flowState = main.TRUE
3408 for cli in main.CLIs:
3409 flowState = cli.checkFlowState()
3410 if not flowState:
3411 main.log.warn( "Not all flows added" )
3412 if flowState:
3413 break
3414 else:
3415 #Dumping summary
3416 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3417
3418 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3419 onpass="FLOWS INSTALLED",
3420 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003421
Hari Krishnac195f3b2015-07-08 20:02:24 -07003422 main.step( "Verify Ping across all hosts" )
3423 pingResult = main.FALSE
3424 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003425 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3426 if not pingResult:
3427 time1 = time.time()
3428 main.log.warn("First pingall failed. Retrying")
3429 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3430
Hari Krishnac195f3b2015-07-08 20:02:24 -07003431 time2 = time.time()
3432 timeDiff = round( ( time2 - time1 ), 2 )
3433 main.log.report(
3434 "Time taken for Ping All: " +
3435 str( timeDiff ) +
3436 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003437
GlennRCbddd58f2015-10-01 15:45:25 -07003438 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003439 utilities.assert_equals(
3440 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003441 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003442 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3443 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003444
GlennRCfa69a2a2015-10-02 15:54:06 -07003445 if not intentState:
3446 main.log.debug( "Intents failed to install completely" )
3447 if not pingResult:
3448 main.log.debug( "Pingall failed" )
3449 if not checkFlowsState:
3450 main.log.debug( "Flows failed to add completely" )
3451
3452 if not caseResult and main.failSwitch:
3453 main.log.report("Stopping test")
3454 main.stop( email=main.emailOnStop )
3455
Hari Krishnac195f3b2015-07-08 20:02:24 -07003456 def CASE94( self ):
3457 """
3458 Install multi-single point intents and verify Ping all works
3459 for Chordal topology
3460 """
3461 import copy
3462 import time
3463 main.log.report( "Install multi-single point intents and verify Ping all" )
3464 main.log.report( "___________________________________________" )
3465 main.case( "Install multi-single point intents and Ping all" )
3466 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3467 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3468 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003469 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003470 time1 = time.time()
3471 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3472 pool = []
3473 for cli in main.CLIs:
3474 egressDevice = deviceDPIDsCopy[i]
3475 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3476 ingressDeviceList.remove(egressDevice)
3477 if i >= len( deviceDPIDsCopy ):
3478 break
3479 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3480 threadID=main.threadID,
3481 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003482 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003483 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003484 t.start()
3485 i = i + 1
3486 main.threadID = main.threadID + 1
3487 for thread in pool:
3488 thread.join()
3489 intentIdList.append(thread.result)
3490 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003491 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003492
3493 main.step("Verify intents are installed")
3494
GlennRC1dde1712015-10-02 11:03:08 -07003495 # Giving onos multiple chances to install intents
3496 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003497 if i != 0:
3498 main.log.warn( "Verification failed. Retrying..." )
3499 main.log.info("Waiting for onos to install intents...")
3500 time.sleep( main.checkIntentsDelay )
3501
3502 intentState = main.TRUE
3503 for e in range(int(main.numCtrls)):
3504 main.log.info( "Checking intents on CLI %s" % (e+1) )
3505 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3506 intentState
3507 if not intentState:
3508 main.log.warn( "Not all intents installed" )
3509 if intentState:
3510 break
3511 else:
3512 #Dumping intent summary
3513 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3514
GlennRCdb2c8422015-09-29 12:21:59 -07003515 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3516 onpass="INTENTS INSTALLED",
3517 onfail="SOME INTENTS NOT INSTALLED" )
3518
GlennRCfa69a2a2015-10-02 15:54:06 -07003519 main.step("Verify flows are all added")
3520
3521 for i in range( main.flowCheck ):
3522 if i != 0:
3523 main.log.warn( "verification failed. Retrying..." )
3524 main.log.info( "Waiting for onos to add flows..." )
3525 time.sleep( main.checkFlowsDelay )
3526
3527 flowState = main.TRUE
3528 for cli in main.CLIs:
3529 flowState = cli.checkFlowState()
3530 if not flowState:
3531 main.log.warn( "Not all flows added" )
3532 if flowState:
3533 break
3534 else:
3535 #Dumping summary
3536 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3537
3538 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3539 onpass="FLOWS INSTALLED",
3540 onfail="SOME FLOWS NOT ADDED" )
3541
Hari Krishnac195f3b2015-07-08 20:02:24 -07003542 main.step( "Verify Ping across all hosts" )
3543 pingResult = main.FALSE
3544 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003545 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07003546 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07003547 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003548 main.log.warn("First pingall failed. Retrying")
3549 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3550
Hari Krishnac195f3b2015-07-08 20:02:24 -07003551 time2 = time.time()
3552 timeDiff = round( ( time2 - time1 ), 2 )
3553 main.log.report(
3554 "Time taken for Ping All: " +
3555 str( timeDiff ) +
3556 " seconds" )
3557
GlennRCfa69a2a2015-10-02 15:54:06 -07003558 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003559 utilities.assert_equals(
3560 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003561 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003562 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3563 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003564
GlennRCfa69a2a2015-10-02 15:54:06 -07003565 if not intentState:
3566 main.log.debug( "Intents failed to install completely" )
3567 if not pingResult:
3568 main.log.debug( "Pingall failed" )
3569 if not checkFlowsState:
3570 main.log.debug( "Flows failed to add completely" )
3571
3572 if not caseResult and main.failSwitch:
3573 main.log.report("Stopping test")
3574 main.stop( email=main.emailOnStop )
3575
3576 def CASE95( self ):
3577 """
3578 Install multi-single point intents and verify Ping all works
3579 for Spine topology
3580 """
3581 import copy
3582 import time
3583 main.log.report( "Install multi-single point intents and verify Ping all" )
3584 main.log.report( "___________________________________________" )
3585 main.case( "Install multi-single point intents and Ping all" )
3586 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3587 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3588 intentIdList = []
3589 main.log.info( "MACsDict" + str(main.MACsDict) )
3590 time1 = time.time()
3591 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3592 pool = []
3593 for cli in main.CLIs:
3594 egressDevice = deviceDPIDsCopy[i]
3595 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3596 ingressDeviceList.remove(egressDevice)
3597 if i >= len( deviceDPIDsCopy ):
3598 break
3599 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3600 threadID=main.threadID,
3601 name="addMultipointToSinglepointIntent",
3602 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3603 pool.append(t)
3604 t.start()
3605 i = i + 1
3606 main.threadID = main.threadID + 1
3607 for thread in pool:
3608 thread.join()
3609 intentIdList.append(thread.result)
3610 time2 = time.time()
3611 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3612
3613 main.step("Verify intents are installed")
3614
3615 # Giving onos multiple chances to install intents
3616 for i in range( main.intentCheck ):
3617 if i != 0:
3618 main.log.warn( "Verification failed. Retrying..." )
3619 main.log.info("Waiting for onos to install intents...")
3620 time.sleep( main.checkIntentsDelay )
3621
3622 intentState = main.TRUE
3623 for e in range(int(main.numCtrls)):
3624 main.log.info( "Checking intents on CLI %s" % (e+1) )
3625 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3626 intentState
3627 if not intentState:
3628 main.log.warn( "Not all intents installed" )
3629 if intentState:
3630 break
3631 else:
3632 #Dumping intent summary
3633 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3634
3635 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3636 onpass="INTENTS INSTALLED",
3637 onfail="SOME INTENTS NOT INSTALLED" )
3638
3639 main.step("Verify flows are all added")
3640
3641 for i in range( main.flowCheck ):
3642 if i != 0:
3643 main.log.warn( "verification failed. Retrying..." )
3644 main.log.info( "Waiting for onos to add flows..." )
3645 time.sleep( main.checkFlowsDelay )
3646
3647 flowState = main.TRUE
3648 for cli in main.CLIs:
3649 flowState = cli.checkFlowState()
3650 if not flowState:
3651 main.log.warn( "Not all flows added" )
3652 if flowState:
3653 break
3654 else:
3655 #Dumping summary
3656 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3657
3658 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3659 onpass="FLOWS INSTALLED",
3660 onfail="SOME FLOWS NOT ADDED" )
3661
3662 main.step( "Verify Ping across all hosts" )
3663 pingResult = main.FALSE
3664 time1 = time.time()
3665 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3666 if not pingResult:
3667 time1 = time.time()
3668 main.log.warn("First pingall failed. Retrying")
3669 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3670
3671 time2 = time.time()
3672 timeDiff = round( ( time2 - time1 ), 2 )
3673 main.log.report(
3674 "Time taken for Ping All: " +
3675 str( timeDiff ) +
3676 " seconds" )
3677
3678 caseResult = ( checkFlowsState and pingResult and intentState )
3679 utilities.assert_equals(
3680 expect=main.TRUE,
3681 actual=caseResult,
3682 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3683 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3684
3685 if not intentState:
3686 main.log.debug( "Intents failed to install completely" )
3687 if not pingResult:
3688 main.log.debug( "Pingall failed" )
3689 if not checkFlowsState:
3690 main.log.debug( "Flows failed to add completely" )
3691
3692 if not caseResult and main.failSwitch:
3693 main.log.report("Stopping test")
3694 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003695
3696 def CASE96( self ):
3697 """
3698 Install single-multi point intents and verify Ping all works
3699 for att topology
3700 """
3701 import copy
3702 main.log.report( "Install single-multi point intents and verify Ping all" )
3703 main.log.report( "___________________________________________" )
3704 main.case( "Install single-multi point intents and Ping all" )
3705 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3706 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3707 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003708 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003709 time1 = time.time()
3710 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3711 pool = []
3712 for cli in main.CLIs:
3713 ingressDevice = deviceDPIDsCopy[i]
3714 egressDeviceList = copy.copy(deviceDPIDsCopy)
3715 egressDeviceList.remove(ingressDevice)
3716 if i >= len( deviceDPIDsCopy ):
3717 break
3718 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3719 threadID=main.threadID,
3720 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003721 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003722 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003723 t.start()
3724 i = i + 1
3725 main.threadID = main.threadID + 1
3726 for thread in pool:
3727 thread.join()
3728 intentIdList.append(thread.result)
3729 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003730 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003731
3732 main.step("Verify intents are installed")
3733
GlennRC1dde1712015-10-02 11:03:08 -07003734 # Giving onos multiple chances to install intents
3735 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003736 if i != 0:
3737 main.log.warn( "Verification failed. Retrying..." )
3738 main.log.info("Waiting for onos to install intents...")
3739 time.sleep( main.checkIntentsDelay )
3740
3741 intentState = main.TRUE
3742 for e in range(int(main.numCtrls)):
3743 main.log.info( "Checking intents on CLI %s" % (e+1) )
3744 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3745 intentState
3746 if not intentState:
3747 main.log.warn( "Not all intents installed" )
3748 if intentState:
3749 break
3750 else:
3751 #Dumping intent summary
3752 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3753
GlennRCdb2c8422015-09-29 12:21:59 -07003754 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3755 onpass="INTENTS INSTALLED",
3756 onfail="SOME INTENTS NOT INSTALLED" )
3757
GlennRCfa69a2a2015-10-02 15:54:06 -07003758 main.step("Verify flows are all added")
3759
3760 for i in range( main.flowCheck ):
3761 if i != 0:
3762 main.log.warn( "verification failed. Retrying..." )
3763 main.log.info( "Waiting for onos to add flows..." )
3764 time.sleep( main.checkFlowsDelay )
3765
3766 flowState = main.TRUE
3767 for cli in main.CLIs:
3768 flowState = cli.checkFlowState()
3769 if not flowState:
3770 main.log.warn( "Not all flows added" )
3771 if flowState:
3772 break
3773 else:
3774 #Dumping summary
3775 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3776
3777 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3778 onpass="FLOWS INSTALLED",
3779 onfail="SOME FLOWS NOT ADDED" )
3780
Hari Krishnac195f3b2015-07-08 20:02:24 -07003781 main.step( "Verify Ping across all hosts" )
3782 pingResult = main.FALSE
3783 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003784 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07003785 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07003786 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003787 main.log.warn("First pingall failed. Retrying")
3788 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3789
Hari Krishnac195f3b2015-07-08 20:02:24 -07003790 time2 = time.time()
3791 timeDiff = round( ( time2 - time1 ), 2 )
3792 main.log.report(
3793 "Time taken for Ping All: " +
3794 str( timeDiff ) +
3795 " seconds" )
3796
GlennRCfa69a2a2015-10-02 15:54:06 -07003797 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003798 utilities.assert_equals(
3799 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003800 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003801 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3802 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3803
GlennRCfa69a2a2015-10-02 15:54:06 -07003804 if not intentState:
3805 main.log.debug( "Intents failed to install completely" )
3806 if not pingResult:
3807 main.log.debug( "Pingall failed" )
3808 if not checkFlowsState:
3809 main.log.debug( "Flows failed to add completely" )
3810
3811 if not caseResult and main.failSwitch:
3812 main.log.report("Stopping test")
3813 main.stop( email=main.emailOnStop )
3814
Hari Krishnac195f3b2015-07-08 20:02:24 -07003815 def CASE97( self ):
3816 """
3817 Install single-multi point intents and verify Ping all works
3818 for Chordal topology
3819 """
3820 import copy
3821 main.log.report( "Install single-multi point intents and verify Ping all" )
3822 main.log.report( "___________________________________________" )
3823 main.case( "Install single-multi point intents and Ping all" )
3824 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3825 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3826 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003827 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003828 time1 = time.time()
3829 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3830 pool = []
3831 for cli in main.CLIs:
3832 ingressDevice = deviceDPIDsCopy[i]
3833 egressDeviceList = copy.copy(deviceDPIDsCopy)
3834 egressDeviceList.remove(ingressDevice)
3835 if i >= len( deviceDPIDsCopy ):
3836 break
3837 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3838 threadID=main.threadID,
3839 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003840 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003841 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003842 t.start()
3843 i = i + 1
3844 main.threadID = main.threadID + 1
3845 for thread in pool:
3846 thread.join()
3847 intentIdList.append(thread.result)
3848 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003849 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003850
3851 main.step("Verify intents are installed")
3852
GlennRC1dde1712015-10-02 11:03:08 -07003853 # Giving onos multiple chances to install intents
3854 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003855 if i != 0:
3856 main.log.warn( "Verification failed. Retrying..." )
3857 main.log.info("Waiting for onos to install intents...")
3858 time.sleep( main.checkIntentsDelay )
3859
3860 intentState = main.TRUE
3861 for e in range(int(main.numCtrls)):
3862 main.log.info( "Checking intents on CLI %s" % (e+1) )
3863 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3864 intentState
3865 if not intentState:
3866 main.log.warn( "Not all intents installed" )
3867 if intentState:
3868 break
3869 else:
3870 #Dumping intent summary
3871 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3872
GlennRCdb2c8422015-09-29 12:21:59 -07003873 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3874 onpass="INTENTS INSTALLED",
3875 onfail="SOME INTENTS NOT INSTALLED" )
3876
GlennRCfa69a2a2015-10-02 15:54:06 -07003877 main.step("Verify flows are all added")
3878
3879 for i in range( main.flowCheck ):
3880 if i != 0:
3881 main.log.warn( "verification failed. Retrying..." )
3882 main.log.info( "Waiting for onos to add flows..." )
3883 time.sleep( main.checkFlowsDelay )
3884
3885 flowState = main.TRUE
3886 for cli in main.CLIs:
3887 flowState = cli.checkFlowState()
3888 if not flowState:
3889 main.log.warn( "Not all flows added" )
3890 if flowState:
3891 break
3892 else:
3893 #Dumping summary
3894 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3895
3896 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3897 onpass="FLOWS INSTALLED",
3898 onfail="SOME FLOWS NOT ADDED" )
3899
Hari Krishnac195f3b2015-07-08 20:02:24 -07003900 main.step( "Verify Ping across all hosts" )
3901 pingResult = main.FALSE
3902 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003903 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07003904 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07003905 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003906 main.log.warn("First pingall failed. Retrying")
3907 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3908
Hari Krishnac195f3b2015-07-08 20:02:24 -07003909 time2 = time.time()
3910 timeDiff = round( ( time2 - time1 ), 2 )
3911 main.log.report(
3912 "Time taken for Ping All: " +
3913 str( timeDiff ) +
3914 " seconds" )
3915
GlennRCfa69a2a2015-10-02 15:54:06 -07003916 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003917 utilities.assert_equals(
3918 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003919 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003920 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3921 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3922
GlennRCfa69a2a2015-10-02 15:54:06 -07003923 if not intentState:
3924 main.log.debug( "Intents failed to install completely" )
3925 if not pingResult:
3926 main.log.debug( "Pingall failed" )
3927 if not checkFlowsState:
3928 main.log.debug( "Flows failed to add completely" )
3929
3930 if not caseResult and main.failSwitch:
3931 main.log.report("Stopping test")
3932 main.stop( email=main.emailOnStop )
3933
Hari Krishnac195f3b2015-07-08 20:02:24 -07003934 def CASE98( self ):
3935 """
3936 Install single-multi point intents and verify Ping all works
3937 for Spine topology
3938 """
3939 import copy
3940 main.log.report( "Install single-multi point intents and verify Ping all" )
3941 main.log.report( "___________________________________________" )
3942 main.case( "Install single-multi point intents and Ping all" )
3943 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3944 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3945 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3946 intentIdList = []
3947 MACsDictCopy = {}
3948 for i in range( len( deviceDPIDsCopy ) ):
3949 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3950
GlennRCfa69a2a2015-10-02 15:54:06 -07003951 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3952 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003953 time1 = time.time()
3954 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3955 pool = []
3956 for cli in main.CLIs:
3957 if i >= len( deviceDPIDsCopy ):
3958 break
3959 ingressDevice = deviceDPIDsCopy[i]
3960 egressDeviceList = copy.copy(deviceDPIDsCopy)
3961 egressDeviceList.remove(ingressDevice)
3962 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3963 threadID=main.threadID,
3964 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003965 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003966 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003967 t.start()
3968 i = i + 1
3969 main.threadID = main.threadID + 1
3970 for thread in pool:
3971 thread.join()
3972 intentIdList.append(thread.result)
3973 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003974 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003975
3976 main.step("Verify intents are installed")
3977
GlennRC1dde1712015-10-02 11:03:08 -07003978 # Giving onos multiple chances to install intents
3979 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003980 if i != 0:
3981 main.log.warn( "Verification failed. Retrying..." )
3982 main.log.info("Waiting for onos to install intents...")
3983 time.sleep( main.checkIntentsDelay )
3984
3985 intentState = main.TRUE
3986 for e in range(int(main.numCtrls)):
3987 main.log.info( "Checking intents on CLI %s" % (e+1) )
3988 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3989 intentState
3990 if not intentState:
3991 main.log.warn( "Not all intents installed" )
3992 if intentState:
3993 break
3994 else:
3995 #Dumping intent summary
3996 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3997
GlennRCdb2c8422015-09-29 12:21:59 -07003998 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3999 onpass="INTENTS INSTALLED",
4000 onfail="SOME INTENTS NOT INSTALLED" )
4001
GlennRCfa69a2a2015-10-02 15:54:06 -07004002 main.step("Verify flows are all added")
4003
4004 for i in range( main.flowCheck ):
4005 if i != 0:
4006 main.log.warn( "verification failed. Retrying..." )
4007 main.log.info( "Waiting for onos to add flows..." )
4008 time.sleep( main.checkFlowsDelay )
4009
4010 flowState = main.TRUE
4011 for cli in main.CLIs:
4012 flowState = cli.checkFlowState()
4013 if not flowState:
4014 main.log.warn( "Not all flows added" )
4015 if flowState:
4016 break
4017 else:
4018 #Dumping summary
4019 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4020
4021 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4022 onpass="FLOWS INSTALLED",
4023 onfail="SOME FLOWS NOT ADDED" )
4024
Hari Krishnac195f3b2015-07-08 20:02:24 -07004025 main.step( "Verify Ping across all hosts" )
4026 pingResult = main.FALSE
4027 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07004028 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07004029 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07004030 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07004031 main.log.warn("First pingall failed. Retrying")
4032 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
4033
Hari Krishnac195f3b2015-07-08 20:02:24 -07004034 time2 = time.time()
4035 timeDiff = round( ( time2 - time1 ), 2 )
4036 main.log.report(
4037 "Time taken for Ping All: " +
4038 str( timeDiff ) +
4039 " seconds" )
4040
GlennRCfa69a2a2015-10-02 15:54:06 -07004041 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004042 utilities.assert_equals(
4043 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004044 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004045 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4046 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4047
GlennRCfa69a2a2015-10-02 15:54:06 -07004048 if not intentState:
4049 main.log.debug( "Intents failed to install completely" )
4050 if not pingResult:
4051 main.log.debug( "Pingall failed" )
4052 if not checkFlowsState:
4053 main.log.debug( "Flows failed to add completely" )
4054
4055 if not caseResult and main.failSwitch:
4056 main.log.report("Stopping test")
4057 main.stop( email=main.emailOnStop )
4058
Hari Krishna4223dbd2015-08-13 16:29:53 -07004059 def CASE190( self ):
4060 """
4061 Verify IPv6 ping across 600 Point intents (Att Topology)
4062 """
4063 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4064 main.log.report( "_________________________________________________" )
4065 import itertools
4066 import time
4067 main.case( "IPv6 ping all 600 Point intents" )
4068 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004069 pingResult = main.FALSE
4070 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004071 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004072 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004073 main.log.warn("First pingall failed. Retrying...")
4074 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004075 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004076 time2 = time.time()
4077 timeDiff = round( ( time2 - time1 ), 2 )
4078 main.log.report(
4079 "Time taken for IPv6 Ping All: " +
4080 str( timeDiff ) +
4081 " seconds" )
4082 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4083 onpass="PING ALL PASS",
4084 onfail="PING ALL FAIL" )
4085
GlennRCbddd58f2015-10-01 15:45:25 -07004086 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004087 utilities.assert_equals(
4088 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004089 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004090 onpass="IPv6 Ping across 600 Point intents test PASS",
4091 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4092
4093 def CASE191( self ):
4094 """
4095 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4096 """
4097 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4098 main.log.report( "_________________________________________________" )
4099 import itertools
4100 import time
4101 main.case( "IPv6 ping all 600 Point intents" )
4102 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004103 pingResult = main.FALSE
4104 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004105 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004106 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004107 main.log.warn("First pingall failed. Retrying...")
4108 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004109 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004110 time2 = time.time()
4111 timeDiff = round( ( time2 - time1 ), 2 )
4112 main.log.report(
4113 "Time taken for IPv6 Ping All: " +
4114 str( timeDiff ) +
4115 " seconds" )
4116 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4117 onpass="PING ALL PASS",
4118 onfail="PING ALL FAIL" )
4119
GlennRCbddd58f2015-10-01 15:45:25 -07004120 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004121 utilities.assert_equals(
4122 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004123 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004124 onpass="IPv6 Ping across 600 Point intents test PASS",
4125 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4126
4127 def CASE192( self ):
4128 """
4129 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4130 """
4131 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4132 main.log.report( "_________________________________________________" )
4133 import itertools
4134 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004135 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004136 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004137 pingResult = main.FALSE
4138 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004139 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004140 if not pingResult:
4141 main.log.warn("First pingall failed. Retrying...")
4142 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004143 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004144 time2 = time.time()
4145 timeDiff = round( ( time2 - time1 ), 2 )
4146 main.log.report(
4147 "Time taken for IPv6 Ping All: " +
4148 str( timeDiff ) +
4149 " seconds" )
4150 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4151 onpass="PING ALL PASS",
4152 onfail="PING ALL FAIL" )
4153
GlennRCbddd58f2015-10-01 15:45:25 -07004154 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004155 utilities.assert_equals(
4156 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004157 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004158 onpass="IPv6 Ping across 4556 Point intents test PASS",
4159 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004160
Hari Krishnac195f3b2015-07-08 20:02:24 -07004161 def CASE10( self ):
4162 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004163 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004164 """
4165 Remove all Intents
4166 """
4167 main.log.report( "Remove all intents that were installed previously" )
4168 main.log.report( "______________________________________________" )
4169 main.log.info( "Remove all intents" )
4170 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004171 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004172 main.step( "Obtain the intent id's first" )
4173 intentsList = main.ONOScli1.getAllIntentIds()
4174 ansi_escape = re.compile( r'\x1b[^m]*m' )
4175 intentsList = ansi_escape.sub( '', intentsList )
4176 intentsList = intentsList.replace(
4177 " onos:intents | grep id=",
4178 "" ).replace(
4179 "id=",
4180 "" ).replace(
4181 "\r\r",
4182 "" )
4183 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004184 intentIdList = []
4185 step1Result = main.TRUE
4186 moreIntents = main.TRUE
4187 removeIntentCount = 0
4188 intentsCount = len(intentsList)
4189 main.log.info ( "Current number of intents: " + str(intentsCount) )
4190 if ( len( intentsList ) > 1 ):
4191 results = main.TRUE
4192 main.log.info("Removing intent...")
4193 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004194 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004195 if removeIntentCount == 5:
4196 break
4197 removeIntentCount = removeIntentCount + 1
4198 intentsList1 = main.ONOScli1.getAllIntentIds()
4199 if len( intentsList1 ) == 0:
4200 break
4201 ansi_escape = re.compile( r'\x1b[^m]*m' )
4202 intentsList1 = ansi_escape.sub( '', intentsList1 )
4203 intentsList1 = intentsList1.replace(
4204 " onos:intents | grep id=",
4205 "" ).replace(
4206 " state=",
4207 "" ).replace(
4208 "\r\r",
4209 "" )
4210 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004211 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4212 print intentsList1
4213 intentIdList1 = []
4214 if ( len( intentsList1 ) > 0 ):
4215 moreIntents = main.TRUE
4216 for i in range( len( intentsList1 ) ):
4217 intentsTemp1 = intentsList1[ i ].split( ',' )
4218 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4219 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4220 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4221 time1 = time.time()
4222 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4223 pool = []
4224 for cli in main.CLIs:
4225 if i >= len( intentIdList1 ):
4226 break
4227 t = main.Thread( target=cli.removeIntent,
4228 threadID=main.threadID,
4229 name="removeIntent",
4230 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4231 pool.append(t)
4232 t.start()
4233 i = i + 1
4234 main.threadID = main.threadID + 1
4235 for thread in pool:
4236 thread.join()
4237 intentIdList.append(thread.result)
4238 #time.sleep(2)
4239 time2 = time.time()
4240 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004241 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004242 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004243 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004244 else:
4245 time.sleep(10)
4246 if len( main.ONOScli1.intents()):
4247 continue
4248 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004249 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004250 else:
4251 print "Removed %d intents" %(intentsCount)
4252 step1Result = main.TRUE
4253 else:
4254 print "No Intent IDs found in Intents list: ", intentsList
4255 step1Result = main.FALSE
4256
4257 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004258 caseResult = step1Result
4259 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004260 onpass="Intent removal test successful",
4261 onfail="Intent removal test failed" )
4262
4263 def CASE12( self, main ):
4264 """
4265 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4266 """
4267 import re
4268 import copy
4269 import time
4270
Hari Krishnac195f3b2015-07-08 20:02:24 -07004271 threadID = 0
4272
4273 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4274 main.log.report( "_____________________________________________________" )
4275 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4276 main.step( "Enable intent based Reactive forwarding" )
4277 installResult = main.FALSE
4278 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004279
Hari Krishnac195f3b2015-07-08 20:02:24 -07004280 pool = []
4281 time1 = time.time()
4282 for cli,feature in main.CLIs:
4283 t = main.Thread(target=cli,threadID=threadID,
4284 name="featureInstall",args=[feature])
4285 pool.append(t)
4286 t.start()
4287 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004288
Hari Krishnac195f3b2015-07-08 20:02:24 -07004289 results = []
4290 for thread in pool:
4291 thread.join()
4292 results.append(thread.result)
4293 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004294
Hari Krishnac195f3b2015-07-08 20:02:24 -07004295 if( all(result == main.TRUE for result in results) == False):
4296 main.log.info("Did not install onos-app-ifwd feature properly")
4297 #main.cleanup()
4298 #main.exit()
4299 else:
4300 main.log.info("Successful feature:install onos-app-ifwd")
4301 installResult = main.TRUE
4302 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004303
Hari Krishnac195f3b2015-07-08 20:02:24 -07004304 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07004305 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07004306 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07004307 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004308 time2 = time.time()
4309 timeDiff = round( ( time2 - time1 ), 2 )
4310 main.log.report(
4311 "Time taken for Ping All: " +
4312 str( timeDiff ) +
4313 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004314
GlennRC626ba132015-09-18 16:16:31 -07004315 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004316 main.log.report( "Pingall Test in Reactive mode successful" )
4317 else:
4318 main.log.report( "Pingall Test in Reactive mode failed" )
4319
4320 main.step( "Disable Intent based Reactive forwarding" )
4321 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004322
Hari Krishnac195f3b2015-07-08 20:02:24 -07004323 pool = []
4324 time1 = time.time()
4325 for cli,feature in main.CLIs:
4326 t = main.Thread(target=cli,threadID=threadID,
4327 name="featureUninstall",args=[feature])
4328 pool.append(t)
4329 t.start()
4330 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004331
Hari Krishnac195f3b2015-07-08 20:02:24 -07004332 results = []
4333 for thread in pool:
4334 thread.join()
4335 results.append(thread.result)
4336 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004337
Hari Krishnac195f3b2015-07-08 20:02:24 -07004338 if( all(result == main.TRUE for result in results) == False):
4339 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4340 uninstallResult = main.FALSE
4341 #main.cleanup()
4342 #main.exit()
4343 else:
4344 main.log.info("Successful feature:uninstall onos-app-ifwd")
4345 uninstallResult = main.TRUE
4346 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4347
4348 # Waiting for reative flows to be cleared.
4349 time.sleep( 10 )
4350
GlennRCbddd58f2015-10-01 15:45:25 -07004351 caseResult = installResult and pingResult and uninstallResult
4352 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004353 onpass="Intent based Reactive forwarding Pingall test PASS",
4354 onfail="Intent based Reactive forwarding Pingall test FAIL" )