]>
Commit | Line | Data |
---|---|---|
c9b5d52c | 1 | #!/usr/bin/env python |
2 | ||
3 | # | |
4 | # Copyright (c) 2020 by VMware, Inc. ("VMware") | |
5 | # Used Copyright (c) 2018 by Network Device Education Foundation, | |
6 | # Inc. ("NetDEF") in this file. | |
7 | # | |
8 | # Permission to use, copy, modify, and/or distribute this software | |
9 | # for any purpose with or without fee is hereby granted, provided | |
10 | # that the above copyright notice and this permission notice appear | |
11 | # in all copies. | |
12 | # | |
13 | # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES | |
14 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
15 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR | |
16 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY | |
17 | # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
18 | # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
19 | # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |
20 | # OF THIS SOFTWARE. | |
21 | # | |
22 | ||
23 | """ | |
24 | Following tests are covered to test multicast pim sm: | |
25 | ||
26 | Test steps | |
27 | - Create topology (setup module) | |
28 | - Bring up topology | |
29 | ||
30 | Following tests are covered: | |
31 | ||
32 | 1. verify oil when join prune sent scenario_1 p0 | |
33 | 2. verify oil when join prune sent scenario_2 p0 | |
34 | 3. shut noshut source interface when upstream cleared from LHR p0( | |
35 | 4. shut noshut receiver interface when upstream cleared from LHR p0( | |
36 | 5. verify igmp clis p0 | |
37 | 6. verify igmp cli generate query once p0 | |
38 | 7. verify remove add igmp config to receiver interface p0 | |
39 | 8. verify remove add igmp commands when pim configured p0 | |
40 | 9. verify remove add pim commands when igmp configured p0 | |
41 | 10. pim dr priority p0 | |
42 | 11. pim hello timer p0 | |
43 | 12. Verify mroute after removing RP sending IGMP prune p2 | |
44 | 13. Verify prune is sent to LHR and FHR when PIM nbr went down | |
45 | 14. Verify mroute flag in LHR and FHR node | |
46 | 15. Verify IGMP prune processed correctly when same join received from IGMP and PIM | |
47 | 16. Verify multicast traffic flowing fine, when LHR connected to RP | |
48 | 17. Verify multicast traffic is flowing fine when FHR is connected to RP | |
49 | """ | |
50 | ||
51 | import os | |
52 | import re | |
53 | import sys | |
c9b5d52c | 54 | import time |
55 | import datetime | |
56 | import pytest | |
57 | ||
7ed8fcff DS |
58 | pytestmark = pytest.mark.pimd |
59 | ||
c9b5d52c | 60 | # Save the Current Working Directory to find configuration files. |
61 | CWD = os.path.dirname(os.path.realpath(__file__)) | |
62 | sys.path.append(os.path.join(CWD, "../")) | |
63 | sys.path.append(os.path.join(CWD, "../lib/")) | |
64 | ||
65 | # Required to instantiate the topology builder class. | |
66 | ||
67 | # pylint: disable=C0413 | |
68 | # Import topogen and topotest helpers | |
69 | from lib.topogen import Topogen, get_topogen | |
c9b5d52c | 70 | |
71 | from lib.common_config import ( | |
72 | start_topology, | |
73 | write_test_header, | |
74 | write_test_footer, | |
75 | step, | |
c9b5d52c | 76 | reset_config_on_routers, |
c9b5d52c | 77 | shutdown_bringup_interface, |
c9b5d52c | 78 | apply_raw_config, |
c9b5d52c | 79 | check_router_status, |
80 | required_linux_kernel_version, | |
81 | topo_daemons, | |
82 | ) | |
83 | from lib.pim import ( | |
84 | create_pim_config, | |
85 | create_igmp_config, | |
86 | verify_igmp_groups, | |
4fafd29f KK |
87 | verify_mroutes, |
88 | clear_mroute, | |
89 | clear_pim_interface_traffic, | |
c9b5d52c | 90 | verify_igmp_config, |
c9b5d52c | 91 | verify_pim_config, |
92 | verify_pim_interface, | |
93 | verify_upstream_iif, | |
94 | verify_multicast_traffic, | |
95 | verify_pim_rp_info, | |
c9b5d52c | 96 | verify_multicast_flag_state, |
1973df1d | 97 | McastTesterHelper, |
c9b5d52c | 98 | ) |
99 | from lib.topolog import logger | |
4953ca97 | 100 | from lib.topojson import build_config_from_json |
c9b5d52c | 101 | |
e82b531d CH |
102 | CWD = os.path.dirname(os.path.realpath(__file__)) |
103 | pytestmark = pytest.mark.pimd | |
c9b5d52c | 104 | |
105 | TOPOLOGY = """ | |
106 | ||
107 | i4-----c1-------------c2---i5 | |
108 | | | | |
109 | | | | |
110 | i1-----l1------r2-----f1---i2 | |
111 | | | | | | |
112 | | | | | | |
113 | i7 i6 i3 i8 | |
114 | ||
115 | Description: | |
116 | i1, i2, i3. i4, i5, i6, i7, i8 - FRR running iperf to send IGMP | |
117 | join and traffic | |
118 | l1 - LHR | |
119 | f1 - FHR | |
120 | r2 - FRR router | |
121 | c1 - FRR router | |
122 | c2 - FRR router | |
123 | """ | |
124 | ||
125 | # Global variables | |
126 | VLAN_1 = 2501 | |
127 | GROUP_RANGE = "225.0.0.0/8" | |
128 | IGMP_GROUP = "225.1.1.1/32" | |
129 | IGMP_JOIN = "225.1.1.1" | |
130 | VLAN_INTF_ADRESS_1 = "10.0.8.3/24" | |
131 | GROUP_RANGE_1 = [ | |
132 | "225.1.1.1/32", | |
133 | "225.1.1.2/32", | |
134 | "225.1.1.3/32", | |
135 | "225.1.1.4/32", | |
136 | "225.1.1.5/32", | |
137 | ] | |
138 | IGMP_JOIN_RANGE_1 = ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"] | |
139 | GROUP_RANGE_2 = [ | |
140 | "226.1.1.1/32", | |
141 | "226.1.1.2/32", | |
142 | "226.1.1.3/32", | |
143 | "226.1.1.4/32", | |
144 | "226.1.1.5/32", | |
145 | ] | |
146 | IGMP_JOIN_RANGE_2 = ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"] | |
147 | GROUP_RANGE_3 = [ | |
148 | "227.1.1.1/32", | |
149 | "227.1.1.2/32", | |
150 | "227.1.1.3/32", | |
151 | "227.1.1.4/32", | |
152 | "227.1.1.5/32", | |
153 | ] | |
154 | IGMP_JOIN_RANGE_3 = ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"] | |
155 | ||
156 | SAME_VLAN_IP_1 = {"ip": "10.1.1.1", "subnet": "255.255.255.0", "cidr": "24"} | |
157 | SAME_VLAN_IP_2 = {"ip": "10.1.1.2", "subnet": "255.255.255.0", "cidr": "24"} | |
158 | SAME_VLAN_IP_3 = {"ip": "10.1.1.3", "subnet": "255.255.255.0", "cidr": "24"} | |
159 | SAME_VLAN_IP_4 = {"ip": "10.1.1.4", "subnet": "255.255.255.0", "cidr": "24"} | |
c9b5d52c | 160 | |
161 | ||
c9b5d52c | 162 | def setup_module(mod): |
163 | """ | |
164 | Sets up the pytest environment | |
165 | ||
166 | * `mod`: module name | |
167 | """ | |
168 | ||
169 | # Required linux kernel version for this suite to run. | |
170 | result = required_linux_kernel_version("4.19") | |
171 | if result is not True: | |
172 | pytest.skip("Kernel requirements are not met") | |
173 | ||
174 | testsuite_run_time = time.asctime(time.localtime(time.time())) | |
175 | logger.info("Testsuite start time: {}".format(testsuite_run_time)) | |
176 | logger.info("=" * 40) | |
177 | logger.info("Master Topology: \n {}".format(TOPOLOGY)) | |
178 | ||
179 | logger.info("Running setup_module to create topology") | |
180 | ||
e82b531d CH |
181 | json_file = "{}/multicast_pim_sm_topo3.json".format(CWD) |
182 | tgen = Topogen(json_file, mod.__name__) | |
183 | global topo | |
184 | topo = tgen.json_topo | |
c9b5d52c | 185 | # ... and here it calls Mininet initialization functions. |
186 | ||
187 | # get list of daemons needs to be started for this suite. | |
188 | daemons = topo_daemons(tgen, topo) | |
189 | ||
190 | # Starting topology, create tmp files which are loaded to routers | |
d60a3f0e | 191 | # to start daemons and then start routers |
c9b5d52c | 192 | start_topology(tgen, daemons) |
193 | ||
194 | # Don"t run this test if we have any failure. | |
195 | if tgen.routers_have_failure(): | |
196 | pytest.skip(tgen.errors) | |
197 | ||
198 | # Creating configuration from JSON | |
199 | build_config_from_json(tgen, topo) | |
200 | ||
1973df1d CH |
201 | # XXX Replace this using "with McastTesterHelper()... " in each test if possible. |
202 | global app_helper | |
203 | app_helper = McastTesterHelper(tgen) | |
204 | ||
c9b5d52c | 205 | logger.info("Running setup_module() done") |
206 | ||
207 | ||
208 | def teardown_module(): | |
209 | """Teardown the pytest environment""" | |
210 | ||
211 | logger.info("Running teardown_module to delete topology") | |
212 | ||
213 | tgen = get_topogen() | |
214 | ||
1973df1d | 215 | app_helper.cleanup() |
8db751b8 | 216 | |
c9b5d52c | 217 | # Stop toplogy and Remove tmp files |
218 | tgen.stop_topology() | |
219 | ||
220 | logger.info( | |
221 | "Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) | |
222 | ) | |
223 | logger.info("=" * 40) | |
224 | ||
225 | ||
226 | ##################################################### | |
227 | # | |
228 | # Testcases | |
229 | # | |
230 | ##################################################### | |
231 | ||
232 | ||
c9b5d52c | 233 | def verify_mroute_repopulated(uptime_before, uptime_after): |
234 | """ | |
235 | API to compare uptime for mroutes | |
236 | ||
237 | Parameters | |
238 | ---------- | |
239 | * `uptime_before` : Uptime dictionary for any particular instance | |
240 | * `uptime_after` : Uptime dictionary for any particular instance | |
241 | """ | |
242 | ||
243 | for group in uptime_before.keys(): | |
244 | for source in uptime_before[group].keys(): | |
245 | if set(uptime_before[group]) != set(uptime_after[group]): | |
246 | errormsg = ( | |
247 | "mroute (%s, %s) has not come" | |
248 | " up after mroute clear [FAILED!!]" % (source, group) | |
249 | ) | |
250 | return errormsg | |
251 | ||
252 | d1 = datetime.datetime.strptime(uptime_before[group][source], "%H:%M:%S") | |
253 | d2 = datetime.datetime.strptime(uptime_after[group][source], "%H:%M:%S") | |
254 | if d2 >= d1: | |
255 | errormsg = "mroute (%s, %s) is not " "repopulated [FAILED!!]" % ( | |
256 | source, | |
257 | group, | |
258 | ) | |
259 | return errormsg | |
260 | ||
261 | logger.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source, group) | |
262 | ||
263 | return True | |
264 | ||
265 | ||
266 | def verify_state_incremented(state_before, state_after): | |
267 | """ | |
268 | API to compare interface traffic state incrementing | |
269 | ||
270 | Parameters | |
271 | ---------- | |
272 | * `state_before` : State dictionary for any particular instance | |
273 | * `state_after` : State dictionary for any particular instance | |
274 | """ | |
275 | ||
8db751b8 CH |
276 | for ttype, v1 in state_before.items(): |
277 | for intf, v2 in v1.items(): | |
278 | for state, value in v2.items(): | |
279 | if value >= state_after[ttype][intf][state]: | |
a53c08bc CH |
280 | errormsg = "[DUT: %s]: state %s value has not incremented, Initial value: %s, Current value: %s [FAILED!!]" % ( |
281 | intf, | |
282 | state, | |
283 | value, | |
284 | state_after[ttype][intf][state], | |
c9b5d52c | 285 | ) |
8db751b8 CH |
286 | return errormsg |
287 | ||
288 | logger.info( | |
289 | "[DUT: %s]: State %s value is incremented, Initial value: %s, Current value: %s [PASSED!!]", | |
290 | intf, | |
291 | state, | |
292 | value, | |
293 | state_after[ttype][intf][state], | |
c9b5d52c | 294 | ) |
c9b5d52c | 295 | |
296 | return True | |
297 | ||
298 | ||
299 | def find_v2_query_msg_in_tcpdump(tgen, router, message, count, cap_file): | |
300 | """ | |
301 | Find v2 query messages in tcpdump file | |
302 | ||
303 | Parameters | |
304 | ---------- | |
305 | * `tgen` : Topology handler | |
306 | * `router` : Device under test | |
307 | * `cap_file` : tcp dump file name | |
308 | ||
309 | """ | |
310 | ||
8db751b8 | 311 | filepath = os.path.join(tgen.logdir, router, cap_file) |
c9b5d52c | 312 | with open(filepath) as f: |
313 | if len(re.findall("{}".format(message), f.read())) < count: | |
314 | errormsg = "[DUT: %s]: Verify Message: %s in tcpdump" " [FAILED!!]" % ( | |
315 | router, | |
316 | message, | |
317 | ) | |
318 | return errormsg | |
319 | ||
320 | logger.info( | |
321 | "[DUT: %s]: Found message: %s in tcpdump " " count: %s [PASSED!!]", | |
322 | router, | |
323 | message, | |
324 | count, | |
325 | ) | |
326 | return True | |
327 | ||
328 | ||
329 | def find_tos_in_tcpdump(tgen, router, message, cap_file): | |
330 | """ | |
331 | Find v2 query messages in tcpdump file | |
332 | ||
333 | Parameters | |
334 | ---------- | |
335 | * `tgen` : Topology handler | |
336 | * `router` : Device under test | |
337 | * `cap_file` : tcp dump file name | |
338 | ||
339 | """ | |
340 | ||
8db751b8 | 341 | filepath = os.path.join(tgen.logdir, router, cap_file) |
c9b5d52c | 342 | with open(filepath) as f: |
343 | ||
344 | if len(re.findall(message, f.read())) < 1: | |
345 | errormsg = "[DUT: %s]: Verify Message: %s in tcpdump" " [FAILED!!]" % ( | |
346 | router, | |
347 | message, | |
348 | ) | |
349 | return errormsg | |
350 | ||
351 | logger.info( | |
352 | "[DUT: %s]: Found message: %s in tcpdump " "[PASSED!!]", router, message | |
353 | ) | |
354 | return True | |
355 | ||
356 | ||
357 | def test_verify_oil_when_join_prune_sent_scenario_1_p1(request): | |
358 | """ | |
359 | TC_21_1: | |
360 | Verify OIL detail updated in (S,G) and (*,G) mroute when IGMP | |
361 | join/prune is sent | |
362 | """ | |
363 | ||
364 | tgen = get_topogen() | |
365 | tc_name = request.node.name | |
366 | write_test_header(tc_name) | |
367 | ||
8db751b8 CH |
368 | # Don"t run this test if we have any failure. |
369 | if tgen.routers_have_failure(): | |
370 | pytest.skip(tgen.errors) | |
371 | ||
c9b5d52c | 372 | # Creating configuration from JSON |
1973df1d | 373 | app_helper.stop_all_hosts() |
4fafd29f | 374 | clear_mroute(tgen) |
c9b5d52c | 375 | reset_config_on_routers(tgen) |
4fafd29f | 376 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 377 | check_router_status(tgen) |
378 | ||
c9b5d52c | 379 | step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3") |
380 | step( | |
381 | "Enable IGMP of FRR1 interface and send IGMP joins " | |
382 | " from FRR1 node for group range (226.1.1.1-5)" | |
383 | ) | |
384 | step( | |
385 | "Enable IGMP of FRR3 interface and send IGMP joins " | |
386 | " from FRR3 node for group range (226.1.1.1-5)" | |
387 | ) | |
388 | ||
389 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
390 | input_dict = { | |
a53c08bc CH |
391 | "f1": { |
392 | "igmp": { | |
393 | "interfaces": { | |
394 | intf_f1_i8: { | |
395 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
396 | } | |
397 | } | |
398 | } | |
399 | } | |
c9b5d52c | 400 | } |
401 | result = create_igmp_config(tgen, topo, input_dict) | |
402 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
403 | ||
404 | input_join = { | |
405 | "i1": topo["routers"]["i1"]["links"]["l1"]["interface"], | |
406 | "i8": topo["routers"]["i8"]["links"]["f1"]["interface"], | |
407 | } | |
408 | ||
409 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 410 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 411 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
412 | ||
413 | step("Configure static RP for (226.1.1.1-5) in R2") | |
414 | ||
415 | input_dict = { | |
416 | "r2": { | |
417 | "pim": { | |
418 | "rp": [ | |
419 | { | |
420 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
421 | "/" | |
422 | )[0], | |
423 | "group_addr_range": GROUP_RANGE, | |
424 | } | |
425 | ] | |
426 | } | |
427 | } | |
428 | } | |
429 | ||
430 | result = create_pim_config(tgen, topo, input_dict) | |
431 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
432 | ||
433 | step( | |
434 | "Configure one source on FRR3 for all the groups and send" " multicast traffic" | |
435 | ) | |
436 | ||
437 | input_src = {"i2": topo["routers"]["i2"]["links"]["f1"]["interface"]} | |
438 | ||
439 | for src, src_intf in input_src.items(): | |
1973df1d | 440 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 441 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
442 | ||
443 | source_i2 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
444 | input_dict_all = [ | |
445 | { | |
446 | "dut": "l1", | |
447 | "src_address": "*", | |
448 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
449 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
450 | }, | |
451 | { | |
452 | "dut": "l1", | |
453 | "src_address": source_i2, | |
454 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
455 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
456 | }, | |
457 | { | |
458 | "dut": "r2", | |
459 | "src_address": "*", | |
460 | "iif": "lo", | |
461 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
462 | }, | |
463 | { | |
464 | "dut": "r2", | |
465 | "src_address": source_i2, | |
466 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
467 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
468 | }, | |
469 | { | |
470 | "dut": "f1", | |
471 | "src_address": "*", | |
472 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
473 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
474 | }, | |
475 | { | |
476 | "dut": "f1", | |
477 | "src_address": source_i2, | |
478 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
479 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
480 | }, | |
481 | ] | |
482 | ||
483 | step("Verify mroutes and iff upstream") | |
484 | ||
485 | for data in input_dict_all: | |
4fafd29f | 486 | result = verify_mroutes( |
c9b5d52c | 487 | tgen, |
488 | data["dut"], | |
489 | data["src_address"], | |
490 | IGMP_JOIN_RANGE_1, | |
491 | data["iif"], | |
492 | data["oil"], | |
493 | ) | |
494 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
495 | ||
496 | for data in input_dict_all: | |
497 | result = verify_upstream_iif( | |
498 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
499 | ) | |
500 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
501 | ||
502 | step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR1 node") | |
503 | ||
504 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
505 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, False) | |
506 | ||
507 | step( | |
508 | "After receiving the IGMP prune from FRR1 , verify traffic " | |
509 | "immediately stopped for this receiver 'show ip multicast'" | |
510 | ) | |
511 | ||
512 | input_traffic = {"l1": {"traffic_sent": [intf_l1_i1]}} | |
513 | result = verify_multicast_traffic(tgen, input_traffic, expected=False) | |
5980ad0a DS |
514 | assert ( |
515 | result is not True | |
516 | ), "Testcase {} : Failed \n " " Traffic is not stopped yet \n Error: {}".format( | |
517 | tc_name, result | |
c9b5d52c | 518 | ) |
519 | logger.info("Expected Behaviour: {}".format(result)) | |
520 | ||
521 | step( | |
522 | "IGMP groups are remove from FRR1 node 'show ip igmp groups'" | |
523 | " FRR3 IGMP still present" | |
524 | ) | |
525 | ||
526 | dut = "l1" | |
527 | result = verify_igmp_groups( | |
528 | tgen, dut, intf_l1_i1, IGMP_JOIN_RANGE_1, expected=False | |
529 | ) | |
5980ad0a DS |
530 | assert ( |
531 | result is not True | |
532 | ), "Testcase {} : Failed \n " "IGMP groups are not deleted \n Error: {}".format( | |
533 | tc_name, result | |
c9b5d52c | 534 | ) |
535 | logger.info("Expected Behaviour: {}".format(result)) | |
536 | ||
537 | dut = "f1" | |
538 | result = verify_igmp_groups(tgen, dut, intf_f1_i8, IGMP_JOIN_RANGE_1) | |
539 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
540 | ||
541 | step( | |
542 | "(*,G) and (S,G) OIL got removed immediately after receiving" | |
543 | " prune 'show ip pim state' and 'show ip mroute' on FRR1 node," | |
544 | " no impact on FRR3 receiver" | |
545 | ) | |
546 | ||
547 | input_dict_l1 = [ | |
548 | { | |
549 | "dut": "l1", | |
550 | "src_address": "*", | |
551 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
552 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
553 | }, | |
554 | { | |
555 | "dut": "l1", | |
556 | "src_address": source_i2, | |
557 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
558 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
559 | }, | |
560 | ] | |
561 | ||
562 | step("Verify mroutes and iff upstream") | |
563 | ||
564 | for data in input_dict_l1: | |
4fafd29f | 565 | result = verify_mroutes( |
c9b5d52c | 566 | tgen, |
567 | data["dut"], | |
568 | data["src_address"], | |
569 | IGMP_JOIN_RANGE_1, | |
570 | data["iif"], | |
571 | data["oil"], | |
572 | expected=False, | |
573 | ) | |
5980ad0a DS |
574 | assert ( |
575 | result is not True | |
576 | ), "Testcase {} : Failed \n " "mroutes are still present \n Error: {}".format( | |
577 | tc_name, result | |
c9b5d52c | 578 | ) |
579 | logger.info("Expected Behaviour: {}".format(result)) | |
580 | ||
581 | for data in input_dict_l1: | |
582 | result = verify_upstream_iif( | |
583 | tgen, | |
584 | data["dut"], | |
585 | data["iif"], | |
586 | data["src_address"], | |
587 | IGMP_JOIN_RANGE_1, | |
588 | expected=False, | |
589 | ) | |
590 | assert result is not True, ( | |
591 | "Testcase {} : Failed \n " | |
592 | "upstream entries are still present \n Error: {}".format(tc_name, result) | |
593 | ) | |
594 | logger.info("Expected Behaviour: {}".format(result)) | |
595 | ||
596 | input_dict_f1 = [ | |
597 | { | |
598 | "dut": "f1", | |
599 | "src_address": "*", | |
600 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
601 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
602 | }, | |
603 | { | |
604 | "dut": "f1", | |
605 | "src_address": source_i2, | |
606 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
607 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
608 | }, | |
609 | ] | |
610 | ||
611 | step("Verify mroutes and iff upstream") | |
612 | ||
613 | for data in input_dict_f1: | |
4fafd29f | 614 | result = verify_mroutes( |
c9b5d52c | 615 | tgen, |
616 | data["dut"], | |
617 | data["src_address"], | |
618 | IGMP_JOIN_RANGE_1, | |
619 | data["iif"], | |
620 | data["oil"], | |
621 | ) | |
622 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
623 | ||
624 | for data in input_dict_f1: | |
625 | result = verify_upstream_iif( | |
626 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
627 | ) | |
628 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
629 | ||
630 | step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " " FRR3 node") | |
631 | ||
632 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
633 | shutdown_bringup_interface(tgen, "f1", intf_f1_i8, False) | |
634 | ||
635 | step( | |
636 | "After receiving the IGMP prune from FRR3s , verify traffic " | |
637 | "immediately stopped for this receiver 'show ip multicast'" | |
638 | ) | |
639 | ||
640 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
641 | result = verify_multicast_traffic(tgen, input_traffic, expected=False) | |
5980ad0a DS |
642 | assert ( |
643 | result is not True | |
644 | ), "Testcase {} : Failed \n " " Traffic is not stopped yet \n Error: {}".format( | |
645 | tc_name, result | |
c9b5d52c | 646 | ) |
647 | logger.info("Expected Behaviour: {}".format(result)) | |
648 | ||
649 | step( | |
650 | "IGMP groups are remove from FRR1 node 'show ip igmp groups'" | |
651 | " FRR3 IGMP still present" | |
652 | ) | |
653 | ||
654 | dut = "f1" | |
655 | result = verify_igmp_groups( | |
656 | tgen, dut, intf_f1_i8, IGMP_JOIN_RANGE_1, expected=False | |
657 | ) | |
5980ad0a DS |
658 | assert ( |
659 | result is not True | |
660 | ), "Testcase {} : Failed \n " "IGMP groups are not deleted \n Error: {}".format( | |
661 | tc_name, result | |
c9b5d52c | 662 | ) |
663 | logger.info("Expected Behaviour: {}".format(result)) | |
664 | ||
665 | step( | |
666 | "(*,G) and (S,G) OIL got prune state (none) from all the nodes" | |
667 | "FRR1, FRR3 verify using 'show ip mroute'" | |
668 | ) | |
669 | ||
670 | input_dict_l1 = [ | |
671 | { | |
672 | "dut": "l1", | |
673 | "src_address": "*", | |
674 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
675 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
676 | }, | |
677 | { | |
678 | "dut": "l1", | |
679 | "src_address": source_i2, | |
680 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
681 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
682 | }, | |
683 | ] | |
684 | ||
685 | step("Verify mroutes and iff upstream") | |
686 | ||
687 | for data in input_dict_l1: | |
4fafd29f | 688 | result = verify_mroutes( |
c9b5d52c | 689 | tgen, |
690 | data["dut"], | |
691 | data["src_address"], | |
692 | IGMP_JOIN_RANGE_1, | |
693 | data["iif"], | |
694 | data["oil"], | |
695 | expected=False, | |
696 | ) | |
5980ad0a DS |
697 | assert ( |
698 | result is not True | |
699 | ), "Testcase {} : Failed \n " "mroutes are still present \n Error: {}".format( | |
700 | tc_name, result | |
c9b5d52c | 701 | ) |
702 | logger.info("Expected Behaviour: {}".format(result)) | |
703 | ||
704 | for data in input_dict_l1: | |
705 | result = verify_upstream_iif( | |
706 | tgen, | |
707 | data["dut"], | |
708 | data["iif"], | |
709 | data["src_address"], | |
710 | IGMP_JOIN_RANGE_1, | |
711 | expected=False, | |
712 | ) | |
713 | assert result is not True, ( | |
714 | "Testcase {} : Failed \n " | |
715 | "upstream entries are still present \n Error: {}".format(tc_name, result) | |
716 | ) | |
717 | logger.info("Expected Behaviour: {}".format(result)) | |
718 | ||
719 | shutdown_bringup_interface(tgen, "f1", intf_f1_i8, True) | |
720 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, True) | |
721 | ||
722 | for data in input_dict_l1: | |
723 | result = verify_upstream_iif( | |
724 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
725 | ) | |
726 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
727 | ||
728 | write_test_footer(tc_name) | |
729 | ||
730 | ||
731 | def test_verify_oil_when_join_prune_sent_scenario_2_p1(request): | |
732 | """ | |
733 | TC_21_2: Verify OIL detail updated in (S,G) and (*,G) mroute when IGMP | |
734 | join/prune is sent | |
735 | """ | |
736 | ||
737 | tgen = get_topogen() | |
738 | tc_name = request.node.name | |
739 | write_test_header(tc_name) | |
740 | ||
8db751b8 CH |
741 | # Don"t run this test if we have any failure. |
742 | if tgen.routers_have_failure(): | |
743 | pytest.skip(tgen.errors) | |
744 | ||
c9b5d52c | 745 | # Creating configuration from JSON |
1973df1d | 746 | app_helper.stop_all_hosts() |
4fafd29f | 747 | clear_mroute(tgen) |
c9b5d52c | 748 | reset_config_on_routers(tgen) |
4fafd29f | 749 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 750 | check_router_status(tgen) |
751 | ||
c9b5d52c | 752 | step("Removing FRR3 to simulate topo " "FHR(FRR1)---LHR(FRR2)") |
753 | ||
754 | intf_l1_c1 = topo["routers"]["l1"]["links"]["c1"]["interface"] | |
755 | intf_f1_c2 = topo["routers"]["f1"]["links"]["c2"]["interface"] | |
756 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
757 | shutdown_bringup_interface(tgen, "l1", intf_l1_c1, False) | |
758 | shutdown_bringup_interface(tgen, "f1", intf_f1_c2, False) | |
759 | shutdown_bringup_interface(tgen, "f1", intf_f1_r2, False) | |
760 | ||
761 | step("Enable the PIM on all the interfaces of FRR1, FRR2") | |
762 | step( | |
763 | "Enable IGMP of FRR1 interface and send IGMP joins " | |
764 | " from FRR1 node for group range (226.1.1.1-5)" | |
765 | ) | |
766 | step( | |
767 | "Enable IGMP of FRR3 interface and send IGMP joins " | |
768 | " from FRR3 node for group range (226.1.1.1-5)" | |
769 | ) | |
770 | ||
771 | intf_r2_i3 = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
772 | input_dict = { | |
a53c08bc CH |
773 | "r2": { |
774 | "igmp": { | |
775 | "interfaces": { | |
776 | intf_r2_i3: { | |
777 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
778 | } | |
779 | } | |
780 | } | |
781 | } | |
c9b5d52c | 782 | } |
783 | result = create_igmp_config(tgen, topo, input_dict) | |
784 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
785 | ||
786 | input_join = { | |
787 | "i1": topo["routers"]["i1"]["links"]["l1"]["interface"], | |
788 | "i3": topo["routers"]["i3"]["links"]["r2"]["interface"], | |
789 | } | |
790 | ||
791 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 792 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 793 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
794 | ||
795 | step("Configure static RP for (226.1.1.1-5) in R2") | |
796 | ||
797 | input_dict = { | |
798 | "r2": { | |
799 | "pim": { | |
800 | "rp": [ | |
801 | { | |
802 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
803 | "/" | |
804 | )[0], | |
805 | "group_addr_range": GROUP_RANGE, | |
806 | } | |
807 | ] | |
808 | } | |
809 | } | |
810 | } | |
811 | ||
812 | result = create_pim_config(tgen, topo, input_dict) | |
813 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
814 | input_dict_all = [ | |
815 | { | |
816 | "dut": "l1", | |
817 | "src_address": "*", | |
818 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
819 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
820 | }, | |
821 | { | |
822 | "dut": "r2", | |
823 | "src_address": "*", | |
824 | "iif": "lo", | |
825 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
826 | }, | |
827 | { | |
828 | "dut": "r2", | |
829 | "src_address": "*", | |
830 | "iif": "lo", | |
831 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
832 | }, | |
833 | ] | |
834 | ||
835 | step("Verify mroutes and iff upstream") | |
836 | ||
837 | for data in input_dict_all: | |
4fafd29f | 838 | result = verify_mroutes( |
c9b5d52c | 839 | tgen, |
840 | data["dut"], | |
841 | data["src_address"], | |
842 | IGMP_JOIN_RANGE_1, | |
843 | data["iif"], | |
844 | data["oil"], | |
845 | ) | |
846 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
847 | ||
848 | for data in input_dict_all: | |
849 | result = verify_upstream_iif( | |
850 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
851 | ) | |
852 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
853 | ||
854 | step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR3(r2) node") | |
855 | ||
856 | intf_r2_i3 = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
857 | shutdown_bringup_interface(tgen, "r2", intf_r2_i3, False) | |
858 | ||
859 | step( | |
860 | "After sending IGMP prune from FRR3(r2) node verify (*,G) OIL " | |
861 | "immediately removed for local receiver mroute should have " | |
862 | " PIM protocol , IGMP should be removed verify using " | |
863 | "'show ip mroute' no impact seen on FRR1(l1) (*,G)" | |
864 | ) | |
865 | ||
866 | input_dict_r2 = [ | |
867 | { | |
868 | "dut": "r2", | |
869 | "src_address": "*", | |
870 | "iif": "lo", | |
871 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
872 | } | |
873 | ] | |
874 | ||
875 | for data in input_dict_r2: | |
4fafd29f | 876 | result = verify_mroutes( |
c9b5d52c | 877 | tgen, |
878 | data["dut"], | |
879 | data["src_address"], | |
880 | IGMP_JOIN_RANGE_1, | |
881 | data["iif"], | |
882 | data["oil"], | |
883 | expected=False, | |
884 | ) | |
5980ad0a DS |
885 | assert ( |
886 | result is not True | |
887 | ), "Testcase {} : Failed \n " "mroutes are still present \n Error: {}".format( | |
888 | tc_name, result | |
c9b5d52c | 889 | ) |
890 | logger.info("Expected Behaviour: {}".format(result)) | |
891 | ||
892 | input_dict_l1_r2 = [ | |
893 | { | |
894 | "dut": "l1", | |
895 | "src_address": "*", | |
896 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
897 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
898 | }, | |
899 | { | |
900 | "dut": "r2", | |
901 | "src_address": "*", | |
902 | "iif": "lo", | |
903 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
904 | }, | |
905 | ] | |
906 | ||
907 | step("Verify mroutes and iff upstream") | |
908 | ||
909 | for data in input_dict_l1_r2: | |
4fafd29f | 910 | result = verify_mroutes( |
c9b5d52c | 911 | tgen, |
912 | data["dut"], | |
913 | data["src_address"], | |
914 | IGMP_JOIN_RANGE_1, | |
915 | data["iif"], | |
916 | data["oil"], | |
917 | ) | |
918 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
919 | ||
920 | step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR1(l1) node") | |
921 | ||
922 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
923 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, False) | |
924 | ||
925 | step( | |
926 | "After sending IGMP prune from FRR1 node verify (*,G) OIL" | |
927 | "got removed immediately from FRR1 node" | |
928 | ) | |
929 | ||
930 | input_dict_l1 = [ | |
931 | { | |
932 | "dut": "l1", | |
933 | "src_address": "*", | |
934 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
935 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
936 | } | |
937 | ] | |
938 | ||
939 | for data in input_dict_l1: | |
4fafd29f | 940 | result = verify_mroutes( |
c9b5d52c | 941 | tgen, |
942 | data["dut"], | |
943 | data["src_address"], | |
944 | IGMP_JOIN_RANGE_1, | |
945 | data["iif"], | |
946 | data["oil"], | |
947 | expected=False, | |
948 | ) | |
5980ad0a DS |
949 | assert ( |
950 | result is not True | |
951 | ), "Testcase {} : Failed \n " "mroutes are still present \n Error: {}".format( | |
952 | tc_name, result | |
c9b5d52c | 953 | ) |
954 | logger.info("Expected Behaviour: {}".format(result)) | |
955 | ||
956 | step("After prune is sent verify upstream got removed in FRR1 node") | |
957 | ||
958 | for data in input_dict_l1: | |
959 | result = verify_upstream_iif( | |
960 | tgen, | |
961 | data["dut"], | |
962 | data["iif"], | |
963 | data["src_address"], | |
964 | IGMP_JOIN_RANGE_1, | |
965 | expected=False, | |
966 | ) | |
967 | assert result is not True, ( | |
968 | "Testcase {} : Failed \n " | |
969 | "upstream entries are still present \n Error: {}".format(tc_name, result) | |
970 | ) | |
971 | logger.info("Expected Behaviour: {}".format(result)) | |
972 | ||
973 | write_test_footer(tc_name) | |
974 | ||
975 | ||
976 | def test_shut_noshut_source_interface_when_upstream_cleared_from_LHR_p1(request): | |
977 | """ | |
978 | TC_26: Verify shut/no shut of source interface after upstream got cleared | |
979 | from LHR | |
980 | """ | |
981 | ||
982 | tgen = get_topogen() | |
983 | tc_name = request.node.name | |
984 | write_test_header(tc_name) | |
985 | ||
8db751b8 CH |
986 | # Don"t run this test if we have any failure. |
987 | if tgen.routers_have_failure(): | |
988 | pytest.skip(tgen.errors) | |
989 | ||
c9b5d52c | 990 | # Creating configuration from JSON |
1973df1d | 991 | app_helper.stop_all_hosts() |
4fafd29f | 992 | clear_mroute(tgen) |
c9b5d52c | 993 | reset_config_on_routers(tgen) |
4fafd29f | 994 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 995 | check_router_status(tgen) |
996 | ||
c9b5d52c | 997 | step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers") |
998 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
999 | ||
1000 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
1001 | ||
1002 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 1003 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 1004 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
1005 | ||
1006 | step("Configure RP on R2 (loopback interface) for " "the group range 225.0.0.0/8") | |
1007 | ||
1008 | input_dict = { | |
1009 | "r2": { | |
1010 | "pim": { | |
1011 | "rp": [ | |
1012 | { | |
1013 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
1014 | "/" | |
1015 | )[0], | |
1016 | "group_addr_range": GROUP_RANGE_1, | |
1017 | } | |
1018 | ] | |
1019 | } | |
1020 | } | |
1021 | } | |
1022 | ||
1023 | result = create_pim_config(tgen, topo, input_dict) | |
1024 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1025 | ||
1026 | step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver") | |
1027 | ||
1028 | input_src = {"i2": topo["routers"]["i2"]["links"]["f1"]["interface"]} | |
1029 | ||
1030 | for src, src_intf in input_src.items(): | |
1973df1d | 1031 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 1032 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
1033 | ||
1034 | step( | |
1035 | "'show ip mroute' showing correct RPF and OIF interface for (*,G)" | |
1036 | " and (S,G) entries on all the nodes" | |
1037 | ) | |
1038 | ||
1039 | source_i2 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
1040 | input_dict_all = [ | |
1041 | { | |
1042 | "dut": "l1", | |
1043 | "src_address": "*", | |
1044 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1045 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1046 | }, | |
1047 | { | |
1048 | "dut": "l1", | |
1049 | "src_address": source_i2, | |
1050 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1051 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1052 | }, | |
1053 | { | |
1054 | "dut": "r2", | |
1055 | "src_address": "*", | |
1056 | "iif": "lo", | |
1057 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
1058 | }, | |
1059 | { | |
1060 | "dut": "r2", | |
1061 | "src_address": source_i2, | |
1062 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
1063 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
1064 | }, | |
1065 | { | |
1066 | "dut": "f1", | |
1067 | "src_address": source_i2, | |
1068 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
1069 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
1070 | }, | |
1071 | ] | |
1072 | ||
1073 | step( | |
1074 | "'show ip pim upstream' and 'show ip pim upstream-rpf' showing" | |
1075 | " correct OIL and IIF on all the nodes" | |
1076 | ) | |
1077 | ||
1078 | for data in input_dict_all: | |
4fafd29f | 1079 | result = verify_mroutes( |
c9b5d52c | 1080 | tgen, |
1081 | data["dut"], | |
1082 | data["src_address"], | |
1083 | IGMP_JOIN_RANGE_1, | |
1084 | data["iif"], | |
1085 | data["oil"], | |
1086 | ) | |
1087 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1088 | ||
1089 | for data in input_dict_all: | |
1090 | result = verify_upstream_iif( | |
1091 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1092 | ) | |
1093 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1094 | ||
1095 | step("Shut the source interface from FRR3") | |
1096 | intf_f1_i2 = topo["routers"]["f1"]["links"]["i2"]["interface"] | |
1097 | shutdown_bringup_interface(tgen, "f1", intf_f1_i2, False) | |
1098 | ||
1099 | step( | |
1100 | "After shut of source interface verify (S,G) mroutes are cleared" | |
1101 | " from all the nodes" | |
1102 | ) | |
1103 | ||
1104 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
4fafd29f | 1105 | result = verify_mroutes( |
c9b5d52c | 1106 | tgen, "f1", source_i2, IGMP_JOIN_RANGE_1, intf_f1_i2, intf_f1_r2, expected=False |
1107 | ) | |
5980ad0a DS |
1108 | assert ( |
1109 | result is not True | |
1110 | ), "Testcase {} : Failed \n mroutes are" " still present \n Error: {}".format( | |
1111 | tc_name, result | |
c9b5d52c | 1112 | ) |
1113 | logger.info("Expected Behavior: {}".format(result)) | |
1114 | ||
1115 | step( | |
1116 | "After waiting for (S,G) timeout from FRR1 for same" | |
1117 | " source verify that (S,G) is flushed from FRR1 node" | |
1118 | " 'show ip pim upstream' 'show ip mroute' " | |
1119 | ) | |
1120 | ||
8db751b8 CH |
1121 | result = verify_upstream_iif( |
1122 | tgen, "l1", "Unknown", source_i2, IGMP_JOIN_RANGE_1, expected=False | |
1123 | ) | |
a53c08bc CH |
1124 | assert ( |
1125 | result is not True | |
1126 | ), "Testcase {} : Failed Error: \n mroutes are still present".format(tc_name) | |
c9b5d52c | 1127 | |
1128 | step("No shut the Source interface just after the upstream is expired" " from FRR1") | |
1129 | shutdown_bringup_interface(tgen, "f1", intf_f1_i2, True) | |
1130 | ||
1131 | step( | |
1132 | "After no shut of source interface , verify all the (S,G) is " | |
1133 | " populated again on 'show ip mroute' 'show ip pim upstream' " | |
1134 | " with proper OIL and IIF detail" | |
1135 | ) | |
1136 | ||
1137 | for data in input_dict_all: | |
4fafd29f | 1138 | result = verify_mroutes( |
c9b5d52c | 1139 | tgen, |
1140 | data["dut"], | |
1141 | data["src_address"], | |
1142 | IGMP_JOIN_RANGE_1, | |
1143 | data["iif"], | |
1144 | data["oil"], | |
1145 | ) | |
1146 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1147 | ||
1148 | for data in input_dict_all: | |
1149 | result = verify_upstream_iif( | |
1150 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1151 | ) | |
1152 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1153 | ||
1154 | step("shut and no shut the source interface immediately") | |
1155 | shutdown_bringup_interface(tgen, "f1", intf_f1_i2, False) | |
1156 | shutdown_bringup_interface(tgen, "f1", intf_f1_i2, True) | |
1157 | ||
1158 | step( | |
1159 | "All the mroutes got updated with proper OIL after no shut of" | |
1160 | "interface verify using 'show ip mroute'" | |
1161 | ) | |
1162 | ||
1163 | for data in input_dict_all: | |
4fafd29f | 1164 | result = verify_mroutes( |
c9b5d52c | 1165 | tgen, |
1166 | data["dut"], | |
1167 | data["src_address"], | |
1168 | IGMP_JOIN_RANGE_1, | |
1169 | data["iif"], | |
1170 | data["oil"], | |
1171 | ) | |
1172 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1173 | ||
1174 | for data in input_dict_all: | |
1175 | result = verify_upstream_iif( | |
1176 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1177 | ) | |
1178 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1179 | ||
1180 | write_test_footer(tc_name) | |
1181 | ||
1182 | ||
1183 | def test_shut_noshut_receiver_interface_when_upstream_cleared_from_LHR_p1(request): | |
1184 | """ | |
1185 | TC_27: Verify shut/no shut of receiver interface after upstream got | |
1186 | cleared from LHR | |
1187 | """ | |
1188 | ||
1189 | tgen = get_topogen() | |
1190 | tc_name = request.node.name | |
1191 | write_test_header(tc_name) | |
1192 | ||
8db751b8 CH |
1193 | # Don"t run this test if we have any failure. |
1194 | if tgen.routers_have_failure(): | |
1195 | pytest.skip(tgen.errors) | |
1196 | ||
c9b5d52c | 1197 | # Creating configuration from JSON |
1973df1d | 1198 | app_helper.stop_all_hosts() |
4fafd29f | 1199 | clear_mroute(tgen) |
c9b5d52c | 1200 | reset_config_on_routers(tgen) |
4fafd29f | 1201 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 1202 | check_router_status(tgen) |
1203 | ||
c9b5d52c | 1204 | step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers") |
1205 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
1206 | ||
1207 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
1208 | ||
1209 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 1210 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 1211 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
1212 | ||
1213 | step("Configure RP on R2 (loopback interface) for " "the group range 225.0.0.0/8") | |
1214 | ||
1215 | input_dict = { | |
1216 | "r2": { | |
1217 | "pim": { | |
1218 | "rp": [ | |
1219 | { | |
1220 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
1221 | "/" | |
1222 | )[0], | |
1223 | "group_addr_range": GROUP_RANGE_1, | |
1224 | } | |
1225 | ] | |
1226 | } | |
1227 | } | |
1228 | } | |
1229 | ||
1230 | result = create_pim_config(tgen, topo, input_dict) | |
1231 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1232 | ||
1233 | step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver") | |
1234 | ||
1235 | input_src = {"i2": topo["routers"]["i2"]["links"]["f1"]["interface"]} | |
1236 | ||
1237 | for src, src_intf in input_src.items(): | |
1973df1d | 1238 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 1239 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
1240 | ||
1241 | step( | |
1242 | "'show ip mroute' showing correct RPF and OIF interface for (*,G)" | |
1243 | " and (S,G) entries on all the nodes" | |
1244 | ) | |
1245 | ||
1246 | source_i2 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
1247 | input_dict_all = [ | |
1248 | { | |
1249 | "dut": "l1", | |
1250 | "src_address": "*", | |
1251 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1252 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1253 | }, | |
1254 | { | |
1255 | "dut": "l1", | |
1256 | "src_address": source_i2, | |
1257 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1258 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1259 | }, | |
1260 | { | |
1261 | "dut": "r2", | |
1262 | "src_address": "*", | |
1263 | "iif": "lo", | |
1264 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
1265 | }, | |
1266 | { | |
1267 | "dut": "r2", | |
1268 | "src_address": source_i2, | |
1269 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
1270 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
1271 | }, | |
1272 | { | |
1273 | "dut": "f1", | |
1274 | "src_address": source_i2, | |
1275 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
1276 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
1277 | }, | |
1278 | ] | |
1279 | ||
1280 | for data in input_dict_all: | |
4fafd29f | 1281 | result = verify_mroutes( |
c9b5d52c | 1282 | tgen, |
1283 | data["dut"], | |
1284 | data["src_address"], | |
1285 | IGMP_JOIN_RANGE_1, | |
1286 | data["iif"], | |
1287 | data["oil"], | |
1288 | ) | |
1289 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1290 | ||
1291 | step( | |
1292 | "'show ip pim upstream' and 'show ip pim upstream-rpf' showing" | |
1293 | " correct OIL and IIF on all the nodes" | |
1294 | ) | |
1295 | ||
1296 | for data in input_dict_all: | |
1297 | result = verify_upstream_iif( | |
1298 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1299 | ) | |
1300 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1301 | ||
1302 | step("Shut the source interface FRR1") | |
1303 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1304 | intf_f1_i2 = topo["routers"]["f1"]["links"]["i2"]["interface"] | |
1305 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
1306 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, False) | |
1307 | ||
1308 | step( | |
1309 | "After waiting for (S,G) timeout from FRR1 for same" | |
1310 | " source verify that (S,G) is flushed from FRR1 node" | |
1311 | " 'show ip pim upstream' 'show ip mroute' " | |
1312 | ) | |
1313 | ||
8db751b8 CH |
1314 | result = verify_upstream_iif( |
1315 | tgen, "l1", "Unknown", source_i2, IGMP_JOIN_RANGE_1, expected=False | |
1316 | ) | |
a53c08bc CH |
1317 | assert ( |
1318 | result is not True | |
1319 | ), "Testcase {} : Failed Error: \nmroutes are still present".format(tc_name) | |
c9b5d52c | 1320 | |
1321 | step("No shut the Source interface just after the upstream is expired" " from FRR1") | |
1322 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, True) | |
1323 | ||
1324 | step( | |
1325 | "After no shut of source interface , verify all the (S,G) is " | |
1326 | " populated again on 'show ip mroute' 'show ip pim upstream' " | |
1327 | " with proper OIL and IIF detail" | |
1328 | ) | |
1329 | ||
1330 | for data in input_dict_all: | |
4fafd29f | 1331 | result = verify_mroutes( |
c9b5d52c | 1332 | tgen, |
1333 | data["dut"], | |
1334 | data["src_address"], | |
1335 | IGMP_JOIN_RANGE_1, | |
1336 | data["iif"], | |
1337 | data["oil"], | |
1338 | ) | |
1339 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1340 | ||
1341 | for data in input_dict_all: | |
1342 | result = verify_upstream_iif( | |
1343 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1344 | ) | |
1345 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1346 | ||
1347 | step("shut and no shut the source interface immediately") | |
1348 | shutdown_bringup_interface(tgen, "f1", intf_f1_i2, False) | |
1349 | shutdown_bringup_interface(tgen, "f1", intf_f1_i2, True) | |
1350 | ||
1351 | step( | |
1352 | "After no shut of receiver interface , verify all the (S,G) is " | |
1353 | "populated again on 'show ip mroute' 'show ip pim upstream' " | |
1354 | "with proper OIL and IIF detail" | |
1355 | ) | |
1356 | ||
1357 | for data in input_dict_all: | |
4fafd29f | 1358 | result = verify_mroutes( |
c9b5d52c | 1359 | tgen, |
1360 | data["dut"], | |
1361 | data["src_address"], | |
1362 | IGMP_JOIN_RANGE_1, | |
1363 | data["iif"], | |
1364 | data["oil"], | |
1365 | ) | |
1366 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1367 | ||
1368 | for data in input_dict_all: | |
1369 | result = verify_upstream_iif( | |
1370 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1371 | ) | |
1372 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1373 | ||
1374 | write_test_footer(tc_name) | |
1375 | ||
1376 | ||
1377 | def test_verify_remove_add_igmp_config_to_receiver_interface_p0(request): | |
1378 | """ | |
1379 | TC_33: Verify removing and adding IGMP config from the receiver interface | |
1380 | """ | |
1381 | tgen = get_topogen() | |
1382 | tc_name = request.node.name | |
1383 | write_test_header(tc_name) | |
1384 | ||
8db751b8 CH |
1385 | # Don"t run this test if we have any failure. |
1386 | if tgen.routers_have_failure(): | |
1387 | pytest.skip(tgen.errors) | |
1388 | ||
c9b5d52c | 1389 | # Creating configuration from JSON |
1973df1d | 1390 | app_helper.stop_all_hosts() |
4fafd29f | 1391 | clear_mroute(tgen) |
c9b5d52c | 1392 | reset_config_on_routers(tgen) |
4fafd29f | 1393 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 1394 | check_router_status(tgen) |
1395 | ||
c9b5d52c | 1396 | step("Enable PIM on all routers") |
1397 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
1398 | ||
1399 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
1400 | ||
1401 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 1402 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 1403 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
1404 | ||
1405 | step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)") | |
1406 | ||
1407 | input_dict = { | |
1408 | "r2": { | |
1409 | "pim": { | |
1410 | "rp": [ | |
1411 | { | |
1412 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
1413 | "/" | |
1414 | )[0], | |
1415 | "group_addr_range": GROUP_RANGE, | |
1416 | } | |
1417 | ] | |
1418 | } | |
1419 | } | |
1420 | } | |
1421 | ||
1422 | result = create_pim_config(tgen, topo, input_dict) | |
1423 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1424 | ||
1425 | step("Configure source on FRR3 and start the traffic for" " (225.1.1.1-225.1.1.10)") | |
1426 | ||
1427 | input_src = {"i2": topo["routers"]["i2"]["links"]["f1"]["interface"]} | |
1428 | ||
1429 | for src, src_intf in input_src.items(): | |
1973df1d | 1430 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 1431 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
1432 | ||
1433 | step("Configure source on FRR1 and start the traffic for" " (225.1.1.1-225.1.1.10)") | |
1434 | ||
1435 | input_src = {"i6": topo["routers"]["i6"]["links"]["l1"]["interface"]} | |
1436 | ||
1437 | for src, src_intf in input_src.items(): | |
1973df1d | 1438 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 1439 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
1440 | ||
1441 | source_i6 = topo["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0] | |
1442 | source_i2 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
1443 | input_dict_all = [ | |
1444 | { | |
1445 | "dut": "l1", | |
1446 | "src_address": "*", | |
1447 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1448 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1449 | }, | |
1450 | { | |
1451 | "dut": "l1", | |
1452 | "src_address": source_i6, | |
1453 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
1454 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1455 | }, | |
1456 | { | |
1457 | "dut": "l1", | |
1458 | "src_address": source_i2, | |
1459 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1460 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1461 | }, | |
1462 | { | |
1463 | "dut": "r2", | |
1464 | "src_address": "*", | |
1465 | "iif": "lo", | |
1466 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
1467 | }, | |
1468 | { | |
1469 | "dut": "f1", | |
1470 | "src_address": source_i2, | |
1471 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
1472 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
1473 | }, | |
1474 | ] | |
1475 | ||
1476 | for data in input_dict_all: | |
4fafd29f | 1477 | result = verify_mroutes( |
c9b5d52c | 1478 | tgen, |
1479 | data["dut"], | |
1480 | data["src_address"], | |
1481 | IGMP_JOIN_RANGE_1, | |
1482 | data["iif"], | |
1483 | data["oil"], | |
1484 | ) | |
1485 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1486 | ||
1487 | for data in input_dict_all: | |
1488 | result = verify_upstream_iif( | |
1489 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1490 | ) | |
1491 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1492 | ||
1493 | step( | |
1494 | "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from" | |
1495 | " receiver interface of FRR1" | |
1496 | ) | |
1497 | ||
1498 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1499 | input_dict_2 = { | |
1500 | "l1": { | |
1501 | "igmp": { | |
5980ad0a DS |
1502 | "interfaces": { |
1503 | intf_l1_i1: { | |
1504 | "igmp": { | |
1505 | "version": "2", | |
1506 | "delete": True, | |
1507 | } | |
1508 | } | |
1509 | } | |
c9b5d52c | 1510 | } |
1511 | } | |
1512 | } | |
1513 | result = create_igmp_config(tgen, topo, input_dict_2) | |
1514 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1515 | ||
1516 | step("IGMP join removed from FRR1 , verify using " "'show ip igmp groups json'") | |
1517 | ||
1518 | dut = "l1" | |
1519 | interface = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1520 | result = verify_igmp_groups(tgen, dut, interface, IGMP_JOIN_RANGE_1, expected=False) | |
5980ad0a DS |
1521 | assert ( |
1522 | result is not True | |
1523 | ), "Testcase {} : Failed \n Groups are not" " present \n Error: {}".format( | |
1524 | tc_name, result | |
c9b5d52c | 1525 | ) |
1526 | logger.info("Expected Behaviour: {}".format(result)) | |
1527 | ||
1528 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
1529 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1530 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
1531 | intf_f1_i2 = topo["routers"]["f1"]["links"]["i2"]["interface"] | |
1532 | input_traffic = { | |
1533 | "l1": {"traffic_received": [intf_l1_r2], "traffic_sent": [intf_l1_i1]}, | |
1534 | "f1": {"traffic_sent": [intf_f1_r2], "traffic_received": [intf_f1_i2]}, | |
1535 | } | |
1536 | result = verify_multicast_traffic(tgen, input_traffic) | |
1537 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1538 | ||
1539 | step( | |
1540 | "Configure igmp 'ip igmp' and 'ip igmp version 2' from " | |
1541 | "receiver interface of FRR1" | |
1542 | ) | |
1543 | ||
1544 | input_dict_2 = { | |
a53c08bc CH |
1545 | "l1": { |
1546 | "igmp": { | |
1547 | "interfaces": { | |
1548 | intf_l1_i1: { | |
1549 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
1550 | } | |
1551 | } | |
1552 | } | |
1553 | } | |
c9b5d52c | 1554 | } |
1555 | result = create_igmp_config(tgen, topo, input_dict_2) | |
1556 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1557 | ||
1558 | step( | |
1559 | "After adding IGMP on receiver interface verify (S,G) and (*,G)" | |
1560 | " entries got populated and traffic is resumed on FRR1 and FRR3 node" | |
1561 | ) | |
1562 | ||
1563 | step( | |
1564 | "Verify OIL/IIF and drJoinDesired using 'show ip mroute , and traffic" | |
1565 | " using show ip pim upstream and show ip multicast'" | |
1566 | ) | |
1567 | ||
1568 | for data in input_dict_all: | |
4fafd29f | 1569 | result = verify_mroutes( |
c9b5d52c | 1570 | tgen, |
1571 | data["dut"], | |
1572 | data["src_address"], | |
1573 | IGMP_JOIN_RANGE_1, | |
1574 | data["iif"], | |
1575 | data["oil"], | |
1576 | ) | |
1577 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1578 | ||
1579 | for data in input_dict_all: | |
1580 | result = verify_upstream_iif( | |
1581 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1582 | ) | |
1583 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1584 | ||
1585 | result = verify_multicast_traffic(tgen, input_traffic) | |
1586 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1587 | ||
1588 | step("Verify that no core is observed") | |
1589 | if tgen.routers_have_failure(): | |
1590 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1591 | ||
1592 | step( | |
1593 | "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from" | |
1594 | " receiver interface of FRR1" | |
1595 | ) | |
1596 | ||
1597 | input_dict_2 = { | |
1598 | "l1": { | |
1599 | "igmp": { | |
5980ad0a DS |
1600 | "interfaces": { |
1601 | intf_l1_i1: { | |
1602 | "igmp": { | |
1603 | "version": "2", | |
1604 | "delete": True, | |
1605 | } | |
1606 | } | |
1607 | } | |
c9b5d52c | 1608 | } |
1609 | } | |
1610 | } | |
1611 | ||
1612 | result = create_igmp_config(tgen, topo, input_dict_2) | |
1613 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1614 | ||
1615 | step("IGMP join removed from FRR1 , verify using " "'show ip igmp groups json'") | |
1616 | ||
1617 | dut = "l1" | |
1618 | interface = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1619 | result = verify_igmp_groups(tgen, dut, interface, IGMP_JOIN_RANGE_1, expected=False) | |
5980ad0a DS |
1620 | assert ( |
1621 | result is not True | |
1622 | ), "Testcase {} : Failed \n Groups are not" " present \n Error: {}".format( | |
1623 | tc_name, result | |
c9b5d52c | 1624 | ) |
1625 | logger.info("Expected Behaviour: {}".format(result)) | |
1626 | ||
1627 | result = verify_multicast_traffic(tgen, input_traffic) | |
1628 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1629 | ||
1630 | step( | |
1631 | "Configure igmp 'ip igmp' and 'ip igmp version 2' from " | |
1632 | "receiver interface of FRR1" | |
1633 | ) | |
1634 | ||
1635 | input_dict_2 = { | |
a53c08bc CH |
1636 | "l1": { |
1637 | "igmp": { | |
1638 | "interfaces": { | |
1639 | intf_l1_i1: { | |
1640 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
1641 | } | |
1642 | } | |
1643 | } | |
1644 | } | |
c9b5d52c | 1645 | } |
1646 | result = create_igmp_config(tgen, topo, input_dict_2) | |
1647 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1648 | ||
1649 | step( | |
1650 | "After adding IGMP on receiver interface verify (S,G) and (*,G)" | |
1651 | " entries got populated and traffic is resumed on FRR1 and FRR3 node" | |
1652 | ) | |
1653 | ||
1654 | step( | |
1655 | "Verify OIL/IIF and drJoinDesired using 'show ip mroute , and traffic" | |
1656 | " using show ip pim upstream and show ip multicast'" | |
1657 | ) | |
1658 | ||
1659 | input_dict_l1_f1 = [ | |
1660 | { | |
1661 | "dut": "l1", | |
1662 | "src_address": "*", | |
1663 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1664 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1665 | }, | |
1666 | { | |
1667 | "dut": "l1", | |
1668 | "src_address": source_i6, | |
1669 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
1670 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1671 | }, | |
1672 | { | |
1673 | "dut": "l1", | |
1674 | "src_address": source_i2, | |
1675 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1676 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1677 | }, | |
1678 | { | |
1679 | "dut": "f1", | |
1680 | "src_address": source_i2, | |
1681 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
1682 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
1683 | }, | |
1684 | ] | |
1685 | ||
1686 | for data in input_dict_l1_f1: | |
4fafd29f | 1687 | result = verify_mroutes( |
c9b5d52c | 1688 | tgen, |
1689 | data["dut"], | |
1690 | data["src_address"], | |
1691 | IGMP_JOIN_RANGE_1, | |
1692 | data["iif"], | |
1693 | data["oil"], | |
1694 | ) | |
1695 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1696 | ||
1697 | for data in input_dict_l1_f1: | |
1698 | result = verify_upstream_iif( | |
1699 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1700 | ) | |
1701 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1702 | ||
1703 | result = verify_multicast_traffic(tgen, input_traffic) | |
1704 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1705 | ||
1706 | step("Verify that no core is observed") | |
1707 | if tgen.routers_have_failure(): | |
1708 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1709 | ||
1710 | step("Remove ip igmp and send igmp prune from FRR1 interface") | |
1711 | ||
1712 | input_dict_2 = { | |
1713 | "l1": { | |
1714 | "igmp": { | |
5980ad0a DS |
1715 | "interfaces": { |
1716 | intf_l1_i1: { | |
1717 | "igmp": { | |
1718 | "version": "2", | |
1719 | "delete": True, | |
1720 | } | |
1721 | } | |
1722 | } | |
c9b5d52c | 1723 | } |
1724 | } | |
1725 | } | |
1726 | result = create_igmp_config(tgen, topo, input_dict_2) | |
1727 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1728 | step( | |
1729 | "Verification: After removing igmp 'no ip igmp' and " | |
1730 | " sending prune verify mroute and upstream got removed" | |
1731 | " from FRR1 verify using 'show ip mroute' and " | |
1732 | "'show ip pim upstream'" | |
1733 | ) | |
1734 | ||
1735 | dut = "l1" | |
1736 | iif = topo["routers"]["l1"]["links"]["i6"]["interface"] | |
1737 | oil = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1738 | source = source_i6 | |
4fafd29f | 1739 | result = verify_mroutes( |
c9b5d52c | 1740 | tgen, dut, source, IGMP_JOIN_RANGE_1, iif, oil, expected=False |
1741 | ) | |
5980ad0a DS |
1742 | assert ( |
1743 | result is not True | |
1744 | ), "Testcase {} : Failed \n routes are still" " present \n Error: {}".format( | |
1745 | tc_name, result | |
c9b5d52c | 1746 | ) |
1747 | logger.info("Expected Behaviour: {}".format(result)) | |
1748 | ||
1749 | write_test_footer(tc_name) | |
1750 | ||
1751 | ||
1752 | def test_verify_remove_add_igmp_commands_when_pim_configured_p0(request): | |
1753 | """ | |
1754 | TC_34: Verify removing and adding IGMP commands when PIM is already | |
1755 | configured | |
1756 | """ | |
1757 | ||
1758 | tgen = get_topogen() | |
1759 | tc_name = request.node.name | |
1760 | write_test_header(tc_name) | |
1761 | ||
8db751b8 CH |
1762 | # Don"t run this test if we have any failure. |
1763 | if tgen.routers_have_failure(): | |
1764 | pytest.skip(tgen.errors) | |
1765 | ||
c9b5d52c | 1766 | # Creating configuration from JSON |
1973df1d | 1767 | app_helper.stop_all_hosts() |
4fafd29f | 1768 | clear_mroute(tgen) |
c9b5d52c | 1769 | reset_config_on_routers(tgen) |
4fafd29f | 1770 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 1771 | check_router_status(tgen) |
1772 | ||
c9b5d52c | 1773 | step("Enable PIM on all routers") |
1774 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
1775 | ||
1776 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
1777 | ||
1778 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 1779 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 1780 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
1781 | ||
1782 | step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)") | |
1783 | ||
1784 | input_dict = { | |
1785 | "r2": { | |
1786 | "pim": { | |
1787 | "rp": [ | |
1788 | { | |
1789 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
1790 | "/" | |
1791 | )[0], | |
1792 | "group_addr_range": GROUP_RANGE, | |
1793 | } | |
1794 | ] | |
1795 | } | |
1796 | } | |
1797 | } | |
1798 | ||
1799 | result = create_pim_config(tgen, topo, input_dict) | |
1800 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1801 | ||
1802 | step("Configure source on FRR3 and start the traffic for" " (225.1.1.1-225.1.1.10)") | |
1803 | ||
1804 | input_src = {"i2": topo["routers"]["i2"]["links"]["f1"]["interface"]} | |
1805 | ||
1806 | for src, src_intf in input_src.items(): | |
1973df1d | 1807 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 1808 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
1809 | ||
1810 | step("Configure source on FRR1 and start the traffic for" " (225.1.1.1-225.1.1.10)") | |
1811 | ||
1812 | input_src = {"i6": topo["routers"]["i6"]["links"]["l1"]["interface"]} | |
1813 | ||
1814 | for src, src_intf in input_src.items(): | |
1973df1d | 1815 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 1816 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
1817 | ||
1818 | source_i6 = topo["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0] | |
1819 | source_i2 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
1820 | input_dict_all = [ | |
1821 | { | |
1822 | "dut": "l1", | |
1823 | "src_address": "*", | |
1824 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1825 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1826 | }, | |
1827 | { | |
1828 | "dut": "l1", | |
1829 | "src_address": source_i6, | |
1830 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
1831 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1832 | }, | |
1833 | { | |
1834 | "dut": "l1", | |
1835 | "src_address": source_i2, | |
1836 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
1837 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
1838 | }, | |
1839 | { | |
1840 | "dut": "r2", | |
1841 | "src_address": "*", | |
1842 | "iif": "lo", | |
1843 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
1844 | }, | |
1845 | { | |
1846 | "dut": "f1", | |
1847 | "src_address": source_i2, | |
1848 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
1849 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
1850 | }, | |
1851 | ] | |
1852 | ||
1853 | for data in input_dict_all: | |
4fafd29f | 1854 | result = verify_mroutes( |
c9b5d52c | 1855 | tgen, |
1856 | data["dut"], | |
1857 | data["src_address"], | |
1858 | IGMP_JOIN_RANGE_1, | |
1859 | data["iif"], | |
1860 | data["oil"], | |
1861 | ) | |
1862 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1863 | ||
1864 | for data in input_dict_all: | |
1865 | result = verify_upstream_iif( | |
1866 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
1867 | ) | |
1868 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1869 | ||
1870 | step( | |
1871 | "Verification: After configuring IGMP related config , " | |
1872 | "verify config is present in the interface " | |
1873 | "'show ip igmp interface ensxx json'" | |
1874 | ) | |
1875 | ||
1876 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
1877 | input_dict_1 = { | |
a53c08bc CH |
1878 | "l1": { |
1879 | "igmp": { | |
1880 | "interfaces": { | |
1881 | intf_l1_i1: { | |
1882 | "igmp": { | |
1883 | "version": "2", | |
1884 | "query": { | |
1885 | "query-max-response-time": 40, | |
1886 | "query-interval": 5, | |
1887 | }, | |
1888 | } | |
1889 | } | |
1890 | } | |
1891 | } | |
1892 | } | |
c9b5d52c | 1893 | } |
1894 | ||
1895 | result = verify_igmp_config(tgen, input_dict_1) | |
1896 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
1897 | ||
1898 | step( | |
1899 | "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from" | |
1900 | " receiver interface of FRR1" | |
1901 | ) | |
1902 | ||
1903 | input_dict_2 = { | |
1904 | "l1": { | |
1905 | "igmp": { | |
5980ad0a DS |
1906 | "interfaces": { |
1907 | intf_l1_i1: { | |
1908 | "igmp": { | |
1909 | "version": "2", | |
1910 | "delete": True, | |
1911 | } | |
1912 | } | |
1913 | } | |
c9b5d52c | 1914 | } |
1915 | } | |
1916 | } | |
1917 | ||
1918 | result = create_igmp_config(tgen, topo, input_dict_2) | |
1919 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1920 | ||
1921 | step( | |
1922 | "Verification: After removing the config CLI got removed " | |
1923 | "'show ip igmp interface ensxx json'" | |
1924 | ) | |
1925 | ||
1926 | result = verify_igmp_config(tgen, input_dict_1, expected=False) | |
5980ad0a DS |
1927 | assert ( |
1928 | result is not True | |
1929 | ), "Testcase {} : Failed \n " "IGMP interface is not removed \n Error: {}".format( | |
1930 | tc_name, result | |
c9b5d52c | 1931 | ) |
1932 | logger.info("Expected Behaviour: {}".format(result)) | |
1933 | ||
1934 | step("Verify that no core is observed") | |
1935 | if tgen.routers_have_failure(): | |
1936 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1937 | ||
1938 | step("Configure 'ip igmp last-member-query-count 10' on FRR1" " receiver interface") | |
1939 | ||
1940 | input_dict_3 = { | |
1941 | "l1": { | |
1942 | "igmp": { | |
1943 | "interfaces": { | |
1944 | "l1-i1-eth1": {"igmp": {"query": {"last-member-query-count": 5}}} | |
1945 | } | |
1946 | } | |
1947 | } | |
1948 | } | |
1949 | result = create_igmp_config(tgen, topo, input_dict_3) | |
1950 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1951 | ||
1952 | result = verify_igmp_config(tgen, input_dict_3) | |
1953 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1954 | ||
1955 | step("Remove 'ip igmp last-member-query-count 10' on FRR1" " receiver interface") | |
1956 | ||
1957 | input_dict_3 = { | |
1958 | "l1": { | |
1959 | "igmp": { | |
1960 | "interfaces": { | |
1961 | "l1-i1-eth1": { | |
1962 | "igmp": { | |
1963 | "query": {"last-member-query-count": "", "delete": True} | |
1964 | } | |
1965 | } | |
1966 | } | |
1967 | } | |
1968 | } | |
1969 | } | |
1970 | result = create_igmp_config(tgen, topo, input_dict_3) | |
1971 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1972 | ||
1973 | input_dict_3 = { | |
1974 | "l1": { | |
1975 | "igmp": { | |
1976 | "interfaces": { | |
1977 | "l1-i1-eth1": {"igmp": {"query": {"last-member-query-count": 2}}} | |
1978 | } | |
1979 | } | |
1980 | } | |
1981 | } | |
1982 | result = verify_igmp_config(tgen, input_dict_3) | |
1983 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1984 | ||
1985 | step("Verify that no core is observed") | |
1986 | if tgen.routers_have_failure(): | |
1987 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
1988 | ||
1989 | step( | |
1990 | "Configure 'ip igmp last-member-query-interval 20' on FRR1" | |
1991 | " receiver interface" | |
1992 | ) | |
1993 | ||
1994 | input_dict_3 = { | |
1995 | "l1": { | |
1996 | "igmp": { | |
1997 | "interfaces": { | |
1998 | "l1-i1-eth1": { | |
1999 | "igmp": {"query": {"last-member-query-interval": 20}} | |
2000 | } | |
2001 | } | |
2002 | } | |
2003 | } | |
2004 | } | |
2005 | result = create_igmp_config(tgen, topo, input_dict_3) | |
2006 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2007 | ||
2008 | result = verify_igmp_config(tgen, input_dict_3) | |
2009 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2010 | ||
2011 | step("Remove 'ip igmp last-member-query-count 10' on FRR1" " receiver interface") | |
2012 | ||
2013 | input_dict_3 = { | |
2014 | "l1": { | |
2015 | "igmp": { | |
2016 | "interfaces": { | |
2017 | "l1-i1-eth1": { | |
2018 | "igmp": { | |
2019 | "query": {"last-member-query-interval": "", "delete": True} | |
2020 | } | |
2021 | } | |
2022 | } | |
2023 | } | |
2024 | } | |
2025 | } | |
2026 | result = create_igmp_config(tgen, topo, input_dict_3) | |
2027 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2028 | ||
2029 | input_dict_3 = { | |
2030 | "l1": { | |
2031 | "igmp": { | |
2032 | "interfaces": { | |
2033 | "l1-i1-eth1": { | |
2034 | "igmp": {"query": {"last-member-query-interval": 10}} | |
2035 | } | |
2036 | } | |
2037 | } | |
2038 | } | |
2039 | } | |
2040 | result = verify_igmp_config(tgen, input_dict_3) | |
2041 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2042 | ||
2043 | step("Verify that no core is observed") | |
2044 | if tgen.routers_have_failure(): | |
2045 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2046 | ||
2047 | write_test_footer(tc_name) | |
2048 | ||
2049 | ||
2050 | def test_verify_remove_add_pim_commands_when_igmp_configured_p1(request): | |
2051 | """ | |
2052 | TC_35: Verify removing and adding PIM commands when IGMP is already | |
2053 | configured | |
2054 | """ | |
2055 | ||
2056 | tgen = get_topogen() | |
2057 | tc_name = request.node.name | |
2058 | write_test_header(tc_name) | |
2059 | ||
8db751b8 CH |
2060 | # Don"t run this test if we have any failure. |
2061 | if tgen.routers_have_failure(): | |
2062 | pytest.skip(tgen.errors) | |
2063 | ||
c9b5d52c | 2064 | # Creating configuration from JSON |
1973df1d | 2065 | app_helper.stop_all_hosts() |
4fafd29f | 2066 | clear_mroute(tgen) |
c9b5d52c | 2067 | reset_config_on_routers(tgen) |
4fafd29f | 2068 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 2069 | check_router_status(tgen) |
2070 | ||
c9b5d52c | 2071 | step("Configure 'ip pim' on receiver interface on FRR1") |
2072 | step("Enable PIM on all routers") | |
2073 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
2074 | ||
2075 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
2076 | ||
2077 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 2078 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 2079 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2080 | ||
2081 | step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)") | |
2082 | ||
2083 | input_dict = { | |
2084 | "r2": { | |
2085 | "pim": { | |
2086 | "rp": [ | |
2087 | { | |
2088 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2089 | "/" | |
2090 | )[0], | |
2091 | "group_addr_range": GROUP_RANGE, | |
2092 | } | |
2093 | ] | |
2094 | } | |
2095 | } | |
2096 | } | |
2097 | ||
2098 | result = create_pim_config(tgen, topo, input_dict) | |
2099 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2100 | ||
2101 | step("Remove 'no ip pim' on receiver interface on FRR1") | |
2102 | ||
2103 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
0a76e764 CH |
2104 | raw_config = { |
2105 | "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "no ip pim"]} | |
2106 | } | |
2107 | result = apply_raw_config(tgen, raw_config) | |
c9b5d52c | 2108 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2109 | ||
2110 | step("Verify that no core is observed") | |
2111 | if tgen.routers_have_failure(): | |
2112 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2113 | ||
2114 | step("Configure 'ip pim bsm' on receiver interface on FRR1") | |
2115 | ||
2116 | raw_config = { | |
2117 | "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "ip pim bsm"]} | |
2118 | } | |
2119 | result = apply_raw_config(tgen, raw_config) | |
2120 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2121 | ||
2122 | step("Remove 'no ip pim bsm' on receiver interface on FRR1") | |
2123 | ||
2124 | raw_config = { | |
2125 | "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "no ip pim bsm"]} | |
2126 | } | |
2127 | result = apply_raw_config(tgen, raw_config) | |
2128 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2129 | ||
2130 | step("Verify that no core is observed") | |
2131 | if tgen.routers_have_failure(): | |
2132 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2133 | ||
2134 | step("Configure 'ip pim drpriority' on receiver interface on FRR1") | |
2135 | ||
2136 | raw_config = { | |
2137 | "l1": { | |
2138 | "raw_config": ["interface {}".format(intf_l1_i1), "ip pim drpriority 10"] | |
2139 | } | |
2140 | } | |
2141 | result = apply_raw_config(tgen, raw_config) | |
2142 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2143 | ||
2144 | step( | |
2145 | "Verification: After configuring PIM related config, " | |
2146 | "verify config is present in the interface " | |
2147 | "'show ip pim interface ensxx json'" | |
2148 | ) | |
2149 | ||
2150 | input_dict_dr = {"l1": {"pim": {"interfaces": {intf_l1_i1: {"drPriority": 10}}}}} | |
2151 | result = verify_pim_config(tgen, input_dict_dr) | |
2152 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2153 | ||
2154 | step("Remove 'no ip pim drpriority' on receiver interface on FRR1") | |
2155 | ||
2156 | raw_config = { | |
2157 | "l1": { | |
2158 | "raw_config": ["interface {}".format(intf_l1_i1), "no ip pim drpriority 10"] | |
2159 | } | |
2160 | } | |
2161 | result = apply_raw_config(tgen, raw_config) | |
2162 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2163 | ||
2164 | step( | |
2165 | "Verification: After removing the config CLI got removed " | |
2166 | "'show ip pim interface ensxx json'" | |
2167 | ) | |
2168 | ||
2169 | input_dict_dr = {"l1": {"pim": {"interfaces": {intf_l1_i1: {"drPriority": 1}}}}} | |
2170 | result = verify_pim_config(tgen, input_dict_dr) | |
2171 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2172 | ||
2173 | step("Verify that no core is observed") | |
2174 | if tgen.routers_have_failure(): | |
2175 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2176 | ||
2177 | step("Configure 'ip pim hello' on receiver interface on FRR1") | |
2178 | ||
2179 | raw_config = { | |
2180 | "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "ip pim hello 50"]} | |
2181 | } | |
2182 | result = apply_raw_config(tgen, raw_config) | |
2183 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2184 | ||
2185 | step( | |
2186 | "Verification: After configuring PIM related config, " | |
2187 | "verify config is present in the interface " | |
2188 | "'show ip pim interface ensxx json'" | |
2189 | ) | |
2190 | ||
2191 | input_dict_dr = {"l1": {"pim": {"interfaces": {intf_l1_i1: {"helloPeriod": 50}}}}} | |
2192 | result = verify_pim_config(tgen, input_dict_dr) | |
2193 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2194 | ||
2195 | step("Remove 'no ip pim hello' on receiver interface on FRR1") | |
2196 | ||
2197 | raw_config = { | |
2198 | "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "no ip pim hello"]} | |
2199 | } | |
2200 | result = apply_raw_config(tgen, raw_config) | |
2201 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2202 | ||
2203 | step( | |
2204 | "Verification: After removing the config CLI got removed " | |
2205 | "'show ip pim interface ensxx json'" | |
2206 | ) | |
2207 | ||
2208 | input_dict_dr = {"l1": {"pim": {"interfaces": {intf_l1_i1: {"helloPeriod": 30}}}}} | |
2209 | result = verify_pim_config(tgen, input_dict_dr) | |
2210 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2211 | ||
2212 | step("Verify that no core is observed") | |
2213 | if tgen.routers_have_failure(): | |
2214 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2215 | ||
2216 | step("Configure 'ip pim unicast-bsm' on receiver interface on FRR1") | |
2217 | ||
2218 | raw_config = { | |
2219 | "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "ip pim unicast-bsm"]} | |
2220 | } | |
2221 | result = apply_raw_config(tgen, raw_config) | |
2222 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2223 | ||
2224 | step("Remove 'no ip pim hello' on receiver interface on FRR1") | |
2225 | ||
2226 | raw_config = { | |
2227 | "l1": { | |
2228 | "raw_config": ["interface {}".format(intf_l1_i1), "no ip pim unicast-bsm"] | |
2229 | } | |
2230 | } | |
2231 | result = apply_raw_config(tgen, raw_config) | |
2232 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2233 | ||
2234 | step("Verify that no core is observed") | |
2235 | if tgen.routers_have_failure(): | |
2236 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2237 | ||
2238 | write_test_footer(tc_name) | |
2239 | ||
2240 | ||
2241 | def test_pim_dr_priority_p0(request): | |
2242 | """ | |
2243 | TC_36: Verify highest DR priority become the PIM DR | |
2244 | """ | |
2245 | ||
2246 | tgen = get_topogen() | |
2247 | tc_name = request.node.name | |
2248 | write_test_header(tc_name) | |
2249 | ||
8db751b8 CH |
2250 | # Don"t run this test if we have any failure. |
2251 | if tgen.routers_have_failure(): | |
2252 | pytest.skip(tgen.errors) | |
2253 | ||
c9b5d52c | 2254 | # Creating configuration from JSON |
1973df1d | 2255 | app_helper.stop_all_hosts() |
4fafd29f | 2256 | clear_mroute(tgen) |
c9b5d52c | 2257 | reset_config_on_routers(tgen) |
4fafd29f | 2258 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 2259 | check_router_status(tgen) |
2260 | ||
c9b5d52c | 2261 | step("Configure 'ip pim' on receiver interface on FRR1") |
2262 | step("Enable PIM on all routers") | |
2263 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
2264 | ||
2265 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
2266 | ||
2267 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 2268 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 2269 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2270 | ||
2271 | step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)") | |
2272 | ||
2273 | input_dict = { | |
2274 | "r2": { | |
2275 | "pim": { | |
2276 | "rp": [ | |
2277 | { | |
2278 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2279 | "/" | |
2280 | )[0], | |
2281 | "group_addr_range": GROUP_RANGE, | |
2282 | } | |
2283 | ] | |
2284 | } | |
2285 | } | |
2286 | } | |
2287 | ||
2288 | result = create_pim_config(tgen, topo, input_dict) | |
2289 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2290 | ||
2291 | input_src = {"i2": topo["routers"]["i2"]["links"]["f1"]["interface"]} | |
2292 | ||
2293 | for src, src_intf in input_src.items(): | |
1973df1d | 2294 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 2295 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
2296 | ||
2297 | source_i2 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
2298 | input_dict_all = [ | |
2299 | { | |
2300 | "dut": "l1", | |
2301 | "src_address": "*", | |
2302 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
2303 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
2304 | }, | |
2305 | { | |
2306 | "dut": "l1", | |
2307 | "src_address": source_i2, | |
2308 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
2309 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
2310 | }, | |
2311 | { | |
2312 | "dut": "r2", | |
2313 | "src_address": "*", | |
2314 | "iif": "lo", | |
2315 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
2316 | }, | |
2317 | { | |
2318 | "dut": "f1", | |
2319 | "src_address": source_i2, | |
2320 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
2321 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
2322 | }, | |
2323 | ] | |
2324 | ||
2325 | for data in input_dict_all: | |
4fafd29f | 2326 | result = verify_mroutes( |
c9b5d52c | 2327 | tgen, |
2328 | data["dut"], | |
2329 | data["src_address"], | |
2330 | IGMP_JOIN_RANGE_1, | |
2331 | data["iif"], | |
2332 | data["oil"], | |
2333 | ) | |
2334 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2335 | ||
2336 | for data in input_dict_all: | |
2337 | result = verify_upstream_iif( | |
2338 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
2339 | ) | |
2340 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2341 | ||
2342 | step("Configure 'ip pim drpriority 10' on receiver interface on FRR1(LHR)") | |
2343 | ||
2344 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
2345 | raw_config = { | |
2346 | "l1": { | |
2347 | "raw_config": ["interface {}".format(intf_l1_r2), "ip pim drpriority 10"] | |
2348 | } | |
2349 | } | |
2350 | result = apply_raw_config(tgen, raw_config) | |
2351 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2352 | ||
2353 | step( | |
2354 | "DR config is successful on FRR1 node , verify using " | |
2355 | " 'show ip pim interface json'" | |
2356 | ) | |
2357 | ||
2358 | input_dict_dr = {"l1": {"pim": {"interfaces": {intf_l1_r2: {"drPriority": 10}}}}} | |
2359 | result = verify_pim_config(tgen, input_dict_dr) | |
2360 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2361 | ||
2362 | for data in input_dict_all: | |
4fafd29f | 2363 | result = verify_mroutes( |
c9b5d52c | 2364 | tgen, |
2365 | data["dut"], | |
2366 | data["src_address"], | |
2367 | IGMP_JOIN_RANGE_1, | |
2368 | data["iif"], | |
2369 | data["oil"], | |
2370 | ) | |
2371 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2372 | ||
2373 | for data in input_dict_all: | |
2374 | result = verify_upstream_iif( | |
2375 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
2376 | ) | |
2377 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2378 | ||
2379 | step("Configure 'ip pim drpriority 20' on receiver interface on FRR3(FHR)") | |
2380 | ||
2381 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
2382 | raw_config = { | |
2383 | "f1": { | |
2384 | "raw_config": ["interface {}".format(intf_f1_r2), "ip pim drpriority 20"] | |
2385 | } | |
2386 | } | |
2387 | result = apply_raw_config(tgen, raw_config) | |
2388 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2389 | ||
2390 | step( | |
2391 | "DR config is successful on FRR3 node , verify using " | |
2392 | " 'show ip pim interface json'" | |
2393 | ) | |
2394 | ||
2395 | input_dict_dr = {"f1": {"pim": {"interfaces": {intf_f1_r2: {"drPriority": 20}}}}} | |
2396 | result = verify_pim_config(tgen, input_dict_dr) | |
2397 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2398 | ||
2399 | for data in input_dict_all: | |
4fafd29f | 2400 | result = verify_mroutes( |
c9b5d52c | 2401 | tgen, |
2402 | data["dut"], | |
2403 | data["src_address"], | |
2404 | IGMP_JOIN_RANGE_1, | |
2405 | data["iif"], | |
2406 | data["oil"], | |
2407 | ) | |
2408 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2409 | ||
2410 | for data in input_dict_all: | |
2411 | result = verify_upstream_iif( | |
2412 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
2413 | ) | |
2414 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2415 | ||
2416 | step( | |
2417 | "PIM is enable on FRR1, FRR2 interface and neighbor is up, " | |
2418 | " verify using 'show ip pim interface'" | |
2419 | ) | |
2420 | ||
2421 | result = verify_pim_interface(tgen, topo, "l1") | |
2422 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2423 | ||
2424 | result = verify_pim_interface(tgen, topo, "f1") | |
2425 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2426 | ||
2427 | step( | |
2428 | "Highet IP become PIM DR , verify using " | |
2429 | "'show ip pim interface json' and 'show ip pim neighbor'" | |
2430 | ) | |
2431 | step("Highest priority become PIM DR") | |
2432 | ||
2433 | dr_address = topo["routers"]["l1"]["links"]["r2"]["ipv4"].split("/")[0] | |
2434 | input_dict_dr = { | |
2435 | "l1": {"pim": {"interfaces": {intf_l1_r2: {"drAddress": dr_address}}}} | |
2436 | } | |
2437 | result = verify_pim_config(tgen, input_dict_dr) | |
2438 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2439 | ||
2440 | dr_address = topo["routers"]["f1"]["links"]["r2"]["ipv4"].split("/")[0] | |
2441 | input_dict_dr = { | |
2442 | "f1": {"pim": {"interfaces": {intf_f1_r2: {"drAddress": dr_address}}}} | |
2443 | } | |
2444 | result = verify_pim_config(tgen, input_dict_dr) | |
2445 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2446 | ||
2447 | step("Remove 'no ip pim drpriority' on receiver interface on FRR1") | |
2448 | ||
2449 | raw_config = { | |
2450 | "l1": { | |
2451 | "raw_config": ["interface {}".format(intf_l1_r2), "no ip pim drpriority 10"] | |
2452 | } | |
2453 | } | |
2454 | result = apply_raw_config(tgen, raw_config) | |
2455 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2456 | ||
2457 | step("Remove 'no ip pim drpriority' on receiver interface on FRR3") | |
2458 | ||
2459 | raw_config = { | |
2460 | "f1": { | |
2461 | "raw_config": ["interface {}".format(intf_f1_r2), "no ip pim drpriority 20"] | |
2462 | } | |
2463 | } | |
2464 | result = apply_raw_config(tgen, raw_config) | |
2465 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2466 | ||
2467 | step( | |
2468 | "After removing drpriority , config got removed from both the " | |
2469 | "nodes and highest IP become PIM DR" | |
2470 | ) | |
2471 | ||
2472 | input_dict_dr = {"l1": {"pim": {"interfaces": {intf_l1_r2: {"drPriority": 1}}}}} | |
2473 | result = verify_pim_config(tgen, input_dict_dr) | |
2474 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2475 | ||
2476 | input_dict_dr = {"f1": {"pim": {"interfaces": {intf_f1_r2: {"drPriority": 1}}}}} | |
2477 | result = verify_pim_config(tgen, input_dict_dr) | |
2478 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2479 | ||
2480 | dr_address = topo["routers"]["r2"]["links"]["l1"]["ipv4"].split("/")[0] | |
2481 | input_dict_dr = { | |
2482 | "l1": {"pim": {"interfaces": {intf_l1_r2: {"drAddress": dr_address}}}} | |
2483 | } | |
2484 | result = verify_pim_config(tgen, input_dict_dr) | |
2485 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2486 | ||
2487 | dr_address = topo["routers"]["r2"]["links"]["f1"]["ipv4"].split("/")[0] | |
2488 | input_dict_dr = { | |
2489 | "f1": {"pim": {"interfaces": {intf_f1_r2: {"drAddress": dr_address}}}} | |
2490 | } | |
2491 | result = verify_pim_config(tgen, input_dict_dr) | |
2492 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2493 | ||
2494 | for data in input_dict_all: | |
4fafd29f | 2495 | result = verify_mroutes( |
c9b5d52c | 2496 | tgen, |
2497 | data["dut"], | |
2498 | data["src_address"], | |
2499 | IGMP_JOIN_RANGE_1, | |
2500 | data["iif"], | |
2501 | data["oil"], | |
2502 | ) | |
2503 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2504 | ||
2505 | for data in input_dict_all: | |
2506 | result = verify_upstream_iif( | |
2507 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
2508 | ) | |
2509 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2510 | ||
2511 | write_test_footer(tc_name) | |
2512 | ||
2513 | ||
2514 | def test_pim_hello_timer_p1(request): | |
2515 | """ | |
2516 | TC_37: Verify PIM hello is sent on configured timer | |
2517 | """ | |
2518 | ||
2519 | tgen = get_topogen() | |
2520 | tc_name = request.node.name | |
2521 | write_test_header(tc_name) | |
2522 | ||
8db751b8 CH |
2523 | # Don"t run this test if we have any failure. |
2524 | if tgen.routers_have_failure(): | |
2525 | pytest.skip(tgen.errors) | |
2526 | ||
c9b5d52c | 2527 | # Creating configuration from JSON |
1973df1d | 2528 | app_helper.stop_all_hosts() |
4fafd29f | 2529 | clear_mroute(tgen) |
c9b5d52c | 2530 | reset_config_on_routers(tgen) |
4fafd29f | 2531 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 2532 | check_router_status(tgen) |
2533 | ||
c9b5d52c | 2534 | step("Configure 'ip pim' on receiver interface on FRR1") |
2535 | step("Enable PIM on all routers") | |
2536 | step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)") | |
2537 | ||
2538 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
2539 | ||
2540 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 2541 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 2542 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2543 | ||
2544 | step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)") | |
2545 | ||
2546 | input_dict = { | |
2547 | "r2": { | |
2548 | "pim": { | |
2549 | "rp": [ | |
2550 | { | |
2551 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2552 | "/" | |
2553 | )[0], | |
2554 | "group_addr_range": GROUP_RANGE, | |
2555 | } | |
2556 | ] | |
2557 | } | |
2558 | } | |
2559 | } | |
2560 | ||
2561 | result = create_pim_config(tgen, topo, input_dict) | |
2562 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2563 | ||
2564 | step("Configure PIM hello interval timer 100 on FRR1 node (FRR1-FRR2 link)") | |
2565 | ||
2566 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
2567 | raw_config = { | |
2568 | "l1": {"raw_config": ["interface {}".format(intf_l1_r2), "ip pim hello 100"]} | |
2569 | } | |
2570 | result = apply_raw_config(tgen, raw_config) | |
2571 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2572 | ||
2573 | step( | |
2574 | "PIM hello interval is configured on interface verify using " | |
2575 | "'show ip pim interface'" | |
2576 | ) | |
2577 | ||
2578 | input_dict_hello = { | |
2579 | "l1": {"pim": {"interfaces": {intf_l1_r2: {"helloPeriod": 100}}}} | |
2580 | } | |
2581 | result = verify_pim_config(tgen, input_dict_hello) | |
2582 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2583 | ||
2584 | step("Modify hello timer to 180 and then 50sec") | |
2585 | ||
2586 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
2587 | raw_config = { | |
2588 | "l1": {"raw_config": ["interface {}".format(intf_l1_r2), "ip pim hello 180"]} | |
2589 | } | |
2590 | result = apply_raw_config(tgen, raw_config) | |
2591 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2592 | ||
2593 | step( | |
2594 | "PIM hello interval is configured on interface verify using " | |
2595 | "'show ip pim interface'" | |
2596 | ) | |
2597 | ||
2598 | input_dict_hello = { | |
2599 | "l1": {"pim": {"interfaces": {intf_l1_r2: {"helloPeriod": 180}}}} | |
2600 | } | |
2601 | result = verify_pim_config(tgen, input_dict_hello) | |
2602 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2603 | ||
2604 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
2605 | raw_config = { | |
2606 | "l1": {"raw_config": ["interface {}".format(intf_l1_r2), "ip pim hello 50"]} | |
2607 | } | |
2608 | result = apply_raw_config(tgen, raw_config) | |
2609 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2610 | ||
2611 | step( | |
2612 | "PIM hello interval is configured on interface verify using " | |
2613 | "'show ip pim interface'" | |
2614 | ) | |
2615 | ||
2616 | input_dict_hello = { | |
2617 | "l1": {"pim": {"interfaces": {intf_l1_r2: {"helloPeriod": 50}}}} | |
2618 | } | |
2619 | result = verify_pim_config(tgen, input_dict_hello) | |
2620 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2621 | ||
2622 | step("Verify that no core is observed") | |
2623 | if tgen.routers_have_failure(): | |
2624 | assert False, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2625 | ||
2626 | write_test_footer(tc_name) | |
2627 | ||
2628 | ||
2629 | def test_mroute_after_removing_RP_sending_IGMP_prune_p2(request): | |
2630 | """ | |
2631 | TC_39 Verify mroute after removing the RP and sending IGMP prune | |
2632 | """ | |
2633 | ||
2634 | tgen = get_topogen() | |
2635 | tc_name = request.node.name | |
2636 | write_test_header(tc_name) | |
2637 | ||
8db751b8 CH |
2638 | # Don"t run this test if we have any failure. |
2639 | if tgen.routers_have_failure(): | |
2640 | pytest.skip(tgen.errors) | |
2641 | ||
c9b5d52c | 2642 | # Creating configuration from JSON |
1973df1d | 2643 | app_helper.stop_all_hosts() |
4fafd29f | 2644 | clear_mroute(tgen) |
c9b5d52c | 2645 | reset_config_on_routers(tgen) |
4fafd29f | 2646 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 2647 | check_router_status(tgen) |
2648 | ||
c9b5d52c | 2649 | step( |
2650 | "Remove cisco connected link to simulate topo " | |
2651 | "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))" | |
2652 | ) | |
2653 | ||
2654 | intf_l1_c1 = topo["routers"]["l1"]["links"]["c1"]["interface"] | |
2655 | intf_f1_c2 = topo["routers"]["f1"]["links"]["c2"]["interface"] | |
2656 | shutdown_bringup_interface(tgen, "l1", intf_l1_c1, False) | |
2657 | shutdown_bringup_interface(tgen, "f1", intf_f1_c2, False) | |
2658 | ||
2659 | step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3") | |
2660 | step( | |
2661 | "Enable IGMP of FRR1 interface and send IGMP joins " | |
2662 | " from FRR1 node for group range (225.1.1.1-5)" | |
2663 | ) | |
2664 | ||
2665 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
2666 | input_dict = { | |
a53c08bc CH |
2667 | "f1": { |
2668 | "igmp": { | |
2669 | "interfaces": { | |
2670 | intf_f1_i8: { | |
2671 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
2672 | } | |
2673 | } | |
2674 | } | |
2675 | } | |
c9b5d52c | 2676 | } |
2677 | result = create_igmp_config(tgen, topo, input_dict) | |
2678 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2679 | ||
2680 | input_join = {"i8": topo["routers"]["i8"]["links"]["f1"]["interface"]} | |
2681 | ||
2682 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 2683 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 2684 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2685 | ||
2686 | step("Configure static RP for (225.1.1.1-5) as R2") | |
2687 | ||
2688 | input_dict = { | |
2689 | "r2": { | |
2690 | "pim": { | |
2691 | "rp": [ | |
2692 | { | |
2693 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2694 | "/" | |
2695 | )[0], | |
2696 | "group_addr_range": GROUP_RANGE, | |
2697 | } | |
2698 | ] | |
2699 | } | |
2700 | } | |
2701 | } | |
2702 | ||
2703 | result = create_pim_config(tgen, topo, input_dict) | |
2704 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2705 | ||
2706 | step( | |
2707 | "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send" | |
2708 | " multicast traffic" | |
2709 | ) | |
2710 | ||
2711 | input_src = {"i6": topo["routers"]["i6"]["links"]["l1"]["interface"]} | |
2712 | ||
2713 | for src, src_intf in input_src.items(): | |
1973df1d | 2714 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 2715 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
2716 | ||
2717 | source_i2 = topo["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0] | |
2718 | ||
2719 | input_dict_all = [ | |
2720 | { | |
2721 | "dut": "l1", | |
2722 | "src_address": source_i2, | |
2723 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
2724 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
2725 | }, | |
2726 | { | |
2727 | "dut": "f1", | |
2728 | "src_address": "*", | |
2729 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
2730 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
2731 | }, | |
2732 | { | |
2733 | "dut": "f1", | |
2734 | "src_address": source_i2, | |
2735 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
2736 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
2737 | }, | |
2738 | ] | |
2739 | ||
2740 | step("Verify mroutes and iff upstream") | |
2741 | ||
2742 | for data in input_dict_all: | |
4fafd29f | 2743 | result = verify_mroutes( |
c9b5d52c | 2744 | tgen, |
2745 | data["dut"], | |
2746 | data["src_address"], | |
2747 | IGMP_JOIN_RANGE_1, | |
2748 | data["iif"], | |
2749 | data["oil"], | |
2750 | ) | |
2751 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2752 | ||
2753 | for data in input_dict_all: | |
2754 | result = verify_upstream_iif( | |
2755 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
2756 | ) | |
2757 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2758 | ||
2759 | step("Remove the RP config for both the range from all the nodes") | |
2760 | ||
2761 | input_dict = { | |
2762 | "r2": { | |
2763 | "pim": { | |
2764 | "rp": [ | |
2765 | { | |
2766 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2767 | "/" | |
2768 | )[0], | |
2769 | "group_addr_range": GROUP_RANGE, | |
2770 | "delete": True, | |
2771 | } | |
2772 | ] | |
2773 | } | |
2774 | } | |
2775 | } | |
2776 | ||
2777 | result = create_pim_config(tgen, topo, input_dict) | |
2778 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2779 | ||
2780 | input_dict_starg = [ | |
2781 | { | |
2782 | "dut": "f1", | |
2783 | "src_address": "*", | |
2784 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
2785 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
2786 | } | |
2787 | ] | |
2788 | ||
2789 | input_dict_sg = [ | |
2790 | { | |
2791 | "dut": "l1", | |
2792 | "src_address": source_i2, | |
2793 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
2794 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
2795 | }, | |
2796 | { | |
2797 | "dut": "f1", | |
2798 | "src_address": source_i2, | |
2799 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
2800 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
2801 | }, | |
2802 | ] | |
2803 | ||
2804 | for data in input_dict_starg: | |
4fafd29f | 2805 | result = verify_mroutes( |
c9b5d52c | 2806 | tgen, |
2807 | data["dut"], | |
2808 | data["src_address"], | |
2809 | IGMP_JOIN_RANGE_1, | |
2810 | data["iif"], | |
2811 | data["oil"], | |
2812 | expected=False, | |
2813 | ) | |
5980ad0a DS |
2814 | assert ( |
2815 | result is not True | |
2816 | ), "Testcase {} : Failed \n " "mroute still present \n Error: {}".format( | |
2817 | tc_name, result | |
c9b5d52c | 2818 | ) |
2819 | logger.info("Expected Behaviour: {}".format(result)) | |
2820 | ||
2821 | for data in input_dict_sg: | |
4fafd29f | 2822 | result = verify_mroutes( |
c9b5d52c | 2823 | tgen, |
2824 | data["dut"], | |
2825 | data["src_address"], | |
2826 | IGMP_JOIN_RANGE_1, | |
2827 | data["iif"], | |
2828 | data["oil"], | |
2829 | ) | |
2830 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2831 | ||
2832 | step("Send prune from receiver-1 (using ctrl+c) on iperf interface") | |
1973df1d | 2833 | app_helper.stop_all_hosts() |
c9b5d52c | 2834 | |
2835 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
2836 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
184ab61e | 2837 | traffic_before = verify_multicast_traffic(tgen, input_traffic, return_traffic=True) |
c9b5d52c | 2838 | assert isinstance(traffic_before, dict), ( |
2839 | "Testcase {} : Failed \n traffic_before is not dictionary \n " | |
2840 | "Error: {}".format(tc_name, result) | |
2841 | ) | |
2842 | ||
2843 | step("IGMP groups are remove from FRR1 node 'show ip igmp groups'") | |
2844 | ||
2845 | dut = "f1" | |
2846 | result = verify_igmp_groups( | |
2847 | tgen, dut, intf_f1_i8, IGMP_JOIN_RANGE_1, expected=False | |
2848 | ) | |
2849 | assert result is not True, ( | |
2850 | "Testcase {} : Failed \n " | |
2851 | "IGMP groups still present still present \n Error: {}".format(tc_name, result) | |
2852 | ) | |
2853 | logger.info("Expected Behaviour: {}".format(result)) | |
2854 | ||
2855 | step( | |
2856 | "After receiving the IGMP prune from FRR1 , verify traffic " | |
2857 | "immediately stopped for this receiver 'show ip multicast'" | |
2858 | ) | |
2859 | ||
2860 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
2861 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
184ab61e | 2862 | traffic_after = verify_multicast_traffic(tgen, input_traffic, return_traffic=True) |
c9b5d52c | 2863 | assert isinstance(traffic_after, dict), ( |
2864 | "Testcase {} : Failed \n traffic_after is not dictionary \n " | |
2865 | "Error: {}".format(tc_name, result) | |
2866 | ) | |
2867 | ||
2868 | result = verify_state_incremented(traffic_before, traffic_after) | |
2869 | assert result is not True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2870 | logger.info("Expected Behaviour: {}".format(result)) | |
2871 | ||
2872 | step("Configure static RP for (225.1.1.1-5) as R2 loopback interface") | |
2873 | ||
2874 | input_dict = { | |
2875 | "r2": { | |
2876 | "pim": { | |
2877 | "rp": [ | |
2878 | { | |
2879 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2880 | "/" | |
2881 | )[0], | |
2882 | "group_addr_range": GROUP_RANGE, | |
2883 | } | |
2884 | ] | |
2885 | } | |
2886 | } | |
2887 | } | |
2888 | ||
2889 | result = create_pim_config(tgen, topo, input_dict) | |
2890 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2891 | ||
2892 | step("Send IGMP joins again from LHR,check IGMP joins and starg received") | |
2893 | ||
2894 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 2895 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 2896 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2897 | ||
2898 | for data in input_dict_starg: | |
4fafd29f | 2899 | result = verify_mroutes( |
c9b5d52c | 2900 | tgen, |
2901 | data["dut"], | |
2902 | data["src_address"], | |
2903 | IGMP_JOIN_RANGE_1, | |
2904 | data["iif"], | |
2905 | data["oil"], | |
2906 | ) | |
2907 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2908 | ||
2909 | step("Send traffic from FHR and verify mroute upstream") | |
2910 | ||
2911 | for src, src_intf in input_src.items(): | |
1973df1d | 2912 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 2913 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
2914 | ||
2915 | source_i2 = topo["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0] | |
2916 | ||
2917 | for data in input_dict_sg: | |
4fafd29f | 2918 | result = verify_mroutes( |
c9b5d52c | 2919 | tgen, |
2920 | data["dut"], | |
2921 | data["src_address"], | |
2922 | IGMP_JOIN_RANGE_1, | |
2923 | data["iif"], | |
2924 | data["oil"], | |
2925 | ) | |
2926 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
2927 | ||
2928 | write_test_footer(tc_name) | |
2929 | ||
2930 | ||
2931 | def test_prune_sent_to_LHR_and_FHR_when_PIMnbr_down_p2(request): | |
2932 | """ | |
2933 | TC_38 Verify prune is sent to LHR and FHR when PIM nbr went down | |
2934 | """ | |
2935 | ||
2936 | tgen = get_topogen() | |
2937 | tc_name = request.node.name | |
2938 | write_test_header(tc_name) | |
2939 | ||
8db751b8 CH |
2940 | # Don"t run this test if we have any failure. |
2941 | if tgen.routers_have_failure(): | |
2942 | pytest.skip(tgen.errors) | |
2943 | ||
c9b5d52c | 2944 | # Creating configuration from JSON |
1973df1d | 2945 | app_helper.stop_all_hosts() |
4fafd29f | 2946 | clear_mroute(tgen) |
c9b5d52c | 2947 | reset_config_on_routers(tgen) |
4fafd29f | 2948 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 2949 | check_router_status(tgen) |
2950 | ||
c9b5d52c | 2951 | step( |
2952 | "Remove cisco connected link to simulate topo " | |
2953 | "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))" | |
2954 | ) | |
2955 | ||
2956 | intf_l1_c1 = topo["routers"]["l1"]["links"]["c1"]["interface"] | |
2957 | intf_f1_c2 = topo["routers"]["f1"]["links"]["c2"]["interface"] | |
2958 | shutdown_bringup_interface(tgen, "l1", intf_l1_c1, False) | |
2959 | shutdown_bringup_interface(tgen, "f1", intf_f1_c2, False) | |
2960 | ||
2961 | step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3") | |
2962 | step( | |
2963 | "Enable IGMP of FRR1 interface and send IGMP joins " | |
2964 | " from FRR1 node for group range (225.1.1.1-5)" | |
2965 | ) | |
2966 | ||
2967 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
2968 | input_dict = { | |
a53c08bc CH |
2969 | "f1": { |
2970 | "igmp": { | |
2971 | "interfaces": { | |
2972 | intf_f1_i8: { | |
2973 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
2974 | } | |
2975 | } | |
2976 | } | |
2977 | } | |
c9b5d52c | 2978 | } |
2979 | result = create_igmp_config(tgen, topo, input_dict) | |
2980 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
2981 | ||
2982 | input_join = {"i8": topo["routers"]["i8"]["links"]["f1"]["interface"]} | |
2983 | ||
2984 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 2985 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 2986 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
2987 | ||
2988 | step("Configure static RP for (225.1.1.1-5) as R2") | |
2989 | ||
2990 | input_dict = { | |
2991 | "r2": { | |
2992 | "pim": { | |
2993 | "rp": [ | |
2994 | { | |
2995 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
2996 | "/" | |
2997 | )[0], | |
2998 | "group_addr_range": GROUP_RANGE, | |
2999 | } | |
3000 | ] | |
3001 | } | |
3002 | } | |
3003 | } | |
3004 | ||
3005 | result = create_pim_config(tgen, topo, input_dict) | |
3006 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3007 | ||
3008 | step( | |
3009 | "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send" | |
3010 | " multicast traffic" | |
3011 | ) | |
3012 | ||
3013 | input_src = { | |
3014 | "i6": topo["routers"]["i6"]["links"]["l1"]["interface"], | |
3015 | "i2": topo["routers"]["i2"]["links"]["f1"]["interface"], | |
3016 | } | |
3017 | ||
3018 | for src, src_intf in input_src.items(): | |
1973df1d | 3019 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 3020 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
3021 | ||
3022 | source_i2 = topo["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0] | |
3023 | source_i1 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
3024 | ||
3025 | input_dict_all = [ | |
3026 | { | |
3027 | "dut": "l1", | |
3028 | "src_address": source_i2, | |
3029 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
3030 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
3031 | }, | |
3032 | { | |
3033 | "dut": "f1", | |
3034 | "src_address": "*", | |
3035 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
3036 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3037 | }, | |
3038 | { | |
3039 | "dut": "f1", | |
3040 | "src_address": source_i1, | |
3041 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
3042 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3043 | }, | |
3044 | { | |
3045 | "dut": "f1", | |
3046 | "src_address": source_i2, | |
3047 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
3048 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3049 | }, | |
3050 | ] | |
3051 | ||
3052 | step("Verify mroutes and iff upstream") | |
3053 | ||
3054 | for data in input_dict_all: | |
4fafd29f | 3055 | result = verify_mroutes( |
c9b5d52c | 3056 | tgen, |
3057 | data["dut"], | |
3058 | data["src_address"], | |
3059 | IGMP_JOIN_RANGE_1, | |
3060 | data["iif"], | |
3061 | data["oil"], | |
3062 | ) | |
3063 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3064 | ||
3065 | for data in input_dict_all: | |
3066 | result = verify_upstream_iif( | |
3067 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3068 | ) | |
3069 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3070 | step("Verify mcast traffic received") | |
3071 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
3072 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
3073 | ||
3074 | result = verify_multicast_traffic(tgen, input_traffic) | |
3075 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3076 | ||
3077 | step("Shut the link from LHR to RP from RP node") | |
3078 | ||
3079 | intf_r2_f1 = topo["routers"]["r2"]["links"]["f1"]["interface"] | |
3080 | shutdown_bringup_interface(tgen, "r2", intf_r2_f1, False) | |
3081 | ||
3082 | step("Verify RP info after Shut the link from LHR to RP from RP node") | |
3083 | dut = "f1" | |
3084 | rp_address = "1.0.5.17" | |
3085 | SOURCE = "Static" | |
3086 | result = verify_pim_rp_info( | |
3087 | tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE | |
3088 | ) | |
3089 | assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) | |
3090 | ||
3091 | input_dict_starg = [ | |
3092 | { | |
3093 | "dut": "f1", | |
3094 | "src_address": "*", | |
3095 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
3096 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3097 | } | |
3098 | ] | |
3099 | ||
3100 | input_dict_sg_i2 = [ | |
3101 | { | |
3102 | "dut": "l1", | |
3103 | "src_address": source_i2, | |
3104 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
3105 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
3106 | }, | |
3107 | { | |
3108 | "dut": "f1", | |
3109 | "src_address": source_i2, | |
3110 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
3111 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3112 | }, | |
3113 | ] | |
3114 | ||
3115 | input_dict_sg_i1 = [ | |
3116 | { | |
3117 | "dut": "f1", | |
3118 | "src_address": source_i1, | |
3119 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
3120 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3121 | } | |
3122 | ] | |
3123 | ||
3124 | input_dict_sg_i2_l1 = [ | |
3125 | { | |
3126 | "dut": "l1", | |
3127 | "src_address": source_i2, | |
3128 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
3129 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
3130 | } | |
3131 | ] | |
3132 | ||
3133 | step("Verify mroute after Shut the link from LHR to RP from RP node") | |
3134 | ||
3135 | for data in input_dict_starg: | |
4fafd29f | 3136 | result = verify_mroutes( |
c9b5d52c | 3137 | tgen, |
3138 | data["dut"], | |
3139 | data["src_address"], | |
3140 | IGMP_JOIN_RANGE_1, | |
3141 | data["iif"], | |
3142 | data["oil"], | |
3143 | expected=False, | |
3144 | ) | |
5980ad0a DS |
3145 | assert ( |
3146 | result is not True | |
3147 | ), "Testcase {} : Failed \n " "mroute still present \n Error: {}".format( | |
3148 | tc_name, result | |
c9b5d52c | 3149 | ) |
3150 | logger.info("Expected Behaviour: {}".format(result)) | |
3151 | ||
3152 | for data in input_dict_sg_i1: | |
4fafd29f | 3153 | result = verify_mroutes( |
c9b5d52c | 3154 | tgen, |
3155 | data["dut"], | |
3156 | data["src_address"], | |
3157 | IGMP_JOIN_RANGE_1, | |
3158 | data["iif"], | |
3159 | data["oil"], | |
3160 | ) | |
3161 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3162 | ||
3163 | step("Verify upstream after Shut the link from LHR to RP from RP node") | |
3164 | ||
3165 | for data in input_dict_starg: | |
3166 | result = verify_upstream_iif( | |
3167 | tgen, | |
3168 | data["dut"], | |
3169 | data["iif"], | |
3170 | data["src_address"], | |
3171 | IGMP_JOIN_RANGE_1, | |
3172 | expected=False, | |
3173 | ) | |
5980ad0a DS |
3174 | assert ( |
3175 | result is not True | |
3176 | ), "Testcase {} : Failed \n " "upstream still present \n Error: {}".format( | |
3177 | tc_name, result | |
c9b5d52c | 3178 | ) |
3179 | logger.info("Expected Behaviour: {}".format(result)) | |
3180 | ||
3181 | for data in input_dict_sg_i1: | |
3182 | result = verify_upstream_iif( | |
3183 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3184 | ) | |
3185 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3186 | ||
3187 | step("No shut the link from LHR to RP from RP node") | |
3188 | ||
3189 | intf_r2_f1 = topo["routers"]["r2"]["links"]["f1"]["interface"] | |
3190 | shutdown_bringup_interface(tgen, "r2", intf_r2_f1, True) | |
3191 | ||
3192 | step("Verify RP info after No shut the link from LHR to RP from RP node") | |
3193 | dut = "f1" | |
3194 | rp_address = "1.0.5.17" | |
3195 | SOURCE = "Static" | |
3196 | result = verify_pim_rp_info( | |
3197 | tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE, expected=False | |
3198 | ) | |
5980ad0a DS |
3199 | assert ( |
3200 | result is not True | |
3201 | ), "Testcase {} : Failed \n " "RP iif is not updated \n Error: {}".format( | |
3202 | tc_name, result | |
c9b5d52c | 3203 | ) |
3204 | logger.info("Expected Behaviour: {}".format(result)) | |
3205 | ||
3206 | step("Verify mroute after No shut the link from LHR to RP from RP node") | |
3207 | ||
3208 | for data in input_dict_starg: | |
4fafd29f | 3209 | result = verify_mroutes( |
c9b5d52c | 3210 | tgen, |
3211 | data["dut"], | |
3212 | data["src_address"], | |
3213 | IGMP_JOIN_RANGE_1, | |
3214 | data["iif"], | |
3215 | data["oil"], | |
3216 | ) | |
3217 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3218 | ||
3219 | for data in input_dict_sg_i2: | |
4fafd29f | 3220 | result = verify_mroutes( |
c9b5d52c | 3221 | tgen, |
3222 | data["dut"], | |
3223 | data["src_address"], | |
3224 | IGMP_JOIN_RANGE_1, | |
3225 | data["iif"], | |
3226 | data["oil"], | |
3227 | ) | |
3228 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3229 | ||
3230 | for data in input_dict_sg_i1: | |
4fafd29f | 3231 | result = verify_mroutes( |
c9b5d52c | 3232 | tgen, |
3233 | data["dut"], | |
3234 | data["src_address"], | |
3235 | IGMP_JOIN_RANGE_1, | |
3236 | data["iif"], | |
3237 | data["oil"], | |
3238 | ) | |
3239 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3240 | ||
3241 | step("Verify upstrem after No shut the link from LHR to RP from RP node") | |
3242 | ||
3243 | for data in input_dict_starg: | |
3244 | result = verify_upstream_iif( | |
3245 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3246 | ) | |
3247 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3248 | ||
3249 | for data in input_dict_sg_i1: | |
3250 | result = verify_upstream_iif( | |
3251 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3252 | ) | |
3253 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3254 | ||
3255 | for data in input_dict_sg_i2: | |
3256 | result = verify_upstream_iif( | |
3257 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3258 | ) | |
3259 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3260 | ||
3261 | step("Verify mcast traffic received after noshut LHR to RP from RP node") | |
3262 | ||
3263 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
3264 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
3265 | result = verify_multicast_traffic(tgen, input_traffic) | |
3266 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3267 | ||
3268 | step("Shut the link from FHR to RP from RP node") | |
3269 | ||
3270 | intf_r2_l1 = topo["routers"]["r2"]["links"]["l1"]["interface"] | |
3271 | shutdown_bringup_interface(tgen, "r2", intf_r2_l1, False) | |
3272 | ||
c9b5d52c | 3273 | step("Verify RP info after Shut the link from FHR to RP from RP node") |
3274 | dut = "l1" | |
3275 | rp_address = "1.0.5.17" | |
3276 | SOURCE = "Static" | |
3277 | result = verify_pim_rp_info( | |
3278 | tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE | |
3279 | ) | |
3280 | assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) | |
3281 | ||
3282 | step("Verify mroute after Shut the link from FHR to RP from RP node") | |
3283 | ||
3284 | for data in input_dict_starg: | |
4fafd29f | 3285 | result = verify_mroutes( |
c9b5d52c | 3286 | tgen, |
3287 | data["dut"], | |
3288 | data["src_address"], | |
3289 | IGMP_JOIN_RANGE_1, | |
3290 | data["iif"], | |
3291 | data["oil"], | |
3292 | ) | |
3293 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3294 | ||
3295 | for data in input_dict_sg_i1: | |
4fafd29f | 3296 | result = verify_mroutes( |
c9b5d52c | 3297 | tgen, |
3298 | data["dut"], | |
3299 | data["src_address"], | |
3300 | IGMP_JOIN_RANGE_1, | |
3301 | data["iif"], | |
3302 | data["oil"], | |
3303 | ) | |
3304 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3305 | ||
3306 | step("Verify upstream after Shut the link from FHR to RP from RP node") | |
3307 | ||
3308 | for data in input_dict_starg: | |
3309 | result = verify_upstream_iif( | |
3310 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3311 | ) | |
3312 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3313 | ||
3314 | for data in input_dict_sg_i1: | |
3315 | result = verify_upstream_iif( | |
3316 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3317 | ) | |
3318 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3319 | ||
3320 | for data in input_dict_sg_i2_l1: | |
3321 | result = verify_upstream_iif( | |
3322 | tgen, | |
3323 | data["dut"], | |
3324 | data["iif"], | |
3325 | data["src_address"], | |
3326 | IGMP_JOIN_RANGE_1, | |
3327 | expected=False, | |
3328 | ) | |
0b25370e DS |
3329 | assert result is not True, ( |
3330 | "Testcase {} : Failed \n " | |
5cbb02eb | 3331 | "upstream is still present after shut the link from " |
0b25370e DS |
3332 | "FHR to RP from RP node \n Error: {}".format(tc_name, result) |
3333 | ) | |
c9b5d52c | 3334 | |
3335 | step(" No shut the link from FHR to RP from RP node") | |
3336 | ||
3337 | intf_r2_l1 = topo["routers"]["r2"]["links"]["l1"]["interface"] | |
3338 | shutdown_bringup_interface(tgen, "r2", intf_r2_l1, True) | |
3339 | ||
3340 | step("Verify RP info after Noshut the link from FHR to RP from RP node") | |
3341 | ||
3342 | dut = "l1" | |
3343 | rp_address = "1.0.5.17" | |
3344 | SOURCE = "Static" | |
3345 | result = verify_pim_rp_info( | |
3346 | tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE, expected=False | |
3347 | ) | |
5980ad0a DS |
3348 | assert ( |
3349 | result is not True | |
3350 | ), "Testcase {} : Failed \n " "RP iif is not updated \n Error: {}".format( | |
3351 | tc_name, result | |
c9b5d52c | 3352 | ) |
3353 | logger.info("Expected Behaviour: {}".format(result)) | |
3354 | ||
3355 | step("Verify mroute after Noshut the link from FHR to RP from RP node") | |
3356 | ||
3357 | for data in input_dict_starg: | |
4fafd29f | 3358 | result = verify_mroutes( |
c9b5d52c | 3359 | tgen, |
3360 | data["dut"], | |
3361 | data["src_address"], | |
3362 | IGMP_JOIN_RANGE_1, | |
3363 | data["iif"], | |
3364 | data["oil"], | |
3365 | ) | |
3366 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3367 | ||
3368 | for data in input_dict_sg_i2: | |
4fafd29f | 3369 | result = verify_mroutes( |
c9b5d52c | 3370 | tgen, |
3371 | data["dut"], | |
3372 | data["src_address"], | |
3373 | IGMP_JOIN_RANGE_1, | |
3374 | data["iif"], | |
3375 | data["oil"], | |
3376 | ) | |
3377 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3378 | ||
3379 | for data in input_dict_sg_i1: | |
4fafd29f | 3380 | result = verify_mroutes( |
c9b5d52c | 3381 | tgen, |
3382 | data["dut"], | |
3383 | data["src_address"], | |
3384 | IGMP_JOIN_RANGE_1, | |
3385 | data["iif"], | |
3386 | data["oil"], | |
3387 | ) | |
3388 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3389 | ||
3390 | step("Verify mroute after Noshut the link from FHR to RP from RP node") | |
3391 | ||
3392 | for data in input_dict_starg: | |
3393 | result = verify_upstream_iif( | |
3394 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3395 | ) | |
3396 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3397 | ||
3398 | for data in input_dict_sg_i1: | |
3399 | result = verify_upstream_iif( | |
3400 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3401 | ) | |
3402 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3403 | ||
3404 | for data in input_dict_sg_i2: | |
3405 | result = verify_upstream_iif( | |
3406 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3407 | ) | |
3408 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3409 | ||
3410 | step("Verify mcast traffic received after noshut FHR to RP from RP node") | |
3411 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
3412 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
3413 | result = verify_multicast_traffic(tgen, input_traffic) | |
3414 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3415 | ||
3416 | step("Shut the link from FHR to RP from FHR node") | |
3417 | ||
3418 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
3419 | shutdown_bringup_interface(tgen, "l1", intf_l1_r2, False) | |
3420 | ||
3421 | step("Verify PIM Nbrs after Shut the link from FHR to RP from FHR node") | |
3422 | ||
c9b5d52c | 3423 | step("Verify RP info after Shut the link from FHR to RP from FHR node") |
3424 | dut = "l1" | |
3425 | rp_address = "1.0.5.17" | |
3426 | SOURCE = "Static" | |
3427 | result = verify_pim_rp_info( | |
3428 | tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE | |
3429 | ) | |
3430 | assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) | |
3431 | ||
3432 | step("Verify mroute after Shut the link from FHR to RP from FHR node") | |
3433 | ||
3434 | for data in input_dict_starg: | |
4fafd29f | 3435 | result = verify_mroutes( |
c9b5d52c | 3436 | tgen, |
3437 | data["dut"], | |
3438 | data["src_address"], | |
3439 | IGMP_JOIN_RANGE_1, | |
3440 | data["iif"], | |
3441 | data["oil"], | |
3442 | ) | |
3443 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3444 | ||
3445 | for data in input_dict_sg_i1: | |
4fafd29f | 3446 | result = verify_mroutes( |
c9b5d52c | 3447 | tgen, |
3448 | data["dut"], | |
3449 | data["src_address"], | |
3450 | IGMP_JOIN_RANGE_1, | |
3451 | data["iif"], | |
3452 | data["oil"], | |
3453 | ) | |
3454 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3455 | ||
3456 | step("Verify upstream after Shut the link from FHR to RP from FHR node") | |
3457 | for data in input_dict_starg: | |
3458 | result = verify_upstream_iif( | |
3459 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3460 | ) | |
3461 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3462 | ||
3463 | for data in input_dict_sg_i1: | |
3464 | result = verify_upstream_iif( | |
3465 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3466 | ) | |
3467 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3468 | ||
3469 | for data in input_dict_sg_i2_l1: | |
3470 | result = verify_upstream_iif( | |
3471 | tgen, | |
3472 | data["dut"], | |
3473 | data["iif"], | |
3474 | data["src_address"], | |
3475 | IGMP_JOIN_RANGE_1, | |
3476 | expected=False, | |
3477 | ) | |
0b25370e DS |
3478 | assert result is not True, ( |
3479 | "Testcase {} : Failed \n " | |
5cbb02eb | 3480 | "upstream is still present after shut the link from " |
0b25370e DS |
3481 | "FHR to RP from FHR node \n Error: {}".format(tc_name, result) |
3482 | ) | |
c9b5d52c | 3483 | |
3484 | step(" No shut the link from FHR to RP from FHR node") | |
3485 | ||
3486 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
3487 | shutdown_bringup_interface(tgen, "l1", intf_l1_r2, True) | |
3488 | ||
3489 | step("Verify RP info after No Shut the link from FHR to RP from FHR node") | |
3490 | dut = "l1" | |
3491 | rp_address = "1.0.5.17" | |
3492 | SOURCE = "Static" | |
3493 | result = verify_pim_rp_info( | |
3494 | tgen, topo, dut, GROUP_RANGE_1, "Unknown", rp_address, SOURCE, expected=False | |
3495 | ) | |
5980ad0a DS |
3496 | assert ( |
3497 | result is not True | |
3498 | ), "Testcase {} : Failed \n " "RP iif is not updated \n Error: {}".format( | |
3499 | tc_name, result | |
c9b5d52c | 3500 | ) |
3501 | logger.info("Expected Behaviour: {}".format(result)) | |
3502 | ||
3503 | step("Verify mroute after No Shut the link from FHR to RP from FHR node") | |
3504 | ||
3505 | for data in input_dict_starg: | |
4fafd29f | 3506 | result = verify_mroutes( |
c9b5d52c | 3507 | tgen, |
3508 | data["dut"], | |
3509 | data["src_address"], | |
3510 | IGMP_JOIN_RANGE_1, | |
3511 | data["iif"], | |
3512 | data["oil"], | |
3513 | ) | |
3514 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3515 | ||
3516 | for data in input_dict_sg_i2: | |
4fafd29f | 3517 | result = verify_mroutes( |
c9b5d52c | 3518 | tgen, |
3519 | data["dut"], | |
3520 | data["src_address"], | |
3521 | IGMP_JOIN_RANGE_1, | |
3522 | data["iif"], | |
3523 | data["oil"], | |
3524 | ) | |
3525 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3526 | ||
3527 | for data in input_dict_sg_i1: | |
4fafd29f | 3528 | result = verify_mroutes( |
c9b5d52c | 3529 | tgen, |
3530 | data["dut"], | |
3531 | data["src_address"], | |
3532 | IGMP_JOIN_RANGE_1, | |
3533 | data["iif"], | |
3534 | data["oil"], | |
3535 | ) | |
3536 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3537 | ||
3538 | step("Verify upstream after No Shut the link from FHR to RP from FHR node") | |
3539 | ||
3540 | for data in input_dict_starg: | |
3541 | result = verify_upstream_iif( | |
3542 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3543 | ) | |
3544 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3545 | ||
3546 | for data in input_dict_sg_i1: | |
3547 | result = verify_upstream_iif( | |
3548 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3549 | ) | |
3550 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3551 | ||
3552 | for data in input_dict_sg_i2: | |
3553 | result = verify_upstream_iif( | |
3554 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3555 | ) | |
3556 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3557 | ||
3558 | step("Verify mcast traffic received after noshut FHR to RP from FHR node") | |
3559 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
3560 | input_traffic = {"f1": {"traffic_sent": [intf_f1_i8]}} | |
3561 | result = verify_multicast_traffic(tgen, input_traffic) | |
3562 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3563 | ||
3564 | write_test_footer(tc_name) | |
3565 | ||
3566 | ||
3567 | def test_mroute_flags_p1(request): | |
3568 | """ | |
3569 | TC_47 Verify mroute flag in LHR and FHR node | |
3570 | """ | |
3571 | ||
3572 | tgen = get_topogen() | |
3573 | tc_name = request.node.name | |
3574 | write_test_header(tc_name) | |
3575 | ||
8db751b8 CH |
3576 | # Don"t run this test if we have any failure. |
3577 | if tgen.routers_have_failure(): | |
3578 | pytest.skip(tgen.errors) | |
3579 | ||
c9b5d52c | 3580 | # Creating configuration from JSON |
1973df1d | 3581 | app_helper.stop_all_hosts() |
4fafd29f | 3582 | clear_mroute(tgen) |
c9b5d52c | 3583 | reset_config_on_routers(tgen) |
4fafd29f | 3584 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 3585 | check_router_status(tgen) |
3586 | ||
c9b5d52c | 3587 | step( |
3588 | "Remove cisco connected link to simulate topo " | |
3589 | "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))" | |
3590 | ) | |
3591 | ||
3592 | intf_l1_c1 = topo["routers"]["l1"]["links"]["c1"]["interface"] | |
3593 | intf_f1_c2 = topo["routers"]["f1"]["links"]["c2"]["interface"] | |
3594 | shutdown_bringup_interface(tgen, "l1", intf_l1_c1, False) | |
3595 | shutdown_bringup_interface(tgen, "f1", intf_f1_c2, False) | |
3596 | ||
3597 | step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3") | |
3598 | step( | |
3599 | "Enable IGMP of FRR1 interface and send IGMP joins " | |
3600 | " from FRR1 node for group range (225.1.1.1-5)" | |
3601 | ) | |
3602 | ||
3603 | intf_f1_i8 = topo["routers"]["f1"]["links"]["i8"]["interface"] | |
3604 | input_dict = { | |
a53c08bc CH |
3605 | "f1": { |
3606 | "igmp": { | |
3607 | "interfaces": { | |
3608 | intf_f1_i8: { | |
3609 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
3610 | } | |
3611 | } | |
3612 | } | |
3613 | } | |
c9b5d52c | 3614 | } |
3615 | result = create_igmp_config(tgen, topo, input_dict) | |
3616 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
3617 | ||
3618 | input_join = {"i8": topo["routers"]["i8"]["links"]["f1"]["interface"]} | |
3619 | ||
3620 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 3621 | result = app_helper.run_join(recvr, IGMP_JOIN_RANGE_1, join_intf=recvr_intf) |
c9b5d52c | 3622 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
3623 | ||
3624 | step("Configure static RP for (225.1.1.1-5) as R2") | |
3625 | ||
3626 | input_dict = { | |
3627 | "r2": { | |
3628 | "pim": { | |
3629 | "rp": [ | |
3630 | { | |
3631 | "rp_addr": topo["routers"]["r2"]["links"]["lo"]["ipv4"].split( | |
3632 | "/" | |
3633 | )[0], | |
3634 | "group_addr_range": GROUP_RANGE, | |
3635 | } | |
3636 | ] | |
3637 | } | |
3638 | } | |
3639 | } | |
3640 | ||
3641 | result = create_pim_config(tgen, topo, input_dict) | |
3642 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3643 | ||
3644 | step( | |
3645 | "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send" | |
3646 | " multicast traffic" | |
3647 | ) | |
3648 | ||
3649 | input_src = { | |
3650 | "i6": topo["routers"]["i6"]["links"]["l1"]["interface"], | |
3651 | "i2": topo["routers"]["i2"]["links"]["f1"]["interface"], | |
3652 | } | |
3653 | ||
3654 | for src, src_intf in input_src.items(): | |
1973df1d | 3655 | result = app_helper.run_traffic(src, IGMP_JOIN_RANGE_1, bind_intf=src_intf) |
c9b5d52c | 3656 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
3657 | ||
3658 | source_i2 = topo["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0] | |
3659 | source_i1 = topo["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0] | |
3660 | ||
3661 | input_dict_all = [ | |
3662 | { | |
3663 | "dut": "l1", | |
3664 | "src_address": source_i2, | |
3665 | "iif": topo["routers"]["l1"]["links"]["i6"]["interface"], | |
3666 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
3667 | }, | |
3668 | { | |
3669 | "dut": "f1", | |
3670 | "src_address": "*", | |
3671 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
3672 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3673 | }, | |
3674 | { | |
3675 | "dut": "f1", | |
3676 | "src_address": source_i1, | |
3677 | "iif": topo["routers"]["f1"]["links"]["i2"]["interface"], | |
3678 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3679 | }, | |
3680 | { | |
3681 | "dut": "f1", | |
3682 | "src_address": source_i2, | |
3683 | "iif": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
3684 | "oil": topo["routers"]["f1"]["links"]["i8"]["interface"], | |
3685 | }, | |
3686 | ] | |
3687 | ||
3688 | step("Verify mroutes and iff upstream") | |
3689 | ||
3690 | for data in input_dict_all: | |
4fafd29f | 3691 | result = verify_mroutes( |
c9b5d52c | 3692 | tgen, |
3693 | data["dut"], | |
3694 | data["src_address"], | |
3695 | IGMP_JOIN_RANGE_1, | |
3696 | data["iif"], | |
3697 | data["oil"], | |
3698 | ) | |
3699 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3700 | ||
3701 | result = verify_upstream_iif( | |
3702 | tgen, data["dut"], data["iif"], data["src_address"], IGMP_JOIN_RANGE_1 | |
3703 | ) | |
3704 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3705 | ||
3706 | dut = "f1" | |
3707 | step("verify flag for (*,G) on f1") | |
3708 | src_address = "*" | |
3709 | flag = "SC" | |
3710 | result = verify_multicast_flag_state( | |
3711 | tgen, dut, src_address, IGMP_JOIN_RANGE_1, flag | |
3712 | ) | |
3713 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3714 | ||
3715 | step("verify flag for (S,G) on f1 for Remote spurce ") | |
3716 | src_address = source_i2 | |
3717 | flag = "ST" | |
3718 | result = verify_multicast_flag_state( | |
3719 | tgen, dut, src_address, IGMP_JOIN_RANGE_1, flag | |
3720 | ) | |
3721 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3722 | ||
3723 | write_test_footer(tc_name) | |
3724 | ||
3725 | ||
3726 | def test_verify_multicast_traffic_when_LHR_connected_to_RP_p1(request): | |
3727 | """ | |
3728 | TC_11: Verify multicast traffic flowing fine, when LHR connected to RP | |
3729 | Topology used: | |
3730 | FHR(FRR3(l1))---LHR(FRR1(r2)----RP(FRR2(f1)) | |
3731 | """ | |
3732 | ||
3733 | tgen = get_topogen() | |
3734 | tc_name = request.node.name | |
3735 | write_test_header(tc_name) | |
3736 | ||
8db751b8 CH |
3737 | # Don"t run this test if we have any failure. |
3738 | if tgen.routers_have_failure(): | |
3739 | pytest.skip(tgen.errors) | |
3740 | ||
c9b5d52c | 3741 | # Creating configuration from JSON |
1973df1d | 3742 | app_helper.stop_all_hosts() |
4fafd29f | 3743 | clear_mroute(tgen) |
c9b5d52c | 3744 | reset_config_on_routers(tgen) |
4fafd29f | 3745 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 3746 | check_router_status(tgen) |
3747 | ||
c9b5d52c | 3748 | step( |
3749 | "Remove FRR3 to cisco connected link to simulate topo " | |
3750 | "FHR(FRR3(l1))---LHR(FRR1(r2)----RP(FRR2(f1))" | |
3751 | ) | |
3752 | ||
3753 | intf_l1_c1 = topo["routers"]["l1"]["links"]["c1"]["interface"] | |
3754 | intf_f1_c2 = topo["routers"]["f1"]["links"]["c2"]["interface"] | |
3755 | shutdown_bringup_interface(tgen, "l1", intf_l1_c1, False) | |
3756 | shutdown_bringup_interface(tgen, "f1", intf_f1_c2, False) | |
3757 | ||
3758 | step("Disable IGMP config from l1") | |
3759 | input_dict_2 = { | |
3760 | "l1": { | |
3761 | "igmp": { | |
3762 | "interfaces": { | |
5980ad0a DS |
3763 | "l1-i1-eth1": { |
3764 | "igmp": { | |
3765 | "version": "2", | |
3766 | "delete": True, | |
3767 | } | |
3768 | } | |
c9b5d52c | 3769 | } |
3770 | } | |
3771 | } | |
3772 | } | |
3773 | result = create_igmp_config(tgen, topo, input_dict_2) | |
3774 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
3775 | ||
3776 | step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers") | |
3777 | step( | |
3778 | "Enable IGMP on FRR1(r2) interface and send IGMP join (226.1.1.1-5)" | |
3779 | " and (232.1.1.1-5)" | |
3780 | ) | |
3781 | ||
3782 | intf_r2_i3 = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
3783 | input_dict = { | |
a53c08bc CH |
3784 | "r2": { |
3785 | "igmp": { | |
3786 | "interfaces": { | |
3787 | intf_r2_i3: { | |
3788 | "igmp": {"version": "2", "query": {"query-interval": 15}} | |
3789 | } | |
3790 | } | |
3791 | } | |
3792 | } | |
c9b5d52c | 3793 | } |
3794 | result = create_igmp_config(tgen, topo, input_dict) | |
3795 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) | |
3796 | ||
3797 | _GROUP_RANGE = GROUP_RANGE_2 + GROUP_RANGE_3 | |
3798 | _IGMP_JOIN_RANGE = IGMP_JOIN_RANGE_2 + IGMP_JOIN_RANGE_3 | |
3799 | ||
3800 | input_join = {"i3": topo["routers"]["i3"]["links"]["r2"]["interface"]} | |
3801 | ||
3802 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 3803 | result = app_helper.run_join(recvr, _IGMP_JOIN_RANGE, join_intf=recvr_intf) |
c9b5d52c | 3804 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
3805 | ||
3806 | step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in (f1)") | |
3807 | ||
3808 | input_dict = { | |
3809 | "f1": { | |
3810 | "pim": { | |
3811 | "rp": [ | |
3812 | { | |
3813 | "rp_addr": topo["routers"]["f1"]["links"]["lo"]["ipv4"].split( | |
3814 | "/" | |
3815 | )[0], | |
3816 | "group_addr_range": _GROUP_RANGE, | |
3817 | } | |
3818 | ] | |
3819 | } | |
3820 | } | |
3821 | } | |
3822 | ||
3823 | result = create_pim_config(tgen, topo, input_dict) | |
3824 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3825 | ||
3826 | step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver") | |
3827 | ||
3828 | input_src = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
3829 | ||
3830 | for src, src_intf in input_src.items(): | |
1973df1d | 3831 | result = app_helper.run_traffic(src, _IGMP_JOIN_RANGE, bind_intf=src_intf) |
c9b5d52c | 3832 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
3833 | ||
3834 | step( | |
3835 | "'show ip mroute' showing correct RPF and OIF interface for (*,G)" | |
3836 | " and (S,G) entries on all the nodes" | |
3837 | ) | |
3838 | ||
3839 | source_i1 = topo["routers"]["i1"]["links"]["l1"]["ipv4"].split("/")[0] | |
3840 | input_dict_all = [ | |
3841 | { | |
3842 | "dut": "l1", | |
3843 | "src_address": source_i1, | |
3844 | "iif": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
3845 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
3846 | }, | |
3847 | { | |
3848 | "dut": "r2", | |
3849 | "src_address": "*", | |
3850 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
3851 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
3852 | }, | |
3853 | { | |
3854 | "dut": "r2", | |
3855 | "src_address": source_i1, | |
3856 | "iif": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
3857 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
3858 | }, | |
3859 | ] | |
3860 | ||
3861 | for data in input_dict_all: | |
4fafd29f | 3862 | result = verify_mroutes( |
c9b5d52c | 3863 | tgen, |
3864 | data["dut"], | |
3865 | data["src_address"], | |
3866 | _IGMP_JOIN_RANGE, | |
3867 | data["iif"], | |
3868 | data["oil"], | |
3869 | ) | |
3870 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3871 | ||
3872 | for data in input_dict_all: | |
3873 | result = verify_upstream_iif( | |
3874 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
3875 | ) | |
3876 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3877 | ||
3878 | step( | |
3879 | "Multicast traffic is flowing for all the groups verify" | |
3880 | "using 'show ip multicast'" | |
3881 | ) | |
3882 | ||
3883 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
3884 | intf_r2_l1 = topo["routers"]["r2"]["links"]["l1"]["interface"] | |
3885 | intf_r2_f1 = topo["routers"]["r2"]["links"]["f1"]["interface"] | |
3886 | intf_r2_i3 = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
3887 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
3888 | input_traffic = { | |
3889 | "l1": {"traffic_received": [intf_l1_i1]}, | |
3890 | "r2": {"traffic_received": [intf_r2_l1], "traffic_sent": [intf_r2_i3]}, | |
3891 | } | |
3892 | result = verify_multicast_traffic(tgen, input_traffic) | |
3893 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3894 | ||
3895 | step("Shut and No shut the receiver port") | |
3896 | ||
3897 | intf_r2_i3 = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
3898 | shutdown_bringup_interface(tgen, "r2", intf_r2_i3, False) | |
3899 | ||
3900 | step( | |
3901 | "Verification: After Shut of receiver port, Verify (*,G) and " | |
3902 | "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'" | |
3903 | ) | |
3904 | ||
3905 | input_dict_r2 = [ | |
3906 | { | |
3907 | "dut": "r2", | |
3908 | "src_address": "*", | |
3909 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
3910 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
3911 | }, | |
3912 | { | |
3913 | "dut": "r2", | |
3914 | "src_address": source_i1, | |
3915 | "iif": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
3916 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
3917 | }, | |
3918 | ] | |
3919 | ||
3920 | for data in input_dict_r2: | |
4fafd29f | 3921 | result = verify_mroutes( |
c9b5d52c | 3922 | tgen, |
3923 | data["dut"], | |
3924 | data["src_address"], | |
3925 | _IGMP_JOIN_RANGE, | |
3926 | data["iif"], | |
3927 | data["oil"], | |
3928 | expected=False, | |
3929 | ) | |
3930 | assert result is not True, ( | |
3931 | "Testcase {} : Failed \n" | |
3932 | " Expected Behaviour: mroutes are cleared \n Error: {}".format( | |
3933 | tc_name, result | |
3934 | ) | |
3935 | ) | |
3936 | logger.info("Expected Behaviour: {}".format(result)) | |
3937 | ||
3938 | shutdown_bringup_interface(tgen, "r2", intf_r2_i3, True) | |
3939 | ||
3940 | step( | |
3941 | "Verification: After No shut of receiver port , Verify (*,G)" | |
3942 | " and (S,G) got populated on LHR node (FRR1) using " | |
3943 | "'show ip mroute' 'show ip pim upstream'" | |
3944 | ) | |
3945 | ||
3946 | for data in input_dict_r2: | |
4fafd29f | 3947 | result = verify_mroutes( |
c9b5d52c | 3948 | tgen, |
3949 | data["dut"], | |
3950 | data["src_address"], | |
3951 | _IGMP_JOIN_RANGE, | |
3952 | data["iif"], | |
3953 | data["oil"], | |
3954 | ) | |
3955 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3956 | ||
3957 | for data in input_dict_r2: | |
3958 | result = verify_upstream_iif( | |
3959 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
3960 | ) | |
3961 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3962 | ||
3963 | step( | |
3964 | "Multicast traffic is resumed for all the groups verify " | |
3965 | "using 'show ip multicast'" | |
3966 | ) | |
3967 | ||
3968 | result = verify_multicast_traffic(tgen, input_traffic) | |
3969 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
3970 | ||
3971 | step("Shut and No shut the source port") | |
3972 | ||
3973 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
3974 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, False) | |
3975 | ||
3976 | step( | |
3977 | "Verification: After Shut of source port, Verify (*,G) and " | |
3978 | "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'" | |
3979 | ) | |
3980 | ||
3981 | input_dict_l1 = [ | |
3982 | { | |
3983 | "dut": "l1", | |
3984 | "src_address": source_i1, | |
3985 | "iif": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
3986 | "oil": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
3987 | } | |
3988 | ] | |
3989 | ||
3990 | for data in input_dict_l1: | |
4fafd29f | 3991 | result = verify_mroutes( |
c9b5d52c | 3992 | tgen, |
3993 | data["dut"], | |
3994 | data["src_address"], | |
3995 | _IGMP_JOIN_RANGE, | |
3996 | data["iif"], | |
3997 | data["oil"], | |
3998 | expected=False, | |
3999 | ) | |
5980ad0a DS |
4000 | assert ( |
4001 | result is not True | |
4002 | ), "Testcase {} : Failed \n" "mroutes are cleared \n Error: {}".format( | |
4003 | tc_name, result | |
c9b5d52c | 4004 | ) |
4005 | logger.info("Expected Behaviour: {}".format(result)) | |
4006 | ||
4007 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, True) | |
4008 | ||
4009 | step( | |
4010 | "Verification: After No shut of source port , Verify (*,G)" | |
4011 | " and (S,G) got populated on LHR node (FRR1) using " | |
4012 | "'show ip mroute' 'show ip pim upstream'" | |
4013 | ) | |
4014 | ||
4015 | for data in input_dict_l1: | |
4fafd29f | 4016 | result = verify_mroutes( |
c9b5d52c | 4017 | tgen, |
4018 | data["dut"], | |
4019 | data["src_address"], | |
4020 | _IGMP_JOIN_RANGE, | |
4021 | data["iif"], | |
4022 | data["oil"], | |
4023 | ) | |
4024 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4025 | ||
4026 | for data in input_dict_l1: | |
4027 | result = verify_upstream_iif( | |
4028 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
4029 | ) | |
4030 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4031 | ||
4032 | step( | |
4033 | "Multicast traffic is resumed for all the groups verify " | |
4034 | "using 'show ip multicast'" | |
4035 | ) | |
4036 | ||
4037 | result = verify_multicast_traffic(tgen, input_traffic) | |
4038 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4039 | ||
4040 | step("Shut and No shut of LHR to cisco port from LHR side") | |
4041 | ||
4042 | intf_r2_f1 = topo["routers"]["r2"]["links"]["f1"]["interface"] | |
4043 | shutdown_bringup_interface(tgen, "r2", intf_r2_f1, False) | |
4044 | ||
4045 | step( | |
4046 | "Verification: After Shut of source port, Verify (S,G) got " | |
4047 | "removed from LHR and FHR using 'show ip mroute'" | |
4048 | ) | |
4049 | ||
4050 | input_dict_r2_f1 = [ | |
4051 | { | |
4052 | "dut": "r2", | |
4053 | "src_address": "*", | |
4054 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
4055 | "oil": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
4056 | }, | |
4057 | { | |
4058 | "dut": "f1", | |
4059 | "src_address": "*", | |
4060 | "iif": "lo", | |
4061 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
4062 | }, | |
4063 | ] | |
4064 | ||
4065 | for data in input_dict_r2_f1: | |
4fafd29f | 4066 | result = verify_mroutes( |
c9b5d52c | 4067 | tgen, |
4068 | data["dut"], | |
4069 | data["src_address"], | |
4070 | _IGMP_JOIN_RANGE, | |
4071 | data["iif"], | |
4072 | data["oil"], | |
4073 | expected=False, | |
4074 | ) | |
5980ad0a DS |
4075 | assert ( |
4076 | result is not True | |
4077 | ), "Testcase {} : Failed \n" " mroutes are cleared \n Error: {}".format( | |
4078 | tc_name, result | |
c9b5d52c | 4079 | ) |
4080 | logger.info("Expected Behaviour: {}".format(result)) | |
4081 | ||
4082 | shutdown_bringup_interface(tgen, "r2", intf_r2_f1, True) | |
4083 | ||
4084 | step( | |
4085 | "Verification: After No shut of source port , Verify (*,G)" | |
4086 | " and (S,G) got populated on LHR node (FRR1) using " | |
4087 | "'show ip mroute' 'show ip pim upstream'" | |
4088 | ) | |
4089 | ||
4090 | for data in input_dict_all: | |
4fafd29f | 4091 | result = verify_mroutes( |
c9b5d52c | 4092 | tgen, |
4093 | data["dut"], | |
4094 | data["src_address"], | |
4095 | _IGMP_JOIN_RANGE, | |
4096 | data["iif"], | |
4097 | data["oil"], | |
4098 | ) | |
4099 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4100 | ||
4101 | for data in input_dict_all: | |
4102 | result = verify_upstream_iif( | |
4103 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
4104 | ) | |
4105 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4106 | ||
4107 | step( | |
4108 | "Multicast traffic is resumed for all the groups verify " | |
4109 | "using 'show ip multicast'" | |
4110 | ) | |
4111 | ||
4112 | input_traffic_r2 = { | |
4113 | "r2": {"traffic_received": [intf_r2_l1], "traffic_sent": [intf_r2_i3]} | |
4114 | } | |
4115 | result = verify_multicast_traffic(tgen, input_traffic_r2) | |
4116 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4117 | ||
4118 | step("Shut and no shut of FHR to LHR port from FHR side") | |
4119 | ||
4120 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
4121 | shutdown_bringup_interface(tgen, "l1", intf_l1_r2, False) | |
4122 | ||
4123 | step( | |
4124 | "Verification: After Shut of LHR to FHR port, Verify (S,G)" | |
4125 | "got removed from LHR 'show ip mroute'" | |
4126 | ) | |
4127 | ||
4128 | dut = "r2" | |
4129 | src_address = "*" | |
4130 | iif = topo["routers"]["r2"]["links"]["f1"]["interface"] | |
4131 | oil = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
4132 | ||
4fafd29f | 4133 | result = verify_mroutes(tgen, dut, src_address, _IGMP_JOIN_RANGE, iif, oil) |
c9b5d52c | 4134 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
4135 | ||
4136 | src_address = source_i1 | |
4137 | iif = topo["routers"]["r2"]["links"]["l1"]["interface"] | |
4138 | oil = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
4139 | ||
4fafd29f | 4140 | result = verify_mroutes( |
c9b5d52c | 4141 | tgen, dut, src_address, _IGMP_JOIN_RANGE, iif, oil, expected=False |
4142 | ) | |
5980ad0a DS |
4143 | assert ( |
4144 | result is not True | |
4145 | ), "Testcase {} : Failed \n" " mroutes are cleared \n Error: {}".format( | |
4146 | tc_name, result | |
c9b5d52c | 4147 | ) |
4148 | logger.info("Expected Behaviour: {}".format(result)) | |
4149 | ||
4150 | shutdown_bringup_interface(tgen, "l1", intf_l1_r2, True) | |
4151 | ||
4152 | step( | |
4153 | "Verification: After No shut of source port , Verify (*,G)" | |
4154 | " and (S,G) got populated on LHR node (FRR1) using " | |
4155 | "'show ip mroute' 'show ip pim upstream'" | |
4156 | ) | |
4157 | ||
4158 | for data in input_dict_all: | |
4fafd29f | 4159 | result = verify_mroutes( |
c9b5d52c | 4160 | tgen, |
4161 | data["dut"], | |
4162 | data["src_address"], | |
4163 | _IGMP_JOIN_RANGE, | |
4164 | data["iif"], | |
4165 | data["oil"], | |
4166 | ) | |
4167 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4168 | ||
4169 | for data in input_dict_all: | |
4170 | result = verify_upstream_iif( | |
4171 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
4172 | ) | |
4173 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4174 | ||
4175 | step( | |
4176 | "Multicast traffic is resumed for all the groups verify " | |
4177 | "using 'show ip multicast'" | |
4178 | ) | |
4179 | ||
4180 | result = verify_multicast_traffic(tgen, input_traffic_r2) | |
4181 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4182 | ||
4183 | write_test_footer(tc_name) | |
4184 | ||
4185 | ||
4186 | def test_verify_multicast_traffic_when_FHR_connected_to_RP_p1(request): | |
4187 | """ | |
4188 | TC_12: Verify multicast traffic is flowing fine when FHR is connected to RP | |
4189 | Topology used: | |
4190 | LHR(FRR1)---FHR(FRR3)----RP(FRR2) | |
4191 | """ | |
4192 | ||
4193 | tgen = get_topogen() | |
4194 | tc_name = request.node.name | |
4195 | write_test_header(tc_name) | |
4196 | ||
8db751b8 CH |
4197 | # Don"t run this test if we have any failure. |
4198 | if tgen.routers_have_failure(): | |
4199 | pytest.skip(tgen.errors) | |
4200 | ||
c9b5d52c | 4201 | # Creating configuration from JSON |
1973df1d | 4202 | app_helper.stop_all_hosts() |
4fafd29f | 4203 | clear_mroute(tgen) |
c9b5d52c | 4204 | reset_config_on_routers(tgen) |
4fafd29f | 4205 | clear_pim_interface_traffic(tgen, topo) |
c9b5d52c | 4206 | check_router_status(tgen) |
4207 | ||
c9b5d52c | 4208 | step( |
4209 | "Remove FRR3 to FRR2 connected link to simulate topo " | |
4210 | "FHR(FRR3)---LHR(FRR1)----RP(FFR2)" | |
4211 | ) | |
4212 | ||
4213 | intf_l1_c1 = topo["routers"]["l1"]["links"]["c1"]["interface"] | |
4214 | intf_f1_c2 = topo["routers"]["f1"]["links"]["c2"]["interface"] | |
4215 | shutdown_bringup_interface(tgen, "l1", intf_l1_c1, False) | |
4216 | shutdown_bringup_interface(tgen, "f1", intf_f1_c2, False) | |
4217 | ||
4218 | step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers") | |
4219 | step("Enable IGMP on FRR1(l1) interface and send IGMP join " " and (225.1.1.1-5)") | |
4220 | ||
4221 | _GROUP_RANGE = GROUP_RANGE_2 + GROUP_RANGE_3 | |
4222 | _IGMP_JOIN_RANGE = IGMP_JOIN_RANGE_2 + IGMP_JOIN_RANGE_3 | |
4223 | ||
4224 | input_join = {"i1": topo["routers"]["i1"]["links"]["l1"]["interface"]} | |
4225 | ||
4226 | for recvr, recvr_intf in input_join.items(): | |
1973df1d | 4227 | result = app_helper.run_join(recvr, _IGMP_JOIN_RANGE, join_intf=recvr_intf) |
c9b5d52c | 4228 | assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) |
4229 | ||
4230 | step("Configure RP for (225.1.1.1-5) in (f1)") | |
4231 | ||
4232 | input_dict = { | |
4233 | "f1": { | |
4234 | "pim": { | |
4235 | "rp": [ | |
4236 | { | |
4237 | "rp_addr": topo["routers"]["f1"]["links"]["lo"]["ipv4"].split( | |
4238 | "/" | |
4239 | )[0], | |
4240 | "group_addr_range": _GROUP_RANGE, | |
4241 | } | |
4242 | ] | |
4243 | } | |
4244 | } | |
4245 | } | |
4246 | ||
4247 | result = create_pim_config(tgen, topo, input_dict) | |
4248 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4249 | ||
4250 | step("Send multicast traffic from FRR3(r2) to 225.1.1.1-225.1.1.10" " receiver") | |
4251 | ||
4252 | input_src = {"i3": topo["routers"]["i3"]["links"]["r2"]["interface"]} | |
4253 | ||
4254 | for src, src_intf in input_src.items(): | |
1973df1d | 4255 | result = app_helper.run_traffic(src, _IGMP_JOIN_RANGE, bind_intf=src_intf) |
c9b5d52c | 4256 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) |
4257 | ||
4258 | step( | |
4259 | "'show ip mroute' showing correct RPF and OIF interface for (*,G)" | |
4260 | " and (S,G) entries on all the nodes" | |
4261 | ) | |
4262 | ||
4263 | source_i3 = topo["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0] | |
4264 | input_dict_all = [ | |
4265 | { | |
4266 | "dut": "l1", | |
4267 | "src_address": "*", | |
4268 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
4269 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
4270 | }, | |
4271 | { | |
4272 | "dut": "l1", | |
4273 | "src_address": source_i3, | |
4274 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
4275 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
4276 | }, | |
4277 | { | |
4278 | "dut": "r2", | |
4279 | "src_address": "*", | |
4280 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
4281 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
4282 | }, | |
4283 | { | |
4284 | "dut": "r2", | |
4285 | "src_address": source_i3, | |
4286 | "iif": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
4287 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
4288 | }, | |
4289 | ] | |
4290 | ||
4291 | for data in input_dict_all: | |
4fafd29f | 4292 | result = verify_mroutes( |
c9b5d52c | 4293 | tgen, |
4294 | data["dut"], | |
4295 | data["src_address"], | |
4296 | _IGMP_JOIN_RANGE, | |
4297 | data["iif"], | |
4298 | data["oil"], | |
4299 | ) | |
4300 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4301 | ||
4302 | for data in input_dict_all: | |
4303 | result = verify_upstream_iif( | |
4304 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
4305 | ) | |
4306 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4307 | ||
4308 | intf_l1_r2 = topo["routers"]["l1"]["links"]["r2"]["interface"] | |
4309 | intf_f1_r2 = topo["routers"]["f1"]["links"]["r2"]["interface"] | |
4310 | intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] | |
4311 | input_traffic = { | |
4312 | "l1": {"traffic_received": [intf_l1_r2], "traffic_sent": [intf_l1_i1]} | |
4313 | } | |
4314 | result = verify_multicast_traffic(tgen, input_traffic) | |
4315 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4316 | ||
4317 | step("Shut the receiver(l1) port in 1 min interval") | |
4318 | ||
4319 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, False) | |
4320 | ||
4321 | step( | |
4322 | "Verification: After Shut of receiver port, Verify (*,G) and " | |
4323 | "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'" | |
4324 | ) | |
4325 | ||
4326 | input_dict_l1 = [ | |
4327 | { | |
4328 | "dut": "l1", | |
4329 | "src_address": source_i3, | |
4330 | "iif": topo["routers"]["l1"]["links"]["r2"]["interface"], | |
4331 | "oil": topo["routers"]["l1"]["links"]["i1"]["interface"], | |
4332 | } | |
4333 | ] | |
4334 | ||
4335 | for data in input_dict_l1: | |
4fafd29f | 4336 | result = verify_mroutes( |
c9b5d52c | 4337 | tgen, |
4338 | data["dut"], | |
4339 | data["src_address"], | |
4340 | _IGMP_JOIN_RANGE, | |
4341 | data["iif"], | |
4342 | data["oil"], | |
4343 | expected=False, | |
4344 | ) | |
5980ad0a DS |
4345 | assert ( |
4346 | result is not True | |
4347 | ), "Testcase {} : Failed \n" " mroutes are cleared \n Error: {}".format( | |
4348 | tc_name, result | |
c9b5d52c | 4349 | ) |
4350 | logger.info("Expected Behaviour: {}".format(result)) | |
4351 | ||
4352 | step("No shut the receiver(l1) port in 1 min interval") | |
4353 | ||
4354 | shutdown_bringup_interface(tgen, "l1", intf_l1_i1, True) | |
4355 | ||
4356 | step( | |
4357 | "Verification: After No shut of receiver port , Verify (*,G)" | |
4358 | " and (S,G) got populated on LHR node (FRR1) using " | |
4359 | "'show ip mroute' 'show ip pim upstream'" | |
4360 | ) | |
4361 | ||
4362 | for data in input_dict_l1: | |
4fafd29f | 4363 | result = verify_mroutes( |
c9b5d52c | 4364 | tgen, |
4365 | data["dut"], | |
4366 | data["src_address"], | |
4367 | _IGMP_JOIN_RANGE, | |
4368 | data["iif"], | |
4369 | data["oil"], | |
4370 | ) | |
4371 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4372 | ||
4373 | for data in input_dict_l1: | |
4374 | result = verify_upstream_iif( | |
4375 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
4376 | ) | |
4377 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4378 | ||
4379 | result = verify_multicast_traffic(tgen, input_traffic) | |
4380 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4381 | ||
4382 | step("Shut the source(r2) port in 1 min interval") | |
4383 | ||
4384 | intf_r2_i3 = topo["routers"]["r2"]["links"]["i3"]["interface"] | |
4385 | shutdown_bringup_interface(tgen, "r2", intf_r2_i3, False) | |
4386 | ||
4387 | step( | |
4388 | "Verification: After Shut of source port, Verify (S,G) got " | |
4389 | "removed from FHR using 'show ip mroute'" | |
4390 | ) | |
4391 | ||
4392 | input_dict_r2 = [ | |
4393 | { | |
4394 | "dut": "r2", | |
4395 | "src_address": source_i3, | |
4396 | "iif": topo["routers"]["r2"]["links"]["i3"]["interface"], | |
4397 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
4398 | } | |
4399 | ] | |
4400 | ||
4401 | for data in input_dict_r2: | |
4fafd29f | 4402 | result = verify_mroutes( |
c9b5d52c | 4403 | tgen, |
4404 | data["dut"], | |
4405 | data["src_address"], | |
4406 | _IGMP_JOIN_RANGE, | |
4407 | data["iif"], | |
4408 | data["oil"], | |
4409 | expected=False, | |
4410 | ) | |
5980ad0a DS |
4411 | assert ( |
4412 | result is not True | |
4413 | ), "Testcase {} : Failed \n" " mroutes are cleared \n Error: {}".format( | |
4414 | tc_name, result | |
c9b5d52c | 4415 | ) |
4416 | logger.info("Expected Behaviour: {}".format(result)) | |
4417 | ||
4418 | step("No shut the source(r2) port in 1 min interval") | |
4419 | ||
4420 | shutdown_bringup_interface(tgen, "r2", intf_r2_i3, True) | |
4421 | ||
4422 | step( | |
4423 | "Verification: After No shut of source port , Verify (*,G)" | |
4424 | " and (S,G) got populated on LHR and FHR using " | |
4425 | "'show ip mroute' 'show ip pim upstream'" | |
4426 | ) | |
4427 | ||
4428 | for data in input_dict_r2: | |
4fafd29f | 4429 | result = verify_mroutes( |
c9b5d52c | 4430 | tgen, |
4431 | data["dut"], | |
4432 | data["src_address"], | |
4433 | _IGMP_JOIN_RANGE, | |
4434 | data["iif"], | |
4435 | data["oil"], | |
4436 | ) | |
4437 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4438 | ||
4439 | for data in input_dict_r2: | |
4440 | result = verify_upstream_iif( | |
4441 | tgen, data["dut"], data["iif"], data["src_address"], _IGMP_JOIN_RANGE | |
4442 | ) | |
4443 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4444 | ||
4445 | result = verify_multicast_traffic(tgen, input_traffic) | |
4446 | assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) | |
4447 | ||
4448 | step("Shut FHR to RP port from FHR side") | |
4449 | ||
4450 | intf_r2_f1 = topo["routers"]["r2"]["links"]["f1"]["interface"] | |
4451 | shutdown_bringup_interface(tgen, "r2", intf_r2_f1, False) | |
4452 | ||
4453 | step( | |
4454 | "Verification: After Shut of FHR to cisco port, Verify (*,G) " | |
4455 | "got removed from FHR and cisco node using 'show ip mroute'" | |
4456 | ) | |
4457 | ||
4458 | input_dict_all_star = [ | |
4459 | { | |
4460 | "dut": "r2", | |
4461 | "src_address": "*", | |
4462 | "iif": topo["routers"]["r2"]["links"]["f1"]["interface"], | |
4463 | "oil": topo["routers"]["r2"]["links"]["l1"]["interface"], | |
4464 | }, | |
4465 | { | |
4466 | "dut": "f1", | |
4467 | "src_address": "*", | |
4468 | "iif": "lo", | |
4469 | "oil": topo["routers"]["f1"]["links"]["r2"]["interface"], | |
4470 | }, | |
4471 | ] | |
4472 | ||
4473 | for data in input_dict_all_star: | |
4fafd29f | 4474 | result = verify_mroutes( |
c9b5d52c | 4475 | tgen, |
4476 | data["dut"], | |
4477 | data["src_address"], | |
4478 | _IGMP_JOIN_RANGE, | |
4479 | data["iif"], | |
4480 | data["oil"], | |
4481 | expected=False, | |
4482 | ) | |
5980ad0a DS |
4483 | assert ( |
4484 | result is not True | |
4485 | ), "Testcase {} : Failed \n" " mroutes are cleared \n Error: {}".format( | |
4486 | tc_name, result | |
c9b5d52c | 4487 | ) |
4488 | logger.info("Expected Behaviour: {}".format(result)) | |
4489 | ||
4490 | write_test_footer(tc_name) | |
4491 | ||
4492 | ||
4493 | if __name__ == "__main__": | |
4494 | args = ["-s"] + sys.argv[1:] | |
4495 | sys.exit(pytest.main(args)) |