blob: 86387a10cb5dbe3e2757dc46206989e90ed2024d [file] [log] [blame]
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -08001class SRRouting:
Jon Halla604fd42018-05-04 14:27:27 -07002
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -08003 def __init__( self ):
4 self.default = ''
5
6 def CASE1( self, main ):
7 """
Andreas Pantelopoulosb7904ce2018-02-07 16:24:49 -08008 Ping between all ipv4 hosts in the topology.
Andreas Pantelopoulos90f0b102018-02-01 13:21:45 -08009 """
You Wangd66de192018-04-30 17:30:12 -070010 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
11 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
12 main.case( "Ping between all ipv4 hosts in the topology" )
13 setupTest( main, test_idx=1, onosNodes=3, ipv6=False, external=False )
14 verify( main, ipv6=False, disconnected=False, external=False )
15 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosf6ed5012018-02-08 21:26:01 -080016
17 def CASE2( self, main ):
18 """
19 Ping between all ipv6 hosts in the topology.
20 """
You Wangd66de192018-04-30 17:30:12 -070021 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
22 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
23 main.case( "Ping between all ipv6 hosts in the topology" )
24 setupTest( main, test_idx=2, onosNodes=3, ipv4=False, external=False )
25 verify( main, ipv4=False, disconnected=False, external=False )
26 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosf6ed5012018-02-08 21:26:01 -080027
You Wang79577812018-02-27 16:39:50 -080028 def CASE3( self, main ):
29 """
30 Ping between all ipv4 and ipv6 hosts in the topology.
31 """
You Wangd66de192018-04-30 17:30:12 -070032 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
33 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
34 main.case( "Ping between all ipv4 and ipv6 hosts in the topology" )
35 setupTest( main, test_idx=3, onosNodes=3, external=False )
36 verify( main, disconnected=False, external=False )
37 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wangba231e72018-03-01 13:18:21 -080038
39 def CASE4( self, main ):
40 """
41 Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
42 """
You Wangd66de192018-04-30 17:30:12 -070043 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
44 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
45 main.case( "Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts" )
46 setupTest( main, test_idx=4, onosNodes=3, ipv6=False )
47 verify( main, ipv6=False, disconnected=False )
48 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wangba231e72018-03-01 13:18:21 -080049
50 def CASE5( self, main ):
51 """
52 Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
53 """
You Wangd66de192018-04-30 17:30:12 -070054 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
55 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
56 main.case( "Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts" )
57 setupTest( main, test_idx=5, onosNodes=3, ipv4=False )
58 verify( main, ipv4=False, disconnected=False )
59 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wangba231e72018-03-01 13:18:21 -080060
61 def CASE6( self, main ):
62 """
63 Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
64 """
You Wangd66de192018-04-30 17:30:12 -070065 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
66 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
67 main.case( "Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external hosts" )
68 setupTest( main, test_idx=6, onosNodes=3 )
69 verify( main, disconnected=False )
70 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulos2eae3242018-03-06 13:47:20 -080071
72 def CASE7( self, main ):
73 """
74 Ping between ipv4 hosts and an external host that is not configured in
75 external router config, but reachable through the use of route-add
76 command.
77 """
You Wangd66de192018-04-30 17:30:12 -070078 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
79 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
80 main.case( "Ping between from ipv4 hosts to external host configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -070081 setupTest( main, test_idx=7, onosNodes=3, ipv6=False, external=False, static=True )
82 main.externalIpv4Hosts = main.staticIpv4Hosts
83 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -070084 verify( main, ipv6=False, internal=False, disconnected=False )
85 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulos2eae3242018-03-06 13:47:20 -080086
87 def CASE8( self, main ):
88 """
89 Ping between ipv6 hosts and an external host that is not configured in
90 external router config, but reachable through the use of route-add
91 command.
92 """
You Wangd66de192018-04-30 17:30:12 -070093 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
94 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
95 main.case( "Ping between from ipv6 hosts to external host configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -070096 setupTest( main, test_idx=8, onosNodes=3, ipv4=False, external=False, static=True )
97 main.externalIpv4Hosts = main.staticIpv4Hosts
98 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangf6c83432018-05-30 17:01:01 -070099 verify( main, ipv4=False, internal=False, disconnected=False )
You Wangd66de192018-04-30 17:30:12 -0700100 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulos2eae3242018-03-06 13:47:20 -0800101
102 def CASE9( self, main ):
103 """
Jon Hall39570262020-11-17 12:18:19 -0800104 Ping between ipv4 and ipv6 hosts and external hosts that is not configured in
Andreas Pantelopoulos2eae3242018-03-06 13:47:20 -0800105 external router config, but reachable through the use of route-add
106 command.
107 """
You Wangd66de192018-04-30 17:30:12 -0700108 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
109 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
110 main.case( "Ping between from ipv4 and ipv6 hosts to external host configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700111 setupTest( main, test_idx=9, onosNodes=3, external=False, static=True )
112 main.externalIpv4Hosts = main.staticIpv4Hosts
113 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700114 verify( main, internal=False, disconnected=False )
115 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800116
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800117 def CASE101( self, main ):
118 """
119 Kill and recover links
120 Ping between all ipv4 hosts in the topology.
121 """
You Wangd66de192018-04-30 17:30:12 -0700122 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
123 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
124 main.case( "Test link failures with IPv4 hosts" )
125 setupTest( main, test_idx=101, onosNodes=3, ipv6=False, external=False )
126 verify( main, ipv6=False, external=False, disconnected=False )
Siddeshec3efb32021-11-19 17:57:43 +0000127 MaxLinks = int( main.params["TOPO"]["linkNum"] )
128 MaxSwitches = int( main.params["TOPO"]["switchNum"] )
129 currentLinks = MaxLinks
130 expect = True
131 for stage in main.params.get( "CASE101Links", [] ):
132 main.log.debug("linksFailures" + stage )
133 linksToRemove = []
134 for switch in main.params[ "CASE101Links" ][ stage ]:
135 main.log.debug("processingSwitch" + switch )
136 if switch == "expect":
137 expect = main.params[ "CASE101Links" ][ stage ][ switch ].split() == "True"
138 continue
139 endpoints = main.params[ "CASE101Links" ][ stage ][ switch ].split(",")
140 for endpoint in endpoints:
141 linksToRemove.append( [ switch, endpoint ] )
142 currentLinks = (currentLinks - 2*len(linksToRemove))
143 verifyLinkFailure( main, linksToRemove, currentLinks, MaxSwitches, ipv6=False, external=False, skipOnFail=False, expectedConnectivity=expect )
144 verifyLinksRestored( main, linksToRemove, MaxLinks, MaxSwitches, ipv6=False, external=False, skipOnFail=False )
You Wangd66de192018-04-30 17:30:12 -0700145 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800146
147 def CASE102( self, main ):
148 """
149 Kill and recover links
150 Ping between all ipv6 hosts in the topology.
151 """
You Wangd66de192018-04-30 17:30:12 -0700152 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
153 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
154 main.case( "Test link failures with IPv6 hosts" )
155 setupTest( main, test_idx=102, onosNodes=3, ipv4=False, external=False )
156 verify( main, ipv4=False, external=False, disconnected=False )
157 verifyLinkFailure( main, ipv4=False, external=False )
158 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800159
160 def CASE103( self, main ):
161 """
162 Kill and recover links
163 Ping between all ipv4 and ipv6 hosts in the topology.
164 """
You Wangd66de192018-04-30 17:30:12 -0700165 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
166 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
167 main.case( "Test link failures with IPv4 and IPv6 hosts" )
168 setupTest( main, test_idx=103, onosNodes=3, external=False )
169 verify( main, external=False, disconnected=False )
170 verifyLinkFailure( main, external=False )
171 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800172
173 def CASE104( self, main ):
174 """
175 Kill and recover links
176 Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
177 """
You Wangd66de192018-04-30 17:30:12 -0700178 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
179 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
180 main.case( "Test link failures with IPv4 hosts including external hosts" )
181 setupTest( main, test_idx=104, onosNodes=3, ipv6=False )
182 verify( main, ipv6=False, disconnected=False )
Siddeshec3efb32021-11-19 17:57:43 +0000183 MaxLinks = int( main.params["TOPO"]["linkNum"] )
184 MaxSwitches = int( main.params["TOPO"]["switchNum"] )
185 currentLinks = MaxLinks
186 expect = True
187 for stage in main.params.get( "CASE104Links", [] ):
188 main.log.debug("linksFailures" + stage )
189 linksToRemove = []
190 for switch in main.params[ "CASE104Links" ][ stage ]:
191 main.log.debug("processingSwitch" + switch )
192 if switch == "expect":
193 expect = main.params[ "CASE104Links" ][ stage ][ switch ].split() == "True"
194 continue
195 endpoints = main.params[ "CASE104Links" ][ stage ][ switch ].split(",")
196 for endpoint in endpoints:
197 linksToRemove.append( [ switch, endpoint ] )
198 currentLinks = (currentLinks - 2*len(linksToRemove))
199 verifyLinkFailure( main, linksToRemove, currentLinks, MaxSwitches, ipv6=False, external=False, skipOnFail=False, expectedConnectivity=expect )
200 verifyLinksRestored( main, linksToRemove, MaxLinks, MaxSwitches, ipv6=False, external=False, skipOnFail=False )
You Wangd66de192018-04-30 17:30:12 -0700201 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800202
203 def CASE105( self, main ):
204 """
205 Kill and recover links
206 Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
207 """
You Wangd66de192018-04-30 17:30:12 -0700208 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
209 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
210 main.case( "Test link failures with IPv6 hosts including external hosts" )
211 setupTest( main, test_idx=105, onosNodes=3, ipv4=False )
212 verify( main, ipv4=False, disconnected=False )
213 verifyLinkFailure( main, ipv4=False )
214 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800215
216 def CASE106( self, main ):
217 """
218 Kill and recover links
219 Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
220 """
You Wangd66de192018-04-30 17:30:12 -0700221 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
222 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
223 main.case( "Test link failures with IPv4 and IPv6 hosts including external hosts" )
224 setupTest( main, test_idx=106, onosNodes=3 )
225 verify( main, disconnected=False )
226 verifyLinkFailure( main )
227 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800228
229 def CASE107( self, main ):
230 """
231 Kill and recover links
232 Ping between ipv4 hosts and an external host that is not configured in
233 external router config, but reachable through the use of route-add command.
234 """
You Wangd66de192018-04-30 17:30:12 -0700235 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
236 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
237 main.case( "Test link failures with IPv4 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700238 setupTest( main, test_idx=107, onosNodes=3, ipv6=False, external=False, static=True )
239 main.externalIpv4Hosts = main.staticIpv4Hosts
240 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700241 verify( main, ipv6=False, disconnected=False )
242 verifyLinkFailure( main, ipv6=False, internal=False )
243 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800244
245 def CASE108( self, main ):
246 """
247 Kill and recover links
248 Ping between ipv6 hosts and an external host that is not configured in
249 external router config, but reachable through the use of route-add command.
250 """
You Wangd66de192018-04-30 17:30:12 -0700251 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
252 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
253 main.case( "Test link failures with IPv6 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700254 setupTest( main, test_idx=108, onosNodes=3, ipv4=False, external=False, static=True )
255 main.externalIpv4Hosts = main.staticIpv4Hosts
256 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700257 verify( main, ipv4=False, disconnected=False )
258 verifyLinkFailure( main, ipv4=False, internal=False )
259 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800260
261 def CASE109( self, main ):
262 """
263 Kill and recover links
264 Ping between ipv4 and pv6 hosts and external hosts that is not configured in
265 external router config, but reachable through the use of route-add command.
266 """
You Wangd66de192018-04-30 17:30:12 -0700267 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
268 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
269 main.case( "Test link failures with IPv4 and IPv6 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700270 setupTest( main, test_idx=109, onosNodes=3, external=False, static=True )
271 main.externalIpv4Hosts = main.staticIpv4Hosts
272 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700273 verify( main, disconnected=False )
274 verifyLinkFailure( main, internal=False )
275 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800276
You Wang27317572018-03-06 12:13:11 -0800277 def CASE201( self, main ):
278 """
279 Kill and recover spine switches
280 Ping between all ipv4 hosts in the topology.
281 """
You Wangd66de192018-04-30 17:30:12 -0700282 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
283 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
284 main.case( "Test switch failures with IPv4 hosts" )
285 setupTest( main, test_idx=201, onosNodes=3, ipv6=False, external=False )
286 verify( main, ipv6=False, external=False, disconnected=False )
287 verifySwitchFailure( main, ipv6=False, external=False )
288 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800289
290 def CASE202( self, main ):
291 """
292 Kill and recover spine switches
293 Ping between all ipv6 hosts in the topology.
294 """
You Wangd66de192018-04-30 17:30:12 -0700295 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
296 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
297 main.case( "Test switch failures with IPv6 hosts" )
298 setupTest( main, test_idx=202, onosNodes=3, ipv4=False, external=False )
299 verify( main, ipv4=False, external=False, disconnected=False )
300 verifySwitchFailure( main, ipv4=False, external=False )
301 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800302
303 def CASE203( self, main ):
304 """
305 Kill and recover spine switches
306 Ping between all ipv4 and ipv6 hosts in the topology.
307 """
You Wangd66de192018-04-30 17:30:12 -0700308 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
309 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
310 main.case( "Test switch failures with IPv4 and IPv6 hosts" )
311 setupTest( main, test_idx=203, onosNodes=3, external=False )
312 verify( main, external=False, disconnected=False )
313 verifySwitchFailure( main, external=False )
314 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800315
316 def CASE204( self, main ):
317 """
318 Kill and recover spine switches
319 Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
320 """
You Wangd66de192018-04-30 17:30:12 -0700321 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
322 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
323 main.case( "Test switch failures with IPv4 hosts including external hosts" )
324 setupTest( main, test_idx=204, onosNodes=3, ipv6=False )
325 verify( main, ipv6=False, disconnected=False )
326 verifySwitchFailure( main, ipv6=False )
327 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800328
329 def CASE205( self, main ):
330 """
331 Kill and recover spine switches
332 Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
333 """
You Wangd66de192018-04-30 17:30:12 -0700334 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
335 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
336 main.case( "Test switch failures with IPv6 hosts including external hosts" )
337 setupTest( main, test_idx=205, onosNodes=3, ipv4=False )
338 verify( main, ipv4=False, disconnected=False )
339 verifySwitchFailure( main, ipv4=False )
340 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800341
342 def CASE206( self, main ):
343 """
344 Kill and recover spine switches
345 Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
346 """
You Wangd66de192018-04-30 17:30:12 -0700347 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
348 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
349 main.case( "Test switch failures with IPv4 and IPv6 hosts including external hosts" )
350 setupTest( main, test_idx=206, onosNodes=3 )
351 verify( main, disconnected=False )
352 verifySwitchFailure( main )
353 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800354
355 def CASE207( self, main ):
356 """
357 Kill and recover spine switches
358 Ping between ipv4 hosts and an external host that is not configured in
359 external router config, but reachable through the use of route-add command.
360 """
You Wangd66de192018-04-30 17:30:12 -0700361 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
362 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
363 main.case( "Test switch failures with IPv4 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700364 setupTest( main, test_idx=207, onosNodes=3, ipv6=False, external=False, static=True )
365 main.externalIpv4Hosts = main.staticIpv4Hosts
366 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700367 verify( main, ipv6=False, disconnected=False )
368 verifySwitchFailure( main, ipv6=False, internal=False )
369 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800370
371 def CASE208( self, main ):
372 """
373 Kill and recover spine switches
374 Ping between ipv6 hosts and an external host that is not configured in
375 external router config, but reachable through the use of route-add command.
376 """
You Wangd66de192018-04-30 17:30:12 -0700377 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
378 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
379 main.case( "Test switch failures with IPv6 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700380 setupTest( main, test_idx=208, onosNodes=3, ipv4=False, external=False, static=True )
381 main.externalIpv4Hosts = main.staticIpv4Hosts
382 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700383 verify( main, ipv4=False, disconnected=False )
384 verifySwitchFailure( main, ipv4=False, internal=False )
385 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang27317572018-03-06 12:13:11 -0800386
387 def CASE209( self, main ):
388 """
389 Kill and recover spine switches
390 Ping between ipv4 and pv6 hosts and external hosts that is not configured in
391 external router config, but reachable through the use of route-add command.
392 """
You Wangd66de192018-04-30 17:30:12 -0700393 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
394 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
395 main.case( "Test switch failures with IPv4 and IPv6 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700396 setupTest( main, test_idx=209, onosNodes=3, external=False, static=True )
397 main.externalIpv4Hosts = main.staticIpv4Hosts
398 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700399 verify( main, disconnected=False )
400 verifySwitchFailure( main, internal=False )
401 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800402
Jon Hall3c910162018-03-07 14:42:16 -0800403 def CASE301( self, main ):
404 """
You Wangd66de192018-04-30 17:30:12 -0700405 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800406 Ping between all ipv4 hosts in the topology.
407 """
You Wangd66de192018-04-30 17:30:12 -0700408 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
409 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
410 main.case( "Test onos failures with IPv4 hosts" )
411 setupTest( main, test_idx=301, onosNodes=3, ipv6=False, external=False )
412 verify( main, ipv6=False, external=False, disconnected=False )
413 verifyOnosFailure( main, ipv6=False, external=False )
414 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800415
416 def CASE302( self, main ):
417 """
You Wangd66de192018-04-30 17:30:12 -0700418 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800419 Ping between all ipv6 hosts in the topology.
420 """
You Wangd66de192018-04-30 17:30:12 -0700421 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
422 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
423 main.case( "Test onos failures with IPv6 hosts" )
424 setupTest( main, test_idx=302, onosNodes=3, ipv4=False, external=False )
425 verify( main, ipv4=False, external=False, disconnected=False )
426 verifyOnosFailure( main, ipv4=False, external=False )
427 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800428
429 def CASE303( self, main ):
430 """
You Wangd66de192018-04-30 17:30:12 -0700431 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800432 Ping between all ipv4 and ipv6 hosts in the topology.
433 """
You Wangd66de192018-04-30 17:30:12 -0700434 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
435 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
436 main.case( "Test onos failures with IPv4 and IPv6 hosts" )
437 setupTest( main, test_idx=303, onosNodes=3, external=False )
438 verify( main, external=False, disconnected=False )
439 verifyOnosFailure( main, external=False )
440 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800441
442 def CASE304( self, main ):
443 """
You Wangd66de192018-04-30 17:30:12 -0700444 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800445 Ping between all ipv4 hosts in the topology and check connectivity to external ipv4 hosts
446 """
You Wangd66de192018-04-30 17:30:12 -0700447 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
448 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
449 main.case( "Test onos failures with IPv4 hosts including external hosts" )
450 setupTest( main, test_idx=304, onosNodes=3, ipv6=False )
451 verify( main, ipv6=False, disconnected=False )
452 verifyOnosFailure( main, ipv6=False )
453 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800454
455 def CASE305( self, main ):
456 """
You Wangd66de192018-04-30 17:30:12 -0700457 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800458 Ping between all ipv6 hosts in the topology and check connectivity to external ipv6 hosts
459 """
You Wangd66de192018-04-30 17:30:12 -0700460 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
461 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
462 main.case( "Test onos failures with IPv6 hosts including external hosts" )
463 setupTest( main, test_idx=305, onosNodes=3, ipv4=False )
464 verify( main, ipv4=False, disconnected=False )
465 verifyOnosFailure( main, ipv4=False )
466 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800467
468 def CASE306( self, main ):
469 """
You Wangd66de192018-04-30 17:30:12 -0700470 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800471 Ping between all ipv4 and ipv6 hosts in the topology and check connectivity to external ipv4 and ipv6 hosts
472 """
You Wangd66de192018-04-30 17:30:12 -0700473 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
474 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
475 main.case( "Test onos failures with IPv4 and IPv6 hosts including external hosts" )
476 setupTest( main, test_idx=306, onosNodes=3 )
477 verify( main, disconnected=False )
478 verifyOnosFailure( main )
479 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800480
481 def CASE307( self, main ):
482 """
You Wangd66de192018-04-30 17:30:12 -0700483 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800484 Ping between ipv4 hosts and an external host that is not configured in
485 external router config, but reachable through the use of route-add command.
486 """
You Wangd66de192018-04-30 17:30:12 -0700487 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
488 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
489 main.case( "Test onos failures with IPv4 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700490 setupTest( main, test_idx=307, onosNodes=3, ipv6=False, external=False, static=True )
491 main.externalIpv4Hosts = main.staticIpv4Hosts
492 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700493 verify( main, ipv6=False, disconnected=False )
494 verifyOnosFailure( main, ipv6=False, internal=False )
495 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800496
497 def CASE308( self, main ):
498 """
You Wangd66de192018-04-30 17:30:12 -0700499 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800500 Ping between ipv6 hosts and an external host that is not configured in
501 external router config, but reachable through the use of route-add command.
502 """
You Wangd66de192018-04-30 17:30:12 -0700503 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
504 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
505 main.case( "Test onos failures with IPv6 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700506 setupTest( main, test_idx=308, onosNodes=3, ipv4=False, external=False, static=True )
507 main.externalIpv4Hosts = main.staticIpv4Hosts
508 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700509 verify( main, ipv4=False, disconnected=False )
510 verifyOnosFailure( main, ipv4=False, internal=False )
511 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jon Hall3c910162018-03-07 14:42:16 -0800512
513 def CASE309( self, main ):
514 """
You Wangd66de192018-04-30 17:30:12 -0700515 Kill and recover onos nodes
Jon Hall3c910162018-03-07 14:42:16 -0800516 Ping between ipv4 and pv6 hosts and external hosts that is not configured in
517 external router config, but reachable through the use of route-add command.
518 """
You Wangd66de192018-04-30 17:30:12 -0700519 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
520 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
521 main.case( "Test onos failures with IPv4 and IPv6 hosts including external hosts configured with route-add command" )
You Wang4efd66b2018-06-12 14:47:26 -0700522 setupTest( main, test_idx=309, onosNodes=3, external=False, static=True )
523 main.externalIpv4Hosts = main.staticIpv4Hosts
524 main.externalIpv6Hosts = main.staticIpv6Hosts
You Wangd66de192018-04-30 17:30:12 -0700525 verify( main, disconnected=False )
526 verifyOnosFailure( main, internal=False )
527 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Andreas Pantelopoulosfab6bf32018-03-06 18:56:35 -0800528
Jon Halla604fd42018-05-04 14:27:27 -0700529 def CASE601( self, main ):
530 """
531 Bring down all switches
532 Verify Topology
533 Bring up all switches
534 Verify
535
536 repeat x3
537 """
538 import time
539 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
540 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
541 main.case( "Bring down all switches then recover" )
542 setupTest( main, test_idx=601, external=False )
543 main.Cluster.next().CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -0700544 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
Jon Halla604fd42018-05-04 14:27:27 -0700545 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
546 main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
547 totalSwitches = int( main.params[ 'TOPO' ][ 'switchNum' ] )
548 totalLinks = int( main.params[ 'TOPO' ][ 'linkNum' ] )
549 switchList = [ 'spine101', 'spine102', 'spine103', 'spine104',
550 'leaf1', 'leaf2', 'leaf3', 'leaf4', 'leaf5', 'leaf6' ]
551 verify( main, disconnected=False, external=False )
552 for i in range( 1, 4 ):
553 main.log.info( "Beginning iteration {} of stopping then starting all switches".format( i ) )
554 main.log.debug( main.Cluster.next().summary() )
555 # Bring down all switches
556 main.step( "Stopping switches - iteration " + str( i ) )
557 switchStop = main.TRUE
558 for switch in switchList:
559 switchStop = switchStop and main.Network.switch( SW=switch, OPTION="stop" )
560 utilities.assert_equals( expect=main.TRUE, actual=switchStop,
561 onpass="All switches stopped",
562 onfail="Failed to stop all switches" )
563
Jon Hall43060f62020-06-23 13:13:33 -0700564 main.log.debug( "sleeping %i seconds" % float( 60 ) )
Jon Halla604fd42018-05-04 14:27:27 -0700565 time.sleep( 60 )
566 lib.verifyTopology( main, 0, 0, main.Cluster.numCtrls )
567 # Bring up all switches
568 main.log.debug( main.Cluster.next().summary() )
569 main.step( "Starting switches - iteration " + str( i ) )
570 switchStart = main.TRUE
571 for switch in switchList:
572 switchStart = switchStart and main.Network.switch( SW=switch, OPTION="start" )
573 utilities.assert_equals( expect=main.TRUE, actual=switchStart,
574 onpass="All switches started",
575 onfail="Failed to start all switches" )
576
577 main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
578 lib.verifyTopology( main, totalSwitches, totalLinks, main.Cluster.numCtrls )
579 main.log.debug( main.Cluster.next().summary() )
Jon Hall43060f62020-06-23 13:13:33 -0700580 main.log.debug( "sleeping %i seconds" % float( 60 ) )
Jon Halla604fd42018-05-04 14:27:27 -0700581 time.sleep( 60 )
582 main.log.debug( main.Cluster.next().summary() )
Jon Hall43060f62020-06-23 13:13:33 -0700583 main.log.debug( "sleeping %i seconds" % float( 60 ) )
Jon Halla604fd42018-05-04 14:27:27 -0700584 time.sleep( 60 )
585 main.log.debug( main.Cluster.next().summary() )
586 verifyPing( main )
587 verify( main, disconnected=False, external=False )
588 verify( main, disconnected=False, external=False )
589 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
590
You Wangc02f3be2018-05-18 12:14:23 -0700591 def CASE602( self, main ):
592 """"
593 Take down a leaf switch that is paired and has a dual homed host
594 Restore the leaf switch
595 Repeat for various dual homed hosts and paired switches
596 """
597 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
598 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
599 main.case( "Drop a leaf switch that is paired and has a dual homed host." )
600 setupTest( main, test_idx=602, onosNodes=3 )
601 verify( main, disconnected=False )
You Wangbe98fb12018-05-24 16:15:17 -0700602 # We need to disable ports toward dual-homed hosts before killing the leaf switch
603 portsToDisable = [ [ "of:0000000000000002", 7 ], [ "of:0000000000000002", 8 ],
604 [ "of:0000000000000002", 10 ], [ "of:0000000000000002", 11 ] ]
605 lib.disablePortBatch( main, portsToDisable, 10, 48, 5 )
You Wangc02f3be2018-05-18 12:14:23 -0700606 # Kill leaf-2
607 lib.killSwitch( main, "leaf2", 9, 38 )
You Wangbe98fb12018-05-24 16:15:17 -0700608 # FIXME: the downed interfaces on h4v6 and h5v6 won't disappear because they are
609 # configured by netcfg
You Wangc02f3be2018-05-18 12:14:23 -0700610 hostLocations = { "h4v6": "of:0000000000000003/6",
You Wangbe98fb12018-05-24 16:15:17 -0700611 "h5v6": [ "of:0000000000000002/8", "of:0000000000000003/7" ],
You Wangc02f3be2018-05-18 12:14:23 -0700612 "h4v4": "of:0000000000000003/10",
613 "h5v4": "of:0000000000000003/11" }
614 lib.verifyHostLocations( main, hostLocations )
615 main.disconnectedIpv4Hosts = [ "h3v4" ]
616 main.disconnectedIpv6Hosts = [ "h3v6" ]
617 verify( main )
618 # Recover leaf-2
You Wangbe98fb12018-05-24 16:15:17 -0700619 lib.recoverSwitch( main, "leaf2", 10, 48, rediscoverHosts=True )
You Wangc02f3be2018-05-18 12:14:23 -0700620 hostLocations = { "h4v6": [ "of:0000000000000002/7", "of:0000000000000003/6" ],
621 "h5v6": [ "of:0000000000000002/8", "of:0000000000000003/7" ],
622 "h4v4": [ "of:0000000000000002/10", "of:0000000000000003/10" ],
623 "h5v4": [ "of:0000000000000002/11", "of:0000000000000003/11" ] }
624 lib.verifyHostLocations( main, hostLocations )
625 main.disconnectedIpv4Hosts = []
626 main.disconnectedIpv6Hosts = []
627 verify( main, disconnected=False )
You Wangbe98fb12018-05-24 16:15:17 -0700628 # We need to disable ports toward dual-homed hosts before killing the leaf switch
629 portsToDisable = [ [ "of:0000000000000004", 7 ], [ "of:0000000000000004", 8 ],
630 [ "of:0000000000000004", 10 ], [ "of:0000000000000004", 11 ] ]
631 lib.disablePortBatch( main, portsToDisable, 10, 48, 5 )
You Wangc02f3be2018-05-18 12:14:23 -0700632 # Kill leaf-4
633 lib.killSwitch( main, "leaf4", 9, 38 )
You Wangbe98fb12018-05-24 16:15:17 -0700634 hostLocations = { "h9v6": [ "of:0000000000000004/7", "of:0000000000000005/6" ],
635 "h10v6": [ "of:0000000000000004/8", "of:0000000000000005/7" ],
You Wangc02f3be2018-05-18 12:14:23 -0700636 "h9v4": "of:0000000000000005/9",
637 "h10v4": "of:0000000000000005/10" }
638 lib.verifyHostLocations( main, hostLocations )
639 main.disconnectedIpv4Hosts = [ "h8v4" ]
640 main.disconnectedIpv6Hosts = [ "h8v6" ]
641 verify( main )
642 # Recover leaf-4
You Wangbe98fb12018-05-24 16:15:17 -0700643 lib.recoverSwitch( main, "leaf4", 10, 48, rediscoverHosts=True )
You Wangc02f3be2018-05-18 12:14:23 -0700644 hostLocations = { "h9v6": [ "of:0000000000000004/7", "of:0000000000000005/6" ],
645 "h10v6": [ "of:0000000000000004/8", "of:0000000000000005/7" ],
646 "h9v4": [ "of:0000000000000004/10", "of:0000000000000005/9" ],
647 "h10v4": [ "of:0000000000000004/11", "of:0000000000000005/10" ] }
648 lib.verifyHostLocations( main, hostLocations )
649 main.disconnectedIpv4Hosts = []
650 main.disconnectedIpv6Hosts = []
651 verify( main, disconnected=False )
652 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
653
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700654 def CASE603( self, main ):
655 """"
656 Drop HAGG-1 device and test connectivity.
657 Drop DAAS-1 device and test connectivity (some hosts lost it)
658 Bring up DAAS-1 and test connectivity (all hosts gained it again)
659
660 Repeat the same with HAGG-2 and DAAS-2.
661 """
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700662 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
663 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
664 main.case( "Drop hagg spine switch along with dass leaf switch." )
665 setupTest( main, test_idx=603, onosNodes=3 )
666 main.disconnectedIpv4Hosts = []
667 main.disconnectedIpv6Hosts = []
668
669 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700670 lib.killSwitch( main, "spine103",
671 int( main.params[ "TOPO" ]["switchNum" ] ) - 1,
672 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6 )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700673 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700674 lib.killSwitch( main, "leaf6",
675 int( main.params[ "TOPO" ]["switchNum" ] ) - 2,
676 int( main.params[ "TOPO" ][ "linkNum" ] ) - 8 )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700677 main.disconnectedIpv4Hosts = [ 'h12v4', 'h13v4']
678 main.disconnectedIpv6Hosts = [ 'h12v6', 'h13v6']
679 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700680 lib.recoverSwitch( main, "leaf6",
681 int( main.params[ "TOPO" ]["switchNum" ] ) - 1,
682 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6,
683 rediscoverHosts=True)
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700684 main.disconnectedIpv4Hosts = []
685 main.disconnectedIpv6Hosts = []
686 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700687 lib.recoverSwitch( main, "spine103",
688 int( main.params[ "TOPO" ][ "switchNum" ] ),
689 int( main.params[ "TOPO" ][ "linkNum" ] ) )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700690 verify( main )
691
Jon Halla604fd42018-05-04 14:27:27 -0700692 lib.killSwitch( main, "spine104",
693 int( main.params[ "TOPO" ]["switchNum" ] ) - 1,
694 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6 )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700695 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700696 lib.killSwitch( main, "leaf1",
697 int( main.params[ "TOPO" ]["switchNum" ] ) - 2,
698 int( main.params[ "TOPO" ][ "linkNum" ] ) - 8 )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700699 main.disconnectedIpv4Hosts = [ 'h1v4', 'h2v4']
700 main.disconnectedIpv6Hosts = [ 'h1v6', 'h2v6']
701 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700702 lib.recoverSwitch( main, "leaf1",
703 int( main.params[ "TOPO" ]["switchNum" ] ) - 1,
704 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6,
705 rediscoverHosts=True )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700706 main.disconnectedIpv4Hosts = []
707 main.disconnectedIpv6Hosts = []
708 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700709 lib.recoverSwitch( main, "spine104",
710 int( main.params[ "TOPO" ][ "switchNum" ] ),
711 int( main.params[ "TOPO" ][ "linkNum" ] ) )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700712 verify( main )
713
714 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
715
716 def CASE604( self, main ):
717 """"
718 Drop HAGG-1 device and test connectivity.
719 Bring up HAGG-1 and test connectivity.
720 Drop HAGG-2 device and test connectivity.
721 Bring up HAGG-2 device and test connectivity
722 """
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700723 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
724 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
725 main.case( "Drop hagg spine switches." )
726 setupTest( main, test_idx=604, onosNodes=3 )
727 main.disconnectedIpv4Hosts = []
728 main.disconnectedIpv6Hosts = []
729 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700730 lib.killSwitch( main, "spine103",
731 int( main.params[ "TOPO" ]["switchNum" ] ) - 1,
732 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6 )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700733 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700734 lib.recoverSwitch( main, "spine103",
735 int( main.params[ "TOPO" ][ "switchNum" ] ),
736 int( main.params[ "TOPO" ][ "linkNum" ] ) )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700737 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700738 lib.killSwitch( main, "spine104",
739 int( main.params[ "TOPO" ]["switchNum" ] ) - 1,
740 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6 )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700741 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700742 lib.recoverSwitch( main, "spine104",
743 int( main.params[ "TOPO" ][ "switchNum" ] ),
744 int( main.params[ "TOPO" ][ "linkNum" ] ) )
Andreas Pantelopoulos74c7ff22018-05-01 15:42:02 -0700745 verify( main )
746 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
747
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700748 def CASE605( self, main ):
749 """
750 Drop HAGG-1 and test connectivity (expect no failure)
751 Drop all leafs in big fabric and test connectivity (expect some failures)
752 Bring up HAGG-1 and test connectivity (still expect some failures)
753 Bring up all leafs in big fabric and test connectivity (expect no failure)
754 Repeat above with HAGG-2
755 """
756 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
757 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
758 main.case( "Drop one hagg and all leafs in big fabric" )
759 setupTest( main, test_idx=605, onosNodes=3 )
760 main.disconnectedIpv4Hosts = []
761 main.disconnectedIpv6Hosts = []
762 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700763 lib.killSwitch( main, "spine103",
764 int( main.params[ "TOPO" ][ "switchNum" ] ) - 1,
765 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6 )
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700766 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700767 lib.killSwitch( main, [ "leaf2", "leaf3", "leaf4", "leaf5" ],
768 int( main.params[ "TOPO" ][ "switchNum" ] ) - 5,
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700769 int( main.params[ "TOPO" ][ "linkNum" ] ) - 42 )
770 main.disconnectedIpv4Hosts = [ "h3v4", "h4v4", "h5v4", "h6v4", "h7v4", "h8v4", "h9v4", "h10v4", "h11v4" ]
771 main.disconnectedIpv6Hosts = [ "h3v6", "h4v6", "h5v6", "h6v6", "h7v6", "h8v6", "h9v6", "h10v6", "h11v6" ]
772 main.disconnectedExternalIpv4Hosts = [ "rh1v4", "rh2v4", "rh5v4" ]
773 main.disconnectedExternalIpv6Hosts = [ "rh1v6", "rh11v6", "rh5v6", "rh2v6", "rh22v6" ]
774 verify( main, disconnected=True )
Jon Halla604fd42018-05-04 14:27:27 -0700775 lib.recoverSwitch( main, "spine103",
776 int( main.params[ "TOPO" ][ "switchNum" ] ) - 4,
777 int( main.params[ "TOPO" ][ "linkNum" ] ) - 36 )
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700778 verify( main, disconnected=True )
Jon Halla604fd42018-05-04 14:27:27 -0700779 lib.recoverSwitch( main, [ "leaf2", "leaf3", "leaf4", "leaf5" ],
780 int( main.params[ "TOPO" ][ "switchNum" ] ),
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700781 int( main.params[ "TOPO" ][ "linkNum" ] ) )
782 main.disconnectedIpv4Hosts = []
783 main.disconnectedIpv6Hosts = []
784 main.disconnectedExternalIpv4Hosts = [ ]
785 main.disconnectedExternalIpv6Hosts = [ ]
786 verify( main )
787
Jon Halla604fd42018-05-04 14:27:27 -0700788 lib.killSwitch( main, "spine104",
789 int( main.params[ "TOPO" ][ "switchNum" ] ) - 1,
790 int( main.params[ "TOPO" ][ "linkNum" ] ) - 6 )
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700791 verify( main )
Jon Halla604fd42018-05-04 14:27:27 -0700792 lib.killSwitch( main, [ "leaf2", "leaf3", "leaf4", "leaf5" ],
793 int( main.params[ "TOPO" ][ "switchNum" ] ) - 5,
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700794 int( main.params[ "TOPO" ][ "linkNum" ] ) - 42 )
795 main.disconnectedIpv4Hosts = [ "h3v4", "h4v4", "h5v4", "h6v4", "h7v4", "h8v4", "h9v4", "h10v4", "h11v4" ]
796 main.disconnectedIpv6Hosts = [ "h3v6", "h4v6", "h5v6", "h6v6", "h7v6", "h8v6", "h9v6", "h10v6", "h11v6" ]
797 main.disconnectedExternalIpv4Hosts = [ "rh1v4", "rh2v4", "rh5v4" ]
798 main.disconnectedExternalIpv6Hosts = [ "rh1v6", "rh11v6", "rh5v6", "rh2v6", "rh22v6" ]
799 verify( main, disconnected=True )
Jon Halla604fd42018-05-04 14:27:27 -0700800 lib.recoverSwitch( main, "spine104",
801 int( main.params[ "TOPO" ][ "switchNum" ] ) - 4,
802 int( main.params[ "TOPO" ][ "linkNum" ] ) - 36 )
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700803 verify( main, disconnected=True )
Jon Halla604fd42018-05-04 14:27:27 -0700804 lib.recoverSwitch( main, [ "leaf2", "leaf3", "leaf4", "leaf5" ],
805 int( main.params[ "TOPO" ][ "switchNum" ] ),
Jonghwan Hyun3759e472018-05-01 15:40:08 -0700806 int( main.params[ "TOPO" ][ "linkNum" ] ) )
807 main.disconnectedIpv4Hosts = []
808 main.disconnectedIpv6Hosts = []
809 main.disconnectedExternalIpv4Hosts = [ ]
810 main.disconnectedExternalIpv6Hosts = [ ]
811 verify( main )
812 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
813
You Wang5da39c82018-04-26 22:55:08 -0700814 def CASE606( self, main ):
815 """
816 Drop SPINE-1 and test connectivity
817 Drop paired leaf and test connectivity (expect some failures)
818 Bring up SPINE-1 and test connectivity (still expect some failures)
819 Bring up the paired leaf and test connectivity
820 Repeat above with SPINE-2 and a different paired leaf
821 """
You Wang5da39c82018-04-26 22:55:08 -0700822 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
823 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
824 main.case( "Drop spine and paired leaf" )
825 setupTest( main, test_idx=606, onosNodes=3 )
You Wangd66de192018-04-30 17:30:12 -0700826 verify( main, disconnected=False )
You Wang6d2d6312018-05-08 12:02:02 -0700827 # Drop spine101 and leaf-2/3
You Wangd66de192018-04-30 17:30:12 -0700828 lib.killSwitch( main, "spine101", 9, 30 )
829 verify( main, disconnected=False )
830 lib.killSwitch( main, "leaf2", 8, 24 )
831 lib.killSwitch( main, "leaf3", 7, 20 )
You Wang5da39c82018-04-26 22:55:08 -0700832 main.disconnectedIpv4Hosts = [ "h3v4", "h4v4", "h5v4", "h6v4", "h7v4" ]
833 main.disconnectedIpv6Hosts = [ "h3v6", "h4v6", "h5v6", "h6v6", "h7v6" ]
You Wangd66de192018-04-30 17:30:12 -0700834 verify( main )
835 lib.recoverSwitch( main, "spine101", 8, 30 )
836 verify( main )
837 lib.recoverSwitch( main, "leaf3", 9, 38 )
You Wang6d2d6312018-05-08 12:02:02 -0700838 lib.recoverSwitch( main, "leaf2", 10, 48, rediscoverHosts=True,
839 hostsToDiscover=main.disconnectedIpv4Hosts + main.disconnectedIpv6Hosts )
You Wang5da39c82018-04-26 22:55:08 -0700840 main.disconnectedIpv4Hosts = []
841 main.disconnectedIpv6Hosts = []
You Wang6d2d6312018-05-08 12:02:02 -0700842 verify( main, disconnected=False )
843 # Drop spine102 and leaf-4/5
844 lib.killSwitch( main, "spine102", 9, 30 )
845 verify( main, disconnected=False )
846 lib.killSwitch( main, "leaf4", 8, 24 )
847 lib.killSwitch( main, "leaf5", 7, 20 )
848 main.disconnectedIpv4Hosts = [ "h8v4", "h9v4", "h10v4", "h11v4" ]
849 main.disconnectedIpv6Hosts = [ "h8v6", "h9v6", "h10v6", "h11v6" ]
850 verify( main, external=False )
851 lib.recoverSwitch( main, "spine102", 8, 30 )
852 verify( main, external=False )
853 lib.recoverSwitch( main, "leaf5", 9, 38 )
854 lib.recoverSwitch( main, "leaf4", 10, 48, rediscoverHosts=True,
855 hostsToDiscover=main.disconnectedIpv4Hosts + main.disconnectedIpv6Hosts )
856 main.disconnectedIpv4Hosts = []
857 main.disconnectedIpv6Hosts = []
858 verify( main, disconnected=False )
859 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
860
861 def CASE620( self, main ):
862 """
863 Take down one of double links towards the spine from all leaf switches and
864 check that buckets in select groups change accordingly
865 Bring up links again and check that buckets in select groups change accordingly
866 """
You Wang6d2d6312018-05-08 12:02:02 -0700867 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
868 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
869 main.case( "Take down one of double links towards the spine" )
870 setupTest( main, test_idx=620, onosNodes=3 )
871 verify( main, disconnected=False )
You Wangc02f3be2018-05-18 12:14:23 -0700872 groupBuckets = { "of:0000000000000002": { "10.1.0.0/24": 4, "10.1.10.0/24": 4,
873 "10.2.0.0/24": 1, "10.2.30.0/24": 1, "10.2.20.0/24": 1,
874 "10.2.10.0/24": 4, "10.2.40.0/24": 4,
875 "10.3.0.0/24": 4, "10.3.10.0/24": 8, "10.3.30.0/24": 8,
876 "10.3.20.0/24": 4, "10.5.10.0/24": 4, "10.5.20.0/24": 4 },
877 "of:0000000000000003": { "10.1.0.0/24": 4, "10.1.10.0/24": 4,
878 "10.2.0.0/24": 4, "10.2.30.0/24": 1, "10.2.20.0/24": 1,
879 "10.2.10.0/24": 1, "10.2.40.0/24": 1,
880 "10.3.0.0/24": 4, "10.3.10.0/24": 8, "10.3.30.0/24": 8,
881 "10.3.20.0/24": 4, "10.5.10.0/24": 4, "10.5.20.0/24": 4 },
882 "of:0000000000000004": { "10.1.0.0/24": 4, "10.1.10.0/24": 4,
883 "10.2.0.0/24": 4, "10.2.30.0/24": 8, "10.2.20.0/24": 8,
884 "10.2.10.0/24": 4, "10.2.40.0/24": 4,
885 "10.3.0.0/24": 1, "10.3.10.0/24": 1, "10.3.30.0/24": 1,
886 "10.3.20.0/24": 4, "10.5.10.0/24": 4, "10.5.20.0/24": 4 },
887 "of:0000000000000005": { "10.1.0.0/24": 4, "10.1.10.0/24": 4,
888 "10.2.0.0/24": 4, "10.2.30.0/24": 8, "10.2.20.0/24": 8,
889 "10.2.10.0/24": 4, "10.2.40.0/24": 4,
890 "10.3.0.0/24": 4, "10.3.10.0/24": 1, "10.3.30.0/24": 1,
891 "10.3.20.0/24": 1, "10.5.10.0/24": 4, "10.5.20.0/24": 4 } }
892 for switch, subnets in groupBuckets.items():
893 lib.checkGroupsForBuckets( main, switch, subnets )
894 # Take down one of double links
You Wang6d2d6312018-05-08 12:02:02 -0700895 portsToDisable = [ [ "of:0000000000000002", 1 ], [ "of:0000000000000002", 3 ],
896 [ "of:0000000000000003", 1 ], [ "of:0000000000000003", 3 ],
897 [ "of:0000000000000004", 1 ], [ "of:0000000000000004", 3 ],
898 [ "of:0000000000000005", 1 ], [ "of:0000000000000005", 3 ] ]
You Wang85747762018-05-11 15:51:50 -0700899 lib.disablePortBatch( main, portsToDisable, 10, 32 )
You Wangc02f3be2018-05-18 12:14:23 -0700900 groupBucketsNew = { "of:0000000000000002": { "10.1.0.0/24": 2, "10.1.10.0/24": 2,
901 "10.2.0.0/24": 1, "10.2.30.0/24": 1, "10.2.20.0/24": 1,
902 "10.2.10.0/24": 2, "10.2.40.0/24": 2,
903 "10.3.0.0/24": 2, "10.3.10.0/24": 4, "10.3.30.0/24": 4,
904 "10.3.20.0/24": 2, "10.5.10.0/24": 2, "10.5.20.0/24": 2 },
905 "of:0000000000000003": { "10.1.0.0/24": 2, "10.1.10.0/24": 2,
906 "10.2.0.0/24": 2, "10.2.30.0/24": 1, "10.2.20.0/24": 1,
907 "10.2.10.0/24": 1, "10.2.40.0/24": 1,
908 "10.3.0.0/24": 2, "10.3.10.0/24": 4, "10.3.30.0/24": 4,
909 "10.3.20.0/24": 2, "10.5.10.0/24": 2, "10.5.20.0/24": 2 },
910 "of:0000000000000004": { "10.1.0.0/24": 2, "10.1.10.0/24": 2,
911 "10.2.0.0/24": 2, "10.2.30.0/24": 4, "10.2.20.0/24": 4,
912 "10.2.10.0/24": 2, "10.2.40.0/24": 2,
913 "10.3.0.0/24": 1, "10.3.10.0/24": 1, "10.3.30.0/24": 1,
914 "10.3.20.0/24": 2, "10.5.10.0/24": 2, "10.5.20.0/24": 2 },
915 "of:0000000000000005": { "10.1.0.0/24": 2, "10.1.10.0/24": 2,
916 "10.2.0.0/24": 2, "10.2.30.0/24": 4, "10.2.20.0/24": 4,
917 "10.2.10.0/24": 2, "10.2.40.0/24": 2,
918 "10.3.0.0/24": 2, "10.3.10.0/24": 1, "10.3.30.0/24": 1,
919 "10.3.20.0/24": 1, "10.5.10.0/24": 2, "10.5.20.0/24": 2 } }
920 for switch, subnets in groupBucketsNew.items():
921 lib.checkGroupsForBuckets( main, switch, subnets )
You Wang6d2d6312018-05-08 12:02:02 -0700922 verify( main, disconnected=False )
You Wangc02f3be2018-05-18 12:14:23 -0700923 # Bring up the links
You Wang85747762018-05-11 15:51:50 -0700924 lib.enablePortBatch( main, portsToDisable, 10, 48 )
You Wangc02f3be2018-05-18 12:14:23 -0700925 for switch, subnets in groupBuckets.items():
926 lib.checkGroupsForBuckets( main, switch, subnets )
You Wang6d2d6312018-05-08 12:02:02 -0700927 verify( main, disconnected=False )
928 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
929
930 def CASE621( self, main ):
931 """
932 Remove all the links in the network and restore all Links (repeat x3)
933 """
934 import time
935 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
936 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
937 main.case( "Remove all the links in the network and restore all Links" )
938 setupTest( main, test_idx=621, onosNodes=3 )
939 verify( main, disconnected=False )
940 linksToRemove = [ ["spine101", "spine103"], ["spine102", "spine104"],
941 ["spine103", "leaf6"], ["spine103", "leaf1"],
942 ["spine104", "leaf6"], ["spine104", "leaf1"],
943 ["spine101", "leaf2"], ["spine101", "leaf3"], ["spine101", "leaf4"], ["spine101", "leaf5"],
944 ["spine102", "leaf2"], ["spine102", "leaf3"], ["spine102", "leaf4"], ["spine102", "leaf5"],
945 ["leaf2", "leaf3"], ["leaf4", "leaf5"] ]
946 portsToDisable = [ [ "of:0000000000000001", 3 ], [ "of:0000000000000001", 4 ],
947 [ "of:0000000000000001", 5 ], [ "of:0000000000000001", 6 ],
948 [ "of:0000000000000002", 6 ], [ "of:0000000000000002", 7 ],
949 [ "of:0000000000000002", 8 ], [ "of:0000000000000002", 9 ],
950 [ "of:0000000000000002", 10 ], [ "of:0000000000000002", 11 ],
951 [ "of:0000000000000003", 6 ], [ "of:0000000000000003", 7 ],
952 [ "of:0000000000000003", 8 ], [ "of:0000000000000003", 9 ],
953 [ "of:0000000000000003", 10 ], [ "of:0000000000000003", 11 ],
954 [ "of:0000000000000003", 12 ], [ "of:0000000000000003", 13 ],
955 [ "of:0000000000000004", 6 ], [ "of:0000000000000004", 7 ],
956 [ "of:0000000000000004", 8 ], [ "of:0000000000000004", 9 ],
957 [ "of:0000000000000004", 10 ], [ "of:0000000000000004", 11 ],
958 [ "of:0000000000000004", 12 ], [ "of:0000000000000004", 13 ], [ "of:0000000000000004", 14 ],
959 [ "of:0000000000000005", 6 ], [ "of:0000000000000005", 7 ],
960 [ "of:0000000000000005", 8 ], [ "of:0000000000000005", 9 ],
961 [ "of:0000000000000005", 10 ], [ "of:0000000000000005", 11 ],
962 [ "of:0000000000000005", 12 ], [ "of:0000000000000005", 13 ],
963 [ "of:0000000000000005", 14 ], [ "of:0000000000000005", 15 ],
964 [ "of:0000000000000006", 3 ], [ "of:0000000000000006", 4 ],
965 [ "of:0000000000000006", 5 ], [ "of:0000000000000006", 6 ] ]
966 for i in range( 0, 3 ):
967 lib.killLinkBatch( main, linksToRemove, 0, 10 )
You Wang85747762018-05-11 15:51:50 -0700968 lib.disablePortBatch( main, portsToDisable, 10, 0 )
You Wang6d2d6312018-05-08 12:02:02 -0700969 main.disconnectedIpv4Hosts = main.internalIpv4Hosts
970 main.disconnectedIpv6Hosts = main.internalIpv6Hosts
971 verify( main )
972 lib.restoreLinkBatch( main, linksToRemove, 48, 10 )
You Wang85747762018-05-11 15:51:50 -0700973 lib.enablePortBatch( main, portsToDisable, 10, 48 )
You Wang6d2d6312018-05-08 12:02:02 -0700974 main.Network.discoverHosts( hostList=main.disconnectedIpv4Hosts + main.disconnectedIpv6Hosts )
Jon Hall43060f62020-06-23 13:13:33 -0700975 main.log.debug( "sleeping %i seconds" % float( 10 ) )
You Wang6d2d6312018-05-08 12:02:02 -0700976 time.sleep( 10 )
977 main.disconnectedIpv4Hosts = []
978 main.disconnectedIpv6Hosts = []
979 verify( main )
980 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
981
982 def CASE622( self, main ):
983 """
984 Take down all uplinks from a paired leaf switch
985 """
You Wang6d2d6312018-05-08 12:02:02 -0700986 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
987 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
988 from core import utilities
989 main.case( "Take down all uplinks from a paired leaf switch" )
990 setupTest( main, test_idx=622, onosNodes=3 )
991 verify( main, disconnected=False )
You Wang85747762018-05-11 15:51:50 -0700992 hostLocations = { "h4v6": [ "of:0000000000000002/7", "of:0000000000000003/6" ],
993 "h5v6": [ "of:0000000000000002/8", "of:0000000000000003/7" ],
994 "h4v4": [ "of:0000000000000002/10", "of:0000000000000003/10" ],
995 "h5v4": [ "of:0000000000000002/11", "of:0000000000000003/11" ] }
996 lib.verifyHostLocations( main, hostLocations )
You Wang6d2d6312018-05-08 12:02:02 -0700997 linksToRemove = [ ["spine101", "leaf2"], ["spine102", "leaf2"] ]
998 lib.killLinkBatch( main, linksToRemove, 40, 10 )
999 # TODO: more verifications are required
You Wangc02f3be2018-05-18 12:14:23 -07001000 main.disconnectedIpv4Hosts = [ "h3v4" ]
1001 main.disconnectedIpv6Hosts = [ "h3v6" ]
You Wangd66de192018-04-30 17:30:12 -07001002 verify( main )
You Wang85747762018-05-11 15:51:50 -07001003 hostLocations = { "h4v6": "of:0000000000000003/6",
You Wangbe98fb12018-05-24 16:15:17 -07001004 "h5v6": [ "of:0000000000000002/8", "of:0000000000000003/7" ],
You Wang85747762018-05-11 15:51:50 -07001005 "h4v4": "of:0000000000000003/10",
1006 "h5v4": "of:0000000000000003/11" }
1007 lib.verifyHostLocations( main, hostLocations )
You Wang6d2d6312018-05-08 12:02:02 -07001008 lib.restoreLinkBatch( main, linksToRemove, 48, 10 )
You Wangc02f3be2018-05-18 12:14:23 -07001009 main.disconnectedIpv4Hosts = []
1010 main.disconnectedIpv6Hosts = []
1011 verify( main, disconnected=False )
You Wang85747762018-05-11 15:51:50 -07001012 hostLocations = { "h4v6": [ "of:0000000000000002/7", "of:0000000000000003/6" ],
1013 "h5v6": [ "of:0000000000000002/8", "of:0000000000000003/7" ],
1014 "h4v4": [ "of:0000000000000002/10", "of:0000000000000003/10" ],
1015 "h5v4": [ "of:0000000000000002/11", "of:0000000000000003/11" ] }
1016 lib.verifyHostLocations( main, hostLocations )
You Wang6d2d6312018-05-08 12:02:02 -07001017 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1018
1019 def CASE630( self, main ):
1020 """
1021 Bring an instance down
1022 Drop a device
1023 Bring that same instance up again and observe that this specific instance sees that the device is down.
1024 """
You Wang6d2d6312018-05-08 12:02:02 -07001025 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1026 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1027 from core import utilities
1028 main.case( "Bring an instance down and drop a device" )
1029 setupTest( main, test_idx=630, onosNodes=3 )
1030 onosToKill = 0
1031 deviceToDrop = "spine101"
1032 lib.killOnos( main, [ onosToKill ], 10, 48, 2 )
1033 lib.killSwitch( main, deviceToDrop, 9, 30 )
1034 lib.recoverOnos( main, [ onosToKill ], 9, 30, 3 )
1035 result = main.Cluster.runningNodes[ onosToKill ].CLI.checkStatus( 9, 30, 3 )
1036 utilities.assert_equals( expect=main.TRUE, actual=result,
1037 onpass="ONOS instance {} sees correct device numbers".format( onosToKill ),
1038 onfail="ONOS instance {} doesn't see correct device numbers".format( onosToKill ) )
You Wang5da39c82018-04-26 22:55:08 -07001039 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001040
Jon Halla604fd42018-05-04 14:27:27 -07001041 def CASE640( self, main ):
1042 """
1043 Controller instance going down and switch coming down at the same time and then we bring them up together
1044
1045 A. Instance goes down and SPINE-1 goes down
1046 - All connectivity should be there
1047 - Bring them up together
1048 - All connectivity should be there
1049 B. Instance goes down and HAGG-1 goes down
1050 - All connectivity should be there
1051 - Bring them up together
1052 - All connectivity should be there
1053 C. Instance goes down and a paired leaf switch goes down
1054 - Single homed hosts in this leaf should lose connectivity all others should be ok
1055 - Bring them up together
1056 - Test connectivity
1057 """
1058 import time
1059 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1060 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1061 main.case( "Drop an ONOS instance and switch(es) at the same time" )
1062 caseDict = { 'A': { 'switches': "spine101",
You Wangbe98fb12018-05-24 16:15:17 -07001063 'ports': [],
Jon Halla604fd42018-05-04 14:27:27 -07001064 'disconnectedV4': [],
1065 'disconnectedV6': [],
1066 'expectedSwitches': 9,
1067 'expectedLinks': 30 },
1068 'B': { 'switches': "spine103",
You Wangbe98fb12018-05-24 16:15:17 -07001069 'ports': [],
Jon Halla604fd42018-05-04 14:27:27 -07001070 'disconnectedV4': [],
1071 'disconnectedV6': [],
1072 'expectedSwitches': 9,
1073 'expectedLinks': 42 },
1074 'C': { 'switches': "leaf2",
You Wangbe98fb12018-05-24 16:15:17 -07001075 'ports': [ [ "of:0000000000000002", 7 ], [ "of:0000000000000002", 8 ],
1076 [ "of:0000000000000002", 10 ], [ "of:0000000000000002", 11 ] ],
Jon Halla604fd42018-05-04 14:27:27 -07001077 'disconnectedV4': [ "h3v4" ],
1078 'disconnectedV6': [ "h3v6" ],
1079 'expectedSwitches': 9,
1080 'expectedLinks': 38 } }
1081 totalSwitches = int( main.params[ 'TOPO' ][ 'switchNum' ] )
1082 totalLinks = int( main.params[ 'TOPO' ][ 'linkNum' ] )
1083 nodeIndex = 0
1084 cases = sorted( caseDict.keys() )
1085 for case in cases:
1086 switches = caseDict[ case ][ 'switches' ]
You Wangbe98fb12018-05-24 16:15:17 -07001087 ports = caseDict[ case ][ 'ports' ]
Jon Halla604fd42018-05-04 14:27:27 -07001088 expectedSwitches = caseDict[ case ][ 'expectedSwitches' ]
1089 expectedLinks = caseDict[ case ][ 'expectedLinks' ]
1090 main.step( "\n640{}: Drop ONOS{} and switch(es) {} at the same time".format( case,
1091 nodeIndex + 1,
1092 switches ) )
1093 setupTest( main, test_idx=640 )
1094 main.Cluster.next().CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001095 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
Jon Halla604fd42018-05-04 14:27:27 -07001096 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1097 main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
1098 instance = main.Cluster.controllers[ nodeIndex ]
1099 verify( main, disconnected=False, external=False )
1100
1101 # Simultaneous failures
1102 main.step( "Kill ONOS{}: {}".format( nodeIndex + 1, instance.ipAddress ) )
1103 killResult = main.ONOSbench.onosDie( instance.ipAddress )
1104 utilities.assert_equals( expect=main.TRUE, actual=killResult,
1105 onpass="ONOS node killed",
1106 onfail="Failed to kill ONOS node" )
1107 instance.active = False
1108 main.Cluster.reset()
You Wangbe98fb12018-05-24 16:15:17 -07001109 if ports:
1110 lib.disablePortBatch( main, ports, 10, 48, 0 )
Jon Halla604fd42018-05-04 14:27:27 -07001111 # TODO: Remove sleeps from the concurrent events
1112 lib.killSwitch( main, switches, expectedSwitches, expectedLinks )
1113 main.disconnectedIpv4Hosts = caseDict[ case ][ 'disconnectedV4' ]
1114 main.disconnectedIpv6Hosts = caseDict[ case ][ 'disconnectedV6' ]
1115
1116 # verify functionality
1117 main.log.debug( main.Cluster.next().summary() )
1118 main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
1119 main.log.debug( main.Cluster.next().summary() )
1120 lib.verifyTopology( main, expectedSwitches, expectedLinks, main.Cluster.numCtrls - 1 )
1121 lib.verifyNodes( main )
1122 verify( main, external=False )
1123
1124 # Bring everything back up
1125 lib.recoverSwitch( main, switches, totalSwitches, totalLinks, rediscoverHosts=True )
1126 main.disconnectedIpv4Hosts = []
1127 main.disconnectedIpv6Hosts = []
1128 lib.recoverOnos( main, [ nodeIndex ], expectedSwitches, expectedLinks, main.Cluster.numCtrls )
1129
1130 # Verify functionality
1131 lib.verifyNodes( main )
1132 verify( main, disconnected=False, external=False )
1133 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1134 nodeIndex = ( nodeIndex + 1 ) % main.Cluster.numCtrls
1135
1136 def CASE641( self, main ):
1137 """
1138 Controller instance going down while switch comes up at the same time
1139
1140 A. Take down SPINE-1
1141 - Test connectivity
1142 - Bring up SPINE-1 and drop an instance at the same time
1143 - Test connectivity
1144 - Bring up instance one
1145 - Test connectivity
1146 B. Take down HAGG-1
1147 - Test connectivity
1148 - Bring up HAGG-1 and drop an instance at the same time
1149 - Test connectivity
1150 - Bring up instance one
1151 - Test connectivity
1152 C. Take down a paired leaf switch
1153 - Test connectivity ( single homed hosts on this leaf will lose it )
1154 - Bring up paired leaf switch and drop a controller instance at the same time
1155 - Test connectivity
1156 - Bring up the instance
1157 - Test connectivity
1158 """
1159 import time
1160 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1161 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1162 main.case( "Drop an ONOS instance and recover switch(es) at the same time" )
1163 caseDict = { 'A': { 'switches': "spine101",
You Wangbe98fb12018-05-24 16:15:17 -07001164 'ports': [],
Jon Halla604fd42018-05-04 14:27:27 -07001165 'disconnectedV4': [],
1166 'disconnectedV6': [],
1167 'expectedSwitches': 9,
1168 'expectedLinks': 30 },
1169 'B': { 'switches': "spine103",
You Wangbe98fb12018-05-24 16:15:17 -07001170 'ports': [],
Jon Halla604fd42018-05-04 14:27:27 -07001171 'disconnectedV4': [],
1172 'disconnectedV6': [],
1173 'expectedSwitches': 9,
1174 'expectedLinks': 42 },
1175 'C': { 'switches': "leaf2",
You Wangbe98fb12018-05-24 16:15:17 -07001176 'ports': [ [ "of:0000000000000002", 7 ], [ "of:0000000000000002", 8 ],
1177 [ "of:0000000000000002", 10 ], [ "of:0000000000000002", 11 ] ],
Jon Halla604fd42018-05-04 14:27:27 -07001178 'disconnectedV4': [ "h3v4" ],
1179 'disconnectedV6': [ "h3v6" ],
1180 'expectedSwitches': 9,
1181 'expectedLinks': 38 } }
1182 totalSwitches = int( main.params[ 'TOPO' ][ 'switchNum' ] )
1183 totalLinks = int( main.params[ 'TOPO' ][ 'linkNum' ] )
1184 nodeIndex = 0
1185 cases = sorted( caseDict.keys() )
1186 for case in cases:
1187 switches = caseDict[ case ][ 'switches' ]
You Wangbe98fb12018-05-24 16:15:17 -07001188 ports = caseDict[ case ][ 'ports' ]
Jon Halla604fd42018-05-04 14:27:27 -07001189 expectedSwitches = caseDict[ case ][ 'expectedSwitches' ]
1190 expectedLinks = caseDict[ case ][ 'expectedLinks' ]
1191 main.step( "\n641{}: Drop ONOS{} and recover switch(es) {} at the same time".format( case,
1192 nodeIndex + 1,
1193 switches ) )
1194 setupTest( main, test_idx=641 )
1195 main.Cluster.next().CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001196 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
Jon Halla604fd42018-05-04 14:27:27 -07001197 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1198 main.Network.discoverHosts( hostList=main.internalIpv4Hosts + main.internalIpv6Hosts )
1199 instance = main.Cluster.controllers[ nodeIndex ]
1200 verify( main, disconnected=False, external=False )
1201 # Drop the switch to setup scenario
You Wangbe98fb12018-05-24 16:15:17 -07001202 if ports:
1203 lib.disablePortBatch( main, ports, 10, 48, 5 )
Jon Halla604fd42018-05-04 14:27:27 -07001204 lib.killSwitch( main, switches, expectedSwitches, expectedLinks )
1205 main.disconnectedIpv4Hosts = caseDict[ case ][ 'disconnectedV4' ]
1206 main.disconnectedIpv6Hosts = caseDict[ case ][ 'disconnectedV6' ]
1207 verify( main, external=False )
1208
1209 # Simultaneous node failure and switch recovery
1210 main.step( "Kill ONOS{}: {}".format( nodeIndex + 1, instance.ipAddress ) )
1211 killResult = main.ONOSbench.onosDie( instance.ipAddress )
1212 utilities.assert_equals( expect=main.TRUE, actual=killResult,
1213 onpass="ONOS node killed",
1214 onfail="Failed to kill ONOS node" )
1215 instance.active = False
1216 main.Cluster.reset()
1217 # TODO: Remove sleeps from the concurrent events
1218 lib.recoverSwitch( main, switches, totalSwitches, totalLinks, rediscoverHosts=True )
1219 main.disconnectedIpv4Hosts = []
1220 main.disconnectedIpv6Hosts = []
1221
1222 # verify functionality
1223 main.log.debug( main.Cluster.next().summary() )
Jon Halla604fd42018-05-04 14:27:27 -07001224 lib.verifyTopology( main, totalSwitches, totalLinks, main.Cluster.numCtrls - 1 )
1225 lib.verifyNodes( main )
1226 verify( main, disconnected=False, external=False )
1227
1228 # Bring everything back up and verify functionality
1229 lib.recoverOnos( main, [ nodeIndex ], totalSwitches, totalLinks, main.Cluster.numCtrls )
1230 lib.verifyNodes( main )
1231 verify( main, external=False )
1232 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1233 nodeIndex = ( nodeIndex + 1 ) % main.Cluster.numCtrls
1234
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001235 def CASE642( self, main ):
1236 """
1237 Drop one link from each double link
1238 Drop a link between DAAS-1 and HAAG-1
1239 Drop a link between HAGG-2 and SPINE-2
1240 Drop one ONOS instance
1241 Test connectivity (expect no failure)
1242 Bring up all links and ONOS instance
1243 Test connectivity (expect no failure)
1244 """
1245 import time
1246 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1247 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1248 main.case( "Drop ONOS instance and links at the same time" )
1249 setupTest( main, test_idx=642, onosNodes=3 )
1250 main.Cluster.active( 0 ).CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001251 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001252 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1253 verify( main )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001254 portsToDisable = [ [ "of:0000000000000001", 1 ], [ "of:0000000000000103", 1 ],
1255 [ "of:0000000000000006", 1 ], [ "of:0000000000000103", 2 ],
1256 [ "of:0000000000000101", 9 ], [ "of:0000000000000103", 3 ],
1257 [ "of:0000000000000002", 1 ], [ "of:0000000000000101", 1 ],
1258 [ "of:0000000000000003", 1 ], [ "of:0000000000000101", 3 ],
1259 [ "of:0000000000000004", 1 ], [ "of:0000000000000101", 5 ],
1260 [ "of:0000000000000005", 1 ], [ "of:0000000000000101", 7 ],
1261 [ "of:0000000000000002", 3 ], [ "of:0000000000000102", 1 ],
1262 [ "of:0000000000000003", 3 ], [ "of:0000000000000102", 3 ],
1263 [ "of:0000000000000004", 3 ], [ "of:0000000000000102", 5 ],
1264 [ "of:0000000000000005", 3 ], [ "of:0000000000000102", 7 ] ]
You Wang85747762018-05-11 15:51:50 -07001265 lib.disablePortBatch( main, portsToDisable,
1266 int( main.params[ "TOPO" ][ "switchNum" ] ),
1267 int( main.params[ "TOPO" ][ "linkNum" ] ) - len( portsToDisable ),
1268 sleep=0 )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001269 lib.killOnos( main, [ 2, ], int( main.params[ "TOPO" ][ "switchNum" ] ),
1270 int( main.params[ "TOPO" ][ "linkNum" ] ) - len( portsToDisable ), 2 )
1271 verify( main )
You Wang85747762018-05-11 15:51:50 -07001272 lib.enablePortBatch( main, portsToDisable,
1273 int( main.params[ "TOPO" ][ "switchNum" ] ),
1274 int( main.params[ "TOPO" ][ "linkNum" ] ),
1275 sleep=0 )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001276 lib.recoverOnos( main, [ 2, ], int( main.params[ "TOPO" ][ "switchNum" ] ),
1277 int( main.params[ "TOPO" ][ "linkNum" ] ), 3 )
1278 verify( main )
1279 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1280
1281 def CASE643( self, main ):
1282 """
1283 Drop one link from each double link
1284 Drop a link between DAAS-1 and HAAG-1
1285 Drop a link between HAGG-2 and SPINE-2
1286 Test connectivity (expect no failure)
1287 Bring up all links
1288 Drop one ONOS instance
1289 Test connectivity (expect no failure)
1290 Bring up ONOS instance
1291 Test connectivity (expect no failure)
1292 """
1293 import time
1294 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1295 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1296 main.case( "Drop ONOS instances and bring up links at the same time" )
1297 setupTest( main, test_idx=643, onosNodes=3 )
1298 main.Cluster.active( 0 ).CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001299 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001300 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1301 verify( main )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001302 portsToDisable = [ [ "of:0000000000000001", 1 ], [ "of:0000000000000103", 1 ],
1303 [ "of:0000000000000006", 1 ], [ "of:0000000000000103", 2 ],
1304 [ "of:0000000000000101", 9 ], [ "of:0000000000000103", 3 ],
1305 [ "of:0000000000000002", 1 ], [ "of:0000000000000101", 1 ],
1306 [ "of:0000000000000003", 1 ], [ "of:0000000000000101", 3 ],
1307 [ "of:0000000000000004", 1 ], [ "of:0000000000000101", 5 ],
1308 [ "of:0000000000000005", 1 ], [ "of:0000000000000101", 7 ],
1309 [ "of:0000000000000002", 3 ], [ "of:0000000000000102", 1 ],
1310 [ "of:0000000000000003", 3 ], [ "of:0000000000000102", 3 ],
1311 [ "of:0000000000000004", 3 ], [ "of:0000000000000102", 5 ],
1312 [ "of:0000000000000005", 3 ], [ "of:0000000000000102", 7 ] ]
You Wang85747762018-05-11 15:51:50 -07001313 lib.disablePortBatch( main, portsToDisable,
1314 int( main.params[ "TOPO" ][ "switchNum" ] ),
1315 int( main.params[ "TOPO" ][ "linkNum" ] ) - len( portsToDisable ) )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001316 verify( main )
You Wang85747762018-05-11 15:51:50 -07001317 lib.enablePortBatch( main, portsToDisable,
1318 int( main.params[ "TOPO" ][ "switchNum" ] ),
1319 int( main.params[ "TOPO" ][ "linkNum" ] ) )
Jonghwan Hyun25c98a62018-05-04 13:59:09 -07001320 lib.killOnos( main, [ 2, ], int( main.params[ "TOPO" ][ "switchNum" ] ),
1321 int( main.params[ "TOPO" ][ "linkNum" ] ), 2 )
1322 verify( main )
1323 lib.recoverOnos( main, [ 2, ], int( main.params[ "TOPO" ][ "switchNum" ] ),
1324 int( main.params[ "TOPO" ][ "linkNum" ] ), 3 )
1325 verify( main )
1326 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Jonghwan Hyun785471d2018-05-14 14:48:19 -07001327
1328 def CASE651( self, main ):
1329 """
1330 Move a single-homed host from port A to port B in DAAS-1
1331 Test connectivity (expect no failure)
1332
1333 Repeat with DAAS-2
1334 """
1335 import time
1336 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1337 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1338 main.case( "Move a single-homed host to another port in the same DAAS" )
1339 setupTest( main, test_idx=651, onosNodes=3 )
1340 main.Cluster.active( 0 ).CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001341 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
Jonghwan Hyun785471d2018-05-14 14:48:19 -07001342 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1343 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001344 # Move an untagged IPv4 host on DAAS-1
Jonghwan Hyun785471d2018-05-14 14:48:19 -07001345 h1v4cfg = '{"of:0000000000000001/7" : { "interfaces" : [ { "ips" : [ "10.1.0.254/24" ], "vlan-untagged": 10 } ] } }'
1346 lib.moveHost( main, "h1v4", "leaf1", "leaf1", "10.1.0.254", prefixLen=24, cfg=h1v4cfg )
You Wang7ea90582018-07-19 15:27:58 -07001347 hostLocations = { "h1v4": "of:0000000000000001/7" }
1348 lib.verifyHostLocations( main, hostLocations )
Jonghwan Hyun785471d2018-05-14 14:48:19 -07001349 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001350 # Move an untagged IPv6 host on DAAS-1
You Wang6260ed52018-07-18 17:54:25 -07001351 h1v6cfg = '{"of:0000000000000001/8" : { "interfaces" : [ { "ips" : [ "1000::3ff/120" ], "vlan-untagged": 21 } ] } }'
You Wang6e5b48e2018-07-23 16:17:38 -07001352 lib.moveHost( main, "h1v6", "leaf1", "leaf1", "1000::3ff", prefixLen=128, cfg=h1v6cfg, ipv6=True )
You Wang7ea90582018-07-19 15:27:58 -07001353 hostLocations = { "h1v6": "of:0000000000000001/8" }
1354 lib.verifyHostLocations( main, hostLocations )
You Wang6260ed52018-07-18 17:54:25 -07001355 verify( main )
You Wang6e5b48e2018-07-23 16:17:38 -07001356 # FIXME: We don't have any tagged hosts on DAAS-1
1357
You Wang2cb70172018-07-25 16:44:13 -07001358 # Move an untagged IPv4 host on DAAS-2
You Wang6260ed52018-07-18 17:54:25 -07001359 h13v4cfg = '{"of:0000000000000006/7" : { "interfaces" : [ { "ips" : [ "10.5.20.254/24" ], "vlan-untagged": 20 } ] } }'
Jonghwan Hyun785471d2018-05-14 14:48:19 -07001360 lib.moveHost( main, "h13v4", "leaf6", "leaf6", "10.5.20.254", prefixLen=24, cfg=h13v4cfg )
You Wang7ea90582018-07-19 15:27:58 -07001361 hostLocations = { "h13v4": "of:0000000000000006/7" }
1362 lib.verifyHostLocations( main, hostLocations )
Jonghwan Hyun785471d2018-05-14 14:48:19 -07001363 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001364 # Move an untagged IPv6 host on DAAS-2
You Wang6260ed52018-07-18 17:54:25 -07001365 h13v6cfg = '{"of:0000000000000006/8" : { "interfaces" : [ { "ips" : [ "1012::3ff/120" ], "vlan-untagged": 26 } ] } }'
You Wang6e5b48e2018-07-23 16:17:38 -07001366 lib.moveHost( main, "h13v6", "leaf6", "leaf6", "1012::3ff", prefixLen=128, cfg=h13v6cfg, ipv6=True )
You Wang7ea90582018-07-19 15:27:58 -07001367 hostLocations = { "h13v6": "of:0000000000000006/8" }
1368 lib.verifyHostLocations( main, hostLocations )
You Wang6260ed52018-07-18 17:54:25 -07001369 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001370 # Move a tagged IPv4 host on DAAS-2
You Wang6e5b48e2018-07-23 16:17:38 -07001371 h12v4cfg = '{"of:0000000000000006/9" : { "interfaces" : [ { "ips" : [ "10.5.10.254/24" ], "vlan-tagged": [80] } ] } }'
1372 lib.moveHost( main, "h12v4", "leaf6", "leaf6", "10.5.10.254", prefixLen=24, cfg=h12v4cfg, vlan=80 )
1373 hostLocations = { "h12v4": "of:0000000000000006/9" }
1374 lib.verifyHostLocations( main, hostLocations )
1375 verify( main )
You Wang6e5b48e2018-07-23 16:17:38 -07001376 # FIXME: Due to CORD-3079, we are not able to test movement of tagged IPv6 hosts at the moment
1377 '''
1378 h12v6cfg = '{"of:0000000000000006/10" : { "interfaces" : [ { "ips" : [ "1011::3ff/120" ], "vlan-tagged": [127] } ] } }'
1379 lib.moveHost( main, "h12v6", "leaf6", "leaf6", "1011::3ff", prefixLen=128, cfg=h12v6cfg, ipv6=True, vlan=127 )
1380 hostLocations = { "h12v6": "of:0000000000000006/10" }
1381 lib.verifyHostLocations( main, hostLocations )
1382 verify( main )
1383 '''
1384
You Wangb2549812018-07-23 11:56:46 -07001385 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang7ea90582018-07-19 15:27:58 -07001386
1387 def CASE652( self, main ):
1388 """
Jon Hall39570262020-11-17 12:18:19 -08001389 Move a dual-homed host from ports 1A and 1B to ports 2A and 2B
You Wang7ea90582018-07-19 15:27:58 -07001390 Host retains the same MAC and IP address
1391 Test connectivity (expect no failure)
1392 """
1393 import time
1394 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1395 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1396 main.case( "Move a dual-homed host from porst 1A and 1B to ports 2A and 2B with the same MAC and IP" )
1397 setupTest( main, test_idx=652, onosNodes=3 )
1398 main.Cluster.active( 0 ).CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001399 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
You Wang7ea90582018-07-19 15:27:58 -07001400 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1401 verify( main )
1402
You Wang2cb70172018-07-25 16:44:13 -07001403 # Move an untagged IPv4 host
1404 lib.addStaticOnosRoute( main, "10.2.31.0/24", "10.2.30.1" )
1405 lib.startScapyHosts( main, scapyNames=[ 'h4v4Scapy' ], mininetNames=[ 'h4v4' ] )
1406 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.31.1", "h4v4Scapy", "h4v4-bond0" )
You Wang7ea90582018-07-19 15:27:58 -07001407 h4v4cfg = '''{"of:0000000000000002/12" : { "interfaces" : [ { "ips" : [ "10.2.30.254/24" ], "vlan-untagged": 16 } ] },
1408 "of:0000000000000003/14" : { "interfaces" : [ { "ips" : [ "10.2.30.254/24" ], "vlan-untagged": 16 } ] } }'''
1409 lib.moveDualHomedHost( main, "h4v4", "leaf2", "leaf3", "leaf2", "leaf3", "10.2.30.254", prefixLen=24, cfg=h4v4cfg )
1410 hostLocations = { "h4v4": [ "of:0000000000000002/12", "of:0000000000000003/14" ] }
1411 lib.verifyHostLocations( main, hostLocations )
1412 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001413 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.31.1", "h4v4Scapy", "h4v4-bond1" )
You Wang7ea90582018-07-19 15:27:58 -07001414
You Wang2cb70172018-07-25 16:44:13 -07001415 # Move an untagged IPv6 host
1416 lib.addStaticOnosRoute( main, "1003::400/120", "1003::3fe" )
1417 lib.startScapyHosts( main, scapyNames=[ 'h4v6Scapy' ], mininetNames=[ 'h4v6' ] )
1418 lib.verifyTraffic( main, main.internalIpv6Hosts, "1003::4fe", "h4v6Scapy", "h4v6-bond0", ipv6=True )
You Wang7ea90582018-07-19 15:27:58 -07001419 h4v6cfg = '''{"of:0000000000000002/13" : { "interfaces" : [ { "ips" : [ "1003::3ff/120" ], "vlan-untagged": 24 } ] },
1420 "of:0000000000000003/15" : { "interfaces" : [ { "ips" : [ "1003::3ff/120" ], "vlan-untagged": 24 } ] } }'''
1421 lib.moveDualHomedHost( main, "h4v6", "leaf2", "leaf3", "leaf2", "leaf3", "1003::3fe", prefixLen=128, cfg=h4v6cfg, ipv6=True )
1422 hostLocations = { "h4v6": [ "of:0000000000000002/13", "of:0000000000000003/15" ] }
1423 lib.verifyHostLocations( main, hostLocations )
1424 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001425 lib.verifyTraffic( main, main.internalIpv6Hosts, "1003::4fe", "h4v6Scapy", "h4v6-bond1", ipv6=True )
You Wang7ea90582018-07-19 15:27:58 -07001426
You Wang2cb70172018-07-25 16:44:13 -07001427 # Move a tagged IPv4 host
1428 lib.addStaticOnosRoute( main, "10.2.21.0/24", "10.2.20.1" )
1429 lib.startScapyHosts( main, scapyNames=[ 'h5v4Scapy' ], mininetNames=[ 'h5v4' ] )
1430 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.21.1", "h5v4Scapy", "h5v4-bond0" )
You Wang6e5b48e2018-07-23 16:17:38 -07001431 h5v4cfg = '''{"of:0000000000000002/14" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] },
1432 "of:0000000000000003/16" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] } }'''
1433 lib.moveDualHomedHost( main, "h5v4", "leaf2", "leaf3", "leaf2", "leaf3", "10.2.20.254", prefixLen=24, cfg=h5v4cfg, vlan=30 )
1434 hostLocations = { "h5v4": [ "of:0000000000000002/14", "of:0000000000000003/16" ] }
1435 lib.verifyHostLocations( main, hostLocations )
1436 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001437 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.21.1", "h5v4Scapy", "h5v4-bond1" )
You Wang6e5b48e2018-07-23 16:17:38 -07001438
You Wangb2549812018-07-23 11:56:46 -07001439 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang7ea90582018-07-19 15:27:58 -07001440
1441 def CASE653( self, main ):
1442 """
1443 Move a dual-homed host from porst 1A and 1B to ports 2A and 2B
1444 Host retains the same IP but MAC address changes
1445 Test connectivity (expect no failure)
1446 """
1447 import time
1448 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1449 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1450 main.case( "Move a dual-homed host from porst 1A and 1B to ports 2A and 2B with the same IP and different MAC" )
1451 setupTest( main, test_idx=653, onosNodes=3 )
1452 main.Cluster.active( 0 ).CLI.balanceMasters()
Jon Hall43060f62020-06-23 13:13:33 -07001453 main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
You Wang7ea90582018-07-19 15:27:58 -07001454 time.sleep( float( main.params[ 'timers' ][ 'balanceMasterSleep' ] ) )
1455 verify( main )
1456
You Wang2cb70172018-07-25 16:44:13 -07001457 # Move an untagged IPv4 host
1458 lib.addStaticOnosRoute( main, "10.2.31.0/24", "10.2.30.1" )
1459 lib.startScapyHosts( main, scapyNames=[ 'h4v4Scapy' ], mininetNames=[ 'h4v4' ] )
1460 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.31.1", "h4v4Scapy", "h4v4-bond0" )
You Wang7ea90582018-07-19 15:27:58 -07001461 h4v4cfg = '''{"of:0000000000000002/12" : { "interfaces" : [ { "ips" : [ "10.2.30.254/24" ], "vlan-untagged": 16 } ] },
1462 "of:0000000000000003/14" : { "interfaces" : [ { "ips" : [ "10.2.30.254/24" ], "vlan-untagged": 16 } ] } }'''
1463 lib.moveDualHomedHost( main, "h4v4", "leaf2", "leaf3", "leaf2", "leaf3", "10.2.30.254", macAddr="00:aa:01:00:00:03", prefixLen=24, cfg=h4v4cfg )
1464 hostLocations = { "h4v4": [ "of:0000000000000002/12", "of:0000000000000003/14" ] }
1465 lib.verifyHostLocations( main, hostLocations )
1466 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001467 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.31.1", "h4v4Scapy", "h4v4-bond1" )
You Wang7ea90582018-07-19 15:27:58 -07001468
You Wang2cb70172018-07-25 16:44:13 -07001469 # Move an untagged IPv6 host
1470 lib.addStaticOnosRoute( main, "1003::400/120", "1003::3fe" )
1471 lib.startScapyHosts( main, scapyNames=[ 'h4v6Scapy' ], mininetNames=[ 'h4v6' ] )
1472 lib.verifyTraffic( main, main.internalIpv6Hosts, "1003::4fe", "h4v6Scapy", "h4v6-bond0", ipv6=True )
You Wang7ea90582018-07-19 15:27:58 -07001473 h4v6cfg = '''{"of:0000000000000002/13" : { "interfaces" : [ { "ips" : [ "1003::3ff/120" ], "vlan-untagged": 24 } ] },
1474 "of:0000000000000003/15" : { "interfaces" : [ { "ips" : [ "1003::3ff/120" ], "vlan-untagged": 24 } ] } }'''
1475 lib.moveDualHomedHost( main, "h4v6", "leaf2", "leaf3", "leaf2", "leaf3", "1003::3fe", macAddr="00:bb:01:00:00:03", prefixLen=128, cfg=h4v6cfg, ipv6=True )
1476 hostLocations = { "h4v6": [ "of:0000000000000002/13", "of:0000000000000003/15" ] }
1477 lib.verifyHostLocations( main, hostLocations )
1478 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001479 lib.verifyTraffic( main, main.internalIpv6Hosts, "1003::4fe", "h4v6Scapy", "h4v6-bond1", ipv6=True )
You Wang7ea90582018-07-19 15:27:58 -07001480
You Wang2cb70172018-07-25 16:44:13 -07001481 # Move a tagged IPv4 host
1482 lib.addStaticOnosRoute( main, "10.2.21.0/24", "10.2.20.1" )
1483 lib.startScapyHosts( main, scapyNames=[ 'h5v4Scapy' ], mininetNames=[ 'h5v4' ] )
1484 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.21.1", "h5v4Scapy", "h5v4-bond0" )
You Wang6e5b48e2018-07-23 16:17:38 -07001485 h5v4cfg = '''{"of:0000000000000002/14" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] },
1486 "of:0000000000000003/16" : { "interfaces" : [ { "ips" : [ "10.2.20.254/24" ], "vlan-tagged": [30] } ] } }'''
1487 lib.moveDualHomedHost( main, "h5v4", "leaf2", "leaf3", "leaf2", "leaf3", "10.2.20.254", macAddr="00:aa:01:00:00:04", prefixLen=24, cfg=h5v4cfg, vlan=30 )
1488 hostLocations = { "h5v4": [ "of:0000000000000002/14", "of:0000000000000003/16" ] }
1489 lib.verifyHostLocations( main, hostLocations )
1490 verify( main )
You Wang2cb70172018-07-25 16:44:13 -07001491 lib.verifyTraffic( main, main.internalIpv4Hosts, "10.2.21.1", "h5v4Scapy", "h5v4-bond1" )
You Wang6e5b48e2018-07-23 16:17:38 -07001492
You Wangb2549812018-07-23 11:56:46 -07001493 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
You Wang0f745de2018-07-27 15:49:22 -07001494
1495 def CASE660( self, main ):
1496 """
1497 External router failure
1498 - Bring down quagga external router-1. Hosts that are behind router-2 should still be reachable. Hosts that are behind router-1 should not be reachable.
1499 - Bring router up again, all external hosts are reachable again.
1500 - Repeat this with external router-2.
1501 """
1502 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1503 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1504 main.case( "External router failure with cross-link" )
1505 setupTest( main, test_idx=660, onosNodes=3, static=True )
1506 main.externalIpv4Hosts += main.staticIpv4Hosts
1507 main.externalIpv6Hosts += main.staticIpv6Hosts
1508 verify( main, disconnected=False )
1509 # Bring down/up external router-1
1510 verifyRouterFailure( main, "r1", [ "rh5v4" ], [ "rh11v6", "rh5v6" ] )
1511 # Bring down/up external router-2
1512 verifyRouterFailure( main, "r2", [], [ "rh22v6" ] )
1513 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1514
1515 def CASE661( self, main ):
1516 """
1517 External router link failure
1518 - Drop a non-cross-link for external router-1. All external hosts should be reachable (via cross-link).
1519 - Bring up the link. All external hosts should be reachable.
1520 - Repeat the steps above with the cross-link of external router-1
1521 - Repeat all steps above with external router-2
1522 """
1523 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1524 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1525 main.case( "External router link failure with cross-link" )
1526 setupTest( main, test_idx=661, onosNodes=3, static=True )
1527 main.externalIpv4Hosts += main.staticIpv4Hosts
1528 main.externalIpv6Hosts += main.staticIpv6Hosts
1529 verify( main, disconnected=False )
1530 # Bring down/up a non-cross-link for external router-1
1531 portsToDisable = [ [ "of:0000000000000005", 13 ] ]
1532 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1533 verify( main, disconnected=False, internal=False )
1534 lib.enablePortBatch( main, portsToDisable, 10, 48 )
1535 verify( main, disconnected=False, internal=False )
1536 # Bring down/up a cross-link for external router-1
1537 portsToDisable = [ [ "of:0000000000000005", 14 ] ]
1538 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1539 verify( main, disconnected=False, internal=False )
1540 lib.enablePortBatch( main, portsToDisable, 10, 48 )
1541 verify( main, disconnected=False, internal=False )
1542 # Bring down/up a non-cross-link for external router-2
1543 portsToDisable = [ [ "of:0000000000000004", 14 ] ]
1544 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1545 verify( main, disconnected=False, internal=False )
1546 lib.enablePortBatch( main, portsToDisable, 10, 48 )
1547 verify( main, disconnected=False, internal=False )
1548 # Bring down/up a cross-link for external router-2
1549 portsToDisable = [ [ "of:0000000000000004", 13 ] ]
1550 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1551 verify( main, disconnected=False, internal=False )
1552 lib.enablePortBatch( main, portsToDisable, 10, 48 )
1553 verify( main, disconnected=False, internal=False )
1554 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1555
1556 def CASE662( self, main ):
1557 """
1558 Internal router failure
1559 - Bring down quagga internal router-1. All external hosts should be reachable (via cross-link).
1560 - Bring the router up. All external hosts should be reachable.
1561 - Repeat this with internal router-2.
1562 """
1563 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1564 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1565 main.case( "Internal router failure with cross-link" )
1566 setupTest( main, test_idx=662, onosNodes=3, static=True )
1567 main.externalIpv4Hosts += main.staticIpv4Hosts
1568 main.externalIpv6Hosts += main.staticIpv6Hosts
1569 verify( main, disconnected=False )
1570 # Bring down/up internal router-1
1571 verifyRouterFailure( main, "bgp1" )
1572 # Bring down/up internal router-2
1573 verifyRouterFailure( main, "bgp2" )
1574 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1575
1576 def CASE663( self, main ):
1577 """
1578 External router failure without cross-link
1579 - Drop the cross-link for both external routers. All external hosts should be reachable.
1580 - Bring down quagga external router-1. Hosts that are behind router-2 should still be reachable. Hosts that are behind router-1 should not be reachable.
1581 - Bring router up again, all external hosts are reachable again.
1582 - Repeat this with external router-2.
1583 """
1584 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1585 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1586 main.case( "External router failure without cross-link" )
1587 setupTest( main, test_idx=663, onosNodes=3, static=True )
1588 main.externalIpv4Hosts += main.staticIpv4Hosts
1589 main.externalIpv6Hosts += main.staticIpv6Hosts
1590 verify( main, disconnected=False )
1591 # Drop the cross-link
1592 portsToDisable = [ [ "of:0000000000000004", 13 ], [ "of:0000000000000005", 14 ] ]
1593 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1594 verify( main, disconnected=False, internal=False )
1595 # Bring down/up external router-1
1596 verifyRouterFailure( main, "r1", [ "rh5v4" ], [ "rh11v6", "rh5v6" ] )
1597 # Bring down/up external router-2
1598 verifyRouterFailure( main, "r2", [], [ "rh22v6" ] )
1599 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1600
1601 def CASE664( self, main ):
1602 """
1603 External router link failure without cross-link
1604 - Drop the cross-link for both external routers. All external hosts should be reachable.
1605 - Drop an extra link for external router-1. Only hosts connected to router-2 should be reachable.
1606 - Bring up single link for external router-1. All external hosts should be reachable.
1607 - Repeat the two steps above with external router-2
1608 """
1609 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1610 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1611 main.case( "External router link failure without cross-link" )
1612 setupTest( main, test_idx=664, onosNodes=3, static=True )
1613 main.externalIpv4Hosts += main.staticIpv4Hosts
1614 main.externalIpv6Hosts += main.staticIpv6Hosts
1615 verify( main, disconnected=False )
1616 # Drop the cross-link
1617 portsToDisable = [ [ "of:0000000000000004", 13 ], [ "of:0000000000000005", 14 ] ]
1618 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1619 verify( main, disconnected=False, internal=False )
1620 # Bring down/up a non-cross-link for external router-1
1621 portsToDisable = [ [ "of:0000000000000005", 13 ] ]
1622 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1623 main.disconnectedExternalIpv4Hosts = [ 'rh5v4' ]
1624 main.disconnectedExternalIpv6Hosts = [ "rh11v6", "rh5v6" ]
1625 verify( main, internal=False )
1626 lib.enablePortBatch( main, portsToDisable, 10, 48 )
1627 main.disconnectedExternalIpv4Hosts = []
1628 main.disconnectedExternalIpv6Hosts = []
1629 verify( main, disconnected=False, internal=False )
1630 # Bring down/up a non-cross-link for external router-2
1631 portsToDisable = [ [ "of:0000000000000004", 14 ] ]
1632 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1633 main.disconnectedExternalIpv6Hosts = [ "rh22v6" ]
1634 verify( main, internal=False )
1635 lib.enablePortBatch( main, portsToDisable, 10, 48 )
1636 main.disconnectedExternalIpv6Hosts = []
1637 verify( main, disconnected=False, internal=False )
1638 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
1639
1640 def CASE665( self, main ):
1641 """
1642 Internal router failure without cross-link
1643 - Drop the cross-link for both external routers. All external hosts should be reachable.
1644 - Bring down quagga internal router-1. Hosts that are behind router-2 should still be reachable. Hosts that are behind router-1 should not be reachable.
1645 - Bring router up again, all external hosts are reachable again.
1646 - Repeat this with internal router-2.
1647 """
1648 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1649 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1650 main.case( "Internal router failure without cross-link" )
1651 setupTest( main, test_idx=665, onosNodes=3, static=True )
1652 main.externalIpv4Hosts += main.staticIpv4Hosts
1653 main.externalIpv6Hosts += main.staticIpv6Hosts
1654 verify( main, disconnected=False )
1655 # Drop the cross-link
1656 portsToDisable = [ [ "of:0000000000000004", 13 ], [ "of:0000000000000005", 14 ] ]
1657 lib.disablePortBatch( main, portsToDisable, 10, 48 )
1658 verify( main, disconnected=False, internal=False )
1659 # Bring down/up internal router-1
1660 verifyRouterFailure( main, "bgp1", [], [ "rh22v6" ] )
1661 # Bring down/up internal router-2
1662 verifyRouterFailure( main, "bgp2", [ "rh5v4" ], [ "rh11v6", "rh5v6" ] )
1663 lib.cleanup( main, copyKarafLog=False, removeHostComponent=True )
Siddesh713c4c52022-01-14 22:08:05 +00001664
1665 def CASE701( self, main ):
1666 """
1667 Add and remove a blackhole route
1668 - Set up an imaginary subnet reachable via a next hop host using a static route
1669 - Ping from any host to an imaginary IP in this subnet
1670 - Setup a subset of the imaginary subnet that we want to blackhole (add a blackhole route)
1671 - Try to Ping from the host again, but it should fail
1672 - Revert the subset (remove the blackhole IP)
1673 - Try to Ping again, this time it should work
1674 """
1675 from tests.USECASE.SegmentRouting.SRRouting.dependencies.SRRoutingTest import *
1676 from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
1677 main.case( "Add and remove a blackhole-route" )
1678 setupTest( main, test_idx=701, onosNodes=3, ipv6=False, external=False )
1679 verify( main, ipv6=False, external=False, disconnected=False )
1680
1681 dstIp = "50.0.1.1"
1682 baseIP = "50.0.0.0"
1683 blackholeIp = "50.0.0.1"
1684 blackholeIpRoute = "%s/24" % blackholeIp
1685 route = "%s/16" % baseIP
1686 blackholeRoute = "%s/24" % baseIP
Tseng, Yib0370162022-05-24 16:12:29 -07001687 srcComponent = getattr( main, 'Host2' )
1688 nextHopComponent = getattr( main, 'Host1' ) # add dstIP to the params file
Siddesh713c4c52022-01-14 22:08:05 +00001689 nextHopIface = nextHopComponent.interfaces[0].get( 'name' )
1690 nextHopIp = nextHopComponent.getIPAddress( iface=nextHopIface )
1691 srcComponentIface = srcComponent.interfaces[0].get( 'name' )
1692 srcComponentIP = srcComponent.getIPAddress( iface=srcComponentIface )
1693 fabricInterfaceIP = lib.getFabricIntfIp( main, srcComponentIP )
1694 main.step( "Adding a static route in onos")
1695 """
1696 Try this on the host:
1697 ip route add 50.0.0.0/16 via <fabric interface ip>
1698 and this in ONOS:
1699 route-add 50.0.0.0/16 via <nextHopComponent fabric ip>
1700 """
1701 routeResult=main.Cluster.active( 0 ).routeAdd( route, nextHopIp )
1702 main.log.debug(routeResult)
1703 utilities.assert_not_equals( expect=None, actual=routeResult,
1704 onpass="Route added in onos",
1705 onfail="Failed to add route in onos" )
1706 main.log.debug( main.Cluster.active( 0 ).routes() )
1707 nextHopComponent.startScapy( ifaceName=nextHopIface )
1708
1709 main.step( "Adding a static route in the host" )
1710 routeResult=srcComponent.addRouteToHost( route, fabricInterfaceIP )
1711 utilities.assert_equals( expect=main.TRUE, actual=routeResult,
1712 onpass="Route added in the host",
1713 onfail="Failed to add route in the host" )
Tseng, Yib0370162022-05-24 16:12:29 -07001714 main.log.debug( main.Host2.getRoutes() )
Siddesh713c4c52022-01-14 22:08:05 +00001715
1716 main.step("Capturing ping to dstIP after adding the static routes")
1717 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + dstIp )
1718 srcComponent.ping( dstIp )
1719 packetFound=nextHopComponent.checkFilter()
1720 if packetFound is main.FALSE:
1721 main.log.debug( nextHopComponent.killFilter() )
1722 utilities.assert_equals( expect=main.TRUE, actual=packetFound,
1723 onpass="Packet has reached dstIP",
1724 onfail="Failed to reach dstIP" )
1725 main.log.debug( nextHopComponent.readPackets() )
1726
1727 main.step("Capturing ping to blackholeIP after adding the static routes")
1728 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + blackholeIp )
1729 srcComponent.ping( blackholeIp )
1730 packetFound=nextHopComponent.checkFilter()
1731 if packetFound is main.FALSE:
1732 main.log.debug( nextHopComponent.killFilter() )
1733 utilities.assert_equals( expect=main.TRUE, actual=packetFound,
1734 onpass="Packet has reached blackholeIP",
1735 onfail="Failed to reach blackholeIP" )
1736 main.log.debug( nextHopComponent.readPackets() )
1737
1738 main.step( "Adding a blackhole route")
1739 blackholeRouteResult=main.Cluster.active( 0 ).blackholeStaticRoute( subnet=blackholeRoute, addBlackhole=True )
1740 utilities.assert_equals( expect=main.TRUE, actual=blackholeRouteResult,
1741 onpass="Blackhole route added",
1742 onfail="Failed to add blackhole route" )
1743
1744 main.step("Capturing ping to blackholeIP after adding the blackhole route")
1745 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + blackholeIp )
1746 srcComponent.ping( blackholeIp )
1747 blackholePacket=nextHopComponent.checkFilter()
1748 if blackholePacket is main.FALSE:
1749 main.log.debug( nextHopComponent.killFilter() )
1750 utilities.assert_equals( expect=main.FALSE, actual=blackholePacket,
1751 onpass="Packet has not reached blackholeIP",
1752 onfail="Packet has reached blackholeIP" )
1753
1754 main.step("Capturing ping to dstIP after adding the blackhole route")
1755 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + dstIp )
1756 srcComponent.ping( dstIp )
1757 packetFound=nextHopComponent.checkFilter()
1758 if packetFound is main.FALSE:
1759 main.log.debug( nextHopComponent.killFilter() )
1760 utilities.assert_equals( expect=main.TRUE, actual=packetFound,
1761 onpass="Packet has reached dstIP",
1762 onfail="Failed to reach dstIP" )
1763 main.log.debug( nextHopComponent.readPackets() )
1764
1765 main.step( "Removing the blackhole route" )
1766 blackholeList = main.Cluster.active( 0 ).blackholeStaticRoute( subnet=blackholeRoute, addBlackhole=False)
1767 utilities.assert_equals( expect=main.TRUE, actual=blackholeList,
1768 onpass="Blackhole route has been removed",
1769 onfail="Failed to remove the blackhole route" )
1770
1771 main.step("Capturing ping to dstIP after removing the blackhole route")
1772 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + dstIp )
1773 srcComponent.ping( dstIp )
1774 packetFound=nextHopComponent.checkFilter()
1775 if packetFound is main.FALSE:
1776 main.log.debug( nextHopComponent.killFilter() )
1777 utilities.assert_equals( expect=main.TRUE, actual=packetFound,
1778 onpass="Packet has reached dstIP",
1779 onfail="Failed to reach dstIP" )
1780
1781 main.step("Capturing ping to blackholeIP after removing the blackhole route")
1782 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + blackholeIp )
1783 srcComponent.ping( blackholeIp )
1784 packetFound=nextHopComponent.checkFilter()
1785 if packetFound is main.FALSE:
1786 main.log.debug( nextHopComponent.killFilter() )
1787 utilities.assert_equals( expect=main.TRUE, actual=packetFound,
1788 onpass="Packet has reached blackholeIP",
1789 onfail="Packet failed to reach blackholeIP" )
1790 main.log.debug( nextHopComponent.checkFilter() )
1791
1792 main.log.debug( nextHopComponent.readPackets() )
1793 main.step("Checking if the route is present in the host")
1794 routeRemoved = srcComponent.deleteRoute( route, fabricInterfaceIP )
1795 utilities.assert_equals( expect=main.TRUE, actual=routeRemoved,
1796 onpass="Route is not present in the host",
1797 onfail="Route is still present in the host" )
1798
1799 main.step( "Checking if the route is removed from onos" )
1800 routeRemoved = main.Cluster.active( 0 ).routeRemove( route, nextHopIp )
1801 utilities.assert_not_equals( expect=None, actual=routeRemoved,
1802 onpass="Route removed from onos",
1803 onfail="Failed to remove route from onos" )
1804
1805 main.step("Capturing ping to dstIP after removing the static route")
1806 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + dstIp )
1807 srcComponent.ping( dstIp )
1808 packetFound=nextHopComponent.checkFilter()
1809 if packetFound is main.FALSE:
1810 main.log.debug( nextHopComponent.killFilter() )
1811 utilities.assert_equals( expect=main.FALSE, actual=packetFound,
1812 onpass="Packet has failed to reach dstIP",
1813 onfail="Packet has reached dstIP" )
1814 main.log.debug( nextHopComponent.readPackets() )
1815
1816 main.step("Capturing ping to blackholeIP after removing the static route")
1817 nextHopComponent.startFilter( ifaceName=nextHopIface, sniffCount=1, pktFilter="icmp and host " + blackholeIp )
1818 srcComponent.ping( blackholeIp )
1819 packetFound=nextHopComponent.checkFilter()
1820 if packetFound is main.FALSE:
1821 main.log.debug( nextHopComponent.killFilter() )
1822 utilities.assert_equals( expect=main.FALSE, actual=packetFound,
1823 onpass="Packet has failed to reach blackholeIP",
1824 onfail="Packet reached blackholeIP" )
1825 main.log.debug( nextHopComponent.checkFilter() )