Skip to content

Commit f3fc33e

Browse files
authored
Merge pull request #16438 from Jafaral/pim-10.1-cand-rp
PIM candidate BSR/RP support
2 parents 38bd668 + 571108e commit f3fc33e

36 files changed

+3488
-149
lines changed

doc/user/pim.rst

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,41 @@ PIM Routers
8383
cannot see data flowing in better than 30 second chunks. This command is
8484
vrf aware, to configure for a vrf, specify the vrf in the router pim block.
8585

86+
.. clicmd:: bsr candidate-bsr [priority (0-255)] [source [address A.B.C.D] | [interface INTERFACE] | [loopback] | [any]]
87+
88+
Configure the router to advertise itself as a candidate PIM-SM BSR. The candidate
89+
with the highest priority becomes the BSR for the domain (high wins). When priority is the
90+
same for more than one candidate BSR, the candidate with the highest IP address
91+
becomes the BSR of the domain. The address can be configured explicitly
92+
via ``address``, or be selecting an interface name using ``interface``.
93+
If ``any`` is configured the highest address from any interface will be selected.
94+
By default, the highest loopback address is selected, which can also be
95+
configured via ``loopback``
96+
97+
.. clicmd:: bsr candidate-rp [interval]
98+
99+
Configure the router to advertise itself as a candidate PIM-SM RP at the
100+
specified ``interval`` in seconds.
101+
102+
103+
.. clicmd:: bsr candidate-rp group A.B.C.D/M
104+
105+
Configure the multicast group prefix that this candidate RP advertises itself for.
106+
This command can be repeated for all desired groups that need to be added to the
107+
candidate RP advertisement.
108+
109+
.. clicmd:: bsr candidate-rp [priority (0-255)] [source [address A.B.C.D] | [interface INTERFACE] | [loopback] | [any]]
110+
111+
Configure the router to advertise itself as a candidate PIM-SM RP. ``interval``
112+
can be used to configure the interval in seconds to send these advertisements.
113+
The candidate with the lowest priority becomes the RP for the domain (low wins).
114+
When priority is the same for more than one candidate RP, the candidate with
115+
the highest IP address becomes the BSR of the domain. The address can be
116+
configured explicitly via ``address``, or be selecting an interface name
117+
using ``interface``. If ``any`` is configured the highest address from any
118+
interface will be selected.By default, the highest loopback address is
119+
selected, which can also be configured via ``loopback``.
120+
86121
.. clicmd:: register-accept-list PLIST
87122

88123
When pim receives a register packet the source of the packet will be compared
@@ -611,11 +646,28 @@ cause great confusion.
611646
Display PIM MLAG (multi-chassis link aggregation) session status and
612647
control message statistics.
613648

614-
.. clicmd:: show ip pim bsr
649+
.. clicmd:: show ip pim bsr [vrf NAME] [json]
615650

616651
Display current bsr, its uptime and last received bsm age.
617652

618-
.. clicmd:: show ip pim bsrp-info [vrf NAME] [json]
653+
.. clicmd:: show ip pim bsr candidate-bsr [vrf NAME] [json]
654+
655+
Display information about the candidate BSR state on this router.
656+
657+
.. clicmd:: show ip pim bsr candidate-rp [vrf NAME] [json]
658+
659+
Display information about the candidate RP state on this router.
660+
661+
.. clicmd:: show ip pim bsr candidate-rp-database [vrf NAME] [json]
662+
663+
Display the current list of candidate RPs received by this router.
664+
665+
.. clicmd:: show ip pim bsr groups [vrf NAME] [json]
666+
667+
Display the current list of multicast group mapping received by
668+
this router from candidate RPs.
669+
670+
.. clicmd:: show ip pim bsr rp-info [vrf NAME] [json]
619671

620672
Display group-to-rp mappings received from E-BSR.
621673

doc/user/pimv6.rst

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,29 @@ PIMv6 Router
8080
cannot see data flowing in better than 30 second chunks. This command is
8181
vrf aware, to configure for a vrf, specify the vrf in the router pim6 block.
8282

