blob: 0246b12eb2ff7988d37dd400e11bbd6d9ae8937b [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001'''
2Copyright 2015 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20'''
21
Hari Krishnac195f3b2015-07-08 20:02:24 -070022import sys
23import os
24import re
25import time
26import json
27import itertools
28
29
Hari Krishna6185fc12015-07-13 15:42:31 -070030class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070031
32 def __init__( self ):
33 self.default = ''
34
35 def CASE1( self, main ):
36 """
37 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070038 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070039 git pull
Hari Krishnac195f3b2015-07-08 20:02:24 -070040 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070041 onos-verify-cell
42 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070043 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070044 onos-start-cli
45 """
46 import time
You Wangb6586542016-02-26 09:25:56 -080047 import re
48 import imp
Hari Krishnac195f3b2015-07-08 20:02:24 -070049
50 global intentState
Devin Lim58046fa2017-07-05 16:55:00 -070051 try:
52 from tests.dependencies.ONOSSetup import ONOSSetup
53 main.testSetUp = ONOSSetup()
54 except ImportError:
55 main.log.error( "ONOSSetup not found exiting the test" )
56 main.exit()
57 main.testSetUp.envSetupDescription()
Hari Krishnac195f3b2015-07-08 20:02:24 -070058
Devin Lim58046fa2017-07-05 16:55:00 -070059 try:
60 time1 = time.time()
61 main.dependencyPath = main.testOnDirectory + \
62 main.params[ 'DEPENDENCY' ][ 'path' ]
63 wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper' ]
64 main.numCtrls = int ( main.params[ 'CTRL' ][ 'numCtrl' ] )
65 main.maxNodes = main.numCtrls
66 karafTimeout = main.params[ 'CTRL' ][ 'karafCliTimeout' ]
67 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
68 main.checkIntentsDelay = int( main.params[ 'timers' ][ 'CheckIntentDelay' ] )
69 main.pingSleep = int( main.params[ 'timers' ][ 'pingSleep' ] )
70 main.topoCheckDelay = int( main.params[ 'timers' ][ 'topoCheckDelay' ] )
71 main.pingTimeoutSmallTopo = int( main.params[ 'timers' ][ 'pingTimeoutSmallTopo' ] )
72 main.pingTimeoutLargeTopo = int( main.params[ 'timers' ][ 'pingTimeoutLargeTopo' ] )
73 main.remHostDelay = int( main.params[ 'timers' ][ 'remHostDelay' ] )
74 main.remDevDelay = int( main.params[ 'timers' ][ 'remDevDelay' ] )
75 main.failSwitch = main.params[ 'TEST' ][ 'pauseTest' ]
76 main.emailOnStop = main.params[ 'TEST' ][ 'email' ]
77 main.intentCheck = int( main.params[ 'TEST' ][ 'intentChecks' ] )
78 main.linkCheck = int( main.params[ 'TEST' ][ 'linkChecks' ] )
79 main.topoCheck = int( main.params[ 'TEST' ][ 'topoChecks' ] )
80 main.numPings = int( main.params[ 'TEST' ][ 'numPings' ] )
81 main.newTopo = ""
GlennRC9e7465e2015-10-02 13:50:36 -070082
Devin Lim58046fa2017-07-05 16:55:00 -070083 main.failSwitch = True if main.failSwitch == "on" else False
84 main.emailOnStop = True if main.emailOnStop == "on" else False
Hari Krishnac195f3b2015-07-08 20:02:24 -070085
Devin Lim58046fa2017-07-05 16:55:00 -070086 main.CHOtestFunctions = imp.load_source( wrapperFile,
87 main.dependencyPath +
88 wrapperFile +
89 ".py" )
You Wangb6586542016-02-26 09:25:56 -080090
Devin Lim58046fa2017-07-05 16:55:00 -070091 stepResult = main.testSetUp.envSetup()
92 except Exception as e:
93 main.testSetUp.envSetupException( e )
Hari Krishnac195f3b2015-07-08 20:02:24 -070094
Devin Lim58046fa2017-07-05 16:55:00 -070095 main.testSetUp.evnSetupConclusion( stepResult )
96
97 if not main.onoscell :
98 main.log.error("Please provide onoscell option at TestON CLI to run CHO tests")
99 main.log.error("Example: ~/TestON/bin/cli.py run CHOtest onoscell <cellName>")
GlennRCef344fc2015-12-11 17:56:57 -0800100 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -0700101 main.exit()
102
Devin Lim58046fa2017-07-05 16:55:00 -0700103 setupResult = main.testSetUp.ONOSSetUp( Mininet=main.Mininet1, newCell=False, cellName=main.onoscell )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700104
105 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700106 time.sleep( 30 )
107 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" )
108 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700109 cfgResult = cfgResult1 and cfgResult2
110 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
111 onpass="ipv6NeighborDiscovery cfg is set to true",
112 onfail="Failed to cfg set ipv6NeighborDiscovery" )
113
Devin Lim58046fa2017-07-05 16:55:00 -0700114 case1Result = setupResult and cfgResult
115 main.log.info( "Time for connecting to CLI: %2f seconds" % ( time.time() - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700116 utilities.assert_equals( expect=main.TRUE, actual=case1Result,
117 onpass="Set up test environment PASS",
118 onfail="Set up test environment FAIL" )
119
120 def CASE20( self, main ):
121 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700122 This test script Loads a new Topology ( Att ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700123 """
124 import re
125 import time
126 import copy
127
GlennRC3de72232015-12-16 10:48:35 -0800128 main.prefix = 0
Jon Hallef0e2a12017-05-24 16:57:53 -0700129 main.numMNswitches = int( main.params[ 'TOPO1' ][ 'numSwitches' ] )
130 main.numMNlinks = int( main.params[ 'TOPO1' ][ 'numLinks' ] )
131 main.numMNhosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800132 main.pingTimeout = main.pingTimeoutSmallTopo
133
Hari Krishnac195f3b2015-07-08 20:02:24 -0700134 main.log.report(
135 "Load Att topology and Balance all Mininet switches across controllers" )
136 main.log.report(
137 "________________________________________________________________________" )
138 main.case(
139 "Assign and Balance all Mininet switches across controllers" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700140
Hari Krishnac195f3b2015-07-08 20:02:24 -0700141 main.step( "Start Mininet with Att topology" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700142 main.newTopo = main.params[ 'TOPO1' ][ 'topo' ]
GlennRCc6cd2a62015-08-10 16:08:22 -0700143 mininetDir = main.Mininet1.home + "/custom/"
Devin Lim58046fa2017-07-05 16:55:00 -0700144 topoPath = main.dependencyPath + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700145 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700146 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700147 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Jon Hall4ba53f02015-07-29 13:07:41 -0700148
Hari Krishnac195f3b2015-07-08 20:02:24 -0700149 main.step( "Assign switches to controllers" )
150 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
151 main.Mininet1.assignSwController(
152 sw="s" + str( i ),
Devin Lim58046fa2017-07-05 16:55:00 -0700153 ip=main.ONOSip )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700154
155 switch_mastership = main.TRUE
156 for i in range( 1, ( main.numMNswitches + 1 ) ):
157 response = main.Mininet1.getSwController( "s" + str( i ) )
158 print( "Response is " + str( response ) )
Devin Lim58046fa2017-07-05 16:55:00 -0700159 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700160 switch_mastership = switch_mastership and main.TRUE
161 else:
162 switch_mastership = main.FALSE
163
164 if switch_mastership == main.TRUE:
165 main.log.report( "Controller assignment successfull" )
166 else:
167 main.log.report( "Controller assignment failed" )
168
Jon Hallef0e2a12017-05-24 16:57:53 -0700169 time.sleep( 30 ) # waiting here to make sure topology converges across all nodes
Hari Krishnac195f3b2015-07-08 20:02:24 -0700170
171 main.step( "Balance devices across controllers" )
172 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700173 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700174 time.sleep( 5 )
175
176 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700177 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700178 case2Result = ( switch_mastership and startStatus )
179 utilities.assert_equals(
180 expect=main.TRUE,
181 actual=case2Result,
182 onpass="Starting new Att topology test PASS",
183 onfail="Starting new Att topology test FAIL" )
184
185 def CASE21( self, main ):
186 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700187 This test script Loads a new Topology ( Chordal ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700188 """
189 import re
190 import time
191 import copy
192
GlennRC3de72232015-12-16 10:48:35 -0800193 main.prefix = 1
Jon Hallef0e2a12017-05-24 16:57:53 -0700194 main.newTopo = main.params[ 'TOPO2' ][ 'topo' ]
195 main.numMNswitches = int( main.params[ 'TOPO2' ][ 'numSwitches' ] )
196 main.numMNlinks = int( main.params[ 'TOPO2' ][ 'numLinks' ] )
197 main.numMNhosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800198 main.pingTimeout = main.pingTimeoutSmallTopo
199
Hari Krishnac195f3b2015-07-08 20:02:24 -0700200 main.log.report(
201 "Load Chordal topology and Balance all Mininet switches across controllers" )
202 main.log.report(
203 "________________________________________________________________________" )
204 main.case(
205 "Assign and Balance all Mininet switches across controllers" )
206
Jon Hallef0e2a12017-05-24 16:57:53 -0700207 main.step( "Start Mininet with Chordal topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700208 mininetDir = main.Mininet1.home + "/custom/"
Devin Lim58046fa2017-07-05 16:55:00 -0700209 topoPath = main.dependencyPath + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700210 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700211 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700212 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700213
214 main.step( "Assign switches to controllers" )
215
216 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
217 main.Mininet1.assignSwController(
218 sw="s" + str( i ),
Devin Lim58046fa2017-07-05 16:55:00 -0700219 ip=main.ONOSip )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700220
221 switch_mastership = main.TRUE
222 for i in range( 1, ( main.numMNswitches + 1 ) ):
223 response = main.Mininet1.getSwController( "s" + str( i ) )
224 print( "Response is " + str( response ) )
Devin Lim58046fa2017-07-05 16:55:00 -0700225 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700226 switch_mastership = switch_mastership and main.TRUE
227 else:
228 switch_mastership = main.FALSE
229
230 if switch_mastership == main.TRUE:
231 main.log.report( "Controller assignment successfull" )
232 else:
233 main.log.report( "Controller assignment failed" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700234
Hari Krishnac195f3b2015-07-08 20:02:24 -0700235 main.step( "Balance devices across controllers" )
236 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700237 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700238 time.sleep( 5 )
239
GlennRCbddd58f2015-10-01 15:45:25 -0700240 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700241 time.sleep( 30 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700242 utilities.assert_equals(
243 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700244 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700245 onpass="Starting new Chordal topology test PASS",
246 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700247
Hari Krishnac195f3b2015-07-08 20:02:24 -0700248 def CASE22( self, main ):
249 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700250 This test script Loads a new Topology ( Spine ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700251 """
252 import re
253 import time
254 import copy
255
GlennRC3de72232015-12-16 10:48:35 -0800256 main.prefix = 2
Jon Hallef0e2a12017-05-24 16:57:53 -0700257 main.newTopo = main.params[ 'TOPO3' ][ 'topo' ]
258 main.numMNswitches = int( main.params[ 'TOPO3' ][ 'numSwitches' ] )
259 main.numMNlinks = int( main.params[ 'TOPO3' ][ 'numLinks' ] )
260 main.numMNhosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800261 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700262
Hari Krishnac195f3b2015-07-08 20:02:24 -0700263 main.log.report(
264 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
265 main.log.report(
266 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800267 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700268
Jon Hallef0e2a12017-05-24 16:57:53 -0700269 main.step( "Start Mininet with Spine topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700270 mininetDir = main.Mininet1.home + "/custom/"
Devin Lim58046fa2017-07-05 16:55:00 -0700271 topoPath = main.dependencyPath + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700272 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700273 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700274 startStatus = main.Mininet1.startNet( topoFile=topoPath )
GlennRCc6cd2a62015-08-10 16:08:22 -0700275
Hari Krishnac195f3b2015-07-08 20:02:24 -0700276 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
277 main.Mininet1.assignSwController(
278 sw="s" + str( i ),
Devin Lim58046fa2017-07-05 16:55:00 -0700279 ip=main.ONOSip )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700280
281 switch_mastership = main.TRUE
282 for i in range( 1, ( main.numMNswitches + 1 ) ):
283 response = main.Mininet1.getSwController( "s" + str( i ) )
284 print( "Response is " + str( response ) )
Devin Lim58046fa2017-07-05 16:55:00 -0700285 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700286 switch_mastership = switch_mastership and main.TRUE
287 else:
288 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700289
Hari Krishnac195f3b2015-07-08 20:02:24 -0700290 if switch_mastership == main.TRUE:
291 main.log.report( "Controller assignment successfull" )
292 else:
293 main.log.report( "Controller assignment failed" )
294 time.sleep( 5 )
295
296 main.step( "Balance devices across controllers" )
Devin Lim58046fa2017-07-05 16:55:00 -0700297 for i in range( main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700298 balanceResult = main.ONOScli1.balanceMasters()
299 # giving some breathing time for ONOS to complete re-balance
300 time.sleep( 3 )
301
GlennRCbddd58f2015-10-01 15:45:25 -0700302 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700303 time.sleep( 60 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700304 utilities.assert_equals(
305 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700306 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700307 onpass="Starting new Spine topology test PASS",
308 onfail="Starting new Spine topology test FAIL" )
309
310 def CASE3( self, main ):
311 """
312 This Test case will be extended to collect and store more data related
313 ONOS state.
314 """
315 import re
316 import copy
317 main.deviceDPIDs = []
318 main.hostMACs = []
319 main.deviceLinks = []
320 main.deviceActiveLinksCount = []
321 main.devicePortsEnabledCount = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700322
Hari Krishnac195f3b2015-07-08 20:02:24 -0700323 main.log.report(
324 "Collect and Store topology details from ONOS before running any Tests" )
325 main.log.report(
326 "____________________________________________________________________" )
327 main.case( "Collect and Store Topology Details from ONOS" )
328 main.step( "Collect and store current number of switches and links" )
329 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700330 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700331 numOnosDevices = topology_result[ 'devices' ]
332 numOnosLinks = topology_result[ 'links' ]
333 topoResult = main.TRUE
334
Jon Hallef0e2a12017-05-24 16:57:53 -0700335 for check in range( main.topoCheck ):
336 if ( ( main.numMNswitches == int( numOnosDevices ) ) and ( main.numMNlinks == int( numOnosLinks ) ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800337 main.step( "Store Device DPIDs" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700338 for i in range( 1, ( main.numMNswitches + 1 ) ):
GlennRC20fc6522015-12-23 23:26:57 -0800339 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800340 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700341
GlennRCee8f3bf2015-12-14 16:18:39 -0800342 main.step( "Store Host MACs" )
343 for i in range( 1, ( main.numMNhosts + 1 ) ):
344 main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
345 print "Host MACs in Store: \n", str( main.hostMACs )
346 main.MACsDict = {}
347 print "Creating dictionary of DPID and HostMacs"
Jon Hallef0e2a12017-05-24 16:57:53 -0700348 for i in range( len( main.hostMACs ) ):
349 main.MACsDict[ main.deviceDPIDs[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
GlennRCee8f3bf2015-12-14 16:18:39 -0800350 print main.MACsDict
351 main.step( "Collect and store all Devices Links" )
352 linksResult = main.ONOScli1.links( jsonFormat=False )
353 ansi_escape = re.compile( r'\x1b[^m]*m' )
354 linksResult = ansi_escape.sub( '', linksResult )
355 linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
356 linksResult = linksResult.splitlines()
357 main.deviceLinks = copy.copy( linksResult )
358 print "Device Links Stored: \n", str( main.deviceLinks )
359 # this will be asserted to check with the params provided count of
360 # links
361 print "Length of Links Store", len( main.deviceLinks )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700362
GlennRCee8f3bf2015-12-14 16:18:39 -0800363 main.step( "Collect and store each Device ports enabled Count" )
364 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -0700365 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800366 pool = []
367 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700368 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800369 break
GlennRC20fc6522015-12-23 23:26:57 -0800370 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700371 t = main.Thread( target=cli.getDevicePortsEnabledCount, threadID=main.threadID, name="getDevicePortsEnabledCount", args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800372 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700373 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800374 i = i + 1
375 main.threadID = main.threadID + 1
376 for thread in pool:
377 thread.join()
378 portResult = thread.result
379 main.devicePortsEnabledCount.append( portResult )
380 print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount )
381 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700382 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700383
GlennRCee8f3bf2015-12-14 16:18:39 -0800384 main.step( "Collect and store each Device active links Count" )
385 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700386
Devin Lim58046fa2017-07-05 16:55:00 -0700387 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800388 pool = []
389 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700390 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800391 break
GlennRC20fc6522015-12-23 23:26:57 -0800392 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700393 t = main.Thread( target=cli.getDeviceLinksActiveCount,
394 threadID=main.threadID,
395 name="getDevicePortsEnabledCount",
396 args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800397 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700398 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800399 i = i + 1
400 main.threadID = main.threadID + 1
401 for thread in pool:
402 thread.join()
403 linkCountResult = thread.result
404 main.deviceActiveLinksCount.append( linkCountResult )
405 print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
406 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700407 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700408
GlennRCee8f3bf2015-12-14 16:18:39 -0800409 # Exit out of the topo check loop
410 break
411
412 else:
Jon Hallef0e2a12017-05-24 16:57:53 -0700413 main.log.info( "Devices (expected): %s, Links (expected): %s" %
414 ( str( main.numMNswitches ), str( main.numMNlinks ) ) )
415 main.log.info( "Devices (actual): %s, Links (actual): %s" %
416 ( numOnosDevices, numOnosLinks ) )
417 main.log.info( "Topology does not match, trying again..." )
GlennRCee8f3bf2015-12-14 16:18:39 -0800418 topoResult = main.FALSE
Jon Hallef0e2a12017-05-24 16:57:53 -0700419 time.sleep( main.topoCheckDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700420
421 # just returning TRUE for now as this one just collects data
422 case3Result = topoResult
423 utilities.assert_equals( expect=main.TRUE, actual=case3Result,
424 onpass="Saving ONOS topology data test PASS",
425 onfail="Saving ONOS topology data test FAIL" )
426
GlennRC20fc6522015-12-23 23:26:57 -0800427 def CASE200( self, main ):
428
429 import time
Devin Lim58046fa2017-07-05 16:55:00 -0700430 try:
431 from tests.dependencies.utils import Utils
432 except ImportError:
433 main.log.error( "Utils not found. exiting the test" )
434 main.exit()
435 try:
436 main.Utils
437 except ( NameError, AttributeError ):
438 main.Utils = Utils()
439
GlennRC20fc6522015-12-23 23:26:57 -0800440 main.log.report( "Clean up ONOS" )
Jon Hall6509dbf2016-06-21 17:01:17 -0700441 main.case( "Stop topology and remove hosts and devices" )
GlennRC20fc6522015-12-23 23:26:57 -0800442
Devin Lim58046fa2017-07-05 16:55:00 -0700443 main.Utils.mininetCleanup( False )
GlennRC20fc6522015-12-23 23:26:57 -0800444
GlennRC20fc6522015-12-23 23:26:57 -0800445 main.log.info( "Constructing host id list" )
446 hosts = []
447 for i in range( main.numMNhosts ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700448 hosts.append( "h" + str( i + 1 ) )
GlennRC20fc6522015-12-23 23:26:57 -0800449
450 main.step( "Getting host ids" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700451 hostList = main.CLIs[ 0 ].getHostsId( hosts )
GlennRC20fc6522015-12-23 23:26:57 -0800452 hostIdResult = True if hostList else False
453 utilities.assert_equals( expect=True, actual=hostIdResult,
454 onpass="Successfully obtained the host ids.",
455 onfail="Failed to obtain the host ids" )
456
457 main.step( "Removing hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700458 hostResult = main.CLIs[ 0 ].removeHost( hostList )
GlennRC20fc6522015-12-23 23:26:57 -0800459 utilities.assert_equals( expect=main.TRUE, actual=hostResult,
460 onpass="Successfully removed hosts",
461 onfail="Failed remove hosts" )
462
463 time.sleep( main.remHostDelay )
464
465 main.log.info( "Constructing device uri list" )
466 deviceList = []
467 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700468 deviceList.append( "of:00000000000000" + format( i + 1, "02x" ) )
GlennRC20fc6522015-12-23 23:26:57 -0800469
470 main.step( "Removing devices" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700471 deviceResult = main.CLIs[ 0 ].removeDevice( deviceList )
GlennRC20fc6522015-12-23 23:26:57 -0800472 utilities.assert_equals( expect=main.TRUE, actual=deviceResult,
473 onpass="Successfully removed devices",
474 onfail="Failed remove devices" )
475
476 time.sleep( main.remDevDelay )
477
Jon Hallef0e2a12017-05-24 16:57:53 -0700478 main.log.info( "Summary\n{}".format( main.CLIs[ 0 ].summary( jsonFormat=False ) ) )
GlennRC20fc6522015-12-23 23:26:57 -0800479
Hari Krishnac195f3b2015-07-08 20:02:24 -0700480 def CASE40( self, main ):
481 """
GlennRC15d164c2015-12-15 17:12:25 -0800482 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700483 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700484 import time
GlennRC15d164c2015-12-15 17:12:25 -0800485 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700486 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800487 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700488
GlennRC15d164c2015-12-15 17:12:25 -0800489 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700490 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800491 utilities.assert_equals( expect=main.TRUE, actual=appResult,
492 onpass="Successfully install fwd app",
493 onfail="Failed to install fwd app" )
494
GlennRC6ac11b12015-10-21 17:41:28 -0700495 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700496 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700497 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700498 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700499 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700500 main.log.warn( "First pingall failed. Retrying..." )
501 time.sleep( main.pingSleep )
GlennRC15d164c2015-12-15 17:12:25 -0800502 else:
503 break
GlennRC6ac11b12015-10-21 17:41:28 -0700504
Hari Krishnac195f3b2015-07-08 20:02:24 -0700505 time2 = time.time()
506 timeDiff = round( ( time2 - time1 ), 2 )
507 main.log.report(
508 "Time taken for Ping All: " +
509 str( timeDiff ) +
510 " seconds" )
511
GlennRC15d164c2015-12-15 17:12:25 -0800512 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700513 onpass="Reactive Mode IPv4 Pingall test PASS",
514 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700515
You Wangb6586542016-02-26 09:25:56 -0800516 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700517 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800518 main.stop( email=main.emailOnStop )
519
GlennRC15d164c2015-12-15 17:12:25 -0800520 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700521 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800522 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800523 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800524 onfail="Failed to deactivate fwd app" )
525
Hari Krishnac195f3b2015-07-08 20:02:24 -0700526 def CASE41( self, main ):
527 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700528 Verify Reactive forwarding ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700529 """
530 import re
531 import copy
532 import time
533 main.log.report( "Verify Reactive forwarding (Chordal Topology)" )
534 main.log.report( "______________________________________________" )
535 main.case( "Enable Reactive forwarding and Verify ping all" )
536 main.step( "Enable Reactive forwarding" )
537 installResult = main.TRUE
538 # Activate fwd app
Jon Hallef0e2a12017-05-24 16:57:53 -0700539 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700540
541 appCheck = main.TRUE
542 pool = []
543 for cli in main.CLIs:
544 t = main.Thread( target=cli.appToIDCheck,
545 name="appToIDCheck-" + str( i ),
546 args=[] )
547 pool.append( t )
548 t.start()
549 for t in pool:
550 t.join()
551 appCheck = appCheck and t.result
552 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
553 onpass="App Ids seem to be correct",
554 onfail="Something is wrong with app Ids" )
555 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700556 main.log.warn( main.CLIs[ 0 ].apps() )
557 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700558
Hari Krishnac195f3b2015-07-08 20:02:24 -0700559 time.sleep( 10 )
560
GlennRC6ac11b12015-10-21 17:41:28 -0700561 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700562 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700563 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700564 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700565 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700566 main.log.warn( "First pingall failed. Retrying..." )
567 time.sleep( main.pingSleep )
568 else:
569 break
GlennRC6ac11b12015-10-21 17:41:28 -0700570
Hari Krishnac195f3b2015-07-08 20:02:24 -0700571 time2 = time.time()
572 timeDiff = round( ( time2 - time1 ), 2 )
573 main.log.report(
574 "Time taken for Ping All: " +
575 str( timeDiff ) +
576 " seconds" )
577
You Wangb6586542016-02-26 09:25:56 -0800578 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700579 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800580 main.stop( email=main.emailOnStop )
581
GlennRC626ba132015-09-18 16:16:31 -0700582 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700583 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700584 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700585 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700586
Jon Hallef0e2a12017-05-24 16:57:53 -0700587 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700588 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700589 onpass="Reactive Mode IPv4 Pingall test PASS",
590 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700591
592 def CASE42( self, main ):
593 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700594 Verify Reactive forwarding ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700595 """
596 import re
597 import copy
598 import time
599 main.log.report( "Verify Reactive forwarding (Spine Topology)" )
600 main.log.report( "______________________________________________" )
601 main.case( "Enable Reactive forwarding and Verify ping all" )
602 main.step( "Enable Reactive forwarding" )
603 installResult = main.TRUE
604 # Activate fwd app
Jon Hallef0e2a12017-05-24 16:57:53 -0700605 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700606
607 appCheck = main.TRUE
608 pool = []
609 for cli in main.CLIs:
610 t = main.Thread( target=cli.appToIDCheck,
611 name="appToIDCheck-" + str( i ),
612 args=[] )
613 pool.append( t )
614 t.start()
615 for t in pool:
616 t.join()
617 appCheck = appCheck and t.result
618 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
619 onpass="App Ids seem to be correct",
620 onfail="Something is wrong with app Ids" )
621 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700622 main.log.warn( main.CLIs[ 0 ].apps() )
623 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700624
Hari Krishnac195f3b2015-07-08 20:02:24 -0700625 time.sleep( 10 )
626
GlennRC6ac11b12015-10-21 17:41:28 -0700627 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700628 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700629 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700630 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700631 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700632 main.log.warn( "First pingall failed. Retrying..." )
633 time.sleep( main.pingSleep )
634 else:
635 break
GlennRC6ac11b12015-10-21 17:41:28 -0700636
Hari Krishnac195f3b2015-07-08 20:02:24 -0700637 time2 = time.time()
638 timeDiff = round( ( time2 - time1 ), 2 )
639 main.log.report(
640 "Time taken for Ping All: " +
641 str( timeDiff ) +
642 " seconds" )
643
You Wangb6586542016-02-26 09:25:56 -0800644 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700645 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800646 main.stop( email=main.emailOnStop )
647
GlennRC626ba132015-09-18 16:16:31 -0700648 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700649 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700650 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700651 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
652
Jon Hallef0e2a12017-05-24 16:57:53 -0700653 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700654 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700655 onpass="Reactive Mode IPv4 Pingall test PASS",
656 onfail="Reactive Mode IPv4 Pingall test FAIL" )
657
GlennRC026dba62016-01-07 18:42:33 -0800658 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800659 """
660 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
661 """
GlennRC026dba62016-01-07 18:42:33 -0800662 import time
You Wang0779bac2016-01-27 16:32:33 -0800663 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800664 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800665 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800666
667 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700668 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800669 utilities.assert_equals( expect=main.TRUE, actual=appResult,
670 onpass="Successfully install fwd app",
671 onfail="Failed to install fwd app" )
672
Jon Hallef0e2a12017-05-24 16:57:53 -0700673 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800674
Jon Hallef0e2a12017-05-24 16:57:53 -0700675 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800676 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700677 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800678 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
679 main.Mininet1.handle.expect( "mininet>" )
680 main.log.info( main.Mininet1.handle.before )
681
Jon Hallef0e2a12017-05-24 16:57:53 -0700682 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800683
684 main.log.info( hosts )
685
686 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700687 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800688 utilities.assert_equals( expect=main.TRUE, actual=appResult,
689 onpass="Successfully deactivated fwd app",
690 onfail="Failed to deactivate fwd app" )
691
692 def CASE48( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800693 """
694 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
695 """
GlennRC026dba62016-01-07 18:42:33 -0800696 import time
You Wang0779bac2016-01-27 16:32:33 -0800697 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800698 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800699 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800700
701 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700702 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800703 utilities.assert_equals( expect=main.TRUE, actual=appResult,
704 onpass="Successfully install fwd app",
705 onfail="Failed to install fwd app" )
706
Jon Hallef0e2a12017-05-24 16:57:53 -0700707 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800708
Jon Hallef0e2a12017-05-24 16:57:53 -0700709 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800710 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700711 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800712 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
713 main.Mininet1.handle.expect( "mininet>" )
714 main.log.info( main.Mininet1.handle.before )
715
Jon Hallef0e2a12017-05-24 16:57:53 -0700716 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800717
718 main.log.info( hosts )
719
720 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700721 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800722 utilities.assert_equals( expect=main.TRUE, actual=appResult,
723 onpass="Successfully deactivated fwd app",
724 onfail="Failed to deactivate fwd app" )
725
726 def CASE49( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800727 """
728 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
729 """
GlennRC026dba62016-01-07 18:42:33 -0800730 import time
You Wang0779bac2016-01-27 16:32:33 -0800731 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800732 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800733 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800734
735 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700736 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800737 utilities.assert_equals( expect=main.TRUE, actual=appResult,
738 onpass="Successfully install fwd app",
739 onfail="Failed to install fwd app" )
740
Jon Hallef0e2a12017-05-24 16:57:53 -0700741 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800742
Jon Hallef0e2a12017-05-24 16:57:53 -0700743 for i in range( 11, numHosts + 10 ):
GlennRC026dba62016-01-07 18:42:33 -0800744 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -0700745 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800746 main.Mininet1.handle.sendline( src + " ping " + dest + " -c 3 -i 1 -W 1" )
747 main.Mininet1.handle.expect( "mininet>" )
748 main.log.info( main.Mininet1.handle.before )
749
Jon Hallef0e2a12017-05-24 16:57:53 -0700750 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800751
752 main.log.info( hosts )
753
754 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700755 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800756 utilities.assert_equals( expect=main.TRUE, actual=appResult,
757 onpass="Successfully deactivated fwd app",
758 onfail="Failed to deactivate fwd app" )
759
Hari Krishna4223dbd2015-08-13 16:29:53 -0700760 def CASE140( self, main ):
761 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700762 Verify IPv6 Reactive forwarding ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700763 """
764 import re
765 import copy
766 import time
767 main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" )
768 main.log.report( "______________________________________________" )
769 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700770 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700771
772 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700773 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
774 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700775 cfgResult = cfgResult1 and cfgResult2
776 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
777 onpass="Reactive mode ipv6Fowarding cfg is set to true",
778 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
779
780 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700781 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700782 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700783 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700784 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700785 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700786 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700787 time2 = time.time()
788 timeDiff = round( ( time2 - time1 ), 2 )
789 main.log.report(
790 "Time taken for IPv6 Ping All: " +
791 str( timeDiff ) +
792 " seconds" )
793
GlennRC626ba132015-09-18 16:16:31 -0700794 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700795 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
796 else:
797 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700798
Jon Hallef0e2a12017-05-24 16:57:53 -0700799 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700800 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700801 onpass="Reactive Mode IPv6 Pingall test PASS",
802 onfail="Reactive Mode IPv6 Pingall test FAIL" )
803
804 def CASE141( self, main ):
805 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700806 Verify IPv6 Reactive forwarding ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700807 """
808 import re
809 import copy
810 import time
811 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
812 main.log.report( "______________________________________________" )
813 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700814 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700815
816 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700817 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
818 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700819 cfgResult = cfgResult1 and cfgResult2
820 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
821 onpass="Reactive mode ipv6Fowarding cfg is set to true",
822 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
823
824 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700825 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700826 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700827 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700828 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700829 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700830 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700831 time2 = time.time()
832 timeDiff = round( ( time2 - time1 ), 2 )
833 main.log.report(
834 "Time taken for IPv6 Ping All: " +
835 str( timeDiff ) +
836 " seconds" )
837
GlennRC626ba132015-09-18 16:16:31 -0700838 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700839 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
840 else:
841 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
842
843 main.step( "Disable Reactive forwarding" )
844
845 main.log.info( "Uninstall reactive forwarding app" )
846 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700847 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700848 pool = []
849 for cli in main.CLIs:
850 t = main.Thread( target=cli.appToIDCheck,
851 name="appToIDCheck-" + str( i ),
852 args=[] )
853 pool.append( t )
854 t.start()
855
856 for t in pool:
857 t.join()
858 appCheck = appCheck and t.result
859 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
860 onpass="App Ids seem to be correct",
861 onfail="Something is wrong with app Ids" )
862 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700863 main.log.warn( main.CLIs[ 0 ].apps() )
864 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700865
866 # Waiting for reative flows to be cleared.
867 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -0700868 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700869 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700870 onpass="Reactive Mode IPv6 Pingall test PASS",
871 onfail="Reactive Mode IPv6 Pingall test FAIL" )
872
873 def CASE142( self, main ):
874 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700875 Verify IPv6 Reactive forwarding ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700876 """
877 import re
878 import copy
879 import time
880 main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" )
881 main.log.report( "______________________________________________" )
882 main.case( "Enable IPv6 Reactive forwarding and Verify ping all" )
883 # Spine topology do not have hosts h1-h10
Jon Hallef0e2a12017-05-24 16:57:53 -0700884 hostList = [ ( 'h' + str( x + 11 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700885 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700886 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
887 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700888 cfgResult = cfgResult1 and cfgResult2
889 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
890 onpass="Reactive mode ipv6Fowarding cfg is set to true",
891 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
892
893 main.step( "Verify IPv6 Pingall" )
GlennRC626ba132015-09-18 16:16:31 -0700894 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700895 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700896 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC558cd862015-10-08 09:54:04 -0700897 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700898 main.log.warn( "First pingall failed. Trying again..." )
GlennRC558cd862015-10-08 09:54:04 -0700899 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700900 time2 = time.time()
901 timeDiff = round( ( time2 - time1 ), 2 )
902 main.log.report(
903 "Time taken for IPv6 Ping All: " +
904 str( timeDiff ) +
905 " seconds" )
906
GlennRC626ba132015-09-18 16:16:31 -0700907 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700908 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
909 else:
910 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
911
912 main.step( "Disable Reactive forwarding" )
913
914 main.log.info( "Uninstall reactive forwarding app" )
915 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700916 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700917 pool = []
918 for cli in main.CLIs:
919 t = main.Thread( target=cli.appToIDCheck,
920 name="appToIDCheck-" + str( i ),
921 args=[] )
922 pool.append( t )
923 t.start()
924
925 for t in pool:
926 t.join()
927 appCheck = appCheck and t.result
928 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
929 onpass="App Ids seem to be correct",
930 onfail="Something is wrong with app Ids" )
931 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700932 main.log.warn( main.CLIs[ 0 ].apps() )
933 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700934
935 # Waiting for reative flows to be cleared.
936 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -0700937 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700938 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700939 onpass="Reactive Mode IPv6 Pingall test PASS",
940 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700941
You Wang0779bac2016-01-27 16:32:33 -0800942 def CASE147( self, main ):
943 """
944 Verify IPv6 reactive forwarding in ATT topology, use a different ping method than CASE140
945 """
946 import time
947 main.log.report( "Verify IPv6 Reactive forwarding (ATT Topology)" )
948 main.log.report( "______________________________________________" )
949 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
950
951 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700952 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -0800953 utilities.assert_equals( expect=main.TRUE, actual=appResult,
954 onpass="Successfully install fwd app",
955 onfail="Failed to install fwd app" )
956
957 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700958 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
959 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -0800960 cfgResult = cfgResult1 and cfgResult2
961 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
962 onpass="Reactive mode ipv6Fowarding cfg is set to true",
963 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
964
You Wangb6586542016-02-26 09:25:56 -0800965 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700966 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
967 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -0800968 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700969 dest = "1000::" + str( i + 1 )
970 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -0800971 main.Mininet1.handle.expect( "mininet>" )
972 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -0700973 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -0800974 main.log.info( hosts )
975
976 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -0800977 main.log.info( "Uninstall IPv6 reactive forwarding app" )
978 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700979 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -0800980 pool = []
981 for cli in main.CLIs:
982 t = main.Thread( target=cli.appToIDCheck,
983 name="appToIDCheck-" + str( i ),
984 args=[] )
985 pool.append( t )
986 t.start()
987
988 for t in pool:
989 t.join()
990 appCheck = appCheck and t.result
991 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
992 onpass="App Ids seem to be correct",
993 onfail="Something is wrong with app Ids" )
994
995 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -0700996 main.log.warn( main.CLIs[ 0 ].apps() )
997 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -0800998
999 # Waiting for reative flows to be cleared.
1000 time.sleep( 30 )
1001
1002 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001003 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001004 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1005 onpass="Successfully deactivated IPv4 fwd app",
1006 onfail="Failed to deactivate IPv4 fwd app" )
1007
1008 def CASE148( self, main ):
1009 """
1010 Verify reactive forwarding in Chordal topology, use a different ping method than CASE141
1011 """
1012 import time
1013 main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" )
1014 main.log.report( "______________________________________________" )
1015 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1016
1017 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001018 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001019 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1020 onpass="Successfully install fwd app",
1021 onfail="Failed to install fwd app" )
1022
1023 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001024 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1025 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001026 cfgResult = cfgResult1 and cfgResult2
1027 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1028 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1029 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1030
You Wangb6586542016-02-26 09:25:56 -08001031 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001032 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
1033 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -08001034 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -07001035 dest = "1000::" + str( i + 1 )
1036 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001037 main.Mininet1.handle.expect( "mininet>" )
1038 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001039 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001040 main.log.info( hosts )
1041
1042 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001043 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1044 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001045 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001046 pool = []
1047 for cli in main.CLIs:
1048 t = main.Thread( target=cli.appToIDCheck,
1049 name="appToIDCheck-" + str( i ),
1050 args=[] )
1051 pool.append( t )
1052 t.start()
1053
1054 for t in pool:
1055 t.join()
1056 appCheck = appCheck and t.result
1057 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1058 onpass="App Ids seem to be correct",
1059 onfail="Something is wrong with app Ids" )
1060
1061 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001062 main.log.warn( main.CLIs[ 0 ].apps() )
1063 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001064
1065 # Waiting for reative flows to be cleared.
1066 time.sleep( 30 )
1067
1068 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001069 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001070 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1071 onpass="Successfully deactivated IPv4 fwd app",
1072 onfail="Failed to deactivate IPv4 fwd app" )
1073
1074 def CASE149( self, main ):
1075 """
1076 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE142
1077 """
1078 import time
1079 main.log.report( "Verify IPv6 Reactive forwarding (Spine-leaf Topology)" )
1080 main.log.report( "______________________________________________" )
1081 main.case( "Enable Reactive forwarding, verify ping6, and disable reactive forwarding" )
1082
1083 main.step( "Enable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001084 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001085 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1086 onpass="Successfully install fwd app",
1087 onfail="Failed to install fwd app" )
1088
1089 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001090 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1091 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001092 cfgResult = cfgResult1 and cfgResult2
1093 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
1094 onpass="Reactive mode ipv6Fowarding cfg is set to true",
1095 onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
1096
You Wangb6586542016-02-26 09:25:56 -08001097 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001098 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
1099 for i in range( 11, numHosts + 10 ):
You Wang0779bac2016-01-27 16:32:33 -08001100 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -07001101 dest = "1000::" + str( i + 1 )
1102 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001103 main.Mininet1.handle.expect( "mininet>" )
1104 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001105 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001106 main.log.info( hosts )
1107
1108 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001109 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1110 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001111 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001112 pool = []
1113 for cli in main.CLIs:
1114 t = main.Thread( target=cli.appToIDCheck,
1115 name="appToIDCheck-" + str( i ),
1116 args=[] )
1117 pool.append( t )
1118 t.start()
1119
1120 for t in pool:
1121 t.join()
1122 appCheck = appCheck and t.result
1123 utilities.assert_equals( expect=main.TRUE, actual=appCheck,
1124 onpass="App Ids seem to be correct",
1125 onfail="Something is wrong with app Ids" )
1126
1127 if appCheck != main.TRUE:
Jon Hallef0e2a12017-05-24 16:57:53 -07001128 main.log.warn( main.CLIs[ 0 ].apps() )
1129 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001130
1131 # Waiting for reative flows to be cleared.
1132 time.sleep( 30 )
1133
1134 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001135 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001136 utilities.assert_equals( expect=main.TRUE, actual=appResult,
1137 onpass="Successfully deactivated IPv4 fwd app",
1138 onfail="Failed to deactivate IPv4 fwd app" )
1139
Hari Krishnac195f3b2015-07-08 20:02:24 -07001140 def CASE5( self, main ):
1141 """
1142 Compare current ONOS topology with reference data
1143 """
1144 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001145
Hari Krishnac195f3b2015-07-08 20:02:24 -07001146 devicesDPIDTemp = []
1147 hostMACsTemp = []
1148 deviceLinksTemp = []
1149 deviceActiveLinksCountTemp = []
1150 devicePortsEnabledCountTemp = []
1151
1152 main.log.report(
1153 "Compare ONOS topology with reference data in Stores" )
1154 main.log.report( "__________________________________________________" )
1155 main.case( "Compare ONOS topology with reference data" )
1156
1157 main.step( "Compare current Device ports enabled with reference" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001158
Jon Hallef0e2a12017-05-24 16:57:53 -07001159 for check in range( main.topoCheck ):
GlennRC289c1b62015-12-12 10:45:43 -08001160 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07001161 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRC289c1b62015-12-12 10:45:43 -08001162 pool = []
1163 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001164 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001165 break
GlennRC20fc6522015-12-23 23:26:57 -08001166 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001167 t = main.Thread( target=cli.getDevicePortsEnabledCount,
1168 threadID=main.threadID,
1169 name="getDevicePortsEnabledCount",
1170 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001171 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001172 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001173 i = i + 1
1174 main.threadID = main.threadID + 1
1175 for thread in pool:
1176 thread.join()
1177 portResult = thread.result
1178 #portTemp = re.split( r'\t+', portResult )
1179 #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1180 devicePortsEnabledCountTemp.append( portResult )
Jon Hall4ba53f02015-07-29 13:07:41 -07001181
GlennRC289c1b62015-12-12 10:45:43 -08001182 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001183 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
1184 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001185 "Device Enabled ports EXPECTED: %s" %
1186 str( main.devicePortsEnabledCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001187 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001188 "Device Enabled ports ACTUAL: %s" %
1189 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001190
GlennRC289c1b62015-12-12 10:45:43 -08001191 if ( cmp( main.devicePortsEnabledCount,
1192 devicePortsEnabledCountTemp ) == 0 ):
1193 stepResult1 = main.TRUE
1194 else:
1195 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001196
GlennRC289c1b62015-12-12 10:45:43 -08001197 main.step( "Compare Device active links with reference" )
1198 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07001199 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRC289c1b62015-12-12 10:45:43 -08001200 pool = []
1201 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001202 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001203 break
GlennRC20fc6522015-12-23 23:26:57 -08001204 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001205 t = main.Thread( target=cli.getDeviceLinksActiveCount,
1206 threadID=main.threadID,
1207 name="getDeviceLinksActiveCount",
1208 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001209 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001210 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001211 i = i + 1
1212 main.threadID = main.threadID + 1
1213 for thread in pool:
1214 thread.join()
1215 linkCountResult = thread.result
1216 #linkCountTemp = re.split( r'\t+', linkCountResult )
1217 #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
1218 deviceActiveLinksCountTemp.append( linkCountResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001219
GlennRC289c1b62015-12-12 10:45:43 -08001220 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001221 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
1222 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001223 "Device Active links EXPECTED: %s" %
1224 str( main.deviceActiveLinksCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001225 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001226 "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) )
1227 if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ):
1228 stepResult2 = main.TRUE
1229 else:
1230 stepResult2 = main.FALSE
1231
1232 """
1233 place holder for comparing devices, hosts, paths and intents if required.
1234 Links and ports data would be incorrect with out devices anyways.
1235 """
1236 caseResult = ( stepResult1 and stepResult2 )
1237
1238 if caseResult:
1239 break
1240 else:
1241 time.sleep( main.topoCheckDelay )
1242 main.log.warn( "Topology check failed. Trying again..." )
1243
GlennRC289c1b62015-12-12 10:45:43 -08001244 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001245 onpass="Compare Topology test PASS",
1246 onfail="Compare Topology test FAIL" )
1247
Devin Lim58046fa2017-07-05 16:55:00 -07001248 def CASE60( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07001249 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001250 Install 300 host intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001251 """
1252 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1253 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001254 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001255
Hari Krishnac195f3b2015-07-08 20:02:24 -07001256 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001257 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001258 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001259
Jon Hallef0e2a12017-05-24 16:57:53 -07001260 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001261 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001262 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1263 onpass="INTENTS INSTALLED",
1264 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001265
1266 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001267 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001268 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1269 onpass="PING ALL PASS",
1270 onfail="PING ALL FAIL" )
1271
GlennRCbddd58f2015-10-01 15:45:25 -07001272 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001273 utilities.assert_equals(
1274 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001275 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001276 onpass="Install 300 Host Intents and Ping All test PASS",
1277 onfail="Install 300 Host Intents and Ping All test FAIL" )
1278
GlennRCfcfdc4f2015-09-30 16:01:57 -07001279 if not intentState:
1280 main.log.debug( "Intents failed to install completely" )
1281 if not pingResult:
1282 main.log.debug( "Pingall failed" )
1283
GlennRCbddd58f2015-10-01 15:45:25 -07001284 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001285 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001286 main.stop( email=main.emailOnStop )
1287
Devin Lim58046fa2017-07-05 16:55:00 -07001288 def CASE61( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07001289 """
You Wang0779bac2016-01-27 16:32:33 -08001290 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001291 """
You Wang0779bac2016-01-27 16:32:33 -08001292 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001293 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001294 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001295
Hari Krishnac195f3b2015-07-08 20:02:24 -07001296 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001297 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001298 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001299
Jon Hallef0e2a12017-05-24 16:57:53 -07001300 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001301 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001302 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1303 onpass="INTENTS INSTALLED",
1304 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001305
1306 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001307 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001308 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1309 onpass="PING ALL PASS",
1310 onfail="PING ALL FAIL" )
1311
GlennRCbddd58f2015-10-01 15:45:25 -07001312 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001313 utilities.assert_equals( expect=main.TRUE,
1314 actual=caseResult,
1315 onpass="Install 300 Host Intents and Ping All test PASS",
1316 onfail="Install 300 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001317
GlennRCfcfdc4f2015-09-30 16:01:57 -07001318 if not intentState:
1319 main.log.debug( "Intents failed to install completely" )
1320 if not pingResult:
1321 main.log.debug( "Pingall failed" )
1322
GlennRCbddd58f2015-10-01 15:45:25 -07001323 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001324 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001325 main.stop( email=main.emailOnStop )
1326
Devin Lim58046fa2017-07-05 16:55:00 -07001327 def CASE62( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07001328 """
1329 Install 2278 host intents and verify ping all for Spine Topology
1330 """
1331 main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" )
1332 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001333 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001334
You Wangb6586542016-02-26 09:25:56 -08001335 main.step( "Add host Intents" )
1336 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001337 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001338
Jon Hallef0e2a12017-05-24 16:57:53 -07001339 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001340 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001341 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1342 onpass="INTENTS INSTALLED",
1343 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001344
1345 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001346 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001347 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1348 onpass="PING ALL PASS",
1349 onfail="PING ALL FAIL" )
1350
GlennRCbddd58f2015-10-01 15:45:25 -07001351 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001352 utilities.assert_equals( expect=main.TRUE,
1353 actual=caseResult,
1354 onpass="Install 2278 Host Intents and Ping All test PASS",
1355 onfail="Install 2278 Host Intents and Ping All test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001356
GlennRCfcfdc4f2015-09-30 16:01:57 -07001357 if not intentState:
1358 main.log.debug( "Intents failed to install completely" )
1359 if not pingResult:
1360 main.log.debug( "Pingall failed" )
1361
GlennRCbddd58f2015-10-01 15:45:25 -07001362 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001363 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001364 main.stop( email=main.emailOnStop )
1365
Devin Lim58046fa2017-07-05 16:55:00 -07001366 def CASE160( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07001367 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001368 Verify IPv6 ping across 300 host intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001369 """
1370 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1371 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001372 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001373
Hari Krishna4223dbd2015-08-13 16:29:53 -07001374 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001375 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1376 utilities.assert_equals( expect=main.TRUE,
1377 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001378 onpass="PING ALL PASS",
1379 onfail="PING ALL FAIL" )
1380
GlennRCbddd58f2015-10-01 15:45:25 -07001381 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001382 utilities.assert_equals(
1383 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001384 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001385 onpass="IPv6 Ping across 300 host intents test PASS",
1386 onfail="IPv6 Ping across 300 host intents test FAIL" )
1387
You Wangb6586542016-02-26 09:25:56 -08001388 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001389 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001390 main.stop( email=main.emailOnStop )
1391
Devin Lim58046fa2017-07-05 16:55:00 -07001392 def CASE161( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07001393 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001394 Verify IPv6 ping across 300 host intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001395 """
You Wang0779bac2016-01-27 16:32:33 -08001396 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001397 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001398 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001399
Hari Krishna4223dbd2015-08-13 16:29:53 -07001400 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001401 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001402 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1403 onpass="PING ALL PASS",
1404 onfail="PING ALL FAIL" )
1405
GlennRCbddd58f2015-10-01 15:45:25 -07001406 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001407 utilities.assert_equals(
1408 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001409 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001410 onpass="IPv6 Ping across 300 host intents test PASS",
1411 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001412
You Wangb6586542016-02-26 09:25:56 -08001413 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001414 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001415 main.stop( email=main.emailOnStop )
1416
Devin Lim58046fa2017-07-05 16:55:00 -07001417 def CASE162( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07001418 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001419 Verify IPv6 ping across 2278 host intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001420 """
1421 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1422 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001423 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001424
Hari Krishna4223dbd2015-08-13 16:29:53 -07001425 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001426 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001427 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1428 onpass="PING ALL PASS",
1429 onfail="PING ALL FAIL" )
1430
GlennRCbddd58f2015-10-01 15:45:25 -07001431 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001432 utilities.assert_equals(
1433 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001434 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001435 onpass="IPv6 Ping across 2278 host intents test PASS",
1436 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001437
You Wangb6586542016-02-26 09:25:56 -08001438 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001439 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001440 main.stop( email=main.emailOnStop )
1441
Hari Krishnac195f3b2015-07-08 20:02:24 -07001442 def CASE70( self, main ):
1443 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001444 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001445 """
1446 import random
1447 main.randomLink1 = []
1448 main.randomLink2 = []
1449 main.randomLink3 = []
1450 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1451 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1452 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1453 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1454 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1455 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1456 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001457
1458 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
1459 main.log.report( "___________________________________________________________________________" )
1460 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1461 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1462 if ( int( switchLinksToToggle ) ==
1463 0 or int( switchLinksToToggle ) > 5 ):
1464 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1465 #main.cleanup()
1466 #main.exit()
1467 else:
1468 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1469
1470 main.step( "Cut links on Core devices using user provided range" )
1471 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1472 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1473 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1474 for i in range( int( switchLinksToToggle ) ):
1475 main.Mininet1.link(
1476 END1=link1End1,
1477 END2=main.randomLink1[ i ],
1478 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001479 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001480 main.Mininet1.link(
1481 END1=link2End1,
1482 END2=main.randomLink2[ i ],
1483 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001484 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001485 main.Mininet1.link(
1486 END1=link3End1,
1487 END2=main.randomLink3[ i ],
1488 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001489 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001490
Jon Hallef0e2a12017-05-24 16:57:53 -07001491 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001492 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1493 int( main.numMNlinks ) -
1494 int( switchLinksToToggle ) * 6 )
1495 utilities.assert_equals( expect=main.TRUE,
1496 actual=linkDown,
1497 onpass="Link down discovered properly",
1498 onfail="Link down was not discovered in " +
1499 str( main.linkSleep * main.linkCheck ) +
1500 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001501
Jon Hallef0e2a12017-05-24 16:57:53 -07001502 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001503 intentState = main.CHOtestFunctions.checkIntents()
1504 utilities.assert_equals( expect=main.TRUE,
1505 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001506 onpass="INTENTS INSTALLED",
1507 onfail="SOME INTENTS NOT INSTALLED" )
1508
Hari Krishnac195f3b2015-07-08 20:02:24 -07001509 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001510 pingResult = main.CHOtestFunctions.checkPingall()
1511 utilities.assert_equals( expect=main.TRUE,
1512 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001513 onpass="PING ALL PASS",
1514 onfail="PING ALL FAIL" )
1515
GlennRCbddd58f2015-10-01 15:45:25 -07001516 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001517 utilities.assert_equals( expect=main.TRUE,
1518 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001519 onpass="Random Link cut Test PASS",
1520 onfail="Random Link cut Test FAIL" )
1521
GlennRCfcfdc4f2015-09-30 16:01:57 -07001522 # Printing what exactly failed
1523 if not linkDown:
1524 main.log.debug( "Link down was not discovered correctly" )
1525 if not pingResult:
1526 main.log.debug( "Pingall failed" )
1527 if not intentState:
1528 main.log.debug( "Intents are not all installed" )
1529
GlennRCbddd58f2015-10-01 15:45:25 -07001530 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001531 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001532 main.stop( email=main.emailOnStop )
1533
Hari Krishnac195f3b2015-07-08 20:02:24 -07001534 def CASE80( self, main ):
1535 """
1536 Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
1537 """
1538 import random
1539 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1540 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1541 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001542 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001543 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1544
1545 main.log.report(
1546 "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
1547 main.log.report(
1548 "__________________________________________________________________" )
1549 main.case(
1550 "Host intents - Bring the core links up that are down and verify ping all" )
1551 main.step( "Bring randomly cut links on Core devices up" )
1552 for i in range( int( switchLinksToToggle ) ):
1553 main.Mininet1.link(
1554 END1=link1End1,
1555 END2=main.randomLink1[ i ],
1556 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001557 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001558 main.Mininet1.link(
1559 END1=link2End1,
1560 END2=main.randomLink2[ i ],
1561 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001562 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001563 main.Mininet1.link(
1564 END1=link3End1,
1565 END2=main.randomLink3[ i ],
1566 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001567 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001568
Jon Hallef0e2a12017-05-24 16:57:53 -07001569 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001570 linkUp = main.CHOtestFunctions.checkLinkEvents( "up",
1571 int( main.numMNlinks ) )
1572 utilities.assert_equals( expect=main.TRUE,
1573 actual=linkUp,
1574 onpass="Link up discovered properly",
1575 onfail="Link up was not discovered in " +
1576 str( main.linkSleep * main.linkCheck ) +
1577 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001578
Jon Hallef0e2a12017-05-24 16:57:53 -07001579 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001580 intentState = main.CHOtestFunctions.checkIntents()
1581 utilities.assert_equals( expect=main.TRUE,
1582 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001583 onpass="INTENTS INSTALLED",
1584 onfail="SOME INTENTS NOT INSTALLED" )
1585
Hari Krishnac195f3b2015-07-08 20:02:24 -07001586 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001587 pingResult = main.CHOtestFunctions.checkPingall()
1588 utilities.assert_equals( expect=main.TRUE,
1589 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001590 onpass="PING ALL PASS",
1591 onfail="PING ALL FAIL" )
1592
GlennRCbddd58f2015-10-01 15:45:25 -07001593 caseResult = linkUp and pingResult
1594 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001595 onpass="Link Up Test PASS",
1596 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001597 # Printing what exactly failed
1598 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001599 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001600 if not pingResult:
1601 main.log.debug( "Pingall failed" )
1602 if not intentState:
1603 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001604
GlennRCbddd58f2015-10-01 15:45:25 -07001605 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001606 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001607 main.stop( email=main.emailOnStop )
1608
Hari Krishnac195f3b2015-07-08 20:02:24 -07001609 def CASE71( self, main ):
1610 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001611 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001612 """
1613 import random
1614 main.randomLink1 = []
1615 main.randomLink2 = []
1616 main.randomLink3 = []
1617 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1618 link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' )
1619 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1620 link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' )
1621 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
1622 link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' )
1623 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
You Wangb6586542016-02-26 09:25:56 -08001624 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001625
1626 main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
1627 main.log.report( "___________________________________________________________________________" )
1628 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1629 main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
1630 if ( int( switchLinksToToggle ) ==
1631 0 or int( switchLinksToToggle ) > 5 ):
1632 main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
1633 #main.cleanup()
1634 #main.exit()
1635 else:
1636 main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" )
1637
1638 main.step( "Cut links on Core devices using user provided range" )
1639 main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
1640 main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
1641 main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
1642 for i in range( int( switchLinksToToggle ) ):
1643 main.Mininet1.link(
1644 END1=link1End1,
1645 END2=main.randomLink1[ i ],
1646 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001647 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001648 main.Mininet1.link(
1649 END1=link2End1,
1650 END2=main.randomLink2[ i ],
1651 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001652 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001653 main.Mininet1.link(
1654 END1=link3End1,
1655 END2=main.randomLink3[ i ],
1656 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001657 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001658
Jon Hallef0e2a12017-05-24 16:57:53 -07001659 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001660 linkDown = main.CHOtestFunctions.checkLinkEvents( "down",
1661 int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 )
1662 utilities.assert_equals( expect=main.TRUE,
1663 actual=linkDown,
1664 onpass="Link down discovered properly",
1665 onfail="Link down was not discovered in " +
1666 str( main.linkSleep * main.linkCheck ) +
1667 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001668
Jon Hallef0e2a12017-05-24 16:57:53 -07001669 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001670 intentState = main.CHOtestFunctions.checkIntents()
1671 utilities.assert_equals( expect=main.TRUE,
1672 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001673 onpass="INTENTS INSTALLED",
1674 onfail="SOME INTENTS NOT INSTALLED" )
1675
Hari Krishnac195f3b2015-07-08 20:02:24 -07001676 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001677 pingResult = main.CHOtestFunctions.checkPingall()
1678 utilities.assert_equals( expect=main.TRUE,
1679 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001680 onpass="PING ALL PASS",
1681 onfail="PING ALL FAIL" )
1682
GlennRCbddd58f2015-10-01 15:45:25 -07001683 caseResult = linkDown and pingResult and intentState
1684 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001685 onpass="Random Link cut Test PASS",
1686 onfail="Random Link cut Test FAIL" )
1687
GlennRCfcfdc4f2015-09-30 16:01:57 -07001688 # Printing what exactly failed
1689 if not linkDown:
1690 main.log.debug( "Link down was not discovered correctly" )
1691 if not pingResult:
1692 main.log.debug( "Pingall failed" )
1693 if not intentState:
1694 main.log.debug( "Intents are not all installed" )
1695
GlennRCbddd58f2015-10-01 15:45:25 -07001696 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001697 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001698 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001699
Hari Krishnac195f3b2015-07-08 20:02:24 -07001700 def CASE81( self, main ):
1701 """
1702 Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
1703 """
1704 import random
1705 link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
1706 link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ]
1707 link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ]
You Wangb6586542016-02-26 09:25:56 -08001708 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001709 switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
1710
1711 main.log.report(
1712 "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
1713 main.log.report(
1714 "__________________________________________________________________" )
1715 main.case(
1716 "Point intents - Bring the core links up that are down and verify ping all" )
1717 main.step( "Bring randomly cut links on Core devices up" )
1718 for i in range( int( switchLinksToToggle ) ):
1719 main.Mininet1.link(
1720 END1=link1End1,
1721 END2=main.randomLink1[ i ],
1722 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001723 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001724 main.Mininet1.link(
1725 END1=link2End1,
1726 END2=main.randomLink2[ i ],
1727 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001728 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001729 main.Mininet1.link(
1730 END1=link3End1,
1731 END2=main.randomLink3[ i ],
1732 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001733 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001734
Jon Hallef0e2a12017-05-24 16:57:53 -07001735 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001736 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1737 utilities.assert_equals( expect=main.TRUE,
1738 actual=linkUp,
1739 onpass="Link up discovered properly",
1740 onfail="Link up was not discovered in " +
1741 str( main.linkSleep * main.linkCheck ) +
1742 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001743
Jon Hallef0e2a12017-05-24 16:57:53 -07001744 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001745 intentState = main.CHOtestFunctions.checkIntents()
1746 utilities.assert_equals( expect=main.TRUE,
1747 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001748 onpass="INTENTS INSTALLED",
1749 onfail="SOME INTENTS NOT INSTALLED" )
1750
Hari Krishnac195f3b2015-07-08 20:02:24 -07001751 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001752 pingResult = main.CHOtestFunctions.checkPingall()
1753 utilities.assert_equals( expect=main.TRUE,
1754 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001755 onpass="PING ALL PASS",
1756 onfail="PING ALL FAIL" )
1757
GlennRCbddd58f2015-10-01 15:45:25 -07001758 caseResult = linkUp and pingResult
1759 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001760 onpass="Link Up Test PASS",
1761 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001762 # Printing what exactly failed
1763 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001764 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001765 if not pingResult:
1766 main.log.debug( "Pingall failed" )
1767 if not intentState:
1768 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001769
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" )
GlennRC884dc9e2015-10-09 15:53:20 -07001772 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001773
Hari Krishnac195f3b2015-07-08 20:02:24 -07001774 def CASE72( self, main ):
1775 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001776 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001777 """
1778 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001779 import itertools
You Wangb6586542016-02-26 09:25:56 -08001780 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001781
Hari Krishnac195f3b2015-07-08 20:02:24 -07001782 main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
1783 main.log.report( "___________________________________________________________________________" )
1784 main.case( "Host intents - Randomly bring some core links down and verify ping all" )
1785 switches = []
1786 switchesComb = []
1787 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -07001788 switches.append( 's%d' % ( i + 1 ) )
1789 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1790 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001791 print main.randomLinks
1792 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001793
Hari Krishnac195f3b2015-07-08 20:02:24 -07001794 for switch in main.randomLinks:
1795 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001796 END1=switch[ 0 ],
1797 END2=switch[ 1 ],
1798 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001799 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001800
Jon Hallef0e2a12017-05-24 16:57:53 -07001801 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001802 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1803 utilities.assert_equals( expect=main.TRUE,
1804 actual=linkDown,
1805 onpass="Link down discovered properly",
1806 onfail="Link down was not discovered in " +
1807 str( main.linkSleep * main.linkCheck ) +
1808 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001809
Jon Hallef0e2a12017-05-24 16:57:53 -07001810 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001811 intentState = main.CHOtestFunctions.checkIntents()
1812 utilities.assert_equals( expect=main.TRUE,
1813 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001814 onpass="INTENTS INSTALLED",
1815 onfail="SOME INTENTS NOT INSTALLED" )
1816
Hari Krishnac195f3b2015-07-08 20:02:24 -07001817 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001818 pingResult = main.CHOtestFunctions.checkPingall()
1819 utilities.assert_equals( expect=main.TRUE,
1820 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001821 onpass="PING ALL PASS",
1822 onfail="PING ALL FAIL" )
1823
GlennRCbddd58f2015-10-01 15:45:25 -07001824 caseResult = linkDown and pingResult and intentState
1825 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001826 onpass="Random Link cut Test PASS",
1827 onfail="Random Link cut Test FAIL" )
1828
GlennRCfcfdc4f2015-09-30 16:01:57 -07001829 # Printing what exactly failed
1830 if not linkDown:
1831 main.log.debug( "Link down was not discovered correctly" )
1832 if not pingResult:
1833 main.log.debug( "Pingall failed" )
1834 if not intentState:
1835 main.log.debug( "Intents are not all installed" )
1836
GlennRCbddd58f2015-10-01 15:45:25 -07001837 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001838 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001839 main.stop( email=main.emailOnStop )
1840
Hari Krishnac195f3b2015-07-08 20:02:24 -07001841 def CASE82( self, main ):
1842 """
1843 Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
1844 """
1845 import random
You Wangb6586542016-02-26 09:25:56 -08001846 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001847
Hari Krishnac195f3b2015-07-08 20:02:24 -07001848 main.log.report(
1849 "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
1850 main.log.report(
1851 "__________________________________________________________________" )
1852 main.case(
1853 "Host intents - Bring the core links up that are down and verify ping all" )
1854 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001855
Hari Krishnac195f3b2015-07-08 20:02:24 -07001856 for switch in main.randomLinks:
1857 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001858 END1=switch[ 0 ],
1859 END2=switch[ 1 ],
1860 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001861 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001862
Jon Hallef0e2a12017-05-24 16:57:53 -07001863 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001864 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1865 utilities.assert_equals( expect=main.TRUE,
1866 actual=linkUp,
1867 onpass="Link up discovered properly",
1868 onfail="Link up was not discovered in " +
1869 str( main.linkSleep * main.linkCheck ) +
1870 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001871
Jon Hallef0e2a12017-05-24 16:57:53 -07001872 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001873 intentState = main.CHOtestFunctions.checkIntents()
1874 utilities.assert_equals( expect=main.TRUE,
1875 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001876 onpass="INTENTS INSTALLED",
1877 onfail="SOME INTENTS NOT INSTALLED" )
1878
Hari Krishnac195f3b2015-07-08 20:02:24 -07001879 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001880 pingResult = main.CHOtestFunctions.checkPingall()
1881 utilities.assert_equals( expect=main.TRUE,
1882 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001883 onpass="PING ALL PASS",
1884 onfail="PING ALL FAIL" )
1885
GlennRCbddd58f2015-10-01 15:45:25 -07001886 caseResult = linkUp and pingResult
1887 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001888 onpass="Link Up Test PASS",
1889 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001890 # Printing what exactly failed
1891 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001892 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001893 if not pingResult:
1894 main.log.debug( "Pingall failed" )
1895 if not intentState:
1896 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001897
GlennRCbddd58f2015-10-01 15:45:25 -07001898 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001899 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001900 main.stop( email=main.emailOnStop )
1901
Hari Krishnac195f3b2015-07-08 20:02:24 -07001902 def CASE73( self, main ):
1903 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001904 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001905 """
1906 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001907 import itertools
You Wangb6586542016-02-26 09:25:56 -08001908 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001909
Hari Krishnac195f3b2015-07-08 20:02:24 -07001910 main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
1911 main.log.report( "___________________________________________________________________________" )
1912 main.case( "Point intents - Randomly bring some core links down and verify ping all" )
1913 switches = []
1914 switchesComb = []
1915 for i in range( main.numMNswitches ):
Jon Hallef0e2a12017-05-24 16:57:53 -07001916 switches.append( 's%d' % ( i + 1 ) )
1917 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1918 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001919 print main.randomLinks
1920 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001921
Hari Krishnac195f3b2015-07-08 20:02:24 -07001922 for switch in main.randomLinks:
1923 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001924 END1=switch[ 0 ],
1925 END2=switch[ 1 ],
1926 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001927 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001928
Jon Hallef0e2a12017-05-24 16:57:53 -07001929 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001930 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 5 * 2 )
1931 utilities.assert_equals( expect=main.TRUE,
1932 actual=linkDown,
1933 onpass="Link down discovered properly",
1934 onfail="Link down was not discovered in " +
1935 str( main.linkSleep * main.linkCheck ) +
1936 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001937
Jon Hallef0e2a12017-05-24 16:57:53 -07001938 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001939 intentState = main.CHOtestFunctions.checkIntents()
1940 utilities.assert_equals( expect=main.TRUE,
1941 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001942 onpass="INTENTS INSTALLED",
1943 onfail="SOME INTENTS NOT INSTALLED" )
1944
Hari Krishnac195f3b2015-07-08 20:02:24 -07001945 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001946 pingResult = main.CHOtestFunctions.checkPingall()
1947 utilities.assert_equals( expect=main.TRUE,
1948 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001949 onpass="PING ALL PASS",
1950 onfail="PING ALL FAIL" )
1951
GlennRCbddd58f2015-10-01 15:45:25 -07001952 caseResult = linkDown and pingResult and intentState
1953 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001954 onpass="Random Link cut Test PASS",
1955 onfail="Random Link cut Test FAIL" )
1956
GlennRCfcfdc4f2015-09-30 16:01:57 -07001957 # Printing what exactly failed
1958 if not linkDown:
1959 main.log.debug( "Link down was not discovered correctly" )
1960 if not pingResult:
1961 main.log.debug( "Pingall failed" )
1962 if not intentState:
1963 main.log.debug( "Intents are not all installed" )
1964
GlennRCbddd58f2015-10-01 15:45:25 -07001965 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001966 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001967 main.stop( email=main.emailOnStop )
1968
Hari Krishnac195f3b2015-07-08 20:02:24 -07001969 def CASE83( self, main ):
1970 """
1971 Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
1972 """
1973 import random
You Wangb6586542016-02-26 09:25:56 -08001974 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001975
Hari Krishnac195f3b2015-07-08 20:02:24 -07001976 main.log.report(
1977 "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
1978 main.log.report(
1979 "__________________________________________________________________" )
1980 main.case(
1981 "Point intents - Bring the core links up that are down and verify ping all" )
1982 main.step( "Bring randomly cut links on devices up" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001983
Hari Krishnac195f3b2015-07-08 20:02:24 -07001984 for switch in main.randomLinks:
1985 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001986 END1=switch[ 0 ],
1987 END2=switch[ 1 ],
1988 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001989 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001990
Jon Hallef0e2a12017-05-24 16:57:53 -07001991 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001992 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
1993 utilities.assert_equals( expect=main.TRUE,
1994 actual=linkUp,
1995 onpass="Link up discovered properly",
1996 onfail="Link up was not discovered in " +
1997 str( main.linkSleep * main.linkCheck ) +
1998 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001999
Jon Hallef0e2a12017-05-24 16:57:53 -07002000 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002001 intentState = main.CHOtestFunctions.checkIntents()
2002 utilities.assert_equals( expect=main.TRUE,
2003 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002004 onpass="INTENTS INSTALLED",
2005 onfail="SOME INTENTS NOT INSTALLED" )
2006
Hari Krishnac195f3b2015-07-08 20:02:24 -07002007 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002008 pingResult = main.CHOtestFunctions.checkPingall()
2009 utilities.assert_equals( expect=main.TRUE,
2010 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002011 onpass="PING ALL PASS",
2012 onfail="PING ALL FAIL" )
2013
GlennRCbddd58f2015-10-01 15:45:25 -07002014 caseResult = linkUp and pingResult
2015 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002016 onpass="Link Up Test PASS",
2017 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002018 # Printing what exactly failed
2019 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002020 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002021 if not pingResult:
2022 main.log.debug( "Pingall failed" )
2023 if not intentState:
2024 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002025
GlennRCbddd58f2015-10-01 15:45:25 -07002026 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002027 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002028 main.stop( email=main.emailOnStop )
2029
Hari Krishnac195f3b2015-07-08 20:02:24 -07002030 def CASE74( self, main ):
2031 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002032 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002033 """
2034 import random
2035 main.randomLink1 = []
2036 main.randomLink2 = []
2037 main.randomLink3 = []
2038 main.randomLink4 = []
2039 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2040 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2041 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2042 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2043 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2044 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002045 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002046
Hari Krishnac195f3b2015-07-08 20:02:24 -07002047 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2048 main.log.report( "___________________________________________________________________________" )
Jon Hall6509dbf2016-06-21 17:01:17 -07002049 main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002050
2051 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002052 linkIndex = range( 4 )
2053 linkIndexS9 = random.sample( linkIndex, 1 )[ 0 ]
2054 linkIndex.remove( linkIndexS9 )
2055 linkIndexS10 = random.sample( linkIndex, 1 )[ 0 ]
2056 main.randomLink1 = link1End2top[ linkIndexS9 ]
2057 main.randomLink2 = link2End2top[ linkIndexS10 ]
2058 main.randomLink3 = random.sample( link1End2bot, 1 )[ 0 ]
2059 main.randomLink4 = random.sample( link2End2bot, 1 )[ 0 ]
Hari Krishna6185fc12015-07-13 15:42:31 -07002060
2061 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002062 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2063 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2064 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002065 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002066 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002067 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002068
You Wangb6586542016-02-26 09:25:56 -08002069 main.step( "Verify link down is discoverd by onos" )
2070 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2071 utilities.assert_equals( expect=main.TRUE,
2072 actual=linkDown,
2073 onpass="Link down discovered properly",
2074 onfail="Link down was not discovered in " +
2075 str( main.linkSleep * main.linkCheck ) +
2076 " seconds" )
You Wang0779bac2016-01-27 16:32:33 -08002077
You Wangb6586542016-02-26 09:25:56 -08002078 main.step( "Verify intents are installed" )
2079 intentState = main.CHOtestFunctions.checkIntents()
2080 utilities.assert_equals( expect=main.TRUE,
2081 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002082 onpass="INTENTS INSTALLED",
2083 onfail="SOME INTENTS NOT INSTALLED" )
2084
Hari Krishnac195f3b2015-07-08 20:02:24 -07002085 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002086 pingResult = main.CHOtestFunctions.checkPingall()
2087 utilities.assert_equals( expect=main.TRUE,
2088 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002089 onpass="PING ALL PASS",
2090 onfail="PING ALL FAIL" )
2091
GlennRCbddd58f2015-10-01 15:45:25 -07002092 caseResult = linkDown and pingResult and intentState
2093 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002094 onpass="Random Link cut Test PASS",
2095 onfail="Random Link cut Test FAIL" )
2096
GlennRCfcfdc4f2015-09-30 16:01:57 -07002097 # Printing what exactly failed
2098 if not linkDown:
2099 main.log.debug( "Link down was not discovered correctly" )
2100 if not pingResult:
2101 main.log.debug( "Pingall failed" )
2102 if not intentState:
2103 main.log.debug( "Intents are not all installed" )
2104
GlennRCbddd58f2015-10-01 15:45:25 -07002105 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002106 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002107 main.stop( email=main.emailOnStop )
2108
Hari Krishnac195f3b2015-07-08 20:02:24 -07002109 def CASE84( self, main ):
2110 """
2111 Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
2112 """
2113 import random
2114 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2115 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002116 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002117 main.log.report(
2118 "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" )
2119 main.log.report(
2120 "__________________________________________________________________" )
2121 main.case(
2122 "Host intents - Bring the core links up that are down and verify ping all" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002123
You Wang0779bac2016-01-27 16:32:33 -08002124 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002125 # Work around for link state propagation delay. Added some sleep time.
2126 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2127 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002128 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002129 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002130 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002131 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002132
Jon Hallef0e2a12017-05-24 16:57:53 -07002133 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002134 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2135 utilities.assert_equals( expect=main.TRUE,
2136 actual=linkUp,
2137 onpass="Link up discovered properly",
2138 onfail="Link up was not discovered in " +
2139 str( main.linkSleep * main.linkCheck ) +
2140 " seconds" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002141
Jon Hallef0e2a12017-05-24 16:57:53 -07002142 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002143 intentState = main.CHOtestFunctions.checkIntents()
2144 utilities.assert_equals( expect=main.TRUE,
2145 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002146 onpass="INTENTS INSTALLED",
2147 onfail="SOME INTENTS NOT INSTALLED" )
2148
Hari Krishnac195f3b2015-07-08 20:02:24 -07002149 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002150 pingResult = main.CHOtestFunctions.checkPingall()
2151 utilities.assert_equals( expect=main.TRUE,
2152 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002153 onpass="PING ALL PASS",
2154 onfail="PING ALL FAIL" )
2155
GlennRCbddd58f2015-10-01 15:45:25 -07002156 caseResult = linkUp and pingResult
2157 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002158 onpass="Link Up Test PASS",
2159 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002160 # Printing what exactly failed
2161 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002162 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002163 if not pingResult:
2164 main.log.debug( "Pingall failed" )
2165 if not intentState:
2166 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002167
GlennRCbddd58f2015-10-01 15:45:25 -07002168 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002169 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002170 main.stop( email=main.emailOnStop )
2171
Hari Krishnab79d0822015-08-20 09:48:43 -07002172 def CASE75( self, main ):
2173 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002174 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo )
Hari Krishnab79d0822015-08-20 09:48:43 -07002175 """
2176 import random
2177 main.randomLink1 = []
2178 main.randomLink2 = []
2179 main.randomLink3 = []
2180 main.randomLink4 = []
2181 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2182 link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' )
2183 link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' )
2184 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
2185 link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' )
2186 link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' )
You Wangb6586542016-02-26 09:25:56 -08002187 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002188
2189 main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
2190 main.log.report( "___________________________________________________________________________" )
2191 main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002192
2193 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002194 linkIndex = range( 4 )
2195 linkIndexS9 = random.sample( linkIndex, 1 )[ 0 ]
2196 linkIndex.remove( linkIndexS9 )
2197 linkIndexS10 = random.sample( linkIndex, 1 )[ 0 ]
2198 main.randomLink1 = link1End2top[ linkIndexS9 ]
2199 main.randomLink2 = link2End2top[ linkIndexS10 ]
2200 main.randomLink3 = random.sample( link1End2bot, 1 )[ 0 ]
2201 main.randomLink4 = random.sample( link2End2bot, 1 )[ 0 ]
Hari Krishnab79d0822015-08-20 09:48:43 -07002202
2203 # Work around for link state propagation delay. Added some sleep time.
2204 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" )
2205 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" )
2206 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002207 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002208 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002209 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002210
Jon Hallef0e2a12017-05-24 16:57:53 -07002211 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002212 linkDown = main.CHOtestFunctions.checkLinkEvents( "down", int( main.numMNlinks ) - 4 )
2213 utilities.assert_equals( expect=main.TRUE,
2214 actual=linkDown,
2215 onpass="Link down discovered properly",
2216 onfail="Link down was not discovered in " +
2217 str( main.linkSleep * main.linkCheck ) +
2218 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002219
Jon Hallef0e2a12017-05-24 16:57:53 -07002220 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002221 intentState = main.CHOtestFunctions.checkIntents()
2222 utilities.assert_equals( expect=main.TRUE,
2223 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002224 onpass="INTENTS INSTALLED",
2225 onfail="SOME INTENTS NOT INSTALLED" )
2226
Hari Krishnab79d0822015-08-20 09:48:43 -07002227 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002228 pingResult = main.CHOtestFunctions.checkPingall()
2229 utilities.assert_equals( expect=main.TRUE,
2230 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002231 onpass="PING ALL PASS",
2232 onfail="PING ALL FAIL" )
2233
GlennRCbddd58f2015-10-01 15:45:25 -07002234 caseResult = linkDown and pingResult and intentState
2235 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002236 onpass="Random Link cut Test PASS",
2237 onfail="Random Link cut Test FAIL" )
2238
GlennRCfcfdc4f2015-09-30 16:01:57 -07002239 # Printing what exactly failed
2240 if not linkDown:
2241 main.log.debug( "Link down was not discovered correctly" )
2242 if not pingResult:
2243 main.log.debug( "Pingall failed" )
2244 if not intentState:
2245 main.log.debug( "Intents are not all installed" )
2246
GlennRCbddd58f2015-10-01 15:45:25 -07002247 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002248 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002249 main.stop( email=main.emailOnStop )
2250
Hari Krishnab79d0822015-08-20 09:48:43 -07002251 def CASE85( self, main ):
2252 """
2253 Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
2254 """
2255 import random
2256 link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ]
2257 link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ]
You Wangb6586542016-02-26 09:25:56 -08002258 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002259 main.log.report(
2260 "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" )
2261 main.log.report(
2262 "__________________________________________________________________" )
2263 main.case(
2264 "Point intents - Bring the core links up that are down and verify ping all" )
2265
You Wang0779bac2016-01-27 16:32:33 -08002266 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002267 # Work around for link state propagation delay. Added some sleep time.
2268 # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" )
2269 # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" )
2270 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002271 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002272 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002273 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002274
Jon Hallef0e2a12017-05-24 16:57:53 -07002275 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002276 linkUp = main.CHOtestFunctions.checkLinkEvents( "up", int( main.numMNlinks ) )
2277 utilities.assert_equals( expect=main.TRUE,
2278 actual=linkUp,
2279 onpass="Link up discovered properly",
2280 onfail="Link up was not discovered in " +
2281 str( main.linkSleep * main.linkCheck ) +
2282 " seconds" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002283
Jon Hallef0e2a12017-05-24 16:57:53 -07002284 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002285 intentState = main.CHOtestFunctions.checkIntents()
2286 utilities.assert_equals( expect=main.TRUE,
2287 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002288 onpass="INTENTS INSTALLED",
2289 onfail="SOME INTENTS NOT INSTALLED" )
2290
Hari Krishnab79d0822015-08-20 09:48:43 -07002291 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002292 pingResult = main.CHOtestFunctions.checkPingall()
2293 utilities.assert_equals( expect=main.TRUE,
2294 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002295 onpass="PING ALL PASS",
2296 onfail="PING ALL FAIL" )
2297
GlennRCbddd58f2015-10-01 15:45:25 -07002298 caseResult = linkUp and pingResult
2299 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002300 onpass="Link Up Test PASS",
2301 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002302 # Printing what exactly failed
2303 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002304 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002305 if not pingResult:
2306 main.log.debug( "Pingall failed" )
2307 if not intentState:
2308 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002309
GlennRCbddd58f2015-10-01 15:45:25 -07002310 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002311 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002312 main.stop( email=main.emailOnStop )
2313
Devin Lim58046fa2017-07-05 16:55:00 -07002314 def CASE170( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002315 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002316 IPv6 ping all with some core links down( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002317 """
2318 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2319 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002320 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002321
Hari Krishna4223dbd2015-08-13 16:29:53 -07002322 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002323 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2324 utilities.assert_equals( expect=main.TRUE,
2325 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002326 onpass="PING ALL PASS",
2327 onfail="PING ALL FAIL" )
2328
GlennRCbddd58f2015-10-01 15:45:25 -07002329 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002330 utilities.assert_equals(
2331 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002332 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002333 onpass="IPv6 Ping across 300 host intents test PASS",
2334 onfail="IPv6 Ping across 300 host intents test FAIL" )
2335
You Wangb6586542016-02-26 09:25:56 -08002336 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002337 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002338 main.stop( email=main.emailOnStop )
2339
Devin Lim58046fa2017-07-05 16:55:00 -07002340 def CASE180( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002341 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002342 IPv6 ping all with after core links back up( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002343 """
2344 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2345 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002346 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002347
Hari Krishna4223dbd2015-08-13 16:29:53 -07002348 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002349 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2350 utilities.assert_equals( expect=main.TRUE,
2351 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002352 onpass="PING ALL PASS",
2353 onfail="PING ALL FAIL" )
2354
GlennRCbddd58f2015-10-01 15:45:25 -07002355 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002356 utilities.assert_equals(
2357 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002358 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002359 onpass="IPv6 Ping across 300 host intents test PASS",
2360 onfail="IPv6 Ping across 300 host intents test FAIL" )
2361
You Wangb6586542016-02-26 09:25:56 -08002362 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002363 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002364 main.stop( email=main.emailOnStop )
2365
Devin Lim58046fa2017-07-05 16:55:00 -07002366 def CASE171( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002367 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002368 IPv6 ping all with some core links down( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002369 """
2370 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2371 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002372 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002373
Hari Krishna4223dbd2015-08-13 16:29:53 -07002374 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002375 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2376 utilities.assert_equals( expect=main.TRUE,
2377 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002378 onpass="PING ALL PASS",
2379 onfail="PING ALL FAIL" )
2380
GlennRCbddd58f2015-10-01 15:45:25 -07002381 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002382 utilities.assert_equals(
2383 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002384 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002385 onpass="IPv6 Ping across 600 point intents test PASS",
2386 onfail="IPv6 Ping across 600 point intents test FAIL" )
2387
You Wangb6586542016-02-26 09:25:56 -08002388 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002389 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002390 main.stop( email=main.emailOnStop )
2391
Devin Lim58046fa2017-07-05 16:55:00 -07002392 def CASE181( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002393 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002394 IPv6 ping all with after core links back up( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002395 """
2396 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2397 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002398 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002399
Hari Krishna4223dbd2015-08-13 16:29:53 -07002400 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002401 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2402 utilities.assert_equals( expect=main.TRUE,
2403 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002404 onpass="PING ALL PASS",
2405 onfail="PING ALL FAIL" )
2406
GlennRCbddd58f2015-10-01 15:45:25 -07002407 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002408 utilities.assert_equals(
2409 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002410 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002411 onpass="IPv6 Ping across 600 Point intents test PASS",
2412 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2413
You Wangb6586542016-02-26 09:25:56 -08002414 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002415 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002416 main.stop( email=main.emailOnStop )
2417
Devin Lim58046fa2017-07-05 16:55:00 -07002418 def CASE172( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002419 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002420 IPv6 ping all with some core links down( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002421 """
2422 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2423 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002424 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002425
Hari Krishna4223dbd2015-08-13 16:29:53 -07002426 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002427 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2428 utilities.assert_equals( expect=main.TRUE,
2429 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002430 onpass="PING ALL PASS",
2431 onfail="PING ALL FAIL" )
2432
GlennRCbddd58f2015-10-01 15:45:25 -07002433 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002434 utilities.assert_equals(
2435 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002436 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002437 onpass="IPv6 Ping across 300 host intents test PASS",
2438 onfail="IPv6 Ping across 300 host intents test FAIL" )
2439
Devin Lim58046fa2017-07-05 16:55:00 -07002440 def CASE182( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002441 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002442 IPv6 ping all with after core links back up( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002443 """
2444 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2445 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002446 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal 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 300 host intents test PASS",
2460 onfail="IPv6 Ping across 300 host 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
Devin Lim58046fa2017-07-05 16:55:00 -07002466 def CASE173( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002467 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002468 IPv6 ping all with some core links down( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002469 """
2470 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2471 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002472 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal 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
Devin Lim58046fa2017-07-05 16:55:00 -07002492 def CASE183( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002493 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002494 IPv6 ping all with after core links back up( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002495 """
2496 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2497 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002498 main.case( "IPv6 ping all with after core links back up( Point 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 600 Point intents test PASS",
2512 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2513
You Wangb6586542016-02-26 09:25:56 -08002514 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002515 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002516 main.stop( email=main.emailOnStop )
2517
Devin Lim58046fa2017-07-05 16:55:00 -07002518 def CASE174( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002519 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002520 IPv6 ping all with some core links down( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002521 """
2522 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2523 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002524 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002525
Hari Krishna4223dbd2015-08-13 16:29:53 -07002526 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002527 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2528 utilities.assert_equals( expect=main.TRUE,
2529 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002530 onpass="PING ALL PASS",
2531 onfail="PING ALL FAIL" )
2532
GlennRCbddd58f2015-10-01 15:45:25 -07002533 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002534 utilities.assert_equals(
2535 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002536 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002537 onpass="IPv6 Ping across 2278 host intents test PASS",
2538 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2539
You Wangb6586542016-02-26 09:25:56 -08002540 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002541 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002542 main.stop( email=main.emailOnStop )
2543
Devin Lim58046fa2017-07-05 16:55:00 -07002544 def CASE184( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002545 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002546 IPv6 ping all with after core links back up( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002547 """
2548 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2549 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002550 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002551
Hari Krishna4223dbd2015-08-13 16:29:53 -07002552 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002553 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2554 utilities.assert_equals( expect=main.TRUE,
2555 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002556 onpass="PING ALL PASS",
2557 onfail="PING ALL FAIL" )
2558
GlennRCbddd58f2015-10-01 15:45:25 -07002559 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002560 utilities.assert_equals(
2561 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002562 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002563 onpass="IPv6 Ping across 2278 host intents test PASS",
2564 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2565
You Wangb6586542016-02-26 09:25:56 -08002566 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002567 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002568 main.stop( email=main.emailOnStop )
2569
Devin Lim58046fa2017-07-05 16:55:00 -07002570 def CASE175( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002571 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002572 IPv6 ping all with some core links down( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002573 """
2574 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2575 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002576 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002577
Hari Krishna4223dbd2015-08-13 16:29:53 -07002578 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002579 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2580 utilities.assert_equals( expect=main.TRUE,
2581 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002582 onpass="PING ALL PASS",
2583 onfail="PING ALL FAIL" )
2584
GlennRCbddd58f2015-10-01 15:45:25 -07002585 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002586 utilities.assert_equals(
2587 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002588 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002589 onpass="IPv6 Ping across 4556 point intents test PASS",
2590 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2591
You Wangb6586542016-02-26 09:25:56 -08002592 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002593 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002594 main.stop( email=main.emailOnStop )
2595
Devin Lim58046fa2017-07-05 16:55:00 -07002596 def CASE185( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002597 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002598 IPv6 ping all with after core links back up( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002599 """
2600 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2601 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002602 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002603
Hari Krishna4223dbd2015-08-13 16:29:53 -07002604 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002605 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2606 utilities.assert_equals( expect=main.TRUE,
2607 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002608 onpass="PING ALL PASS",
2609 onfail="PING ALL FAIL" )
2610
GlennRCbddd58f2015-10-01 15:45:25 -07002611 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002612 utilities.assert_equals(
2613 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002614 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002615 onpass="IPv6 Ping across 4556 Point intents test PASS",
2616 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2617
You Wangb6586542016-02-26 09:25:56 -08002618 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002619 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002620 main.stop( email=main.emailOnStop )
2621
Devin Lim58046fa2017-07-05 16:55:00 -07002622 def CASE90( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002623 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002624 Install 600 point intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002625 """
2626 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2627 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002628 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002629
Hari Krishnac195f3b2015-07-08 20:02:24 -07002630 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002631 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002632 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002633
Jon Hallef0e2a12017-05-24 16:57:53 -07002634 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002635 intentState = main.CHOtestFunctions.checkIntents()
2636 utilities.assert_equals( expect=main.TRUE,
2637 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002638 onpass="INTENTS INSTALLED",
2639 onfail="SOME INTENTS NOT INSTALLED" )
2640
Hari Krishnac195f3b2015-07-08 20:02:24 -07002641 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002642 pingResult = main.CHOtestFunctions.checkPingall()
2643 utilities.assert_equals( expect=main.TRUE,
2644 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002645 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002646 onfail="PING ALL FAIL" )
2647
GlennRCbddd58f2015-10-01 15:45:25 -07002648 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002649 utilities.assert_equals(
2650 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002651 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002652 onpass="Install 600 point Intents and Ping All test PASS",
2653 onfail="Install 600 point Intents and Ping All test FAIL" )
2654
GlennRCbddd58f2015-10-01 15:45:25 -07002655 if not intentState:
2656 main.log.debug( "Intents failed to install completely" )
2657 if not pingResult:
2658 main.log.debug( "Pingall failed" )
2659
2660 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002661 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002662 main.stop( email=main.emailOnStop )
2663
Devin Lim58046fa2017-07-05 16:55:00 -07002664 def CASE91( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002665 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002666 Install 600 point intents and verify ping all ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002667 """
2668 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2669 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002670 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002671
Hari Krishnac195f3b2015-07-08 20:02:24 -07002672 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002673 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002674 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002675
Jon Hallef0e2a12017-05-24 16:57:53 -07002676 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002677 intentState = main.CHOtestFunctions.checkIntents()
2678 utilities.assert_equals( expect=main.TRUE,
2679 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002680 onpass="INTENTS INSTALLED",
2681 onfail="SOME INTENTS NOT INSTALLED" )
2682
Hari Krishnac195f3b2015-07-08 20:02:24 -07002683 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002684 pingResult = main.CHOtestFunctions.checkPingall()
2685 utilities.assert_equals( expect=main.TRUE,
2686 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002687 onpass="PING ALL PASS",
2688 onfail="PING ALL FAIL" )
2689
GlennRCbddd58f2015-10-01 15:45:25 -07002690 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002691 utilities.assert_equals(
2692 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002693 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002694 onpass="Install 600 point Intents and Ping All test PASS",
2695 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002696
GlennRCbddd58f2015-10-01 15:45:25 -07002697 if not intentState:
2698 main.log.debug( "Intents failed to install completely" )
2699 if not pingResult:
2700 main.log.debug( "Pingall failed" )
2701
2702 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002703 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002704 main.stop( email=main.emailOnStop )
2705
Devin Lim58046fa2017-07-05 16:55:00 -07002706 def CASE92( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002707 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002708 Install 4556 point intents and verify ping all ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002709 """
2710 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2711 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002712 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002713
You Wangb6586542016-02-26 09:25:56 -08002714 main.step( "Add point Intents" )
2715 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002716 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002717
Jon Hallef0e2a12017-05-24 16:57:53 -07002718 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002719 intentState = main.CHOtestFunctions.checkIntents()
2720 utilities.assert_equals( expect=main.TRUE,
2721 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002722 onpass="INTENTS INSTALLED",
2723 onfail="SOME INTENTS NOT INSTALLED" )
2724
Hari Krishnac195f3b2015-07-08 20:02:24 -07002725 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002726 pingResult = main.CHOtestFunctions.checkPingall()
2727 utilities.assert_equals( expect=main.TRUE,
2728 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002729 onpass="PING ALL PASS",
2730 onfail="PING ALL FAIL" )
2731
GlennRCbddd58f2015-10-01 15:45:25 -07002732 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002733 utilities.assert_equals(
2734 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002735 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002736 onpass="Install 4556 point Intents and Ping All test PASS",
2737 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002738
GlennRCbddd58f2015-10-01 15:45:25 -07002739 if not intentState:
2740 main.log.debug( "Intents failed to install completely" )
2741 if not pingResult:
2742 main.log.debug( "Pingall failed" )
2743
2744 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002745 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002746 main.stop( email=main.emailOnStop )
2747
Devin Lim58046fa2017-07-05 16:55:00 -07002748 def CASE93( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002749 """
2750 Install multi-single point intents and verify Ping all works
2751 for att topology
2752 """
2753 import copy
2754 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002755 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002756 main.log.report( "Install multi-single point intents and verify Ping all" )
2757 main.log.report( "___________________________________________" )
2758 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002759 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2760 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002761 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002762 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002763 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07002764 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002765 pool = []
2766 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002767 egressDevice = deviceDPIDsCopy[ i ]
2768 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2769 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002770 if i >= len( deviceDPIDsCopy ):
2771 break
2772 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002773 threadID=main.threadID,
2774 name="addMultipointToSinglepointIntent",
2775 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2776 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002777 t.start()
2778 i = i + 1
2779 main.threadID = main.threadID + 1
2780 for thread in pool:
2781 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002782 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002783 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002784 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07002785
Jon Hallef0e2a12017-05-24 16:57:53 -07002786 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002787 # Giving onos multiple chances to install intents
2788 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002789 if i != 0:
2790 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002791 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002792 time.sleep( main.checkIntentsDelay )
2793
2794 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07002795 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07002796 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2797 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002798 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002799 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002800 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002801 if intentState:
2802 break
You Wangb6586542016-02-26 09:25:56 -08002803 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002804 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002805 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002806
2807 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2808 onpass="INTENTS INSTALLED",
2809 onfail="SOME INTENTS NOT INSTALLED" )
2810
Jon Hallef0e2a12017-05-24 16:57:53 -07002811 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002812
2813 for i in range( main.flowCheck ):
2814 if i != 0:
2815 main.log.warn( "verification failed. Retrying..." )
2816 main.log.info( "Waiting for onos to add flows..." )
2817 time.sleep( main.checkFlowsDelay )
2818
2819 flowState = main.TRUE
2820 for cli in main.CLIs:
2821 flowState = cli.checkFlowState()
2822 if not flowState:
2823 main.log.warn( "Not all flows added" )
2824 if flowState:
2825 break
2826 else:
2827 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002828 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002829
2830 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2831 onpass="FLOWS INSTALLED",
2832 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002833
Hari Krishnac195f3b2015-07-08 20:02:24 -07002834 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002835 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07002836 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002837 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07002838 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07002839 main.log.warn( "First pingall failed. Retrying..." )
2840 time.sleep( main.pingSleep )
2841 else:
2842 break
GlennRCdb2c8422015-09-29 12:21:59 -07002843
Hari Krishnac195f3b2015-07-08 20:02:24 -07002844 time2 = time.time()
2845 timeDiff = round( ( time2 - time1 ), 2 )
2846 main.log.report(
2847 "Time taken for Ping All: " +
2848 str( timeDiff ) +
2849 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002850
GlennRCbddd58f2015-10-01 15:45:25 -07002851 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002852 utilities.assert_equals(
2853 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002854 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002855 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2856 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002857
GlennRCfa69a2a2015-10-02 15:54:06 -07002858 if not intentState:
2859 main.log.debug( "Intents failed to install completely" )
2860 if not pingResult:
2861 main.log.debug( "Pingall failed" )
2862 if not checkFlowsState:
2863 main.log.debug( "Flows failed to add completely" )
2864
2865 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002866 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002867 main.stop( email=main.emailOnStop )
2868
Devin Lim58046fa2017-07-05 16:55:00 -07002869 def CASE94( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002870 """
2871 Install multi-single point intents and verify Ping all works
2872 for Chordal topology
2873 """
2874 import copy
2875 import time
2876 main.log.report( "Install multi-single point intents and verify Ping all" )
2877 main.log.report( "___________________________________________" )
2878 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002879 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2880 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002881 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002882 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002883 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07002884 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002885 pool = []
2886 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002887 egressDevice = deviceDPIDsCopy[ i ]
2888 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2889 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002890 if i >= len( deviceDPIDsCopy ):
2891 break
2892 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002893 threadID=main.threadID,
2894 name="addMultipointToSinglepointIntent",
2895 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2896 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002897 t.start()
2898 i = i + 1
2899 main.threadID = main.threadID + 1
2900 for thread in pool:
2901 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002902 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002903 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002904 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002905
Jon Hallef0e2a12017-05-24 16:57:53 -07002906 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002907 # Giving onos multiple chances to install intents
2908 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002909 if i != 0:
2910 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002911 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002912 time.sleep( main.checkIntentsDelay )
2913
2914 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07002915 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07002916 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2917 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002918 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002919 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002920 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002921 if intentState:
2922 break
You Wangb6586542016-02-26 09:25:56 -08002923 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002924 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002925 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002926
GlennRCdb2c8422015-09-29 12:21:59 -07002927 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2928 onpass="INTENTS INSTALLED",
2929 onfail="SOME INTENTS NOT INSTALLED" )
2930
Jon Hallef0e2a12017-05-24 16:57:53 -07002931 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002932
2933 for i in range( main.flowCheck ):
2934 if i != 0:
2935 main.log.warn( "verification failed. Retrying..." )
2936 main.log.info( "Waiting for onos to add flows..." )
2937 time.sleep( main.checkFlowsDelay )
2938
2939 flowState = main.TRUE
2940 for cli in main.CLIs:
2941 flowState = cli.checkFlowState()
2942 if not flowState:
2943 main.log.warn( "Not all flows added" )
2944 if flowState:
2945 break
2946 else:
2947 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002948 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002949
2950 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2951 onpass="FLOWS INSTALLED",
2952 onfail="SOME FLOWS NOT ADDED" )
2953
Hari Krishnac195f3b2015-07-08 20:02:24 -07002954 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002955 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07002956 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002957 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07002958 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07002959 main.log.warn( "First pingall failed. Retrying..." )
2960 time.sleep( main.pingSleep )
2961 else:
2962 break
GlennRCfa69a2a2015-10-02 15:54:06 -07002963
Hari Krishnac195f3b2015-07-08 20:02:24 -07002964 time2 = time.time()
2965 timeDiff = round( ( time2 - time1 ), 2 )
2966 main.log.report(
2967 "Time taken for Ping All: " +
2968 str( timeDiff ) +
2969 " seconds" )
2970
GlennRCfa69a2a2015-10-02 15:54:06 -07002971 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002972 utilities.assert_equals(
2973 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002974 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002975 onpass="Install 25 multi to single point Intents and Ping All test PASS",
2976 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002977
GlennRCfa69a2a2015-10-02 15:54:06 -07002978 if not intentState:
2979 main.log.debug( "Intents failed to install completely" )
2980 if not pingResult:
2981 main.log.debug( "Pingall failed" )
2982 if not checkFlowsState:
2983 main.log.debug( "Flows failed to add completely" )
2984
2985 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002986 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002987 main.stop( email=main.emailOnStop )
2988
Devin Lim58046fa2017-07-05 16:55:00 -07002989 def CASE95( self, main ):
GlennRCfa69a2a2015-10-02 15:54:06 -07002990 """
2991 Install multi-single point intents and verify Ping all works
2992 for Spine topology
2993 """
2994 import copy
2995 import time
2996 main.log.report( "Install multi-single point intents and verify Ping all" )
2997 main.log.report( "___________________________________________" )
2998 main.case( "Install multi-single point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002999 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3000 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
GlennRCfa69a2a2015-10-02 15:54:06 -07003001 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003002 main.log.info( "MACsDict" + str( main.MACsDict ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003003 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003004 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003005 pool = []
3006 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003007 egressDevice = deviceDPIDsCopy[ i ]
3008 ingressDeviceList = copy.copy( deviceDPIDsCopy )
3009 ingressDeviceList.remove( egressDevice )
GlennRCfa69a2a2015-10-02 15:54:06 -07003010 if i >= len( deviceDPIDsCopy ):
3011 break
3012 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003013 threadID=main.threadID,
3014 name="addMultipointToSinglepointIntent",
3015 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
3016 pool.append( t )
GlennRCfa69a2a2015-10-02 15:54:06 -07003017 t.start()
3018 i = i + 1
3019 main.threadID = main.threadID + 1
3020 for thread in pool:
3021 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003022 intentIdList.append( thread.result )
GlennRCfa69a2a2015-10-02 15:54:06 -07003023 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003024 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003025
Jon Hallef0e2a12017-05-24 16:57:53 -07003026 main.step( "Verify intents are installed" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003027 # Giving onos multiple chances to install intents
3028 for i in range( main.intentCheck ):
3029 if i != 0:
3030 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003031 main.log.info( "Waiting for onos to install intents..." )
GlennRCfa69a2a2015-10-02 15:54:06 -07003032 time.sleep( main.checkIntentsDelay )
3033
3034 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003035 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003036 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3037 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003038 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003039 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003040 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003041 if intentState:
3042 break
You Wangb6586542016-02-26 09:25:56 -08003043 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003044 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003045 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003046
3047 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3048 onpass="INTENTS INSTALLED",
3049 onfail="SOME INTENTS NOT INSTALLED" )
3050
Jon Hallef0e2a12017-05-24 16:57:53 -07003051 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003052
3053 for i in range( main.flowCheck ):
3054 if i != 0:
3055 main.log.warn( "verification failed. Retrying..." )
3056 main.log.info( "Waiting for onos to add flows..." )
3057 time.sleep( main.checkFlowsDelay )
3058
3059 flowState = main.TRUE
3060 for cli in main.CLIs:
3061 flowState = cli.checkFlowState()
3062 if not flowState:
3063 main.log.warn( "Not all flows added" )
3064 if flowState:
3065 break
3066 else:
3067 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003068 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003069
3070 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3071 onpass="FLOWS INSTALLED",
3072 onfail="SOME FLOWS NOT ADDED" )
3073
3074 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003075 for i in range( main.numPings ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003076 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003077 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003078 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003079 main.log.warn( "First pingall failed. Retrying..." )
3080 time.sleep( main.pingSleep )
3081 else:
3082 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003083
3084 time2 = time.time()
3085 timeDiff = round( ( time2 - time1 ), 2 )
3086 main.log.report(
3087 "Time taken for Ping All: " +
3088 str( timeDiff ) +
3089 " seconds" )
3090
3091 caseResult = ( checkFlowsState and pingResult and intentState )
3092 utilities.assert_equals(
3093 expect=main.TRUE,
3094 actual=caseResult,
3095 onpass="Install 25 multi to single point Intents and Ping All test PASS",
3096 onfail="Install 25 multi to single point Intents and Ping All test FAIL" )
3097
3098 if not intentState:
3099 main.log.debug( "Intents failed to install completely" )
3100 if not pingResult:
3101 main.log.debug( "Pingall failed" )
3102 if not checkFlowsState:
3103 main.log.debug( "Flows failed to add completely" )
3104
3105 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003106 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003107 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003108
Devin Lim58046fa2017-07-05 16:55:00 -07003109 def CASE96( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003110 """
3111 Install single-multi point intents and verify Ping all works
3112 for att topology
3113 """
3114 import copy
3115 main.log.report( "Install single-multi point intents and verify Ping all" )
3116 main.log.report( "___________________________________________" )
3117 main.case( "Install single-multi point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003118 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3119 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003120 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003121 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003122 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003123 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003124 pool = []
3125 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003126 ingressDevice = deviceDPIDsCopy[ i ]
3127 egressDeviceList = copy.copy( deviceDPIDsCopy )
3128 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003129 if i >= len( deviceDPIDsCopy ):
3130 break
3131 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003132 threadID=main.threadID,
3133 name="addSinglepointToMultipointIntent",
3134 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ) ] )
3135 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003136 t.start()
3137 i = i + 1
3138 main.threadID = main.threadID + 1
3139 for thread in pool:
3140 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003141 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003142 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003143 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003144
Jon Hallef0e2a12017-05-24 16:57:53 -07003145 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003146 # Giving onos multiple chances to install intents
3147 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003148 if i != 0:
3149 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003150 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003151 time.sleep( main.checkIntentsDelay )
3152
3153 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003154 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003155 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3156 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003157 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003158 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003159 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003160 if intentState:
3161 break
You Wangb6586542016-02-26 09:25:56 -08003162 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003163 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003164 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003165
GlennRCdb2c8422015-09-29 12:21:59 -07003166 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3167 onpass="INTENTS INSTALLED",
3168 onfail="SOME INTENTS NOT INSTALLED" )
3169
Jon Hallef0e2a12017-05-24 16:57:53 -07003170 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003171
3172 for i in range( main.flowCheck ):
3173 if i != 0:
3174 main.log.warn( "verification failed. Retrying..." )
3175 main.log.info( "Waiting for onos to add flows..." )
3176 time.sleep( main.checkFlowsDelay )
3177
3178 flowState = main.TRUE
3179 for cli in main.CLIs:
3180 flowState = cli.checkFlowState()
3181 if not flowState:
3182 main.log.warn( "Not all flows added" )
3183 if flowState:
3184 break
3185 else:
3186 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003187 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003188
3189 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3190 onpass="FLOWS INSTALLED",
3191 onfail="SOME FLOWS NOT ADDED" )
3192
Hari Krishnac195f3b2015-07-08 20:02:24 -07003193 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003194 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003195 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003196 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003197 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003198 main.log.warn( "First pingall failed. Retrying..." )
3199 time.sleep( main.pingSleep )
3200 else:
3201 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003202
Hari Krishnac195f3b2015-07-08 20:02:24 -07003203 time2 = time.time()
3204 timeDiff = round( ( time2 - time1 ), 2 )
3205 main.log.report(
3206 "Time taken for Ping All: " +
3207 str( timeDiff ) +
3208 " seconds" )
3209
Jon Hallef0e2a12017-05-24 16:57:53 -07003210 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003211 utilities.assert_equals(
3212 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003213 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003214 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3215 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3216
GlennRCfa69a2a2015-10-02 15:54:06 -07003217 if not intentState:
3218 main.log.debug( "Intents failed to install completely" )
3219 if not pingResult:
3220 main.log.debug( "Pingall failed" )
3221 if not checkFlowsState:
3222 main.log.debug( "Flows failed to add completely" )
3223
3224 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003225 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003226 main.stop( email=main.emailOnStop )
3227
Devin Lim58046fa2017-07-05 16:55:00 -07003228 def CASE97( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003229 """
3230 Install single-multi point intents and verify Ping all works
3231 for Chordal topology
3232 """
3233 import copy
3234 main.log.report( "Install single-multi point intents and verify Ping all" )
3235 main.log.report( "___________________________________________" )
3236 main.case( "Install single-multi point intents and Ping all" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003237 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3238 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003239 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003240 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003241 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003242 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003243 pool = []
3244 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003245 ingressDevice = deviceDPIDsCopy[ i ]
3246 egressDeviceList = copy.copy( deviceDPIDsCopy )
3247 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003248 if i >= len( deviceDPIDsCopy ):
3249 break
3250 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003251 threadID=main.threadID,
3252 name="addSinglepointToMultipointIntent",
3253 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ), '' ] )
3254 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003255 t.start()
3256 i = i + 1
3257 main.threadID = main.threadID + 1
3258 for thread in pool:
3259 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003260 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003261 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003262 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003263
Jon Hallef0e2a12017-05-24 16:57:53 -07003264 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003265 # Giving onos multiple chances to install intents
3266 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003267 if i != 0:
3268 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003269 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003270 time.sleep( main.checkIntentsDelay )
3271
3272 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003273 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003274 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3275 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003276 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003277 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003278 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003279 if intentState:
3280 break
You Wangb6586542016-02-26 09:25:56 -08003281 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003282 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003283 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003284
GlennRCdb2c8422015-09-29 12:21:59 -07003285 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3286 onpass="INTENTS INSTALLED",
3287 onfail="SOME INTENTS NOT INSTALLED" )
3288
Jon Hallef0e2a12017-05-24 16:57:53 -07003289 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003290
3291 for i in range( main.flowCheck ):
3292 if i != 0:
3293 main.log.warn( "verification failed. Retrying..." )
3294 main.log.info( "Waiting for onos to add flows..." )
3295 time.sleep( main.checkFlowsDelay )
3296
3297 flowState = main.TRUE
3298 for cli in main.CLIs:
3299 flowState = cli.checkFlowState()
3300 if not flowState:
3301 main.log.warn( "Not all flows added" )
3302 if flowState:
3303 break
3304 else:
3305 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003306 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003307
3308 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3309 onpass="FLOWS INSTALLED",
3310 onfail="SOME FLOWS NOT ADDED" )
3311
Hari Krishnac195f3b2015-07-08 20:02:24 -07003312 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003313 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003314 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003315 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003316 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003317 main.log.warn( "First pingall failed. Retrying..." )
3318 time.sleep( main.pingSleep )
3319 else:
3320 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003321
Hari Krishnac195f3b2015-07-08 20:02:24 -07003322 time2 = time.time()
3323 timeDiff = round( ( time2 - time1 ), 2 )
3324 main.log.report(
3325 "Time taken for Ping All: " +
3326 str( timeDiff ) +
3327 " seconds" )
3328
Jon Hallef0e2a12017-05-24 16:57:53 -07003329 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003330 utilities.assert_equals(
3331 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003332 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003333 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3334 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3335
GlennRCfa69a2a2015-10-02 15:54:06 -07003336 if not intentState:
3337 main.log.debug( "Intents failed to install completely" )
3338 if not pingResult:
3339 main.log.debug( "Pingall failed" )
3340 if not checkFlowsState:
3341 main.log.debug( "Flows failed to add completely" )
3342
3343 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003344 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003345 main.stop( email=main.emailOnStop )
3346
Devin Lim58046fa2017-07-05 16:55:00 -07003347 def CASE98( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003348 """
3349 Install single-multi point intents and verify Ping all works
3350 for Spine topology
3351 """
3352 import copy
3353 main.log.report( "Install single-multi point intents and verify Ping all" )
3354 main.log.report( "___________________________________________" )
3355 main.case( "Install single-multi point intents and Ping all" )
3356 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3357 deviceDPIDsCopy = deviceDPIDsCopy[ 10: ]
Jon Hallef0e2a12017-05-24 16:57:53 -07003358 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003359 intentIdList = []
3360 MACsDictCopy = {}
3361 for i in range( len( deviceDPIDsCopy ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003362 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07003363
Jon Hallef0e2a12017-05-24 16:57:53 -07003364 main.log.info( "deviceDPIDsCopy" + str( deviceDPIDsCopy ) )
3365 main.log.info( "MACsDictCopy" + str( MACsDictCopy ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003366 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003367 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003368 pool = []
3369 for cli in main.CLIs:
3370 if i >= len( deviceDPIDsCopy ):
3371 break
Jon Hallef0e2a12017-05-24 16:57:53 -07003372 ingressDevice = deviceDPIDsCopy[ i ]
3373 egressDeviceList = copy.copy( deviceDPIDsCopy )
3374 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003375 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003376 threadID=main.threadID,
3377 name="addSinglepointToMultipointIntent",
3378 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', MACsDictCopy.get( ingressDevice ), '' ] )
3379 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003380 t.start()
3381 i = i + 1
3382 main.threadID = main.threadID + 1
3383 for thread in pool:
3384 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003385 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003386 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003387 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003388
Jon Hallef0e2a12017-05-24 16:57:53 -07003389 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003390 # Giving onos multiple chances to install intents
3391 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003392 if i != 0:
3393 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003394 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003395 time.sleep( main.checkIntentsDelay )
3396
3397 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003398 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003399 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3400 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003401 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003402 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003403 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003404 if intentState:
3405 break
You Wangb6586542016-02-26 09:25:56 -08003406 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003407 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003408 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003409
GlennRCdb2c8422015-09-29 12:21:59 -07003410 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3411 onpass="INTENTS INSTALLED",
3412 onfail="SOME INTENTS NOT INSTALLED" )
3413
Jon Hallef0e2a12017-05-24 16:57:53 -07003414 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003415
3416 for i in range( main.flowCheck ):
3417 if i != 0:
3418 main.log.warn( "verification failed. Retrying..." )
3419 main.log.info( "Waiting for onos to add flows..." )
3420 time.sleep( main.checkFlowsDelay )
3421
3422 flowState = main.TRUE
3423 for cli in main.CLIs:
3424 flowState = cli.checkFlowState()
3425 if not flowState:
3426 main.log.warn( "Not all flows added" )
3427 if flowState:
3428 break
3429 else:
3430 #Dumping summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003431 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003432
3433 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3434 onpass="FLOWS INSTALLED",
3435 onfail="SOME FLOWS NOT ADDED" )
3436
Hari Krishnac195f3b2015-07-08 20:02:24 -07003437 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003438 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003439 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003440 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003441 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003442 main.log.warn( "First pingall failed. Retrying..." )
3443 time.sleep( main.pingSleep )
3444 else:
3445 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003446
Hari Krishnac195f3b2015-07-08 20:02:24 -07003447 time2 = time.time()
3448 timeDiff = round( ( time2 - time1 ), 2 )
3449 main.log.report(
3450 "Time taken for Ping All: " +
3451 str( timeDiff ) +
3452 " seconds" )
3453
Jon Hallef0e2a12017-05-24 16:57:53 -07003454 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003455 utilities.assert_equals(
3456 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003457 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003458 onpass="Install 25 single to multi point Intents and Ping All test PASS",
3459 onfail="Install 25 single to multi point Intents and Ping All test FAIL" )
3460
GlennRCfa69a2a2015-10-02 15:54:06 -07003461 if not intentState:
3462 main.log.debug( "Intents failed to install completely" )
3463 if not pingResult:
3464 main.log.debug( "Pingall failed" )
3465 if not checkFlowsState:
3466 main.log.debug( "Flows failed to add completely" )
3467
3468 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003469 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003470 main.stop( email=main.emailOnStop )
3471
Devin Lim58046fa2017-07-05 16:55:00 -07003472 def CASE190( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07003473 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003474 Verify IPv6 ping across 600 Point intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003475 """
3476 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3477 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003478 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003479
Hari Krishna4223dbd2015-08-13 16:29:53 -07003480 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003481 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3482 utilities.assert_equals( expect=main.TRUE,
3483 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003484 onpass="PING ALL PASS",
3485 onfail="PING ALL FAIL" )
3486
GlennRCbddd58f2015-10-01 15:45:25 -07003487 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003488 utilities.assert_equals(
3489 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003490 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003491 onpass="IPv6 Ping across 600 Point intents test PASS",
3492 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3493
You Wangb6586542016-02-26 09:25:56 -08003494 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003495 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003496 main.stop( email=main.emailOnStop )
3497
Devin Lim58046fa2017-07-05 16:55:00 -07003498 def CASE191( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07003499 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003500 Verify IPv6 ping across 600 Point intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003501 """
3502 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3503 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003504 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003505
Hari Krishna4223dbd2015-08-13 16:29:53 -07003506 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003507 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3508 utilities.assert_equals( expect=main.TRUE,
3509 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003510 onpass="PING ALL PASS",
3511 onfail="PING ALL FAIL" )
3512
GlennRCbddd58f2015-10-01 15:45:25 -07003513 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003514 utilities.assert_equals(
3515 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003516 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003517 onpass="IPv6 Ping across 600 Point intents test PASS",
3518 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3519
You Wangb6586542016-02-26 09:25:56 -08003520 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003521 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003522 main.stop( email=main.emailOnStop )
3523
Devin Lim58046fa2017-07-05 16:55:00 -07003524 def CASE192( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07003525 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003526 Verify IPv6 ping across 4556 Point intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003527 """
3528 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3529 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003530 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003531
Hari Krishna4223dbd2015-08-13 16:29:53 -07003532 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003533 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3534 utilities.assert_equals( expect=main.TRUE,
3535 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003536 onpass="PING ALL PASS",
3537 onfail="PING ALL FAIL" )
3538
GlennRCbddd58f2015-10-01 15:45:25 -07003539 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003540 utilities.assert_equals(
3541 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003542 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003543 onpass="IPv6 Ping across 4556 Point intents test PASS",
3544 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003545
You Wangb6586542016-02-26 09:25:56 -08003546 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003547 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003548 main.stop( email=main.emailOnStop )
3549
Devin Lim58046fa2017-07-05 16:55:00 -07003550 def CASE10( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003551 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003552 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003553 """
3554 Remove all Intents
3555 """
3556 main.log.report( "Remove all intents that were installed previously" )
3557 main.log.report( "______________________________________________" )
3558 main.log.info( "Remove all intents" )
3559 main.case( "Removing intents" )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003560 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003561 main.step( "Obtain the intent id's first" )
3562 intentsList = main.ONOScli1.getAllIntentIds()
3563 ansi_escape = re.compile( r'\x1b[^m]*m' )
3564 intentsList = ansi_escape.sub( '', intentsList )
3565 intentsList = intentsList.replace(
3566 " onos:intents | grep id=",
3567 "" ).replace(
3568 "id=",
3569 "" ).replace(
3570 "\r\r",
3571 "" )
3572 intentsList = intentsList.splitlines()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003573 intentIdList = []
3574 step1Result = main.TRUE
3575 moreIntents = main.TRUE
3576 removeIntentCount = 0
Jon Hallef0e2a12017-05-24 16:57:53 -07003577 intentsCount = len( intentsList )
3578 main.log.info( "Current number of intents: " + str( intentsCount ) )
You Wangb6586542016-02-26 09:25:56 -08003579
3580 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003581 if ( len( intentsList ) > 1 ):
3582 results = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003583 main.log.info( "Removing intent..." )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003584 while moreIntents:
Jon Hallef0e2a12017-05-24 16:57:53 -07003585 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003586 if removeIntentCount == 5:
3587 break
3588 removeIntentCount = removeIntentCount + 1
3589 intentsList1 = main.ONOScli1.getAllIntentIds()
3590 if len( intentsList1 ) == 0:
3591 break
3592 ansi_escape = re.compile( r'\x1b[^m]*m' )
3593 intentsList1 = ansi_escape.sub( '', intentsList1 )
3594 intentsList1 = intentsList1.replace(
3595 " onos:intents | grep id=",
3596 "" ).replace(
3597 " state=",
3598 "" ).replace(
3599 "\r\r",
3600 "" )
3601 intentsList1 = intentsList1.splitlines()
Jon Hallef0e2a12017-05-24 16:57:53 -07003602 main.log.info( "Round %d intents to remove: " % ( removeIntentCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003603 print intentsList1
3604 intentIdList1 = []
3605 if ( len( intentsList1 ) > 0 ):
3606 moreIntents = main.TRUE
3607 for i in range( len( intentsList1 ) ):
3608 intentsTemp1 = intentsList1[ i ].split( ',' )
Jon Hallef0e2a12017-05-24 16:57:53 -07003609 intentIdList1.append( intentsTemp1[ 0 ].split( '=' )[ 1 ] )
3610 main.log.info( "Leftover Intent IDs: " + str( intentIdList1 ) )
3611 main.log.info( "Length of Leftover Intents list: " + str( len( intentIdList1 ) ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003612 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003613 for i in xrange( 0, len( intentIdList1 ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003614 pool = []
3615 for cli in main.CLIs:
3616 if i >= len( intentIdList1 ):
3617 break
3618 t = main.Thread( target=cli.removeIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003619 threadID=main.threadID,
3620 name="removeIntent",
3621 args=[ intentIdList1[ i ], 'org.onosproject.cli', False, False ] )
3622 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003623 t.start()
3624 i = i + 1
3625 main.threadID = main.threadID + 1
3626 for thread in pool:
3627 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003628 intentIdList.append( thread.result )
3629 #time.sleep( 2 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003630 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003631 main.log.info( "Time for removing host intents: %2f seconds" % ( time2 - time1 ) )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003632 time.sleep( purgeDelay )
Jon Hallef0e2a12017-05-24 16:57:53 -07003633 main.log.info( "Purging WITHDRAWN Intents" )
3634 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003635 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003636 time.sleep( 10 )
3637 if len( main.ONOScli1.intents() ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003638 continue
3639 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003640 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003641 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003642 print "Removed %d intents" % ( intentsCount )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003643 step1Result = main.TRUE
3644 else:
3645 print "No Intent IDs found in Intents list: ", intentsList
3646 step1Result = main.FALSE
3647
3648 print main.ONOScli1.intents()
You Wangb6586542016-02-26 09:25:56 -08003649
3650 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003651 caseResult = step1Result
3652 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003653 onpass="Intent removal test successful",
3654 onfail="Intent removal test failed" )
3655
3656 def CASE12( self, main ):
3657 """
3658 Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it
3659 """
3660 import re
3661 import copy
3662 import time
3663
Hari Krishnac195f3b2015-07-08 20:02:24 -07003664 threadID = 0
3665
3666 main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" )
3667 main.log.report( "_____________________________________________________" )
3668 main.case( "Enable Intent based Reactive forwarding and Verify ping all" )
3669 main.step( "Enable intent based Reactive forwarding" )
3670 installResult = main.FALSE
3671 feature = "onos-app-ifwd"
Hari Krishna6185fc12015-07-13 15:42:31 -07003672
Hari Krishnac195f3b2015-07-08 20:02:24 -07003673 pool = []
3674 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003675 for cli, feature in main.CLIs:
3676 t = main.Thread( target=cli, threadID=threadID,
3677 name="featureInstall", args=[ feature ] )
3678 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003679 t.start()
3680 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003681
Hari Krishnac195f3b2015-07-08 20:02:24 -07003682 results = []
3683 for thread in pool:
3684 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003685 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003686 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003687
Jon Hallef0e2a12017-05-24 16:57:53 -07003688 if( all( result == main.TRUE for result in results ) == False ):
3689 main.log.info( "Did not install onos-app-ifwd feature properly" )
3690 #main.cleanup()
3691 #main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003692 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003693 main.log.info( "Successful feature:install onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003694 installResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003695 main.log.info( "Time for feature:install onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07003696
GlennRC6ac11b12015-10-21 17:41:28 -07003697 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003698 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -07003699 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003700 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003701 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003702 main.log.warn( "First pingall failed. Retrying..." )
3703 time.sleep( main.pingSleep )
3704 else:
3705 break
GlennRC6ac11b12015-10-21 17:41:28 -07003706
Hari Krishnac195f3b2015-07-08 20:02:24 -07003707 time2 = time.time()
3708 timeDiff = round( ( time2 - time1 ), 2 )
3709 main.log.report(
3710 "Time taken for Ping All: " +
3711 str( timeDiff ) +
3712 " seconds" )
Jon Hall4ba53f02015-07-29 13:07:41 -07003713
GlennRC626ba132015-09-18 16:16:31 -07003714 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003715 main.log.report( "Pingall Test in Reactive mode successful" )
3716 else:
3717 main.log.report( "Pingall Test in Reactive mode failed" )
3718
3719 main.step( "Disable Intent based Reactive forwarding" )
3720 uninstallResult = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -07003721
Hari Krishnac195f3b2015-07-08 20:02:24 -07003722 pool = []
3723 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003724 for cli, feature in main.CLIs:
3725 t = main.Thread( target=cli, threadID=threadID,
3726 name="featureUninstall", args=[ feature ] )
3727 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003728 t.start()
3729 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003730
Hari Krishnac195f3b2015-07-08 20:02:24 -07003731 results = []
3732 for thread in pool:
3733 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003734 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003735 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003736
Jon Hallef0e2a12017-05-24 16:57:53 -07003737 if( all( result == main.TRUE for result in results ) == False ):
3738 main.log.info( "Did not uninstall onos-app-ifwd feature properly" )
3739 uninstallResult = main.FALSE
3740 #main.cleanup()
3741 #main.exit()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003742 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003743 main.log.info( "Successful feature:uninstall onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003744 uninstallResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003745 main.log.info( "Time for feature:uninstall onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003746
3747 # Waiting for reative flows to be cleared.
3748 time.sleep( 10 )
3749
GlennRCbddd58f2015-10-01 15:45:25 -07003750 caseResult = installResult and pingResult and uninstallResult
3751 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003752 onpass="Intent based Reactive forwarding Pingall test PASS",
3753 onfail="Intent based Reactive forwarding Pingall test FAIL" )