diff options
author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2024-12-16 13:57:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-16 13:57:31 +0100 |
commit | 3bebb7be9204a51f194317438aa883f1b10c8646 (patch) | |
tree | 6e4e508a35f6d03491661b25b645008d8ae7dd5a /tests | |
parent | Merge pull request #17645 from donaldsharp/support_bundle_rip (diff) | |
parent | doc: Clean up Multicast RIB documentation (diff) | |
download | frr-3bebb7be9204a51f194317438aa883f1b10c8646.tar.xz frr-3bebb7be9204a51f194317438aa883f1b10c8646.zip |
Merge pull request #17252 from nabahr/mcast-mode
Fix PIMD RPF lookup mode and nexthop tracking
Diffstat (limited to 'tests')
27 files changed, 468 insertions, 42 deletions
diff --git a/tests/topotests/all_protocol_startup/r1/ipv4_routes.ref b/tests/topotests/all_protocol_startup/r1/ipv4_routes.ref index 33c44780b..a188ad92f 100644 --- a/tests/topotests/all_protocol_startup/r1/ipv4_routes.ref +++ b/tests/topotests/all_protocol_startup/r1/ipv4_routes.ref @@ -1,3 +1,4 @@ +IPv4 unicast VRF default: C>* 192.168.0.0/24 is directly connected, r1-eth0, weight 1, XX:XX:XX C>* 192.168.1.0/26 is directly connected, r1-eth1, weight 1, XX:XX:XX C>* 192.168.2.0/26 is directly connected, r1-eth2, weight 1, XX:XX:XX diff --git a/tests/topotests/all_protocol_startup/r1/ipv6_routes.ref b/tests/topotests/all_protocol_startup/r1/ipv6_routes.ref index f5c1d6d7d..4cb8692f9 100644 --- a/tests/topotests/all_protocol_startup/r1/ipv6_routes.ref +++ b/tests/topotests/all_protocol_startup/r1/ipv6_routes.ref @@ -1,3 +1,4 @@ +IPv6 unicast VRF default: C>* fc00:0:0:1::/64 is directly connected, r1-eth1, weight 1, XX:XX:XX C>* fc00:0:0:2::/64 is directly connected, r1-eth2, weight 1, XX:XX:XX C>* fc00:0:0:3::/64 is directly connected, r1-eth3, weight 1, XX:XX:XX diff --git a/tests/topotests/mgmt_config/r1/early-end-zebra.conf b/tests/topotests/mgmt_config/r1/early-end-zebra.conf index 44a2f9682..926540f9b 100644 --- a/tests/topotests/mgmt_config/r1/early-end-zebra.conf +++ b/tests/topotests/mgmt_config/r1/early-end-zebra.conf @@ -1,6 +1,6 @@ allow-external-route-update end -ip multicast rpf-lookup-mode urib-only +router-id 1.2.3.4 end ip table range 2 3 end
\ No newline at end of file diff --git a/tests/topotests/mgmt_config/r1/early-end2-zebra.conf b/tests/topotests/mgmt_config/r1/early-end2-zebra.conf index 37619d52a..b8514f324 100644 --- a/tests/topotests/mgmt_config/r1/early-end2-zebra.conf +++ b/tests/topotests/mgmt_config/r1/early-end2-zebra.conf @@ -1,7 +1,7 @@ conf t allow-external-route-update end -ip multicast rpf-lookup-mode urib-only +router-id 1.2.3.4 end ip table range 2 3 end
\ No newline at end of file diff --git a/tests/topotests/mgmt_config/r1/early-exit-zebra.conf b/tests/topotests/mgmt_config/r1/early-exit-zebra.conf index 44f202dbc..990351685 100644 --- a/tests/topotests/mgmt_config/r1/early-exit-zebra.conf +++ b/tests/topotests/mgmt_config/r1/early-exit-zebra.conf @@ -1,6 +1,6 @@ allow-external-route-update exit -ip multicast rpf-lookup-mode urib-only +router-id 1.2.3.4 exit ip table range 2 3 exit
\ No newline at end of file diff --git a/tests/topotests/mgmt_config/r1/early-exit2-zebra.conf b/tests/topotests/mgmt_config/r1/early-exit2-zebra.conf index c7109bfd3..5a783f449 100644 --- a/tests/topotests/mgmt_config/r1/early-exit2-zebra.conf +++ b/tests/topotests/mgmt_config/r1/early-exit2-zebra.conf @@ -1,7 +1,7 @@ conf t allow-external-route-update exit -ip multicast rpf-lookup-mode urib-only +router-id 1.2.3.4 exit ip table range 2 3 exit
\ No newline at end of file diff --git a/tests/topotests/mgmt_config/r1/one-exit-zebra.conf b/tests/topotests/mgmt_config/r1/one-exit-zebra.conf index 0c3845970..c8396fec7 100644 --- a/tests/topotests/mgmt_config/r1/one-exit-zebra.conf +++ b/tests/topotests/mgmt_config/r1/one-exit-zebra.conf @@ -1,3 +1,3 @@ allow-external-route-update exit -ip multicast rpf-lookup-mode urib-only +router-id 1.2.3.4 diff --git a/tests/topotests/mgmt_config/r1/one-exit2-zebra.conf b/tests/topotests/mgmt_config/r1/one-exit2-zebra.conf index 34acb76d9..3a50f6d13 100644 --- a/tests/topotests/mgmt_config/r1/one-exit2-zebra.conf +++ b/tests/topotests/mgmt_config/r1/one-exit2-zebra.conf @@ -1,4 +1,4 @@ conf t allow-external-route-update exit -ip multicast rpf-lookup-mode urib-only
\ No newline at end of file +router-id 1.2.3.4
\ No newline at end of file diff --git a/tests/topotests/mgmt_config/test_config.py b/tests/topotests/mgmt_config/test_config.py index 1d732223f..627a564a6 100644 --- a/tests/topotests/mgmt_config/test_config.py +++ b/tests/topotests/mgmt_config/test_config.py @@ -153,7 +153,7 @@ def cleanup_config(r1, tempdir, logpath): yield r1.cmd_nostatus("vtysh -c 'conf t' -c 'no allow-external-route-update'") - r1.cmd_nostatus("vtysh -c 'conf t' -c 'no ip multicast rpf-lookup-mode urib-only'") + r1.cmd_nostatus("vtysh -c 'conf t' -c 'no router-id 1.2.3.4'") r1.cmd_nostatus("vtysh -c 'conf t' -c 'no ip table range 2 3'") logbuf = save_log_snippet(logpath, logbuf, "/dev/null") @@ -290,9 +290,7 @@ def test_zebra_one_exit_file(r1, confdir, tempdir, logpath): showrun = r1.cmd_nostatus("vtysh -c 'show running'") assert "allow-external-route-update" in showrun, "zebra conf missing" - assert ( - "ip multicast rpf-lookup-mode urib-only" not in showrun - ), "zebra second conf present, unexpected" + assert "router-id 1.2.3.4" not in showrun, "zebra second conf present, unexpected" def test_zebra_one_exit_redir(r1, confdir, tempdir, logpath): @@ -307,9 +305,7 @@ def test_zebra_one_exit_redir(r1, confdir, tempdir, logpath): showrun = r1.cmd_nostatus("vtysh -c 'show running'") assert "allow-external-route-update" in showrun, "zebra conf missing" - assert ( - "ip multicast rpf-lookup-mode urib-only" not in showrun - ), "zebra second conf present, unexpected" + assert "router-id 1.2.3.4" not in showrun, "zebra second conf present, unexpected" def test_zebra_early_exit_file(r1, confdir, tempdir, logpath): @@ -324,9 +320,7 @@ def test_zebra_early_exit_file(r1, confdir, tempdir, logpath): showrun = r1.cmd_nostatus("vtysh -c 'show running'") assert "allow-external-route-update" in showrun, "zebra conf missing" - assert ( - "ip multicast rpf-lookup-mode urib-only" not in showrun - ), "zebra second conf present, unexpected" + assert "router-id 1.2.3.4" not in showrun, "zebra second conf present, unexpected" assert "ip table range 2 3" not in showrun, "zebra third conf present, unexpected" @@ -342,9 +336,7 @@ def test_zebra_early_exit_redir(r1, confdir, tempdir, logpath): showrun = r1.cmd_nostatus("vtysh -c 'show running'") assert "allow-external-route-update" in showrun, "zebra conf missing" - assert ( - "ip multicast rpf-lookup-mode urib-only" not in showrun - ), "zebra second conf present, unexpected" + assert "router-id 1.2.3.4" not in showrun, "zebra second conf present, unexpected" assert "ip table range 2 3" not in showrun, "zebra third conf present, unexpected" @@ -360,9 +352,7 @@ def test_zebra_early_end_file(r1, confdir, tempdir, logpath): showrun = r1.cmd_nostatus("vtysh -c 'show running'") assert "allow-external-route-update" in showrun, "zebra conf missing" - assert ( - "ip multicast rpf-lookup-mode urib-only" in showrun - ), "zebra second conf missing" + assert "router-id 1.2.3.4" in showrun, "zebra second conf missing" assert "ip table range 2 3" in showrun, "zebra third missing" @@ -378,7 +368,5 @@ def test_zebra_early_end_redir(r1, confdir, tempdir, logpath): showrun = r1.cmd_nostatus("vtysh -c 'show running'") assert "allow-external-route-update" in showrun, "zebra conf missing" - assert ( - "ip multicast rpf-lookup-mode urib-only" not in showrun - ), "zebra second conf present, unexpected" + assert "router-id 1.2.3.4" not in showrun, "zebra second conf present, unexpected" assert "ip table range 2 3" not in showrun, "zebra third conf present, unexpected" diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt index 131085a47..e4787be3c 100644 --- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt +++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt @@ -1,3 +1,4 @@ +IPv4 unicast VRF default: O 10.0.1.0/24 [110/10] is directly connected, r1-eth0, weight 1, XX:XX:XX C>* 10.0.1.0/24 is directly connected, r1-eth0, weight 1, XX:XX:XX L>* 10.0.1.1/32 is directly connected, r1-eth0, weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-neno.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-neno.txt index 45ee1071d..2f893c3d9 100644 --- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-neno.txt +++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-neno.txt @@ -1,4 +1,4 @@ -VRF neno: +IPv4 unicast VRF neno: O>* 10.0.3.0/24 [110/20] via 10.0.30.3, r1-eth2, weight 1, XX:XX:XX B>* 10.0.4.0/24 [110/20] via 10.0.20.2, r1-eth1 (vrf default), weight 1, XX:XX:XX O 10.0.30.0/24 [110/10] is directly connected, r1-eth2, weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt index f3724bbb9..07ec7226f 100644 --- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt +++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt @@ -1,3 +1,4 @@ +IPv4 unicast VRF default: S>* 0.0.0.0/0 [1/0] via 10.0.20.1, r2-eth1, weight 1, XX:XX:XX O>* 10.0.1.0/24 [110/20] via 10.0.20.1, r2-eth1, weight 1, XX:XX:XX O 10.0.2.0/24 [110/10] is directly connected, r2-eth0, weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt index 0f8b12bdf..f409034b8 100644 --- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt +++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt @@ -1,4 +1,4 @@ -VRF ray: +IPv4 unicast VRF ray: B 10.0.1.0/24 [110/20] via 10.0.20.1, r2-eth1 (vrf default) inactive, weight 1, XX:XX:XX B 10.0.2.0/24 [20/0] is directly connected, r2-eth0 (vrf default) inactive, weight 1, XX:XX:XX B>* 10.0.3.0/24 [110/20] via 10.0.20.1, r2-eth1 (vrf default), weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r3/zebra-vrf-default.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r3/zebra-vrf-default.txt index db4e268cb..2af9d2460 100644 --- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r3/zebra-vrf-default.txt +++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r3/zebra-vrf-default.txt @@ -1,3 +1,4 @@ +IPv4 unicast VRF default: O 10.0.3.0/24 [110/10] is directly connected, r3-eth0, weight 1, XX:XX:XX C>* 10.0.3.0/24 is directly connected, r3-eth0, weight 1, XX:XX:XX L>* 10.0.3.3/32 is directly connected, r3-eth0, weight 1, XX:XX:XX @@ -6,5 +7,3 @@ O 10.0.30.0/24 [110/10] is directly connected, r3-eth1, weight 1, XX:XX:XX C>* 10.0.30.0/24 is directly connected, r3-eth1, weight 1, XX:XX:XX L>* 10.0.30.3/32 is directly connected, r3-eth1, weight 1, XX:XX:XX O>* 10.0.40.0/24 [110/20] via 10.0.30.1, r3-eth1, weight 1, XX:XX:XX - - diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r4/zebra-vrf-default.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r4/zebra-vrf-default.txt index 486570857..013073795 100644 --- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r4/zebra-vrf-default.txt +++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r4/zebra-vrf-default.txt @@ -1,3 +1,4 @@ +IPv4 unicast VRF default: O>* 10.0.3.0/24 [110/20] via 10.0.40.2, r4-eth1, weight 1, XX:XX:XX O 10.0.4.0/24 [110/10] is directly connected, r4-eth0, weight 1, XX:XX:XX C>* 10.0.4.0/24 is directly connected, r4-eth0, weight 1, XX:XX:XX @@ -6,4 +7,3 @@ O>* 10.0.30.0/24 [110/20] via 10.0.40.2, r4-eth1, weight 1, XX:XX:XX O 10.0.40.0/24 [110/10] is directly connected, r4-eth1, weight 1, XX:XX:XX C>* 10.0.40.0/24 is directly connected, r4-eth1, weight 1, XX:XX:XX L>* 10.0.40.4/32 is directly connected, r4-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/ospf_netns_vrf/r1/zebraroute.txt b/tests/topotests/ospf_netns_vrf/r1/zebraroute.txt index 68fd30d4c..82cc2d913 100644 --- a/tests/topotests/ospf_netns_vrf/r1/zebraroute.txt +++ b/tests/topotests/ospf_netns_vrf/r1/zebraroute.txt @@ -1,4 +1,4 @@ -VRF r1-ospf-cust1: +IPv4 unicast VRF r1-ospf-cust1: O 10.0.1.0/24 [110/10] is directly connected, r1-eth0, weight 1, XX:XX:XX C>* 10.0.1.0/24 is directly connected, r1-eth0, weight 1, XX:XX:XX L>* 10.0.1.1/32 is directly connected, r1-eth0, weight 1, XX:XX:XX @@ -7,4 +7,3 @@ O 10.0.3.0/24 [110/10] is directly connected, r1-eth1, weight 1, XX:XX:XX C>* 10.0.3.0/24 is directly connected, r1-eth1, weight 1, XX:XX:XX L>* 10.0.3.2/32 is directly connected, r1-eth1, weight 1, XX:XX:XX O>* 10.0.10.0/24 [110/20] via 10.0.3.1, r1-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/ospf_netns_vrf/r1/zebraroutedown.txt b/tests/topotests/ospf_netns_vrf/r1/zebraroutedown.txt index f0bce905b..d6ad2a250 100644 --- a/tests/topotests/ospf_netns_vrf/r1/zebraroutedown.txt +++ b/tests/topotests/ospf_netns_vrf/r1/zebraroutedown.txt @@ -1,4 +1,4 @@ -VRF r1-ospf-cust1: +IPv4 unicast VRF r1-ospf-cust1: O 10.0.1.0/24 [110/10] is directly connected, r1-eth0, weight 1, XX:XX:XX C>* 10.0.1.0/24 is directly connected, r1-eth0, weight 1, XX:XX:XX L>* 10.0.1.1/32 is directly connected, r1-eth0, weight 1, XX:XX:XX @@ -6,4 +6,3 @@ O>* 10.0.2.0/24 [110/20] via 10.0.3.3, r1-eth1, weight 1, XX:XX:XX O 10.0.3.0/24 [110/10] is directly connected, r1-eth1, weight 1, XX:XX:XX C>* 10.0.3.0/24 is directly connected, r1-eth1, weight 1, XX:XX:XX L>* 10.0.3.2/32 is directly connected, r1-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/ospf_netns_vrf/r2/zebraroute.txt b/tests/topotests/ospf_netns_vrf/r2/zebraroute.txt index 098eceb28..effcbc463 100644 --- a/tests/topotests/ospf_netns_vrf/r2/zebraroute.txt +++ b/tests/topotests/ospf_netns_vrf/r2/zebraroute.txt @@ -1,4 +1,4 @@ -VRF r2-ospf-cust1: +IPv4 unicast VRF r2-ospf-cust1: O>* 10.0.1.0/24 [110/20] via 10.0.3.2, r2-eth1, weight 1, XX:XX:XX O 10.0.2.0/24 [110/10] is directly connected, r2-eth0, weight 1, XX:XX:XX C>* 10.0.2.0/24 is directly connected, r2-eth0, weight 1, XX:XX:XX @@ -7,4 +7,3 @@ O 10.0.3.0/24 [110/10] is directly connected, r2-eth1, weight 1, XX:XX:XX C>* 10.0.3.0/24 is directly connected, r2-eth1, weight 1, XX:XX:XX L>* 10.0.3.3/32 is directly connected, r2-eth1, weight 1, XX:XX:XX O>* 10.0.10.0/24 [110/20] via 10.0.3.1, r2-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/ospf_netns_vrf/r2/zebraroutedown.txt b/tests/topotests/ospf_netns_vrf/r2/zebraroutedown.txt index a9300f8df..7321b184a 100644 --- a/tests/topotests/ospf_netns_vrf/r2/zebraroutedown.txt +++ b/tests/topotests/ospf_netns_vrf/r2/zebraroutedown.txt @@ -1,4 +1,4 @@ -VRF r2-ospf-cust1: +IPv4 unicast VRF r2-ospf-cust1: O>* 10.0.1.0/24 [110/20] via 10.0.3.2, r2-eth1, weight 1, XX:XX:XX O 10.0.2.0/24 [110/10] is directly connected, r2-eth0, weight 1, XX:XX:XX C>* 10.0.2.0/24 is directly connected, r2-eth0, weight 1, XX:XX:XX @@ -6,4 +6,3 @@ L>* 10.0.2.1/32 is directly connected, r2-eth0, weight 1, XX:XX:XX O 10.0.3.0/24 [110/10] is directly connected, r2-eth1, weight 1, XX:XX:XX C>* 10.0.3.0/24 is directly connected, r2-eth1, weight 1, XX:XX:XX L>* 10.0.3.3/32 is directly connected, r2-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/ospf_netns_vrf/r3/zebraroute.txt b/tests/topotests/ospf_netns_vrf/r3/zebraroute.txt index f58beb81a..3fea04bd1 100644 --- a/tests/topotests/ospf_netns_vrf/r3/zebraroute.txt +++ b/tests/topotests/ospf_netns_vrf/r3/zebraroute.txt @@ -1,4 +1,4 @@ -VRF r3-ospf-cust1: +IPv4 unicast VRF r3-ospf-cust1: O>* 10.0.1.0/24 [110/20] via 10.0.3.2, r3-eth0, weight 1, XX:XX:XX O>* 10.0.2.0/24 [110/20] via 10.0.3.3, r3-eth0, weight 1, XX:XX:XX O 10.0.3.0/24 [110/10] is directly connected, r3-eth0, weight 1, XX:XX:XX @@ -7,4 +7,3 @@ L>* 10.0.3.1/32 is directly connected, r3-eth0, weight 1, XX:XX:XX O 10.0.10.0/24 [110/10] is directly connected, r3-eth1, weight 1, XX:XX:XX C>* 10.0.10.0/24 is directly connected, r3-eth1, weight 1, XX:XX:XX L>* 10.0.10.1/32 is directly connected, r3-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/ospf_netns_vrf/r3/zebraroutedown.txt b/tests/topotests/ospf_netns_vrf/r3/zebraroutedown.txt index cfedf8fcb..3287355ce 100644 --- a/tests/topotests/ospf_netns_vrf/r3/zebraroutedown.txt +++ b/tests/topotests/ospf_netns_vrf/r3/zebraroutedown.txt @@ -1,5 +1,4 @@ -VRF r3-ospf-cust1: +IPv4 unicast VRF r3-ospf-cust1: O 10.0.10.0/24 [110/10] is directly connected, r3-eth1, weight 1, XX:XX:XX C>* 10.0.10.0/24 is directly connected, r3-eth1, weight 1, XX:XX:XX L>* 10.0.10.1/32 is directly connected, r3-eth1, weight 1, XX:XX:XX - diff --git a/tests/topotests/pim_mrib/__init__.py b/tests/topotests/pim_mrib/__init__.py new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/tests/topotests/pim_mrib/__init__.py diff --git a/tests/topotests/pim_mrib/r1/frr.conf b/tests/topotests/pim_mrib/r1/frr.conf new file mode 100644 index 000000000..28cf2b2c4 --- /dev/null +++ b/tests/topotests/pim_mrib/r1/frr.conf @@ -0,0 +1,28 @@ +! +hostname r1 +password zebra +log file /tmp/r1-frr.log +! +!debug pim nht +!debug pim nht detail +!debug pim nht rp +! +interface r1-eth0 + ip address 10.0.0.1/24 + ip igmp + ip pim +! +interface r1-eth1 + ip address 10.0.1.1/24 + ip igmp + ip pim +! +ip forwarding +! +ip route 10.0.2.0/24 10.0.0.2 50 +ip route 10.0.3.0/24 10.0.1.3 50 +! +router pim + rpf-lookup-mode mrib-then-urib + rp 10.0.0.1 224.0.0.0/4 +!
\ No newline at end of file diff --git a/tests/topotests/pim_mrib/r2/frr.conf b/tests/topotests/pim_mrib/r2/frr.conf new file mode 100644 index 000000000..3e647f679 --- /dev/null +++ b/tests/topotests/pim_mrib/r2/frr.conf @@ -0,0 +1,28 @@ +! +hostname r2 +password zebra +log file /tmp/r2-frr.log +! +!debug pim nht +!debug pim nht detail +!debug pim nht rp +! +interface r2-eth0 + ip address 10.0.0.2/24 + ip igmp + ip pim +! +interface r2-eth1 + ip address 10.0.2.2/24 + ip igmp + ip pim +! +ip forwarding +! +ip route 10.0.1.0/24 10.0.0.1 50 +ip route 10.0.3.0/24 10.0.2.4 50 +! +router pim + rpf-lookup-mode mrib-then-urib + rp 10.0.0.1 224.0.0.0/4 +!
\ No newline at end of file diff --git a/tests/topotests/pim_mrib/r3/frr.conf b/tests/topotests/pim_mrib/r3/frr.conf new file mode 100644 index 000000000..9815484d0 --- /dev/null +++ b/tests/topotests/pim_mrib/r3/frr.conf @@ -0,0 +1,28 @@ +! +hostname r3 +password zebra +log file /tmp/r3-frr.log +! +!debug pim nht +!debug pim nht detail +!debug pim nht rp +! +interface r3-eth0 + ip address 10.0.1.3/24 + ip igmp + ip pim +! +interface r3-eth1 + ip address 10.0.3.3/24 + ip igmp + ip pim +! +ip forwarding +! +ip route 10.0.0.0/24 10.0.1.1 50 +ip route 10.0.2.0/24 10.0.3.4 50 +! +router pim + rpf-lookup-mode mrib-then-urib + rp 10.0.0.1 224.0.0.0/4 +!
\ No newline at end of file diff --git a/tests/topotests/pim_mrib/r4/frr.conf b/tests/topotests/pim_mrib/r4/frr.conf new file mode 100644 index 000000000..8432a7a35 --- /dev/null +++ b/tests/topotests/pim_mrib/r4/frr.conf @@ -0,0 +1,29 @@ +! +hostname r4 +password zebra +log file /tmp/r4-frr.log +! +debug pim nht +debug pim nht detail +debug pim nht rp +debug zebra rib detail +! +interface r4-eth0 + ip address 10.0.2.4/24 + ip igmp + ip pim +! +interface r4-eth1 + ip address 10.0.3.4/24 + ip igmp + ip pim +! +ip forwarding +! +ip route 10.0.0.0/24 10.0.2.2 50 +ip route 10.0.1.0/24 10.0.3.3 50 +! +router pim + rpf-lookup-mode mrib-then-urib + rp 10.0.0.1 224.0.0.0/4 +!
\ No newline at end of file diff --git a/tests/topotests/pim_mrib/test_pim_mrib.py b/tests/topotests/pim_mrib/test_pim_mrib.py new file mode 100644 index 000000000..355c503e3 --- /dev/null +++ b/tests/topotests/pim_mrib/test_pim_mrib.py @@ -0,0 +1,328 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: ISC + +# +# test_pim_mrib.py +# +# Copyright (c) 2024 ATCorp +# Nathan Bahr +# + +import os +import sys +import pytest +from functools import partial + +# pylint: disable=C0413 +# Import topogen and topotest helpers +from lib import topotest +from lib.topogen import Topogen, get_topogen +from lib.topolog import logger +from lib.pim import ( + verify_pim_rp_info, +) +from lib.common_config import step, write_test_header + +""" +test_pim_mrib.py: Test PIM MRIB overrides and RPF modes +""" + +TOPOLOGY = """ + Test PIM MRIB overrides and RPF modes + + +---+---+ +---+---+ + | | 10.0.0.0/24 | | + + R1 +----------------------+ R2 | + | | .1 .2 | | + +---+---+ r1-eth0 r2-eth0 +---+---+ + .1 | r1-eth1 r2-eth1 | .2 + | | + 10.0.1.0/24 | | 10.0.2.0/24 + | | + .3 | r3-eth0 r4-eth0 | .4 + +---+---+ r3-eth1 r4-eth1 +---+---+ + | | .3 .4 | | + + R3 +----------------------+ R4 | + | | 10.0.3.0/24 | | + +---+---+ +---+---+ +""" + +# Save the Current Working Directory to find configuration files. +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# Required to instantiate the topology builder class. +pytestmark = [pytest.mark.pimd] + + +def build_topo(tgen): + '''Build function''' + + # Create routers + tgen.add_router("r1") + tgen.add_router("r2") + tgen.add_router("r3") + tgen.add_router("r4") + + # Create topology links + tgen.add_link(tgen.gears["r1"], tgen.gears["r2"], "r1-eth0", "r2-eth0") + tgen.add_link(tgen.gears["r1"], tgen.gears["r3"], "r1-eth1", "r3-eth0") + tgen.add_link(tgen.gears["r2"], tgen.gears["r4"], "r2-eth1", "r4-eth0") + tgen.add_link(tgen.gears["r3"], tgen.gears["r4"], "r3-eth1", "r4-eth1") + + +def setup_module(mod): + logger.info("PIM MRIB/RPF functionality:\n {}".format(TOPOLOGY)) + + tgen = Topogen(build_topo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + for rname, router in router_list.items(): + logger.info("Loading router %s" % rname) + router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname))) + + # Initialize all routers. + tgen.start_router() + + +def teardown_module(mod): + '''Teardown the pytest environment''' + tgen = get_topogen() + tgen.stop_topology() + + +def test_pim_mrib_init(request): + '''Test boot in MRIB-than-URIB with the default MRIB''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + step("Verify rp-info using default URIB nexthop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "r4-eth0", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_pim_mrib_override(request): + '''Test MRIB override nexthop''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip("skipped because of router(s) failure") + + # Install a MRIB route that has a shorter prefix length and lower cost. + # In MRIB-than-URIB mode, it should use this route + tgen.routers()["r4"].vtysh_cmd( + ''' + conf term + ip mroute 10.0.0.0/16 10.0.3.3 25 + ''' + ) + + step("Verify rp-info using MRIB nexthop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "r4-eth1", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_pim_mrib_prefix_mode(request): + '''Test longer prefix lookup mode''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip("skipped because of router(s) failure") + + # Switch to longer prefix match, should switch back to the URIB route + # even with the lower cost, the longer prefix match will win because of the mode + tgen.routers()["r4"].vtysh_cmd( + ''' + conf term + router pim + rpf-lookup-mode longer-prefix + ''' + ) + + step("Verify rp-info using URIB nexthop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "r4-eth0", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_pim_mrib_dist_mode(request): + '''Test lower distance lookup mode''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip("skipped because of router(s) failure") + + # Switch to lower distance match, should switch back to the MRIB route + tgen.routers()["r4"].vtysh_cmd( + ''' + conf term + router pim + rpf-lookup-mode lower-distance + ''' + ) + + step("Verify rp-info using MRIB nexthop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "r4-eth1", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_pim_mrib_urib_mode(request): + '''Test URIB only lookup mode''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip("skipped because of router(s) failure") + + # Switch to urib only match, should switch back to the URIB route + tgen.routers()["r4"].vtysh_cmd( + ''' + conf term + router pim + rpf-lookup-mode urib-only + ''' + ) + + step("Verify rp-info using URIB nexthop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "r4-eth0", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_pim_mrib_mrib_mode(request): + '''Test MRIB only lookup mode''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip("skipped because of router(s) failure") + + # Switch to mrib only match, should switch back to the MRIB route + tgen.routers()["r4"].vtysh_cmd( + ''' + conf term + router pim + rpf-lookup-mode mrib-only + ''' + ) + + step("Verify rp-info using MRIB nexthop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "r4-eth1", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_pim_mrib_mrib_mode_no_route(request): + '''Test MRIB only with no route''' + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + pytest.skip("skipped because of router(s) failure") + + # Remove the MRIB route, in mrib-only mode, it should switch to no path for the RP + tgen.routers()["r4"].vtysh_cmd( + ''' + conf term + no ip mroute 10.0.0.0/16 10.0.3.3 25 + ''' + ) + + step("Verify rp-info with Unknown next hop") + result = verify_pim_rp_info( + tgen, + None, + "r4", + "224.0.0.0/4", + "Unknown", + "10.0.0.1", + "Static", + False, + "ipv4", + True, + ) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + +def test_memory_leak(): + '''Run the memory leak test and report results.''' + tgen = get_topogen() + if not tgen.is_memleak_enabled(): + pytest.skip("Memory leak test/report is disabled") + + tgen.report_memory_leaks() + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) |