83+
.. clicmd:: bsr candidate-bsr [priority (0-255)] [source [address X:X::X:X] | [interface INTERFACE] | [loopback] | [any]]
84+
85+
Configure the router to advertise itself as a candidate PIM-SM BSR. The candidate
86+
with the highest priority becomes the BSR for the domain (high wins). When priority is the
87+
same for more than one candidate BSR, the candidate with the highest IP address
88+
becomes the BSR of the domain. The address can be configured explicitly
89+
via ``address``, or be selecting an interface name using ``interface``.
90+
If ``any`` is configured the highest address from any interface will be selected.
91+
By default, the highest loopback address is selected, which can also be
92+
configured via ``loopback``
93+
94+
.. clicmd:: bsr candidate-rp [interval (1-4294967295) ] [priority (0-255)] [source [address X:X::X:X] | [interface INTERFACE] | [loopback] | [any]]
95+
96+
Configure the router to advertise itself as a candidate PIM-SM RP. ``interval``
97+
can be used to configure the interval in seconds to send these advertisements.
98+
The candidate with the lowest priority becomes the RP for the domain (low wins).
99+
When priority is the same for more than one candidate RP, the candidate with
100+
the highest IP address becomes the BSR of the domain. The address can be
101+
configured explicitly via ``address``, or be selecting an interface name
102+
using ``interface``. If ``any`` is configured the highest address from any
103+
interface will be selected.By default, the highest loopback address is
104+
selected, which can also be configured via ``loopback``.
105+
83106
.. clicmd:: spt-switchover infinity-and-beyond [prefix-list PLIST]
84107

85108
On the last hop router if it is desired to not switch over to the SPT tree
@@ -391,11 +414,28 @@ General multicast routing state
391414
Display total number of S,G mroutes and number of S,G mroutes
392415
installed into the kernel for all vrfs.
393416

394-
.. clicmd:: show ipv6 pim bsr
417+
.. clicmd:: show ipv6 pim bsr [vrf NAME] [json]
395418

396419
Display current bsr, its uptime and last received bsm age.
397420

398-
.. clicmd:: show ipv6 pim bsrp-info [vrf NAME] [json]
421+
.. clicmd:: show ipv6 pim bsr candidate-bsr [vrf NAME] [json]
422+
423+
Display information about the candidate BSR state on this router.
424+
425+
.. clicmd:: show ipv6 pim bsr candidate-rp [vrf NAME] [json]
426+
427+
Display information about the candidate RP state on this router.
428+
429+
.. clicmd:: show ipv6 pim bsr candidate-rp-database [vrf NAME] [json]
430+
431+
Display the current list of candidate RPs received by this router.
432+
433+
.. clicmd:: show ipv6 pim bsr groups [vrf NAME] [json]
434+
435+
Display the current list of multicast group mapping received by
436+
this router from candidate RPs.
437+
438+
.. clicmd:: show ipv6 pim bsr rp-info [vrf NAME] [json]
399439

400440
Display group-to-rp mappings received from E-BSR.
401441

pimd/pim6_cmd.c

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,62 @@ DEFPY (no_ipv6_pim_ucast_bsm,
12591259
return pim_process_no_unicast_bsm_cmd(vty);
12601260
}
12611261

