blob: a65bf3cee14741d452b97b293d457832625c7d2b [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'] )
GlennRC11353392015-10-02 14:21:34 -070036 main.failSwitch = main.params['TEST']['pause_test']
GlennRC9e7465e2015-10-02 13:50:36 -070037 main.emailOnStop = main.params['TEST']['email']
GlennRC1dde1712015-10-02 11:03:08 -070038 main.intentCheck = int( main.params['TEST']['intent_check'] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070039 main.newTopo = ""
40 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070041
GlennRC9e7465e2015-10-02 13:50:36 -070042 main.failSwitch = True if main.failSwitch == "on" else False
43 main.emailOnStop = True if main.emailOnStop == "on" else False
44
Hari Krishnac195f3b2015-07-08 20:02:24 -070045 for i in range( 1, int(main.numCtrls) + 1 ):
46 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070047
48 main.case( "Set up test environment" )
49 main.log.report( "Set up test environment" )
50 main.log.report( "_______________________" )
51
Hari Krishna6185fc12015-07-13 15:42:31 -070052 main.step( "Apply Cell environment for ONOS" )
53 if ( main.onoscell ):
54 cellName = main.onoscell
55 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070056 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
57 onpass="Test step PASS",
58 onfail="Test step FAIL" )
59 else:
60 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
61 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
62 main.clean()
63 main.exit()
64
Hari Krishnac195f3b2015-07-08 20:02:24 -070065 main.step( "Git checkout and pull " + git_branch )
66 if git_pull == 'on':
67 checkout_result = main.ONOSbench.gitCheckout( git_branch )
68 pull_result = main.ONOSbench.gitPull()
69 cp_result = ( checkout_result and pull_result )
70 else:
71 checkout_result = main.TRUE
72 pull_result = main.TRUE
73 main.log.info( "Skipped git checkout and pull" )
74 cp_result = ( checkout_result and pull_result )
75 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
76 onpass="Test step PASS",
77 onfail="Test step FAIL" )
78
79 main.step( "mvn clean & install" )
80 if git_pull == 'on':
81 mvn_result = main.ONOSbench.cleanInstall()
82 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
83 onpass="Test step PASS",
84 onfail="Test step FAIL" )
85 else:
86 mvn_result = main.TRUE
87 main.log.info("Skipped mvn clean install as git pull is disabled in params file")
88
89 main.ONOSbench.getVersion( report=True )
90
Hari Krishnac195f3b2015-07-08 20:02:24 -070091 main.step( "Create ONOS package" )
92 packageResult = main.ONOSbench.onosPackage()
93 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
94 onpass="Test step PASS",
95 onfail="Test step FAIL" )
96
97 main.step( "Uninstall ONOS package on all Nodes" )
98 uninstallResult = main.TRUE
99 for i in range( int( main.numCtrls ) ):
100 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
101 u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] )
102 utilities.assert_equals( expect=main.TRUE, actual=u_result,
103 onpass="Test step PASS",
104 onfail="Test step FAIL" )
105 uninstallResult = ( uninstallResult and u_result )
106
107 main.step( "Install ONOS package on all Nodes" )
108 installResult = main.TRUE
109 for i in range( int( main.numCtrls ) ):
GlennRCa8d786a2015-09-23 17:40:11 -0700110 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700111 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
112 utilities.assert_equals( expect=main.TRUE, actual=i_result,
113 onpass="Test step PASS",
114 onfail="Test step FAIL" )
115 installResult = ( installResult and i_result )
116
117 main.step( "Verify ONOS nodes UP status" )
118 statusResult = main.TRUE
119 for i in range( int( main.numCtrls ) ):
120 main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" )
121 onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] )
122 utilities.assert_equals( expect=main.TRUE, actual=onos_status,
123 onpass="Test step PASS",
124 onfail="Test step FAIL" )
125 statusResult = ( statusResult and onos_status )
Jon Hall4ba53f02015-07-29 13:07:41 -0700126
Hari Krishnac195f3b2015-07-08 20:02:24 -0700127 main.step( "Start ONOS CLI on all nodes" )
128 cliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700129 main.log.step(" Start ONOS cli using thread ")
130 startCliResult = main.TRUE
131 pool = []
132 time1 = time.time()
133 for i in range( int( main.numCtrls) ):
134 t = main.Thread( target=main.CLIs[i].startOnosCli,
135 threadID=main.threadID,
136 name="startOnosCli",
137 args=[ main.onosIPs[i], karafTimeout ] )
138 pool.append(t)
139 t.start()
140 main.threadID = main.threadID + 1
141 for t in pool:
142 t.join()
143 startCliResult = startCliResult and t.result
144 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700145
Hari Krishnac195f3b2015-07-08 20:02:24 -0700146 if not startCliResult:
147 main.log.info("ONOS CLI did not start up properly")
148 main.cleanup()
149 main.exit()
150 else:
151 main.log.info("Successful CLI startup")
152 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700153
154 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
155 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
156 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
157 cfgResult = cfgResult1 and cfgResult2
158 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
159 onpass="ipv6NeighborDiscovery cfg is set to true",
160 onfail="Failed to cfg set ipv6NeighborDiscovery" )
161
162 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Hari Krishnac195f3b2015-07-08 20:02:24 -0700163 main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1))
164 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
165 onpass="Set up test environment PASS",
166 onfail="Set up test environment FAIL" )
167
168 def CASE20( self, main ):
169 """
170 This test script Loads a new Topology (Att) on CHO setup and balances all switches
171 """
172 import re
173 import time
174 import copy
175
176 main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] )
177 main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] )
178 main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] )
179 main.pingTimeout = 300
180 main.log.report(
181 "Load Att topology and Balance all Mininet switches across controllers" )
182 main.log.report(
183 "________________________________________________________________________" )
184 main.case(
185 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700186
Hari Krishnac195f3b2015-07-08 20:02:24 -0700187 main.step( "Stop any previous Mininet network topology" )
188 cliResult = main.TRUE
189 if main.newTopo == main.params['TOPO3']['topo']:
190 stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" )
191
192 main.step( "Start Mininet with Att topology" )
193 main.newTopo = main.params['TOPO1']['topo']
GlennRCc6cd2a62015-08-10 16:08:22 -0700194 mininetDir = main.Mininet1.home + "/custom/"
195 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
196 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
197 topoPath = mininetDir + main.newTopo
198 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Jon Hall4ba53f02015-07-29 13:07:41 -0700199
Hari Krishnac195f3b2015-07-08 20:02:24 -0700200 main.step( "Assign switches to controllers" )
201 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
202 main.Mininet1.assignSwController(
203 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700204 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700205
206 switch_mastership = main.TRUE
207 for i in range( 1, ( main.numMNswitches + 1 ) ):
208 response = main.Mininet1.getSwController( "s" + str( i ) )
209 print( "Response is " + str( response ) )
210 if re.search( "tcp:" + main.onosIPs[0], response ):
211 switch_mastership = switch_mastership and main.TRUE
212 else:
213 switch_mastership = main.FALSE
214
215 if switch_mastership == main.TRUE:
216 main.log.report( "Controller assignment successfull" )
217 else:
218 main.log.report( "Controller assignment failed" )
219
220 time.sleep(30) # waiting here to make sure topology converges across all nodes
221
222 main.step( "Balance devices across controllers" )
223 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700224 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700225 time.sleep( 5 )
226
227 topology_output = main.ONOScli1.topology()
228 topology_result = main.ONOSbench.getTopology( topology_output )
229 case2Result = ( switch_mastership and startStatus )
230 utilities.assert_equals(
231 expect=main.TRUE,
232 actual=case2Result,
233 onpass="Starting new Att topology test PASS",
234 onfail="Starting new Att topology test FAIL" )
235
236 def CASE21( self, main ):
237 """
238 This test script Loads a new Topology (Chordal) on CHO setup and balances all switches
239 """
240 import re
241 import time
242 import copy
243
244 main.newTopo = main.params['TOPO2']['topo']
245 main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] )
246 main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] )
247 main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] )
248 main.pingTimeout = 300
249 main.log.report(
250 "Load Chordal topology and Balance all Mininet switches across controllers" )
251 main.log.report(
252 "________________________________________________________________________" )
253 main.case(
254 "Assign and Balance all Mininet switches across controllers" )
255
256 main.step( "Stop any previous Mininet network topology" )
257 stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" )
258
GlennRCc6cd2a62015-08-10 16:08:22 -0700259 main.step("Start Mininet with Chordal topology")
260 mininetDir = main.Mininet1.home + "/custom/"
261 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
262 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
263 topoPath = mininetDir + main.newTopo
264 startStatus = main.Mininet1.startNet(topoFile = topoPath)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265
266 main.step( "Assign switches to controllers" )
267
268 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
269 main.Mininet1.assignSwController(
270 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700271 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700272
273 switch_mastership = main.TRUE
274 for i in range( 1, ( main.numMNswitches + 1 ) ):
275 response = main.Mininet1.getSwController( "s" + str( i ) )
276 print( "Response is " + str( response ) )
277 if re.search( "tcp:" + main.onosIPs[0], response ):
278 switch_mastership = switch_mastership and main.TRUE
279 else:
280 switch_mastership = main.FALSE
281
282 if switch_mastership == main.TRUE:
283 main.log.report( "Controller assignment successfull" )
284 else:
285 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700286
Hari Krishnac195f3b2015-07-08 20:02:24 -0700287 main.step( "Balance devices across controllers" )
288 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700289 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290 time.sleep( 5 )
291
GlennRCbddd58f2015-10-01 15:45:25 -0700292 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293 time.sleep(30)
294 utilities.assert_equals(
295 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700296 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700297 onpass="Starting new Chordal topology test PASS",
298 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700299
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300 def CASE22( self, main ):
301 """
302 This test script Loads a new Topology (Spine) on CHO setup and balances all switches
303 """
304 import re
305 import time
306 import copy
307
308 main.newTopo = main.params['TOPO3']['topo']
309 main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] )
310 main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] )
311 main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] )
312 main.pingTimeout = 600
Jon Hall4ba53f02015-07-29 13:07:41 -0700313
Hari Krishnac195f3b2015-07-08 20:02:24 -0700314 main.log.report(
315 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
316 main.log.report(
317 "________________________________________________________________________" )
318 main.case(
319 "Assign and Balance all Mininet switches across controllers" )
320 main.step( "Stop any previous Mininet network topology" )
321 stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700322
323 main.step("Start Mininet with Spine topology")
324 mininetDir = main.Mininet1.home + "/custom/"
325 topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo
326 main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to")
327 topoPath = mininetDir + main.newTopo
328 startStatus = main.Mininet1.startNet(topoFile = topoPath)
329
Hari Krishnac195f3b2015-07-08 20:02:24 -0700330 time.sleep(60)
331 main.step( "Assign switches to controllers" )
332
333 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
334 main.Mininet1.assignSwController(
335 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700336 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700337
338 switch_mastership = main.TRUE
339 for i in range( 1, ( main.numMNswitches + 1 ) ):
340 response = main.Mininet1.getSwController( "s" + str( i ) )
341 print( "Response is " + str( response ) )
342 if re.search( "tcp:" + main.onosIPs[0], response ):
343 switch_mastership = switch_mastership and main.TRUE
344 else:
345 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700346
Hari Krishnac195f3b2015-07-08 20:02:24 -0700347 if switch_mastership == main.TRUE:
348 main.log.report( "Controller assignment successfull" )
349 else:
350 main.log.report( "Controller assignment failed" )
351 time.sleep( 5 )
352
353 main.step( "Balance devices across controllers" )
354 for i in range( int( main.numCtrls ) ):
355 balanceResult = main.ONOScli1.balanceMasters()
356 # giving some breathing time for ONOS to complete re-balance
357 time.sleep( 3 )
358
GlennRCbddd58f2015-10-01 15:45:25 -0700359 caseResult = switch_mastership
Hari Krishnac195f3b2015-07-08 20:02:24 -0700360 time.sleep(60)
361 utilities.assert_equals(
362 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700363 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700364 onpass="Starting new Spine topology test PASS",
365 onfail="Starting new Spine topology test FAIL" )
366
367 def CASE3( self, main ):
368 """
369 This Test case will be extended to collect and store more data related
370 ONOS state.
371 """
372 import re
373 import copy
374 main.deviceDPIDs = []
375 main.hostMACs = []
376 main.deviceLinks = []
377 main.deviceActiveLinksCount = []
378 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700379
Hari Krishnac195f3b2015-07-08 20:02:24 -0700380 main.log.report(
381 "Collect and Store topology details from ONOS before running any Tests" )
382 main.log.report(
383 "____________________________________________________________________" )
384 main.case( "Collect and Store Topology Details from ONOS" )
385 main.step( "Collect and store current number of switches and links" )
386 topology_output = main.ONOScli1.topology()
387 topology_result = main.ONOSbench.getTopology( topology_output )
388 numOnosDevices = topology_result[ 'devices' ]
389 numOnosLinks = topology_result[ 'links' ]
390 topoResult = main.TRUE
391
392 if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ):
393 main.step( "Store Device DPIDs" )
394 for i in range( 1, (main.numMNswitches+1) ):
395 main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
396 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
397
398 main.step( "Store Host MACs" )
399 for i in range( 1, ( main.numMNhosts + 1 ) ):
400 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
401 print "Host MACs in Store: \n", str( main.hostMACs )
402 main.MACsDict = {}
403 print "Creating dictionary of DPID and HostMacs"
404 for i in range(len(main.hostMACs)):
405 main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0]
406 print main.MACsDict
407 main.step( "Collect and store all Devices Links" )
408 linksResult = main.ONOScli1.links( jsonFormat=False )
409 ansi_escape = re.compile( r'\x1b[^m]*m' )
410 linksResult = ansi_escape.sub( '', linksResult )
411 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
412 linksResult = linksResult.splitlines()
413 main.deviceLinks = copy.copy( linksResult )
414 print "Device Links Stored: \n", str( main.deviceLinks )
415 # this will be asserted to check with the params provided count of
416 # links
417 print "Length of Links Store", len( main.deviceLinks )
418
419 main.step( "Collect and store each Device ports enabled Count" )
420 time1 = time.time()
421 for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
422 pool = []
423 for cli in main.CLIs:
424 if i >= main.numMNswitches + 1:
425 break
426 dpid = "of:00000000000000" + format( i,'02x' )
427 t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
428 t.start()
429 pool.append(t)
430 i = i + 1
431 main.threadID = main.threadID + 1
432 for thread in pool:
433 thread.join()
434 portResult = thread.result
435 main.devicePortsEnabledCount.append( portResult )
436 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
437 time2 = time.time()
438 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
439
440 main.step( "Collect and store each Device active links Count" )
441 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700442
Hari Krishnac195f3b2015-07-08 20:02:24 -0700443 for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
444 pool = []
445 for cli in main.CLIs:
446 if i >= main.numMNswitches + 1:
447 break
448 dpid = "of:00000000000000" + format( i,'02x' )
449 t = main.Thread( target = cli.getDeviceLinksActiveCount,
450 threadID = main.threadID,
451 name = "getDevicePortsEnabledCount",
452 args = [dpid])
453 t.start()
454 pool.append(t)
455 i = i + 1
456 main.threadID = main.threadID + 1
457 for thread in pool:
458 thread.join()
459 linkCountResult = thread.result
460 main.deviceActiveLinksCount.append( linkCountResult )
461 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
462 time2 = time.time()
463 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
464
465 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700466 main.log.info("Devices (expected): %s, Links (expected): %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700467 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
468 main.log.info("Devices (actual): %s, Links (actual): %s" %
469 ( numOnosDevices , numOnosLinks ) )
470 main.log.info("Topology does not match, exiting CHO test...")
471 topoResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700472 # It's better exit here from running the test
Hari Krishnac195f3b2015-07-08 20:02:24 -0700473 main.cleanup()
474 main.exit()
475
476 # just returning TRUE for now as this one just collects data
477 case3Result = topoResult
478 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
479 onpass="Saving ONOS topology data test PASS",
480 onfail="Saving ONOS topology data test FAIL" )
481
482 def CASE40( self, main ):
483 """
484 Verify Reactive forwarding (Att Topology)
485 """
486 import re
487 import copy
488 import time
489 main.log.report( "Verify Reactive forwarding (Att Topology)" )
490 main.log.report( "______________________________________________" )
491 main.case( "Enable Reactive forwarding and Verify ping all" )
492 main.step( "Enable Reactive forwarding" )
493 installResult = main.TRUE
494 # Activate fwd app
495 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
496 appCheck = main.TRUE
497 pool = []
498 for cli in main.CLIs:
499 t = main.Thread( target=cli.appToIDCheck,
500 name="appToIDCheck-" + str( i ),
501 args=[] )
502 pool.append( t )
503 t.start()
504 for t in pool:
505 t.join()
506 appCheck = appCheck and t.result
507 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
508 onpass="App Ids seem to be correct",
509 onfail="Something is wrong with app Ids" )
510 if appCheck != main.TRUE:
511 main.log.warn( main.CLIs[0].apps() )
512 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700513
Hari Krishnac195f3b2015-07-08 20:02:24 -0700514 time.sleep( 10 )
515
516 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700517 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700518 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700519 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
520 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700521 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700522 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -0700523 time2 = time.time()
524 timeDiff = round( ( time2 - time1 ), 2 )
525 main.log.report(
526 "Time taken for Ping All: " +
527 str( timeDiff ) +
528 " seconds" )
529
GlennRC626ba132015-09-18 16:16:31 -0700530 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700531 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700532 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700533 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700534
GlennRCbddd58f2015-10-01 15:45:25 -0700535 caseResult = appCheck and pingResult
536 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700537 onpass="Reactive Mode IPv4 Pingall test PASS",
538 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700539
540 def CASE41( self, main ):
541 """
542 Verify Reactive forwarding (Chordal Topology)
543 """
544 import re
545 import copy
546 import time
547 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
548 main.log.report( "______________________________________________" )
549 main.case( "Enable Reactive forwarding and Verify ping all" )
550 main.step( "Enable Reactive forwarding" )
551 installResult = main.TRUE
552 # Activate fwd app
553 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
554
555 appCheck = main.TRUE
556 pool = []
557 for cli in main.CLIs:
558 t = main.Thread( target=cli.appToIDCheck,
559 name="appToIDCheck-" + str( i ),
560 args=[] )
561 pool.append( t )
562 t.start()
563 for t in pool:
564 t.join()
565 appCheck = appCheck and t.result
566 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
567 onpass="App Ids seem to be correct",
568 onfail="Something is wrong with app Ids" )
569 if appCheck != main.TRUE:
570 main.log.warn( main.CLIs[0].apps() )
571 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700572
Hari Krishnac195f3b2015-07-08 20:02:24 -0700573 time.sleep( 10 )
574
575 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700576 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700577 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700578 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
579 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700580 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700581 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700582 time2 = time.time()
583 timeDiff = round( ( time2 - time1 ), 2 )
584 main.log.report(
585 "Time taken for Ping All: " +
586 str( timeDiff ) +
587 " seconds" )
588
GlennRC626ba132015-09-18 16:16:31 -0700589 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700590 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700591 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700592 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700593
GlennRCbddd58f2015-10-01 15:45:25 -0700594 caseResult = appCheck and pingResult
595 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700596 onpass="Reactive Mode IPv4 Pingall test PASS",
597 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700598
599 def CASE42( self, main ):
600 """
601 Verify Reactive forwarding (Spine Topology)
602 """
603 import re
604 import copy
605 import time
606 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
607 main.log.report( "______________________________________________" )
608 main.case( "Enable Reactive forwarding and Verify ping all" )
609 main.step( "Enable Reactive forwarding" )
610 installResult = main.TRUE
611 # Activate fwd app
612 appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" )
613
614 appCheck = main.TRUE
615 pool = []
616 for cli in main.CLIs:
617 t = main.Thread( target=cli.appToIDCheck,
618 name="appToIDCheck-" + str( i ),
619 args=[] )
620 pool.append( t )
621 t.start()
622 for t in pool:
623 t.join()
624 appCheck = appCheck and t.result
625 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
626 onpass="App Ids seem to be correct",
627 onfail="Something is wrong with app Ids" )
628 if appCheck != main.TRUE:
629 main.log.warn( main.CLIs[0].apps() )
630 main.log.warn( main.CLIs[0].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700631
Hari Krishnac195f3b2015-07-08 20:02:24 -0700632 time.sleep( 10 )
633
634 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700635 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700636 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700637 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
638 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700639 main.log.warn("First pingall failed. Trying again...")
GlennRC626ba132015-09-18 16:16:31 -0700640 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700641 time2 = time.time()
642 timeDiff = round( ( time2 - time1 ), 2 )
643 main.log.report(
644 "Time taken for Ping All: " +
645 str( timeDiff ) +
646 " seconds" )
647
GlennRC626ba132015-09-18 16:16:31 -0700648 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700649 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700650 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700651 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
652
GlennRCbddd58f2015-10-01 15:45:25 -0700653 caseResult = appCheck and pingResult
654 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700655 onpass="Reactive Mode IPv4 Pingall test PASS",
656 onfail="Reactive Mode IPv4 Pingall test FAIL" )
657
658 def CASE140( self, main ):
659 """
660 Verify IPv6 Reactive forwarding (Att Topology)
661 """
662 import re
663 import copy
664 import time
665 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
666 main.log.report( "______________________________________________" )
667 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
668 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
669
670 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
671 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
672 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
673 cfgResult = cfgResult1 and cfgResult2
674 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
675 onpass="Reactive mode ipv6Fowarding cfg is set to true",
676 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
677
678 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700679 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700680 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700681 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
682 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700683 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700684 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700685 time2 = time.time()
686 timeDiff = round( ( time2 - time1 ), 2 )
687 main.log.report(
688 "Time taken for IPv6 Ping All: " +
689 str( timeDiff ) +
690 " seconds" )
691
GlennRC626ba132015-09-18 16:16:31 -0700692 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700693 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
694 else:
695 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700696
697 main.step( "Disable Reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700698
Hari Krishnac195f3b2015-07-08 20:02:24 -0700699 main.log.info( "Uninstall reactive forwarding app" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700700 appCheck = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700701 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
702 pool = []
703 for cli in main.CLIs:
704 t = main.Thread( target=cli.appToIDCheck,
705 name="appToIDCheck-" + str( i ),
706 args=[] )
707 pool.append( t )
708 t.start()
709
710 for t in pool:
711 t.join()
712 appCheck = appCheck and t.result
713 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
714 onpass="App Ids seem to be correct",
715 onfail="Something is wrong with app Ids" )
716 if appCheck != main.TRUE:
717 main.log.warn( main.CLIs[0].apps() )
718 main.log.warn( main.CLIs[0].appIDs() )
719
720 # Waiting for reative flows to be cleared.
721 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700722 caseResult = appCheck and cfgResult and pingResult
723 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700724 onpass="Reactive Mode IPv6 Pingall test PASS",
725 onfail="Reactive Mode IPv6 Pingall test FAIL" )
726
727 def CASE141( self, main ):
728 """
729 Verify IPv6 Reactive forwarding (Chordal Topology)
730 """
731 import re
732 import copy
733 import time
734 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
735 main.log.report( "______________________________________________" )
736 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
737 hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ]
738
739 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
740 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
741 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
742 cfgResult = cfgResult1 and cfgResult2
743 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
744 onpass="Reactive mode ipv6Fowarding cfg is set to true",
745 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
746
747 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700748 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700749 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -0700750 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
751 if not pingResult:
GlennRCf07c44a2015-09-18 13:33:46 -0700752 main.log.warn("First pingall failed. Trying again..")
GlennRC626ba132015-09-18 16:16:31 -0700753 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700754 time2 = time.time()
755 timeDiff = round( ( time2 - time1 ), 2 )
756 main.log.report(
757 "Time taken for IPv6 Ping All: " +
758 str( timeDiff ) +
759 " seconds" )
760
GlennRC626ba132015-09-18 16:16:31 -0700761 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700762 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
763 else:
764 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
765
766 main.step( "Disable Reactive forwarding" )
767
768 main.log.info( "Uninstall reactive forwarding app" )
769 appCheck = main.TRUE
770 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
771 pool = []
772 for cli in main.CLIs:
773 t = main.Thread( target=cli.appToIDCheck,
774 name="appToIDCheck-" + str( i ),
775 args=[] )
776 pool.append( t )
777 t.start()
778
779 for t in pool:
780 t.join()
781 appCheck = appCheck and t.result
782 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
783 onpass="App Ids seem to be correct",
784 onfail="Something is wrong with app Ids" )
785 if appCheck != main.TRUE:
786 main.log.warn( main.CLIs[0].apps() )
787 main.log.warn( main.CLIs[0].appIDs() )
788
789 # Waiting for reative flows to be cleared.
790 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700791 caseResult = appCheck and cfgResult and pingResult
792 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700793 onpass="Reactive Mode IPv6 Pingall test PASS",
794 onfail="Reactive Mode IPv6 Pingall test FAIL" )
795
796 def CASE142( self, main ):
797 """
798 Verify IPv6 Reactive forwarding (Spine Topology)
799 """
800 import re
801 import copy
802 import time
803 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
804 main.log.report( "______________________________________________" )
805 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
806 # Spine topology do not have hosts h1-h10
807 hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ]
808 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
809 cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
810 cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
811 cfgResult = cfgResult1 and cfgResult2
812 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
813 onpass="Reactive mode ipv6Fowarding cfg is set to true",
814 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
815
816 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700817 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700818 time1 = time.time()
GlennRC558cd862015-10-08 09:54:04 -0700819 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
820 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -0700821 main.log.warn("First pingall failed. Trying again...")
GlennRC558cd862015-10-08 09:54:04 -0700822 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700823 time2 = time.time()
824 timeDiff = round( ( time2 - time1 ), 2 )
825 main.log.report(
826 "Time taken for IPv6 Ping All: " +
827 str( timeDiff ) +
828 " seconds" )
829
GlennRC626ba132015-09-18 16:16:31 -0700830 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700831 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
832 else:
833 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
834
835 main.step( "Disable Reactive forwarding" )
836
837 main.log.info( "Uninstall reactive forwarding app" )
838 appCheck = main.TRUE
839 appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" )
840 pool = []
841 for cli in main.CLIs:
842 t = main.Thread( target=cli.appToIDCheck,
843 name="appToIDCheck-" + str( i ),
844 args=[] )
845 pool.append( t )
846 t.start()
847
848 for t in pool:
849 t.join()
850 appCheck = appCheck and t.result
851 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
852 onpass="App Ids seem to be correct",
853 onfail="Something is wrong with app Ids" )
854 if appCheck != main.TRUE:
855 main.log.warn( main.CLIs[0].apps() )
856 main.log.warn( main.CLIs[0].appIDs() )
857
858 # Waiting for reative flows to be cleared.
859 time.sleep( 30 )
GlennRCbddd58f2015-10-01 15:45:25 -0700860 caseResult = appCheck and cfgResult and pingResult
861 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700862 onpass="Reactive Mode IPv6 Pingall test PASS",
863 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700864
865 def CASE5( self, main ):
866 """
867 Compare current ONOS topology with reference data
868 """
869 import re
Jon Hall4ba53f02015-07-29 13:07:41 -0700870
Hari Krishnac195f3b2015-07-08 20:02:24 -0700871 devicesDPIDTemp = []
872 hostMACsTemp = []
873 deviceLinksTemp = []
874 deviceActiveLinksCountTemp = []
875 devicePortsEnabledCountTemp = []
876
877 main.log.report(
878 "Compare ONOS topology with reference data in Stores" )
879 main.log.report( "__________________________________________________" )
880 main.case( "Compare ONOS topology with reference data" )
881
882 main.step( "Compare current Device ports enabled with reference" )
883 time1 = time.time()
884 for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ):
885 pool = []
886 for cli in main.CLIs:
887 if i >= main.numMNswitches + 1:
888 break
889 dpid = "of:00000000000000" + format( i,'02x' )
890 t = main.Thread(target = cli.getDevicePortsEnabledCount,
891 threadID = main.threadID,
892 name = "getDevicePortsEnabledCount",
893 args = [dpid])
894 t.start()
895 pool.append(t)
896 i = i + 1
897 main.threadID = main.threadID + 1
898 for thread in pool:
899 thread.join()
900 portResult = thread.result
901 #portTemp = re.split( r'\t+', portResult )
902 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
903 devicePortsEnabledCountTemp.append( portResult )
904
905 time2 = time.time()
906 main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1))
907 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700908 "Device Enabled ports EXPECTED: %s" %
909 str( main.devicePortsEnabledCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700910 main.log.info (
Jon Hall4ba53f02015-07-29 13:07:41 -0700911 "Device Enabled ports ACTUAL: %s" %
Hari Krishnac195f3b2015-07-08 20:02:24 -0700912 str( devicePortsEnabledCountTemp ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700913
Hari Krishnac195f3b2015-07-08 20:02:24 -0700914 if ( cmp( main.devicePortsEnabledCount,
915 devicePortsEnabledCountTemp ) == 0 ):
916 stepResult1 = main.TRUE
917 else:
918 stepResult1 = main.FALSE
919
920 main.step( "Compare Device active links with reference" )
921 time1 = time.time()
922 for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ):
923 pool = []
924 for cli in main.CLIs:
925 if i >= main.numMNswitches + 1:
926 break
927 dpid = "of:00000000000000" + format( i,'02x' )
928 t = main.Thread(target = cli.getDeviceLinksActiveCount,
929 threadID = main.threadID,
930 name = "getDeviceLinksActiveCount",
931 args = [dpid])
932 t.start()
933 pool.append(t)
934 i = i + 1
935 main.threadID = main.threadID + 1
936 for thread in pool:
937 thread.join()
938 linkCountResult = thread.result
939 #linkCountTemp = re.split( r'\t+', linkCountResult )
940 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
941 deviceActiveLinksCountTemp.append( linkCountResult )
942
943 time2 = time.time()
944 main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
945 main.log.info (
946 "Device Active links EXPECTED: %s" %
947 str( main.deviceActiveLinksCount ) )
948 main.log.info (
949 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
950 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
951 stepResult2 = main.TRUE
952 else:
953 stepResult2 = main.FALSE
954
955 """
956 place holder for comparing devices, hosts, paths and intents if required.
957 Links and ports data would be incorrect with out devices anyways.
958 """
959 case5Result = ( stepResult1 and stepResult2 )
960 utilities.assert_equals( expect=main.TRUE, actual=case5Result,
961 onpass="Compare Topology test PASS",
962 onfail="Compare Topology test FAIL" )
963
964 def CASE60( self ):
965 """
966 Install 300 host intents and verify ping all (Att Topology)
967 """
968 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
969 main.log.report( "_______________________________________" )
970 import itertools
971 import time
972 main.case( "Install 300 host intents" )
973 main.step( "Add host Intents" )
974 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700975 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
976
Hari Krishnac195f3b2015-07-08 20:02:24 -0700977 intentIdList = []
978 time1 = time.time()
979 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
980 pool = []
981 for cli in main.CLIs:
982 if i >= len( hostCombos ):
983 break
984 t = main.Thread( target=cli.addHostIntent,
985 threadID=main.threadID,
986 name="addHostIntent",
987 args=[hostCombos[i][0],hostCombos[i][1]])
988 pool.append(t)
989 t.start()
990 i = i + 1
991 main.threadID = main.threadID + 1
992 for thread in pool:
993 thread.join()
994 intentIdList.append(thread.result)
995 time2 = time.time()
996 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
997
GlennRCfcfdc4f2015-09-30 16:01:57 -0700998 # Saving intent ids to check intents in later cases
999 main.intentIds = list(intentIdList)
1000
GlennRCa8d786a2015-09-23 17:40:11 -07001001 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07001002
GlennRC1dde1712015-10-02 11:03:08 -07001003 # Giving onos multiple chances to install intents
1004 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001005 if i != 0:
1006 main.log.warn( "Verification failed. Retrying..." )
1007 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001008 time.sleep( main.checkIntentsDelay )
1009
1010 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001011 for e in range(int(main.numCtrls)):
1012 main.log.info( "Checking intents on CLI %s" % (e+1) )
1013 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1014 intentState
1015 if not intentState:
1016 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001017 if intentState:
1018 break
GlennRCdb2c8422015-09-29 12:21:59 -07001019 else:
1020 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001021 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
GlennRCdb2c8422015-09-29 12:21:59 -07001022
GlennRCa8d786a2015-09-23 17:40:11 -07001023
1024 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1025 onpass="INTENTS INSTALLED",
1026 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001027
1028 main.step( "Verify Ping across all hosts" )
1029 pingResult = main.FALSE
1030 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001031 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1032 if not pingResult:
1033 main.log.warn("First pingall failed. Retrying...")
1034 time1 = time.time()
1035 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001036 time2 = time.time()
1037 timeDiff = round( ( time2 - time1 ), 2 )
1038 main.log.report(
1039 "Time taken for Ping All: " +
1040 str( timeDiff ) +
1041 " seconds" )
1042 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1043 onpass="PING ALL PASS",
1044 onfail="PING ALL FAIL" )
1045
GlennRCbddd58f2015-10-01 15:45:25 -07001046 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001047 utilities.assert_equals(
1048 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001049 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001050 onpass="Install 300 Host Intents and Ping All test PASS",
1051 onfail="Install 300 Host Intents and Ping All test FAIL" )
1052
GlennRCfcfdc4f2015-09-30 16:01:57 -07001053 if not intentState:
1054 main.log.debug( "Intents failed to install completely" )
1055 if not pingResult:
1056 main.log.debug( "Pingall failed" )
1057
GlennRCbddd58f2015-10-01 15:45:25 -07001058 if not caseResult and main.failSwitch:
1059 main.log.report("Stopping test")
1060 main.stop( email=main.emailOnStop )
1061
Hari Krishnac195f3b2015-07-08 20:02:24 -07001062 def CASE61( self ):
1063 """
1064 Install 600 host intents and verify ping all for Chordal Topology
1065 """
1066 main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" )
1067 main.log.report( "_______________________________________" )
1068 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001069
Hari Krishnac195f3b2015-07-08 20:02:24 -07001070 main.case( "Install 600 host intents" )
1071 main.step( "Add host Intents" )
1072 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001073 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
1074
Hari Krishnac195f3b2015-07-08 20:02:24 -07001075 intentIdList = []
1076 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07001077
Hari Krishnac195f3b2015-07-08 20:02:24 -07001078 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1079 pool = []
1080 for cli in main.CLIs:
1081 if i >= len( hostCombos ):
1082 break
1083 t = main.Thread( target=cli.addHostIntent,
1084 threadID=main.threadID,
1085 name="addHostIntent",
1086 args=[hostCombos[i][0],hostCombos[i][1]])
1087 pool.append(t)
1088 t.start()
1089 i = i + 1
1090 main.threadID = main.threadID + 1
1091 for thread in pool:
1092 thread.join()
1093 intentIdList.append(thread.result)
1094 time2 = time.time()
1095 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001096
GlennRCfcfdc4f2015-09-30 16:01:57 -07001097 # Saving intent ids to check intents in later cases
1098 main.intentIds = list(intentIdList)
1099
GlennRCa8d786a2015-09-23 17:40:11 -07001100 main.step("Verify intents are installed")
1101
GlennRC1dde1712015-10-02 11:03:08 -07001102 # Giving onos multiple chances to install intents
1103 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001104 if i != 0:
1105 main.log.warn( "Verification failed. Retrying..." )
1106 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001107 time.sleep( main.checkIntentsDelay )
1108
1109 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001110 for e in range(int(main.numCtrls)):
1111 main.log.info( "Checking intents on CLI %s" % (e+1) )
1112 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1113 intentState
1114 if not intentState:
1115 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001116 if intentState:
1117 break
GlennRCdb2c8422015-09-29 12:21:59 -07001118 else:
1119 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001120 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001121
1122 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1123 onpass="INTENTS INSTALLED",
1124 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001125
1126 main.step( "Verify Ping across all hosts" )
1127 pingResult = main.FALSE
1128 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001129 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1130 if not pingResult:
1131 main.log.warn("First pingall failed. Retrying...")
1132 time1 = time.time()
1133 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001134 time2 = time.time()
1135 timeDiff = round( ( time2 - time1 ), 2 )
1136 main.log.report(
1137 "Time taken for Ping All: " +
1138 str( timeDiff ) +
1139 " seconds" )
1140 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1141 onpass="PING ALL PASS",
1142 onfail="PING ALL FAIL" )
1143
GlennRCbddd58f2015-10-01 15:45:25 -07001144 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001145
Hari Krishnac195f3b2015-07-08 20:02:24 -07001146 utilities.assert_equals(
1147 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001148 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001149 onpass="Install 300 Host Intents and Ping All test PASS",
1150 onfail="Install 300 Host Intents and Ping All test FAIL" )
1151
GlennRCfcfdc4f2015-09-30 16:01:57 -07001152 if not intentState:
1153 main.log.debug( "Intents failed to install completely" )
1154 if not pingResult:
1155 main.log.debug( "Pingall failed" )
1156
GlennRCbddd58f2015-10-01 15:45:25 -07001157 if not caseResult and main.failSwitch:
1158 main.log.report("Stopping test")
1159 main.stop( email=main.emailOnStop )
1160
Hari Krishnac195f3b2015-07-08 20:02:24 -07001161 def CASE62( self ):
1162 """
1163 Install 2278 host intents and verify ping all for Spine Topology
1164 """
1165 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1166 main.log.report( "_______________________________________" )
1167 import itertools
Jon Hall4ba53f02015-07-29 13:07:41 -07001168
Hari Krishnac195f3b2015-07-08 20:02:24 -07001169 main.case( "Install 2278 host intents" )
1170 main.step( "Add host Intents" )
1171 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07001172 hostCombos = list( itertools.combinations( main.hostMACs, 2 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001173 main.pingTimeout = 300
1174 intentIdList = []
1175 time1 = time.time()
1176 for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ):
1177 pool = []
1178 for cli in main.CLIs:
1179 if i >= len( hostCombos ):
1180 break
1181 t = main.Thread( target=cli.addHostIntent,
1182 threadID=main.threadID,
1183 name="addHostIntent",
1184 args=[hostCombos[i][0],hostCombos[i][1]])
1185 pool.append(t)
1186 t.start()
1187 i = i + 1
1188 main.threadID = main.threadID + 1
1189 for thread in pool:
1190 thread.join()
1191 intentIdList.append(thread.result)
1192 time2 = time.time()
1193 main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07001194
GlennRCfcfdc4f2015-09-30 16:01:57 -07001195 # Saving intent ids to check intents in later cases
1196 main.intentIds = list(intentIdList)
1197
GlennRCa8d786a2015-09-23 17:40:11 -07001198 main.step("Verify intents are installed")
1199
GlennRC1dde1712015-10-02 11:03:08 -07001200 # Giving onos multiple chances to install intents
1201 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07001202 if i != 0:
1203 main.log.warn( "Verification failed. Retrying..." )
1204 main.log.info("Waiting for onos to install intents...")
GlennRCa8d786a2015-09-23 17:40:11 -07001205 time.sleep( main.checkIntentsDelay )
1206
1207 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07001208 for e in range(int(main.numCtrls)):
1209 main.log.info( "Checking intents on CLI %s" % (e+1) )
1210 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
1211 intentState
1212 if not intentState:
1213 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07001214 if intentState:
1215 break
GlennRCdb2c8422015-09-29 12:21:59 -07001216 else:
1217 #Dumping intent summary
GlennRCfcfdc4f2015-09-30 16:01:57 -07001218 main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
GlennRCa8d786a2015-09-23 17:40:11 -07001219
1220 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1221 onpass="INTENTS INSTALLED",
1222 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001223
1224 main.step( "Verify Ping across all hosts" )
1225 pingResult = main.FALSE
1226 time1 = time.time()
GlennRCa8d786a2015-09-23 17:40:11 -07001227 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
1228 if not pingResult:
1229 main.log.warn("First pingall failed. Retrying...")
1230 time1 = time.time()
1231 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
Hari Krishnac195f3b2015-07-08 20:02:24 -07001232 time2 = time.time()
1233 timeDiff = round( ( time2 - time1 ), 2 )
1234 main.log.report(
1235 "Time taken for Ping All: " +
1236 str( timeDiff ) +
1237 " seconds" )
1238 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1239 onpass="PING ALL PASS",
1240 onfail="PING ALL FAIL" )
1241
GlennRCbddd58f2015-10-01 15:45:25 -07001242 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001243
Hari Krishnac195f3b2015-07-08 20:02:24 -07001244 utilities.assert_equals(
1245 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001246 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001247 onpass="Install 2278 Host Intents and Ping All test PASS",
1248 onfail="Install 2278 Host Intents and Ping All test FAIL" )
1249
GlennRCfcfdc4f2015-09-30 16:01:57 -07001250 if not intentState:
1251 main.log.debug( "Intents failed to install completely" )
1252 if not pingResult:
1253 main.log.debug( "Pingall failed" )
1254
GlennRCbddd58f2015-10-01 15:45:25 -07001255 if not caseResult and main.failSwitch:
1256 main.log.report("Stopping test")
1257 main.stop( email=main.emailOnStop )
1258
Hari Krishna4223dbd2015-08-13 16:29:53 -07001259 def CASE160( self ):
1260 """
1261 Verify IPv6 ping across 300 host intents (Att Topology)
1262 """
1263 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1264 main.log.report( "_________________________________________________" )
1265 import itertools
1266 import time
1267 main.case( "IPv6 ping all 300 host intents" )
1268 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001269 pingResult = main.FALSE
1270 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001271 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001272 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001273 main.log.warn("First pingall failed. Retrying...")
1274 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001275 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001276 time2 = time.time()
1277 timeDiff = round( ( time2 - time1 ), 2 )
1278 main.log.report(
1279 "Time taken for IPv6 Ping All: " +
1280 str( timeDiff ) +
1281 " seconds" )
1282 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1283 onpass="PING ALL PASS",
1284 onfail="PING ALL FAIL" )
1285
GlennRCbddd58f2015-10-01 15:45:25 -07001286 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001287 utilities.assert_equals(
1288 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001289 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001290 onpass="IPv6 Ping across 300 host intents test PASS",
1291 onfail="IPv6 Ping across 300 host intents test FAIL" )
1292
1293 def CASE161( self ):
1294 """
1295 Verify IPv6 ping across 600 host intents (Chordal Topology)
1296 """
1297 main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" )
1298 main.log.report( "_________________________________________________" )
1299 import itertools
1300 import time
1301 main.case( "IPv6 ping all 600 host intents" )
1302 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001303 pingResult = main.FALSE
1304 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001305 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001306 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001307 main.log.warn("First pingall failed. Retrying...")
1308 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001309 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001310 time2 = time.time()
1311 timeDiff = round( ( time2 - time1 ), 2 )
1312 main.log.report(
1313 "Time taken for IPv6 Ping All: " +
1314 str( timeDiff ) +
1315 " seconds" )
1316 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1317 onpass="PING ALL PASS",
1318 onfail="PING ALL FAIL" )
1319
GlennRCbddd58f2015-10-01 15:45:25 -07001320 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001321 utilities.assert_equals(
1322 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001323 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001324 onpass="IPv6 Ping across 600 host intents test PASS",
1325 onfail="IPv6 Ping across 600 host intents test FAIL" )
1326
1327 def CASE162( self ):
1328 """
1329 Verify IPv6 ping across 2278 host intents (Spine Topology)
1330 """
1331 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1332 main.log.report( "_________________________________________________" )
1333 import itertools
1334 import time
1335 main.case( "IPv6 ping all 600 host intents" )
1336 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001337 pingResult = main.FALSE
1338 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001339 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07001340 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001341 main.log.warn("First pingall failed. Retrying...")
1342 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07001343 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001344 time2 = time.time()
1345 timeDiff = round( ( time2 - time1 ), 2 )
1346 main.log.report(
1347 "Time taken for IPv6 Ping All: " +
1348 str( timeDiff ) +
1349 " seconds" )
1350 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1351 onpass="PING ALL PASS",
1352 onfail="PING ALL FAIL" )
1353
GlennRCbddd58f2015-10-01 15:45:25 -07001354 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001355 utilities.assert_equals(
1356 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001357 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001358 onpass="IPv6 Ping across 600 host intents test PASS",
1359 onfail="IPv6 Ping across 600 host intents test FAIL" )
1360
Hari Krishnac195f3b2015-07-08 20:02:24 -07001361 def CASE70( self, main ):
1362 """
1363 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
1364 """
1365 import random
1366 main.randomLink1 = []
1367 main.randomLink2 = []
1368 main.randomLink3 = []
1369 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1370 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1371 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1372 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1373 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1374 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1375 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1376 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1377
1378 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1379 main.log.report( "___________________________________________________________________________" )
1380 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1381 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1382 if ( int( switchLinksToToggle ) ==
1383 0 or int( switchLinksToToggle ) > 5 ):
1384 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1385 #main.cleanup()
1386 #main.exit()
1387 else:
1388 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1389
1390 main.step( "Cut links on Core devices using user provided range" )
1391 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1392 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1393 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1394 for i in range( int( switchLinksToToggle ) ):
1395 main.Mininet1.link(
1396 END1=link1End1,
1397 END2=main.randomLink1[ i ],
1398 OPTION="down" )
1399 time.sleep( link_sleep )
1400 main.Mininet1.link(
1401 END1=link2End1,
1402 END2=main.randomLink2[ i ],
1403 OPTION="down" )
1404 time.sleep( link_sleep )
1405 main.Mininet1.link(
1406 END1=link3End1,
1407 END2=main.randomLink3[ i ],
1408 OPTION="down" )
1409 time.sleep( link_sleep )
1410
Hari Krishna6185fc12015-07-13 15:42:31 -07001411 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001412 linkDown = main.ONOSbench.checkStatus(
1413 topology_output, main.numMNswitches, str(
1414 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1415 utilities.assert_equals(
1416 expect=main.TRUE,
1417 actual=linkDown,
1418 onpass="Link Down discovered properly",
1419 onfail="Link down was not discovered in " +
1420 str( link_sleep ) +
1421 " seconds" )
1422
GlennRCfcfdc4f2015-09-30 16:01:57 -07001423 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001424 # Giving onos multiple chances to install intents
1425 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001426 if i != 0:
1427 main.log.warn( "Verification failed. Retrying..." )
1428 main.log.info("Giving onos some time...")
1429 time.sleep( main.checkIntentsDelay )
1430
1431 intentState = main.TRUE
1432 for e in range(int(main.numCtrls)):
1433 main.log.info( "Checking intents on CLI %s" % (e+1) )
1434 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1435 intentState
1436 if not intentState:
1437 main.log.warn( "Not all intents installed" )
1438 if intentState:
1439 break
1440 else:
1441 #Dumping intent summary
1442 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1443
1444
1445 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1446 onpass="INTENTS INSTALLED",
1447 onfail="SOME INTENTS NOT INSTALLED" )
1448
Hari Krishnac195f3b2015-07-08 20:02:24 -07001449 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001450 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001451 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001452 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1453 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001454 main.log.warn("First pingall failed. Retrying...")
1455 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001456 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001457
Hari Krishnac195f3b2015-07-08 20:02:24 -07001458 time2 = time.time()
1459 timeDiff = round( ( time2 - time1 ), 2 )
1460 main.log.report(
1461 "Time taken for Ping All: " +
1462 str( timeDiff ) +
1463 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001464 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001465 onpass="PING ALL PASS",
1466 onfail="PING ALL FAIL" )
1467
GlennRCbddd58f2015-10-01 15:45:25 -07001468 caseResult = linkDown and pingResult and intentState
1469 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001470 onpass="Random Link cut Test PASS",
1471 onfail="Random Link cut Test FAIL" )
1472
GlennRCfcfdc4f2015-09-30 16:01:57 -07001473 # Printing what exactly failed
1474 if not linkDown:
1475 main.log.debug( "Link down was not discovered correctly" )
1476 if not pingResult:
1477 main.log.debug( "Pingall failed" )
1478 if not intentState:
1479 main.log.debug( "Intents are not all installed" )
1480
GlennRCbddd58f2015-10-01 15:45:25 -07001481 if not caseResult and main.failSwitch:
1482 main.log.report("Stopping test")
1483 main.stop( email=main.emailOnStop )
1484
Hari Krishnac195f3b2015-07-08 20:02:24 -07001485 def CASE80( self, main ):
1486 """
1487 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1488 """
1489 import random
1490 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1491 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1492 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1493 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1494 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1495
1496 main.log.report(
1497 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1498 main.log.report(
1499 "__________________________________________________________________" )
1500 main.case(
1501 "Host intents - Bring the core links up that are down and verify ping all" )
1502 main.step( "Bring randomly cut links on Core devices up" )
1503 for i in range( int( switchLinksToToggle ) ):
1504 main.Mininet1.link(
1505 END1=link1End1,
1506 END2=main.randomLink1[ i ],
1507 OPTION="up" )
1508 time.sleep( link_sleep )
1509 main.Mininet1.link(
1510 END1=link2End1,
1511 END2=main.randomLink2[ i ],
1512 OPTION="up" )
1513 time.sleep( link_sleep )
1514 main.Mininet1.link(
1515 END1=link3End1,
1516 END2=main.randomLink3[ i ],
1517 OPTION="up" )
1518 time.sleep( link_sleep )
1519
Hari Krishna6185fc12015-07-13 15:42:31 -07001520 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001521 linkUp = main.ONOSbench.checkStatus(
1522 topology_output,
1523 main.numMNswitches,
1524 str( main.numMNlinks ) )
1525 utilities.assert_equals(
1526 expect=main.TRUE,
1527 actual=linkUp,
1528 onpass="Link up discovered properly",
1529 onfail="Link up was not discovered in " +
1530 str( link_sleep ) +
1531 " seconds" )
1532
GlennRCfcfdc4f2015-09-30 16:01:57 -07001533 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001534 # Giving onos multiple chances to install intents
1535 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001536 if i != 0:
1537 main.log.warn( "Verification failed. Retrying..." )
1538 main.log.info("Giving onos some time...")
1539 time.sleep( main.checkIntentsDelay )
1540
1541 intentState = main.TRUE
1542 for e in range(int(main.numCtrls)):
1543 main.log.info( "Checking intents on CLI %s" % (e+1) )
1544 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1545 intentState
1546 if not intentState:
1547 main.log.warn( "Not all intents installed" )
1548 if intentState:
1549 break
1550 else:
1551 #Dumping intent summary
1552 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1553
1554
1555 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1556 onpass="INTENTS INSTALLED",
1557 onfail="SOME INTENTS NOT INSTALLED" )
1558
Hari Krishnac195f3b2015-07-08 20:02:24 -07001559 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001560 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001561 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001562 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1563 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001564 main.log.warn("First pingall failed. Retrying...")
1565 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001566 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001567
Hari Krishnac195f3b2015-07-08 20:02:24 -07001568 time2 = time.time()
1569 timeDiff = round( ( time2 - time1 ), 2 )
1570 main.log.report(
1571 "Time taken for Ping All: " +
1572 str( timeDiff ) +
1573 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001574 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575 onpass="PING ALL PASS",
1576 onfail="PING ALL FAIL" )
1577
GlennRCbddd58f2015-10-01 15:45:25 -07001578 caseResult = linkUp and pingResult
1579 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001580 onpass="Link Up Test PASS",
1581 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001582 # Printing what exactly failed
1583 if not linkUp:
1584 main.log.debug( "Link down was not discovered correctly" )
1585 if not pingResult:
1586 main.log.debug( "Pingall failed" )
1587 if not intentState:
1588 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001589
GlennRCbddd58f2015-10-01 15:45:25 -07001590 if not caseResult and main.failSwitch:
1591 main.log.report("Stopping test")
1592 main.stop( email=main.emailOnStop )
1593
Hari Krishnac195f3b2015-07-08 20:02:24 -07001594 def CASE71( self, main ):
1595 """
1596 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
1597 """
1598 import random
1599 main.randomLink1 = []
1600 main.randomLink2 = []
1601 main.randomLink3 = []
1602 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1603 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1604 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1605 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1606 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1607 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1608 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1609 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1610
1611 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1612 main.log.report( "___________________________________________________________________________" )
1613 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1614 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1615 if ( int( switchLinksToToggle ) ==
1616 0 or int( switchLinksToToggle ) > 5 ):
1617 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1618 #main.cleanup()
1619 #main.exit()
1620 else:
1621 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1622
1623 main.step( "Cut links on Core devices using user provided range" )
1624 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1625 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1626 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1627 for i in range( int( switchLinksToToggle ) ):
1628 main.Mininet1.link(
1629 END1=link1End1,
1630 END2=main.randomLink1[ i ],
1631 OPTION="down" )
1632 time.sleep( link_sleep )
1633 main.Mininet1.link(
1634 END1=link2End1,
1635 END2=main.randomLink2[ i ],
1636 OPTION="down" )
1637 time.sleep( link_sleep )
1638 main.Mininet1.link(
1639 END1=link3End1,
1640 END2=main.randomLink3[ i ],
1641 OPTION="down" )
1642 time.sleep( link_sleep )
1643
Hari Krishna6185fc12015-07-13 15:42:31 -07001644 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001645 linkDown = main.ONOSbench.checkStatus(
1646 topology_output, main.numMNswitches, str(
1647 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) )
1648 utilities.assert_equals(
1649 expect=main.TRUE,
1650 actual=linkDown,
1651 onpass="Link Down discovered properly",
1652 onfail="Link down was not discovered in " +
1653 str( link_sleep ) +
1654 " seconds" )
1655
GlennRCfcfdc4f2015-09-30 16:01:57 -07001656 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001657 # Giving onos multiple chances to install intents
1658 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001659 if i != 0:
1660 main.log.warn( "Verification failed. Retrying..." )
1661 main.log.info("Giving onos some time...")
1662 time.sleep( main.checkIntentsDelay )
1663
1664 intentState = main.TRUE
1665 for e in range(int(main.numCtrls)):
1666 main.log.info( "Checking intents on CLI %s" % (e+1) )
1667 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1668 intentState
1669 if not intentState:
1670 main.log.warn( "Not all intents installed" )
1671 if intentState:
1672 break
1673 else:
1674 #Dumping intent summary
1675 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1676
1677
1678 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1679 onpass="INTENTS INSTALLED",
1680 onfail="SOME INTENTS NOT INSTALLED" )
1681
Hari Krishnac195f3b2015-07-08 20:02:24 -07001682 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001683 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001684 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1686 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001687 main.log.warn("First pingall failed. Retrying...")
1688 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001689 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001690
Hari Krishnac195f3b2015-07-08 20:02:24 -07001691 time2 = time.time()
1692 timeDiff = round( ( time2 - time1 ), 2 )
1693 main.log.report(
1694 "Time taken for Ping All: " +
1695 str( timeDiff ) +
1696 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001697 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001698 onpass="PING ALL PASS",
1699 onfail="PING ALL FAIL" )
1700
GlennRCbddd58f2015-10-01 15:45:25 -07001701 caseResult = linkDown and pingResult and intentState
1702 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001703 onpass="Random Link cut Test PASS",
1704 onfail="Random Link cut Test FAIL" )
1705
GlennRCfcfdc4f2015-09-30 16:01:57 -07001706 # Printing what exactly failed
1707 if not linkDown:
1708 main.log.debug( "Link down was not discovered correctly" )
1709 if not pingResult:
1710 main.log.debug( "Pingall failed" )
1711 if not intentState:
1712 main.log.debug( "Intents are not all installed" )
1713
GlennRCbddd58f2015-10-01 15:45:25 -07001714 if not caseResult and main.failSwitch:
1715 main.log.report("Stopping test")
1716 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001717
Hari Krishnac195f3b2015-07-08 20:02:24 -07001718 def CASE81( self, main ):
1719 """
1720 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1721 """
1722 import random
1723 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1724 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1725 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1726 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
1727 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1728
1729 main.log.report(
1730 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1731 main.log.report(
1732 "__________________________________________________________________" )
1733 main.case(
1734 "Point intents - Bring the core links up that are down and verify ping all" )
1735 main.step( "Bring randomly cut links on Core devices up" )
1736 for i in range( int( switchLinksToToggle ) ):
1737 main.Mininet1.link(
1738 END1=link1End1,
1739 END2=main.randomLink1[ i ],
1740 OPTION="up" )
1741 time.sleep( link_sleep )
1742 main.Mininet1.link(
1743 END1=link2End1,
1744 END2=main.randomLink2[ i ],
1745 OPTION="up" )
1746 time.sleep( link_sleep )
1747 main.Mininet1.link(
1748 END1=link3End1,
1749 END2=main.randomLink3[ i ],
1750 OPTION="up" )
1751 time.sleep( link_sleep )
1752
Hari Krishna6185fc12015-07-13 15:42:31 -07001753 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001754 linkUp = main.ONOSbench.checkStatus(
1755 topology_output,
1756 main.numMNswitches,
1757 str( main.numMNlinks ) )
1758 utilities.assert_equals(
1759 expect=main.TRUE,
1760 actual=linkUp,
1761 onpass="Link up discovered properly",
1762 onfail="Link up was not discovered in " +
1763 str( link_sleep ) +
1764 " seconds" )
1765
GlennRCfcfdc4f2015-09-30 16:01:57 -07001766 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001767 # Giving onos multiple chances to install intents
1768 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001769 if i != 0:
1770 main.log.warn( "Verification failed. Retrying..." )
1771 main.log.info("Giving onos some time...")
1772 time.sleep( main.checkIntentsDelay )
1773
1774 intentState = main.TRUE
1775 for e in range(int(main.numCtrls)):
1776 main.log.info( "Checking intents on CLI %s" % (e+1) )
1777 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1778 intentState
1779 if not intentState:
1780 main.log.warn( "Not all intents installed" )
1781 if intentState:
1782 break
1783 else:
1784 #Dumping intent summary
1785 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1786
1787
1788 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1789 onpass="INTENTS INSTALLED",
1790 onfail="SOME INTENTS NOT INSTALLED" )
1791
Hari Krishnac195f3b2015-07-08 20:02:24 -07001792 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001793 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001795 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1796 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001797 main.log.warn("First pingall failed. Retrying...")
1798 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001799 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001800
Hari Krishnac195f3b2015-07-08 20:02:24 -07001801 time2 = time.time()
1802 timeDiff = round( ( time2 - time1 ), 2 )
1803 main.log.report(
1804 "Time taken for Ping All: " +
1805 str( timeDiff ) +
1806 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001807 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001808 onpass="PING ALL PASS",
1809 onfail="PING ALL FAIL" )
1810
GlennRCbddd58f2015-10-01 15:45:25 -07001811 caseResult = linkUp and pingResult
1812 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001813 onpass="Link Up Test PASS",
1814 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001815 # Printing what exactly failed
1816 if not linkUp:
1817 main.log.debug( "Link down was not discovered correctly" )
1818 if not pingResult:
1819 main.log.debug( "Pingall failed" )
1820 if not intentState:
1821 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001822
GlennRCbddd58f2015-10-01 15:45:25 -07001823 if not caseResult and main.failSwitch:
1824 main.log.report("Stopping test")
GlennRC884dc9e2015-10-09 15:53:20 -07001825 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001826
Hari Krishnac195f3b2015-07-08 20:02:24 -07001827 def CASE72( self, main ):
1828 """
1829 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
1830 """
1831 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001832 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07001833 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001834
Hari Krishnac195f3b2015-07-08 20:02:24 -07001835 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1836 main.log.report( "___________________________________________________________________________" )
1837 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1838 switches = []
1839 switchesComb = []
1840 for i in range( main.numMNswitches ):
1841 switches.append('s%d'%(i+1))
1842 switchesLinksComb = list(itertools.combinations(switches,2))
1843 main.randomLinks = random.sample(switchesLinksComb, 5 )
1844 print main.randomLinks
1845 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001846
Hari Krishnac195f3b2015-07-08 20:02:24 -07001847 for switch in main.randomLinks:
1848 main.Mininet1.link(
1849 END1=switch[0],
1850 END2=switch[1],
1851 OPTION="down")
1852 time.sleep( link_sleep )
1853
Hari Krishna6185fc12015-07-13 15:42:31 -07001854 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001855 linkDown = main.ONOSbench.checkStatus(
1856 topology_output, main.numMNswitches, str(
1857 int( main.numMNlinks ) - 5 * 2 ) )
1858 utilities.assert_equals(
1859 expect=main.TRUE,
1860 actual=linkDown,
1861 onpass="Link Down discovered properly",
1862 onfail="Link down was not discovered in " +
1863 str( link_sleep ) +
1864 " seconds" )
1865
GlennRCfcfdc4f2015-09-30 16:01:57 -07001866 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001867 # Giving onos multiple chances to install intents
1868 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001869 if i != 0:
1870 main.log.warn( "Verification failed. Retrying..." )
1871 main.log.info("Giving onos some time...")
1872 time.sleep( main.checkIntentsDelay )
1873
1874 intentState = main.TRUE
1875 for e in range(int(main.numCtrls)):
1876 main.log.info( "Checking intents on CLI %s" % (e+1) )
1877 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1878 intentState
1879 if not intentState:
1880 main.log.warn( "Not all intents installed" )
1881 if intentState:
1882 break
1883 else:
1884 #Dumping intent summary
1885 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1886
1887
1888 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1889 onpass="INTENTS INSTALLED",
1890 onfail="SOME INTENTS NOT INSTALLED" )
1891
Hari Krishnac195f3b2015-07-08 20:02:24 -07001892 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001893 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001895 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
1896 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001897 main.log.warn("First pingall failed. Retrying...")
1898 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001899 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001900
Hari Krishnac195f3b2015-07-08 20:02:24 -07001901 time2 = time.time()
1902 timeDiff = round( ( time2 - time1 ), 2 )
1903 main.log.report(
1904 "Time taken for Ping All: " +
1905 str( timeDiff ) +
1906 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001907 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001908 onpass="PING ALL PASS",
1909 onfail="PING ALL FAIL" )
1910
GlennRCbddd58f2015-10-01 15:45:25 -07001911 caseResult = linkDown and pingResult and intentState
1912 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001913 onpass="Random Link cut Test PASS",
1914 onfail="Random Link cut Test FAIL" )
1915
GlennRCfcfdc4f2015-09-30 16:01:57 -07001916 # Printing what exactly failed
1917 if not linkDown:
1918 main.log.debug( "Link down was not discovered correctly" )
1919 if not pingResult:
1920 main.log.debug( "Pingall failed" )
1921 if not intentState:
1922 main.log.debug( "Intents are not all installed" )
1923
GlennRCbddd58f2015-10-01 15:45:25 -07001924 if not caseResult and main.failSwitch:
1925 main.log.report("Stopping test")
1926 main.stop( email=main.emailOnStop )
1927
Hari Krishnac195f3b2015-07-08 20:02:24 -07001928 def CASE82( self, main ):
1929 """
1930 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1931 """
1932 import random
1933 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001934
Hari Krishnac195f3b2015-07-08 20:02:24 -07001935 main.log.report(
1936 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1937 main.log.report(
1938 "__________________________________________________________________" )
1939 main.case(
1940 "Host intents - Bring the core links up that are down and verify ping all" )
1941 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001942
Hari Krishnac195f3b2015-07-08 20:02:24 -07001943 for switch in main.randomLinks:
1944 main.Mininet1.link(
1945 END1=switch[0],
1946 END2=switch[1],
1947 OPTION="up")
1948 time.sleep( link_sleep )
1949
Hari Krishna6185fc12015-07-13 15:42:31 -07001950 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001951 linkUp = main.ONOSbench.checkStatus(
1952 topology_output,
1953 main.numMNswitches,
1954 str( main.numMNlinks ) )
1955 utilities.assert_equals(
1956 expect=main.TRUE,
1957 actual=linkUp,
1958 onpass="Link up discovered properly",
1959 onfail="Link up was not discovered in " +
1960 str( link_sleep ) +
1961 " seconds" )
1962
GlennRCfcfdc4f2015-09-30 16:01:57 -07001963 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07001964 # Giving onos multiple chances to install intents
1965 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07001966 if i != 0:
1967 main.log.warn( "Verification failed. Retrying..." )
1968 main.log.info("Giving onos some time...")
1969 time.sleep( main.checkIntentsDelay )
1970
1971 intentState = main.TRUE
1972 for e in range(int(main.numCtrls)):
1973 main.log.info( "Checking intents on CLI %s" % (e+1) )
1974 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
1975 intentState
1976 if not intentState:
1977 main.log.warn( "Not all intents installed" )
1978 if intentState:
1979 break
1980 else:
1981 #Dumping intent summary
1982 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
1983
1984
1985 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1986 onpass="INTENTS INSTALLED",
1987 onfail="SOME INTENTS NOT INSTALLED" )
1988
Hari Krishnac195f3b2015-07-08 20:02:24 -07001989 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001990 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001991 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001992 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
1993 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07001994 main.log.warn("First pingall failed. Retrying...")
1995 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07001996 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07001997
Hari Krishnac195f3b2015-07-08 20:02:24 -07001998 time2 = time.time()
1999 timeDiff = round( ( time2 - time1 ), 2 )
2000 main.log.report(
2001 "Time taken for Ping All: " +
2002 str( timeDiff ) +
2003 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002004 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002005 onpass="PING ALL PASS",
2006 onfail="PING ALL FAIL" )
2007
GlennRCbddd58f2015-10-01 15:45:25 -07002008 caseResult = linkUp and pingResult
2009 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002010 onpass="Link Up Test PASS",
2011 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002012 # Printing what exactly failed
2013 if not linkUp:
2014 main.log.debug( "Link down was not discovered correctly" )
2015 if not pingResult:
2016 main.log.debug( "Pingall failed" )
2017 if not intentState:
2018 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002019
GlennRCbddd58f2015-10-01 15:45:25 -07002020 if not caseResult and main.failSwitch:
2021 main.log.report("Stopping test")
2022 main.stop( email=main.emailOnStop )
2023
Hari Krishnac195f3b2015-07-08 20:02:24 -07002024 def CASE73( self, main ):
2025 """
2026 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
2027 """
2028 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07002029 import itertools
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002031
Hari Krishnac195f3b2015-07-08 20:02:24 -07002032 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
2033 main.log.report( "___________________________________________________________________________" )
2034 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
2035 switches = []
2036 switchesComb = []
2037 for i in range( main.numMNswitches ):
2038 switches.append('s%d'%(i+1))
2039 switchesLinksComb = list(itertools.combinations(switches,2))
2040 main.randomLinks = random.sample(switchesLinksComb, 5 )
2041 print main.randomLinks
2042 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002043
Hari Krishnac195f3b2015-07-08 20:02:24 -07002044 for switch in main.randomLinks:
2045 main.Mininet1.link(
2046 END1=switch[0],
2047 END2=switch[1],
2048 OPTION="down")
2049 time.sleep( link_sleep )
2050
Hari Krishna6185fc12015-07-13 15:42:31 -07002051 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002052 linkDown = main.ONOSbench.checkStatus(
2053 topology_output, main.numMNswitches, str(
2054 int( main.numMNlinks ) - 5 * 2 ) )
2055 utilities.assert_equals(
2056 expect=main.TRUE,
2057 actual=linkDown,
2058 onpass="Link Down discovered properly",
2059 onfail="Link down was not discovered in " +
2060 str( link_sleep ) +
2061 " seconds" )
2062
GlennRCfcfdc4f2015-09-30 16:01:57 -07002063 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002064 # Giving onos multiple chances to install intents
2065 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002066 if i != 0:
2067 main.log.warn( "Verification failed. Retrying..." )
2068 main.log.info("Giving onos some time...")
2069 time.sleep( main.checkIntentsDelay )
2070
2071 intentState = main.TRUE
2072 for e in range(int(main.numCtrls)):
2073 main.log.info( "Checking intents on CLI %s" % (e+1) )
2074 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2075 intentState
2076 if not intentState:
2077 main.log.warn( "Not all intents installed" )
2078 if intentState:
2079 break
2080 else:
2081 #Dumping intent summary
2082 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2083
2084
2085 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2086 onpass="INTENTS INSTALLED",
2087 onfail="SOME INTENTS NOT INSTALLED" )
2088
Hari Krishnac195f3b2015-07-08 20:02:24 -07002089 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002090 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002091 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2093 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002094 main.log.warn("First pingall failed. Retrying...")
2095 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002096 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002097
Hari Krishnac195f3b2015-07-08 20:02:24 -07002098 time2 = time.time()
2099 timeDiff = round( ( time2 - time1 ), 2 )
2100 main.log.report(
2101 "Time taken for Ping All: " +
2102 str( timeDiff ) +
2103 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002104 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002105 onpass="PING ALL PASS",
2106 onfail="PING ALL FAIL" )
2107
GlennRCbddd58f2015-10-01 15:45:25 -07002108 caseResult = linkDown and pingResult and intentState
2109 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002110 onpass="Random Link cut Test PASS",
2111 onfail="Random Link cut Test FAIL" )
2112
GlennRCfcfdc4f2015-09-30 16:01:57 -07002113 # Printing what exactly failed
2114 if not linkDown:
2115 main.log.debug( "Link down was not discovered correctly" )
2116 if not pingResult:
2117 main.log.debug( "Pingall failed" )
2118 if not intentState:
2119 main.log.debug( "Intents are not all installed" )
2120
GlennRCbddd58f2015-10-01 15:45:25 -07002121 if not caseResult and main.failSwitch:
2122 main.log.report("Stopping test")
2123 main.stop( email=main.emailOnStop )
2124
Hari Krishnac195f3b2015-07-08 20:02:24 -07002125 def CASE83( self, main ):
2126 """
2127 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2128 """
2129 import random
2130 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002131
Hari Krishnac195f3b2015-07-08 20:02:24 -07002132 main.log.report(
2133 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2134 main.log.report(
2135 "__________________________________________________________________" )
2136 main.case(
2137 "Point intents - Bring the core links up that are down and verify ping all" )
2138 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002139
Hari Krishnac195f3b2015-07-08 20:02:24 -07002140 for switch in main.randomLinks:
2141 main.Mininet1.link(
2142 END1=switch[0],
2143 END2=switch[1],
2144 OPTION="up")
2145 time.sleep( link_sleep )
2146
Hari Krishna6185fc12015-07-13 15:42:31 -07002147 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002148 linkUp = main.ONOSbench.checkStatus(
2149 topology_output,
2150 main.numMNswitches,
2151 str( main.numMNlinks ) )
2152 utilities.assert_equals(
2153 expect=main.TRUE,
2154 actual=linkUp,
2155 onpass="Link up discovered properly",
2156 onfail="Link up was not discovered in " +
2157 str( link_sleep ) +
2158 " seconds" )
2159
GlennRCfcfdc4f2015-09-30 16:01:57 -07002160 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002161 # Giving onos multiple chances to install intents
2162 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002163 if i != 0:
2164 main.log.warn( "Verification failed. Retrying..." )
2165 main.log.info("Giving onos some time...")
2166 time.sleep( main.checkIntentsDelay )
2167
2168 intentState = main.TRUE
2169 for e in range(int(main.numCtrls)):
2170 main.log.info( "Checking intents on CLI %s" % (e+1) )
2171 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2172 intentState
2173 if not intentState:
2174 main.log.warn( "Not all intents installed" )
2175 if intentState:
2176 break
2177 else:
2178 #Dumping intent summary
2179 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2180
2181
2182 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2183 onpass="INTENTS INSTALLED",
2184 onfail="SOME INTENTS NOT INSTALLED" )
2185
Hari Krishnac195f3b2015-07-08 20:02:24 -07002186 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002187 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002188 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002189 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2190 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002191 main.log.warn("First pingall failed. Retrying...")
2192 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002193 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002194
Hari Krishnac195f3b2015-07-08 20:02:24 -07002195 time2 = time.time()
2196 timeDiff = round( ( time2 - time1 ), 2 )
2197 main.log.report(
2198 "Time taken for Ping All: " +
2199 str( timeDiff ) +
2200 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002201 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002202 onpass="PING ALL PASS",
2203 onfail="PING ALL FAIL" )
2204
GlennRCbddd58f2015-10-01 15:45:25 -07002205 caseResult = linkUp and pingResult
2206 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002207 onpass="Link Up Test PASS",
2208 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002209 # Printing what exactly failed
2210 if not linkUp:
2211 main.log.debug( "Link down was not discovered correctly" )
2212 if not pingResult:
2213 main.log.debug( "Pingall failed" )
2214 if not intentState:
2215 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002216
GlennRCbddd58f2015-10-01 15:45:25 -07002217 if not caseResult and main.failSwitch:
2218 main.log.report("Stopping test")
2219 main.stop( email=main.emailOnStop )
2220
Hari Krishnac195f3b2015-07-08 20:02:24 -07002221 def CASE74( self, main ):
2222 """
2223 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo)
2224 """
2225 import random
2226 main.randomLink1 = []
2227 main.randomLink2 = []
2228 main.randomLink3 = []
2229 main.randomLink4 = []
2230 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2231 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2232 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2233 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2234 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2235 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2236 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2237 main.pingTimeout = 400
Jon Hall4ba53f02015-07-29 13:07:41 -07002238
Hari Krishnac195f3b2015-07-08 20:02:24 -07002239 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2240 main.log.report( "___________________________________________________________________________" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002241 main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002242 linkIndex = range(4)
Hari Krishna6185fc12015-07-13 15:42:31 -07002243 linkIndexS9 = random.sample(linkIndex,1)[0]
Hari Krishnac195f3b2015-07-08 20:02:24 -07002244 linkIndex.remove(linkIndexS9)
2245 linkIndexS10 = random.sample(linkIndex,1)[0]
2246 main.randomLink1 = link1End2top[linkIndexS9]
2247 main.randomLink2 = link2End2top[linkIndexS10]
2248 main.randomLink3 = random.sample(link1End2bot,1)[0]
2249 main.randomLink4 = random.sample(link2End2bot,1)[0]
Hari Krishna6185fc12015-07-13 15:42:31 -07002250
2251 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002252 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2253 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2254 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2255 time.sleep( link_sleep )
2256 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2257 time.sleep( link_sleep )
2258
Hari Krishna6185fc12015-07-13 15:42:31 -07002259 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002260 linkDown = main.ONOSbench.checkStatus(
2261 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002262 int( main.numMNlinks ) - 4 ))
Hari Krishnac195f3b2015-07-08 20:02:24 -07002263 utilities.assert_equals(
2264 expect=main.TRUE,
2265 actual=linkDown,
2266 onpass="Link Down discovered properly",
2267 onfail="Link down was not discovered in " +
2268 str( link_sleep ) +
2269 " seconds" )
2270
GlennRCfcfdc4f2015-09-30 16:01:57 -07002271 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002272 # Giving onos multiple chances to install intents
2273 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002274 if i != 0:
2275 main.log.warn( "Verification failed. Retrying..." )
2276 main.log.info("Giving onos some time...")
2277 time.sleep( main.checkIntentsDelay )
2278
2279 intentState = main.TRUE
2280 for e in range(int(main.numCtrls)):
2281 main.log.info( "Checking intents on CLI %s" % (e+1) )
2282 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2283 intentState
2284 if not intentState:
2285 main.log.warn( "Not all intents installed" )
2286 if intentState:
2287 break
2288 else:
2289 #Dumping intent summary
2290 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2291
2292
2293 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2294 onpass="INTENTS INSTALLED",
2295 onfail="SOME INTENTS NOT INSTALLED" )
2296
Hari Krishnac195f3b2015-07-08 20:02:24 -07002297 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002298 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002299 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002300 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2301 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002302 main.log.warn("First pingall failed. Retrying...")
2303 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002304 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002305
Hari Krishnac195f3b2015-07-08 20:02:24 -07002306 time2 = time.time()
2307 timeDiff = round( ( time2 - time1 ), 2 )
2308 main.log.report(
2309 "Time taken for Ping All: " +
2310 str( timeDiff ) +
2311 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002312 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002313 onpass="PING ALL PASS",
2314 onfail="PING ALL FAIL" )
2315
GlennRCbddd58f2015-10-01 15:45:25 -07002316 caseResult = linkDown and pingResult and intentState
2317 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002318 onpass="Random Link cut Test PASS",
2319 onfail="Random Link cut Test FAIL" )
2320
GlennRCfcfdc4f2015-09-30 16:01:57 -07002321 # Printing what exactly failed
2322 if not linkDown:
2323 main.log.debug( "Link down was not discovered correctly" )
2324 if not pingResult:
2325 main.log.debug( "Pingall failed" )
2326 if not intentState:
2327 main.log.debug( "Intents are not all installed" )
2328
GlennRCbddd58f2015-10-01 15:45:25 -07002329 if not caseResult and main.failSwitch:
2330 main.log.report("Stopping test")
2331 main.stop( email=main.emailOnStop )
2332
Hari Krishnac195f3b2015-07-08 20:02:24 -07002333 def CASE84( self, main ):
2334 """
2335 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2336 """
2337 import random
2338 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2339 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2340 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2341 main.log.report(
2342 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2343 main.log.report(
2344 "__________________________________________________________________" )
2345 main.case(
2346 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002347
2348 # Work around for link state propagation delay. Added some sleep time.
2349 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2350 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002351 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2352 time.sleep( link_sleep )
2353 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2354 time.sleep( link_sleep )
2355
Hari Krishna6185fc12015-07-13 15:42:31 -07002356 topology_output = main.ONOScli1.topology()
Hari Krishnac195f3b2015-07-08 20:02:24 -07002357 linkUp = main.ONOSbench.checkStatus(
2358 topology_output,
2359 main.numMNswitches,
2360 str( main.numMNlinks ) )
2361 utilities.assert_equals(
2362 expect=main.TRUE,
2363 actual=linkUp,
2364 onpass="Link up discovered properly",
2365 onfail="Link up was not discovered in " +
2366 str( link_sleep ) +
2367 " seconds" )
2368
GlennRCfcfdc4f2015-09-30 16:01:57 -07002369 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002370 # Giving onos multiple chances to install intents
2371 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002372 if i != 0:
2373 main.log.warn( "Verification failed. Retrying..." )
2374 main.log.info("Giving onos some time...")
2375 time.sleep( main.checkIntentsDelay )
2376
2377 intentState = main.TRUE
2378 for e in range(int(main.numCtrls)):
2379 main.log.info( "Checking intents on CLI %s" % (e+1) )
2380 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2381 intentState
2382 if not intentState:
2383 main.log.warn( "Not all intents installed" )
2384 if intentState:
2385 break
2386 else:
2387 #Dumping intent summary
2388 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2389
2390
2391 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2392 onpass="INTENTS INSTALLED",
2393 onfail="SOME INTENTS NOT INSTALLED" )
2394
Hari Krishnac195f3b2015-07-08 20:02:24 -07002395 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002396 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07002397 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002398 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2399 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002400 main.log.warn("First pingall failed. Retrying...")
2401 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002402 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002403
Hari Krishnac195f3b2015-07-08 20:02:24 -07002404 time2 = time.time()
2405 timeDiff = round( ( time2 - time1 ), 2 )
2406 main.log.report(
2407 "Time taken for Ping All: " +
2408 str( timeDiff ) +
2409 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002410 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002411 onpass="PING ALL PASS",
2412 onfail="PING ALL FAIL" )
2413
GlennRCbddd58f2015-10-01 15:45:25 -07002414 caseResult = linkUp and pingResult
2415 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002416 onpass="Link Up Test PASS",
2417 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002418 # Printing what exactly failed
2419 if not linkUp:
2420 main.log.debug( "Link down was not discovered correctly" )
2421 if not pingResult:
2422 main.log.debug( "Pingall failed" )
2423 if not intentState:
2424 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002425
GlennRCbddd58f2015-10-01 15:45:25 -07002426 if not caseResult and main.failSwitch:
2427 main.log.report("Stopping test")
2428 main.stop( email=main.emailOnStop )
2429
Hari Krishnab79d0822015-08-20 09:48:43 -07002430 def CASE75( self, main ):
2431 """
2432 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo)
2433 """
2434 import random
2435 main.randomLink1 = []
2436 main.randomLink2 = []
2437 main.randomLink3 = []
2438 main.randomLink4 = []
2439 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2440 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2441 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2442 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2443 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2444 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
2445 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2446 main.pingTimeout = 400
2447
2448 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2449 main.log.report( "___________________________________________________________________________" )
2450 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2451 linkIndex = range(4)
2452 linkIndexS9 = random.sample(linkIndex,1)[0]
2453 linkIndex.remove(linkIndexS9)
2454 linkIndexS10 = random.sample(linkIndex,1)[0]
2455 main.randomLink1 = link1End2top[linkIndexS9]
2456 main.randomLink2 = link2End2top[linkIndexS10]
2457 main.randomLink3 = random.sample(link1End2bot,1)[0]
2458 main.randomLink4 = random.sample(link2End2bot,1)[0]
2459
2460 # Work around for link state propagation delay. Added some sleep time.
2461 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2462 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2463 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
2464 time.sleep( link_sleep )
2465 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
2466 time.sleep( link_sleep )
2467
2468 topology_output = main.ONOScli1.topology()
2469 linkDown = main.ONOSbench.checkStatus(
2470 topology_output, main.numMNswitches, str(
Hari Krishna390d4702015-08-21 14:37:46 -07002471 int( main.numMNlinks ) - 4 ))
Hari Krishnab79d0822015-08-20 09:48:43 -07002472 utilities.assert_equals(
2473 expect=main.TRUE,
2474 actual=linkDown,
2475 onpass="Link Down discovered properly",
2476 onfail="Link down was not discovered in " +
2477 str( link_sleep ) +
2478 " seconds" )
2479
GlennRCfcfdc4f2015-09-30 16:01:57 -07002480 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002481 # Giving onos multiple chances to install intents
2482 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002483 if i != 0:
2484 main.log.warn( "Verification failed. Retrying..." )
2485 main.log.info("Giving onos some time...")
2486 time.sleep( main.checkIntentsDelay )
2487
2488 intentState = main.TRUE
2489 for e in range(int(main.numCtrls)):
2490 main.log.info( "Checking intents on CLI %s" % (e+1) )
2491 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2492 intentState
2493 if not intentState:
2494 main.log.warn( "Not all intents installed" )
2495 if intentState:
2496 break
2497 else:
2498 #Dumping intent summary
2499 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2500
2501
2502 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2503 onpass="INTENTS INSTALLED",
2504 onfail="SOME INTENTS NOT INSTALLED" )
2505
Hari Krishnab79d0822015-08-20 09:48:43 -07002506 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002507 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002508 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002509 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
2510 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002511 main.log.warn("First pingall failed. Retrying...")
2512 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002513 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002514
Hari Krishnab79d0822015-08-20 09:48:43 -07002515 time2 = time.time()
2516 timeDiff = round( ( time2 - time1 ), 2 )
2517 main.log.report(
2518 "Time taken for Ping All: " +
2519 str( timeDiff ) +
2520 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002521 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002522 onpass="PING ALL PASS",
2523 onfail="PING ALL FAIL" )
2524
GlennRCbddd58f2015-10-01 15:45:25 -07002525 caseResult = linkDown and pingResult and intentState
2526 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002527 onpass="Random Link cut Test PASS",
2528 onfail="Random Link cut Test FAIL" )
2529
GlennRCfcfdc4f2015-09-30 16:01:57 -07002530 # Printing what exactly failed
2531 if not linkDown:
2532 main.log.debug( "Link down was not discovered correctly" )
2533 if not pingResult:
2534 main.log.debug( "Pingall failed" )
2535 if not intentState:
2536 main.log.debug( "Intents are not all installed" )
2537
GlennRCbddd58f2015-10-01 15:45:25 -07002538 if not caseResult and main.failSwitch:
2539 main.log.report("Stopping test")
2540 main.stop( email=main.emailOnStop )
2541
Hari Krishnab79d0822015-08-20 09:48:43 -07002542 def CASE85( self, main ):
2543 """
2544 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2545 """
2546 import random
2547 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2548 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2549 link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
2550 main.log.report(
2551 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2552 main.log.report(
2553 "__________________________________________________________________" )
2554 main.case(
2555 "Point intents - Bring the core links up that are down and verify ping all" )
2556
2557 # Work around for link state propagation delay. Added some sleep time.
2558 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2559 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2560 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
2561 time.sleep( link_sleep )
2562 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
2563 time.sleep( link_sleep )
2564
2565 topology_output = main.ONOScli1.topology()
2566 linkUp = main.ONOSbench.checkStatus(
2567 topology_output,
2568 main.numMNswitches,
2569 str( main.numMNlinks ) )
2570 utilities.assert_equals(
2571 expect=main.TRUE,
2572 actual=linkUp,
2573 onpass="Link up discovered properly",
2574 onfail="Link up was not discovered in " +
2575 str( link_sleep ) +
2576 " seconds" )
2577
GlennRCfcfdc4f2015-09-30 16:01:57 -07002578 main.step("Verify intents are installed")
GlennRC1dde1712015-10-02 11:03:08 -07002579 # Giving onos multiple chances to install intents
2580 for i in range( main.intentCheck ):
GlennRCfcfdc4f2015-09-30 16:01:57 -07002581 if i != 0:
2582 main.log.warn( "Verification failed. Retrying..." )
2583 main.log.info("Giving onos some time...")
2584 time.sleep( main.checkIntentsDelay )
2585
2586 intentState = main.TRUE
2587 for e in range(int(main.numCtrls)):
2588 main.log.info( "Checking intents on CLI %s" % (e+1) )
2589 intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
2590 intentState
2591 if not intentState:
2592 main.log.warn( "Not all intents installed" )
2593 if intentState:
2594 break
2595 else:
2596 #Dumping intent summary
2597 main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
2598
2599
2600 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2601 onpass="INTENTS INSTALLED",
2602 onfail="SOME INTENTS NOT INSTALLED" )
2603
Hari Krishnab79d0822015-08-20 09:48:43 -07002604 main.step( "Verify Ping across all hosts" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002605 pingResult = main.FALSE
Hari Krishnab79d0822015-08-20 09:48:43 -07002606 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002607 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
2608 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002609 main.log.warn("First pingall failed. Retrying...")
2610 time1 = time.time()
GlennRCfcfdc4f2015-09-30 16:01:57 -07002611 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07002612
Hari Krishnab79d0822015-08-20 09:48:43 -07002613 time2 = time.time()
2614 timeDiff = round( ( time2 - time1 ), 2 )
2615 main.log.report(
2616 "Time taken for Ping All: " +
2617 str( timeDiff ) +
2618 " seconds" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002619 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002620 onpass="PING ALL PASS",
2621 onfail="PING ALL FAIL" )
2622
GlennRCbddd58f2015-10-01 15:45:25 -07002623 caseResult = linkUp and pingResult
2624 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002625 onpass="Link Up Test PASS",
2626 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002627 # Printing what exactly failed
2628 if not linkUp:
2629 main.log.debug( "Link down was not discovered correctly" )
2630 if not pingResult:
2631 main.log.debug( "Pingall failed" )
2632 if not intentState:
2633 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002634
GlennRCbddd58f2015-10-01 15:45:25 -07002635 if not caseResult and main.failSwitch:
2636 main.log.report("Stopping test")
2637 main.stop( email=main.emailOnStop )
2638
Hari Krishna4223dbd2015-08-13 16:29:53 -07002639 def CASE170( self ):
2640 """
2641 IPv6 ping all with some core links down( Host Intents-Att Topo)
2642 """
2643 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2644 main.log.report( "_________________________________________________" )
2645 import itertools
2646 import time
2647 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2648 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002649 pingResult = main.FALSE
2650 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002651 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002652 if not pingResult:
2653 main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
GlennRC4ae5a242015-10-02 11:37:56 -07002654 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002655 time2 = time.time()
2656 timeDiff = round( ( time2 - time1 ), 2 )
2657 main.log.report(
2658 "Time taken for IPv6 Ping All: " +
2659 str( timeDiff ) +
2660 " seconds" )
2661 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2662 onpass="PING ALL PASS",
2663 onfail="PING ALL FAIL" )
2664
GlennRCbddd58f2015-10-01 15:45:25 -07002665 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002666 utilities.assert_equals(
2667 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002668 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002669 onpass="IPv6 Ping across 300 host intents test PASS",
2670 onfail="IPv6 Ping across 300 host intents test FAIL" )
2671
2672 def CASE180( self ):
2673 """
2674 IPv6 ping all with after core links back up( Host Intents-Att Topo)
2675 """
2676 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2677 main.log.report( "_________________________________________________" )
2678 import itertools
2679 import time
2680 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2681 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002682 pingResult = main.FALSE
2683 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002684 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002685 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002686 main.log.warn("First ping failed. Retrying...")
2687 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002688 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002689 time2 = time.time()
2690 timeDiff = round( ( time2 - time1 ), 2 )
2691 main.log.report(
2692 "Time taken for IPv6 Ping All: " +
2693 str( timeDiff ) +
2694 " seconds" )
2695 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2696 onpass="PING ALL PASS",
2697 onfail="PING ALL FAIL" )
2698
GlennRCbddd58f2015-10-01 15:45:25 -07002699 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002700 utilities.assert_equals(
2701 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002702 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002703 onpass="IPv6 Ping across 300 host intents test PASS",
2704 onfail="IPv6 Ping across 300 host intents test FAIL" )
2705
2706 def CASE171( self ):
2707 """
2708 IPv6 ping all with some core links down( Point Intents-Att Topo)
2709 """
2710 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2711 main.log.report( "_________________________________________________" )
2712 import itertools
2713 import time
2714 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2715 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002716 pingResult = main.FALSE
2717 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002718 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002719 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002720 main.log.warn("First ping failed. Retrying...")
2721 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002722 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002723 time2 = time.time()
2724 timeDiff = round( ( time2 - time1 ), 2 )
2725 main.log.report(
2726 "Time taken for IPv6 Ping All: " +
2727 str( timeDiff ) +
2728 " seconds" )
2729 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2730 onpass="PING ALL PASS",
2731 onfail="PING ALL FAIL" )
2732
GlennRCbddd58f2015-10-01 15:45:25 -07002733 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002734 utilities.assert_equals(
2735 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002736 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002737 onpass="IPv6 Ping across 600 point intents test PASS",
2738 onfail="IPv6 Ping across 600 point intents test FAIL" )
2739
2740 def CASE181( self ):
2741 """
2742 IPv6 ping all with after core links back up( Point Intents-Att Topo)
2743 """
2744 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2745 main.log.report( "_________________________________________________" )
2746 import itertools
2747 import time
2748 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2749 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002750 pingResult = main.FALSE
2751 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002752 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002753 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002754 main.log.warn("First ping failed. Retrying...")
2755 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002756 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002757 time2 = time.time()
2758 timeDiff = round( ( time2 - time1 ), 2 )
2759 main.log.report(
2760 "Time taken for IPv6 Ping All: " +
2761 str( timeDiff ) +
2762 " seconds" )
2763 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2764 onpass="PING ALL PASS",
2765 onfail="PING ALL FAIL" )
2766
GlennRCbddd58f2015-10-01 15:45:25 -07002767 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002768 utilities.assert_equals(
2769 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002770 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002771 onpass="IPv6 Ping across 600 Point intents test PASS",
2772 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2773
2774 def CASE172( self ):
2775 """
2776 IPv6 ping all with some core links down( Host Intents-Chordal Topo)
2777 """
2778 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2779 main.log.report( "_________________________________________________" )
2780 import itertools
2781 import time
2782 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2783 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002784 pingResult = main.FALSE
2785 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002786 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002787 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002788 main.log.warn("First ping failed. Retrying...")
2789 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002790 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002791 time2 = time.time()
2792 timeDiff = round( ( time2 - time1 ), 2 )
2793 main.log.report(
2794 "Time taken for IPv6 Ping All: " +
2795 str( timeDiff ) +
2796 " seconds" )
2797 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2798 onpass="PING ALL PASS",
2799 onfail="PING ALL FAIL" )
2800
GlennRCbddd58f2015-10-01 15:45:25 -07002801 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002802 utilities.assert_equals(
2803 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002804 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002805 onpass="IPv6 Ping across 300 host intents test PASS",
2806 onfail="IPv6 Ping across 300 host intents test FAIL" )
2807
2808 def CASE182( self ):
2809 """
2810 IPv6 ping all with after core links back up( Host Intents-Chordal Topo)
2811 """
2812 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2813 main.log.report( "_________________________________________________" )
2814 import itertools
2815 import time
2816 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2817 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002818 pingResult = main.FALSE
2819 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002820 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002821 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002822 main.log.warn("First ping failed. Retrying...")
2823 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002824 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002825 time2 = time.time()
2826 timeDiff = round( ( time2 - time1 ), 2 )
2827 main.log.report(
2828 "Time taken for IPv6 Ping All: " +
2829 str( timeDiff ) +
2830 " seconds" )
2831 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2832 onpass="PING ALL PASS",
2833 onfail="PING ALL FAIL" )
2834
GlennRCbddd58f2015-10-01 15:45:25 -07002835 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002836 utilities.assert_equals(
2837 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002838 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002839 onpass="IPv6 Ping across 300 host intents test PASS",
2840 onfail="IPv6 Ping across 300 host intents test FAIL" )
2841
2842 def CASE173( self ):
2843 """
2844 IPv6 ping all with some core links down( Point Intents-Chordal Topo)
2845 """
2846 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2847 main.log.report( "_________________________________________________" )
2848 import itertools
2849 import time
2850 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2851 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002852 pingResult = main.FALSE
2853 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002854 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002855 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002856 main.log.warn("First ping failed. Retrying...")
2857 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002858 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002859 time2 = time.time()
2860 timeDiff = round( ( time2 - time1 ), 2 )
2861 main.log.report(
2862 "Time taken for IPv6 Ping All: " +
2863 str( timeDiff ) +
2864 " seconds" )
2865 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2866 onpass="PING ALL PASS",
2867 onfail="PING ALL FAIL" )
2868
GlennRCbddd58f2015-10-01 15:45:25 -07002869 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002870 utilities.assert_equals(
2871 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002872 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002873 onpass="IPv6 Ping across 600 point intents test PASS",
2874 onfail="IPv6 Ping across 600 point intents test FAIL" )
2875
2876 def CASE183( self ):
2877 """
2878 IPv6 ping all with after core links back up( Point Intents-Chordal Topo)
2879 """
2880 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2881 main.log.report( "_________________________________________________" )
2882 import itertools
2883 import time
2884 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2885 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002886 pingResult = main.FALSE
2887 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002888 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002889 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002890 main.log.warn("First ping failed. Retrying...")
2891 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002892 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002893 time2 = time.time()
2894 timeDiff = round( ( time2 - time1 ), 2 )
2895 main.log.report(
2896 "Time taken for IPv6 Ping All: " +
2897 str( timeDiff ) +
2898 " seconds" )
2899 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2900 onpass="PING ALL PASS",
2901 onfail="PING ALL FAIL" )
2902
GlennRCbddd58f2015-10-01 15:45:25 -07002903 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002904 utilities.assert_equals(
2905 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002906 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002907 onpass="IPv6 Ping across 600 Point intents test PASS",
2908 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2909
2910 def CASE174( self ):
2911 """
2912 IPv6 ping all with some core links down( Host Intents-Spine Topo)
2913 """
2914 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2915 main.log.report( "_________________________________________________" )
2916 import itertools
2917 import time
2918 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2919 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002920 pingResult = main.FALSE
2921 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002922 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002923 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002924 main.log.warn("First ping failed. Retrying...")
2925 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002926 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002927 time2 = time.time()
2928 timeDiff = round( ( time2 - time1 ), 2 )
2929 main.log.report(
2930 "Time taken for IPv6 Ping All: " +
2931 str( timeDiff ) +
2932 " seconds" )
2933 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2934 onpass="PING ALL PASS",
2935 onfail="PING ALL FAIL" )
2936
GlennRCbddd58f2015-10-01 15:45:25 -07002937 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002938 utilities.assert_equals(
2939 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002940 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002941 onpass="IPv6 Ping across 2278 host intents test PASS",
2942 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2943
2944 def CASE184( self ):
2945 """
2946 IPv6 ping all with after core links back up( Host Intents-Spine Topo)
2947 """
2948 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2949 main.log.report( "_________________________________________________" )
2950 import itertools
2951 import time
2952 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2953 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002954 pingResult = main.FALSE
2955 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002956 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002957 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002958 main.log.warn("First ping failed. Retrying...")
2959 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002960 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002961 time2 = time.time()
2962 timeDiff = round( ( time2 - time1 ), 2 )
2963 main.log.report(
2964 "Time taken for IPv6 Ping All: " +
2965 str( timeDiff ) +
2966 " seconds" )
2967 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
2968 onpass="PING ALL PASS",
2969 onfail="PING ALL FAIL" )
2970
GlennRCbddd58f2015-10-01 15:45:25 -07002971 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002972 utilities.assert_equals(
2973 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002974 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002975 onpass="IPv6 Ping across 2278 host intents test PASS",
2976 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2977
2978 def CASE175( self ):
2979 """
2980 IPv6 ping all with some core links down( Point Intents-Spine Topo)
2981 """
2982 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2983 main.log.report( "_________________________________________________" )
2984 import itertools
2985 import time
2986 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2987 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002988 pingResult = main.FALSE
2989 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002990 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07002991 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07002992 main.log.warn("First ping failed. Retrying...")
2993 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07002994 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002995 time2 = time.time()
2996 timeDiff = round( ( time2 - time1 ), 2 )
2997 main.log.report(
2998 "Time taken for IPv6 Ping All: " +
2999 str( timeDiff ) +
3000 " seconds" )
3001 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3002 onpass="PING ALL PASS",
3003 onfail="PING ALL FAIL" )
3004
GlennRCbddd58f2015-10-01 15:45:25 -07003005 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003006 utilities.assert_equals(
3007 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003008 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003009 onpass="IPv6 Ping across 4556 point intents test PASS",
3010 onfail="IPv6 Ping across 4556 point intents test FAIL" )
3011
3012 def CASE185( self ):
3013 """
3014 IPv6 ping all with after core links back up( Point Intents-Spine Topo)
3015 """
3016 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3017 main.log.report( "_________________________________________________" )
3018 import itertools
3019 import time
3020 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
3021 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003022 pingResult = main.FALSE
3023 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003024 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07003025 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07003026 main.log.warn("First ping failed. Retrying...")
3027 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07003028 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003029 time2 = time.time()
3030 timeDiff = round( ( time2 - time1 ), 2 )
3031 main.log.report(
3032 "Time taken for IPv6 Ping All: " +
3033 str( timeDiff ) +
3034 " seconds" )
3035 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3036 onpass="PING ALL PASS",
3037 onfail="PING ALL FAIL" )
3038
GlennRCbddd58f2015-10-01 15:45:25 -07003039 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003040 utilities.assert_equals(
3041 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003042 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003043 onpass="IPv6 Ping across 4556 Point intents test PASS",
3044 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
3045
Hari Krishnac195f3b2015-07-08 20:02:24 -07003046 def CASE90( self ):
3047 """
3048 Install 600 point intents and verify ping all (Att Topology)
3049 """
3050 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
3051 main.log.report( "_______________________________________" )
3052 import itertools
3053 import time
3054 main.case( "Install 600 point intents" )
3055 main.step( "Add point Intents" )
3056 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003057 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3058
Hari Krishnac195f3b2015-07-08 20:02:24 -07003059 intentIdList = []
3060 time1 = time.time()
3061 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3062 pool = []
3063 for cli in main.CLIs:
3064 if i >= len( deviceCombos ):
3065 break
3066 t = main.Thread( target=cli.addPointIntent,
3067 threadID=main.threadID,
3068 name="addPointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003069 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 -07003070 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003071 t.start()
3072 i = i + 1
3073 main.threadID = main.threadID + 1
3074 for thread in pool:
3075 thread.join()
3076 intentIdList.append(thread.result)
3077 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003078 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003079
GlennRCfcfdc4f2015-09-30 16:01:57 -07003080 # Saving intent ids to check intents in later case
3081 main.intentIds = list(intentIdList)
3082
GlennRCa8d786a2015-09-23 17:40:11 -07003083 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003084
GlennRC1dde1712015-10-02 11:03:08 -07003085 # Giving onos multiple chances to install intents
3086 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003087 if i != 0:
3088 main.log.warn( "Verification failed. Retrying..." )
3089 main.log.info("Waiting for onos to install intents...")
3090 time.sleep( main.checkIntentsDelay )
3091
GlennRCa8d786a2015-09-23 17:40:11 -07003092 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003093 for e in range(int(main.numCtrls)):
3094 main.log.info( "Checking intents on CLI %s" % (e+1) )
3095 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3096 intentState
3097 if not intentState:
3098 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003099 if intentState:
3100 break
GlennRCdb2c8422015-09-29 12:21:59 -07003101 else:
3102 #Dumping intent summary
3103 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003104
3105 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3106 onpass="INTENTS INSTALLED",
3107 onfail="SOME INTENTS NOT INSTALLED" )
3108
Hari Krishnac195f3b2015-07-08 20:02:24 -07003109 main.step( "Verify Ping across all hosts" )
3110 pingResult = main.FALSE
3111 time1 = time.time()
3112 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3113 time2 = time.time()
3114 timeDiff = round( ( time2 - time1 ), 2 )
3115 main.log.report(
3116 "Time taken for Ping All: " +
3117 str( timeDiff ) +
3118 " seconds" )
3119 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3120 onpass="PING tALL PASS",
3121 onfail="PING ALL FAIL" )
3122
GlennRCbddd58f2015-10-01 15:45:25 -07003123 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003124
Hari Krishnac195f3b2015-07-08 20:02:24 -07003125 utilities.assert_equals(
3126 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003127 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003128 onpass="Install 600 point Intents and Ping All test PASS",
3129 onfail="Install 600 point Intents and Ping All test FAIL" )
3130
GlennRCbddd58f2015-10-01 15:45:25 -07003131 if not intentState:
3132 main.log.debug( "Intents failed to install completely" )
3133 if not pingResult:
3134 main.log.debug( "Pingall failed" )
3135
3136 if not caseResult and main.failSwitch:
3137 main.log.report("Stopping test")
3138 main.stop( email=main.emailOnStop )
3139
Hari Krishnac195f3b2015-07-08 20:02:24 -07003140 def CASE91( self ):
3141 """
3142 Install 600 point intents and verify ping all (Chordal Topology)
3143 """
3144 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
3145 main.log.report( "_______________________________________" )
3146 import itertools
3147 import time
3148 main.case( "Install 600 point intents" )
3149 main.step( "Add point Intents" )
3150 intentResult = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -07003151 deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) )
3152
Hari Krishnac195f3b2015-07-08 20:02:24 -07003153 intentIdList = []
3154 time1 = time.time()
3155 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3156 pool = []
3157 for cli in main.CLIs:
3158 if i >= len( deviceCombos ):
3159 break
3160 t = main.Thread( target=cli.addPointIntent,
3161 threadID=main.threadID,
3162 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003163 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 -07003164 pool.append(t)
3165 #time.sleep(1)
3166 t.start()
3167 i = i + 1
3168 main.threadID = main.threadID + 1
3169 for thread in pool:
3170 thread.join()
3171 intentIdList.append(thread.result)
3172 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003173 main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
GlennRCa8d786a2015-09-23 17:40:11 -07003174
GlennRCfcfdc4f2015-09-30 16:01:57 -07003175 # Saving intent ids to check intents in later case
3176 main.intentIds = list(intentIdList)
3177
GlennRCa8d786a2015-09-23 17:40:11 -07003178 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003179
GlennRC1dde1712015-10-02 11:03:08 -07003180 # Giving onos multiple chances to install intents
3181 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003182 if i != 0:
3183 main.log.warn( "Verification failed. Retrying..." )
3184 main.log.info("Waiting for onos to install intents...")
3185 time.sleep( main.checkIntentsDelay )
3186
GlennRCa8d786a2015-09-23 17:40:11 -07003187 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003188 for e in range(int(main.numCtrls)):
3189 main.log.info( "Checking intents on CLI %s" % (e+1) )
3190 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3191 intentState
3192 if not intentState:
3193 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003194 if intentState:
3195 break
GlennRCdb2c8422015-09-29 12:21:59 -07003196 else:
3197 #Dumping intent summary
3198 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003199
3200 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3201 onpass="INTENTS INSTALLED",
3202 onfail="SOME INTENTS NOT INSTALLED" )
3203
Hari Krishnac195f3b2015-07-08 20:02:24 -07003204 main.step( "Verify Ping across all hosts" )
3205 pingResult = main.FALSE
3206 time1 = time.time()
3207 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3208 time2 = time.time()
3209 timeDiff = round( ( time2 - time1 ), 2 )
3210 main.log.report(
3211 "Time taken for Ping All: " +
3212 str( timeDiff ) +
3213 " seconds" )
3214 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3215 onpass="PING ALL PASS",
3216 onfail="PING ALL FAIL" )
3217
GlennRCbddd58f2015-10-01 15:45:25 -07003218 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003219
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 utilities.assert_equals(
3221 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003222 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003223 onpass="Install 600 point Intents and Ping All test PASS",
3224 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003225
GlennRCbddd58f2015-10-01 15:45:25 -07003226 if not intentState:
3227 main.log.debug( "Intents failed to install completely" )
3228 if not pingResult:
3229 main.log.debug( "Pingall failed" )
3230
3231 if not caseResult and main.failSwitch:
3232 main.log.report("Stopping test")
3233 main.stop( email=main.emailOnStop )
3234
Hari Krishnac195f3b2015-07-08 20:02:24 -07003235 def CASE92( self ):
3236 """
3237 Install 4556 point intents and verify ping all (Spine Topology)
3238 """
3239 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
3240 main.log.report( "_______________________________________" )
3241 import itertools
3242 import time
3243 main.case( "Install 4556 point intents" )
3244 main.step( "Add point Intents" )
3245 intentResult = main.TRUE
3246 main.pingTimeout = 600
3247 for i in range(len(main.hostMACs)):
3248 main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0]
3249 print main.MACsDict
3250 deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) )
3251 intentIdList = []
3252 time1 = time.time()
3253 for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ):
3254 pool = []
3255 for cli in main.CLIs:
3256 if i >= len( deviceCombos ):
3257 break
3258 t = main.Thread( target=cli.addPointIntent,
3259 threadID=main.threadID,
3260 name="addPointIntent",
Hari Krishna55b171b2015-09-02 09:46:03 -07003261 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 -07003262 pool.append(t)
3263 #time.sleep(1)
3264 t.start()
3265 i = i + 1
3266 main.threadID = main.threadID + 1
3267 for thread in pool:
3268 thread.join()
3269 intentIdList.append(thread.result)
3270 time2 = time.time()
Hari Krishna6185fc12015-07-13 15:42:31 -07003271 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCa8d786a2015-09-23 17:40:11 -07003272
GlennRCfcfdc4f2015-09-30 16:01:57 -07003273 # Saving intent ids to check intents in later case
3274 main.intentIds = list(intentIdList)
3275
GlennRCa8d786a2015-09-23 17:40:11 -07003276 main.step("Verify intents are installed")
GlennRCdb2c8422015-09-29 12:21:59 -07003277
GlennRC1dde1712015-10-02 11:03:08 -07003278 # Giving onos multiple chances to install intents
3279 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003280 if i != 0:
3281 main.log.warn( "Verification failed. Retrying..." )
3282 main.log.info("Waiting for onos to install intents...")
3283 time.sleep( main.checkIntentsDelay )
3284
GlennRCa8d786a2015-09-23 17:40:11 -07003285 intentState = main.TRUE
GlennRCdb2c8422015-09-29 12:21:59 -07003286 for e in range(int(main.numCtrls)):
3287 main.log.info( "Checking intents on CLI %s" % (e+1) )
3288 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3289 intentState
3290 if not intentState:
3291 main.log.warn( "Not all intents installed" )
GlennRCa8d786a2015-09-23 17:40:11 -07003292 if intentState:
3293 break
GlennRCdb2c8422015-09-29 12:21:59 -07003294 else:
3295 #Dumping intent summary
3296 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCa8d786a2015-09-23 17:40:11 -07003297
3298 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3299 onpass="INTENTS INSTALLED",
3300 onfail="SOME INTENTS NOT INSTALLED" )
3301
Hari Krishnac195f3b2015-07-08 20:02:24 -07003302 main.step( "Verify Ping across all hosts" )
3303 pingResult = main.FALSE
3304 time1 = time.time()
3305 pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
3306 time2 = time.time()
3307 timeDiff = round( ( time2 - time1 ), 2 )
3308 main.log.report(
3309 "Time taken for Ping All: " +
3310 str( timeDiff ) +
3311 " seconds" )
3312 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
3313 onpass="PING ALL PASS",
3314 onfail="PING ALL FAIL" )
3315
GlennRCbddd58f2015-10-01 15:45:25 -07003316 caseResult = ( intentState and pingResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07003317
Hari Krishnac195f3b2015-07-08 20:02:24 -07003318 utilities.assert_equals(
3319 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003320 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003321 onpass="Install 4556 point Intents and Ping All test PASS",
3322 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003323
GlennRCbddd58f2015-10-01 15:45:25 -07003324 if not intentState:
3325 main.log.debug( "Intents failed to install completely" )
3326 if not pingResult:
3327 main.log.debug( "Pingall failed" )
3328
3329 if not caseResult and main.failSwitch:
3330 main.log.report("Stopping test")
3331 main.stop( email=main.emailOnStop )
3332
Hari Krishnac195f3b2015-07-08 20:02:24 -07003333 def CASE93( self ):
3334 """
3335 Install multi-single point intents and verify Ping all works
3336 for att topology
3337 """
3338 import copy
3339 import time
GlennRCdb2c8422015-09-29 12:21:59 -07003340 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07003341 main.log.report( "Install multi-single point intents and verify Ping all" )
3342 main.log.report( "___________________________________________" )
3343 main.case( "Install multi-single point intents and Ping all" )
3344 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3345 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3346 intentIdList = []
GlennRCdb2c8422015-09-29 12:21:59 -07003347 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003348 time1 = time.time()
3349 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3350 pool = []
3351 for cli in main.CLIs:
3352 egressDevice = deviceDPIDsCopy[i]
3353 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3354 ingressDeviceList.remove(egressDevice)
3355 if i >= len( deviceDPIDsCopy ):
3356 break
3357 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3358 threadID=main.threadID,
3359 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003360 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003361 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003362 t.start()
3363 i = i + 1
3364 main.threadID = main.threadID + 1
3365 for thread in pool:
3366 thread.join()
3367 intentIdList.append(thread.result)
3368 time2 = time.time()
3369 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07003370
GlennRCdb2c8422015-09-29 12:21:59 -07003371 main.step("Verify intents are installed")
Hari Krishnac195f3b2015-07-08 20:02:24 -07003372
GlennRC1dde1712015-10-02 11:03:08 -07003373 # Giving onos multiple chances to install intents
3374 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003375 if i != 0:
3376 main.log.warn( "Verification failed. Retrying..." )
3377 main.log.info("Waiting for onos to install intents...")
3378 time.sleep( main.checkIntentsDelay )
3379
3380 intentState = main.TRUE
3381 for e in range(int(main.numCtrls)):
3382 main.log.info( "Checking intents on CLI %s" % (e+1) )
3383 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3384 intentState
3385 if not intentState:
3386 main.log.warn( "Not all intents installed" )
3387 if intentState:
3388 break
3389 else:
3390 #Dumping intent summary
3391 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3392
3393 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3394 onpass="INTENTS INSTALLED",
3395 onfail="SOME INTENTS NOT INSTALLED" )
3396
GlennRCfa69a2a2015-10-02 15:54:06 -07003397 main.step("Verify flows are all added")
3398
3399 for i in range( main.flowCheck ):
3400 if i != 0:
3401 main.log.warn( "verification failed. Retrying..." )
3402 main.log.info( "Waiting for onos to add flows..." )
3403 time.sleep( main.checkFlowsDelay )
3404
3405 flowState = main.TRUE
3406 for cli in main.CLIs:
3407 flowState = cli.checkFlowState()
3408 if not flowState:
3409 main.log.warn( "Not all flows added" )
3410 if flowState:
3411 break
3412 else:
3413 #Dumping summary
3414 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3415
3416 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3417 onpass="FLOWS INSTALLED",
3418 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07003419
Hari Krishnac195f3b2015-07-08 20:02:24 -07003420 main.step( "Verify Ping across all hosts" )
3421 pingResult = main.FALSE
3422 time1 = time.time()
GlennRCdb2c8422015-09-29 12:21:59 -07003423 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3424 if not pingResult:
3425 time1 = time.time()
3426 main.log.warn("First pingall failed. Retrying")
3427 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3428
Hari Krishnac195f3b2015-07-08 20:02:24 -07003429 time2 = time.time()
3430 timeDiff = round( ( time2 - time1 ), 2 )
3431 main.log.report(
3432 "Time taken for Ping All: " +
3433 str( timeDiff ) +
3434 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07003435
GlennRCbddd58f2015-10-01 15:45:25 -07003436 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003437 utilities.assert_equals(
3438 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003439 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003440 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3441 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003442
GlennRCfa69a2a2015-10-02 15:54:06 -07003443 if not intentState:
3444 main.log.debug( "Intents failed to install completely" )
3445 if not pingResult:
3446 main.log.debug( "Pingall failed" )
3447 if not checkFlowsState:
3448 main.log.debug( "Flows failed to add completely" )
3449
3450 if not caseResult and main.failSwitch:
3451 main.log.report("Stopping test")
3452 main.stop( email=main.emailOnStop )
3453
Hari Krishnac195f3b2015-07-08 20:02:24 -07003454 def CASE94( self ):
3455 """
3456 Install multi-single point intents and verify Ping all works
3457 for Chordal topology
3458 """
3459 import copy
3460 import time
3461 main.log.report( "Install multi-single point intents and verify Ping all" )
3462 main.log.report( "___________________________________________" )
3463 main.case( "Install multi-single point intents and Ping all" )
3464 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3465 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3466 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003467 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003468 time1 = time.time()
3469 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3470 pool = []
3471 for cli in main.CLIs:
3472 egressDevice = deviceDPIDsCopy[i]
3473 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3474 ingressDeviceList.remove(egressDevice)
3475 if i >= len( deviceDPIDsCopy ):
3476 break
3477 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3478 threadID=main.threadID,
3479 name="addMultipointToSinglepointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003480 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003481 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003482 t.start()
3483 i = i + 1
3484 main.threadID = main.threadID + 1
3485 for thread in pool:
3486 thread.join()
3487 intentIdList.append(thread.result)
3488 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003489 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003490
3491 main.step("Verify intents are installed")
3492
GlennRC1dde1712015-10-02 11:03:08 -07003493 # Giving onos multiple chances to install intents
3494 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003495 if i != 0:
3496 main.log.warn( "Verification failed. Retrying..." )
3497 main.log.info("Waiting for onos to install intents...")
3498 time.sleep( main.checkIntentsDelay )
3499
3500 intentState = main.TRUE
3501 for e in range(int(main.numCtrls)):
3502 main.log.info( "Checking intents on CLI %s" % (e+1) )
3503 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3504 intentState
3505 if not intentState:
3506 main.log.warn( "Not all intents installed" )
3507 if intentState:
3508 break
3509 else:
3510 #Dumping intent summary
3511 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3512
GlennRCdb2c8422015-09-29 12:21:59 -07003513 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3514 onpass="INTENTS INSTALLED",
3515 onfail="SOME INTENTS NOT INSTALLED" )
3516
GlennRCfa69a2a2015-10-02 15:54:06 -07003517 main.step("Verify flows are all added")
3518
3519 for i in range( main.flowCheck ):
3520 if i != 0:
3521 main.log.warn( "verification failed. Retrying..." )
3522 main.log.info( "Waiting for onos to add flows..." )
3523 time.sleep( main.checkFlowsDelay )
3524
3525 flowState = main.TRUE
3526 for cli in main.CLIs:
3527 flowState = cli.checkFlowState()
3528 if not flowState:
3529 main.log.warn( "Not all flows added" )
3530 if flowState:
3531 break
3532 else:
3533 #Dumping summary
3534 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3535
3536 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3537 onpass="FLOWS INSTALLED",
3538 onfail="SOME FLOWS NOT ADDED" )
3539
Hari Krishnac195f3b2015-07-08 20:02:24 -07003540 main.step( "Verify Ping across all hosts" )
3541 pingResult = main.FALSE
3542 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003543 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07003544 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07003545 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003546 main.log.warn("First pingall failed. Retrying")
3547 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3548
Hari Krishnac195f3b2015-07-08 20:02:24 -07003549 time2 = time.time()
3550 timeDiff = round( ( time2 - time1 ), 2 )
3551 main.log.report(
3552 "Time taken for Ping All: " +
3553 str( timeDiff ) +
3554 " seconds" )
3555
GlennRCfa69a2a2015-10-02 15:54:06 -07003556 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003557 utilities.assert_equals(
3558 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003559 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003560 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3561 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003562
GlennRCfa69a2a2015-10-02 15:54:06 -07003563 if not intentState:
3564 main.log.debug( "Intents failed to install completely" )
3565 if not pingResult:
3566 main.log.debug( "Pingall failed" )
3567 if not checkFlowsState:
3568 main.log.debug( "Flows failed to add completely" )
3569
3570 if not caseResult and main.failSwitch:
3571 main.log.report("Stopping test")
3572 main.stop( email=main.emailOnStop )
3573
3574 def CASE95( self ):
3575 """
3576 Install multi-single point intents and verify Ping all works
3577 for Spine topology
3578 """
3579 import copy
3580 import time
3581 main.log.report( "Install multi-single point intents and verify Ping all" )
3582 main.log.report( "___________________________________________" )
3583 main.case( "Install multi-single point intents and Ping all" )
3584 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3585 portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
3586 intentIdList = []
3587 main.log.info( "MACsDict" + str(main.MACsDict) )
3588 time1 = time.time()
3589 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3590 pool = []
3591 for cli in main.CLIs:
3592 egressDevice = deviceDPIDsCopy[i]
3593 ingressDeviceList = copy.copy(deviceDPIDsCopy)
3594 ingressDeviceList.remove(egressDevice)
3595 if i >= len( deviceDPIDsCopy ):
3596 break
3597 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
3598 threadID=main.threadID,
3599 name="addMultipointToSinglepointIntent",
3600 args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
3601 pool.append(t)
3602 t.start()
3603 i = i + 1
3604 main.threadID = main.threadID + 1
3605 for thread in pool:
3606 thread.join()
3607 intentIdList.append(thread.result)
3608 time2 = time.time()
3609 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
3610
3611 main.step("Verify intents are installed")
3612
3613 # Giving onos multiple chances to install intents
3614 for i in range( main.intentCheck ):
3615 if i != 0:
3616 main.log.warn( "Verification failed. Retrying..." )
3617 main.log.info("Waiting for onos to install intents...")
3618 time.sleep( main.checkIntentsDelay )
3619
3620 intentState = main.TRUE
3621 for e in range(int(main.numCtrls)):
3622 main.log.info( "Checking intents on CLI %s" % (e+1) )
3623 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3624 intentState
3625 if not intentState:
3626 main.log.warn( "Not all intents installed" )
3627 if intentState:
3628 break
3629 else:
3630 #Dumping intent summary
3631 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3632
3633 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3634 onpass="INTENTS INSTALLED",
3635 onfail="SOME INTENTS NOT INSTALLED" )
3636
3637 main.step("Verify flows are all added")
3638
3639 for i in range( main.flowCheck ):
3640 if i != 0:
3641 main.log.warn( "verification failed. Retrying..." )
3642 main.log.info( "Waiting for onos to add flows..." )
3643 time.sleep( main.checkFlowsDelay )
3644
3645 flowState = main.TRUE
3646 for cli in main.CLIs:
3647 flowState = cli.checkFlowState()
3648 if not flowState:
3649 main.log.warn( "Not all flows added" )
3650 if flowState:
3651 break
3652 else:
3653 #Dumping summary
3654 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3655
3656 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3657 onpass="FLOWS INSTALLED",
3658 onfail="SOME FLOWS NOT ADDED" )
3659
3660 main.step( "Verify Ping across all hosts" )
3661 pingResult = main.FALSE
3662 time1 = time.time()
3663 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3664 if not pingResult:
3665 time1 = time.time()
3666 main.log.warn("First pingall failed. Retrying")
3667 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3668
3669 time2 = time.time()
3670 timeDiff = round( ( time2 - time1 ), 2 )
3671 main.log.report(
3672 "Time taken for Ping All: " +
3673 str( timeDiff ) +
3674 " seconds" )
3675
3676 caseResult = ( checkFlowsState and pingResult and intentState )
3677 utilities.assert_equals(
3678 expect=main.TRUE,
3679 actual=caseResult,
3680 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3681 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3682
3683 if not intentState:
3684 main.log.debug( "Intents failed to install completely" )
3685 if not pingResult:
3686 main.log.debug( "Pingall failed" )
3687 if not checkFlowsState:
3688 main.log.debug( "Flows failed to add completely" )
3689
3690 if not caseResult and main.failSwitch:
3691 main.log.report("Stopping test")
3692 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003693
3694 def CASE96( self ):
3695 """
3696 Install single-multi point intents and verify Ping all works
3697 for att topology
3698 """
3699 import copy
3700 main.log.report( "Install single-multi point intents and verify Ping all" )
3701 main.log.report( "___________________________________________" )
3702 main.case( "Install single-multi point intents and Ping all" )
3703 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3704 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3705 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003706 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003707 time1 = time.time()
3708 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3709 pool = []
3710 for cli in main.CLIs:
3711 ingressDevice = deviceDPIDsCopy[i]
3712 egressDeviceList = copy.copy(deviceDPIDsCopy)
3713 egressDeviceList.remove(ingressDevice)
3714 if i >= len( deviceDPIDsCopy ):
3715 break
3716 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3717 threadID=main.threadID,
3718 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003719 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003720 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003721 t.start()
3722 i = i + 1
3723 main.threadID = main.threadID + 1
3724 for thread in pool:
3725 thread.join()
3726 intentIdList.append(thread.result)
3727 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003728 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003729
3730 main.step("Verify intents are installed")
3731
GlennRC1dde1712015-10-02 11:03:08 -07003732 # Giving onos multiple chances to install intents
3733 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003734 if i != 0:
3735 main.log.warn( "Verification failed. Retrying..." )
3736 main.log.info("Waiting for onos to install intents...")
3737 time.sleep( main.checkIntentsDelay )
3738
3739 intentState = main.TRUE
3740 for e in range(int(main.numCtrls)):
3741 main.log.info( "Checking intents on CLI %s" % (e+1) )
3742 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3743 intentState
3744 if not intentState:
3745 main.log.warn( "Not all intents installed" )
3746 if intentState:
3747 break
3748 else:
3749 #Dumping intent summary
3750 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3751
GlennRCdb2c8422015-09-29 12:21:59 -07003752 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3753 onpass="INTENTS INSTALLED",
3754 onfail="SOME INTENTS NOT INSTALLED" )
3755
GlennRCfa69a2a2015-10-02 15:54:06 -07003756 main.step("Verify flows are all added")
3757
3758 for i in range( main.flowCheck ):
3759 if i != 0:
3760 main.log.warn( "verification failed. Retrying..." )
3761 main.log.info( "Waiting for onos to add flows..." )
3762 time.sleep( main.checkFlowsDelay )
3763
3764 flowState = main.TRUE
3765 for cli in main.CLIs:
3766 flowState = cli.checkFlowState()
3767 if not flowState:
3768 main.log.warn( "Not all flows added" )
3769 if flowState:
3770 break
3771 else:
3772 #Dumping summary
3773 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3774
3775 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3776 onpass="FLOWS INSTALLED",
3777 onfail="SOME FLOWS NOT ADDED" )
3778
Hari Krishnac195f3b2015-07-08 20:02:24 -07003779 main.step( "Verify Ping across all hosts" )
3780 pingResult = main.FALSE
3781 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003782 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07003783 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07003784 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003785 main.log.warn("First pingall failed. Retrying")
3786 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3787
Hari Krishnac195f3b2015-07-08 20:02:24 -07003788 time2 = time.time()
3789 timeDiff = round( ( time2 - time1 ), 2 )
3790 main.log.report(
3791 "Time taken for Ping All: " +
3792 str( timeDiff ) +
3793 " seconds" )
3794
GlennRCfa69a2a2015-10-02 15:54:06 -07003795 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003796 utilities.assert_equals(
3797 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003798 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003799 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3800 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3801
GlennRCfa69a2a2015-10-02 15:54:06 -07003802 if not intentState:
3803 main.log.debug( "Intents failed to install completely" )
3804 if not pingResult:
3805 main.log.debug( "Pingall failed" )
3806 if not checkFlowsState:
3807 main.log.debug( "Flows failed to add completely" )
3808
3809 if not caseResult and main.failSwitch:
3810 main.log.report("Stopping test")
3811 main.stop( email=main.emailOnStop )
3812
Hari Krishnac195f3b2015-07-08 20:02:24 -07003813 def CASE97( self ):
3814 """
3815 Install single-multi point intents and verify Ping all works
3816 for Chordal topology
3817 """
3818 import copy
3819 main.log.report( "Install single-multi point intents and verify Ping all" )
3820 main.log.report( "___________________________________________" )
3821 main.case( "Install single-multi point intents and Ping all" )
3822 deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
3823 portEgressList = ['1']*(len(deviceDPIDsCopy) - 1)
3824 intentIdList = []
GlennRCfa69a2a2015-10-02 15:54:06 -07003825 main.log.info( "MACsDict" + str(main.MACsDict) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003826 time1 = time.time()
3827 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3828 pool = []
3829 for cli in main.CLIs:
3830 ingressDevice = deviceDPIDsCopy[i]
3831 egressDeviceList = copy.copy(deviceDPIDsCopy)
3832 egressDeviceList.remove(ingressDevice)
3833 if i >= len( deviceDPIDsCopy ):
3834 break
3835 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3836 threadID=main.threadID,
3837 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003838 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003839 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003840 t.start()
3841 i = i + 1
3842 main.threadID = main.threadID + 1
3843 for thread in pool:
3844 thread.join()
3845 intentIdList.append(thread.result)
3846 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003847 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003848
3849 main.step("Verify intents are installed")
3850
GlennRC1dde1712015-10-02 11:03:08 -07003851 # Giving onos multiple chances to install intents
3852 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003853 if i != 0:
3854 main.log.warn( "Verification failed. Retrying..." )
3855 main.log.info("Waiting for onos to install intents...")
3856 time.sleep( main.checkIntentsDelay )
3857
3858 intentState = main.TRUE
3859 for e in range(int(main.numCtrls)):
3860 main.log.info( "Checking intents on CLI %s" % (e+1) )
3861 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3862 intentState
3863 if not intentState:
3864 main.log.warn( "Not all intents installed" )
3865 if intentState:
3866 break
3867 else:
3868 #Dumping intent summary
3869 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3870
GlennRCdb2c8422015-09-29 12:21:59 -07003871 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3872 onpass="INTENTS INSTALLED",
3873 onfail="SOME INTENTS NOT INSTALLED" )
3874
GlennRCfa69a2a2015-10-02 15:54:06 -07003875 main.step("Verify flows are all added")
3876
3877 for i in range( main.flowCheck ):
3878 if i != 0:
3879 main.log.warn( "verification failed. Retrying..." )
3880 main.log.info( "Waiting for onos to add flows..." )
3881 time.sleep( main.checkFlowsDelay )
3882
3883 flowState = main.TRUE
3884 for cli in main.CLIs:
3885 flowState = cli.checkFlowState()
3886 if not flowState:
3887 main.log.warn( "Not all flows added" )
3888 if flowState:
3889 break
3890 else:
3891 #Dumping summary
3892 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
3893
3894 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3895 onpass="FLOWS INSTALLED",
3896 onfail="SOME FLOWS NOT ADDED" )
3897
Hari Krishnac195f3b2015-07-08 20:02:24 -07003898 main.step( "Verify Ping across all hosts" )
3899 pingResult = main.FALSE
3900 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003901 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07003902 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07003903 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07003904 main.log.warn("First pingall failed. Retrying")
3905 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
3906
Hari Krishnac195f3b2015-07-08 20:02:24 -07003907 time2 = time.time()
3908 timeDiff = round( ( time2 - time1 ), 2 )
3909 main.log.report(
3910 "Time taken for Ping All: " +
3911 str( timeDiff ) +
3912 " seconds" )
3913
GlennRCfa69a2a2015-10-02 15:54:06 -07003914 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003915 utilities.assert_equals(
3916 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003917 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003918 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3919 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3920
GlennRCfa69a2a2015-10-02 15:54:06 -07003921 if not intentState:
3922 main.log.debug( "Intents failed to install completely" )
3923 if not pingResult:
3924 main.log.debug( "Pingall failed" )
3925 if not checkFlowsState:
3926 main.log.debug( "Flows failed to add completely" )
3927
3928 if not caseResult and main.failSwitch:
3929 main.log.report("Stopping test")
3930 main.stop( email=main.emailOnStop )
3931
Hari Krishnac195f3b2015-07-08 20:02:24 -07003932 def CASE98( self ):
3933 """
3934 Install single-multi point intents and verify Ping all works
3935 for Spine topology
3936 """
3937 import copy
3938 main.log.report( "Install single-multi point intents and verify Ping all" )
3939 main.log.report( "___________________________________________" )
3940 main.case( "Install single-multi point intents and Ping all" )
3941 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3942 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
3943 portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1)
3944 intentIdList = []
3945 MACsDictCopy = {}
3946 for i in range( len( deviceDPIDsCopy ) ):
3947 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ]
3948
GlennRCfa69a2a2015-10-02 15:54:06 -07003949 main.log.info( "deviceDPIDsCopy" + str(deviceDPIDsCopy) )
3950 main.log.info( "MACsDictCopy" + str(MACsDictCopy) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003951 time1 = time.time()
3952 for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
3953 pool = []
3954 for cli in main.CLIs:
3955 if i >= len( deviceDPIDsCopy ):
3956 break
3957 ingressDevice = deviceDPIDsCopy[i]
3958 egressDeviceList = copy.copy(deviceDPIDsCopy)
3959 egressDeviceList.remove(ingressDevice)
3960 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
3961 threadID=main.threadID,
3962 name="addSinglepointToMultipointIntent",
Hari Krishna4223dbd2015-08-13 16:29:53 -07003963 args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
Hari Krishnac195f3b2015-07-08 20:02:24 -07003964 pool.append(t)
Hari Krishnac195f3b2015-07-08 20:02:24 -07003965 t.start()
3966 i = i + 1
3967 main.threadID = main.threadID + 1
3968 for thread in pool:
3969 thread.join()
3970 intentIdList.append(thread.result)
3971 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003972 main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
GlennRCdb2c8422015-09-29 12:21:59 -07003973
3974 main.step("Verify intents are installed")
3975
GlennRC1dde1712015-10-02 11:03:08 -07003976 # Giving onos multiple chances to install intents
3977 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003978 if i != 0:
3979 main.log.warn( "Verification failed. Retrying..." )
3980 main.log.info("Waiting for onos to install intents...")
3981 time.sleep( main.checkIntentsDelay )
3982
3983 intentState = main.TRUE
3984 for e in range(int(main.numCtrls)):
3985 main.log.info( "Checking intents on CLI %s" % (e+1) )
3986 intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
3987 intentState
3988 if not intentState:
3989 main.log.warn( "Not all intents installed" )
3990 if intentState:
3991 break
3992 else:
3993 #Dumping intent summary
3994 main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
3995
GlennRCdb2c8422015-09-29 12:21:59 -07003996 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3997 onpass="INTENTS INSTALLED",
3998 onfail="SOME INTENTS NOT INSTALLED" )
3999
GlennRCfa69a2a2015-10-02 15:54:06 -07004000 main.step("Verify flows are all added")
4001
4002 for i in range( main.flowCheck ):
4003 if i != 0:
4004 main.log.warn( "verification failed. Retrying..." )
4005 main.log.info( "Waiting for onos to add flows..." )
4006 time.sleep( main.checkFlowsDelay )
4007
4008 flowState = main.TRUE
4009 for cli in main.CLIs:
4010 flowState = cli.checkFlowState()
4011 if not flowState:
4012 main.log.warn( "Not all flows added" )
4013 if flowState:
4014 break
4015 else:
4016 #Dumping summary
4017 main.log.info( "Summary:\n" + str( main.ONOScli1.summary(jsonFormat=False) ) )
4018
4019 utilities.assert_equals( expect=main.TRUE, actual=flowState,
4020 onpass="FLOWS INSTALLED",
4021 onfail="SOME FLOWS NOT ADDED" )
4022
Hari Krishnac195f3b2015-07-08 20:02:24 -07004023 main.step( "Verify Ping across all hosts" )
4024 pingResult = main.FALSE
4025 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07004026 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRCdb2c8422015-09-29 12:21:59 -07004027 if not pingResult:
GlennRCdb2c8422015-09-29 12:21:59 -07004028 time1 = time.time()
GlennRCfa69a2a2015-10-02 15:54:06 -07004029 main.log.warn("First pingall failed. Retrying")
4030 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
4031
Hari Krishnac195f3b2015-07-08 20:02:24 -07004032 time2 = time.time()
4033 timeDiff = round( ( time2 - time1 ), 2 )
4034 main.log.report(
4035 "Time taken for Ping All: " +
4036 str( timeDiff ) +
4037 " seconds" )
4038
GlennRCfa69a2a2015-10-02 15:54:06 -07004039 caseResult = ( pingResult and intentState and flowState)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004040 utilities.assert_equals(
4041 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004042 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004043 onpass="Install 25 single to multi point Intents and Ping All test PASS",
4044 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
4045
GlennRCfa69a2a2015-10-02 15:54:06 -07004046 if not intentState:
4047 main.log.debug( "Intents failed to install completely" )
4048 if not pingResult:
4049 main.log.debug( "Pingall failed" )
4050 if not checkFlowsState:
4051 main.log.debug( "Flows failed to add completely" )
4052
4053 if not caseResult and main.failSwitch:
4054 main.log.report("Stopping test")
4055 main.stop( email=main.emailOnStop )
4056
Hari Krishna4223dbd2015-08-13 16:29:53 -07004057 def CASE190( self ):
4058 """
4059 Verify IPv6 ping across 600 Point intents (Att Topology)
4060 """
4061 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
4062 main.log.report( "_________________________________________________" )
4063 import itertools
4064 import time
4065 main.case( "IPv6 ping all 600 Point intents" )
4066 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004067 pingResult = main.FALSE
4068 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004069 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004070 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004071 main.log.warn("First pingall failed. Retrying...")
4072 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004073 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004074 time2 = time.time()
4075 timeDiff = round( ( time2 - time1 ), 2 )
4076 main.log.report(
4077 "Time taken for IPv6 Ping All: " +
4078 str( timeDiff ) +
4079 " seconds" )
4080 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4081 onpass="PING ALL PASS",
4082 onfail="PING ALL FAIL" )
4083
GlennRCbddd58f2015-10-01 15:45:25 -07004084 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004085 utilities.assert_equals(
4086 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004087 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004088 onpass="IPv6 Ping across 600 Point intents test PASS",
4089 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4090
4091 def CASE191( self ):
4092 """
4093 Verify IPv6 ping across 600 Point intents (Chordal Topology)
4094 """
4095 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
4096 main.log.report( "_________________________________________________" )
4097 import itertools
4098 import time
4099 main.case( "IPv6 ping all 600 Point intents" )
4100 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004101 pingResult = main.FALSE
4102 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004103 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -07004104 if not pingResult:
GlennRCa8d786a2015-09-23 17:40:11 -07004105 main.log.warn("First pingall failed. Retrying...")
4106 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004107 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004108 time2 = time.time()
4109 timeDiff = round( ( time2 - time1 ), 2 )
4110 main.log.report(
4111 "Time taken for IPv6 Ping All: " +
4112 str( timeDiff ) +
4113 " seconds" )
4114 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4115 onpass="PING ALL PASS",
4116 onfail="PING ALL FAIL" )
4117
GlennRCbddd58f2015-10-01 15:45:25 -07004118 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004119 utilities.assert_equals(
4120 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004121 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07004122 onpass="IPv6 Ping across 600 Point intents test PASS",
4123 onfail="IPv6 Ping across 600 Point intents test FAIL" )
4124
4125 def CASE192( self ):
4126 """
4127 Verify IPv6 ping across 4556 Point intents (Spine Topology)
4128 """
4129 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
4130 main.log.report( "_________________________________________________" )
4131 import itertools
4132 import time
Hari Krishna310efca2015-09-03 09:43:16 -07004133 main.case( "IPv6 ping all 4556 Point intents" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004134 main.step( "Verify IPv6 Ping across all hosts" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004135 pingResult = main.FALSE
4136 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004137 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRCa8d786a2015-09-23 17:40:11 -07004138 if not pingResult:
4139 main.log.warn("First pingall failed. Retrying...")
4140 time1 = time.time()
GlennRC4ae5a242015-10-02 11:37:56 -07004141 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004142 time2 = time.time()
4143 timeDiff = round( ( time2 - time1 ), 2 )
4144 main.log.report(
4145 "Time taken for IPv6 Ping All: " +
4146 str( timeDiff ) +
4147 " seconds" )
4148 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
4149 onpass="PING ALL PASS",
4150 onfail="PING ALL FAIL" )
4151
GlennRCbddd58f2015-10-01 15:45:25 -07004152 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07004153 utilities.assert_equals(
4154 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07004155 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07004156 onpass="IPv6 Ping across 4556 Point intents test PASS",
4157 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07004158
Hari Krishnac195f3b2015-07-08 20:02:24 -07004159 def CASE10( self ):
4160 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07004161 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07004162 """
4163 Remove all Intents
4164 """
4165 main.log.report( "Remove all intents that were installed previously" )
4166 main.log.report( "______________________________________________" )
4167 main.log.info( "Remove all intents" )
4168 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07004169 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004170 main.step( "Obtain the intent id's first" )
4171 intentsList = main.ONOScli1.getAllIntentIds()
4172 ansi_escape = re.compile( r'\x1b[^m]*m' )
4173 intentsList = ansi_escape.sub( '', intentsList )
4174 intentsList = intentsList.replace(
4175 " onos:intents | grep id=",
4176 "" ).replace(
4177 "id=",
4178 "" ).replace(
4179 "\r\r",
4180 "" )
4181 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004182 intentIdList = []
4183 step1Result = main.TRUE
4184 moreIntents = main.TRUE
4185 removeIntentCount = 0
4186 intentsCount = len(intentsList)
4187 main.log.info ( "Current number of intents: " + str(intentsCount) )
4188 if ( len( intentsList ) > 1 ):
4189 results = main.TRUE
4190 main.log.info("Removing intent...")
4191 while moreIntents:
Hari Krishna6185fc12015-07-13 15:42:31 -07004192 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07004193 if removeIntentCount == 5:
4194 break
4195 removeIntentCount = removeIntentCount + 1
4196 intentsList1 = main.ONOScli1.getAllIntentIds()
4197 if len( intentsList1 ) == 0:
4198 break
4199 ansi_escape = re.compile( r'\x1b[^m]*m' )
4200 intentsList1 = ansi_escape.sub( '', intentsList1 )
4201 intentsList1 = intentsList1.replace(
4202 " onos:intents | grep id=",
4203 "" ).replace(
4204 " state=",
4205 "" ).replace(
4206 "\r\r",
4207 "" )
4208 intentsList1 = intentsList1.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004209 main.log.info ( "Round %d intents to remove: " %(removeIntentCount) )
4210 print intentsList1
4211 intentIdList1 = []
4212 if ( len( intentsList1 ) > 0 ):
4213 moreIntents = main.TRUE
4214 for i in range( len( intentsList1 ) ):
4215 intentsTemp1 = intentsList1[ i ].split( ',' )
4216 intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] )
4217 main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) )
4218 main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) )
4219 time1 = time.time()
4220 for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ):
4221 pool = []
4222 for cli in main.CLIs:
4223 if i >= len( intentIdList1 ):
4224 break
4225 t = main.Thread( target=cli.removeIntent,
4226 threadID=main.threadID,
4227 name="removeIntent",
4228 args=[intentIdList1[i],'org.onosproject.cli',False,False])
4229 pool.append(t)
4230 t.start()
4231 i = i + 1
4232 main.threadID = main.threadID + 1
4233 for thread in pool:
4234 thread.join()
4235 intentIdList.append(thread.result)
4236 #time.sleep(2)
4237 time2 = time.time()
4238 main.log.info("Time for removing host intents: %2f seconds" %(time2-time1))
Hari Krishnaad0c5202015-09-01 14:26:49 -07004239 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004240 main.log.info("Purging WITHDRAWN Intents")
Hari Krishna6185fc12015-07-13 15:42:31 -07004241 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07004242 else:
4243 time.sleep(10)
4244 if len( main.ONOScli1.intents()):
4245 continue
4246 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07004247 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07004248 else:
4249 print "Removed %d intents" %(intentsCount)
4250 step1Result = main.TRUE
4251 else:
4252 print "No Intent IDs found in Intents list: ", intentsList
4253 step1Result = main.FALSE
4254
4255 print main.ONOScli1.intents()
GlennRCbddd58f2015-10-01 15:45:25 -07004256 caseResult = step1Result
4257 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004258 onpass="Intent removal test successful",
4259 onfail="Intent removal test failed" )
4260
4261 def CASE12( self, main ):
4262 """
4263 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
4264 """
4265 import re
4266 import copy
4267 import time
4268
Hari Krishnac195f3b2015-07-08 20:02:24 -07004269 threadID = 0
4270
4271 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
4272 main.log.report( "_____________________________________________________" )
4273 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
4274 main.step( "Enable intent based Reactive forwarding" )
4275 installResult = main.FALSE
4276 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07004277
Hari Krishnac195f3b2015-07-08 20:02:24 -07004278 pool = []
4279 time1 = time.time()
4280 for cli,feature in main.CLIs:
4281 t = main.Thread(target=cli,threadID=threadID,
4282 name="featureInstall",args=[feature])
4283 pool.append(t)
4284 t.start()
4285 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004286
Hari Krishnac195f3b2015-07-08 20:02:24 -07004287 results = []
4288 for thread in pool:
4289 thread.join()
4290 results.append(thread.result)
4291 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004292
Hari Krishnac195f3b2015-07-08 20:02:24 -07004293 if( all(result == main.TRUE for result in results) == False):
4294 main.log.info("Did not install onos-app-ifwd feature properly")
4295 #main.cleanup()
4296 #main.exit()
4297 else:
4298 main.log.info("Successful feature:install onos-app-ifwd")
4299 installResult = main.TRUE
4300 main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
Jon Hall4ba53f02015-07-29 13:07:41 -07004301
Hari Krishnac195f3b2015-07-08 20:02:24 -07004302 main.step( "Verify Pingall" )
GlennRC626ba132015-09-18 16:16:31 -07004303 pingResult = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07004304 time1 = time.time()
GlennRC626ba132015-09-18 16:16:31 -07004305 pingResult = main.Mininet1.pingall(timeout=600)
Hari Krishnac195f3b2015-07-08 20:02:24 -07004306 time2 = time.time()
4307 timeDiff = round( ( time2 - time1 ), 2 )
4308 main.log.report(
4309 "Time taken for Ping All: " +
4310 str( timeDiff ) +
4311 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07004312
GlennRC626ba132015-09-18 16:16:31 -07004313 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07004314 main.log.report( "Pingall Test in Reactive mode successful" )
4315 else:
4316 main.log.report( "Pingall Test in Reactive mode failed" )
4317
4318 main.step( "Disable Intent based Reactive forwarding" )
4319 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07004320
Hari Krishnac195f3b2015-07-08 20:02:24 -07004321 pool = []
4322 time1 = time.time()
4323 for cli,feature in main.CLIs:
4324 t = main.Thread(target=cli,threadID=threadID,
4325 name="featureUninstall",args=[feature])
4326 pool.append(t)
4327 t.start()
4328 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07004329
Hari Krishnac195f3b2015-07-08 20:02:24 -07004330 results = []
4331 for thread in pool:
4332 thread.join()
4333 results.append(thread.result)
4334 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07004335
Hari Krishnac195f3b2015-07-08 20:02:24 -07004336 if( all(result == main.TRUE for result in results) == False):
4337 main.log.info("Did not uninstall onos-app-ifwd feature properly")
4338 uninstallResult = main.FALSE
4339 #main.cleanup()
4340 #main.exit()
4341 else:
4342 main.log.info("Successful feature:uninstall onos-app-ifwd")
4343 uninstallResult = main.TRUE
4344 main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1))
4345
4346 # Waiting for reative flows to be cleared.
4347 time.sleep( 10 )
4348
GlennRCbddd58f2015-10-01 15:45:25 -07004349 caseResult = installResult and pingResult and uninstallResult
4350 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07004351 onpass="Intent based Reactive forwarding Pingall test PASS",
4352 onfail="Intent based Reactive forwarding Pingall test FAIL" )