blob: a49aef3c7d8324afacdf8ae5917b92f61d246e45 [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
108 # TODO: Verify Cleanup works as intended, even with multiple testcases running in a row
109 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
110 main.funcs.cleanup( main )
111
112 def CASE102( self, main ):
113 """
114 Connect to Pod
115 Create Flow between 2 dual homed hosts
116 Kill link from leaf to dst host used by flow
117 Verify flow continues using other link
118 Collect logs and analyze results
119 """
120 try:
121 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
122 import json
123 except ImportError:
124 main.log.error( "SRStagingTest not found. Exiting the test" )
125 main.cleanAndExit()
126 try:
127 main.funcs
128 except ( NameError, AttributeError ):
129 main.funcs = SRStagingTest()
130
131 descPrefix = "CASE102-Destination-Link"
132 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
133 main.funcs.setupTest( main,
134 topology='0x2',
135 onosNodes=3,
136 description="%s tests on the %s pod" % ( descPrefix, pod ) )
137 srcComponent = getattr( main, 'Compute2' )
138 dstComponent = getattr( main, 'Compute1' )
139
140 targets = main.funcs.getHostConnections( main, dstComponent )
141 shortDesc = descPrefix + "-Failure"
142 longDesc = "%s Failure: Bring down port with traffic to %s" % ( descPrefix, dstComponent.name )
143 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
144 longDesc, stat='packetsSent', bidirectional=False )
145 # TODO: These should be "bidirectional" names
146 shortDesc = descPrefix + "-Recovery"
147 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
148 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
149 bidirectional=False )
150 # Cleanup
151 # TODO: Verify Cleanup works as intended, even with multiple testcases running in a row
152 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
153 main.funcs.cleanup( main )
154
155 def CASE103( self, main ):
156 """
157 Connect to Pod
158 Create Flow between 1 dual homed host and 1 single homed host
159 Kill link from leaf to src host used by flow
160 Verify flow continues using other link
161 Collect logs and analyze results
162 """
163 try:
164 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
165 import json
166 except ImportError:
167 main.log.error( "SRStagingTest not found. Exiting the test" )
168 main.cleanAndExit()
169 try:
170 main.funcs
171 except ( NameError, AttributeError ):
172 main.funcs = SRStagingTest()
173
174 descPrefix = "CASE103-Source-Link"
175 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
176 main.funcs.setupTest( main,
177 topology='0x2',
178 onosNodes=3,
179 description="%s tests on the %s pod" % ( descPrefix, pod ) )
180 srcComponent = getattr( main, 'Compute1' )
181 dstComponent = getattr( main, 'Compute3' )
182
183 targets = main.funcs.getHostConnections( main, srcComponent )
184 shortDesc = descPrefix + "-Failure"
185 longDesc = "%s Failure: Bring down port with traffic from %s" % ( descPrefix, srcComponent.name )
186 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
187 longDesc, stat='packetsReceived', bidirectional=False )
188 # TODO: These should be "bidirectional" names
189 shortDesc = descPrefix + "-Recovery"
190 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
191 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
192 bidirectional=False )
193 # Cleanup
194 # TODO: Verify Cleanup works as intended, even with multiple testcases running in a row
195 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
196 main.funcs.cleanup( main )
197
198 def CASE104( self, main ):
199 """
200 Connect to Pod
201 Create Flow between 1 dual homed host and 1 single homed host
202 Kill link from leaf to dst host used by flow
203 Verify flow continues using other link
204 Collect logs and analyze results
205 """
206 try:
207 from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest
208 import json
209 except ImportError:
210 main.log.error( "SRStagingTest not found. Exiting the test" )
211 main.cleanAndExit()
212 try:
213 main.funcs
214 except ( NameError, AttributeError ):
215 main.funcs = SRStagingTest()
216
217 descPrefix = "CASE104-Destination-Link"
218 pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" )
219 main.funcs.setupTest( main,
220 topology='0x2',
221 onosNodes=3,
222 description="%s tests on the %s pod" % ( descPrefix, pod ) )
223 srcComponent = getattr( main, 'Compute3' )
224 dstComponent = getattr( main, 'Compute1' )
225
226 targets = main.funcs.getHostConnections( main, dstComponent )
227 shortDesc = descPrefix + "-Failure"
228 longDesc = "%s Failure: Bring down port with traffic to %s" % ( descPrefix, dstComponent.name )
229 killDevice, killPort = main.funcs.linkDown( targets, srcComponent, dstComponent, shortDesc,
230 longDesc, stat='packetsSent', bidirectional=False )
231 # TODO: These should be "bidirectional" names
232 shortDesc = descPrefix + "-Recovery"
233 longDesc = "%s Recovery: Bring up %s/%s" % ( descPrefix, killDevice, killPort )
234 main.funcs.linkUp( killDevice, killPort, srcComponent, dstComponent, shortDesc, longDesc,
235 bidirectional=False )
236 # Cleanup
237 # TODO: Verify Cleanup works as intended, even with multiple testcases running in a row
238 main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) )
239 main.funcs.cleanup( main )