blob: 60bbfb16a140dd758f48bf33f660f72e9bc9b774 [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
Hari Krishnac195f3b2015-07-08 20:02:24 -070019 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070020 onos-verify-cell
21 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070022 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070023 onos-start-cli
24 """
25 import time
You Wangb6586542016-02-26 09:25:56 -080026 import re
27 import imp
Hari Krishnac195f3b2015-07-08 20:02:24 -070028
29 global intentState
30 main.threadID = 0
You Wangb6586542016-02-26 09:25:56 -080031 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
32 main.dependencyPath = main.testOnDirectory + \
33 main.params[ 'DEPENDENCY' ][ 'path' ]
34 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070035 main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -070036 git_pull = main.params[ 'GIT' ][ 'autoPull' ]
37 git_branch = main.params[ 'GIT' ][ 'branch' ]
Jon Hallef0e2a12017-05-24 16:57:53 -070038 karafTimeout = main.params[ 'CTRL' ][ 'karafCliTimeout' ]
39 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
40 main.checkIntentsDelay = int( main.params[ 'timers' ][ 'CheckIntentDelay' ] )
41 main.pingSleep = int( main.params[ 'timers' ][ 'pingSleep' ] )
42 main.topoCheckDelay = int( main.params[ 'timers' ][ 'topoCheckDelay' ] )
43 main.pingTimeoutSmallTopo = int( main.params[ 'timers' ][ 'pingTimeoutSmallTopo' ] )
44 main.pingTimeoutLargeTopo = int( main.params[ 'timers' ][ 'pingTimeoutLargeTopo' ] )
45 main.remHostDelay = int( main.params[ 'timers' ][ 'remHostDelay' ] )
46 main.remDevDelay = int( main.params[ 'timers' ][ 'remDevDelay' ] )
47 main.failSwitch = main.params[ 'TEST' ][ 'pauseTest' ]
48 main.emailOnStop = main.params[ 'TEST' ][ 'email' ]
49 main.intentCheck = int( main.params[ 'TEST' ][ 'intentChecks' ] )
50 main.linkCheck = int( main.params[ 'TEST' ][ 'linkChecks' ] )
51 main.topoCheck = int( main.params[ 'TEST' ][ 'topoChecks' ] )
52 main.numPings = int( main.params[ 'TEST' ][ 'numPings' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -070053 main.newTopo = ""
54 main.CLIs = []
Hari Krishnac195f3b2015-07-08 20:02:24 -070055
GlennRC9e7465e2015-10-02 13:50:36 -070056 main.failSwitch = True if main.failSwitch == "on" else False
57 main.emailOnStop = True if main.emailOnStop == "on" else False
58
Jon Hallef0e2a12017-05-24 16:57:53 -070059 for i in range( 1, int( main.numCtrls ) + 1 ):
Hari Krishnac195f3b2015-07-08 20:02:24 -070060 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070061
You Wangb6586542016-02-26 09:25:56 -080062 main.CHOtestFunctions = imp.load_source( wrapperFile,
63 main.dependencyPath +
64 wrapperFile +
65 ".py" )
66
Hari Krishnac195f3b2015-07-08 20:02:24 -070067 main.case( "Set up test environment" )
68 main.log.report( "Set up test environment" )
69 main.log.report( "_______________________" )
70
Hari Krishna6185fc12015-07-13 15:42:31 -070071 main.step( "Apply Cell environment for ONOS" )
72 if ( main.onoscell ):
73 cellName = main.onoscell
74 cell_result = main.ONOSbench.setCell( cellName )
Hari Krishna6185fc12015-07-13 15:42:31 -070075 utilities.assert_equals( expect=main.TRUE, actual=cell_result,
Jon Hallef0e2a12017-05-24 16:57:53 -070076 onpass="Test step PASS",
77 onfail="Test step FAIL" )
Hari Krishna6185fc12015-07-13 15:42:31 -070078 else:
79 main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" )
80 main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" )
GlennRCef344fc2015-12-11 17:56:57 -080081 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070082 main.exit()
83
Hari Krishnac195f3b2015-07-08 20:02:24 -070084 main.step( "Git checkout and pull " + git_branch )
85 if git_pull == 'on':
86 checkout_result = main.ONOSbench.gitCheckout( git_branch )
87 pull_result = main.ONOSbench.gitPull()
88 cp_result = ( checkout_result and pull_result )
89 else:
90 checkout_result = main.TRUE
91 pull_result = main.TRUE
92 main.log.info( "Skipped git checkout and pull" )
93 cp_result = ( checkout_result and pull_result )
94 utilities.assert_equals( expect=main.TRUE, actual=cp_result,
95 onpass="Test step PASS",
96 onfail="Test step FAIL" )
97
Hari Krishnac195f3b2015-07-08 20:02:24 -070098 main.ONOSbench.getVersion( report=True )
99
Hari Krishnac195f3b2015-07-08 20:02:24 -0700100 main.step( "Create ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700101 packageResult = main.ONOSbench.buckBuild()
Hari Krishnac195f3b2015-07-08 20:02:24 -0700102 utilities.assert_equals( expect=main.TRUE, actual=packageResult,
103 onpass="Test step PASS",
104 onfail="Test step FAIL" )
105
106 main.step( "Uninstall ONOS package on all Nodes" )
107 uninstallResult = main.TRUE
108 for i in range( int( main.numCtrls ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700109 main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[ i ] )
110 u_result = main.ONOSbench.onosUninstall( main.onosIPs[ i ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700111 utilities.assert_equals( expect=main.TRUE, actual=u_result,
112 onpass="Test step PASS",
113 onfail="Test step FAIL" )
114 uninstallResult = ( uninstallResult and u_result )
115
116 main.step( "Install ONOS package on all Nodes" )
117 installResult = main.TRUE
118 for i in range( int( main.numCtrls ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700119 main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[ i ] )
120 i_result = main.ONOSbench.onosInstall( node=main.onosIPs[ i ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700121 utilities.assert_equals( expect=main.TRUE, actual=i_result,
122 onpass="Test step PASS",
123 onfail="Test step FAIL" )
124 installResult = ( installResult and i_result )
125
Chiyu Chengef109502016-11-21 15:51:38 -0800126 main.step( "Set up ONOS secure SSH" )
127 secureSshResult = main.TRUE
128 for i in range( int( main.numCtrls ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700129 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
Chiyu Chengef109502016-11-21 15:51:38 -0800130 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
131 onpass="Test step PASS",
132 onfail="Test step FAIL" )
133
You Wang0357c432017-01-09 16:13:33 -0800134 time.sleep( 5 )
135 main.step( "Starting ONOS service" )
136 stopResult = main.TRUE
137 startResult = main.TRUE
138 onosIsUp = main.TRUE
139 for i in range( main.numCtrls ):
140 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
141 if onosIsUp == main.TRUE:
142 main.log.report( "ONOS instance is up and ready" )
143 else:
144 main.log.report( "ONOS instance may not be up, stop and " +
145 "start ONOS again " )
146 for i in range( main.numCtrls ):
147 stopResult = stopResult and \
148 main.ONOSbench.onosStop( main.ONOSip[ i ] )
149 for i in range( main.numCtrls ):
150 startResult = startResult and \
151 main.ONOSbench.onosStart( main.ONOSip[ i ] )
152 stepResult = onosIsUp and stopResult and startResult
153 utilities.assert_equals( expect=main.TRUE,
154 actual=stepResult,
155 onpass="ONOS service is ready",
156 onfail="ONOS service did not start properly" )
157
Hari Krishnac195f3b2015-07-08 20:02:24 -0700158 main.step( "Start ONOS CLI on all nodes" )
159 cliResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700160 main.step( " Start ONOS cli using thread " )
161 startCliResult = main.TRUE
Hari Krishnac195f3b2015-07-08 20:02:24 -0700162 pool = []
163 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700164 for i in range( int( main.numCtrls ) ):
165 t = main.Thread( target=main.CLIs[ i ].startOnosCli,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700166 threadID=main.threadID,
167 name="startOnosCli",
Jon Hallef0e2a12017-05-24 16:57:53 -0700168 args=[ main.onosIPs[ i ], karafTimeout ] )
169 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700170 t.start()
171 main.threadID = main.threadID + 1
172 for t in pool:
173 t.join()
174 startCliResult = startCliResult and t.result
175 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700176
Hari Krishnac195f3b2015-07-08 20:02:24 -0700177 if not startCliResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700178 main.log.info( "ONOS CLI did not start up properly" )
179 main.cleanup()
180 main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -0700181 else:
Jon Hallef0e2a12017-05-24 16:57:53 -0700182 main.log.info( "Successful CLI startup" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700183 startCliResult = main.TRUE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700184
185 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700186 time.sleep( 30 )
187 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
188 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700189 cfgResult = cfgResult1 and cfgResult2
190 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
191 onpass="ipv6NeighborDiscovery cfg is set to true",
192 onfail="Failed to cfg set ipv6NeighborDiscovery" )
193
194 case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult
Jon Hallef0e2a12017-05-24 16:57:53 -0700195 main.log.info( "Time for connecting to CLI: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700196 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
197 onpass="Set up test environment PASS",
198 onfail="Set up test environment FAIL" )
199
200 def CASE20( self, main ):
201 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700202 This test script Loads a new Topology ( Att ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700203 """
204 import re
205 import time
206 import copy
207
GlennRC3de72232015-12-16 10:48:35 -0800208 main.prefix = 0
Jon Hallef0e2a12017-05-24 16:57:53 -0700209 main.numMNswitches = int( main.params[ 'TOPO1' ][ 'numSwitches' ] )
210 main.numMNlinks = int( main.params[ 'TOPO1' ][ 'numLinks' ] )
211 main.numMNhosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800212 main.pingTimeout = main.pingTimeoutSmallTopo
213
Hari Krishnac195f3b2015-07-08 20:02:24 -0700214 main.log.report(
215 "Load Att topology and Balance all Mininet switches across controllers" )
216 main.log.report(
217 "________________________________________________________________________" )
218 main.case(
219 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700220
Hari Krishnac195f3b2015-07-08 20:02:24 -0700221 main.step( "Start Mininet with Att topology" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700222 main.newTopo = main.params[ 'TOPO1' ][ 'topo' ]
GlennRCc6cd2a62015-08-10 16:08:22 -0700223 mininetDir = main.Mininet1.home + "/custom/"
Jon Hallef0e2a12017-05-24 16:57:53 -0700224 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
225 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700226 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700227 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Jon Hall4ba53f02015-07-29 13:07:41 -0700228
Hari Krishnac195f3b2015-07-08 20:02:24 -0700229 main.step( "Assign switches to controllers" )
230 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
231 main.Mininet1.assignSwController(
232 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700233 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700234
235 switch_mastership = main.TRUE
236 for i in range( 1, ( main.numMNswitches + 1 ) ):
237 response = main.Mininet1.getSwController( "s" + str( i ) )
238 print( "Response is " + str( response ) )
Jon Hallef0e2a12017-05-24 16:57:53 -0700239 if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700240 switch_mastership = switch_mastership and main.TRUE
241 else:
242 switch_mastership = main.FALSE
243
244 if switch_mastership == main.TRUE:
245 main.log.report( "Controller assignment successfull" )
246 else:
247 main.log.report( "Controller assignment failed" )
248
Jon Hallef0e2a12017-05-24 16:57:53 -0700249 time.sleep( 30 ) # waiting here to make sure topology converges across all nodes
Hari Krishnac195f3b2015-07-08 20:02:24 -0700250
251 main.step( "Balance devices across controllers" )
252 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700253 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700254 time.sleep( 5 )
255
256 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700257 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700258 case2Result = ( switch_mastership and startStatus )
259 utilities.assert_equals(
260 expect=main.TRUE,
261 actual=case2Result,
262 onpass="Starting new Att topology test PASS",
263 onfail="Starting new Att topology test FAIL" )
264
265 def CASE21( self, main ):
266 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700267 This test script Loads a new Topology ( Chordal ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700268 """
269 import re
270 import time
271 import copy
272
GlennRC3de72232015-12-16 10:48:35 -0800273 main.prefix = 1
Jon Hallef0e2a12017-05-24 16:57:53 -0700274 main.newTopo = main.params[ 'TOPO2' ][ 'topo' ]
275 main.numMNswitches = int( main.params[ 'TOPO2' ][ 'numSwitches' ] )
276 main.numMNlinks = int( main.params[ 'TOPO2' ][ 'numLinks' ] )
277 main.numMNhosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800278 main.pingTimeout = main.pingTimeoutSmallTopo
279
Hari Krishnac195f3b2015-07-08 20:02:24 -0700280 main.log.report(
281 "Load Chordal topology and Balance all Mininet switches across controllers" )
282 main.log.report(
283 "________________________________________________________________________" )
284 main.case(
285 "Assign and Balance all Mininet switches across controllers" )
286
Jon Hallef0e2a12017-05-24 16:57:53 -0700287 main.step( "Start Mininet with Chordal topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700288 mininetDir = main.Mininet1.home + "/custom/"
Jon Hallef0e2a12017-05-24 16:57:53 -0700289 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
290 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700291 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700292 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700293
294 main.step( "Assign switches to controllers" )
295
296 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
297 main.Mininet1.assignSwController(
298 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700299 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700300
301 switch_mastership = main.TRUE
302 for i in range( 1, ( main.numMNswitches + 1 ) ):
303 response = main.Mininet1.getSwController( "s" + str( i ) )
304 print( "Response is " + str( response ) )
Jon Hallef0e2a12017-05-24 16:57:53 -0700305 if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700306 switch_mastership = switch_mastership and main.TRUE
307 else:
308 switch_mastership = main.FALSE
309
310 if switch_mastership == main.TRUE:
311 main.log.report( "Controller assignment successfull" )
312 else:
313 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700314
Hari Krishnac195f3b2015-07-08 20:02:24 -0700315 main.step( "Balance devices across controllers" )
316 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700317 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700318 time.sleep( 5 )
319
GlennRCbddd58f2015-10-01 15:45:25 -0700320 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700321 time.sleep( 30 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700322 utilities.assert_equals(
323 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700324 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700325 onpass="Starting new Chordal topology test PASS",
326 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700327
Hari Krishnac195f3b2015-07-08 20:02:24 -0700328 def CASE22( self, main ):
329 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700330 This test script Loads a new Topology ( Spine ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700331 """
332 import re
333 import time
334 import copy
335
GlennRC3de72232015-12-16 10:48:35 -0800336 main.prefix = 2
Jon Hallef0e2a12017-05-24 16:57:53 -0700337 main.newTopo = main.params[ 'TOPO3' ][ 'topo' ]
338 main.numMNswitches = int( main.params[ 'TOPO3' ][ 'numSwitches' ] )
339 main.numMNlinks = int( main.params[ 'TOPO3' ][ 'numLinks' ] )
340 main.numMNhosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800341 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700342
Hari Krishnac195f3b2015-07-08 20:02:24 -0700343 main.log.report(
344 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
345 main.log.report(
346 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800347 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700348
Jon Hallef0e2a12017-05-24 16:57:53 -0700349 main.step( "Start Mininet with Spine topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700350 mininetDir = main.Mininet1.home + "/custom/"
Jon Hallef0e2a12017-05-24 16:57:53 -0700351 topoPath = main.testDir + "/" + main.TEST + "/dependencies/" + main.newTopo
352 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700353 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700354 startStatus = main.Mininet1.startNet( topoFile=topoPath )
GlennRCc6cd2a62015-08-10 16:08:22 -0700355
Hari Krishnac195f3b2015-07-08 20:02:24 -0700356 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
357 main.Mininet1.assignSwController(
358 sw="s" + str( i ),
Hari Krishna10065772015-07-10 15:55:53 -0700359 ip=main.onosIPs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700360
361 switch_mastership = main.TRUE
362 for i in range( 1, ( main.numMNswitches + 1 ) ):
363 response = main.Mininet1.getSwController( "s" + str( i ) )
364 print( "Response is " + str( response ) )
Jon Hallef0e2a12017-05-24 16:57:53 -0700365 if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700366 switch_mastership = switch_mastership and main.TRUE
367 else:
368 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700369
Hari Krishnac195f3b2015-07-08 20:02:24 -0700370 if switch_mastership == main.TRUE:
371 main.log.report( "Controller assignment successfull" )
372 else:
373 main.log.report( "Controller assignment failed" )
374 time.sleep( 5 )
375
376 main.step( "Balance devices across controllers" )
377 for i in range( int( main.numCtrls ) ):
378 balanceResult = main.ONOScli1.balanceMasters()
379 # giving some breathing time for ONOS to complete re-balance
380 time.sleep( 3 )
381
GlennRCbddd58f2015-10-01 15:45:25 -0700382 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700383 time.sleep( 60 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700384 utilities.assert_equals(
385 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700386 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700387 onpass="Starting new Spine topology test PASS",
388 onfail="Starting new Spine topology test FAIL" )
389
390 def CASE3( self, main ):
391 """
392 This Test case will be extended to collect and store more data related
393 ONOS state.
394 """
395 import re
396 import copy
397 main.deviceDPIDs = []
398 main.hostMACs = []
399 main.deviceLinks = []
400 main.deviceActiveLinksCount = []
401 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700402
Hari Krishnac195f3b2015-07-08 20:02:24 -0700403 main.log.report(
404 "Collect and Store topology details from ONOS before running any Tests" )
405 main.log.report(
406 "____________________________________________________________________" )
407 main.case( "Collect and Store Topology Details from ONOS" )
408 main.step( "Collect and store current number of switches and links" )
409 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700410 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700411 numOnosDevices = topology_result[ 'devices' ]
412 numOnosLinks = topology_result[ 'links' ]
413 topoResult = main.TRUE
414
Jon Hallef0e2a12017-05-24 16:57:53 -0700415 for check in range( main.topoCheck ):
416 if ( ( main.numMNswitches == int( numOnosDevices ) ) and ( main.numMNlinks == int( numOnosLinks ) ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800417 main.step( "Store Device DPIDs" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700418 for i in range( 1, ( main.numMNswitches + 1 ) ):
GlennRC20fc6522015-12-23 23:26:57 -0800419 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800420 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700421
GlennRCee8f3bf2015-12-14 16:18:39 -0800422 main.step( "Store Host MACs" )
423 for i in range( 1, ( main.numMNhosts + 1 ) ):
424 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
425 print "Host MACs in Store: \n", str( main.hostMACs )
426 main.MACsDict = {}
427 print "Creating dictionary of DPID and HostMacs"
Jon Hallef0e2a12017-05-24 16:57:53 -0700428 for i in range( len( main.hostMACs ) ):
429 main.MACsDict[ main.deviceDPIDs[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
GlennRCee8f3bf2015-12-14 16:18:39 -0800430 print main.MACsDict
431 main.step( "Collect and store all Devices Links" )
432 linksResult = main.ONOScli1.links( jsonFormat=False )
433 ansi_escape = re.compile( r'\x1b[^m]*m' )
434 linksResult = ansi_escape.sub( '', linksResult )
435 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
436 linksResult = linksResult.splitlines()
437 main.deviceLinks = copy.copy( linksResult )
438 print "Device Links Stored: \n", str( main.deviceLinks )
439 # this will be asserted to check with the params provided count of
440 # links
441 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700442
GlennRCee8f3bf2015-12-14 16:18:39 -0800443 main.step( "Collect and store each Device ports enabled Count" )
444 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700445 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800446 pool = []
447 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700448 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800449 break
GlennRC20fc6522015-12-23 23:26:57 -0800450 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700451 t = main.Thread( target=cli.getDevicePortsEnabledCount, threadID=main.threadID, name="getDevicePortsEnabledCount", args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800452 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700453 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800454 i = i + 1
455 main.threadID = main.threadID + 1
456 for thread in pool:
457 thread.join()
458 portResult = thread.result
459 main.devicePortsEnabledCount.append( portResult )
460 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
461 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700462 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700463
GlennRCee8f3bf2015-12-14 16:18:39 -0800464 main.step( "Collect and store each Device active links Count" )
465 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700466
Jon Hallef0e2a12017-05-24 16:57:53 -0700467 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800468 pool = []
469 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700470 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800471 break
GlennRC20fc6522015-12-23 23:26:57 -0800472 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700473 t = main.Thread( target=cli.getDeviceLinksActiveCount,
474 threadID=main.threadID,
475 name="getDevicePortsEnabledCount",
476 args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800477 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700478 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800479 i = i + 1
480 main.threadID = main.threadID + 1
481 for thread in pool:
482 thread.join()
483 linkCountResult = thread.result
484 main.deviceActiveLinksCount.append( linkCountResult )
485 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
486 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700487 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700488
GlennRCee8f3bf2015-12-14 16:18:39 -0800489 # Exit out of the topo check loop
490 break
491
492 else:
Jon Hallef0e2a12017-05-24 16:57:53 -0700493 main.log.info( "Devices (expected): %s, Links (expected): %s" %
494 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
495 main.log.info( "Devices (actual): %s, Links (actual): %s" %
496 ( numOnosDevices, numOnosLinks ) )
497 main.log.info( "Topology does not match, trying again..." )
GlennRCee8f3bf2015-12-14 16:18:39 -0800498 topoResult = main.FALSE
Jon Hallef0e2a12017-05-24 16:57:53 -0700499 time.sleep( main.topoCheckDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700500
501 # just returning TRUE for now as this one just collects data
502 case3Result = topoResult
503 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
504 onpass="Saving ONOS topology data test PASS",
505 onfail="Saving ONOS topology data test FAIL" )
506
GlennRC20fc6522015-12-23 23:26:57 -0800507 def CASE200( self, main ):
508
509 import time
510 main.log.report( "Clean up ONOS" )
Jon Hall6509dbf2016-06-21 17:01:17 -0700511 main.case( "Stop topology and remove hosts and devices" )
GlennRC20fc6522015-12-23 23:26:57 -0800512
513 main.step( "Stop Topology" )
514 stopStatus = main.Mininet1.stopNet()
515 utilities.assert_equals( expect=main.TRUE, actual=stopStatus,
516 onpass="Stopped mininet",
517 onfail="Failed to stop mininet" )
518
GlennRC20fc6522015-12-23 23:26:57 -0800519 main.log.info( "Constructing host id list" )
520 hosts = []
521 for i in range( main.numMNhosts ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700522 hosts.append( "h" + str( i + 1 ) )
GlennRC20fc6522015-12-23 23:26:57 -0800523
524 main.step( "Getting host ids" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700525 hostList = main.CLIs[ 0 ].getHostsId( hosts )
GlennRC20fc6522015-12-23 23:26:57 -0800526 hostIdResult = True if hostList else False
527 utilities.assert_equals( expect=True, actual=hostIdResult,
528 onpass="Successfully obtained the host ids.",
529 onfail="Failed to obtain the host ids" )
530
531 main.step( "Removing hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700532 hostResult = main.CLIs[ 0 ].removeHost( hostList )
GlennRC20fc6522015-12-23 23:26:57 -0800533 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
534 onpass="Successfully removed hosts",
535 onfail="Failed remove hosts" )
536
537 time.sleep( main.remHostDelay )
538
539 main.log.info( "Constructing device uri list" )
540 deviceList = []
541 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700542 deviceList.append( "of:00000000000000" + format( i + 1, "02x" ) )
GlennRC20fc6522015-12-23 23:26:57 -0800543
544 main.step( "Removing devices" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700545 deviceResult = main.CLIs[ 0 ].removeDevice( deviceList )
GlennRC20fc6522015-12-23 23:26:57 -0800546 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
547 onpass="Successfully removed devices",
548 onfail="Failed remove devices" )
549
550 time.sleep( main.remDevDelay )
551
Jon Hallef0e2a12017-05-24 16:57:53 -0700552 main.log.info( "Summary\n{}".format( main.CLIs[ 0 ].summary( jsonFormat=False ) ) )
GlennRC20fc6522015-12-23 23:26:57 -0800553
Hari Krishnac195f3b2015-07-08 20:02:24 -0700554 def CASE40( self, main ):
555 """
GlennRC15d164c2015-12-15 17:12:25 -0800556 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700557 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700558 import time
GlennRC15d164c2015-12-15 17:12:25 -0800559 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700560 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800561 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700562
GlennRC15d164c2015-12-15 17:12:25 -0800563 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700564 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800565 utilities.assert_equals( expect=main.TRUE, actual=appResult,
566 onpass="Successfully install fwd app",
567 onfail="Failed to install fwd app" )
568
GlennRC6ac11b12015-10-21 17:41:28 -0700569 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700570 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700571 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700572 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700573 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700574 main.log.warn( "First pingall failed. Retrying..." )
575 time.sleep( main.pingSleep )
GlennRC15d164c2015-12-15 17:12:25 -0800576 else:
577 break
GlennRC6ac11b12015-10-21 17:41:28 -0700578
Hari Krishnac195f3b2015-07-08 20:02:24 -0700579 time2 = time.time()
580 timeDiff = round( ( time2 - time1 ), 2 )
581 main.log.report(
582 "Time taken for Ping All: " +
583 str( timeDiff ) +
584 " seconds" )
585
GlennRC15d164c2015-12-15 17:12:25 -0800586 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700587 onpass="Reactive Mode IPv4 Pingall test PASS",
588 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700589
You Wangb6586542016-02-26 09:25:56 -0800590 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700591 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800592 main.stop( email=main.emailOnStop )
593
GlennRC15d164c2015-12-15 17:12:25 -0800594 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700595 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800596 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800597 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800598 onfail="Failed to deactivate fwd app" )
599
Hari Krishnac195f3b2015-07-08 20:02:24 -0700600 def CASE41( self, main ):
601 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700602 Verify Reactive forwarding ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700603 """
604 import re
605 import copy
606 import time
607 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
608 main.log.report( "______________________________________________" )
609 main.case( "Enable Reactive forwarding and Verify ping all" )
610 main.step( "Enable Reactive forwarding" )
611 installResult = main.TRUE
612 # Activate fwd app
Jon Hallef0e2a12017-05-24 16:57:53 -0700613 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700614
615 appCheck = main.TRUE
616 pool = []
617 for cli in main.CLIs:
618 t = main.Thread( target=cli.appToIDCheck,
619 name="appToIDCheck-" + str( i ),
620 args=[] )
621 pool.append( t )
622 t.start()
623 for t in pool:
624 t.join()
625 appCheck = appCheck and t.result
626 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
627 onpass="App Ids seem to be correct",
628 onfail="Something is wrong with app Ids" )
629 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700630 main.log.warn( main.CLIs[ 0 ].apps() )
631 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700632
Hari Krishnac195f3b2015-07-08 20:02:24 -0700633 time.sleep( 10 )
634
GlennRC6ac11b12015-10-21 17:41:28 -0700635 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700636 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700637 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700638 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700639 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700640 main.log.warn( "First pingall failed. Retrying..." )
641 time.sleep( main.pingSleep )
642 else:
643 break
GlennRC6ac11b12015-10-21 17:41:28 -0700644
Hari Krishnac195f3b2015-07-08 20:02:24 -0700645 time2 = time.time()
646 timeDiff = round( ( time2 - time1 ), 2 )
647 main.log.report(
648 "Time taken for Ping All: " +
649 str( timeDiff ) +
650 " seconds" )
651
You Wangb6586542016-02-26 09:25:56 -0800652 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700653 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800654 main.stop( email=main.emailOnStop )
655
GlennRC626ba132015-09-18 16:16:31 -0700656 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700657 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700658 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700659 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700660
Jon Hallef0e2a12017-05-24 16:57:53 -0700661 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700662 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700663 onpass="Reactive Mode IPv4 Pingall test PASS",
664 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700665
666 def CASE42( self, main ):
667 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700668 Verify Reactive forwarding ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700669 """
670 import re
671 import copy
672 import time
673 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
674 main.log.report( "______________________________________________" )
675 main.case( "Enable Reactive forwarding and Verify ping all" )
676 main.step( "Enable Reactive forwarding" )
677 installResult = main.TRUE
678 # Activate fwd app
Jon Hallef0e2a12017-05-24 16:57:53 -0700679 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700680
681 appCheck = main.TRUE
682 pool = []
683 for cli in main.CLIs:
684 t = main.Thread( target=cli.appToIDCheck,
685 name="appToIDCheck-" + str( i ),
686 args=[] )
687 pool.append( t )
688 t.start()
689 for t in pool:
690 t.join()
691 appCheck = appCheck and t.result
692 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
693 onpass="App Ids seem to be correct",
694 onfail="Something is wrong with app Ids" )
695 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700696 main.log.warn( main.CLIs[ 0 ].apps() )
697 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700698
Hari Krishnac195f3b2015-07-08 20:02:24 -0700699 time.sleep( 10 )
700
GlennRC6ac11b12015-10-21 17:41:28 -0700701 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700702 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700703 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700704 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700705 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700706 main.log.warn( "First pingall failed. Retrying..." )
707 time.sleep( main.pingSleep )
708 else:
709 break
GlennRC6ac11b12015-10-21 17:41:28 -0700710
Hari Krishnac195f3b2015-07-08 20:02:24 -0700711 time2 = time.time()
712 timeDiff = round( ( time2 - time1 ), 2 )
713 main.log.report(
714 "Time taken for Ping All: " +
715 str( timeDiff ) +
716 " seconds" )
717
You Wangb6586542016-02-26 09:25:56 -0800718 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700719 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800720 main.stop( email=main.emailOnStop )
721
GlennRC626ba132015-09-18 16:16:31 -0700722 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700723 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700724 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700725 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
726
Jon Hallef0e2a12017-05-24 16:57:53 -0700727 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700728 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700729 onpass="Reactive Mode IPv4 Pingall test PASS",
730 onfail="Reactive Mode IPv4 Pingall test FAIL" )
731
GlennRC026dba62016-01-07 18:42:33 -0800732 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800733 """
734 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
735 """
GlennRC026dba62016-01-07 18:42:33 -0800736 import time
You Wang0779bac2016-01-27 16:32:33 -0800737 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800738 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800739 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800740
741 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700742 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800743 utilities.assert_equals( expect=main.TRUE, actual=appResult,
744 onpass="Successfully install fwd app",
745 onfail="Failed to install fwd app" )
746
Jon Hallef0e2a12017-05-24 16:57:53 -0700747 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800748
Jon Hallef0e2a12017-05-24 16:57:53 -0700749 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800750 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700751 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800752 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
753 main.Mininet1.handle.expect( "mininet>" )
754 main.log.info( main.Mininet1.handle.before )
755
Jon Hallef0e2a12017-05-24 16:57:53 -0700756 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800757
758 main.log.info( hosts )
759
760 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700761 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800762 utilities.assert_equals( expect=main.TRUE, actual=appResult,
763 onpass="Successfully deactivated fwd app",
764 onfail="Failed to deactivate fwd app" )
765
766 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800767 """
768 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
769 """
GlennRC026dba62016-01-07 18:42:33 -0800770 import time
You Wang0779bac2016-01-27 16:32:33 -0800771 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800772 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800773 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800774
775 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700776 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800777 utilities.assert_equals( expect=main.TRUE, actual=appResult,
778 onpass="Successfully install fwd app",
779 onfail="Failed to install fwd app" )
780
Jon Hallef0e2a12017-05-24 16:57:53 -0700781 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800782
Jon Hallef0e2a12017-05-24 16:57:53 -0700783 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800784 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700785 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800786 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
787 main.Mininet1.handle.expect( "mininet>" )
788 main.log.info( main.Mininet1.handle.before )
789
Jon Hallef0e2a12017-05-24 16:57:53 -0700790 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800791
792 main.log.info( hosts )
793
794 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700795 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800796 utilities.assert_equals( expect=main.TRUE, actual=appResult,
797 onpass="Successfully deactivated fwd app",
798 onfail="Failed to deactivate fwd app" )
799
800 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800801 """
802 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
803 """
GlennRC026dba62016-01-07 18:42:33 -0800804 import time
You Wang0779bac2016-01-27 16:32:33 -0800805 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800806 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800807 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800808
809 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700810 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800811 utilities.assert_equals( expect=main.TRUE, actual=appResult,
812 onpass="Successfully install fwd app",
813 onfail="Failed to install fwd app" )
814
Jon Hallef0e2a12017-05-24 16:57:53 -0700815 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800816
Jon Hallef0e2a12017-05-24 16:57:53 -0700817 for i in range( 11, numHosts + 10 ):
GlennRC026dba62016-01-07 18:42:33 -0800818 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -0700819 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800820 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
821 main.Mininet1.handle.expect( "mininet>" )
822 main.log.info( main.Mininet1.handle.before )
823
Jon Hallef0e2a12017-05-24 16:57:53 -0700824 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800825
826 main.log.info( hosts )
827
828 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700829 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800830 utilities.assert_equals( expect=main.TRUE, actual=appResult,
831 onpass="Successfully deactivated fwd app",
832 onfail="Failed to deactivate fwd app" )
833
Hari Krishna4223dbd2015-08-13 16:29:53 -0700834 def CASE140( self, main ):
835 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700836 Verify IPv6 Reactive forwarding ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700837 """
838 import re
839 import copy
840 import time
841 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
842 main.log.report( "______________________________________________" )
843 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700844 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700845
846 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700847 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
848 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700849 cfgResult = cfgResult1 and cfgResult2
850 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
851 onpass="Reactive mode ipv6Fowarding cfg is set to true",
852 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
853
854 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700855 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700856 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700857 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700858 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700859 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700860 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700861 time2 = time.time()
862 timeDiff = round( ( time2 - time1 ), 2 )
863 main.log.report(
864 "Time taken for IPv6 Ping All: " +
865 str( timeDiff ) +
866 " seconds" )
867
GlennRC626ba132015-09-18 16:16:31 -0700868 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700869 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
870 else:
871 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700872
Jon Hallef0e2a12017-05-24 16:57:53 -0700873 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700874 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700875 onpass="Reactive Mode IPv6 Pingall test PASS",
876 onfail="Reactive Mode IPv6 Pingall test FAIL" )
877
878 def CASE141( self, main ):
879 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700880 Verify IPv6 Reactive forwarding ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700881 """
882 import re
883 import copy
884 import time
885 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
886 main.log.report( "______________________________________________" )
887 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700888 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700889
890 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700891 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
892 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700893 cfgResult = cfgResult1 and cfgResult2
894 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
895 onpass="Reactive mode ipv6Fowarding cfg is set to true",
896 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
897
898 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700899 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700900 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700901 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700902 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700903 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700904 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700905 time2 = time.time()
906 timeDiff = round( ( time2 - time1 ), 2 )
907 main.log.report(
908 "Time taken for IPv6 Ping All: " +
909 str( timeDiff ) +
910 " seconds" )
911
GlennRC626ba132015-09-18 16:16:31 -0700912 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700913 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
914 else:
915 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
916
917 main.step( "Disable Reactive forwarding" )
918
919 main.log.info( "Uninstall reactive forwarding app" )
920 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700921 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700922 pool = []
923 for cli in main.CLIs:
924 t = main.Thread( target=cli.appToIDCheck,
925 name="appToIDCheck-" + str( i ),
926 args=[] )
927 pool.append( t )
928 t.start()
929
930 for t in pool:
931 t.join()
932 appCheck = appCheck and t.result
933 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
934 onpass="App Ids seem to be correct",
935 onfail="Something is wrong with app Ids" )
936 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700937 main.log.warn( main.CLIs[ 0 ].apps() )
938 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700939
940 # Waiting for reative flows to be cleared.
941 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -0700942 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700943 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700944 onpass="Reactive Mode IPv6 Pingall test PASS",
945 onfail="Reactive Mode IPv6 Pingall test FAIL" )
946
947 def CASE142( self, main ):
948 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700949 Verify IPv6 Reactive forwarding ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700950 """
951 import re
952 import copy
953 import time
954 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
955 main.log.report( "______________________________________________" )
956 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
957 # Spine topology do not have hosts h1-h10
Jon Hallef0e2a12017-05-24 16:57:53 -0700958 hostList = [ ( 'h' + str( x + 11 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700959 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700960 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
961 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700962 cfgResult = cfgResult1 and cfgResult2
963 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
964 onpass="Reactive mode ipv6Fowarding cfg is set to true",
965 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
966
967 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700968 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700969 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700970 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC558cd862015-10-08 09:54:04 -0700971 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700972 main.log.warn( "First pingall failed. Trying again..." )
GlennRC558cd862015-10-08 09:54:04 -0700973 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700974 time2 = time.time()
975 timeDiff = round( ( time2 - time1 ), 2 )
976 main.log.report(
977 "Time taken for IPv6 Ping All: " +
978 str( timeDiff ) +
979 " seconds" )
980
GlennRC626ba132015-09-18 16:16:31 -0700981 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700982 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
983 else:
984 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
985
986 main.step( "Disable Reactive forwarding" )
987
988 main.log.info( "Uninstall reactive forwarding app" )
989 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700990 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700991 pool = []
992 for cli in main.CLIs:
993 t = main.Thread( target=cli.appToIDCheck,
994 name="appToIDCheck-" + str( i ),
995 args=[] )
996 pool.append( t )
997 t.start()
998
999 for t in pool:
1000 t.join()
1001 appCheck = appCheck and t.result
1002 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1003 onpass="App Ids seem to be correct",
1004 onfail="Something is wrong with app Ids" )
1005 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001006 main.log.warn( main.CLIs[ 0 ].apps() )
1007 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001008
1009 # Waiting for reative flows to be cleared.
1010 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -07001011 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -07001012 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001013 onpass="Reactive Mode IPv6 Pingall test PASS",
1014 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001015
You Wang0779bac2016-01-27 16:32:33 -08001016 def CASE147( self, main ):
1017 """
1018 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
1019 """
1020 import time
1021 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
1022 main.log.report( "______________________________________________" )
1023 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1024
1025 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001026 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001027 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1028 onpass="Successfully install fwd app",
1029 onfail="Failed to install fwd app" )
1030
1031 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001032 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1033 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001034 cfgResult = cfgResult1 and cfgResult2
1035 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1036 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1037 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1038
You Wangb6586542016-02-26 09:25:56 -08001039 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001040 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
1041 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -08001042 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -07001043 dest = "1000::" + str( i + 1 )
1044 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001045 main.Mininet1.handle.expect( "mininet>" )
1046 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001047 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001048 main.log.info( hosts )
1049
1050 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001051 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1052 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001053 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001054 pool = []
1055 for cli in main.CLIs:
1056 t = main.Thread( target=cli.appToIDCheck,
1057 name="appToIDCheck-" + str( i ),
1058 args=[] )
1059 pool.append( t )
1060 t.start()
1061
1062 for t in pool:
1063 t.join()
1064 appCheck = appCheck and t.result
1065 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1066 onpass="App Ids seem to be correct",
1067 onfail="Something is wrong with app Ids" )
1068
1069 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001070 main.log.warn( main.CLIs[ 0 ].apps() )
1071 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001072
1073 # Waiting for reative flows to be cleared.
1074 time.sleep( 30 )
1075
1076 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001077 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001078 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1079 onpass="Successfully deactivated IPv4 fwd app",
1080 onfail="Failed to deactivate IPv4 fwd app" )
1081
1082 def CASE148( self, main ):
1083 """
1084 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1085 """
1086 import time
1087 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1088 main.log.report( "______________________________________________" )
1089 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1090
1091 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001092 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001093 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1094 onpass="Successfully install fwd app",
1095 onfail="Failed to install fwd app" )
1096
1097 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001098 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1099 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001100 cfgResult = cfgResult1 and cfgResult2
1101 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1102 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1103 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1104
You Wangb6586542016-02-26 09:25:56 -08001105 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001106 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
1107 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -08001108 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -07001109 dest = "1000::" + str( i + 1 )
1110 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001111 main.Mininet1.handle.expect( "mininet>" )
1112 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001113 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001114 main.log.info( hosts )
1115
1116 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001117 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1118 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001119 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001120 pool = []
1121 for cli in main.CLIs:
1122 t = main.Thread( target=cli.appToIDCheck,
1123 name="appToIDCheck-" + str( i ),
1124 args=[] )
1125 pool.append( t )
1126 t.start()
1127
1128 for t in pool:
1129 t.join()
1130 appCheck = appCheck and t.result
1131 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1132 onpass="App Ids seem to be correct",
1133 onfail="Something is wrong with app Ids" )
1134
1135 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001136 main.log.warn( main.CLIs[ 0 ].apps() )
1137 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001138
1139 # Waiting for reative flows to be cleared.
1140 time.sleep( 30 )
1141
1142 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001143 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001144 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1145 onpass="Successfully deactivated IPv4 fwd app",
1146 onfail="Failed to deactivate IPv4 fwd app" )
1147
1148 def CASE149( self, main ):
1149 """
1150 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1151 """
1152 import time
1153 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1154 main.log.report( "______________________________________________" )
1155 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1156
1157 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001158 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001159 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1160 onpass="Successfully install fwd app",
1161 onfail="Failed to install fwd app" )
1162
1163 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001164 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1165 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001166 cfgResult = cfgResult1 and cfgResult2
1167 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1168 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1169 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1170
You Wangb6586542016-02-26 09:25:56 -08001171 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001172 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
1173 for i in range( 11, numHosts + 10 ):
You Wang0779bac2016-01-27 16:32:33 -08001174 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -07001175 dest = "1000::" + str( i + 1 )
1176 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001177 main.Mininet1.handle.expect( "mininet>" )
1178 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001179 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001180 main.log.info( hosts )
1181
1182 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001183 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1184 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001185 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001186 pool = []
1187 for cli in main.CLIs:
1188 t = main.Thread( target=cli.appToIDCheck,
1189 name="appToIDCheck-" + str( i ),
1190 args=[] )
1191 pool.append( t )
1192 t.start()
1193
1194 for t in pool:
1195 t.join()
1196 appCheck = appCheck and t.result
1197 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1198 onpass="App Ids seem to be correct",
1199 onfail="Something is wrong with app Ids" )
1200
1201 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001202 main.log.warn( main.CLIs[ 0 ].apps() )
1203 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001204
1205 # Waiting for reative flows to be cleared.
1206 time.sleep( 30 )
1207
1208 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001209 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001210 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1211 onpass="Successfully deactivated IPv4 fwd app",
1212 onfail="Failed to deactivate IPv4 fwd app" )
1213
Hari Krishnac195f3b2015-07-08 20:02:24 -07001214 def CASE5( self, main ):
1215 """
1216 Compare current ONOS topology with reference data
1217 """
1218 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001219
Hari Krishnac195f3b2015-07-08 20:02:24 -07001220 devicesDPIDTemp = []
1221 hostMACsTemp = []
1222 deviceLinksTemp = []
1223 deviceActiveLinksCountTemp = []
1224 devicePortsEnabledCountTemp = []
1225
1226 main.log.report(
1227 "Compare ONOS topology with reference data in Stores" )
1228 main.log.report( "__________________________________________________" )
1229 main.case( "Compare ONOS topology with reference data" )
1230
1231 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001232
Jon Hallef0e2a12017-05-24 16:57:53 -07001233 for check in range( main.topoCheck ):
GlennRC289c1b62015-12-12 10:45:43 -08001234 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001235 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRC289c1b62015-12-12 10:45:43 -08001236 pool = []
1237 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001238 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001239 break
GlennRC20fc6522015-12-23 23:26:57 -08001240 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001241 t = main.Thread( target=cli.getDevicePortsEnabledCount,
1242 threadID=main.threadID,
1243 name="getDevicePortsEnabledCount",
1244 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001245 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001246 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001247 i = i + 1
1248 main.threadID = main.threadID + 1
1249 for thread in pool:
1250 thread.join()
1251 portResult = thread.result
1252 #portTemp = re.split( r'\t+', portResult )
1253 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1254 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001255
GlennRC289c1b62015-12-12 10:45:43 -08001256 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001257 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
1258 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001259 "Device Enabled ports EXPECTED: %s" %
1260 str( main.devicePortsEnabledCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001261 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001262 "Device Enabled ports ACTUAL: %s" %
1263 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001264
GlennRC289c1b62015-12-12 10:45:43 -08001265 if ( cmp( main.devicePortsEnabledCount,
1266 devicePortsEnabledCountTemp ) == 0 ):
1267 stepResult1 = main.TRUE
1268 else:
1269 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001270
GlennRC289c1b62015-12-12 10:45:43 -08001271 main.step( "Compare Device active links with reference" )
1272 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001273 for i in xrange( 1, ( main.numMNswitches + 1 ), int( main.numCtrls ) ):
GlennRC289c1b62015-12-12 10:45:43 -08001274 pool = []
1275 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001276 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001277 break
GlennRC20fc6522015-12-23 23:26:57 -08001278 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001279 t = main.Thread( target=cli.getDeviceLinksActiveCount,
1280 threadID=main.threadID,
1281 name="getDeviceLinksActiveCount",
1282 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001283 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001284 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001285 i = i + 1
1286 main.threadID = main.threadID + 1
1287 for thread in pool:
1288 thread.join()
1289 linkCountResult = thread.result
1290 #linkCountTemp = re.split( r'\t+', linkCountResult )
1291 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1292 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001293
GlennRC289c1b62015-12-12 10:45:43 -08001294 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001295 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
1296 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001297 "Device Active links EXPECTED: %s" %
1298 str( main.deviceActiveLinksCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001299 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001300 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1301 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1302 stepResult2 = main.TRUE
1303 else:
1304 stepResult2 = main.FALSE
1305
1306 """
1307 place holder for comparing devices, hosts, paths and intents if required.
1308 Links and ports data would be incorrect with out devices anyways.
1309 """
1310 caseResult = ( stepResult1 and stepResult2 )
1311
1312 if caseResult:
1313 break
1314 else:
1315 time.sleep( main.topoCheckDelay )
1316 main.log.warn( "Topology check failed. Trying again..." )
1317
GlennRC289c1b62015-12-12 10:45:43 -08001318 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001319 onpass="Compare Topology test PASS",
1320 onfail="Compare Topology test FAIL" )
1321
1322 def CASE60( self ):
1323 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001324 Install 300 host intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001325 """
1326 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1327 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001328 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001329
Hari Krishnac195f3b2015-07-08 20:02:24 -07001330 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001331 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001332 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001333
Jon Hallef0e2a12017-05-24 16:57:53 -07001334 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001335 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001336 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1337 onpass="INTENTS INSTALLED",
1338 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001339
1340 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001341 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001342 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1343 onpass="PING ALL PASS",
1344 onfail="PING ALL FAIL" )
1345
GlennRCbddd58f2015-10-01 15:45:25 -07001346 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001347 utilities.assert_equals(
1348 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001349 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001350 onpass="Install 300 Host Intents and Ping All test PASS",
1351 onfail="Install 300 Host Intents and Ping All test FAIL" )
1352
GlennRCfcfdc4f2015-09-30 16:01:57 -07001353 if not intentState:
1354 main.log.debug( "Intents failed to install completely" )
1355 if not pingResult:
1356 main.log.debug( "Pingall failed" )
1357
GlennRCbddd58f2015-10-01 15:45:25 -07001358 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001359 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001360 main.stop( email=main.emailOnStop )
1361
Hari Krishnac195f3b2015-07-08 20:02:24 -07001362 def CASE61( self ):
1363 """
You Wang0779bac2016-01-27 16:32:33 -08001364 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001365 """
You Wang0779bac2016-01-27 16:32:33 -08001366 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001367 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001368 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001369
Hari Krishnac195f3b2015-07-08 20:02:24 -07001370 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001371 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001372 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001373
Jon Hallef0e2a12017-05-24 16:57:53 -07001374 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001375 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001376 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1377 onpass="INTENTS INSTALLED",
1378 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001379
1380 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001381 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001382 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1383 onpass="PING ALL PASS",
1384 onfail="PING ALL FAIL" )
1385
GlennRCbddd58f2015-10-01 15:45:25 -07001386 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001387 utilities.assert_equals( expect=main.TRUE,
1388 actual=caseResult,
1389 onpass="Install 300 Host Intents and Ping All test PASS",
1390 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001391
GlennRCfcfdc4f2015-09-30 16:01:57 -07001392 if not intentState:
1393 main.log.debug( "Intents failed to install completely" )
1394 if not pingResult:
1395 main.log.debug( "Pingall failed" )
1396
GlennRCbddd58f2015-10-01 15:45:25 -07001397 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001398 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001399 main.stop( email=main.emailOnStop )
1400
Hari Krishnac195f3b2015-07-08 20:02:24 -07001401 def CASE62( self ):
1402 """
1403 Install 2278 host intents and verify ping all for Spine Topology
1404 """
1405 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1406 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001407 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001408
You Wangb6586542016-02-26 09:25:56 -08001409 main.step( "Add host Intents" )
1410 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001411 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001412
Jon Hallef0e2a12017-05-24 16:57:53 -07001413 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001414 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001415 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1416 onpass="INTENTS INSTALLED",
1417 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001418
1419 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001420 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001421 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1422 onpass="PING ALL PASS",
1423 onfail="PING ALL FAIL" )
1424
GlennRCbddd58f2015-10-01 15:45:25 -07001425 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001426 utilities.assert_equals( expect=main.TRUE,
1427 actual=caseResult,
1428 onpass="Install 2278 Host Intents and Ping All test PASS",
1429 onfail="Install 2278 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001430
GlennRCfcfdc4f2015-09-30 16:01:57 -07001431 if not intentState:
1432 main.log.debug( "Intents failed to install completely" )
1433 if not pingResult:
1434 main.log.debug( "Pingall failed" )
1435
GlennRCbddd58f2015-10-01 15:45:25 -07001436 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001437 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001438 main.stop( email=main.emailOnStop )
1439
Hari Krishna4223dbd2015-08-13 16:29:53 -07001440 def CASE160( self ):
1441 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001442 Verify IPv6 ping across 300 host intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001443 """
1444 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1445 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001446 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001447
Hari Krishna4223dbd2015-08-13 16:29:53 -07001448 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001449 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1450 utilities.assert_equals( expect=main.TRUE,
1451 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001452 onpass="PING ALL PASS",
1453 onfail="PING ALL FAIL" )
1454
GlennRCbddd58f2015-10-01 15:45:25 -07001455 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001456 utilities.assert_equals(
1457 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001458 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001459 onpass="IPv6 Ping across 300 host intents test PASS",
1460 onfail="IPv6 Ping across 300 host intents test FAIL" )
1461
You Wangb6586542016-02-26 09:25:56 -08001462 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001463 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001464 main.stop( email=main.emailOnStop )
1465
Hari Krishna4223dbd2015-08-13 16:29:53 -07001466 def CASE161( self ):
1467 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001468 Verify IPv6 ping across 300 host intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001469 """
You Wang0779bac2016-01-27 16:32:33 -08001470 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001471 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001472 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001473
Hari Krishna4223dbd2015-08-13 16:29:53 -07001474 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001475 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001476 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1477 onpass="PING ALL PASS",
1478 onfail="PING ALL FAIL" )
1479
GlennRCbddd58f2015-10-01 15:45:25 -07001480 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001481 utilities.assert_equals(
1482 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001483 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001484 onpass="IPv6 Ping across 300 host intents test PASS",
1485 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001486
You Wangb6586542016-02-26 09:25:56 -08001487 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001488 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001489 main.stop( email=main.emailOnStop )
1490
Hari Krishna4223dbd2015-08-13 16:29:53 -07001491 def CASE162( self ):
1492 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001493 Verify IPv6 ping across 2278 host intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001494 """
1495 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1496 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001497 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001498
Hari Krishna4223dbd2015-08-13 16:29:53 -07001499 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001500 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001501 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1502 onpass="PING ALL PASS",
1503 onfail="PING ALL FAIL" )
1504
GlennRCbddd58f2015-10-01 15:45:25 -07001505 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001506 utilities.assert_equals(
1507 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001508 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001509 onpass="IPv6 Ping across 2278 host intents test PASS",
1510 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001511
You Wangb6586542016-02-26 09:25:56 -08001512 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001513 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001514 main.stop( email=main.emailOnStop )
1515
Hari Krishnac195f3b2015-07-08 20:02:24 -07001516 def CASE70( self, main ):
1517 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001518 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001519 """
1520 import random
1521 main.randomLink1 = []
1522 main.randomLink2 = []
1523 main.randomLink3 = []
1524 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1525 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1526 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1527 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1528 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1529 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1530 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001531
1532 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1533 main.log.report( "___________________________________________________________________________" )
1534 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1535 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1536 if ( int( switchLinksToToggle ) ==
1537 0 or int( switchLinksToToggle ) > 5 ):
1538 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1539 #main.cleanup()
1540 #main.exit()
1541 else:
1542 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1543
1544 main.step( "Cut links on Core devices using user provided range" )
1545 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1546 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1547 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1548 for i in range( int( switchLinksToToggle ) ):
1549 main.Mininet1.link(
1550 END1=link1End1,
1551 END2=main.randomLink1[ i ],
1552 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001553 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001554 main.Mininet1.link(
1555 END1=link2End1,
1556 END2=main.randomLink2[ i ],
1557 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001558 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001559 main.Mininet1.link(
1560 END1=link3End1,
1561 END2=main.randomLink3[ i ],
1562 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001563 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001564
Jon Hallef0e2a12017-05-24 16:57:53 -07001565 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001566 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1567 int( main.numMNlinks ) -
1568 int( switchLinksToToggle ) * 6 )
1569 utilities.assert_equals( expect=main.TRUE,
1570 actual=linkDown,
1571 onpass="Link down discovered properly",
1572 onfail="Link down was not discovered in " +
1573 str( main.linkSleep * main.linkCheck ) +
1574 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001575
Jon Hallef0e2a12017-05-24 16:57:53 -07001576 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001577 intentState = main.CHOtestFunctions.checkIntents()
1578 utilities.assert_equals( expect=main.TRUE,
1579 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001580 onpass="INTENTS INSTALLED",
1581 onfail="SOME INTENTS NOT INSTALLED" )
1582
Hari Krishnac195f3b2015-07-08 20:02:24 -07001583 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001584 pingResult = main.CHOtestFunctions.checkPingall()
1585 utilities.assert_equals( expect=main.TRUE,
1586 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001587 onpass="PING ALL PASS",
1588 onfail="PING ALL FAIL" )
1589
GlennRCbddd58f2015-10-01 15:45:25 -07001590 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001591 utilities.assert_equals( expect=main.TRUE,
1592 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001593 onpass="Random Link cut Test PASS",
1594 onfail="Random Link cut Test FAIL" )
1595
GlennRCfcfdc4f2015-09-30 16:01:57 -07001596 # Printing what exactly failed
1597 if not linkDown:
1598 main.log.debug( "Link down was not discovered correctly" )
1599 if not pingResult:
1600 main.log.debug( "Pingall failed" )
1601 if not intentState:
1602 main.log.debug( "Intents are not all installed" )
1603
GlennRCbddd58f2015-10-01 15:45:25 -07001604 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001605 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001606 main.stop( email=main.emailOnStop )
1607
Hari Krishnac195f3b2015-07-08 20:02:24 -07001608 def CASE80( self, main ):
1609 """
1610 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1611 """
1612 import random
1613 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1614 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1615 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001616 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001617 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1618
1619 main.log.report(
1620 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1621 main.log.report(
1622 "__________________________________________________________________" )
1623 main.case(
1624 "Host intents - Bring the core links up that are down and verify ping all" )
1625 main.step( "Bring randomly cut links on Core devices up" )
1626 for i in range( int( switchLinksToToggle ) ):
1627 main.Mininet1.link(
1628 END1=link1End1,
1629 END2=main.randomLink1[ i ],
1630 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001631 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001632 main.Mininet1.link(
1633 END1=link2End1,
1634 END2=main.randomLink2[ i ],
1635 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001636 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001637 main.Mininet1.link(
1638 END1=link3End1,
1639 END2=main.randomLink3[ i ],
1640 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001641 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001642
Jon Hallef0e2a12017-05-24 16:57:53 -07001643 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001644 linkUp = main.CHOtestFunctions.checkLinkEvents( "up",
1645 int( main.numMNlinks ) )
1646 utilities.assert_equals( expect=main.TRUE,
1647 actual=linkUp,
1648 onpass="Link up discovered properly",
1649 onfail="Link up was not discovered in " +
1650 str( main.linkSleep * main.linkCheck ) +
1651 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001652
Jon Hallef0e2a12017-05-24 16:57:53 -07001653 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001654 intentState = main.CHOtestFunctions.checkIntents()
1655 utilities.assert_equals( expect=main.TRUE,
1656 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001657 onpass="INTENTS INSTALLED",
1658 onfail="SOME INTENTS NOT INSTALLED" )
1659
Hari Krishnac195f3b2015-07-08 20:02:24 -07001660 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001661 pingResult = main.CHOtestFunctions.checkPingall()
1662 utilities.assert_equals( expect=main.TRUE,
1663 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001664 onpass="PING ALL PASS",
1665 onfail="PING ALL FAIL" )
1666
GlennRCbddd58f2015-10-01 15:45:25 -07001667 caseResult = linkUp and pingResult
1668 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001669 onpass="Link Up Test PASS",
1670 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001671 # Printing what exactly failed
1672 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001673 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001674 if not pingResult:
1675 main.log.debug( "Pingall failed" )
1676 if not intentState:
1677 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001678
GlennRCbddd58f2015-10-01 15:45:25 -07001679 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001680 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001681 main.stop( email=main.emailOnStop )
1682
Hari Krishnac195f3b2015-07-08 20:02:24 -07001683 def CASE71( self, main ):
1684 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001685 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001686 """
1687 import random
1688 main.randomLink1 = []
1689 main.randomLink2 = []
1690 main.randomLink3 = []
1691 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1692 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1693 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1694 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1695 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1696 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1697 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
You Wangb6586542016-02-26 09:25:56 -08001698 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001699
1700 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1701 main.log.report( "___________________________________________________________________________" )
1702 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1703 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1704 if ( int( switchLinksToToggle ) ==
1705 0 or int( switchLinksToToggle ) > 5 ):
1706 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1707 #main.cleanup()
1708 #main.exit()
1709 else:
1710 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1711
1712 main.step( "Cut links on Core devices using user provided range" )
1713 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1714 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1715 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1716 for i in range( int( switchLinksToToggle ) ):
1717 main.Mininet1.link(
1718 END1=link1End1,
1719 END2=main.randomLink1[ i ],
1720 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001721 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001722 main.Mininet1.link(
1723 END1=link2End1,
1724 END2=main.randomLink2[ i ],
1725 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001726 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001727 main.Mininet1.link(
1728 END1=link3End1,
1729 END2=main.randomLink3[ i ],
1730 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001731 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001732
Jon Hallef0e2a12017-05-24 16:57:53 -07001733 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001734 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1735 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 )
1736 utilities.assert_equals( expect=main.TRUE,
1737 actual=linkDown,
1738 onpass="Link down discovered properly",
1739 onfail="Link down was not discovered in " +
1740 str( main.linkSleep * main.linkCheck ) +
1741 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001742
Jon Hallef0e2a12017-05-24 16:57:53 -07001743 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001744 intentState = main.CHOtestFunctions.checkIntents()
1745 utilities.assert_equals( expect=main.TRUE,
1746 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001747 onpass="INTENTS INSTALLED",
1748 onfail="SOME INTENTS NOT INSTALLED" )
1749
Hari Krishnac195f3b2015-07-08 20:02:24 -07001750 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001751 pingResult = main.CHOtestFunctions.checkPingall()
1752 utilities.assert_equals( expect=main.TRUE,
1753 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001754 onpass="PING ALL PASS",
1755 onfail="PING ALL FAIL" )
1756
GlennRCbddd58f2015-10-01 15:45:25 -07001757 caseResult = linkDown and pingResult and intentState
1758 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001759 onpass="Random Link cut Test PASS",
1760 onfail="Random Link cut Test FAIL" )
1761
GlennRCfcfdc4f2015-09-30 16:01:57 -07001762 # Printing what exactly failed
1763 if not linkDown:
1764 main.log.debug( "Link down was not discovered correctly" )
1765 if not pingResult:
1766 main.log.debug( "Pingall failed" )
1767 if not intentState:
1768 main.log.debug( "Intents are not all installed" )
1769
GlennRCbddd58f2015-10-01 15:45:25 -07001770 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001771 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001772 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001773
Hari Krishnac195f3b2015-07-08 20:02:24 -07001774 def CASE81( self, main ):
1775 """
1776 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1777 """
1778 import random
1779 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1780 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1781 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001782 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001783 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1784
1785 main.log.report(
1786 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1787 main.log.report(
1788 "__________________________________________________________________" )
1789 main.case(
1790 "Point intents - Bring the core links up that are down and verify ping all" )
1791 main.step( "Bring randomly cut links on Core devices up" )
1792 for i in range( int( switchLinksToToggle ) ):
1793 main.Mininet1.link(
1794 END1=link1End1,
1795 END2=main.randomLink1[ i ],
1796 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001797 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001798 main.Mininet1.link(
1799 END1=link2End1,
1800 END2=main.randomLink2[ i ],
1801 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001802 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001803 main.Mininet1.link(
1804 END1=link3End1,
1805 END2=main.randomLink3[ i ],
1806 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001807 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001808
Jon Hallef0e2a12017-05-24 16:57:53 -07001809 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001810 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1811 utilities.assert_equals( expect=main.TRUE,
1812 actual=linkUp,
1813 onpass="Link up discovered properly",
1814 onfail="Link up was not discovered in " +
1815 str( main.linkSleep * main.linkCheck ) +
1816 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001817
Jon Hallef0e2a12017-05-24 16:57:53 -07001818 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001819 intentState = main.CHOtestFunctions.checkIntents()
1820 utilities.assert_equals( expect=main.TRUE,
1821 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001822 onpass="INTENTS INSTALLED",
1823 onfail="SOME INTENTS NOT INSTALLED" )
1824
Hari Krishnac195f3b2015-07-08 20:02:24 -07001825 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001826 pingResult = main.CHOtestFunctions.checkPingall()
1827 utilities.assert_equals( expect=main.TRUE,
1828 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001829 onpass="PING ALL PASS",
1830 onfail="PING ALL FAIL" )
1831
GlennRCbddd58f2015-10-01 15:45:25 -07001832 caseResult = linkUp and pingResult
1833 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001834 onpass="Link Up Test PASS",
1835 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001836 # Printing what exactly failed
1837 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001838 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001839 if not pingResult:
1840 main.log.debug( "Pingall failed" )
1841 if not intentState:
1842 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001843
GlennRCbddd58f2015-10-01 15:45:25 -07001844 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001845 main.log.report( "Stopping test" )
GlennRC884dc9e2015-10-09 15:53:20 -07001846 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001847
Hari Krishnac195f3b2015-07-08 20:02:24 -07001848 def CASE72( self, main ):
1849 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001850 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001851 """
1852 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001853 import itertools
You Wangb6586542016-02-26 09:25:56 -08001854 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001855
Hari Krishnac195f3b2015-07-08 20:02:24 -07001856 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1857 main.log.report( "___________________________________________________________________________" )
1858 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1859 switches = []
1860 switchesComb = []
1861 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -07001862 switches.append( 's%d' % ( i + 1 ) )
1863 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1864 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001865 print main.randomLinks
1866 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001867
Hari Krishnac195f3b2015-07-08 20:02:24 -07001868 for switch in main.randomLinks:
1869 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001870 END1=switch[ 0 ],
1871 END2=switch[ 1 ],
1872 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001873 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001874
Jon Hallef0e2a12017-05-24 16:57:53 -07001875 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001876 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1877 utilities.assert_equals( expect=main.TRUE,
1878 actual=linkDown,
1879 onpass="Link down discovered properly",
1880 onfail="Link down was not discovered in " +
1881 str( main.linkSleep * main.linkCheck ) +
1882 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001883
Jon Hallef0e2a12017-05-24 16:57:53 -07001884 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001885 intentState = main.CHOtestFunctions.checkIntents()
1886 utilities.assert_equals( expect=main.TRUE,
1887 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001888 onpass="INTENTS INSTALLED",
1889 onfail="SOME INTENTS NOT INSTALLED" )
1890
Hari Krishnac195f3b2015-07-08 20:02:24 -07001891 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001892 pingResult = main.CHOtestFunctions.checkPingall()
1893 utilities.assert_equals( expect=main.TRUE,
1894 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001895 onpass="PING ALL PASS",
1896 onfail="PING ALL FAIL" )
1897
GlennRCbddd58f2015-10-01 15:45:25 -07001898 caseResult = linkDown and pingResult and intentState
1899 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001900 onpass="Random Link cut Test PASS",
1901 onfail="Random Link cut Test FAIL" )
1902
GlennRCfcfdc4f2015-09-30 16:01:57 -07001903 # Printing what exactly failed
1904 if not linkDown:
1905 main.log.debug( "Link down was not discovered correctly" )
1906 if not pingResult:
1907 main.log.debug( "Pingall failed" )
1908 if not intentState:
1909 main.log.debug( "Intents are not all installed" )
1910
GlennRCbddd58f2015-10-01 15:45:25 -07001911 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001912 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001913 main.stop( email=main.emailOnStop )
1914
Hari Krishnac195f3b2015-07-08 20:02:24 -07001915 def CASE82( self, main ):
1916 """
1917 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1918 """
1919 import random
You Wangb6586542016-02-26 09:25:56 -08001920 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001921
Hari Krishnac195f3b2015-07-08 20:02:24 -07001922 main.log.report(
1923 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1924 main.log.report(
1925 "__________________________________________________________________" )
1926 main.case(
1927 "Host intents - Bring the core links up that are down and verify ping all" )
1928 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001929
Hari Krishnac195f3b2015-07-08 20:02:24 -07001930 for switch in main.randomLinks:
1931 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001932 END1=switch[ 0 ],
1933 END2=switch[ 1 ],
1934 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001935 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001936
Jon Hallef0e2a12017-05-24 16:57:53 -07001937 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001938 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1939 utilities.assert_equals( expect=main.TRUE,
1940 actual=linkUp,
1941 onpass="Link up discovered properly",
1942 onfail="Link up was not discovered in " +
1943 str( main.linkSleep * main.linkCheck ) +
1944 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001945
Jon Hallef0e2a12017-05-24 16:57:53 -07001946 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001947 intentState = main.CHOtestFunctions.checkIntents()
1948 utilities.assert_equals( expect=main.TRUE,
1949 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001950 onpass="INTENTS INSTALLED",
1951 onfail="SOME INTENTS NOT INSTALLED" )
1952
Hari Krishnac195f3b2015-07-08 20:02:24 -07001953 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001954 pingResult = main.CHOtestFunctions.checkPingall()
1955 utilities.assert_equals( expect=main.TRUE,
1956 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001957 onpass="PING ALL PASS",
1958 onfail="PING ALL FAIL" )
1959
GlennRCbddd58f2015-10-01 15:45:25 -07001960 caseResult = linkUp and pingResult
1961 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001962 onpass="Link Up Test PASS",
1963 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001964 # Printing what exactly failed
1965 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001966 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001967 if not pingResult:
1968 main.log.debug( "Pingall failed" )
1969 if not intentState:
1970 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001971
GlennRCbddd58f2015-10-01 15:45:25 -07001972 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001973 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001974 main.stop( email=main.emailOnStop )
1975
Hari Krishnac195f3b2015-07-08 20:02:24 -07001976 def CASE73( self, main ):
1977 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001978 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001979 """
1980 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001981 import itertools
You Wangb6586542016-02-26 09:25:56 -08001982 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001983
Hari Krishnac195f3b2015-07-08 20:02:24 -07001984 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1985 main.log.report( "___________________________________________________________________________" )
1986 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1987 switches = []
1988 switchesComb = []
1989 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -07001990 switches.append( 's%d' % ( i + 1 ) )
1991 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1992 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001993 print main.randomLinks
1994 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001995
Hari Krishnac195f3b2015-07-08 20:02:24 -07001996 for switch in main.randomLinks:
1997 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001998 END1=switch[ 0 ],
1999 END2=switch[ 1 ],
2000 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002001 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002002
Jon Hallef0e2a12017-05-24 16:57:53 -07002003 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002004 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
2005 utilities.assert_equals( expect=main.TRUE,
2006 actual=linkDown,
2007 onpass="Link down discovered properly",
2008 onfail="Link down was not discovered in " +
2009 str( main.linkSleep * main.linkCheck ) +
2010 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002011
Jon Hallef0e2a12017-05-24 16:57:53 -07002012 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002013 intentState = main.CHOtestFunctions.checkIntents()
2014 utilities.assert_equals( expect=main.TRUE,
2015 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002016 onpass="INTENTS INSTALLED",
2017 onfail="SOME INTENTS NOT INSTALLED" )
2018
Hari Krishnac195f3b2015-07-08 20:02:24 -07002019 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002020 pingResult = main.CHOtestFunctions.checkPingall()
2021 utilities.assert_equals( expect=main.TRUE,
2022 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002023 onpass="PING ALL PASS",
2024 onfail="PING ALL FAIL" )
2025
GlennRCbddd58f2015-10-01 15:45:25 -07002026 caseResult = linkDown and pingResult and intentState
2027 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002028 onpass="Random Link cut Test PASS",
2029 onfail="Random Link cut Test FAIL" )
2030
GlennRCfcfdc4f2015-09-30 16:01:57 -07002031 # Printing what exactly failed
2032 if not linkDown:
2033 main.log.debug( "Link down was not discovered correctly" )
2034 if not pingResult:
2035 main.log.debug( "Pingall failed" )
2036 if not intentState:
2037 main.log.debug( "Intents are not all installed" )
2038
GlennRCbddd58f2015-10-01 15:45:25 -07002039 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002040 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002041 main.stop( email=main.emailOnStop )
2042
Hari Krishnac195f3b2015-07-08 20:02:24 -07002043 def CASE83( self, main ):
2044 """
2045 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
2046 """
2047 import random
You Wangb6586542016-02-26 09:25:56 -08002048 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002049
Hari Krishnac195f3b2015-07-08 20:02:24 -07002050 main.log.report(
2051 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
2052 main.log.report(
2053 "__________________________________________________________________" )
2054 main.case(
2055 "Point intents - Bring the core links up that are down and verify ping all" )
2056 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002057
Hari Krishnac195f3b2015-07-08 20:02:24 -07002058 for switch in main.randomLinks:
2059 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07002060 END1=switch[ 0 ],
2061 END2=switch[ 1 ],
2062 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002063 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002064
Jon Hallef0e2a12017-05-24 16:57:53 -07002065 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002066 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2067 utilities.assert_equals( expect=main.TRUE,
2068 actual=linkUp,
2069 onpass="Link up discovered properly",
2070 onfail="Link up was not discovered in " +
2071 str( main.linkSleep * main.linkCheck ) +
2072 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002073
Jon Hallef0e2a12017-05-24 16:57:53 -07002074 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002075 intentState = main.CHOtestFunctions.checkIntents()
2076 utilities.assert_equals( expect=main.TRUE,
2077 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002078 onpass="INTENTS INSTALLED",
2079 onfail="SOME INTENTS NOT INSTALLED" )
2080
Hari Krishnac195f3b2015-07-08 20:02:24 -07002081 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002082 pingResult = main.CHOtestFunctions.checkPingall()
2083 utilities.assert_equals( expect=main.TRUE,
2084 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002085 onpass="PING ALL PASS",
2086 onfail="PING ALL FAIL" )
2087
GlennRCbddd58f2015-10-01 15:45:25 -07002088 caseResult = linkUp and pingResult
2089 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002090 onpass="Link Up Test PASS",
2091 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002092 # Printing what exactly failed
2093 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002094 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002095 if not pingResult:
2096 main.log.debug( "Pingall failed" )
2097 if not intentState:
2098 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002099
GlennRCbddd58f2015-10-01 15:45:25 -07002100 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002101 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002102 main.stop( email=main.emailOnStop )
2103
Hari Krishnac195f3b2015-07-08 20:02:24 -07002104 def CASE74( self, main ):
2105 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002106 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002107 """
2108 import random
2109 main.randomLink1 = []
2110 main.randomLink2 = []
2111 main.randomLink3 = []
2112 main.randomLink4 = []
2113 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2114 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2115 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2116 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2117 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2118 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002119 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002120
Hari Krishnac195f3b2015-07-08 20:02:24 -07002121 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2122 main.log.report( "___________________________________________________________________________" )
Jon Hall6509dbf2016-06-21 17:01:17 -07002123 main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002124
2125 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002126 linkIndex = range( 4 )
2127 linkIndexS9 = random.sample( linkIndex, 1 )[ 0 ]
2128 linkIndex.remove( linkIndexS9 )
2129 linkIndexS10 = random.sample( linkIndex, 1 )[ 0 ]
2130 main.randomLink1 = link1End2top[ linkIndexS9 ]
2131 main.randomLink2 = link2End2top[ linkIndexS10 ]
2132 main.randomLink3 = random.sample( link1End2bot, 1 )[ 0 ]
2133 main.randomLink4 = random.sample( link2End2bot, 1 )[ 0 ]
Hari Krishna6185fc12015-07-13 15:42:31 -07002134
2135 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002136 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2137 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2138 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002139 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002140 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002141 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002142
You Wangb6586542016-02-26 09:25:56 -08002143 main.step( "Verify link down is discoverd by onos" )
2144 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2145 utilities.assert_equals( expect=main.TRUE,
2146 actual=linkDown,
2147 onpass="Link down discovered properly",
2148 onfail="Link down was not discovered in " +
2149 str( main.linkSleep * main.linkCheck ) +
2150 " seconds" )
You Wang0779bac2016-01-27 16:32:33 -08002151
You Wangb6586542016-02-26 09:25:56 -08002152 main.step( "Verify intents are installed" )
2153 intentState = main.CHOtestFunctions.checkIntents()
2154 utilities.assert_equals( expect=main.TRUE,
2155 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002156 onpass="INTENTS INSTALLED",
2157 onfail="SOME INTENTS NOT INSTALLED" )
2158
Hari Krishnac195f3b2015-07-08 20:02:24 -07002159 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002160 pingResult = main.CHOtestFunctions.checkPingall()
2161 utilities.assert_equals( expect=main.TRUE,
2162 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002163 onpass="PING ALL PASS",
2164 onfail="PING ALL FAIL" )
2165
GlennRCbddd58f2015-10-01 15:45:25 -07002166 caseResult = linkDown and pingResult and intentState
2167 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002168 onpass="Random Link cut Test PASS",
2169 onfail="Random Link cut Test FAIL" )
2170
GlennRCfcfdc4f2015-09-30 16:01:57 -07002171 # Printing what exactly failed
2172 if not linkDown:
2173 main.log.debug( "Link down was not discovered correctly" )
2174 if not pingResult:
2175 main.log.debug( "Pingall failed" )
2176 if not intentState:
2177 main.log.debug( "Intents are not all installed" )
2178
GlennRCbddd58f2015-10-01 15:45:25 -07002179 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002180 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002181 main.stop( email=main.emailOnStop )
2182
Hari Krishnac195f3b2015-07-08 20:02:24 -07002183 def CASE84( self, main ):
2184 """
2185 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2186 """
2187 import random
2188 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2189 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002190 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002191 main.log.report(
2192 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2193 main.log.report(
2194 "__________________________________________________________________" )
2195 main.case(
2196 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002197
You Wang0779bac2016-01-27 16:32:33 -08002198 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002199 # Work around for link state propagation delay. Added some sleep time.
2200 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2201 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002202 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002203 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002204 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002205 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002206
Jon Hallef0e2a12017-05-24 16:57:53 -07002207 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002208 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2209 utilities.assert_equals( expect=main.TRUE,
2210 actual=linkUp,
2211 onpass="Link up discovered properly",
2212 onfail="Link up was not discovered in " +
2213 str( main.linkSleep * main.linkCheck ) +
2214 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002215
Jon Hallef0e2a12017-05-24 16:57:53 -07002216 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002217 intentState = main.CHOtestFunctions.checkIntents()
2218 utilities.assert_equals( expect=main.TRUE,
2219 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002220 onpass="INTENTS INSTALLED",
2221 onfail="SOME INTENTS NOT INSTALLED" )
2222
Hari Krishnac195f3b2015-07-08 20:02:24 -07002223 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002224 pingResult = main.CHOtestFunctions.checkPingall()
2225 utilities.assert_equals( expect=main.TRUE,
2226 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002227 onpass="PING ALL PASS",
2228 onfail="PING ALL FAIL" )
2229
GlennRCbddd58f2015-10-01 15:45:25 -07002230 caseResult = linkUp and pingResult
2231 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002232 onpass="Link Up Test PASS",
2233 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002234 # Printing what exactly failed
2235 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002236 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002237 if not pingResult:
2238 main.log.debug( "Pingall failed" )
2239 if not intentState:
2240 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002241
GlennRCbddd58f2015-10-01 15:45:25 -07002242 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002243 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002244 main.stop( email=main.emailOnStop )
2245
Hari Krishnab79d0822015-08-20 09:48:43 -07002246 def CASE75( self, main ):
2247 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002248 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo )
Hari Krishnab79d0822015-08-20 09:48:43 -07002249 """
2250 import random
2251 main.randomLink1 = []
2252 main.randomLink2 = []
2253 main.randomLink3 = []
2254 main.randomLink4 = []
2255 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2256 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2257 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2258 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2259 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2260 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002261 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002262
2263 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2264 main.log.report( "___________________________________________________________________________" )
2265 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002266
2267 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002268 linkIndex = range( 4 )
2269 linkIndexS9 = random.sample( linkIndex, 1 )[ 0 ]
2270 linkIndex.remove( linkIndexS9 )
2271 linkIndexS10 = random.sample( linkIndex, 1 )[ 0 ]
2272 main.randomLink1 = link1End2top[ linkIndexS9 ]
2273 main.randomLink2 = link2End2top[ linkIndexS10 ]
2274 main.randomLink3 = random.sample( link1End2bot, 1 )[ 0 ]
2275 main.randomLink4 = random.sample( link2End2bot, 1 )[ 0 ]
Hari Krishnab79d0822015-08-20 09:48:43 -07002276
2277 # Work around for link state propagation delay. Added some sleep time.
2278 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2279 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2280 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002281 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002282 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002283 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002284
Jon Hallef0e2a12017-05-24 16:57:53 -07002285 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002286 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2287 utilities.assert_equals( expect=main.TRUE,
2288 actual=linkDown,
2289 onpass="Link down discovered properly",
2290 onfail="Link down was not discovered in " +
2291 str( main.linkSleep * main.linkCheck ) +
2292 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002293
Jon Hallef0e2a12017-05-24 16:57:53 -07002294 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002295 intentState = main.CHOtestFunctions.checkIntents()
2296 utilities.assert_equals( expect=main.TRUE,
2297 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002298 onpass="INTENTS INSTALLED",
2299 onfail="SOME INTENTS NOT INSTALLED" )
2300
Hari Krishnab79d0822015-08-20 09:48:43 -07002301 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002302 pingResult = main.CHOtestFunctions.checkPingall()
2303 utilities.assert_equals( expect=main.TRUE,
2304 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002305 onpass="PING ALL PASS",
2306 onfail="PING ALL FAIL" )
2307
GlennRCbddd58f2015-10-01 15:45:25 -07002308 caseResult = linkDown and pingResult and intentState
2309 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002310 onpass="Random Link cut Test PASS",
2311 onfail="Random Link cut Test FAIL" )
2312
GlennRCfcfdc4f2015-09-30 16:01:57 -07002313 # Printing what exactly failed
2314 if not linkDown:
2315 main.log.debug( "Link down was not discovered correctly" )
2316 if not pingResult:
2317 main.log.debug( "Pingall failed" )
2318 if not intentState:
2319 main.log.debug( "Intents are not all installed" )
2320
GlennRCbddd58f2015-10-01 15:45:25 -07002321 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002322 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002323 main.stop( email=main.emailOnStop )
2324
Hari Krishnab79d0822015-08-20 09:48:43 -07002325 def CASE85( self, main ):
2326 """
2327 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2328 """
2329 import random
2330 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2331 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002332 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002333 main.log.report(
2334 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2335 main.log.report(
2336 "__________________________________________________________________" )
2337 main.case(
2338 "Point intents - Bring the core links up that are down and verify ping all" )
2339
You Wang0779bac2016-01-27 16:32:33 -08002340 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002341 # Work around for link state propagation delay. Added some sleep time.
2342 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2343 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2344 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002345 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002346 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002347 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002348
Jon Hallef0e2a12017-05-24 16:57:53 -07002349 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002350 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2351 utilities.assert_equals( expect=main.TRUE,
2352 actual=linkUp,
2353 onpass="Link up discovered properly",
2354 onfail="Link up was not discovered in " +
2355 str( main.linkSleep * main.linkCheck ) +
2356 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002357
Jon Hallef0e2a12017-05-24 16:57:53 -07002358 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002359 intentState = main.CHOtestFunctions.checkIntents()
2360 utilities.assert_equals( expect=main.TRUE,
2361 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002362 onpass="INTENTS INSTALLED",
2363 onfail="SOME INTENTS NOT INSTALLED" )
2364
Hari Krishnab79d0822015-08-20 09:48:43 -07002365 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002366 pingResult = main.CHOtestFunctions.checkPingall()
2367 utilities.assert_equals( expect=main.TRUE,
2368 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002369 onpass="PING ALL PASS",
2370 onfail="PING ALL FAIL" )
2371
GlennRCbddd58f2015-10-01 15:45:25 -07002372 caseResult = linkUp and pingResult
2373 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002374 onpass="Link Up Test PASS",
2375 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002376 # Printing what exactly failed
2377 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002378 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002379 if not pingResult:
2380 main.log.debug( "Pingall failed" )
2381 if not intentState:
2382 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002383
GlennRCbddd58f2015-10-01 15:45:25 -07002384 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002385 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002386 main.stop( email=main.emailOnStop )
2387
Hari Krishna4223dbd2015-08-13 16:29:53 -07002388 def CASE170( self ):
2389 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002390 IPv6 ping all with some core links down( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002391 """
2392 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2393 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002394 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002395
Hari Krishna4223dbd2015-08-13 16:29:53 -07002396 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002397 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2398 utilities.assert_equals( expect=main.TRUE,
2399 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002400 onpass="PING ALL PASS",
2401 onfail="PING ALL FAIL" )
2402
GlennRCbddd58f2015-10-01 15:45:25 -07002403 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002404 utilities.assert_equals(
2405 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002406 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002407 onpass="IPv6 Ping across 300 host intents test PASS",
2408 onfail="IPv6 Ping across 300 host intents test FAIL" )
2409
You Wangb6586542016-02-26 09:25:56 -08002410 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002411 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002412 main.stop( email=main.emailOnStop )
2413
Hari Krishna4223dbd2015-08-13 16:29:53 -07002414 def CASE180( self ):
2415 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002416 IPv6 ping all with after core links back up( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002417 """
2418 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2419 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002420 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002421
Hari Krishna4223dbd2015-08-13 16:29:53 -07002422 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002423 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2424 utilities.assert_equals( expect=main.TRUE,
2425 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002426 onpass="PING ALL PASS",
2427 onfail="PING ALL FAIL" )
2428
GlennRCbddd58f2015-10-01 15:45:25 -07002429 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002430 utilities.assert_equals(
2431 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002432 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002433 onpass="IPv6 Ping across 300 host intents test PASS",
2434 onfail="IPv6 Ping across 300 host intents test FAIL" )
2435
You Wangb6586542016-02-26 09:25:56 -08002436 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002437 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002438 main.stop( email=main.emailOnStop )
2439
Hari Krishna4223dbd2015-08-13 16:29:53 -07002440 def CASE171( self ):
2441 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002442 IPv6 ping all with some core links down( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002443 """
2444 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2445 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002446 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002447
Hari Krishna4223dbd2015-08-13 16:29:53 -07002448 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002449 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2450 utilities.assert_equals( expect=main.TRUE,
2451 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002452 onpass="PING ALL PASS",
2453 onfail="PING ALL FAIL" )
2454
GlennRCbddd58f2015-10-01 15:45:25 -07002455 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002456 utilities.assert_equals(
2457 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002458 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002459 onpass="IPv6 Ping across 600 point intents test PASS",
2460 onfail="IPv6 Ping across 600 point intents test FAIL" )
2461
You Wangb6586542016-02-26 09:25:56 -08002462 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002463 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002464 main.stop( email=main.emailOnStop )
2465
Hari Krishna4223dbd2015-08-13 16:29:53 -07002466 def CASE181( self ):
2467 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002468 IPv6 ping all with after core links back up( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002469 """
2470 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2471 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002472 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002473
Hari Krishna4223dbd2015-08-13 16:29:53 -07002474 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002475 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2476 utilities.assert_equals( expect=main.TRUE,
2477 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002478 onpass="PING ALL PASS",
2479 onfail="PING ALL FAIL" )
2480
GlennRCbddd58f2015-10-01 15:45:25 -07002481 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002482 utilities.assert_equals(
2483 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002484 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002485 onpass="IPv6 Ping across 600 Point intents test PASS",
2486 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2487
You Wangb6586542016-02-26 09:25:56 -08002488 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002489 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002490 main.stop( email=main.emailOnStop )
2491
Hari Krishna4223dbd2015-08-13 16:29:53 -07002492 def CASE172( self ):
2493 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002494 IPv6 ping all with some core links down( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002495 """
2496 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2497 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002498 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002499
Hari Krishna4223dbd2015-08-13 16:29:53 -07002500 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002501 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2502 utilities.assert_equals( expect=main.TRUE,
2503 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002504 onpass="PING ALL PASS",
2505 onfail="PING ALL FAIL" )
2506
GlennRCbddd58f2015-10-01 15:45:25 -07002507 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002508 utilities.assert_equals(
2509 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002510 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002511 onpass="IPv6 Ping across 300 host intents test PASS",
2512 onfail="IPv6 Ping across 300 host intents test FAIL" )
2513
2514 def CASE182( self ):
2515 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002516 IPv6 ping all with after core links back up( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002517 """
2518 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2519 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002520 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002521
Hari Krishna4223dbd2015-08-13 16:29:53 -07002522 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002523 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2524 utilities.assert_equals( expect=main.TRUE,
2525 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002526 onpass="PING ALL PASS",
2527 onfail="PING ALL FAIL" )
2528
GlennRCbddd58f2015-10-01 15:45:25 -07002529 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002530 utilities.assert_equals(
2531 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002532 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002533 onpass="IPv6 Ping across 300 host intents test PASS",
2534 onfail="IPv6 Ping across 300 host intents test FAIL" )
2535
You Wangb6586542016-02-26 09:25:56 -08002536 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002537 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002538 main.stop( email=main.emailOnStop )
2539
Hari Krishna4223dbd2015-08-13 16:29:53 -07002540 def CASE173( self ):
2541 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002542 IPv6 ping all with some core links down( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002543 """
2544 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2545 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002546 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002547
Hari Krishna4223dbd2015-08-13 16:29:53 -07002548 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002549 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2550 utilities.assert_equals( expect=main.TRUE,
2551 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002552 onpass="PING ALL PASS",
2553 onfail="PING ALL FAIL" )
2554
GlennRCbddd58f2015-10-01 15:45:25 -07002555 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002556 utilities.assert_equals(
2557 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002558 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002559 onpass="IPv6 Ping across 600 point intents test PASS",
2560 onfail="IPv6 Ping across 600 point intents test FAIL" )
2561
You Wangb6586542016-02-26 09:25:56 -08002562 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002563 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002564 main.stop( email=main.emailOnStop )
2565
Hari Krishna4223dbd2015-08-13 16:29:53 -07002566 def CASE183( self ):
2567 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002568 IPv6 ping all with after core links back up( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002569 """
2570 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2571 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002572 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002573
Hari Krishna4223dbd2015-08-13 16:29:53 -07002574 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002575 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2576 utilities.assert_equals( expect=main.TRUE,
2577 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002578 onpass="PING ALL PASS",
2579 onfail="PING ALL FAIL" )
2580
GlennRCbddd58f2015-10-01 15:45:25 -07002581 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002582 utilities.assert_equals(
2583 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002584 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002585 onpass="IPv6 Ping across 600 Point intents test PASS",
2586 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2587
You Wangb6586542016-02-26 09:25:56 -08002588 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002589 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002590 main.stop( email=main.emailOnStop )
2591
Hari Krishna4223dbd2015-08-13 16:29:53 -07002592 def CASE174( self ):
2593 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002594 IPv6 ping all with some core links down( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002595 """
2596 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2597 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002598 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002599
Hari Krishna4223dbd2015-08-13 16:29:53 -07002600 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002601 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2602 utilities.assert_equals( expect=main.TRUE,
2603 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002604 onpass="PING ALL PASS",
2605 onfail="PING ALL FAIL" )
2606
GlennRCbddd58f2015-10-01 15:45:25 -07002607 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002608 utilities.assert_equals(
2609 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002610 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002611 onpass="IPv6 Ping across 2278 host intents test PASS",
2612 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2613
You Wangb6586542016-02-26 09:25:56 -08002614 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002615 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002616 main.stop( email=main.emailOnStop )
2617
Hari Krishna4223dbd2015-08-13 16:29:53 -07002618 def CASE184( self ):
2619 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002620 IPv6 ping all with after core links back up( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002621 """
2622 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2623 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002624 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002625
Hari Krishna4223dbd2015-08-13 16:29:53 -07002626 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002627 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2628 utilities.assert_equals( expect=main.TRUE,
2629 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002630 onpass="PING ALL PASS",
2631 onfail="PING ALL FAIL" )
2632
GlennRCbddd58f2015-10-01 15:45:25 -07002633 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002634 utilities.assert_equals(
2635 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002636 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002637 onpass="IPv6 Ping across 2278 host intents test PASS",
2638 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2639
You Wangb6586542016-02-26 09:25:56 -08002640 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002641 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002642 main.stop( email=main.emailOnStop )
2643
Hari Krishna4223dbd2015-08-13 16:29:53 -07002644 def CASE175( self ):
2645 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002646 IPv6 ping all with some core links down( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002647 """
2648 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2649 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002650 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002651
Hari Krishna4223dbd2015-08-13 16:29:53 -07002652 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002653 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2654 utilities.assert_equals( expect=main.TRUE,
2655 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002656 onpass="PING ALL PASS",
2657 onfail="PING ALL FAIL" )
2658
GlennRCbddd58f2015-10-01 15:45:25 -07002659 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002660 utilities.assert_equals(
2661 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002662 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002663 onpass="IPv6 Ping across 4556 point intents test PASS",
2664 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2665
You Wangb6586542016-02-26 09:25:56 -08002666 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002667 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002668 main.stop( email=main.emailOnStop )
2669
Hari Krishna4223dbd2015-08-13 16:29:53 -07002670 def CASE185( self ):
2671 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002672 IPv6 ping all with after core links back up( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002673 """
2674 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2675 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002676 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002677
Hari Krishna4223dbd2015-08-13 16:29:53 -07002678 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002679 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2680 utilities.assert_equals( expect=main.TRUE,
2681 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002682 onpass="PING ALL PASS",
2683 onfail="PING ALL FAIL" )
2684
GlennRCbddd58f2015-10-01 15:45:25 -07002685 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002686 utilities.assert_equals(
2687 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002688 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002689 onpass="IPv6 Ping across 4556 Point intents test PASS",
2690 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2691
You Wangb6586542016-02-26 09:25:56 -08002692 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002693 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002694 main.stop( email=main.emailOnStop )
2695
Hari Krishnac195f3b2015-07-08 20:02:24 -07002696 def CASE90( self ):
2697 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002698 Install 600 point intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002699 """
2700 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2701 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002702 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002703
Hari Krishnac195f3b2015-07-08 20:02:24 -07002704 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002705 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002706 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002707
Jon Hallef0e2a12017-05-24 16:57:53 -07002708 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002709 intentState = main.CHOtestFunctions.checkIntents()
2710 utilities.assert_equals( expect=main.TRUE,
2711 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002712 onpass="INTENTS INSTALLED",
2713 onfail="SOME INTENTS NOT INSTALLED" )
2714
Hari Krishnac195f3b2015-07-08 20:02:24 -07002715 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002716 pingResult = main.CHOtestFunctions.checkPingall()
2717 utilities.assert_equals( expect=main.TRUE,
2718 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002719 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002720 onfail="PING ALL FAIL" )
2721
GlennRCbddd58f2015-10-01 15:45:25 -07002722 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002723 utilities.assert_equals(
2724 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002725 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002726 onpass="Install 600 point Intents and Ping All test PASS",
2727 onfail="Install 600 point Intents and Ping All test FAIL" )
2728
GlennRCbddd58f2015-10-01 15:45:25 -07002729 if not intentState:
2730 main.log.debug( "Intents failed to install completely" )
2731 if not pingResult:
2732 main.log.debug( "Pingall failed" )
2733
2734 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002735 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002736 main.stop( email=main.emailOnStop )
2737
Hari Krishnac195f3b2015-07-08 20:02:24 -07002738 def CASE91( self ):
2739 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002740 Install 600 point intents and verify ping all ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002741 """
2742 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2743 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002744 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002745
Hari Krishnac195f3b2015-07-08 20:02:24 -07002746 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002747 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002748 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002749
Jon Hallef0e2a12017-05-24 16:57:53 -07002750 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002751 intentState = main.CHOtestFunctions.checkIntents()
2752 utilities.assert_equals( expect=main.TRUE,
2753 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002754 onpass="INTENTS INSTALLED",
2755 onfail="SOME INTENTS NOT INSTALLED" )
2756
Hari Krishnac195f3b2015-07-08 20:02:24 -07002757 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002758 pingResult = main.CHOtestFunctions.checkPingall()
2759 utilities.assert_equals( expect=main.TRUE,
2760 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002761 onpass="PING ALL PASS",
2762 onfail="PING ALL FAIL" )
2763
GlennRCbddd58f2015-10-01 15:45:25 -07002764 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002765 utilities.assert_equals(
2766 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002767 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002768 onpass="Install 600 point Intents and Ping All test PASS",
2769 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002770
GlennRCbddd58f2015-10-01 15:45:25 -07002771 if not intentState:
2772 main.log.debug( "Intents failed to install completely" )
2773 if not pingResult:
2774 main.log.debug( "Pingall failed" )
2775
2776 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002777 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002778 main.stop( email=main.emailOnStop )
2779
Hari Krishnac195f3b2015-07-08 20:02:24 -07002780 def CASE92( self ):
2781 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002782 Install 4556 point intents and verify ping all ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002783 """
2784 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2785 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002786 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002787
You Wangb6586542016-02-26 09:25:56 -08002788 main.step( "Add point Intents" )
2789 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002790 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002791
Jon Hallef0e2a12017-05-24 16:57:53 -07002792 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002793 intentState = main.CHOtestFunctions.checkIntents()
2794 utilities.assert_equals( expect=main.TRUE,
2795 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002796 onpass="INTENTS INSTALLED",
2797 onfail="SOME INTENTS NOT INSTALLED" )
2798
Hari Krishnac195f3b2015-07-08 20:02:24 -07002799 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002800 pingResult = main.CHOtestFunctions.checkPingall()
2801 utilities.assert_equals( expect=main.TRUE,
2802 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002803 onpass="PING ALL PASS",
2804 onfail="PING ALL FAIL" )
2805
GlennRCbddd58f2015-10-01 15:45:25 -07002806 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002807 utilities.assert_equals(
2808 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002809 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002810 onpass="Install 4556 point Intents and Ping All test PASS",
2811 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002812
GlennRCbddd58f2015-10-01 15:45:25 -07002813 if not intentState:
2814 main.log.debug( "Intents failed to install completely" )
2815 if not pingResult:
2816 main.log.debug( "Pingall failed" )
2817
2818 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002819 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002820 main.stop( email=main.emailOnStop )
2821
Hari Krishnac195f3b2015-07-08 20:02:24 -07002822 def CASE93( self ):
2823 """
2824 Install multi-single point intents and verify Ping all works
2825 for att topology
2826 """
2827 import copy
2828 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002829 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002830 main.log.report( "Install multi-single point intents and verify Ping all" )
2831 main.log.report( "___________________________________________" )
2832 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002833 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2834 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002835 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002836 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002837 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002838 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002839 pool = []
2840 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002841 egressDevice = deviceDPIDsCopy[ i ]
2842 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2843 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002844 if i >= len( deviceDPIDsCopy ):
2845 break
2846 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002847 threadID=main.threadID,
2848 name="addMultipointToSinglepointIntent",
2849 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2850 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002851 t.start()
2852 i = i + 1
2853 main.threadID = main.threadID + 1
2854 for thread in pool:
2855 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002856 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002857 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002858 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07002859
Jon Hallef0e2a12017-05-24 16:57:53 -07002860 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002861 # Giving onos multiple chances to install intents
2862 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002863 if i != 0:
2864 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002865 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002866 time.sleep( main.checkIntentsDelay )
2867
2868 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07002869 for e in range( int( main.numCtrls ) ):
2870 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2871 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002872 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002873 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002874 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002875 if intentState:
2876 break
You Wangb6586542016-02-26 09:25:56 -08002877 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002878 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002879 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002880
2881 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2882 onpass="INTENTS INSTALLED",
2883 onfail="SOME INTENTS NOT INSTALLED" )
2884
Jon Hallef0e2a12017-05-24 16:57:53 -07002885 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002886
2887 for i in range( main.flowCheck ):
2888 if i != 0:
2889 main.log.warn( "verification failed. Retrying..." )
2890 main.log.info( "Waiting for onos to add flows..." )
2891 time.sleep( main.checkFlowsDelay )
2892
2893 flowState = main.TRUE
2894 for cli in main.CLIs:
2895 flowState = cli.checkFlowState()
2896 if not flowState:
2897 main.log.warn( "Not all flows added" )
2898 if flowState:
2899 break
2900 else:
2901 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002902 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002903
2904 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2905 onpass="FLOWS INSTALLED",
2906 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002907
Hari Krishnac195f3b2015-07-08 20:02:24 -07002908 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002909 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07002910 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002911 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07002912 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07002913 main.log.warn( "First pingall failed. Retrying..." )
2914 time.sleep( main.pingSleep )
2915 else:
2916 break
GlennRCdb2c8422015-09-29 12:21:59 -07002917
Hari Krishnac195f3b2015-07-08 20:02:24 -07002918 time2 = time.time()
2919 timeDiff = round( ( time2 - time1 ), 2 )
2920 main.log.report(
2921 "Time taken for Ping All: " +
2922 str( timeDiff ) +
2923 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002924
GlennRCbddd58f2015-10-01 15:45:25 -07002925 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002926 utilities.assert_equals(
2927 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002928 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002929 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2930 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002931
GlennRCfa69a2a2015-10-02 15:54:06 -07002932 if not intentState:
2933 main.log.debug( "Intents failed to install completely" )
2934 if not pingResult:
2935 main.log.debug( "Pingall failed" )
2936 if not checkFlowsState:
2937 main.log.debug( "Flows failed to add completely" )
2938
2939 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002940 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002941 main.stop( email=main.emailOnStop )
2942
Hari Krishnac195f3b2015-07-08 20:02:24 -07002943 def CASE94( self ):
2944 """
2945 Install multi-single point intents and verify Ping all works
2946 for Chordal topology
2947 """
2948 import copy
2949 import time
2950 main.log.report( "Install multi-single point intents and verify Ping all" )
2951 main.log.report( "___________________________________________" )
2952 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002953 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2954 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002955 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002956 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002957 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002958 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002959 pool = []
2960 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002961 egressDevice = deviceDPIDsCopy[ i ]
2962 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2963 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002964 if i >= len( deviceDPIDsCopy ):
2965 break
2966 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002967 threadID=main.threadID,
2968 name="addMultipointToSinglepointIntent",
2969 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2970 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002971 t.start()
2972 i = i + 1
2973 main.threadID = main.threadID + 1
2974 for thread in pool:
2975 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002976 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002977 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002978 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002979
Jon Hallef0e2a12017-05-24 16:57:53 -07002980 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002981 # Giving onos multiple chances to install intents
2982 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002983 if i != 0:
2984 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002985 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002986 time.sleep( main.checkIntentsDelay )
2987
2988 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07002989 for e in range( int( main.numCtrls ) ):
2990 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2991 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002992 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002993 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002994 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002995 if intentState:
2996 break
You Wangb6586542016-02-26 09:25:56 -08002997 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002998 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002999 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003000
GlennRCdb2c8422015-09-29 12:21:59 -07003001 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3002 onpass="INTENTS INSTALLED",
3003 onfail="SOME INTENTS NOT INSTALLED" )
3004
Jon Hallef0e2a12017-05-24 16:57:53 -07003005 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003006
3007 for i in range( main.flowCheck ):
3008 if i != 0:
3009 main.log.warn( "verification failed. Retrying..." )
3010 main.log.info( "Waiting for onos to add flows..." )
3011 time.sleep( main.checkFlowsDelay )
3012
3013 flowState = main.TRUE
3014 for cli in main.CLIs:
3015 flowState = cli.checkFlowState()
3016 if not flowState:
3017 main.log.warn( "Not all flows added" )
3018 if flowState:
3019 break
3020 else:
3021 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003022 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003023
3024 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3025 onpass="FLOWS INSTALLED",
3026 onfail="SOME FLOWS NOT ADDED" )
3027
Hari Krishnac195f3b2015-07-08 20:02:24 -07003028 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003029 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003030 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003031 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003032 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003033 main.log.warn( "First pingall failed. Retrying..." )
3034 time.sleep( main.pingSleep )
3035 else:
3036 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003037
Hari Krishnac195f3b2015-07-08 20:02:24 -07003038 time2 = time.time()
3039 timeDiff = round( ( time2 - time1 ), 2 )
3040 main.log.report(
3041 "Time taken for Ping All: " +
3042 str( timeDiff ) +
3043 " seconds" )
3044
GlennRCfa69a2a2015-10-02 15:54:06 -07003045 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003046 utilities.assert_equals(
3047 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003048 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003049 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3050 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003051
GlennRCfa69a2a2015-10-02 15:54:06 -07003052 if not intentState:
3053 main.log.debug( "Intents failed to install completely" )
3054 if not pingResult:
3055 main.log.debug( "Pingall failed" )
3056 if not checkFlowsState:
3057 main.log.debug( "Flows failed to add completely" )
3058
3059 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003060 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003061 main.stop( email=main.emailOnStop )
3062
3063 def CASE95( self ):
3064 """
3065 Install multi-single point intents and verify Ping all works
3066 for Spine topology
3067 """
3068 import copy
3069 import time
3070 main.log.report( "Install multi-single point intents and verify Ping all" )
3071 main.log.report( "___________________________________________" )
3072 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003073 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3074 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
GlennRCfa69a2a2015-10-02 15:54:06 -07003075 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003076 main.log.info( "MACsDict" + str( main.MACsDict ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003077 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003078 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003079 pool = []
3080 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003081 egressDevice = deviceDPIDsCopy[ i ]
3082 ingressDeviceList = copy.copy( deviceDPIDsCopy )
3083 ingressDeviceList.remove( egressDevice )
GlennRCfa69a2a2015-10-02 15:54:06 -07003084 if i >= len( deviceDPIDsCopy ):
3085 break
3086 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003087 threadID=main.threadID,
3088 name="addMultipointToSinglepointIntent",
3089 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
3090 pool.append( t )
GlennRCfa69a2a2015-10-02 15:54:06 -07003091 t.start()
3092 i = i + 1
3093 main.threadID = main.threadID + 1
3094 for thread in pool:
3095 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003096 intentIdList.append( thread.result )
GlennRCfa69a2a2015-10-02 15:54:06 -07003097 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003098 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003099
Jon Hallef0e2a12017-05-24 16:57:53 -07003100 main.step( "Verify intents are installed" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003101 # Giving onos multiple chances to install intents
3102 for i in range( main.intentCheck ):
3103 if i != 0:
3104 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003105 main.log.info( "Waiting for onos to install intents..." )
GlennRCfa69a2a2015-10-02 15:54:06 -07003106 time.sleep( main.checkIntentsDelay )
3107
3108 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003109 for e in range( int( main.numCtrls ) ):
3110 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3111 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003112 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003113 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003114 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003115 if intentState:
3116 break
You Wangb6586542016-02-26 09:25:56 -08003117 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003118 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003119 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003120
3121 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3122 onpass="INTENTS INSTALLED",
3123 onfail="SOME INTENTS NOT INSTALLED" )
3124
Jon Hallef0e2a12017-05-24 16:57:53 -07003125 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003126
3127 for i in range( main.flowCheck ):
3128 if i != 0:
3129 main.log.warn( "verification failed. Retrying..." )
3130 main.log.info( "Waiting for onos to add flows..." )
3131 time.sleep( main.checkFlowsDelay )
3132
3133 flowState = main.TRUE
3134 for cli in main.CLIs:
3135 flowState = cli.checkFlowState()
3136 if not flowState:
3137 main.log.warn( "Not all flows added" )
3138 if flowState:
3139 break
3140 else:
3141 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003142 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003143
3144 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3145 onpass="FLOWS INSTALLED",
3146 onfail="SOME FLOWS NOT ADDED" )
3147
3148 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003149 for i in range( main.numPings ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003150 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003151 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003152 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003153 main.log.warn( "First pingall failed. Retrying..." )
3154 time.sleep( main.pingSleep )
3155 else:
3156 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003157
3158 time2 = time.time()
3159 timeDiff = round( ( time2 - time1 ), 2 )
3160 main.log.report(
3161 "Time taken for Ping All: " +
3162 str( timeDiff ) +
3163 " seconds" )
3164
3165 caseResult = ( checkFlowsState and pingResult and intentState )
3166 utilities.assert_equals(
3167 expect=main.TRUE,
3168 actual=caseResult,
3169 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3170 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3171
3172 if not intentState:
3173 main.log.debug( "Intents failed to install completely" )
3174 if not pingResult:
3175 main.log.debug( "Pingall failed" )
3176 if not checkFlowsState:
3177 main.log.debug( "Flows failed to add completely" )
3178
3179 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003180 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003181 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003182
3183 def CASE96( self ):
3184 """
3185 Install single-multi point intents and verify Ping all works
3186 for att topology
3187 """
3188 import copy
3189 main.log.report( "Install single-multi point intents and verify Ping all" )
3190 main.log.report( "___________________________________________" )
3191 main.case( "Install single-multi point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003192 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3193 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003194 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003195 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003196 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003197 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003198 pool = []
3199 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003200 ingressDevice = deviceDPIDsCopy[ i ]
3201 egressDeviceList = copy.copy( deviceDPIDsCopy )
3202 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003203 if i >= len( deviceDPIDsCopy ):
3204 break
3205 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003206 threadID=main.threadID,
3207 name="addSinglepointToMultipointIntent",
3208 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ) ] )
3209 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003210 t.start()
3211 i = i + 1
3212 main.threadID = main.threadID + 1
3213 for thread in pool:
3214 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003215 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003216 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003217 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003218
Jon Hallef0e2a12017-05-24 16:57:53 -07003219 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003220 # Giving onos multiple chances to install intents
3221 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003222 if i != 0:
3223 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003224 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003225 time.sleep( main.checkIntentsDelay )
3226
3227 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003228 for e in range( int( main.numCtrls ) ):
3229 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3230 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003231 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003232 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003233 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003234 if intentState:
3235 break
You Wangb6586542016-02-26 09:25:56 -08003236 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003237 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003238 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003239
GlennRCdb2c8422015-09-29 12:21:59 -07003240 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3241 onpass="INTENTS INSTALLED",
3242 onfail="SOME INTENTS NOT INSTALLED" )
3243
Jon Hallef0e2a12017-05-24 16:57:53 -07003244 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003245
3246 for i in range( main.flowCheck ):
3247 if i != 0:
3248 main.log.warn( "verification failed. Retrying..." )
3249 main.log.info( "Waiting for onos to add flows..." )
3250 time.sleep( main.checkFlowsDelay )
3251
3252 flowState = main.TRUE
3253 for cli in main.CLIs:
3254 flowState = cli.checkFlowState()
3255 if not flowState:
3256 main.log.warn( "Not all flows added" )
3257 if flowState:
3258 break
3259 else:
3260 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003261 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003262
3263 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3264 onpass="FLOWS INSTALLED",
3265 onfail="SOME FLOWS NOT ADDED" )
3266
Hari Krishnac195f3b2015-07-08 20:02:24 -07003267 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003268 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003269 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003270 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003271 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003272 main.log.warn( "First pingall failed. Retrying..." )
3273 time.sleep( main.pingSleep )
3274 else:
3275 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003276
Hari Krishnac195f3b2015-07-08 20:02:24 -07003277 time2 = time.time()
3278 timeDiff = round( ( time2 - time1 ), 2 )
3279 main.log.report(
3280 "Time taken for Ping All: " +
3281 str( timeDiff ) +
3282 " seconds" )
3283
Jon Hallef0e2a12017-05-24 16:57:53 -07003284 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003285 utilities.assert_equals(
3286 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003287 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003288 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3289 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3290
GlennRCfa69a2a2015-10-02 15:54:06 -07003291 if not intentState:
3292 main.log.debug( "Intents failed to install completely" )
3293 if not pingResult:
3294 main.log.debug( "Pingall failed" )
3295 if not checkFlowsState:
3296 main.log.debug( "Flows failed to add completely" )
3297
3298 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003299 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003300 main.stop( email=main.emailOnStop )
3301
Hari Krishnac195f3b2015-07-08 20:02:24 -07003302 def CASE97( self ):
3303 """
3304 Install single-multi point intents and verify Ping all works
3305 for Chordal topology
3306 """
3307 import copy
3308 main.log.report( "Install single-multi point intents and verify Ping all" )
3309 main.log.report( "___________________________________________" )
3310 main.case( "Install single-multi point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003311 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3312 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003313 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003314 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003315 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003316 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003317 pool = []
3318 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003319 ingressDevice = deviceDPIDsCopy[ i ]
3320 egressDeviceList = copy.copy( deviceDPIDsCopy )
3321 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003322 if i >= len( deviceDPIDsCopy ):
3323 break
3324 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003325 threadID=main.threadID,
3326 name="addSinglepointToMultipointIntent",
3327 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ), '' ] )
3328 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003329 t.start()
3330 i = i + 1
3331 main.threadID = main.threadID + 1
3332 for thread in pool:
3333 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003334 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003335 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003336 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003337
Jon Hallef0e2a12017-05-24 16:57:53 -07003338 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003339 # Giving onos multiple chances to install intents
3340 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003341 if i != 0:
3342 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003343 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003344 time.sleep( main.checkIntentsDelay )
3345
3346 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003347 for e in range( int( main.numCtrls ) ):
3348 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3349 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003350 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003351 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003352 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003353 if intentState:
3354 break
You Wangb6586542016-02-26 09:25:56 -08003355 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003356 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003357 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003358
GlennRCdb2c8422015-09-29 12:21:59 -07003359 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3360 onpass="INTENTS INSTALLED",
3361 onfail="SOME INTENTS NOT INSTALLED" )
3362
Jon Hallef0e2a12017-05-24 16:57:53 -07003363 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003364
3365 for i in range( main.flowCheck ):
3366 if i != 0:
3367 main.log.warn( "verification failed. Retrying..." )
3368 main.log.info( "Waiting for onos to add flows..." )
3369 time.sleep( main.checkFlowsDelay )
3370
3371 flowState = main.TRUE
3372 for cli in main.CLIs:
3373 flowState = cli.checkFlowState()
3374 if not flowState:
3375 main.log.warn( "Not all flows added" )
3376 if flowState:
3377 break
3378 else:
3379 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003380 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003381
3382 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3383 onpass="FLOWS INSTALLED",
3384 onfail="SOME FLOWS NOT ADDED" )
3385
Hari Krishnac195f3b2015-07-08 20:02:24 -07003386 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003387 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003388 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003389 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003390 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003391 main.log.warn( "First pingall failed. Retrying..." )
3392 time.sleep( main.pingSleep )
3393 else:
3394 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003395
Hari Krishnac195f3b2015-07-08 20:02:24 -07003396 time2 = time.time()
3397 timeDiff = round( ( time2 - time1 ), 2 )
3398 main.log.report(
3399 "Time taken for Ping All: " +
3400 str( timeDiff ) +
3401 " seconds" )
3402
Jon Hallef0e2a12017-05-24 16:57:53 -07003403 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003404 utilities.assert_equals(
3405 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003406 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003407 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3408 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3409
GlennRCfa69a2a2015-10-02 15:54:06 -07003410 if not intentState:
3411 main.log.debug( "Intents failed to install completely" )
3412 if not pingResult:
3413 main.log.debug( "Pingall failed" )
3414 if not checkFlowsState:
3415 main.log.debug( "Flows failed to add completely" )
3416
3417 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003418 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003419 main.stop( email=main.emailOnStop )
3420
Hari Krishnac195f3b2015-07-08 20:02:24 -07003421 def CASE98( self ):
3422 """
3423 Install single-multi point intents and verify Ping all works
3424 for Spine topology
3425 """
3426 import copy
3427 main.log.report( "Install single-multi point intents and verify Ping all" )
3428 main.log.report( "___________________________________________" )
3429 main.case( "Install single-multi point intents and Ping all" )
3430 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3431 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
Jon Hallef0e2a12017-05-24 16:57:53 -07003432 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003433 intentIdList = []
3434 MACsDictCopy = {}
3435 for i in range( len( deviceDPIDsCopy ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003436 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07003437
Jon Hallef0e2a12017-05-24 16:57:53 -07003438 main.log.info( "deviceDPIDsCopy" + str( deviceDPIDsCopy ) )
3439 main.log.info( "MACsDictCopy" + str( MACsDictCopy ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003440 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003441 for i in xrange( 0, len( deviceDPIDsCopy ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003442 pool = []
3443 for cli in main.CLIs:
3444 if i >= len( deviceDPIDsCopy ):
3445 break
Jon Hallef0e2a12017-05-24 16:57:53 -07003446 ingressDevice = deviceDPIDsCopy[ i ]
3447 egressDeviceList = copy.copy( deviceDPIDsCopy )
3448 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003449 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003450 threadID=main.threadID,
3451 name="addSinglepointToMultipointIntent",
3452 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', MACsDictCopy.get( ingressDevice ), '' ] )
3453 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003454 t.start()
3455 i = i + 1
3456 main.threadID = main.threadID + 1
3457 for thread in pool:
3458 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003459 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003460 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003461 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003462
Jon Hallef0e2a12017-05-24 16:57:53 -07003463 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003464 # Giving onos multiple chances to install intents
3465 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003466 if i != 0:
3467 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003468 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003469 time.sleep( main.checkIntentsDelay )
3470
3471 intentState = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003472 for e in range( int( main.numCtrls ) ):
3473 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3474 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003475 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003476 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003477 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003478 if intentState:
3479 break
You Wangb6586542016-02-26 09:25:56 -08003480 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003481 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003482 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003483
GlennRCdb2c8422015-09-29 12:21:59 -07003484 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3485 onpass="INTENTS INSTALLED",
3486 onfail="SOME INTENTS NOT INSTALLED" )
3487
Jon Hallef0e2a12017-05-24 16:57:53 -07003488 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003489
3490 for i in range( main.flowCheck ):
3491 if i != 0:
3492 main.log.warn( "verification failed. Retrying..." )
3493 main.log.info( "Waiting for onos to add flows..." )
3494 time.sleep( main.checkFlowsDelay )
3495
3496 flowState = main.TRUE
3497 for cli in main.CLIs:
3498 flowState = cli.checkFlowState()
3499 if not flowState:
3500 main.log.warn( "Not all flows added" )
3501 if flowState:
3502 break
3503 else:
3504 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003505 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003506
3507 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3508 onpass="FLOWS INSTALLED",
3509 onfail="SOME FLOWS NOT ADDED" )
3510
Hari Krishnac195f3b2015-07-08 20:02:24 -07003511 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003512 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003513 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003514 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003515 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003516 main.log.warn( "First pingall failed. Retrying..." )
3517 time.sleep( main.pingSleep )
3518 else:
3519 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003520
Hari Krishnac195f3b2015-07-08 20:02:24 -07003521 time2 = time.time()
3522 timeDiff = round( ( time2 - time1 ), 2 )
3523 main.log.report(
3524 "Time taken for Ping All: " +
3525 str( timeDiff ) +
3526 " seconds" )
3527
Jon Hallef0e2a12017-05-24 16:57:53 -07003528 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003529 utilities.assert_equals(
3530 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003531 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003532 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3533 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3534
GlennRCfa69a2a2015-10-02 15:54:06 -07003535 if not intentState:
3536 main.log.debug( "Intents failed to install completely" )
3537 if not pingResult:
3538 main.log.debug( "Pingall failed" )
3539 if not checkFlowsState:
3540 main.log.debug( "Flows failed to add completely" )
3541
3542 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003543 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003544 main.stop( email=main.emailOnStop )
3545
Hari Krishna4223dbd2015-08-13 16:29:53 -07003546 def CASE190( self ):
3547 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003548 Verify IPv6 ping across 600 Point intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003549 """
3550 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3551 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003552 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003553
Hari Krishna4223dbd2015-08-13 16:29:53 -07003554 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003555 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3556 utilities.assert_equals( expect=main.TRUE,
3557 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003558 onpass="PING ALL PASS",
3559 onfail="PING ALL FAIL" )
3560
GlennRCbddd58f2015-10-01 15:45:25 -07003561 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003562 utilities.assert_equals(
3563 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003564 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003565 onpass="IPv6 Ping across 600 Point intents test PASS",
3566 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3567
You Wangb6586542016-02-26 09:25:56 -08003568 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003569 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003570 main.stop( email=main.emailOnStop )
3571
Hari Krishna4223dbd2015-08-13 16:29:53 -07003572 def CASE191( self ):
3573 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003574 Verify IPv6 ping across 600 Point intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003575 """
3576 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3577 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003578 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003579
Hari Krishna4223dbd2015-08-13 16:29:53 -07003580 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003581 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3582 utilities.assert_equals( expect=main.TRUE,
3583 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003584 onpass="PING ALL PASS",
3585 onfail="PING ALL FAIL" )
3586
GlennRCbddd58f2015-10-01 15:45:25 -07003587 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003588 utilities.assert_equals(
3589 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003590 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003591 onpass="IPv6 Ping across 600 Point intents test PASS",
3592 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3593
You Wangb6586542016-02-26 09:25:56 -08003594 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003595 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003596 main.stop( email=main.emailOnStop )
3597
Hari Krishna4223dbd2015-08-13 16:29:53 -07003598 def CASE192( self ):
3599 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003600 Verify IPv6 ping across 4556 Point intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003601 """
3602 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3603 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003604 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003605
Hari Krishna4223dbd2015-08-13 16:29:53 -07003606 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003607 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3608 utilities.assert_equals( expect=main.TRUE,
3609 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003610 onpass="PING ALL PASS",
3611 onfail="PING ALL FAIL" )
3612
GlennRCbddd58f2015-10-01 15:45:25 -07003613 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003614 utilities.assert_equals(
3615 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003616 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003617 onpass="IPv6 Ping across 4556 Point intents test PASS",
3618 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003619
You Wangb6586542016-02-26 09:25:56 -08003620 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003621 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003622 main.stop( email=main.emailOnStop )
3623
Hari Krishnac195f3b2015-07-08 20:02:24 -07003624 def CASE10( self ):
3625 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003626 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003627 """
3628 Remove all Intents
3629 """
3630 main.log.report( "Remove all intents that were installed previously" )
3631 main.log.report( "______________________________________________" )
3632 main.log.info( "Remove all intents" )
3633 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003634 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003635 main.step( "Obtain the intent id's first" )
3636 intentsList = main.ONOScli1.getAllIntentIds()
3637 ansi_escape = re.compile( r'\x1b[^m]*m' )
3638 intentsList = ansi_escape.sub( '', intentsList )
3639 intentsList = intentsList.replace(
3640 " onos:intents | grep id=",
3641 "" ).replace(
3642 "id=",
3643 "" ).replace(
3644 "\r\r",
3645 "" )
3646 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003647 intentIdList = []
3648 step1Result = main.TRUE
3649 moreIntents = main.TRUE
3650 removeIntentCount = 0
Jon Hallef0e2a12017-05-24 16:57:53 -07003651 intentsCount = len( intentsList )
3652 main.log.info( "Current number of intents: " + str( intentsCount ) )
You Wangb6586542016-02-26 09:25:56 -08003653
3654 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003655 if ( len( intentsList ) > 1 ):
3656 results = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003657 main.log.info( "Removing intent..." )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003658 while moreIntents:
Jon Hallef0e2a12017-05-24 16:57:53 -07003659 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003660 if removeIntentCount == 5:
3661 break
3662 removeIntentCount = removeIntentCount + 1
3663 intentsList1 = main.ONOScli1.getAllIntentIds()
3664 if len( intentsList1 ) == 0:
3665 break
3666 ansi_escape = re.compile( r'\x1b[^m]*m' )
3667 intentsList1 = ansi_escape.sub( '', intentsList1 )
3668 intentsList1 = intentsList1.replace(
3669 " onos:intents | grep id=",
3670 "" ).replace(
3671 " state=",
3672 "" ).replace(
3673 "\r\r",
3674 "" )
3675 intentsList1 = intentsList1.splitlines()
Jon Hallef0e2a12017-05-24 16:57:53 -07003676 main.log.info( "Round %d intents to remove: " % ( removeIntentCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003677 print intentsList1
3678 intentIdList1 = []
3679 if ( len( intentsList1 ) > 0 ):
3680 moreIntents = main.TRUE
3681 for i in range( len( intentsList1 ) ):
3682 intentsTemp1 = intentsList1[ i ].split( ',' )
Jon Hallef0e2a12017-05-24 16:57:53 -07003683 intentIdList1.append( intentsTemp1[ 0 ].split( '=' )[ 1 ] )
3684 main.log.info( "Leftover Intent IDs: " + str( intentIdList1 ) )
3685 main.log.info( "Length of Leftover Intents list: " + str( len( intentIdList1 ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003686 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003687 for i in xrange( 0, len( intentIdList1 ), int( main.numCtrls ) ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003688 pool = []
3689 for cli in main.CLIs:
3690 if i >= len( intentIdList1 ):
3691 break
3692 t = main.Thread( target=cli.removeIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003693 threadID=main.threadID,
3694 name="removeIntent",
3695 args=[ intentIdList1[ i ], 'org.onosproject.cli', False, False ] )
3696 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003697 t.start()
3698 i = i + 1
3699 main.threadID = main.threadID + 1
3700 for thread in pool:
3701 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003702 intentIdList.append( thread.result )
3703 #time.sleep( 2 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003704 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003705 main.log.info( "Time for removing host intents: %2f seconds" % ( time2 - time1 ) )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003706 time.sleep( purgeDelay )
Jon Hallef0e2a12017-05-24 16:57:53 -07003707 main.log.info( "Purging WITHDRAWN Intents" )
3708 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003709 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003710 time.sleep( 10 )
3711 if len( main.ONOScli1.intents() ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003712 continue
3713 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003714 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003715 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003716 print "Removed %d intents" % ( intentsCount )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003717 step1Result = main.TRUE
3718 else:
3719 print "No Intent IDs found in Intents list: ", intentsList
3720 step1Result = main.FALSE
3721
3722 print main.ONOScli1.intents()
You Wangb6586542016-02-26 09:25:56 -08003723
3724 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003725 caseResult = step1Result
3726 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003727 onpass="Intent removal test successful",
3728 onfail="Intent removal test failed" )
3729
3730 def CASE12( self, main ):
3731 """
3732 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3733 """
3734 import re
3735 import copy
3736 import time
3737
Hari Krishnac195f3b2015-07-08 20:02:24 -07003738 threadID = 0
3739
3740 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3741 main.log.report( "_____________________________________________________" )
3742 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3743 main.step( "Enable intent based Reactive forwarding" )
3744 installResult = main.FALSE
3745 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003746
Hari Krishnac195f3b2015-07-08 20:02:24 -07003747 pool = []
3748 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003749 for cli, feature in main.CLIs:
3750 t = main.Thread( target=cli, threadID=threadID,
3751 name="featureInstall", args=[ feature ] )
3752 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003753 t.start()
3754 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003755
Hari Krishnac195f3b2015-07-08 20:02:24 -07003756 results = []
3757 for thread in pool:
3758 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003759 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003760 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003761
Jon Hallef0e2a12017-05-24 16:57:53 -07003762 if( all( result == main.TRUE for result in results ) == False ):
3763 main.log.info( "Did not install onos-app-ifwd feature properly" )
3764 #main.cleanup()
3765 #main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003766 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003767 main.log.info( "Successful feature:install onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003768 installResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003769 main.log.info( "Time for feature:install onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07003770
GlennRC6ac11b12015-10-21 17:41:28 -07003771 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003772 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -07003773 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003774 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003775 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003776 main.log.warn( "First pingall failed. Retrying..." )
3777 time.sleep( main.pingSleep )
3778 else:
3779 break
GlennRC6ac11b12015-10-21 17:41:28 -07003780
Hari Krishnac195f3b2015-07-08 20:02:24 -07003781 time2 = time.time()
3782 timeDiff = round( ( time2 - time1 ), 2 )
3783 main.log.report(
3784 "Time taken for Ping All: " +
3785 str( timeDiff ) +
3786 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003787
GlennRC626ba132015-09-18 16:16:31 -07003788 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003789 main.log.report( "Pingall Test in Reactive mode successful" )
3790 else:
3791 main.log.report( "Pingall Test in Reactive mode failed" )
3792
3793 main.step( "Disable Intent based Reactive forwarding" )
3794 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003795
Hari Krishnac195f3b2015-07-08 20:02:24 -07003796 pool = []
3797 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003798 for cli, feature in main.CLIs:
3799 t = main.Thread( target=cli, threadID=threadID,
3800 name="featureUninstall", args=[ feature ] )
3801 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003802 t.start()
3803 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003804
Hari Krishnac195f3b2015-07-08 20:02:24 -07003805 results = []
3806 for thread in pool:
3807 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003808 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003809 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003810
Jon Hallef0e2a12017-05-24 16:57:53 -07003811 if( all( result == main.TRUE for result in results ) == False ):
3812 main.log.info( "Did not uninstall onos-app-ifwd feature properly" )
3813 uninstallResult = main.FALSE
3814 #main.cleanup()
3815 #main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003816 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003817 main.log.info( "Successful feature:uninstall onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003818 uninstallResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003819 main.log.info( "Time for feature:uninstall onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003820
3821 # Waiting for reative flows to be cleared.
3822 time.sleep( 10 )
3823
GlennRCbddd58f2015-10-01 15:45:25 -07003824 caseResult = installResult and pingResult and uninstallResult
3825 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003826 onpass="Intent based Reactive forwarding Pingall test PASS",
3827 onfail="Intent based Reactive forwarding Pingall test FAIL" )