1262+
DEFPY (pim6_bsr_candidate_bsr,
1263+
pim6_bsr_candidate_bsr_cmd,
1264+
"[no] bsr candidate-bsr [{priority (0-255)|source <address X:X::X:X|interface IFNAME|loopback$loopback|any$any>}]",
1265+
NO_STR
1266+
BSR_STR
1267+
"Make this router a Candidate BSR\n"
1268+
"BSR Priority (higher wins)\n"
1269+
"BSR Priority (higher wins)\n"
1270+
"Specify IP address for BSR operation\n"
1271+
"Local address to use\n"
1272+
"Local address to use\n"
1273+
"Interface to pick address from\n"
1274+
"Interface to pick address from\n"
1275+
"Pick highest loopback address (default)\n"
1276+
"Pick highest address from any interface\n")
1277+
{
1278+
return pim_process_bsr_candidate_cmd(vty, FRR_PIM_CAND_BSR_XPATH, no,
1279+
false, any, ifname, address_str,
1280+
priority_str, NULL);
1281+
}
1282+
1283+
DEFPY (pim6_bsr_candidate_rp,
1284+
pim6_bsr_candidate_rp_cmd,
1285+
"[no] bsr candidate-rp [{priority (0-255)|interval (1-4294967295)|source <address X:X::X:X|interface IFNAME|loopback$loopback|any$any>}]",
1286+
NO_STR
1287+
"Bootstrap Router configuration\n"
1288+
"Make this router a Candidate RP\n"
1289+
"RP Priority (lower wins)\n"
1290+
"RP Priority (lower wins)\n"
1291+
"Advertisement interval (seconds)\n"
1292+
"Advertisement interval (seconds)\n"
1293+
"Specify IP address for RP operation\n"
1294+
"Local address to use\n"
1295+
"Local address to use\n"
1296+
"Interface to pick address from\n"
1297+
"Interface to pick address from\n"
1298+
"Pick highest loopback address (default)\n"
1299+
"Pick highest address from any interface\n")
1300+
{
1301+
return pim_process_bsr_candidate_cmd(vty, FRR_PIM_CAND_RP_XPATH, no,
1302+
true, any, ifname, address_str,
1303+
priority_str, interval_str);
1304+
}
1305+
1306+
DEFPY (pim6_bsr_candidate_rp_group,
1307+
pim6_bsr_candidate_rp_group_cmd,
1308+
"[no] bsr candidate-rp group X:X::X:X/M",
1309+
NO_STR
1310+
"Bootstrap Router configuration\n"
1311+
"Make this router a Candidate RP\n"
1312+
"Configure groups to become candidate RP for\n"
1313+
"Multicast group prefix\n")
1314+
{
1315+
return pim_process_bsr_crp_grp_cmd(vty, group_str, no);
1316+
}
1317+
12621318
DEFPY (pim6_ssmpingd,
12631319
pim6_ssmpingd_cmd,
12641320
"ssmpingd [X:X::X:X]$source",
@@ -1719,6 +1775,90 @@ DEFPY (show_ipv6_pim_secondary,
17191775
return pim_show_secondary_helper(vrf, vty);
17201776
}
17211777

1778+
DEFPY (show_ipv6_pim_bsr_cand_bsr,
1779+
show_ipv6_pim_bsr_cand_bsr_cmd,
1780+
"show ipv6 pim bsr candidate-bsr [vrf NAME$vrfname] [json$json]",
1781+
SHOW_STR
1782+
IPV6_STR
1783+
PIM_STR
1784+
BSR_STR
1785+
"Current PIM router candidate BSR state\n"
1786+
VRF_CMD_HELP_STR
1787+
JSON_STR)
1788+
{
1789+
int idx = 2;
1790+
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, !!json);
1791+
1792+
if (!vrf || !vrf->info)
1793+
return CMD_WARNING;
1794+
1795+
return pim_show_bsr_cand_bsr(vrf, vty, !!json);
1796+
}
1797+
1798+
DEFPY (show_ipv6_pim_bsr_cand_rp,
1799+
show_ipv6_pim_bsr_cand_rp_cmd,
1800+
"show ipv6 pim bsr candidate-rp [vrf VRF_NAME] [json$json]",
1801+
SHOW_STR
1802+
IPV6_STR
1803+
PIM_STR
1804+
BSR_STR
1805+
"Current PIM router candidate RP state\n"
1806+
VRF_CMD_HELP_STR
1807+
JSON_STR)
1808+
{
1809+
struct vrf *vrf = pim_cmd_lookup(vty, vrf_name);
1810+
1811+
if (!vrf || !vrf->info)
1812+
return CMD_WARNING;
1813+
1814+
return pim_show_bsr_cand_rp(vrf, vty, !!json);
1815+
}
1816+
1817+
DEFPY (show_ipv6_pim_bsr_rpdb,
1818+
show_ipv6_pim_bsr_rpdb_cmd,
1819+
"show ipv6 pim bsr candidate-rp-database [vrf VRF_NAME] [json$json]",
1820+
SHOW_STR
1821+
IPV6_STR
1822+
PIM_STR
1823+
BSR_STR
1824+
"Candidate RPs database on this router (if it is the BSR)\n"
1825+
VRF_CMD_HELP_STR
1826+
JSON_STR)
1827+
{
1828+
struct vrf *vrf = pim_cmd_lookup(vty, vrf_name);
1829+
1830+
if (!vrf || !vrf->info)
1831+
return CMD_WARNING;
1832+
1833+
struct pim_instance *pim = vrf->info;
1834+
struct bsm_scope *scope = &pim->global_scope;
1835+
1836+
return pim_crp_db_show(vty, scope, !!json);
1837+
}
1838+
1839+
DEFPY (show_ipv6_pim_bsr_groups,
1840+
show_ipv6_pim_bsr_groups_cmd,
1841+
"show ipv6 pim bsr groups [vrf VRF_NAME] [json$json]",
1842+
SHOW_STR
1843+
IPV6_STR
1844+
PIM_STR
1845+
"boot-strap router information\n"
1846+
"Candidate RP groups\n"
1847+
VRF_CMD_HELP_STR
1848+
JSON_STR)
1849+
{
1850+
struct vrf *vrf = pim_cmd_lookup(vty, vrf_name);
1851+
1852+
if (!vrf || !vrf->info)
1853+
return CMD_WARNING;
1854+
1855+
struct pim_instance *pim = vrf->info;
1856+
struct bsm_scope *scope = &pim->global_scope;
1857+
1858+
return pim_crp_groups_show(vty, scope, !!json);
1859+
}
1860+
1861+
17221862
DEFPY (show_ipv6_pim_statistics,
17231863
show_ipv6_pim_statistics_cmd,
17241864
"show ipv6 pim [vrf NAME] statistics [interface WORD$word] [json$json]",
@@ -2650,6 +2790,9 @@ void pim_cmd_init(void)
26502790
install_element(PIM6_NODE, &no_pim6_rp_prefix_list_cmd);
26512791
install_element(PIM6_NODE, &pim6_ssmpingd_cmd);
26522792
install_element(PIM6_NODE, &no_pim6_ssmpingd_cmd);
2793+
install_element(PIM6_NODE, &pim6_bsr_candidate_rp_cmd);
2794+
install_element(PIM6_NODE, &pim6_bsr_candidate_rp_group_cmd);
2795+
install_element(PIM6_NODE, &pim6_bsr_candidate_bsr_cmd);
26532796

26542797
install_element(CONFIG_NODE, &ipv6_mld_group_watermark_cmd);
26552798
install_element(VRF_NODE, &ipv6_mld_group_watermark_cmd);
@@ -2705,6 +2848,10 @@ void pim_cmd_init(void)
27052848
install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
27062849
install_element(VIEW_NODE, &show_ipv6_pim_rpf_vrf_all_cmd);
27072850
install_element(VIEW_NODE, &show_ipv6_pim_secondary_cmd);
2851+
install_element(VIEW_NODE, &show_ipv6_pim_bsr_cand_bsr_cmd);
2852+
install_element(VIEW_NODE, &show_ipv6_pim_bsr_cand_rp_cmd);
2853+
install_element(VIEW_NODE, &show_ipv6_pim_bsr_rpdb_cmd);
2854+
install_element(VIEW_NODE, &show_ipv6_pim_bsr_groups_cmd);
27082855
install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
27092856
install_element(VIEW_NODE, &show_ipv6_pim_upstream_cmd);
27102857
install_element(VIEW_NODE, &show_ipv6_pim_upstream_vrf_all_cmd);

pimd/pim6_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ static const struct frr_yang_module_info *const pim6d_yang_modules[] = {
103103
&frr_routing_info,
104104
&frr_pim_info,
105105
&frr_pim_rp_info,
106+
&frr_pim_candidate_info,
106107
&frr_gmp_info,
107108
};
108109

0 commit comments

Comments
 (0)