blob: 0f69f4162ba2186d222682dccbffc933571d86f3 [file] [log] [blame]
Jon Hall32c90f32021-06-24 16:32:44 -07001class SRpairedLeaves:
2 def __init__( self ):
3 self.default = ''
4
5 def CASE1( self, main ):
6 """
7 Connect to Pod
8 Check host dataplane connectivity
9 Collect logs and analyze results
10 """
11 try:
12 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
13 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
14 import datetime
15 import json
16 except ImportError as e:
17 main.log.exception( "SRStagingTest not found. Exiting the test" )
18 main.cleanAndExit()
19 try:
20 main.funcs
21 except ( NameError, AttributeError ):
22 main.funcs = SRStagingTest()
23
24 try:
25 main.log.debug( "loading parser script" )
26 import tests.USECASE.SegmentRouting.SRStaging.dependencies.log_breakdown as logParser
27 except ImportError as e:
28 main.log.exception( "Error running script" )
29 descPrefix = "Host Connectivity"
30 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
31 main.cfgName = 'CASE001'
32 main.funcs.setupTest( main,
33 topology='0x2',
34 onosNodes=3,
35 description="%s tests on the %s pod" % ( descPrefix, pod ) )
36 switches = int( main.params[ 'TOPO' ][ 'switchNum' ] )
37 links = int( main.params[ 'TOPO' ][ 'linkNum' ] )
38 hosts = [ 'h1', 'h2', 'h3', 'mgmt' ]
39 run.verifyTopology( main, switches, links, main.Cluster.numCtrls )
Jon Hall32c90f32021-06-24 16:32:44 -070040 run.verifyPing( main, hosts, hosts )
Jon Hall66ce22f2021-06-30 14:57:40 -070041 main.funcs.cleanup( main )
Jon Hall32c90f32021-06-24 16:32:44 -070042
43 def CASE2( self, main ):
44 """
45 Connect to Pod
46 Check host to gateway connectivity
47 Collect logs and analyze results
48 """
49 try:
50 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
51 import json
52 except ImportError:
53 main.log.error( "SRStagingTest not found. Exiting the test" )
54 main.cleanAndExit()
55 try:
56 main.funcs
57 except ( NameError, AttributeError ):
58 main.funcs = SRStagingTest()
59
60 descPrefix = "Host to gateway connectivity"
61 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
62 main.funcs.setupTest( main,
63 topology='0x2',
64 onosNodes=3,
65 description="%s tests on the %s pod" % ( descPrefix, pod ) )
66 run.pingAllFabricIntfs( main, hosts, dumpFlows=False )
Jon Hall66ce22f2021-06-30 14:57:40 -070067 main.funcs.cleanup( main )
68
69 def CASE101( self, main ):
70 """
71 Connect to Pod
72 Create Flow between 2 dual homed hosts
73 Kill link from leaf to src host used by flow
74 Verify flow continues using other link
75 Collect logs and analyze results
76 """
77 try:
78 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
79 import json
80 except ImportError:
81 main.log.error( "SRStagingTest not found. Exiting the test" )
82 main.cleanAndExit()
83 try:
84 main.funcs
85 except ( NameError, AttributeError ):
86 main.funcs = SRStagingTest()
87
88 descPrefix = "CASE101-Source-Link"
89 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
90 main.funcs.setupTest( main,
91 topology='0x2',
92 onosNodes=3,
93 description="%s tests on the %s pod" % ( descPrefix, pod ) )
94 srcComponent = getattr( main, 'Compute1' )
95 dstComponent = getattr( main, 'Compute2' )
96
97 targets = main.funcs.getHostConnections( main, srcComponent )
98 shortDesc = descPrefix + "-Failure"
99 longDesc = "%s Failure: Bring down port with traffic from %s" % ( descPrefix, srcComponent.name )
100 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
101 longDesc, stat='packetsReceived', bidirectional=False )
102 # TODO: These should be "bidirectional" names
103 shortDesc = descPrefix + "-Recovery"
104 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
105 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
106 bidirectional=False )
107 # Cleanup
Jon Hall66ce22f2021-06-30 14:57:40 -0700108 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
109 main.funcs.cleanup( main )
110
111 def CASE102( self, main ):
112 """
113 Connect to Pod
114 Create Flow between 2 dual homed hosts
115 Kill link from leaf to dst host used by flow
116 Verify flow continues using other link
117 Collect logs and analyze results
118 """
119 try:
120 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
121 import json
122 except ImportError:
123 main.log.error( "SRStagingTest not found. Exiting the test" )
124 main.cleanAndExit()
125 try:
126 main.funcs
127 except ( NameError, AttributeError ):
128 main.funcs = SRStagingTest()
129
130 descPrefix = "CASE102-Destination-Link"
131 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
132 main.funcs.setupTest( main,
133 topology='0x2',
134 onosNodes=3,
135 description="%s tests on the %s pod" % ( descPrefix, pod ) )
136 srcComponent = getattr( main, 'Compute2' )
137 dstComponent = getattr( main, 'Compute1' )
138
139 targets = main.funcs.getHostConnections( main, dstComponent )
140 shortDesc = descPrefix + "-Failure"
141 longDesc = "%s Failure: Bring down port with traffic to %s" % ( descPrefix, dstComponent.name )
142 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
143 longDesc, stat='packetsSent', bidirectional=False )
144 # TODO: These should be "bidirectional" names
145 shortDesc = descPrefix + "-Recovery"
146 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
147 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
148 bidirectional=False )
149 # Cleanup
Jon Hall66ce22f2021-06-30 14:57:40 -0700150 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
151 main.funcs.cleanup( main )
152
153 def CASE103( self, main ):
154 """
155 Connect to Pod
156 Create Flow between 1 dual homed host and 1 single homed host
157 Kill link from leaf to src host used by flow
158 Verify flow continues using other link
159 Collect logs and analyze results
160 """
161 try:
162 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
163 import json
164 except ImportError:
165 main.log.error( "SRStagingTest not found. Exiting the test" )
166 main.cleanAndExit()
167 try:
168 main.funcs
169 except ( NameError, AttributeError ):
170 main.funcs = SRStagingTest()
171
172 descPrefix = "CASE103-Source-Link"
173 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
174 main.funcs.setupTest( main,
175 topology='0x2',
176 onosNodes=3,
177 description="%s tests on the %s pod" % ( descPrefix, pod ) )
178 srcComponent = getattr( main, 'Compute1' )
179 dstComponent = getattr( main, 'Compute3' )
180
181 targets = main.funcs.getHostConnections( main, srcComponent )
182 shortDesc = descPrefix + "-Failure"
183 longDesc = "%s Failure: Bring down port with traffic from %s" % ( descPrefix, srcComponent.name )
184 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
185 longDesc, stat='packetsReceived', bidirectional=False )
186 # TODO: These should be "bidirectional" names
187 shortDesc = descPrefix + "-Recovery"
188 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
189 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
190 bidirectional=False )
191 # Cleanup
Jon Hall66ce22f2021-06-30 14:57:40 -0700192 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
193 main.funcs.cleanup( main )
194
195 def CASE104( self, main ):
196 """
197 Connect to Pod
198 Create Flow between 1 dual homed host and 1 single homed host
199 Kill link from leaf to dst host used by flow
200 Verify flow continues using other link
201 Collect logs and analyze results
202 """
203 try:
204 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
205 import json
206 except ImportError:
207 main.log.error( "SRStagingTest not found. Exiting the test" )
208 main.cleanAndExit()
209 try:
210 main.funcs
211 except ( NameError, AttributeError ):
212 main.funcs = SRStagingTest()
213
214 descPrefix = "CASE104-Destination-Link"
215 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
216 main.funcs.setupTest( main,
217 topology='0x2',
218 onosNodes=3,
219 description="%s tests on the %s pod" % ( descPrefix, pod ) )
220 srcComponent = getattr( main, 'Compute3' )
221 dstComponent = getattr( main, 'Compute1' )
222
223 targets = main.funcs.getHostConnections( main, dstComponent )
224 shortDesc = descPrefix + "-Failure"
225 longDesc = "%s Failure: Bring down port with traffic to %s" % ( descPrefix, dstComponent.name )
226 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
227 longDesc, stat='packetsSent', bidirectional=False )
228 # TODO: These should be "bidirectional" names
229 shortDesc = descPrefix + "-Recovery"
230 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
231 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
232 bidirectional=False )
233 # Cleanup
Jon Hall22a3bcf2021-07-23 11:40:11 -0700234 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
235 main.funcs.cleanup( main )
236
237 def CASE201( self, main ):
238 """
239 Connect to Pod
240 Create Flow between 2 dual homed hosts
241 Kill the leaf that traffic first flows into
242 Verify flow continues using other link
243 Collect logs and analyze results
244 """
245 try:
246 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
247 import json
248 except ImportError:
249 main.log.error( "SRStagingTest not found. Exiting the test" )
250 main.cleanAndExit()
251 try:
252 main.funcs
253 except ( NameError, AttributeError ):
254 main.funcs = SRStagingTest()
255
256 descPrefix = "CASE201-Source-Leaf"
257 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
258 main.funcs.setupTest( main,
259 topology='0x2',
260 onosNodes=3,
261 description="%s tests on the %s pod" % ( descPrefix, pod ) )
262 srcComponent = getattr( main, 'Compute1' )
263 dstComponent = getattr( main, 'Compute2' )
264
265 targets = main.funcs.getHostConnections( main, srcComponent )
266 shortDescFailure = descPrefix + "-Failure"
267 longDescFailure = "%s Failure: Bring down switch with traffic from %s" % ( descPrefix, srcComponent.name )
268 shortDescRecovery = descPrefix + "-Recovery"
269 longDescRecovery = "%s Recovery: Bring up switch previously killed" % descPrefix
270 main.funcs.onlReboot( targets, srcComponent, dstComponent,
271 shortDescFailure, longDescFailure,
272 shortDescRecovery, longDescRecovery,
273 stat='packetsReceived', bidirectional=False )
274 # Cleanup
275 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
276 main.funcs.cleanup( main )
277
278 def CASE202( self, main ):
279 """
280 Connect to Pod
281 Create Flow between 2 dual homed hosts
282 Kill the last leaf that traffic flows out of
283 Verify flow continues using other link
284 Collect logs and analyze results
285 """
286 try:
287 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
288 import json
289 except ImportError:
290 main.log.error( "SRStagingTest not found. Exiting the test" )
291 main.cleanAndExit()
292 try:
293 main.funcs
294 except ( NameError, AttributeError ):
295 main.funcs = SRStagingTest()
296
297 descPrefix = "CASE202-Destination-Leaf"
298 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
299 main.funcs.setupTest( main,
300 topology='0x2',
301 onosNodes=3,
302 description="%s tests on the %s pod" % ( descPrefix, pod ) )
303 srcComponent = getattr( main, 'Compute1' )
304 dstComponent = getattr( main, 'Compute2' )
305
306 targets = main.funcs.getHostConnections( main, dstComponent )
307 shortDescFailure = descPrefix + "-Failure"
308 longDescFailure = "%s Failure: Bring down switch with traffic from %s" % ( descPrefix, srcComponent.name )
309 shortDescRecovery = descPrefix + "-Recovery"
310 longDescRecovery = "%s Recovery: Bring up switch previously killed" % descPrefix
311 main.funcs.onlReboot( targets, srcComponent, dstComponent,
312 shortDescFailure, longDescFailure,
313 shortDescRecovery, longDescRecovery,
314 stat='packetsSent', bidirectional=False )
315 # Cleanup
316 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
317 main.funcs.cleanup( main )
318
319 def CASE203( self, main ):
320 """
321 Connect to Pod
322 Create Flow between 1 dual homed host and 1 single homed host
323 Kill the leaf that traffic first flows into
324 Verify flow continues using other link
325 Collect logs and analyze results
326 """
327 try:
328 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
329 import json
330 except ImportError:
331 main.log.error( "SRStagingTest not found. Exiting the test" )
332 main.cleanAndExit()
333 try:
334 main.funcs
335 except ( NameError, AttributeError ):
336 main.funcs = SRStagingTest()
337
338 descPrefix = "CASE203-Source-Leaf"
339 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
340 main.funcs.setupTest( main,
341 topology='0x2',
342 onosNodes=3,
343 description="%s tests on the %s pod" % ( descPrefix, pod ) )
344 srcComponentList = [ getattr( main, name ) for name in [ 'ManagmentServer', 'Compute1', 'Compute2' ] ]
345 dstComponent = getattr( main, 'Compute3' )
346
347 targets = main.funcs.getHostConnections( main, srcComponentList, excludedDIDs=[ 'leaf2' ] )
348 shortDescFailure = descPrefix + "-Failure"
349 longDescFailure = "%s Failure: Bring down switch with traffic to %s" % ( descPrefix, dstComponent.name )
350 shortDescRecovery = descPrefix + "-Recovery"
351 longDescRecovery = "%s Recovery: Bring up switch previously killed" % descPrefix
352 main.funcs.onlReboot( targets, srcComponentList, dstComponent,
353 shortDescFailure, longDescFailure,
354 shortDescRecovery, longDescRecovery,
355 stat='packetsReceived', bidirectional=False )
356 # Cleanup
357 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
358 main.funcs.cleanup( main )
359
360 def CASE204( self, main ):
361 """
362 Connect to Pod
363 Create Flow between 1 dual homed host and 1 single homed host
364 Kill the last leaf that traffic flows out of
365 Verify flow continues using other link
366 Collect logs and analyze results
367 """
368 try:
369 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
370 import json
371 except ImportError:
372 main.log.error( "SRStagingTest not found. Exiting the test" )
373 main.cleanAndExit()
374 try:
375 main.funcs
376 except ( NameError, AttributeError ):
377 main.funcs = SRStagingTest()
378
379 descPrefix = "CASE204-Destination-Leaf"
380 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
381 main.funcs.setupTest( main,
382 topology='0x2',
383 onosNodes=3,
384 description="%s tests on the %s pod" % ( descPrefix, pod ) )
385 srcComponent = getattr( main, 'Compute3' )
386 dstComponentList = [ getattr( main, name ) for name in [ 'ManagmentServer', 'Compute1', 'Compute2' ] ]
387
388 targets = main.funcs.getHostConnections( main, dstComponentList, excludedDIDs=[ 'leaf2' ] )
389 shortDescFailure = descPrefix + "-Failure"
390 longDescFailure = "%s Failure: Bring down switch with traffic from %s" % ( descPrefix, srcComponent.name )
391 shortDescRecovery = descPrefix + "-Recovery"
392 longDescRecovery = "%s Recovery: Bring up switch previously killed" % descPrefix
393 main.funcs.onlReboot( targets, srcComponent, dstComponentList,
394 shortDescFailure, longDescFailure,
395 shortDescRecovery, longDescRecovery,
396 stat='packetsSent', bidirectional=False )
397 # Cleanup
Jon Hall66ce22f2021-06-30 14:57:40 -0700398 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
399 main.funcs.cleanup( main )