Skip to content

Commit

Permalink
pimd: Candidate-RP support
Browse files Browse the repository at this point in the history
Signed-off-by: David Lamparter <[email protected]>
Signed-off-by: Jafar Al-Gharaibeh <[email protected]>
  • Loading branch information
Jafaral committed Sep 9, 2024
1 parent fbd7431 commit a110bb7
Show file tree
Hide file tree
Showing 18 changed files with 1,206 additions and 14 deletions.
93 changes: 93 additions & 0 deletions pimd/pim6_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,41 @@ DEFPY (no_ipv6_pim_ucast_bsm,
return pim_process_no_unicast_bsm_cmd(vty);
}

DEFPY (pim6_bsr_candidate_rp,
pim6_bsr_candidate_rp_cmd,
"[no] bsr candidate-rp [{priority (0-255)|interval (1-4294967295)|source <address X:X::X:X|interface IFNAME|loopback$loopback|any$any>}]",
NO_STR
"Bootstrap Router configuration\n"
"Make this router a Candidate RP\n"
"RP Priority (lower wins)\n"
"RP Priority (lower wins)\n"
"Advertisement interval (seconds)\n"
"Advertisement interval (seconds)\n"
"Specify IP address for RP operation\n"
"Local address to use\n"
"Local address to use\n"
"Interface to pick address from\n"
"Interface to pick address from\n"
"Pick highest loopback address (default)\n"
"Pick highest address from any interface\n")
{
return pim_process_bsr_candidate_cmd(vty, FRR_PIM_CAND_RP_XPATH, no,
true, any, ifname, address_str,
priority_str, interval_str);
}

DEFPY (pim6_bsr_candidate_rp_group,
pim6_bsr_candidate_rp_group_cmd,
"[no] bsr candidate-rp group X:X::X:X/M",
NO_STR
"Bootstrap Router configuration\n"
"Make this router a Candidate RP\n"
"Configure groups to become candidate RP for\n"
"Multicast group prefix\n")
{
return pim_process_bsr_crp_grp_cmd(vty, group_str, no);
}

DEFPY (pim6_ssmpingd,
pim6_ssmpingd_cmd,
"ssmpingd [X:X::X:X]$source",
Expand Down Expand Up @@ -1719,6 +1754,61 @@ DEFPY (show_ipv6_pim_secondary,
return pim_show_secondary_helper(vrf, vty);
}

DEFPY (show_ipv6_pim_cand_rp,
show_ipv6_pim_cand_rp_cmd,
"show ipv6 pim candidate-rp [vrf VRF_NAME] [json$uj]",
SHOW_STR
IPV6_STR
PIM_STR
"PIM Candidate RP state\n"
VRF_CMD_HELP_STR
JSON_STR)
{
struct vrf *vrf = pim_cmd_lookup(vty, vrf_name);
struct pim_instance *pim;
struct bsm_scope *scope;
json_object *json = NULL;

if (!vrf || !vrf->info)
return CMD_WARNING;

pim = (struct pim_instance *)vrf->info;
scope = &pim->global_scope;

if (!scope->cand_rp_addrsel.run) {
if (uj)
vty_out(vty, "{}\n");
else
vty_out(vty,
"This router is not currently operating as Candidate RP\n");
return CMD_SUCCESS;
}

if (uj) {
json = json_object_new_object();
json_object_string_addf(json, "address", "%pPA",
&scope->cand_rp_addrsel.run_addr);
json_object_int_add(json, "priority", scope->cand_rp_prio);
json_object_int_add(json, "nextAdvertisementMsec",
event_timer_remain_msec(
scope->cand_rp_adv_timer));

vty_out(vty, "%s\n",
json_object_to_json_string_ext(json,
JSON_C_TO_STRING_PRETTY));
json_object_free(json);
return CMD_SUCCESS;
}

vty_out(vty, "Candidate-RP\nAddress: %pPA\nPriority: %u\n\n",
&scope->cand_rp_addrsel.run_addr, scope->cand_rp_prio);
vty_out(vty, "Next adv.: %lu msec\n",
event_timer_remain_msec(scope->cand_rp_adv_timer));


return CMD_SUCCESS;
}

DEFPY (show_ipv6_pim_statistics,
show_ipv6_pim_statistics_cmd,
"show ipv6 pim [vrf NAME] statistics [interface WORD$word] [json$json]",
Expand Down Expand Up @@ -2650,6 +2740,8 @@ void pim_cmd_init(void)
install_element(PIM6_NODE, &no_pim6_rp_prefix_list_cmd);
install_element(PIM6_NODE, &pim6_ssmpingd_cmd);
install_element(PIM6_NODE, &no_pim6_ssmpingd_cmd);
install_element(PIM6_NODE, &pim6_bsr_candidate_rp_cmd);
install_element(PIM6_NODE, &pim6_bsr_candidate_rp_group_cmd);

install_element(CONFIG_NODE, &ipv6_mld_group_watermark_cmd);
install_element(VRF_NODE, &ipv6_mld_group_watermark_cmd);
Expand Down Expand Up @@ -2705,6 +2797,7 @@ void pim_cmd_init(void)
install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_rpf_vrf_all_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_secondary_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_cand_rp_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_upstream_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_upstream_vrf_all_cmd);
Expand Down
1 change: 1 addition & 0 deletions pimd/pim6_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static const struct frr_yang_module_info *const pim6d_yang_modules[] = {
&frr_routing_info,
&frr_pim_info,
&frr_pim_rp_info,
&frr_pim_candidate_info,
&frr_gmp_info,
};

Expand Down
Loading

0 comments on commit a110bb7

Please sign in to comment.