blob: 6fc4882e73df5424c8c38be353fe0cfda57c31a4 [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
You Wangb6586542016-02-26 09:25:56 -080027 import re
28 import imp
Hari Krishnac195f3b2015-07-08 20:02:24 -070029
30 global intentState
31 main.threadID = 0
You Wangb6586542016-02-26 09:25:56 -080032 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
33 main.dependencyPath = main.testOnDirectory + \
34 main.params[ 'DEPENDENCY' ][ 'path' ]
35 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070036 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070037 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
38 git_branch = main.params[ 'GIT' ][ 'branch' ]
Jon Hallef0e2a12017-05-24 16:57:53 -070039 karafTimeout = main.params[ 'CTRL' ][ 'karafCliTimeout' ]
40 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
41 main.checkIntentsDelay = int( main.params[ 'timers' ][ 'CheckIntentDelay' ] )
42 main.pingSleep = int( main.params[ 'timers' ][ 'pingSleep' ] )
43 main.topoCheckDelay = int( main.params[ 'timers' ][ 'topoCheckDelay' ] )
44 main.pingTimeoutSmallTopo = int( main.params[ 'timers' ][ 'pingTimeoutSmallTopo' ] )
45 main.pingTimeoutLargeTopo = int( main.params[ 'timers' ][ 'pingTimeoutLargeTopo' ] )
46 main.remHostDelay = int( main.params[ 'timers' ][ 'remHostDelay' ] )
47 main.remDevDelay = int( main.params[ 'timers' ][ 'remDevDelay' ] )
48 main.failSwitch = main.params[ 'TEST' ][ 'pauseTest' ]
49 main.emailOnStop = main.params[ 'TEST' ][ 'email' ]
50 main.intentCheck = int( main.params[ 'TEST' ][ 'intentChecks' ] )
51 main.linkCheck = int( main.params[ 'TEST' ][ 'linkChecks' ] )
52 main.topoCheck = int( main.params[ 'TEST' ][ 'topoChecks' ] )
53 main.numPings = int( main.params[ 'TEST' ][ 'numPings' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070054 main.newTopo = ""
55 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070056
GlennRC9e7465e2015-10-02 13:50:36 -070057 main.failSwitch = True if main.failSwitch == "on" else False
58 main.emailOnStop = True if main.emailOnStop == "on" else False
59
Jon Hallef0e2a12017-05-24 16:57:53 -070060 for i in range( 1, int( main.numCtrls ) + 1 ):
Hari Krishnac195f3b2015-07-08 20:02:24 -070061 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070062
You Wangb6586542016-02-26 09:25:56 -080063 main.CHOtestFunctions = imp.load_source( wrapperFile,
64 main.dependencyPath +
65 wrapperFile +
66 ".py" )
67
Hari Krishnac195f3b2015-07-08 20:02:24 -070068 main.case( "Set up test environment" )
69 main.log.report( "Set up test environment" )
70 main.log.report( "_______________________" )
71
Hari Krishna6185fc12015-07-13 15:42:31 -070072 main.step( "Apply Cell environment for ONOS" )
73 if ( main.onoscell ):
74 cellName = main.onoscell
75 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070076 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
Jon Hallef0e2a12017-05-24 16:57:53 -070077 onpass="Test step PASS",
78 onfail="Test step FAIL" )
Hari Krishna6185fc12015-07-13 15:42:31 -070079 else:
80 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
81 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080082 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070083 main.exit()
84
Hari Krishnac195f3b2015-07-08 20:02:24 -070085 main.step( "Git checkout and pull " + git_branch )
86 if git_pull == 'on':
87 checkout_result = main.ONOSbench.gitCheckout( git_branch )
88 pull_result = main.ONOSbench.gitPull()
89 cp_result = ( checkout_result and pull_result )
90 else:
91 checkout_result = main.TRUE
92 pull_result = main.TRUE
93 main.log.info( "Skipped git checkout and pull" )
94 cp_result = ( checkout_result and pull_result )
95 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
96 onpass="Test step PASS",
97 onfail="Test step FAIL" )
98
99 main.step( "mvn clean & install" )
100 if git_pull == 'on':
101 mvn_result = main.ONOSbench.cleanInstall()
102 utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
Jon Hallef0e2a12017-05-24 16:57:53 -0700103 onpass="Test step PASS",
104 onfail="Test step FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700105 else:
106 mvn_result = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700107 main.log.info( "Skipped mvn clean install as git pull is disabled in params file" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700108
109 main.ONOSbench.getVersion( report=True )
110
Hari Krishnac195f3b2015-07-08 20:02:24 -0700111 main.step( "Create ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700112 packageResult = main.ONOSbench.buckBuild()
Hari Krishnac195f3b2015-07-08 20:02:24 -0700113 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
114 onpass="Test step PASS",
115 onfail="Test step FAIL" )
116
117 main.step( "Uninstall ONOS package on all Nodes" )
118 uninstallResult = main.TRUE
119 for i in range( int( main.numCtrls ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700120 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[ i ] )
121 u_result = main.ONOSbench.onosUninstall( main.onosIPs[ i ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700122 utilities.assert_equals( expect=main.TRUE, actual=u_result,
123 onpass="Test step PASS",
124 onfail="Test step FAIL" )
125 uninstallResult = ( uninstallResult and u_result )
126
127 main.step( "Install ONOS package on all Nodes" )
128 installResult = main.TRUE
129 for i in range( int( main.numCtrls ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700130 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[ i ] )
131 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[ i ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700132 utilities.assert_equals( expect=main.TRUE, actual=i_result,
133 onpass="Test step PASS",
134 onfail="Test step FAIL" )
135 installResult = ( installResult and i_result )
136
Chiyu Chengef109502016-11-21 15:51:38 -0800137 main.step( "Set up ONOS secure SSH" )
138 secureSshResult = main.TRUE
139 for i in range( int( main.numCtrls ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700140 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
Chiyu Chengef109502016-11-21 15:51:38 -0800141 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
142 onpass="Test step PASS",
143 onfail="Test step FAIL" )
144
You Wang0357c432017-01-09 16:13:33 -0800145 time.sleep( 5 )
146 main.step( "Starting ONOS service" )
147 stopResult = main.TRUE
148 startResult = main.TRUE
149 onosIsUp = main.TRUE
150 for i in range( main.numCtrls ):
151 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
152 if onosIsUp == main.TRUE:
153 main.log.report( "ONOS instance is up and ready" )
154 else:
155 main.log.report( "ONOS instance may not be up, stop and " +
156 "start ONOS again " )
157 for i in range( main.numCtrls ):
158 stopResult = stopResult and \
159 main.ONOSbench.onosStop( main.ONOSip[ i ] )
160 for i in range( main.numCtrls ):
161 startResult = startResult and \
162 main.ONOSbench.onosStart( main.ONOSip[ i ] )
163 stepResult = onosIsUp and stopResult and startResult
164 utilities.assert_equals( expect=main.TRUE,
165 actual=stepResult,
166 onpass="ONOS service is ready",
167 onfail="ONOS service did not start properly" )
168
Hari Krishnac195f3b2015-07-08 20:02:24 -0700169 main.step( "Start ONOS CLI on all nodes" )
170 cliResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700171 main.step( " Start ONOS cli using thread " )
172 startCliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700173 pool = []
174 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700175 for i in range( int( main.numCtrls ) ):
176 t = main.Thread( target=main.CLIs[ i ].startOnosCli,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700177 threadID=main.threadID,
178 name="startOnosCli",
Jon Hallef0e2a12017-05-24 16:57:53 -0700179 args=[ main.onosIPs[ i ], karafTimeout ] )
180 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700181 t.start()
182 main.threadID = main.threadID + 1
183 for t in pool:
184 t.join()
185 startCliResult = startCliResult and t.result
186 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700187
Hari Krishnac195f3b2015-07-08 20:02:24 -0700188 if not startCliResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700189 main.log.info( "ONOS CLI did not start up properly" )
190 main.cleanup()
191 main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -0700192 else:
Jon Hallef0e2a12017-05-24 16:57:53 -0700193 main.log.info( "Successful CLI startup" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700194 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700195
196 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700197 time.sleep( 30 )
198 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
199 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700200 cfgResult = cfgResult1 and cfgResult2
201 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
202 onpass="ipv6NeighborDiscovery cfg is set to true",
203 onfail="Failed to cfg set ipv6NeighborDiscovery" )
204
205 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Jon Hallef0e2a12017-05-24 16:57:53 -0700206 main.log.info( "Time for connecting to CLI: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700207 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
208 onpass="Set up test environment PASS",
209 onfail="Set up test environment FAIL" )
210
211 def CASE20( self, main ):
212 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700213 This test script Loads a new Topology ( Att ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700214 """
215 import re
216 import time
217 import copy
218
GlennRC3de72232015-12-16 10:48:35 -0800219 main.prefix = 0
Jon Hallef0e2a12017-05-24 16:57:53 -0700220 main.numMNswitches = int( main.params[ 'TOPO1' ][ 'numSwitches' ] )
221 main.numMNlinks = int( main.params[ 'TOPO1' ][ 'numLinks' ] )
222 main.numMNhosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800223 main.pingTimeout = main.pingTimeoutSmallTopo
224
Hari Krishnac195f3b2015-07-08 20:02:24 -0700225 main.log.report(
226 "Load Att topology and Balance all Mininet switches across controllers" )
227 main.log.report(
228 "________________________________________________________________________" )
229 main.case(
230 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700231
Hari Krishnac195f3b2015-07-08 20:02:24 -0700232 main.step( "Start Mininet with Att topology" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700233 main.newTopo = main.params[ 'TOPO1' ][ 'topo' ]
GlennRCc6cd2a62015-08-10 16:08:22 -0700234 mininetDir = main.Mininet1.home + "/custom/"
Jon Hallef0e2a12017-05-24 16:57:53 -0700235 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
236 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700237 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700238 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Jon Hall4ba53f02015-07-29 13:07:41 -0700239
Hari Krishnac195f3b2015-07-08 20:02:24 -0700240 main.step( "Assign switches to controllers" )
241 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
242 main.Mininet1.assignSwController(
243 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700244 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700245
246 switch_mastership = main.TRUE
247 for i in range( 1, ( main.numMNswitches + 1 ) ):
248 response = main.Mininet1.getSwController( "s" + str( i ) )
249 print( "Response is " + str( response ) )
Jon Hallef0e2a12017-05-24 16:57:53 -0700250 if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700251 switch_mastership = switch_mastership and main.TRUE
252 else:
253 switch_mastership = main.FALSE
254
255 if switch_mastership == main.TRUE:
256 main.log.report( "Controller assignment successfull" )
257 else:
258 main.log.report( "Controller assignment failed" )
259
Jon Hallef0e2a12017-05-24 16:57:53 -0700260 time.sleep( 30 ) # waiting here to make sure topology converges across all nodes
Hari Krishnac195f3b2015-07-08 20:02:24 -0700261
262 main.step( "Balance devices across controllers" )
263 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700264 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265 time.sleep( 5 )
266
267 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700268 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700269 case2Result = ( switch_mastership and startStatus )
270 utilities.assert_equals(
271 expect=main.TRUE,
272 actual=case2Result,
273 onpass="Starting new Att topology test PASS",
274 onfail="Starting new Att topology test FAIL" )
275
276 def CASE21( self, main ):
277 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700278 This test script Loads a new Topology ( Chordal ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700279 """
280 import re
281 import time
282 import copy
283
GlennRC3de72232015-12-16 10:48:35 -0800284 main.prefix = 1
Jon Hallef0e2a12017-05-24 16:57:53 -0700285 main.newTopo = main.params[ 'TOPO2' ][ 'topo' ]
286 main.numMNswitches = int( main.params[ 'TOPO2' ][ 'numSwitches' ] )
287 main.numMNlinks = int( main.params[ 'TOPO2' ][ 'numLinks' ] )
288 main.numMNhosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800289 main.pingTimeout = main.pingTimeoutSmallTopo
290
Hari Krishnac195f3b2015-07-08 20:02:24 -0700291 main.log.report(
292 "Load Chordal topology and Balance all Mininet switches across controllers" )
293 main.log.report(
294 "________________________________________________________________________" )
295 main.case(
296 "Assign and Balance all Mininet switches across controllers" )
297
Jon Hallef0e2a12017-05-24 16:57:53 -0700298 main.step( "Start Mininet with Chordal topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700299 mininetDir = main.Mininet1.home + "/custom/"
Jon Hallef0e2a12017-05-24 16:57:53 -0700300 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
301 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700302 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700303 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700304
305 main.step( "Assign switches to controllers" )
306
307 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
308 main.Mininet1.assignSwController(
309 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700310 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700311
312 switch_mastership = main.TRUE
313 for i in range( 1, ( main.numMNswitches + 1 ) ):
314 response = main.Mininet1.getSwController( "s" + str( i ) )
315 print( "Response is " + str( response ) )
Jon Hallef0e2a12017-05-24 16:57:53 -0700316 if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700317 switch_mastership = switch_mastership and main.TRUE
318 else:
319 switch_mastership = main.FALSE
320
321 if switch_mastership == main.TRUE:
322 main.log.report( "Controller assignment successfull" )
323 else:
324 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700325
Hari Krishnac195f3b2015-07-08 20:02:24 -0700326 main.step( "Balance devices across controllers" )
327 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700328 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700329 time.sleep( 5 )
330
GlennRCbddd58f2015-10-01 15:45:25 -0700331 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700332 time.sleep( 30 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700333 utilities.assert_equals(
334 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700335 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700336 onpass="Starting new Chordal topology test PASS",
337 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700338
Hari Krishnac195f3b2015-07-08 20:02:24 -0700339 def CASE22( self, main ):
340 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700341 This test script Loads a new Topology ( Spine ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700342 """
343 import re
344 import time
345 import copy
346
GlennRC3de72232015-12-16 10:48:35 -0800347 main.prefix = 2
Jon Hallef0e2a12017-05-24 16:57:53 -0700348 main.newTopo = main.params[ 'TOPO3' ][ 'topo' ]
349 main.numMNswitches = int( main.params[ 'TOPO3' ][ 'numSwitches' ] )
350 main.numMNlinks = int( main.params[ 'TOPO3' ][ 'numLinks' ] )
351 main.numMNhosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800352 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700353
Hari Krishnac195f3b2015-07-08 20:02:24 -0700354 main.log.report(
355 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
356 main.log.report(
357 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800358 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700359
Jon Hallef0e2a12017-05-24 16:57:53 -0700360 main.step( "Start Mininet with Spine topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700361 mininetDir = main.Mininet1.home + "/custom/"
Jon Hallef0e2a12017-05-24 16:57:53 -0700362 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
363 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700364 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700365 startStatus = main.Mininet1.startNet( topoFile=topoPath )
GlennRCc6cd2a62015-08-10 16:08:22 -0700366
Hari Krishnac195f3b2015-07-08 20:02:24 -0700367 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
368 main.Mininet1.assignSwController(
369 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700370 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700371
372 switch_mastership = main.TRUE
373 for i in range( 1, ( main.numMNswitches + 1 ) ):
374 response = main.Mininet1.getSwController( "s" + str( i ) )
375 print( "Response is " + str( response ) )
Jon Hallef0e2a12017-05-24 16:57:53 -0700376 if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700377 switch_mastership = switch_mastership and main.TRUE
378 else:
379 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700380
Hari Krishnac195f3b2015-07-08 20:02:24 -0700381 if switch_mastership == main.TRUE:
382 main.log.report( "Controller assignment successfull" )
383 else:
384 main.log.report( "Controller assignment failed" )
385 time.sleep( 5 )
386
387 main.step( "Balance devices across controllers" )
388 for i in range( int( main.numCtrls ) ):
389 balanceResult = main.ONOScli1.balanceMasters()
390 # giving some breathing time for ONOS to complete re-balance
391 time.sleep( 3 )
392
GlennRCbddd58f2015-10-01 15:45:25 -0700393 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700394 time.sleep( 60 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700395 utilities.assert_equals(
396 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700397 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700398 onpass="Starting new Spine topology test PASS",
399 onfail="Starting new Spine topology test FAIL" )
400
401 def CASE3( self, main ):
402 """
403 This Test case will be extended to collect and store more data related
404 ONOS state.
405 """
406 import re
407 import copy
408 main.deviceDPIDs = []
409 main.hostMACs = []
410 main.deviceLinks = []
411 main.deviceActiveLinksCount = []
412 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700413
Hari Krishnac195f3b2015-07-08 20:02:24 -0700414 main.log.report(
415 "Collect and Store topology details from ONOS before running any Tests" )
416 main.log.report(
417 "____________________________________________________________________" )
418 main.case( "Collect and Store Topology Details from ONOS" )
419 main.step( "Collect and store current number of switches and links" )
420 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700421 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700422 numOnosDevices = topology_result[ 'devices' ]
423 numOnosLinks = topology_result[ 'links' ]
424 topoResult = main.TRUE
425
Jon Hallef0e2a12017-05-24 16:57:53 -0700426 for check in range( main.topoCheck ):
427 if ( ( main.numMNswitches == int( numOnosDevices ) ) and ( main.numMNlinks == int( numOnosLinks ) ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800428 main.step( "Store Device DPIDs" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700429 for i in range( 1, ( main.numMNswitches + 1 ) ):
GlennRC20fc6522015-12-23 23:26:57 -0800430 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800431 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700432
GlennRCee8f3bf2015-12-14 16:18:39 -0800433 main.step( "Store Host MACs" )
434 for i in range( 1, ( main.numMNhosts + 1 ) ):
435 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
436 print "Host MACs in Store: \n", str( main.hostMACs )
437 main.MACsDict = {}
438 print "Creating dictionary of DPID and HostMacs"
Jon Hallef0e2a12017-05-24 16:57:53 -0700439 for i in range( len( main.hostMACs ) ):
440 main.MACsDict[ main.deviceDPIDs[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
GlennRCee8f3bf2015-12-14 16:18:39 -0800441 print main.MACsDict
442 main.step( "Collect and store all Devices Links" )
443 linksResult = main.ONOScli1.links( jsonFormat=False )
444 ansi_escape = re.compile( r'\x1b[^m]*m' )
445 linksResult = ansi_escape.sub( '', linksResult )
446 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
447 linksResult = linksResult.splitlines()
448 main.deviceLinks = copy.copy( linksResult )
449 print "Device Links Stored: \n", str( main.deviceLinks )
450 # this will be asserted to check with the params provided count of
451 # links
452 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700453
GlennRCee8f3bf2015-12-14 16:18:39 -0800454 main.step( "Collect and store each Device ports enabled Count" )
455 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700456 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800457 pool = []
458 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700459 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800460 break
GlennRC20fc6522015-12-23 23:26:57 -0800461 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700462 t = main.Thread( target=cli.getDevicePortsEnabledCount, threadID=main.threadID, name="getDevicePortsEnabledCount", args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800463 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700464 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800465 i = i + 1
466 main.threadID = main.threadID + 1
467 for thread in pool:
468 thread.join()
469 portResult = thread.result
470 main.devicePortsEnabledCount.append( portResult )
471 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
472 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700473 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700474
GlennRCee8f3bf2015-12-14 16:18:39 -0800475 main.step( "Collect and store each Device active links Count" )
476 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700477
Jon Hallef0e2a12017-05-24 16:57:53 -0700478 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800479 pool = []
480 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700481 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800482 break
GlennRC20fc6522015-12-23 23:26:57 -0800483 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700484 t = main.Thread( target=cli.getDeviceLinksActiveCount,
485 threadID=main.threadID,
486 name="getDevicePortsEnabledCount",
487 args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800488 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700489 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800490 i = i + 1
491 main.threadID = main.threadID + 1
492 for thread in pool:
493 thread.join()
494 linkCountResult = thread.result
495 main.deviceActiveLinksCount.append( linkCountResult )
496 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
497 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700498 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700499
GlennRCee8f3bf2015-12-14 16:18:39 -0800500 # Exit out of the topo check loop
501 break
502
503 else:
Jon Hallef0e2a12017-05-24 16:57:53 -0700504 main.log.info( "Devices (expected): %s, Links (expected): %s" %
505 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
506 main.log.info( "Devices (actual): %s, Links (actual): %s" %
507 ( numOnosDevices, numOnosLinks ) )
508 main.log.info( "Topology does not match, trying again..." )
GlennRCee8f3bf2015-12-14 16:18:39 -0800509 topoResult = main.FALSE
Jon Hallef0e2a12017-05-24 16:57:53 -0700510 time.sleep( main.topoCheckDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700511
512 # just returning TRUE for now as this one just collects data
513 case3Result = topoResult
514 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
515 onpass="Saving ONOS topology data test PASS",
516 onfail="Saving ONOS topology data test FAIL" )
517
GlennRC20fc6522015-12-23 23:26:57 -0800518 def CASE200( self, main ):
519
520 import time
521 main.log.report( "Clean up ONOS" )
Jon Hall6509dbf2016-06-21 17:01:17 -0700522 main.case( "Stop topology and remove hosts and devices" )
GlennRC20fc6522015-12-23 23:26:57 -0800523
524 main.step( "Stop Topology" )
525 stopStatus = main.Mininet1.stopNet()
526 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
527 onpass="Stopped mininet",
528 onfail="Failed to stop mininet" )
529
GlennRC20fc6522015-12-23 23:26:57 -0800530 main.log.info( "Constructing host id list" )
531 hosts = []
532 for i in range( main.numMNhosts ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700533 hosts.append( "h" + str( i + 1 ) )
GlennRC20fc6522015-12-23 23:26:57 -0800534
535 main.step( "Getting host ids" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700536 hostList = main.CLIs[ 0 ].getHostsId( hosts )
GlennRC20fc6522015-12-23 23:26:57 -0800537 hostIdResult = True if hostList else False
538 utilities.assert_equals( expect=True, actual=hostIdResult,
539 onpass="Successfully obtained the host ids.",
540 onfail="Failed to obtain the host ids" )
541
542 main.step( "Removing hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700543 hostResult = main.CLIs[ 0 ].removeHost( hostList )
GlennRC20fc6522015-12-23 23:26:57 -0800544 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
545 onpass="Successfully removed hosts",
546 onfail="Failed remove hosts" )
547
548 time.sleep( main.remHostDelay )
549
550 main.log.info( "Constructing device uri list" )
551 deviceList = []
552 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700553 deviceList.append( "of:00000000000000" + format( i + 1, "02x" ) )
GlennRC20fc6522015-12-23 23:26:57 -0800554
555 main.step( "Removing devices" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700556 deviceResult = main.CLIs[ 0 ].removeDevice( deviceList )
GlennRC20fc6522015-12-23 23:26:57 -0800557 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
558 onpass="Successfully removed devices",
559 onfail="Failed remove devices" )
560
561 time.sleep( main.remDevDelay )
562
Jon Hallef0e2a12017-05-24 16:57:53 -0700563 main.log.info( "Summary\n{}".format( main.CLIs[ 0 ].summary( jsonFormat=False ) ) )
GlennRC20fc6522015-12-23 23:26:57 -0800564
Hari Krishnac195f3b2015-07-08 20:02:24 -0700565 def CASE40( self, main ):
566 """
GlennRC15d164c2015-12-15 17:12:25 -0800567 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700568 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700569 import time
GlennRC15d164c2015-12-15 17:12:25 -0800570 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700571 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800572 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700573
GlennRC15d164c2015-12-15 17:12:25 -0800574 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700575 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800576 utilities.assert_equals( expect=main.TRUE, actual=appResult,
577 onpass="Successfully install fwd app",
578 onfail="Failed to install fwd app" )
579
GlennRC6ac11b12015-10-21 17:41:28 -0700580 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700581 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700582 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700583 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700584 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700585 main.log.warn( "First pingall failed. Retrying..." )
586 time.sleep( main.pingSleep )
GlennRC15d164c2015-12-15 17:12:25 -0800587 else:
588 break
GlennRC6ac11b12015-10-21 17:41:28 -0700589
Hari Krishnac195f3b2015-07-08 20:02:24 -0700590 time2 = time.time()
591 timeDiff = round( ( time2 - time1 ), 2 )
592 main.log.report(
593 "Time taken for Ping All: " +
594 str( timeDiff ) +
595 " seconds" )
596
GlennRC15d164c2015-12-15 17:12:25 -0800597 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700598 onpass="Reactive Mode IPv4 Pingall test PASS",
599 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700600
You Wangb6586542016-02-26 09:25:56 -0800601 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700602 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800603 main.stop( email=main.emailOnStop )
604
GlennRC15d164c2015-12-15 17:12:25 -0800605 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700606 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800607 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800608 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800609 onfail="Failed to deactivate fwd app" )
610
Hari Krishnac195f3b2015-07-08 20:02:24 -0700611 def CASE41( self, main ):
612 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700613 Verify Reactive forwarding ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700614 """
615 import re
616 import copy
617 import time
618 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
619 main.log.report( "______________________________________________" )
620 main.case( "Enable Reactive forwarding and Verify ping all" )
621 main.step( "Enable Reactive forwarding" )
622 installResult = main.TRUE
623 # Activate fwd app
Jon Hallef0e2a12017-05-24 16:57:53 -0700624 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700625
626 appCheck = main.TRUE
627 pool = []
628 for cli in main.CLIs:
629 t = main.Thread( target=cli.appToIDCheck,
630 name="appToIDCheck-" + str( i ),
631 args=[] )
632 pool.append( t )
633 t.start()
634 for t in pool:
635 t.join()
636 appCheck = appCheck and t.result
637 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
638 onpass="App Ids seem to be correct",
639 onfail="Something is wrong with app Ids" )
640 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700641 main.log.warn( main.CLIs[ 0 ].apps() )
642 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700643
Hari Krishnac195f3b2015-07-08 20:02:24 -0700644 time.sleep( 10 )
645
GlennRC6ac11b12015-10-21 17:41:28 -0700646 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700647 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700648 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700649 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700650 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700651 main.log.warn( "First pingall failed. Retrying..." )
652 time.sleep( main.pingSleep )
653 else:
654 break
GlennRC6ac11b12015-10-21 17:41:28 -0700655
Hari Krishnac195f3b2015-07-08 20:02:24 -0700656 time2 = time.time()
657 timeDiff = round( ( time2 - time1 ), 2 )
658 main.log.report(
659 "Time taken for Ping All: " +
660 str( timeDiff ) +
661 " seconds" )
662
You Wangb6586542016-02-26 09:25:56 -0800663 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700664 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800665 main.stop( email=main.emailOnStop )
666
GlennRC626ba132015-09-18 16:16:31 -0700667 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700668 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700669 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700670 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700671
Jon Hallef0e2a12017-05-24 16:57:53 -0700672 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700673 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700674 onpass="Reactive Mode IPv4 Pingall test PASS",
675 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700676
677 def CASE42( self, main ):
678 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700679 Verify Reactive forwarding ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700680 """
681 import re
682 import copy
683 import time
684 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
685 main.log.report( "______________________________________________" )
686 main.case( "Enable Reactive forwarding and Verify ping all" )
687 main.step( "Enable Reactive forwarding" )
688 installResult = main.TRUE
689 # Activate fwd app
Jon Hallef0e2a12017-05-24 16:57:53 -0700690 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700691
692 appCheck = main.TRUE
693 pool = []
694 for cli in main.CLIs:
695 t = main.Thread( target=cli.appToIDCheck,
696 name="appToIDCheck-" + str( i ),
697 args=[] )
698 pool.append( t )
699 t.start()
700 for t in pool:
701 t.join()
702 appCheck = appCheck and t.result
703 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
704 onpass="App Ids seem to be correct",
705 onfail="Something is wrong with app Ids" )
706 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700707 main.log.warn( main.CLIs[ 0 ].apps() )
708 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700709
Hari Krishnac195f3b2015-07-08 20:02:24 -0700710 time.sleep( 10 )
711
GlennRC6ac11b12015-10-21 17:41:28 -0700712 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700713 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700714 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700715 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700716 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700717 main.log.warn( "First pingall failed. Retrying..." )
718 time.sleep( main.pingSleep )
719 else:
720 break
GlennRC6ac11b12015-10-21 17:41:28 -0700721
Hari Krishnac195f3b2015-07-08 20:02:24 -0700722 time2 = time.time()
723 timeDiff = round( ( time2 - time1 ), 2 )
724 main.log.report(
725 "Time taken for Ping All: " +
726 str( timeDiff ) +
727 " seconds" )
728
You Wangb6586542016-02-26 09:25:56 -0800729 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700730 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800731 main.stop( email=main.emailOnStop )
732
GlennRC626ba132015-09-18 16:16:31 -0700733 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700734 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700735 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700736 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
737
Jon Hallef0e2a12017-05-24 16:57:53 -0700738 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700739 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700740 onpass="Reactive Mode IPv4 Pingall test PASS",
741 onfail="Reactive Mode IPv4 Pingall test FAIL" )
742
GlennRC026dba62016-01-07 18:42:33 -0800743 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800744 """
745 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
746 """
GlennRC026dba62016-01-07 18:42:33 -0800747 import time
You Wang0779bac2016-01-27 16:32:33 -0800748 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800749 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800750 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800751
752 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700753 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800754 utilities.assert_equals( expect=main.TRUE, actual=appResult,
755 onpass="Successfully install fwd app",
756 onfail="Failed to install fwd app" )
757
Jon Hallef0e2a12017-05-24 16:57:53 -0700758 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800759
Jon Hallef0e2a12017-05-24 16:57:53 -0700760 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800761 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700762 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800763 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
764 main.Mininet1.handle.expect( "mininet>" )
765 main.log.info( main.Mininet1.handle.before )
766
Jon Hallef0e2a12017-05-24 16:57:53 -0700767 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800768
769 main.log.info( hosts )
770
771 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700772 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800773 utilities.assert_equals( expect=main.TRUE, actual=appResult,
774 onpass="Successfully deactivated fwd app",
775 onfail="Failed to deactivate fwd app" )
776
777 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800778 """
779 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
780 """
GlennRC026dba62016-01-07 18:42:33 -0800781 import time
You Wang0779bac2016-01-27 16:32:33 -0800782 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800783 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800784 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800785
786 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700787 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800788 utilities.assert_equals( expect=main.TRUE, actual=appResult,
789 onpass="Successfully install fwd app",
790 onfail="Failed to install fwd app" )
791
Jon Hallef0e2a12017-05-24 16:57:53 -0700792 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800793
Jon Hallef0e2a12017-05-24 16:57:53 -0700794 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800795 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700796 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800797 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
798 main.Mininet1.handle.expect( "mininet>" )
799 main.log.info( main.Mininet1.handle.before )
800
Jon Hallef0e2a12017-05-24 16:57:53 -0700801 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800802
803 main.log.info( hosts )
804
805 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700806 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800807 utilities.assert_equals( expect=main.TRUE, actual=appResult,
808 onpass="Successfully deactivated fwd app",
809 onfail="Failed to deactivate fwd app" )
810
811 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800812 """
813 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
814 """
GlennRC026dba62016-01-07 18:42:33 -0800815 import time
You Wang0779bac2016-01-27 16:32:33 -0800816 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800817 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800818 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800819
820 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700821 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800822 utilities.assert_equals( expect=main.TRUE, actual=appResult,
823 onpass="Successfully install fwd app",
824 onfail="Failed to install fwd app" )
825
Jon Hallef0e2a12017-05-24 16:57:53 -0700826 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800827
Jon Hallef0e2a12017-05-24 16:57:53 -0700828 for i in range( 11, numHosts + 10 ):
GlennRC026dba62016-01-07 18:42:33 -0800829 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -0700830 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800831 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
832 main.Mininet1.handle.expect( "mininet>" )
833 main.log.info( main.Mininet1.handle.before )
834
Jon Hallef0e2a12017-05-24 16:57:53 -0700835 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800836
837 main.log.info( hosts )
838
839 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700840 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800841 utilities.assert_equals( expect=main.TRUE, actual=appResult,
842 onpass="Successfully deactivated fwd app",
843 onfail="Failed to deactivate fwd app" )
844
Hari Krishna4223dbd2015-08-13 16:29:53 -0700845 def CASE140( self, main ):
846 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700847 Verify IPv6 Reactive forwarding ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700848 """
849 import re
850 import copy
851 import time
852 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
853 main.log.report( "______________________________________________" )
854 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700855 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700856
857 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700858 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
859 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700860 cfgResult = cfgResult1 and cfgResult2
861 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
862 onpass="Reactive mode ipv6Fowarding cfg is set to true",
863 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
864
865 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700866 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700867 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700868 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700869 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700870 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700871 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700872 time2 = time.time()
873 timeDiff = round( ( time2 - time1 ), 2 )
874 main.log.report(
875 "Time taken for IPv6 Ping All: " +
876 str( timeDiff ) +
877 " seconds" )
878
GlennRC626ba132015-09-18 16:16:31 -0700879 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700880 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
881 else:
882 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700883
Jon Hallef0e2a12017-05-24 16:57:53 -0700884 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700885 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700886 onpass="Reactive Mode IPv6 Pingall test PASS",
887 onfail="Reactive Mode IPv6 Pingall test FAIL" )
888
889 def CASE141( self, main ):
890 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700891 Verify IPv6 Reactive forwarding ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700892 """
893 import re
894 import copy
895 import time
896 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
897 main.log.report( "______________________________________________" )
898 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700899 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700900
901 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700902 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
903 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700904 cfgResult = cfgResult1 and cfgResult2
905 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
906 onpass="Reactive mode ipv6Fowarding cfg is set to true",
907 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
908
909 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700910 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700911 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700912 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700913 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700914 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700915 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700916 time2 = time.time()
917 timeDiff = round( ( time2 - time1 ), 2 )
918 main.log.report(
919 "Time taken for IPv6 Ping All: " +
920 str( timeDiff ) +
921 " seconds" )
922
GlennRC626ba132015-09-18 16:16:31 -0700923 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700924 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
925 else:
926 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
927
928 main.step( "Disable Reactive forwarding" )
929
930 main.log.info( "Uninstall reactive forwarding app" )
931 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700932 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700933 pool = []
934 for cli in main.CLIs:
935 t = main.Thread( target=cli.appToIDCheck,
936 name="appToIDCheck-" + str( i ),
937 args=[] )
938 pool.append( t )
939 t.start()
940
941 for t in pool:
942 t.join()
943 appCheck = appCheck and t.result
944 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
945 onpass="App Ids seem to be correct",
946 onfail="Something is wrong with app Ids" )
947 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700948 main.log.warn( main.CLIs[ 0 ].apps() )
949 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700950
951 # Waiting for reative flows to be cleared.
952 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -0700953 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700954 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700955 onpass="Reactive Mode IPv6 Pingall test PASS",
956 onfail="Reactive Mode IPv6 Pingall test FAIL" )
957
958 def CASE142( self, main ):
959 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700960 Verify IPv6 Reactive forwarding ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700961 """
962 import re
963 import copy
964 import time
965 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
966 main.log.report( "______________________________________________" )
967 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
968 # Spine topology do not have hosts h1-h10
Jon Hallef0e2a12017-05-24 16:57:53 -0700969 hostList = [ ( 'h' + str( x + 11 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700970 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700971 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
972 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700973 cfgResult = cfgResult1 and cfgResult2
974 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
975 onpass="Reactive mode ipv6Fowarding cfg is set to true",
976 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
977
978 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700979 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700980 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700981 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC558cd862015-10-08 09:54:04 -0700982 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700983 main.log.warn( "First pingall failed. Trying again..." )
GlennRC558cd862015-10-08 09:54:04 -0700984 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700985 time2 = time.time()
986 timeDiff = round( ( time2 - time1 ), 2 )
987 main.log.report(
988 "Time taken for IPv6 Ping All: " +
989 str( timeDiff ) +
990 " seconds" )
991
GlennRC626ba132015-09-18 16:16:31 -0700992 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700993 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
994 else:
995 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
996
997 main.step( "Disable Reactive forwarding" )
998
999 main.log.info( "Uninstall reactive forwarding app" )
1000 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001001 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001002 pool = []
1003 for cli in main.CLIs:
1004 t = main.Thread( target=cli.appToIDCheck,
1005 name="appToIDCheck-" + str( i ),
1006 args=[] )
1007 pool.append( t )
1008 t.start()
1009
1010 for t in pool:
1011 t.join()
1012 appCheck = appCheck and t.result
1013 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1014 onpass="App Ids seem to be correct",
1015 onfail="Something is wrong with app Ids" )
1016 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001017 main.log.warn( main.CLIs[ 0 ].apps() )
1018 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001019
1020 # Waiting for reative flows to be cleared.
1021 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -07001022 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -07001023 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001024 onpass="Reactive Mode IPv6 Pingall test PASS",
1025 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001026
You Wang0779bac2016-01-27 16:32:33 -08001027 def CASE147( self, main ):
1028 """
1029 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
1030 """
1031 import time
1032 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
1033 main.log.report( "______________________________________________" )
1034 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1035
1036 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001037 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001038 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1039 onpass="Successfully install fwd app",
1040 onfail="Failed to install fwd app" )
1041
1042 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001043 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1044 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001045 cfgResult = cfgResult1 and cfgResult2
1046 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1047 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1048 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1049
You Wangb6586542016-02-26 09:25:56 -08001050 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001051 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
1052 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -08001053 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -07001054 dest = "1000::" + str( i + 1 )
1055 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001056 main.Mininet1.handle.expect( "mininet>" )
1057 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001058 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001059 main.log.info( hosts )
1060
1061 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001062 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1063 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001064 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001065 pool = []
1066 for cli in main.CLIs:
1067 t = main.Thread( target=cli.appToIDCheck,
1068 name="appToIDCheck-" + str( i ),
1069 args=[] )
1070 pool.append( t )
1071 t.start()
1072
1073 for t in pool:
1074 t.join()
1075 appCheck = appCheck and t.result
1076 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1077 onpass="App Ids seem to be correct",
1078 onfail="Something is wrong with app Ids" )
1079
1080 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001081 main.log.warn( main.CLIs[ 0 ].apps() )
1082 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001083
1084 # Waiting for reative flows to be cleared.
1085 time.sleep( 30 )
1086
1087 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001088 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001089 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1090 onpass="Successfully deactivated IPv4 fwd app",
1091 onfail="Failed to deactivate IPv4 fwd app" )
1092
1093 def CASE148( self, main ):
1094 """
1095 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1096 """
1097 import time
1098 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1099 main.log.report( "______________________________________________" )
1100 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1101
1102 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001103 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001104 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1105 onpass="Successfully install fwd app",
1106 onfail="Failed to install fwd app" )
1107
1108 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001109 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1110 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001111 cfgResult = cfgResult1 and cfgResult2
1112 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1113 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1114 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1115
You Wangb6586542016-02-26 09:25:56 -08001116 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001117 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
1118 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -08001119 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -07001120 dest = "1000::" + str( i + 1 )
1121 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001122 main.Mininet1.handle.expect( "mininet>" )
1123 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001124 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001125 main.log.info( hosts )
1126
1127 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001128 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1129 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001130 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001131 pool = []
1132 for cli in main.CLIs:
1133 t = main.Thread( target=cli.appToIDCheck,
1134 name="appToIDCheck-" + str( i ),
1135 args=[] )
1136 pool.append( t )
1137 t.start()
1138
1139 for t in pool:
1140 t.join()
1141 appCheck = appCheck and t.result
1142 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1143 onpass="App Ids seem to be correct",
1144 onfail="Something is wrong with app Ids" )
1145
1146 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001147 main.log.warn( main.CLIs[ 0 ].apps() )
1148 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001149
1150 # Waiting for reative flows to be cleared.
1151 time.sleep( 30 )
1152
1153 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001154 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001155 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1156 onpass="Successfully deactivated IPv4 fwd app",
1157 onfail="Failed to deactivate IPv4 fwd app" )
1158
1159 def CASE149( self, main ):
1160 """
1161 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1162 """
1163 import time
1164 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1165 main.log.report( "______________________________________________" )
1166 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1167
1168 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001169 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001170 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1171 onpass="Successfully install fwd app",
1172 onfail="Failed to install fwd app" )
1173
1174 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001175 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1176 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001177 cfgResult = cfgResult1 and cfgResult2
1178 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1179 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1180 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1181
You Wangb6586542016-02-26 09:25:56 -08001182 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001183 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
1184 for i in range( 11, numHosts + 10 ):
You Wang0779bac2016-01-27 16:32:33 -08001185 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -07001186 dest = "1000::" + str( i + 1 )
1187 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001188 main.Mininet1.handle.expect( "mininet>" )
1189 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001190 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001191 main.log.info( hosts )
1192
1193 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001194 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1195 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001196 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001197 pool = []
1198 for cli in main.CLIs:
1199 t = main.Thread( target=cli.appToIDCheck,
1200 name="appToIDCheck-" + str( i ),
1201 args=[] )
1202 pool.append( t )
1203 t.start()
1204
1205 for t in pool:
1206 t.join()
1207 appCheck = appCheck and t.result
1208 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1209 onpass="App Ids seem to be correct",
1210 onfail="Something is wrong with app Ids" )
1211
1212 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001213 main.log.warn( main.CLIs[ 0 ].apps() )
1214 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001215
1216 # Waiting for reative flows to be cleared.
1217 time.sleep( 30 )
1218
1219 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001220 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001221 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1222 onpass="Successfully deactivated IPv4 fwd app",
1223 onfail="Failed to deactivate IPv4 fwd app" )
1224
Hari Krishnac195f3b2015-07-08 20:02:24 -07001225 def CASE5( self, main ):
1226 """
1227 Compare current ONOS topology with reference data
1228 """
1229 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001230
Hari Krishnac195f3b2015-07-08 20:02:24 -07001231 devicesDPIDTemp = []
1232 hostMACsTemp = []
1233 deviceLinksTemp = []
1234 deviceActiveLinksCountTemp = []
1235 devicePortsEnabledCountTemp = []
1236
1237 main.log.report(
1238 "Compare ONOS topology with reference data in Stores" )
1239 main.log.report( "__________________________________________________" )
1240 main.case( "Compare ONOS topology with reference data" )
1241
1242 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001243
Jon Hallef0e2a12017-05-24 16:57:53 -07001244 for check in range( main.topoCheck ):
GlennRC289c1b62015-12-12 10:45:43 -08001245 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001246 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRC289c1b62015-12-12 10:45:43 -08001247 pool = []
1248 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001249 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001250 break
GlennRC20fc6522015-12-23 23:26:57 -08001251 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001252 t = main.Thread( target=cli.getDevicePortsEnabledCount,
1253 threadID=main.threadID,
1254 name="getDevicePortsEnabledCount",
1255 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001256 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001257 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001258 i = i + 1
1259 main.threadID = main.threadID + 1
1260 for thread in pool:
1261 thread.join()
1262 portResult = thread.result
1263 #portTemp = re.split( r'\t+', portResult )
1264 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1265 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001266
GlennRC289c1b62015-12-12 10:45:43 -08001267 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001268 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
1269 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001270 "Device Enabled ports EXPECTED: %s" %
1271 str( main.devicePortsEnabledCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001272 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001273 "Device Enabled ports ACTUAL: %s" %
1274 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001275
GlennRC289c1b62015-12-12 10:45:43 -08001276 if ( cmp( main.devicePortsEnabledCount,
1277 devicePortsEnabledCountTemp ) == 0 ):
1278 stepResult1 = main.TRUE
1279 else:
1280 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001281
GlennRC289c1b62015-12-12 10:45:43 -08001282 main.step( "Compare Device active links with reference" )
1283 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001284 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRC289c1b62015-12-12 10:45:43 -08001285 pool = []
1286 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001287 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001288 break
GlennRC20fc6522015-12-23 23:26:57 -08001289 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001290 t = main.Thread( target=cli.getDeviceLinksActiveCount,
1291 threadID=main.threadID,
1292 name="getDeviceLinksActiveCount",
1293 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001294 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001295 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001296 i = i + 1
1297 main.threadID = main.threadID + 1
1298 for thread in pool:
1299 thread.join()
1300 linkCountResult = thread.result
1301 #linkCountTemp = re.split( r'\t+', linkCountResult )
1302 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1303 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001304
GlennRC289c1b62015-12-12 10:45:43 -08001305 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001306 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
1307 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001308 "Device Active links EXPECTED: %s" %
1309 str( main.deviceActiveLinksCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001310 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001311 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1312 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1313 stepResult2 = main.TRUE
1314 else:
1315 stepResult2 = main.FALSE
1316
1317 """
1318 place holder for comparing devices, hosts, paths and intents if required.
1319 Links and ports data would be incorrect with out devices anyways.
1320 """
1321 caseResult = ( stepResult1 and stepResult2 )
1322
1323 if caseResult:
1324 break
1325 else:
1326 time.sleep( main.topoCheckDelay )
1327 main.log.warn( "Topology check failed. Trying again..." )
1328
GlennRC289c1b62015-12-12 10:45:43 -08001329 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001330 onpass="Compare Topology test PASS",
1331 onfail="Compare Topology test FAIL" )
1332
1333 def CASE60( self ):
1334 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001335 Install 300 host intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001336 """
1337 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1338 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001339 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001340
Hari Krishnac195f3b2015-07-08 20:02:24 -07001341 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001342 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001343 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001344
Jon Hallef0e2a12017-05-24 16:57:53 -07001345 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001346 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001347 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1348 onpass="INTENTS INSTALLED",
1349 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001350
1351 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001352 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001353 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1354 onpass="PING ALL PASS",
1355 onfail="PING ALL FAIL" )
1356
GlennRCbddd58f2015-10-01 15:45:25 -07001357 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001358 utilities.assert_equals(
1359 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001360 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001361 onpass="Install 300 Host Intents and Ping All test PASS",
1362 onfail="Install 300 Host Intents and Ping All test FAIL" )
1363
GlennRCfcfdc4f2015-09-30 16:01:57 -07001364 if not intentState:
1365 main.log.debug( "Intents failed to install completely" )
1366 if not pingResult:
1367 main.log.debug( "Pingall failed" )
1368
GlennRCbddd58f2015-10-01 15:45:25 -07001369 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001370 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001371 main.stop( email=main.emailOnStop )
1372
Hari Krishnac195f3b2015-07-08 20:02:24 -07001373 def CASE61( self ):
1374 """
You Wang0779bac2016-01-27 16:32:33 -08001375 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001376 """
You Wang0779bac2016-01-27 16:32:33 -08001377 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001378 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001379 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001380
Hari Krishnac195f3b2015-07-08 20:02:24 -07001381 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001382 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001383 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001384
Jon Hallef0e2a12017-05-24 16:57:53 -07001385 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001386 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001387 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1388 onpass="INTENTS INSTALLED",
1389 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001390
1391 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001392 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001393 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1394 onpass="PING ALL PASS",
1395 onfail="PING ALL FAIL" )
1396
GlennRCbddd58f2015-10-01 15:45:25 -07001397 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001398 utilities.assert_equals( expect=main.TRUE,
1399 actual=caseResult,
1400 onpass="Install 300 Host Intents and Ping All test PASS",
1401 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001402
GlennRCfcfdc4f2015-09-30 16:01:57 -07001403 if not intentState:
1404 main.log.debug( "Intents failed to install completely" )
1405 if not pingResult:
1406 main.log.debug( "Pingall failed" )
1407
GlennRCbddd58f2015-10-01 15:45:25 -07001408 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001409 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001410 main.stop( email=main.emailOnStop )
1411
Hari Krishnac195f3b2015-07-08 20:02:24 -07001412 def CASE62( self ):
1413 """
1414 Install 2278 host intents and verify ping all for Spine Topology
1415 """
1416 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1417 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001418 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001419
You Wangb6586542016-02-26 09:25:56 -08001420 main.step( "Add host Intents" )
1421 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001422 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001423
Jon Hallef0e2a12017-05-24 16:57:53 -07001424 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001425 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001426 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1427 onpass="INTENTS INSTALLED",
1428 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001429
1430 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001431 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001432 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1433 onpass="PING ALL PASS",
1434 onfail="PING ALL FAIL" )
1435
GlennRCbddd58f2015-10-01 15:45:25 -07001436 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001437 utilities.assert_equals( expect=main.TRUE,
1438 actual=caseResult,
1439 onpass="Install 2278 Host Intents and Ping All test PASS",
1440 onfail="Install 2278 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001441
GlennRCfcfdc4f2015-09-30 16:01:57 -07001442 if not intentState:
1443 main.log.debug( "Intents failed to install completely" )
1444 if not pingResult:
1445 main.log.debug( "Pingall failed" )
1446
GlennRCbddd58f2015-10-01 15:45:25 -07001447 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001448 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001449 main.stop( email=main.emailOnStop )
1450
Hari Krishna4223dbd2015-08-13 16:29:53 -07001451 def CASE160( self ):
1452 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001453 Verify IPv6 ping across 300 host intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001454 """
1455 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1456 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001457 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001458
Hari Krishna4223dbd2015-08-13 16:29:53 -07001459 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001460 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1461 utilities.assert_equals( expect=main.TRUE,
1462 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001463 onpass="PING ALL PASS",
1464 onfail="PING ALL FAIL" )
1465
GlennRCbddd58f2015-10-01 15:45:25 -07001466 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001467 utilities.assert_equals(
1468 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001469 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001470 onpass="IPv6 Ping across 300 host intents test PASS",
1471 onfail="IPv6 Ping across 300 host intents test FAIL" )
1472
You Wangb6586542016-02-26 09:25:56 -08001473 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001474 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001475 main.stop( email=main.emailOnStop )
1476
Hari Krishna4223dbd2015-08-13 16:29:53 -07001477 def CASE161( self ):
1478 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001479 Verify IPv6 ping across 300 host intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001480 """
You Wang0779bac2016-01-27 16:32:33 -08001481 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001482 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001483 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001484
Hari Krishna4223dbd2015-08-13 16:29:53 -07001485 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001486 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001487 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1488 onpass="PING ALL PASS",
1489 onfail="PING ALL FAIL" )
1490
GlennRCbddd58f2015-10-01 15:45:25 -07001491 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001492 utilities.assert_equals(
1493 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001494 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001495 onpass="IPv6 Ping across 300 host intents test PASS",
1496 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001497
You Wangb6586542016-02-26 09:25:56 -08001498 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001499 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001500 main.stop( email=main.emailOnStop )
1501
Hari Krishna4223dbd2015-08-13 16:29:53 -07001502 def CASE162( self ):
1503 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001504 Verify IPv6 ping across 2278 host intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001505 """
1506 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1507 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001508 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001509
Hari Krishna4223dbd2015-08-13 16:29:53 -07001510 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001511 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001512 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1513 onpass="PING ALL PASS",
1514 onfail="PING ALL FAIL" )
1515
GlennRCbddd58f2015-10-01 15:45:25 -07001516 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001517 utilities.assert_equals(
1518 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001519 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001520 onpass="IPv6 Ping across 2278 host intents test PASS",
1521 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001522
You Wangb6586542016-02-26 09:25:56 -08001523 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001524 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001525 main.stop( email=main.emailOnStop )
1526
Hari Krishnac195f3b2015-07-08 20:02:24 -07001527 def CASE70( self, main ):
1528 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001529 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001530 """
1531 import random
1532 main.randomLink1 = []
1533 main.randomLink2 = []
1534 main.randomLink3 = []
1535 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1536 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1537 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1538 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1539 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1540 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1541 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001542
1543 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1544 main.log.report( "___________________________________________________________________________" )
1545 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1546 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1547 if ( int( switchLinksToToggle ) ==
1548 0 or int( switchLinksToToggle ) > 5 ):
1549 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1550 #main.cleanup()
1551 #main.exit()
1552 else:
1553 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1554
1555 main.step( "Cut links on Core devices using user provided range" )
1556 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1557 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1558 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1559 for i in range( int( switchLinksToToggle ) ):
1560 main.Mininet1.link(
1561 END1=link1End1,
1562 END2=main.randomLink1[ i ],
1563 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001564 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001565 main.Mininet1.link(
1566 END1=link2End1,
1567 END2=main.randomLink2[ i ],
1568 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001569 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001570 main.Mininet1.link(
1571 END1=link3End1,
1572 END2=main.randomLink3[ i ],
1573 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001574 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575
Jon Hallef0e2a12017-05-24 16:57:53 -07001576 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001577 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1578 int( main.numMNlinks ) -
1579 int( switchLinksToToggle ) * 6 )
1580 utilities.assert_equals( expect=main.TRUE,
1581 actual=linkDown,
1582 onpass="Link down discovered properly",
1583 onfail="Link down was not discovered in " +
1584 str( main.linkSleep * main.linkCheck ) +
1585 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001586
Jon Hallef0e2a12017-05-24 16:57:53 -07001587 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001588 intentState = main.CHOtestFunctions.checkIntents()
1589 utilities.assert_equals( expect=main.TRUE,
1590 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001591 onpass="INTENTS INSTALLED",
1592 onfail="SOME INTENTS NOT INSTALLED" )
1593
Hari Krishnac195f3b2015-07-08 20:02:24 -07001594 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001595 pingResult = main.CHOtestFunctions.checkPingall()
1596 utilities.assert_equals( expect=main.TRUE,
1597 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001598 onpass="PING ALL PASS",
1599 onfail="PING ALL FAIL" )
1600
GlennRCbddd58f2015-10-01 15:45:25 -07001601 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001602 utilities.assert_equals( expect=main.TRUE,
1603 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001604 onpass="Random Link cut Test PASS",
1605 onfail="Random Link cut Test FAIL" )
1606
GlennRCfcfdc4f2015-09-30 16:01:57 -07001607 # Printing what exactly failed
1608 if not linkDown:
1609 main.log.debug( "Link down was not discovered correctly" )
1610 if not pingResult:
1611 main.log.debug( "Pingall failed" )
1612 if not intentState:
1613 main.log.debug( "Intents are not all installed" )
1614
GlennRCbddd58f2015-10-01 15:45:25 -07001615 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001616 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001617 main.stop( email=main.emailOnStop )
1618
Hari Krishnac195f3b2015-07-08 20:02:24 -07001619 def CASE80( self, main ):
1620 """
1621 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1622 """
1623 import random
1624 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1625 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1626 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001627 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001628 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1629
1630 main.log.report(
1631 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1632 main.log.report(
1633 "__________________________________________________________________" )
1634 main.case(
1635 "Host intents - Bring the core links up that are down and verify ping all" )
1636 main.step( "Bring randomly cut links on Core devices up" )
1637 for i in range( int( switchLinksToToggle ) ):
1638 main.Mininet1.link(
1639 END1=link1End1,
1640 END2=main.randomLink1[ i ],
1641 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001642 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001643 main.Mininet1.link(
1644 END1=link2End1,
1645 END2=main.randomLink2[ i ],
1646 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001647 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001648 main.Mininet1.link(
1649 END1=link3End1,
1650 END2=main.randomLink3[ i ],
1651 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001652 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001653
Jon Hallef0e2a12017-05-24 16:57:53 -07001654 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001655 linkUp = main.CHOtestFunctions.checkLinkEvents( "up",
1656 int( main.numMNlinks ) )
1657 utilities.assert_equals( expect=main.TRUE,
1658 actual=linkUp,
1659 onpass="Link up discovered properly",
1660 onfail="Link up was not discovered in " +
1661 str( main.linkSleep * main.linkCheck ) +
1662 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001663
Jon Hallef0e2a12017-05-24 16:57:53 -07001664 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001665 intentState = main.CHOtestFunctions.checkIntents()
1666 utilities.assert_equals( expect=main.TRUE,
1667 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001668 onpass="INTENTS INSTALLED",
1669 onfail="SOME INTENTS NOT INSTALLED" )
1670
Hari Krishnac195f3b2015-07-08 20:02:24 -07001671 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001672 pingResult = main.CHOtestFunctions.checkPingall()
1673 utilities.assert_equals( expect=main.TRUE,
1674 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001675 onpass="PING ALL PASS",
1676 onfail="PING ALL FAIL" )
1677
GlennRCbddd58f2015-10-01 15:45:25 -07001678 caseResult = linkUp and pingResult
1679 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001680 onpass="Link Up Test PASS",
1681 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001682 # Printing what exactly failed
1683 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001684 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001685 if not pingResult:
1686 main.log.debug( "Pingall failed" )
1687 if not intentState:
1688 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001689
GlennRCbddd58f2015-10-01 15:45:25 -07001690 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001691 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001692 main.stop( email=main.emailOnStop )
1693
Hari Krishnac195f3b2015-07-08 20:02:24 -07001694 def CASE71( self, main ):
1695 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001696 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001697 """
1698 import random
1699 main.randomLink1 = []
1700 main.randomLink2 = []
1701 main.randomLink3 = []
1702 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1703 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1704 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1705 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1706 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1707 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1708 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
You Wangb6586542016-02-26 09:25:56 -08001709 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001710
1711 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1712 main.log.report( "___________________________________________________________________________" )
1713 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1714 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1715 if ( int( switchLinksToToggle ) ==
1716 0 or int( switchLinksToToggle ) > 5 ):
1717 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1718 #main.cleanup()
1719 #main.exit()
1720 else:
1721 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1722
1723 main.step( "Cut links on Core devices using user provided range" )
1724 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1725 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1726 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1727 for i in range( int( switchLinksToToggle ) ):
1728 main.Mininet1.link(
1729 END1=link1End1,
1730 END2=main.randomLink1[ i ],
1731 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001732 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001733 main.Mininet1.link(
1734 END1=link2End1,
1735 END2=main.randomLink2[ i ],
1736 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001737 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001738 main.Mininet1.link(
1739 END1=link3End1,
1740 END2=main.randomLink3[ i ],
1741 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001742 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001743
Jon Hallef0e2a12017-05-24 16:57:53 -07001744 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001745 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1746 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 )
1747 utilities.assert_equals( expect=main.TRUE,
1748 actual=linkDown,
1749 onpass="Link down discovered properly",
1750 onfail="Link down was not discovered in " +
1751 str( main.linkSleep * main.linkCheck ) +
1752 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001753
Jon Hallef0e2a12017-05-24 16:57:53 -07001754 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001755 intentState = main.CHOtestFunctions.checkIntents()
1756 utilities.assert_equals( expect=main.TRUE,
1757 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001758 onpass="INTENTS INSTALLED",
1759 onfail="SOME INTENTS NOT INSTALLED" )
1760
Hari Krishnac195f3b2015-07-08 20:02:24 -07001761 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001762 pingResult = main.CHOtestFunctions.checkPingall()
1763 utilities.assert_equals( expect=main.TRUE,
1764 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001765 onpass="PING ALL PASS",
1766 onfail="PING ALL FAIL" )
1767
GlennRCbddd58f2015-10-01 15:45:25 -07001768 caseResult = linkDown and pingResult and intentState
1769 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001770 onpass="Random Link cut Test PASS",
1771 onfail="Random Link cut Test FAIL" )
1772
GlennRCfcfdc4f2015-09-30 16:01:57 -07001773 # Printing what exactly failed
1774 if not linkDown:
1775 main.log.debug( "Link down was not discovered correctly" )
1776 if not pingResult:
1777 main.log.debug( "Pingall failed" )
1778 if not intentState:
1779 main.log.debug( "Intents are not all installed" )
1780
GlennRCbddd58f2015-10-01 15:45:25 -07001781 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001782 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001783 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001784
Hari Krishnac195f3b2015-07-08 20:02:24 -07001785 def CASE81( self, main ):
1786 """
1787 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1788 """
1789 import random
1790 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1791 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1792 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001793 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1795
1796 main.log.report(
1797 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1798 main.log.report(
1799 "__________________________________________________________________" )
1800 main.case(
1801 "Point intents - Bring the core links up that are down and verify ping all" )
1802 main.step( "Bring randomly cut links on Core devices up" )
1803 for i in range( int( switchLinksToToggle ) ):
1804 main.Mininet1.link(
1805 END1=link1End1,
1806 END2=main.randomLink1[ i ],
1807 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001808 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001809 main.Mininet1.link(
1810 END1=link2End1,
1811 END2=main.randomLink2[ i ],
1812 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001813 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001814 main.Mininet1.link(
1815 END1=link3End1,
1816 END2=main.randomLink3[ i ],
1817 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001818 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001819
Jon Hallef0e2a12017-05-24 16:57:53 -07001820 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001821 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1822 utilities.assert_equals( expect=main.TRUE,
1823 actual=linkUp,
1824 onpass="Link up discovered properly",
1825 onfail="Link up was not discovered in " +
1826 str( main.linkSleep * main.linkCheck ) +
1827 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001828
Jon Hallef0e2a12017-05-24 16:57:53 -07001829 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001830 intentState = main.CHOtestFunctions.checkIntents()
1831 utilities.assert_equals( expect=main.TRUE,
1832 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001833 onpass="INTENTS INSTALLED",
1834 onfail="SOME INTENTS NOT INSTALLED" )
1835
Hari Krishnac195f3b2015-07-08 20:02:24 -07001836 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001837 pingResult = main.CHOtestFunctions.checkPingall()
1838 utilities.assert_equals( expect=main.TRUE,
1839 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001840 onpass="PING ALL PASS",
1841 onfail="PING ALL FAIL" )
1842
GlennRCbddd58f2015-10-01 15:45:25 -07001843 caseResult = linkUp and pingResult
1844 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001845 onpass="Link Up Test PASS",
1846 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001847 # Printing what exactly failed
1848 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001849 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001850 if not pingResult:
1851 main.log.debug( "Pingall failed" )
1852 if not intentState:
1853 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001854
GlennRCbddd58f2015-10-01 15:45:25 -07001855 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001856 main.log.report( "Stopping test" )
GlennRC884dc9e2015-10-09 15:53:20 -07001857 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001858
Hari Krishnac195f3b2015-07-08 20:02:24 -07001859 def CASE72( self, main ):
1860 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001861 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001862 """
1863 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001864 import itertools
You Wangb6586542016-02-26 09:25:56 -08001865 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001866
Hari Krishnac195f3b2015-07-08 20:02:24 -07001867 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1868 main.log.report( "___________________________________________________________________________" )
1869 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1870 switches = []
1871 switchesComb = []
1872 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -07001873 switches.append( 's%d' % ( i + 1 ) )
1874 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1875 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001876 print main.randomLinks
1877 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001878
Hari Krishnac195f3b2015-07-08 20:02:24 -07001879 for switch in main.randomLinks:
1880 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001881 END1=switch[ 0 ],
1882 END2=switch[ 1 ],
1883 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001884 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001885
Jon Hallef0e2a12017-05-24 16:57:53 -07001886 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001887 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1888 utilities.assert_equals( expect=main.TRUE,
1889 actual=linkDown,
1890 onpass="Link down discovered properly",
1891 onfail="Link down was not discovered in " +
1892 str( main.linkSleep * main.linkCheck ) +
1893 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001894
Jon Hallef0e2a12017-05-24 16:57:53 -07001895 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001896 intentState = main.CHOtestFunctions.checkIntents()
1897 utilities.assert_equals( expect=main.TRUE,
1898 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001899 onpass="INTENTS INSTALLED",
1900 onfail="SOME INTENTS NOT INSTALLED" )
1901
Hari Krishnac195f3b2015-07-08 20:02:24 -07001902 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001903 pingResult = main.CHOtestFunctions.checkPingall()
1904 utilities.assert_equals( expect=main.TRUE,
1905 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001906 onpass="PING ALL PASS",
1907 onfail="PING ALL FAIL" )
1908
GlennRCbddd58f2015-10-01 15:45:25 -07001909 caseResult = linkDown and pingResult and intentState
1910 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001911 onpass="Random Link cut Test PASS",
1912 onfail="Random Link cut Test FAIL" )
1913
GlennRCfcfdc4f2015-09-30 16:01:57 -07001914 # Printing what exactly failed
1915 if not linkDown:
1916 main.log.debug( "Link down was not discovered correctly" )
1917 if not pingResult:
1918 main.log.debug( "Pingall failed" )
1919 if not intentState:
1920 main.log.debug( "Intents are not all installed" )
1921
GlennRCbddd58f2015-10-01 15:45:25 -07001922 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001923 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001924 main.stop( email=main.emailOnStop )
1925
Hari Krishnac195f3b2015-07-08 20:02:24 -07001926 def CASE82( self, main ):
1927 """
1928 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1929 """
1930 import random
You Wangb6586542016-02-26 09:25:56 -08001931 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001932
Hari Krishnac195f3b2015-07-08 20:02:24 -07001933 main.log.report(
1934 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1935 main.log.report(
1936 "__________________________________________________________________" )
1937 main.case(
1938 "Host intents - Bring the core links up that are down and verify ping all" )
1939 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001940
Hari Krishnac195f3b2015-07-08 20:02:24 -07001941 for switch in main.randomLinks:
1942 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001943 END1=switch[ 0 ],
1944 END2=switch[ 1 ],
1945 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001946 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001947
Jon Hallef0e2a12017-05-24 16:57:53 -07001948 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001949 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1950 utilities.assert_equals( expect=main.TRUE,
1951 actual=linkUp,
1952 onpass="Link up discovered properly",
1953 onfail="Link up was not discovered in " +
1954 str( main.linkSleep * main.linkCheck ) +
1955 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001956
Jon Hallef0e2a12017-05-24 16:57:53 -07001957 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001958 intentState = main.CHOtestFunctions.checkIntents()
1959 utilities.assert_equals( expect=main.TRUE,
1960 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001961 onpass="INTENTS INSTALLED",
1962 onfail="SOME INTENTS NOT INSTALLED" )
1963
Hari Krishnac195f3b2015-07-08 20:02:24 -07001964 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001965 pingResult = main.CHOtestFunctions.checkPingall()
1966 utilities.assert_equals( expect=main.TRUE,
1967 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001968 onpass="PING ALL PASS",
1969 onfail="PING ALL FAIL" )
1970
GlennRCbddd58f2015-10-01 15:45:25 -07001971 caseResult = linkUp and pingResult
1972 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001973 onpass="Link Up Test PASS",
1974 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001975 # Printing what exactly failed
1976 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001977 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001978 if not pingResult:
1979 main.log.debug( "Pingall failed" )
1980 if not intentState:
1981 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001982
GlennRCbddd58f2015-10-01 15:45:25 -07001983 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001984 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001985 main.stop( email=main.emailOnStop )
1986
Hari Krishnac195f3b2015-07-08 20:02:24 -07001987 def CASE73( self, main ):
1988 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001989 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001990 """
1991 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001992 import itertools
You Wangb6586542016-02-26 09:25:56 -08001993 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001994
Hari Krishnac195f3b2015-07-08 20:02:24 -07001995 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1996 main.log.report( "___________________________________________________________________________" )
1997 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1998 switches = []
1999 switchesComb = []
2000 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -07002001 switches.append( 's%d' % ( i + 1 ) )
2002 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
2003 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002004 print main.randomLinks
2005 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002006
Hari Krishnac195f3b2015-07-08 20:02:24 -07002007 for switch in main.randomLinks:
2008 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07002009 END1=switch[ 0 ],
2010 END2=switch[ 1 ],
2011 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002012 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002013
Jon Hallef0e2a12017-05-24 16:57:53 -07002014 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002015 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
2016 utilities.assert_equals( expect=main.TRUE,
2017 actual=linkDown,
2018 onpass="Link down discovered properly",
2019 onfail="Link down was not discovered in " +
2020 str( main.linkSleep * main.linkCheck ) +
2021 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002022
Jon Hallef0e2a12017-05-24 16:57:53 -07002023 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002024 intentState = main.CHOtestFunctions.checkIntents()
2025 utilities.assert_equals( expect=main.TRUE,
2026 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002027 onpass="INTENTS INSTALLED",
2028 onfail="SOME INTENTS NOT INSTALLED" )
2029
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002031 pingResult = main.CHOtestFunctions.checkPingall()
2032 utilities.assert_equals( expect=main.TRUE,
2033 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002034 onpass="PING ALL PASS",
2035 onfail="PING ALL FAIL" )
2036
GlennRCbddd58f2015-10-01 15:45:25 -07002037 caseResult = linkDown and pingResult and intentState
2038 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002039 onpass="Random Link cut Test PASS",
2040 onfail="Random Link cut Test FAIL" )
2041
GlennRCfcfdc4f2015-09-30 16:01:57 -07002042 # Printing what exactly failed
2043 if not linkDown:
2044 main.log.debug( "Link down was not discovered correctly" )
2045 if not pingResult:
2046 main.log.debug( "Pingall failed" )
2047 if not intentState:
2048 main.log.debug( "Intents are not all installed" )
2049
GlennRCbddd58f2015-10-01 15:45:25 -07002050 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002051 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002052 main.stop( email=main.emailOnStop )
2053
Hari Krishnac195f3b2015-07-08 20:02:24 -07002054 def CASE83( self, main ):
2055 """
2056 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2057 """
2058 import random
You Wangb6586542016-02-26 09:25:56 -08002059 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002060
Hari Krishnac195f3b2015-07-08 20:02:24 -07002061 main.log.report(
2062 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2063 main.log.report(
2064 "__________________________________________________________________" )
2065 main.case(
2066 "Point intents - Bring the core links up that are down and verify ping all" )
2067 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002068
Hari Krishnac195f3b2015-07-08 20:02:24 -07002069 for switch in main.randomLinks:
2070 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07002071 END1=switch[ 0 ],
2072 END2=switch[ 1 ],
2073 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002074 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002075
Jon Hallef0e2a12017-05-24 16:57:53 -07002076 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002077 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2078 utilities.assert_equals( expect=main.TRUE,
2079 actual=linkUp,
2080 onpass="Link up discovered properly",
2081 onfail="Link up was not discovered in " +
2082 str( main.linkSleep * main.linkCheck ) +
2083 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002084
Jon Hallef0e2a12017-05-24 16:57:53 -07002085 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002086 intentState = main.CHOtestFunctions.checkIntents()
2087 utilities.assert_equals( expect=main.TRUE,
2088 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002089 onpass="INTENTS INSTALLED",
2090 onfail="SOME INTENTS NOT INSTALLED" )
2091
Hari Krishnac195f3b2015-07-08 20:02:24 -07002092 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002093 pingResult = main.CHOtestFunctions.checkPingall()
2094 utilities.assert_equals( expect=main.TRUE,
2095 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002096 onpass="PING ALL PASS",
2097 onfail="PING ALL FAIL" )
2098
GlennRCbddd58f2015-10-01 15:45:25 -07002099 caseResult = linkUp and pingResult
2100 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002101 onpass="Link Up Test PASS",
2102 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002103 # Printing what exactly failed
2104 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002105 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002106 if not pingResult:
2107 main.log.debug( "Pingall failed" )
2108 if not intentState:
2109 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002110
GlennRCbddd58f2015-10-01 15:45:25 -07002111 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002112 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002113 main.stop( email=main.emailOnStop )
2114
Hari Krishnac195f3b2015-07-08 20:02:24 -07002115 def CASE74( self, main ):
2116 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002117 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002118 """
2119 import random
2120 main.randomLink1 = []
2121 main.randomLink2 = []
2122 main.randomLink3 = []
2123 main.randomLink4 = []
2124 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2125 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2126 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2127 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2128 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2129 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002130 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002131
Hari Krishnac195f3b2015-07-08 20:02:24 -07002132 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2133 main.log.report( "___________________________________________________________________________" )
Jon Hall6509dbf2016-06-21 17:01:17 -07002134 main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002135
2136 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002137 linkIndex = range( 4 )
2138 linkIndexS9 = random.sample( linkIndex, 1 )[ 0 ]
2139 linkIndex.remove( linkIndexS9 )
2140 linkIndexS10 = random.sample( linkIndex, 1 )[ 0 ]
2141 main.randomLink1 = link1End2top[ linkIndexS9 ]
2142 main.randomLink2 = link2End2top[ linkIndexS10 ]
2143 main.randomLink3 = random.sample( link1End2bot, 1 )[ 0 ]
2144 main.randomLink4 = random.sample( link2End2bot, 1 )[ 0 ]
Hari Krishna6185fc12015-07-13 15:42:31 -07002145
2146 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002147 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2148 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2149 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002150 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002151 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002152 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002153
You Wangb6586542016-02-26 09:25:56 -08002154 main.step( "Verify link down is discoverd by onos" )
2155 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2156 utilities.assert_equals( expect=main.TRUE,
2157 actual=linkDown,
2158 onpass="Link down discovered properly",
2159 onfail="Link down was not discovered in " +
2160 str( main.linkSleep * main.linkCheck ) +
2161 " seconds" )
You Wang0779bac2016-01-27 16:32:33 -08002162
You Wangb6586542016-02-26 09:25:56 -08002163 main.step( "Verify intents are installed" )
2164 intentState = main.CHOtestFunctions.checkIntents()
2165 utilities.assert_equals( expect=main.TRUE,
2166 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002167 onpass="INTENTS INSTALLED",
2168 onfail="SOME INTENTS NOT INSTALLED" )
2169
Hari Krishnac195f3b2015-07-08 20:02:24 -07002170 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002171 pingResult = main.CHOtestFunctions.checkPingall()
2172 utilities.assert_equals( expect=main.TRUE,
2173 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002174 onpass="PING ALL PASS",
2175 onfail="PING ALL FAIL" )
2176
GlennRCbddd58f2015-10-01 15:45:25 -07002177 caseResult = linkDown and pingResult and intentState
2178 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002179 onpass="Random Link cut Test PASS",
2180 onfail="Random Link cut Test FAIL" )
2181
GlennRCfcfdc4f2015-09-30 16:01:57 -07002182 # Printing what exactly failed
2183 if not linkDown:
2184 main.log.debug( "Link down was not discovered correctly" )
2185 if not pingResult:
2186 main.log.debug( "Pingall failed" )
2187 if not intentState:
2188 main.log.debug( "Intents are not all installed" )
2189
GlennRCbddd58f2015-10-01 15:45:25 -07002190 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002191 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002192 main.stop( email=main.emailOnStop )
2193
Hari Krishnac195f3b2015-07-08 20:02:24 -07002194 def CASE84( self, main ):
2195 """
2196 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2197 """
2198 import random
2199 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2200 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002201 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002202 main.log.report(
2203 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2204 main.log.report(
2205 "__________________________________________________________________" )
2206 main.case(
2207 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002208
You Wang0779bac2016-01-27 16:32:33 -08002209 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002210 # Work around for link state propagation delay. Added some sleep time.
2211 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2212 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002213 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002214 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002215 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002216 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002217
Jon Hallef0e2a12017-05-24 16:57:53 -07002218 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002219 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2220 utilities.assert_equals( expect=main.TRUE,
2221 actual=linkUp,
2222 onpass="Link up discovered properly",
2223 onfail="Link up was not discovered in " +
2224 str( main.linkSleep * main.linkCheck ) +
2225 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002226
Jon Hallef0e2a12017-05-24 16:57:53 -07002227 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002228 intentState = main.CHOtestFunctions.checkIntents()
2229 utilities.assert_equals( expect=main.TRUE,
2230 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002231 onpass="INTENTS INSTALLED",
2232 onfail="SOME INTENTS NOT INSTALLED" )
2233
Hari Krishnac195f3b2015-07-08 20:02:24 -07002234 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002235 pingResult = main.CHOtestFunctions.checkPingall()
2236 utilities.assert_equals( expect=main.TRUE,
2237 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002238 onpass="PING ALL PASS",
2239 onfail="PING ALL FAIL" )
2240
GlennRCbddd58f2015-10-01 15:45:25 -07002241 caseResult = linkUp and pingResult
2242 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002243 onpass="Link Up Test PASS",
2244 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002245 # Printing what exactly failed
2246 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002247 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002248 if not pingResult:
2249 main.log.debug( "Pingall failed" )
2250 if not intentState:
2251 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002252
GlennRCbddd58f2015-10-01 15:45:25 -07002253 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002254 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002255 main.stop( email=main.emailOnStop )
2256
Hari Krishnab79d0822015-08-20 09:48:43 -07002257 def CASE75( self, main ):
2258 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002259 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo )
Hari Krishnab79d0822015-08-20 09:48:43 -07002260 """
2261 import random
2262 main.randomLink1 = []
2263 main.randomLink2 = []
2264 main.randomLink3 = []
2265 main.randomLink4 = []
2266 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2267 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2268 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2269 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2270 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2271 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002272 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002273
2274 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2275 main.log.report( "___________________________________________________________________________" )
2276 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002277
2278 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002279 linkIndex = range( 4 )
2280 linkIndexS9 = random.sample( linkIndex, 1 )[ 0 ]
2281 linkIndex.remove( linkIndexS9 )
2282 linkIndexS10 = random.sample( linkIndex, 1 )[ 0 ]
2283 main.randomLink1 = link1End2top[ linkIndexS9 ]
2284 main.randomLink2 = link2End2top[ linkIndexS10 ]
2285 main.randomLink3 = random.sample( link1End2bot, 1 )[ 0 ]
2286 main.randomLink4 = random.sample( link2End2bot, 1 )[ 0 ]
Hari Krishnab79d0822015-08-20 09:48:43 -07002287
2288 # Work around for link state propagation delay. Added some sleep time.
2289 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2290 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2291 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002292 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002293 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002294 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002295
Jon Hallef0e2a12017-05-24 16:57:53 -07002296 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002297 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2298 utilities.assert_equals( expect=main.TRUE,
2299 actual=linkDown,
2300 onpass="Link down discovered properly",
2301 onfail="Link down was not discovered in " +
2302 str( main.linkSleep * main.linkCheck ) +
2303 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002304
Jon Hallef0e2a12017-05-24 16:57:53 -07002305 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002306 intentState = main.CHOtestFunctions.checkIntents()
2307 utilities.assert_equals( expect=main.TRUE,
2308 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002309 onpass="INTENTS INSTALLED",
2310 onfail="SOME INTENTS NOT INSTALLED" )
2311
Hari Krishnab79d0822015-08-20 09:48:43 -07002312 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002313 pingResult = main.CHOtestFunctions.checkPingall()
2314 utilities.assert_equals( expect=main.TRUE,
2315 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002316 onpass="PING ALL PASS",
2317 onfail="PING ALL FAIL" )
2318
GlennRCbddd58f2015-10-01 15:45:25 -07002319 caseResult = linkDown and pingResult and intentState
2320 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002321 onpass="Random Link cut Test PASS",
2322 onfail="Random Link cut Test FAIL" )
2323
GlennRCfcfdc4f2015-09-30 16:01:57 -07002324 # Printing what exactly failed
2325 if not linkDown:
2326 main.log.debug( "Link down was not discovered correctly" )
2327 if not pingResult:
2328 main.log.debug( "Pingall failed" )
2329 if not intentState:
2330 main.log.debug( "Intents are not all installed" )
2331
GlennRCbddd58f2015-10-01 15:45:25 -07002332 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002333 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002334 main.stop( email=main.emailOnStop )
2335
Hari Krishnab79d0822015-08-20 09:48:43 -07002336 def CASE85( self, main ):
2337 """
2338 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2339 """
2340 import random
2341 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2342 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002343 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002344 main.log.report(
2345 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2346 main.log.report(
2347 "__________________________________________________________________" )
2348 main.case(
2349 "Point intents - Bring the core links up that are down and verify ping all" )
2350
You Wang0779bac2016-01-27 16:32:33 -08002351 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002352 # Work around for link state propagation delay. Added some sleep time.
2353 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2354 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2355 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002356 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002357 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002358 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002359
Jon Hallef0e2a12017-05-24 16:57:53 -07002360 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002361 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2362 utilities.assert_equals( expect=main.TRUE,
2363 actual=linkUp,
2364 onpass="Link up discovered properly",
2365 onfail="Link up was not discovered in " +
2366 str( main.linkSleep * main.linkCheck ) +
2367 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002368
Jon Hallef0e2a12017-05-24 16:57:53 -07002369 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002370 intentState = main.CHOtestFunctions.checkIntents()
2371 utilities.assert_equals( expect=main.TRUE,
2372 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002373 onpass="INTENTS INSTALLED",
2374 onfail="SOME INTENTS NOT INSTALLED" )
2375
Hari Krishnab79d0822015-08-20 09:48:43 -07002376 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002377 pingResult = main.CHOtestFunctions.checkPingall()
2378 utilities.assert_equals( expect=main.TRUE,
2379 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002380 onpass="PING ALL PASS",
2381 onfail="PING ALL FAIL" )
2382
GlennRCbddd58f2015-10-01 15:45:25 -07002383 caseResult = linkUp and pingResult
2384 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002385 onpass="Link Up Test PASS",
2386 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002387 # Printing what exactly failed
2388 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002389 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002390 if not pingResult:
2391 main.log.debug( "Pingall failed" )
2392 if not intentState:
2393 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002394
GlennRCbddd58f2015-10-01 15:45:25 -07002395 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002396 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002397 main.stop( email=main.emailOnStop )
2398
Hari Krishna4223dbd2015-08-13 16:29:53 -07002399 def CASE170( self ):
2400 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002401 IPv6 ping all with some core links down( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002402 """
2403 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2404 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002405 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002406
Hari Krishna4223dbd2015-08-13 16:29:53 -07002407 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002408 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2409 utilities.assert_equals( expect=main.TRUE,
2410 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002411 onpass="PING ALL PASS",
2412 onfail="PING ALL FAIL" )
2413
GlennRCbddd58f2015-10-01 15:45:25 -07002414 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002415 utilities.assert_equals(
2416 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002417 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002418 onpass="IPv6 Ping across 300 host intents test PASS",
2419 onfail="IPv6 Ping across 300 host intents test FAIL" )
2420
You Wangb6586542016-02-26 09:25:56 -08002421 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002422 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002423 main.stop( email=main.emailOnStop )
2424
Hari Krishna4223dbd2015-08-13 16:29:53 -07002425 def CASE180( self ):
2426 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002427 IPv6 ping all with after core links back up( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002428 """
2429 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2430 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002431 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002432
Hari Krishna4223dbd2015-08-13 16:29:53 -07002433 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002434 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2435 utilities.assert_equals( expect=main.TRUE,
2436 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002437 onpass="PING ALL PASS",
2438 onfail="PING ALL FAIL" )
2439
GlennRCbddd58f2015-10-01 15:45:25 -07002440 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002441 utilities.assert_equals(
2442 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002443 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002444 onpass="IPv6 Ping across 300 host intents test PASS",
2445 onfail="IPv6 Ping across 300 host intents test FAIL" )
2446
You Wangb6586542016-02-26 09:25:56 -08002447 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002448 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002449 main.stop( email=main.emailOnStop )
2450
Hari Krishna4223dbd2015-08-13 16:29:53 -07002451 def CASE171( self ):
2452 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002453 IPv6 ping all with some core links down( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002454 """
2455 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2456 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002457 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002458
Hari Krishna4223dbd2015-08-13 16:29:53 -07002459 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002460 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2461 utilities.assert_equals( expect=main.TRUE,
2462 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002463 onpass="PING ALL PASS",
2464 onfail="PING ALL FAIL" )
2465
GlennRCbddd58f2015-10-01 15:45:25 -07002466 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002467 utilities.assert_equals(
2468 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002469 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002470 onpass="IPv6 Ping across 600 point intents test PASS",
2471 onfail="IPv6 Ping across 600 point intents test FAIL" )
2472
You Wangb6586542016-02-26 09:25:56 -08002473 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002474 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002475 main.stop( email=main.emailOnStop )
2476
Hari Krishna4223dbd2015-08-13 16:29:53 -07002477 def CASE181( self ):
2478 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002479 IPv6 ping all with after core links back up( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002480 """
2481 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2482 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002483 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002484
Hari Krishna4223dbd2015-08-13 16:29:53 -07002485 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002486 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2487 utilities.assert_equals( expect=main.TRUE,
2488 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002489 onpass="PING ALL PASS",
2490 onfail="PING ALL FAIL" )
2491
GlennRCbddd58f2015-10-01 15:45:25 -07002492 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002493 utilities.assert_equals(
2494 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002495 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002496 onpass="IPv6 Ping across 600 Point intents test PASS",
2497 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2498
You Wangb6586542016-02-26 09:25:56 -08002499 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002500 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002501 main.stop( email=main.emailOnStop )
2502
Hari Krishna4223dbd2015-08-13 16:29:53 -07002503 def CASE172( self ):
2504 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002505 IPv6 ping all with some core links down( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002506 """
2507 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2508 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002509 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002510
Hari Krishna4223dbd2015-08-13 16:29:53 -07002511 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002512 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2513 utilities.assert_equals( expect=main.TRUE,
2514 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002515 onpass="PING ALL PASS",
2516 onfail="PING ALL FAIL" )
2517
GlennRCbddd58f2015-10-01 15:45:25 -07002518 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002519 utilities.assert_equals(
2520 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002521 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002522 onpass="IPv6 Ping across 300 host intents test PASS",
2523 onfail="IPv6 Ping across 300 host intents test FAIL" )
2524
2525 def CASE182( self ):
2526 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002527 IPv6 ping all with after core links back up( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002528 """
2529 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2530 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002531 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002532
Hari Krishna4223dbd2015-08-13 16:29:53 -07002533 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002534 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2535 utilities.assert_equals( expect=main.TRUE,
2536 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002537 onpass="PING ALL PASS",
2538 onfail="PING ALL FAIL" )
2539
GlennRCbddd58f2015-10-01 15:45:25 -07002540 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002541 utilities.assert_equals(
2542 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002543 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002544 onpass="IPv6 Ping across 300 host intents test PASS",
2545 onfail="IPv6 Ping across 300 host intents test FAIL" )
2546
You Wangb6586542016-02-26 09:25:56 -08002547 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002548 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002549 main.stop( email=main.emailOnStop )
2550
Hari Krishna4223dbd2015-08-13 16:29:53 -07002551 def CASE173( self ):
2552 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002553 IPv6 ping all with some core links down( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002554 """
2555 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2556 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002557 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002558
Hari Krishna4223dbd2015-08-13 16:29:53 -07002559 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002560 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2561 utilities.assert_equals( expect=main.TRUE,
2562 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002563 onpass="PING ALL PASS",
2564 onfail="PING ALL FAIL" )
2565
GlennRCbddd58f2015-10-01 15:45:25 -07002566 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002567 utilities.assert_equals(
2568 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002569 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002570 onpass="IPv6 Ping across 600 point intents test PASS",
2571 onfail="IPv6 Ping across 600 point intents test FAIL" )
2572
You Wangb6586542016-02-26 09:25:56 -08002573 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002574 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002575 main.stop( email=main.emailOnStop )
2576
Hari Krishna4223dbd2015-08-13 16:29:53 -07002577 def CASE183( self ):
2578 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002579 IPv6 ping all with after core links back up( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002580 """
2581 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2582 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002583 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002584
Hari Krishna4223dbd2015-08-13 16:29:53 -07002585 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002586 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2587 utilities.assert_equals( expect=main.TRUE,
2588 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002589 onpass="PING ALL PASS",
2590 onfail="PING ALL FAIL" )
2591
GlennRCbddd58f2015-10-01 15:45:25 -07002592 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002593 utilities.assert_equals(
2594 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002595 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002596 onpass="IPv6 Ping across 600 Point intents test PASS",
2597 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2598
You Wangb6586542016-02-26 09:25:56 -08002599 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002600 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002601 main.stop( email=main.emailOnStop )
2602
Hari Krishna4223dbd2015-08-13 16:29:53 -07002603 def CASE174( self ):
2604 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002605 IPv6 ping all with some core links down( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002606 """
2607 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2608 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002609 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002610
Hari Krishna4223dbd2015-08-13 16:29:53 -07002611 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002612 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2613 utilities.assert_equals( expect=main.TRUE,
2614 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002615 onpass="PING ALL PASS",
2616 onfail="PING ALL FAIL" )
2617
GlennRCbddd58f2015-10-01 15:45:25 -07002618 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002619 utilities.assert_equals(
2620 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002621 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002622 onpass="IPv6 Ping across 2278 host intents test PASS",
2623 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2624
You Wangb6586542016-02-26 09:25:56 -08002625 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002626 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002627 main.stop( email=main.emailOnStop )
2628
Hari Krishna4223dbd2015-08-13 16:29:53 -07002629 def CASE184( self ):
2630 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002631 IPv6 ping all with after core links back up( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002632 """
2633 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2634 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002635 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002636
Hari Krishna4223dbd2015-08-13 16:29:53 -07002637 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002638 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2639 utilities.assert_equals( expect=main.TRUE,
2640 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002641 onpass="PING ALL PASS",
2642 onfail="PING ALL FAIL" )
2643
GlennRCbddd58f2015-10-01 15:45:25 -07002644 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002645 utilities.assert_equals(
2646 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002647 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002648 onpass="IPv6 Ping across 2278 host intents test PASS",
2649 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2650
You Wangb6586542016-02-26 09:25:56 -08002651 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002652 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002653 main.stop( email=main.emailOnStop )
2654
Hari Krishna4223dbd2015-08-13 16:29:53 -07002655 def CASE175( self ):
2656 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002657 IPv6 ping all with some core links down( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002658 """
2659 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2660 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002661 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002662
Hari Krishna4223dbd2015-08-13 16:29:53 -07002663 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002664 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2665 utilities.assert_equals( expect=main.TRUE,
2666 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002667 onpass="PING ALL PASS",
2668 onfail="PING ALL FAIL" )
2669
GlennRCbddd58f2015-10-01 15:45:25 -07002670 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002671 utilities.assert_equals(
2672 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002673 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002674 onpass="IPv6 Ping across 4556 point intents test PASS",
2675 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2676
You Wangb6586542016-02-26 09:25:56 -08002677 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002678 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002679 main.stop( email=main.emailOnStop )
2680
Hari Krishna4223dbd2015-08-13 16:29:53 -07002681 def CASE185( self ):
2682 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002683 IPv6 ping all with after core links back up( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002684 """
2685 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2686 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002687 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002688
Hari Krishna4223dbd2015-08-13 16:29:53 -07002689 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002690 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2691 utilities.assert_equals( expect=main.TRUE,
2692 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002693 onpass="PING ALL PASS",
2694 onfail="PING ALL FAIL" )
2695
GlennRCbddd58f2015-10-01 15:45:25 -07002696 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002697 utilities.assert_equals(
2698 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002699 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002700 onpass="IPv6 Ping across 4556 Point intents test PASS",
2701 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2702
You Wangb6586542016-02-26 09:25:56 -08002703 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002704 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002705 main.stop( email=main.emailOnStop )
2706
Hari Krishnac195f3b2015-07-08 20:02:24 -07002707 def CASE90( self ):
2708 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002709 Install 600 point intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002710 """
2711 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2712 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002713 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002714
Hari Krishnac195f3b2015-07-08 20:02:24 -07002715 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002716 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002717 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002718
Jon Hallef0e2a12017-05-24 16:57:53 -07002719 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002720 intentState = main.CHOtestFunctions.checkIntents()
2721 utilities.assert_equals( expect=main.TRUE,
2722 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002723 onpass="INTENTS INSTALLED",
2724 onfail="SOME INTENTS NOT INSTALLED" )
2725
Hari Krishnac195f3b2015-07-08 20:02:24 -07002726 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002727 pingResult = main.CHOtestFunctions.checkPingall()
2728 utilities.assert_equals( expect=main.TRUE,
2729 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002730 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002731 onfail="PING ALL FAIL" )
2732
GlennRCbddd58f2015-10-01 15:45:25 -07002733 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002734 utilities.assert_equals(
2735 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002736 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002737 onpass="Install 600 point Intents and Ping All test PASS",
2738 onfail="Install 600 point Intents and Ping All test FAIL" )
2739
GlennRCbddd58f2015-10-01 15:45:25 -07002740 if not intentState:
2741 main.log.debug( "Intents failed to install completely" )
2742 if not pingResult:
2743 main.log.debug( "Pingall failed" )
2744
2745 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002746 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002747 main.stop( email=main.emailOnStop )
2748
Hari Krishnac195f3b2015-07-08 20:02:24 -07002749 def CASE91( self ):
2750 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002751 Install 600 point intents and verify ping all ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002752 """
2753 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2754 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002755 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002756
Hari Krishnac195f3b2015-07-08 20:02:24 -07002757 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002758 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002759 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002760
Jon Hallef0e2a12017-05-24 16:57:53 -07002761 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002762 intentState = main.CHOtestFunctions.checkIntents()
2763 utilities.assert_equals( expect=main.TRUE,
2764 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002765 onpass="INTENTS INSTALLED",
2766 onfail="SOME INTENTS NOT INSTALLED" )
2767
Hari Krishnac195f3b2015-07-08 20:02:24 -07002768 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002769 pingResult = main.CHOtestFunctions.checkPingall()
2770 utilities.assert_equals( expect=main.TRUE,
2771 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002772 onpass="PING ALL PASS",
2773 onfail="PING ALL FAIL" )
2774
GlennRCbddd58f2015-10-01 15:45:25 -07002775 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002776 utilities.assert_equals(
2777 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002778 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002779 onpass="Install 600 point Intents and Ping All test PASS",
2780 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002781
GlennRCbddd58f2015-10-01 15:45:25 -07002782 if not intentState:
2783 main.log.debug( "Intents failed to install completely" )
2784 if not pingResult:
2785 main.log.debug( "Pingall failed" )
2786
2787 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002788 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002789 main.stop( email=main.emailOnStop )
2790
Hari Krishnac195f3b2015-07-08 20:02:24 -07002791 def CASE92( self ):
2792 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002793 Install 4556 point intents and verify ping all ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002794 """
2795 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2796 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002797 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002798
You Wangb6586542016-02-26 09:25:56 -08002799 main.step( "Add point Intents" )
2800 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002801 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002802
Jon Hallef0e2a12017-05-24 16:57:53 -07002803 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002804 intentState = main.CHOtestFunctions.checkIntents()
2805 utilities.assert_equals( expect=main.TRUE,
2806 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002807 onpass="INTENTS INSTALLED",
2808 onfail="SOME INTENTS NOT INSTALLED" )
2809
Hari Krishnac195f3b2015-07-08 20:02:24 -07002810 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002811 pingResult = main.CHOtestFunctions.checkPingall()
2812 utilities.assert_equals( expect=main.TRUE,
2813 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002814 onpass="PING ALL PASS",
2815 onfail="PING ALL FAIL" )
2816
GlennRCbddd58f2015-10-01 15:45:25 -07002817 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002818 utilities.assert_equals(
2819 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002820 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002821 onpass="Install 4556 point Intents and Ping All test PASS",
2822 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002823
GlennRCbddd58f2015-10-01 15:45:25 -07002824 if not intentState:
2825 main.log.debug( "Intents failed to install completely" )
2826 if not pingResult:
2827 main.log.debug( "Pingall failed" )
2828
2829 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002830 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002831 main.stop( email=main.emailOnStop )
2832
Hari Krishnac195f3b2015-07-08 20:02:24 -07002833 def CASE93( self ):
2834 """
2835 Install multi-single point intents and verify Ping all works
2836 for att topology
2837 """
2838 import copy
2839 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002840 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002841 main.log.report( "Install multi-single point intents and verify Ping all" )
2842 main.log.report( "___________________________________________" )
2843 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002844 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2845 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002846 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002847 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002848 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002849 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002850 pool = []
2851 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002852 egressDevice = deviceDPIDsCopy[ i ]
2853 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2854 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002855 if i >= len( deviceDPIDsCopy ):
2856 break
2857 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002858 threadID=main.threadID,
2859 name="addMultipointToSinglepointIntent",
2860 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2861 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002862 t.start()
2863 i = i + 1
2864 main.threadID = main.threadID + 1
2865 for thread in pool:
2866 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002867 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002868 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002869 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07002870
Jon Hallef0e2a12017-05-24 16:57:53 -07002871 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002872 # Giving onos multiple chances to install intents
2873 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002874 if i != 0:
2875 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002876 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002877 time.sleep( main.checkIntentsDelay )
2878
2879 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07002880 for e in range( int( main.numCtrls ) ):
2881 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2882 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002883 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002884 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002885 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002886 if intentState:
2887 break
You Wangb6586542016-02-26 09:25:56 -08002888 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002889 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002890 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002891
2892 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2893 onpass="INTENTS INSTALLED",
2894 onfail="SOME INTENTS NOT INSTALLED" )
2895
Jon Hallef0e2a12017-05-24 16:57:53 -07002896 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002897
2898 for i in range( main.flowCheck ):
2899 if i != 0:
2900 main.log.warn( "verification failed. Retrying..." )
2901 main.log.info( "Waiting for onos to add flows..." )
2902 time.sleep( main.checkFlowsDelay )
2903
2904 flowState = main.TRUE
2905 for cli in main.CLIs:
2906 flowState = cli.checkFlowState()
2907 if not flowState:
2908 main.log.warn( "Not all flows added" )
2909 if flowState:
2910 break
2911 else:
2912 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002913 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002914
2915 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2916 onpass="FLOWS INSTALLED",
2917 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002918
Hari Krishnac195f3b2015-07-08 20:02:24 -07002919 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002920 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07002921 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002922 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07002923 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07002924 main.log.warn( "First pingall failed. Retrying..." )
2925 time.sleep( main.pingSleep )
2926 else:
2927 break
GlennRCdb2c8422015-09-29 12:21:59 -07002928
Hari Krishnac195f3b2015-07-08 20:02:24 -07002929 time2 = time.time()
2930 timeDiff = round( ( time2 - time1 ), 2 )
2931 main.log.report(
2932 "Time taken for Ping All: " +
2933 str( timeDiff ) +
2934 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002935
GlennRCbddd58f2015-10-01 15:45:25 -07002936 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002937 utilities.assert_equals(
2938 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002939 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002940 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2941 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002942
GlennRCfa69a2a2015-10-02 15:54:06 -07002943 if not intentState:
2944 main.log.debug( "Intents failed to install completely" )
2945 if not pingResult:
2946 main.log.debug( "Pingall failed" )
2947 if not checkFlowsState:
2948 main.log.debug( "Flows failed to add completely" )
2949
2950 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002951 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002952 main.stop( email=main.emailOnStop )
2953
Hari Krishnac195f3b2015-07-08 20:02:24 -07002954 def CASE94( self ):
2955 """
2956 Install multi-single point intents and verify Ping all works
2957 for Chordal topology
2958 """
2959 import copy
2960 import time
2961 main.log.report( "Install multi-single point intents and verify Ping all" )
2962 main.log.report( "___________________________________________" )
2963 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002964 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2965 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002966 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002967 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002968 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002969 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002970 pool = []
2971 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002972 egressDevice = deviceDPIDsCopy[ i ]
2973 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2974 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002975 if i >= len( deviceDPIDsCopy ):
2976 break
2977 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002978 threadID=main.threadID,
2979 name="addMultipointToSinglepointIntent",
2980 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2981 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002982 t.start()
2983 i = i + 1
2984 main.threadID = main.threadID + 1
2985 for thread in pool:
2986 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002987 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002988 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002989 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002990
Jon Hallef0e2a12017-05-24 16:57:53 -07002991 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002992 # Giving onos multiple chances to install intents
2993 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002994 if i != 0:
2995 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002996 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002997 time.sleep( main.checkIntentsDelay )
2998
2999 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003000 for e in range( int( main.numCtrls ) ):
3001 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3002 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003003 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003004 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003005 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003006 if intentState:
3007 break
You Wangb6586542016-02-26 09:25:56 -08003008 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003009 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003010 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003011
GlennRCdb2c8422015-09-29 12:21:59 -07003012 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3013 onpass="INTENTS INSTALLED",
3014 onfail="SOME INTENTS NOT INSTALLED" )
3015
Jon Hallef0e2a12017-05-24 16:57:53 -07003016 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003017
3018 for i in range( main.flowCheck ):
3019 if i != 0:
3020 main.log.warn( "verification failed. Retrying..." )
3021 main.log.info( "Waiting for onos to add flows..." )
3022 time.sleep( main.checkFlowsDelay )
3023
3024 flowState = main.TRUE
3025 for cli in main.CLIs:
3026 flowState = cli.checkFlowState()
3027 if not flowState:
3028 main.log.warn( "Not all flows added" )
3029 if flowState:
3030 break
3031 else:
3032 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003033 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003034
3035 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3036 onpass="FLOWS INSTALLED",
3037 onfail="SOME FLOWS NOT ADDED" )
3038
Hari Krishnac195f3b2015-07-08 20:02:24 -07003039 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003040 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003041 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003042 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003043 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003044 main.log.warn( "First pingall failed. Retrying..." )
3045 time.sleep( main.pingSleep )
3046 else:
3047 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003048
Hari Krishnac195f3b2015-07-08 20:02:24 -07003049 time2 = time.time()
3050 timeDiff = round( ( time2 - time1 ), 2 )
3051 main.log.report(
3052 "Time taken for Ping All: " +
3053 str( timeDiff ) +
3054 " seconds" )
3055
GlennRCfa69a2a2015-10-02 15:54:06 -07003056 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003057 utilities.assert_equals(
3058 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003059 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003060 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3061 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003062
GlennRCfa69a2a2015-10-02 15:54:06 -07003063 if not intentState:
3064 main.log.debug( "Intents failed to install completely" )
3065 if not pingResult:
3066 main.log.debug( "Pingall failed" )
3067 if not checkFlowsState:
3068 main.log.debug( "Flows failed to add completely" )
3069
3070 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003071 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003072 main.stop( email=main.emailOnStop )
3073
3074 def CASE95( self ):
3075 """
3076 Install multi-single point intents and verify Ping all works
3077 for Spine topology
3078 """
3079 import copy
3080 import time
3081 main.log.report( "Install multi-single point intents and verify Ping all" )
3082 main.log.report( "___________________________________________" )
3083 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003084 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3085 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
GlennRCfa69a2a2015-10-02 15:54:06 -07003086 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003087 main.log.info( "MACsDict" + str( main.MACsDict ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003088 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003089 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003090 pool = []
3091 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003092 egressDevice = deviceDPIDsCopy[ i ]
3093 ingressDeviceList = copy.copy( deviceDPIDsCopy )
3094 ingressDeviceList.remove( egressDevice )
GlennRCfa69a2a2015-10-02 15:54:06 -07003095 if i >= len( deviceDPIDsCopy ):
3096 break
3097 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003098 threadID=main.threadID,
3099 name="addMultipointToSinglepointIntent",
3100 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
3101 pool.append( t )
GlennRCfa69a2a2015-10-02 15:54:06 -07003102 t.start()
3103 i = i + 1
3104 main.threadID = main.threadID + 1
3105 for thread in pool:
3106 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003107 intentIdList.append( thread.result )
GlennRCfa69a2a2015-10-02 15:54:06 -07003108 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003109 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003110
Jon Hallef0e2a12017-05-24 16:57:53 -07003111 main.step( "Verify intents are installed" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003112 # Giving onos multiple chances to install intents
3113 for i in range( main.intentCheck ):
3114 if i != 0:
3115 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003116 main.log.info( "Waiting for onos to install intents..." )
GlennRCfa69a2a2015-10-02 15:54:06 -07003117 time.sleep( main.checkIntentsDelay )
3118
3119 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003120 for e in range( int( main.numCtrls ) ):
3121 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3122 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003123 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003124 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003125 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003126 if intentState:
3127 break
You Wangb6586542016-02-26 09:25:56 -08003128 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003129 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003130 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003131
3132 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3133 onpass="INTENTS INSTALLED",
3134 onfail="SOME INTENTS NOT INSTALLED" )
3135
Jon Hallef0e2a12017-05-24 16:57:53 -07003136 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003137
3138 for i in range( main.flowCheck ):
3139 if i != 0:
3140 main.log.warn( "verification failed. Retrying..." )
3141 main.log.info( "Waiting for onos to add flows..." )
3142 time.sleep( main.checkFlowsDelay )
3143
3144 flowState = main.TRUE
3145 for cli in main.CLIs:
3146 flowState = cli.checkFlowState()
3147 if not flowState:
3148 main.log.warn( "Not all flows added" )
3149 if flowState:
3150 break
3151 else:
3152 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003153 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003154
3155 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3156 onpass="FLOWS INSTALLED",
3157 onfail="SOME FLOWS NOT ADDED" )
3158
3159 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003160 for i in range( main.numPings ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003161 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003162 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003163 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003164 main.log.warn( "First pingall failed. Retrying..." )
3165 time.sleep( main.pingSleep )
3166 else:
3167 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003168
3169 time2 = time.time()
3170 timeDiff = round( ( time2 - time1 ), 2 )
3171 main.log.report(
3172 "Time taken for Ping All: " +
3173 str( timeDiff ) +
3174 " seconds" )
3175
3176 caseResult = ( checkFlowsState and pingResult and intentState )
3177 utilities.assert_equals(
3178 expect=main.TRUE,
3179 actual=caseResult,
3180 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3181 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3182
3183 if not intentState:
3184 main.log.debug( "Intents failed to install completely" )
3185 if not pingResult:
3186 main.log.debug( "Pingall failed" )
3187 if not checkFlowsState:
3188 main.log.debug( "Flows failed to add completely" )
3189
3190 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003191 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003192 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003193
3194 def CASE96( self ):
3195 """
3196 Install single-multi point intents and verify Ping all works
3197 for att topology
3198 """
3199 import copy
3200 main.log.report( "Install single-multi point intents and verify Ping all" )
3201 main.log.report( "___________________________________________" )
3202 main.case( "Install single-multi point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003203 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3204 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003205 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003206 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003207 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003208 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003209 pool = []
3210 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003211 ingressDevice = deviceDPIDsCopy[ i ]
3212 egressDeviceList = copy.copy( deviceDPIDsCopy )
3213 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003214 if i >= len( deviceDPIDsCopy ):
3215 break
3216 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003217 threadID=main.threadID,
3218 name="addSinglepointToMultipointIntent",
3219 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ) ] )
3220 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003221 t.start()
3222 i = i + 1
3223 main.threadID = main.threadID + 1
3224 for thread in pool:
3225 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003226 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003227 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003228 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003229
Jon Hallef0e2a12017-05-24 16:57:53 -07003230 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003231 # Giving onos multiple chances to install intents
3232 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003233 if i != 0:
3234 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003235 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003236 time.sleep( main.checkIntentsDelay )
3237
3238 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003239 for e in range( int( main.numCtrls ) ):
3240 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3241 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003242 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003243 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003244 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003245 if intentState:
3246 break
You Wangb6586542016-02-26 09:25:56 -08003247 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003248 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003249 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003250
GlennRCdb2c8422015-09-29 12:21:59 -07003251 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3252 onpass="INTENTS INSTALLED",
3253 onfail="SOME INTENTS NOT INSTALLED" )
3254
Jon Hallef0e2a12017-05-24 16:57:53 -07003255 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003256
3257 for i in range( main.flowCheck ):
3258 if i != 0:
3259 main.log.warn( "verification failed. Retrying..." )
3260 main.log.info( "Waiting for onos to add flows..." )
3261 time.sleep( main.checkFlowsDelay )
3262
3263 flowState = main.TRUE
3264 for cli in main.CLIs:
3265 flowState = cli.checkFlowState()
3266 if not flowState:
3267 main.log.warn( "Not all flows added" )
3268 if flowState:
3269 break
3270 else:
3271 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003272 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003273
3274 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3275 onpass="FLOWS INSTALLED",
3276 onfail="SOME FLOWS NOT ADDED" )
3277
Hari Krishnac195f3b2015-07-08 20:02:24 -07003278 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003279 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003280 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003281 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003282 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003283 main.log.warn( "First pingall failed. Retrying..." )
3284 time.sleep( main.pingSleep )
3285 else:
3286 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003287
Hari Krishnac195f3b2015-07-08 20:02:24 -07003288 time2 = time.time()
3289 timeDiff = round( ( time2 - time1 ), 2 )
3290 main.log.report(
3291 "Time taken for Ping All: " +
3292 str( timeDiff ) +
3293 " seconds" )
3294
Jon Hallef0e2a12017-05-24 16:57:53 -07003295 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003296 utilities.assert_equals(
3297 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003298 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003299 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3300 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3301
GlennRCfa69a2a2015-10-02 15:54:06 -07003302 if not intentState:
3303 main.log.debug( "Intents failed to install completely" )
3304 if not pingResult:
3305 main.log.debug( "Pingall failed" )
3306 if not checkFlowsState:
3307 main.log.debug( "Flows failed to add completely" )
3308
3309 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003310 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003311 main.stop( email=main.emailOnStop )
3312
Hari Krishnac195f3b2015-07-08 20:02:24 -07003313 def CASE97( self ):
3314 """
3315 Install single-multi point intents and verify Ping all works
3316 for Chordal topology
3317 """
3318 import copy
3319 main.log.report( "Install single-multi point intents and verify Ping all" )
3320 main.log.report( "___________________________________________" )
3321 main.case( "Install single-multi point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003322 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3323 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003324 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003325 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003326 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003327 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003328 pool = []
3329 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003330 ingressDevice = deviceDPIDsCopy[ i ]
3331 egressDeviceList = copy.copy( deviceDPIDsCopy )
3332 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003333 if i >= len( deviceDPIDsCopy ):
3334 break
3335 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003336 threadID=main.threadID,
3337 name="addSinglepointToMultipointIntent",
3338 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ), '' ] )
3339 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003340 t.start()
3341 i = i + 1
3342 main.threadID = main.threadID + 1
3343 for thread in pool:
3344 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003345 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003346 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003347 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003348
Jon Hallef0e2a12017-05-24 16:57:53 -07003349 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003350 # Giving onos multiple chances to install intents
3351 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003352 if i != 0:
3353 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003354 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003355 time.sleep( main.checkIntentsDelay )
3356
3357 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003358 for e in range( int( main.numCtrls ) ):
3359 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3360 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003361 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003362 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003363 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003364 if intentState:
3365 break
You Wangb6586542016-02-26 09:25:56 -08003366 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003367 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003368 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003369
GlennRCdb2c8422015-09-29 12:21:59 -07003370 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3371 onpass="INTENTS INSTALLED",
3372 onfail="SOME INTENTS NOT INSTALLED" )
3373
Jon Hallef0e2a12017-05-24 16:57:53 -07003374 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003375
3376 for i in range( main.flowCheck ):
3377 if i != 0:
3378 main.log.warn( "verification failed. Retrying..." )
3379 main.log.info( "Waiting for onos to add flows..." )
3380 time.sleep( main.checkFlowsDelay )
3381
3382 flowState = main.TRUE
3383 for cli in main.CLIs:
3384 flowState = cli.checkFlowState()
3385 if not flowState:
3386 main.log.warn( "Not all flows added" )
3387 if flowState:
3388 break
3389 else:
3390 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003391 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003392
3393 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3394 onpass="FLOWS INSTALLED",
3395 onfail="SOME FLOWS NOT ADDED" )
3396
Hari Krishnac195f3b2015-07-08 20:02:24 -07003397 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003398 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003399 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003400 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003401 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003402 main.log.warn( "First pingall failed. Retrying..." )
3403 time.sleep( main.pingSleep )
3404 else:
3405 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003406
Hari Krishnac195f3b2015-07-08 20:02:24 -07003407 time2 = time.time()
3408 timeDiff = round( ( time2 - time1 ), 2 )
3409 main.log.report(
3410 "Time taken for Ping All: " +
3411 str( timeDiff ) +
3412 " seconds" )
3413
Jon Hallef0e2a12017-05-24 16:57:53 -07003414 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003415 utilities.assert_equals(
3416 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003417 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003418 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3419 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3420
GlennRCfa69a2a2015-10-02 15:54:06 -07003421 if not intentState:
3422 main.log.debug( "Intents failed to install completely" )
3423 if not pingResult:
3424 main.log.debug( "Pingall failed" )
3425 if not checkFlowsState:
3426 main.log.debug( "Flows failed to add completely" )
3427
3428 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003429 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003430 main.stop( email=main.emailOnStop )
3431
Hari Krishnac195f3b2015-07-08 20:02:24 -07003432 def CASE98( self ):
3433 """
3434 Install single-multi point intents and verify Ping all works
3435 for Spine topology
3436 """
3437 import copy
3438 main.log.report( "Install single-multi point intents and verify Ping all" )
3439 main.log.report( "___________________________________________" )
3440 main.case( "Install single-multi point intents and Ping all" )
3441 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3442 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
Jon Hallef0e2a12017-05-24 16:57:53 -07003443 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003444 intentIdList = []
3445 MACsDictCopy = {}
3446 for i in range( len( deviceDPIDsCopy ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003447 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07003448
Jon Hallef0e2a12017-05-24 16:57:53 -07003449 main.log.info( "deviceDPIDsCopy" + str( deviceDPIDsCopy ) )
3450 main.log.info( "MACsDictCopy" + str( MACsDictCopy ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003451 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003452 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003453 pool = []
3454 for cli in main.CLIs:
3455 if i >= len( deviceDPIDsCopy ):
3456 break
Jon Hallef0e2a12017-05-24 16:57:53 -07003457 ingressDevice = deviceDPIDsCopy[ i ]
3458 egressDeviceList = copy.copy( deviceDPIDsCopy )
3459 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003460 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003461 threadID=main.threadID,
3462 name="addSinglepointToMultipointIntent",
3463 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', MACsDictCopy.get( ingressDevice ), '' ] )
3464 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003465 t.start()
3466 i = i + 1
3467 main.threadID = main.threadID + 1
3468 for thread in pool:
3469 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003470 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003471 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003472 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003473
Jon Hallef0e2a12017-05-24 16:57:53 -07003474 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003475 # Giving onos multiple chances to install intents
3476 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003477 if i != 0:
3478 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003479 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003480 time.sleep( main.checkIntentsDelay )
3481
3482 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003483 for e in range( int( main.numCtrls ) ):
3484 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3485 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003486 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003487 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003488 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003489 if intentState:
3490 break
You Wangb6586542016-02-26 09:25:56 -08003491 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003492 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003493 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003494
GlennRCdb2c8422015-09-29 12:21:59 -07003495 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3496 onpass="INTENTS INSTALLED",
3497 onfail="SOME INTENTS NOT INSTALLED" )
3498
Jon Hallef0e2a12017-05-24 16:57:53 -07003499 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003500
3501 for i in range( main.flowCheck ):
3502 if i != 0:
3503 main.log.warn( "verification failed. Retrying..." )
3504 main.log.info( "Waiting for onos to add flows..." )
3505 time.sleep( main.checkFlowsDelay )
3506
3507 flowState = main.TRUE
3508 for cli in main.CLIs:
3509 flowState = cli.checkFlowState()
3510 if not flowState:
3511 main.log.warn( "Not all flows added" )
3512 if flowState:
3513 break
3514 else:
3515 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003516 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003517
3518 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3519 onpass="FLOWS INSTALLED",
3520 onfail="SOME FLOWS NOT ADDED" )
3521
Hari Krishnac195f3b2015-07-08 20:02:24 -07003522 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003523 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003524 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003525 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003526 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003527 main.log.warn( "First pingall failed. Retrying..." )
3528 time.sleep( main.pingSleep )
3529 else:
3530 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003531
Hari Krishnac195f3b2015-07-08 20:02:24 -07003532 time2 = time.time()
3533 timeDiff = round( ( time2 - time1 ), 2 )
3534 main.log.report(
3535 "Time taken for Ping All: " +
3536 str( timeDiff ) +
3537 " seconds" )
3538
Jon Hallef0e2a12017-05-24 16:57:53 -07003539 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003540 utilities.assert_equals(
3541 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003542 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003543 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3544 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3545
GlennRCfa69a2a2015-10-02 15:54:06 -07003546 if not intentState:
3547 main.log.debug( "Intents failed to install completely" )
3548 if not pingResult:
3549 main.log.debug( "Pingall failed" )
3550 if not checkFlowsState:
3551 main.log.debug( "Flows failed to add completely" )
3552
3553 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003554 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003555 main.stop( email=main.emailOnStop )
3556
Hari Krishna4223dbd2015-08-13 16:29:53 -07003557 def CASE190( self ):
3558 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003559 Verify IPv6 ping across 600 Point intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003560 """
3561 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3562 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003563 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003564
Hari Krishna4223dbd2015-08-13 16:29:53 -07003565 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003566 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3567 utilities.assert_equals( expect=main.TRUE,
3568 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003569 onpass="PING ALL PASS",
3570 onfail="PING ALL FAIL" )
3571
GlennRCbddd58f2015-10-01 15:45:25 -07003572 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003573 utilities.assert_equals(
3574 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003575 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003576 onpass="IPv6 Ping across 600 Point intents test PASS",
3577 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3578
You Wangb6586542016-02-26 09:25:56 -08003579 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003580 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003581 main.stop( email=main.emailOnStop )
3582
Hari Krishna4223dbd2015-08-13 16:29:53 -07003583 def CASE191( self ):
3584 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003585 Verify IPv6 ping across 600 Point intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003586 """
3587 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3588 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003589 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003590
Hari Krishna4223dbd2015-08-13 16:29:53 -07003591 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003592 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3593 utilities.assert_equals( expect=main.TRUE,
3594 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003595 onpass="PING ALL PASS",
3596 onfail="PING ALL FAIL" )
3597
GlennRCbddd58f2015-10-01 15:45:25 -07003598 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003599 utilities.assert_equals(
3600 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003601 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003602 onpass="IPv6 Ping across 600 Point intents test PASS",
3603 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3604
You Wangb6586542016-02-26 09:25:56 -08003605 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003606 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003607 main.stop( email=main.emailOnStop )
3608
Hari Krishna4223dbd2015-08-13 16:29:53 -07003609 def CASE192( self ):
3610 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003611 Verify IPv6 ping across 4556 Point intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003612 """
3613 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3614 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003615 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003616
Hari Krishna4223dbd2015-08-13 16:29:53 -07003617 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003618 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3619 utilities.assert_equals( expect=main.TRUE,
3620 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003621 onpass="PING ALL PASS",
3622 onfail="PING ALL FAIL" )
3623
GlennRCbddd58f2015-10-01 15:45:25 -07003624 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003625 utilities.assert_equals(
3626 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003627 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003628 onpass="IPv6 Ping across 4556 Point intents test PASS",
3629 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003630
You Wangb6586542016-02-26 09:25:56 -08003631 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003632 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003633 main.stop( email=main.emailOnStop )
3634
Hari Krishnac195f3b2015-07-08 20:02:24 -07003635 def CASE10( self ):
3636 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003637 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003638 """
3639 Remove all Intents
3640 """
3641 main.log.report( "Remove all intents that were installed previously" )
3642 main.log.report( "______________________________________________" )
3643 main.log.info( "Remove all intents" )
3644 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003645 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003646 main.step( "Obtain the intent id's first" )
3647 intentsList = main.ONOScli1.getAllIntentIds()
3648 ansi_escape = re.compile( r'\x1b[^m]*m' )
3649 intentsList = ansi_escape.sub( '', intentsList )
3650 intentsList = intentsList.replace(
3651 " onos:intents | grep id=",
3652 "" ).replace(
3653 "id=",
3654 "" ).replace(
3655 "\r\r",
3656 "" )
3657 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003658 intentIdList = []
3659 step1Result = main.TRUE
3660 moreIntents = main.TRUE
3661 removeIntentCount = 0
Jon Hallef0e2a12017-05-24 16:57:53 -07003662 intentsCount = len( intentsList )
3663 main.log.info( "Current number of intents: " + str( intentsCount ) )
You Wangb6586542016-02-26 09:25:56 -08003664
3665 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003666 if ( len( intentsList ) > 1 ):
3667 results = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003668 main.log.info( "Removing intent..." )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003669 while moreIntents:
Jon Hallef0e2a12017-05-24 16:57:53 -07003670 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003671 if removeIntentCount == 5:
3672 break
3673 removeIntentCount = removeIntentCount + 1
3674 intentsList1 = main.ONOScli1.getAllIntentIds()
3675 if len( intentsList1 ) == 0:
3676 break
3677 ansi_escape = re.compile( r'\x1b[^m]*m' )
3678 intentsList1 = ansi_escape.sub( '', intentsList1 )
3679 intentsList1 = intentsList1.replace(
3680 " onos:intents | grep id=",
3681 "" ).replace(
3682 " state=",
3683 "" ).replace(
3684 "\r\r",
3685 "" )
3686 intentsList1 = intentsList1.splitlines()
Jon Hallef0e2a12017-05-24 16:57:53 -07003687 main.log.info( "Round %d intents to remove: " % ( removeIntentCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003688 print intentsList1
3689 intentIdList1 = []
3690 if ( len( intentsList1 ) > 0 ):
3691 moreIntents = main.TRUE
3692 for i in range( len( intentsList1 ) ):
3693 intentsTemp1 = intentsList1[ i ].split( ',' )
Jon Hallef0e2a12017-05-24 16:57:53 -07003694 intentIdList1.append( intentsTemp1[ 0 ].split( '=' )[ 1 ] )
3695 main.log.info( "Leftover Intent IDs: " + str( intentIdList1 ) )
3696 main.log.info( "Length of Leftover Intents list: " + str( len( intentIdList1 ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003697 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003698 for i in xrange( 0, len( intentIdList1 ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003699 pool = []
3700 for cli in main.CLIs:
3701 if i >= len( intentIdList1 ):
3702 break
3703 t = main.Thread( target=cli.removeIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003704 threadID=main.threadID,
3705 name="removeIntent",
3706 args=[ intentIdList1[ i ], 'org.onosproject.cli', False, False ] )
3707 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003708 t.start()
3709 i = i + 1
3710 main.threadID = main.threadID + 1
3711 for thread in pool:
3712 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003713 intentIdList.append( thread.result )
3714 #time.sleep( 2 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003715 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003716 main.log.info( "Time for removing host intents: %2f seconds" % ( time2 - time1 ) )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003717 time.sleep( purgeDelay )
Jon Hallef0e2a12017-05-24 16:57:53 -07003718 main.log.info( "Purging WITHDRAWN Intents" )
3719 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003720 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003721 time.sleep( 10 )
3722 if len( main.ONOScli1.intents() ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003723 continue
3724 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003725 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003726 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003727 print "Removed %d intents" % ( intentsCount )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003728 step1Result = main.TRUE
3729 else:
3730 print "No Intent IDs found in Intents list: ", intentsList
3731 step1Result = main.FALSE
3732
3733 print main.ONOScli1.intents()
You Wangb6586542016-02-26 09:25:56 -08003734
3735 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003736 caseResult = step1Result
3737 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003738 onpass="Intent removal test successful",
3739 onfail="Intent removal test failed" )
3740
3741 def CASE12( self, main ):
3742 """
3743 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3744 """
3745 import re
3746 import copy
3747 import time
3748
Hari Krishnac195f3b2015-07-08 20:02:24 -07003749 threadID = 0
3750
3751 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3752 main.log.report( "_____________________________________________________" )
3753 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3754 main.step( "Enable intent based Reactive forwarding" )
3755 installResult = main.FALSE
3756 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003757
Hari Krishnac195f3b2015-07-08 20:02:24 -07003758 pool = []
3759 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003760 for cli, feature in main.CLIs:
3761 t = main.Thread( target=cli, threadID=threadID,
3762 name="featureInstall", args=[ feature ] )
3763 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003764 t.start()
3765 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003766
Hari Krishnac195f3b2015-07-08 20:02:24 -07003767 results = []
3768 for thread in pool:
3769 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003770 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003771 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003772
Jon Hallef0e2a12017-05-24 16:57:53 -07003773 if( all( result == main.TRUE for result in results ) == False ):
3774 main.log.info( "Did not install onos-app-ifwd feature properly" )
3775 #main.cleanup()
3776 #main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003777 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003778 main.log.info( "Successful feature:install onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003779 installResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003780 main.log.info( "Time for feature:install onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07003781
GlennRC6ac11b12015-10-21 17:41:28 -07003782 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003783 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -07003784 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003785 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003786 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003787 main.log.warn( "First pingall failed. Retrying..." )
3788 time.sleep( main.pingSleep )
3789 else:
3790 break
GlennRC6ac11b12015-10-21 17:41:28 -07003791
Hari Krishnac195f3b2015-07-08 20:02:24 -07003792 time2 = time.time()
3793 timeDiff = round( ( time2 - time1 ), 2 )
3794 main.log.report(
3795 "Time taken for Ping All: " +
3796 str( timeDiff ) +
3797 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003798
GlennRC626ba132015-09-18 16:16:31 -07003799 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003800 main.log.report( "Pingall Test in Reactive mode successful" )
3801 else:
3802 main.log.report( "Pingall Test in Reactive mode failed" )
3803
3804 main.step( "Disable Intent based Reactive forwarding" )
3805 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003806
Hari Krishnac195f3b2015-07-08 20:02:24 -07003807 pool = []
3808 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003809 for cli, feature in main.CLIs:
3810 t = main.Thread( target=cli, threadID=threadID,
3811 name="featureUninstall", args=[ feature ] )
3812 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003813 t.start()
3814 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003815
Hari Krishnac195f3b2015-07-08 20:02:24 -07003816 results = []
3817 for thread in pool:
3818 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003819 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003820 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003821
Jon Hallef0e2a12017-05-24 16:57:53 -07003822 if( all( result == main.TRUE for result in results ) == False ):
3823 main.log.info( "Did not uninstall onos-app-ifwd feature properly" )
3824 uninstallResult = main.FALSE
3825 #main.cleanup()
3826 #main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003827 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003828 main.log.info( "Successful feature:uninstall onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003829 uninstallResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003830 main.log.info( "Time for feature:uninstall onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003831
3832 # Waiting for reative flows to be cleared.
3833 time.sleep( 10 )
3834
GlennRCbddd58f2015-10-01 15:45:25 -07003835 caseResult = installResult and pingResult and uninstallResult
3836 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003837 onpass="Intent based Reactive forwarding Pingall test PASS",
3838 onfail="Intent based Reactive forwarding Pingall test FAIL" )