mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-29 15:03:58 +00:00
pimd: candidate BSR/RP show commands, move under ip pim bsr
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
This commit is contained in:
parent
2d0812373c
commit
865bae9657
@ -1775,69 +1775,53 @@ DEFPY (show_ipv6_pim_secondary,
|
|||||||
return pim_show_secondary_helper(vrf, vty);
|
return pim_show_secondary_helper(vrf, vty);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ipv6_pim_cand_rp,
|
DEFPY (show_ipv6_pim_bsr_cand_bsr,
|
||||||
show_ipv6_pim_cand_rp_cmd,
|
show_ipv6_pim_bsr_cand_bsr_cmd,
|
||||||
"show ipv6 pim candidate-rp [vrf VRF_NAME] [json$uj]",
|
"show ipv6 pim bsr candidate-bsr [vrf NAME$vrfname] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IPV6_STR
|
IPV6_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
"PIM Candidate RP state\n"
|
BSR_STR
|
||||||
|
"Current PIM router candidate BSR state\n"
|
||||||
VRF_CMD_HELP_STR
|
VRF_CMD_HELP_STR
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
struct vrf *vrf = pim_cmd_lookup(vty, vrf_name);
|
int idx = 2;
|
||||||
struct pim_instance *pim;
|
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, !!json);
|
||||||
struct bsm_scope *scope;
|
|
||||||
json_object *json = NULL;
|
|
||||||
|
|
||||||
if (!vrf || !vrf->info)
|
if (!vrf || !vrf->info)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
pim = (struct pim_instance *)vrf->info;
|
return pim_show_bsr_cand_bsr(vrf, vty, !!json);
|
||||||
scope = &pim->global_scope;
|
}
|
||||||
|
|
||||||
if (!scope->cand_rp_addrsel.run) {
|
DEFPY (show_ipv6_pim_bsr_cand_rp,
|
||||||
if (uj)
|
show_ipv6_pim_bsr_cand_rp_cmd,
|
||||||
vty_out(vty, "{}\n");
|
"show ipv6 pim bsr candidate-rp [vrf VRF_NAME] [json$json]",
|
||||||
else
|
SHOW_STR
|
||||||
vty_out(vty,
|
IPV6_STR
|
||||||
"This router is not currently operating as Candidate RP\n");
|
PIM_STR
|
||||||
return CMD_SUCCESS;
|
BSR_STR
|
||||||
}
|
"Current PIM router candidate RP state\n"
|
||||||
|
VRF_CMD_HELP_STR
|
||||||
|
JSON_STR)
|
||||||
|
{
|
||||||
|
struct vrf *vrf = pim_cmd_lookup(vty, vrf_name);
|
||||||
|
|
||||||
if (uj) {
|
if (!vrf || !vrf->info)
|
||||||
json = json_object_new_object();
|
return CMD_WARNING;
|
||||||
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",
|
return pim_show_bsr_cand_rp(vrf, vty, !!json);
|
||||||
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_bsr_rpdb,
|
DEFPY (show_ipv6_pim_bsr_rpdb,
|
||||||
show_ipv6_pim_bsr_rpdb_cmd,
|
show_ipv6_pim_bsr_rpdb_cmd,
|
||||||
"show ipv6 pim bsr candidate-rps [vrf VRF_NAME] [json$uj]",
|
"show ipv6 pim bsr candidate-rp-database [vrf VRF_NAME] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IPV6_STR
|
IPV6_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
"boot-strap router information\n"
|
BSR_STR
|
||||||
"Candidate RPs\n"
|
"Candidate RPs database on this router (if it is the BSR)\n"
|
||||||
VRF_CMD_HELP_STR
|
VRF_CMD_HELP_STR
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
@ -1849,12 +1833,12 @@ DEFPY (show_ipv6_pim_bsr_rpdb,
|
|||||||
struct pim_instance *pim = vrf->info;
|
struct pim_instance *pim = vrf->info;
|
||||||
struct bsm_scope *scope = &pim->global_scope;
|
struct bsm_scope *scope = &pim->global_scope;
|
||||||
|
|
||||||
return pim_crp_db_show(vty, scope);
|
return pim_crp_db_show(vty, scope, !!json);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ipv6_pim_bsr_groups,
|
DEFPY (show_ipv6_pim_bsr_groups,
|
||||||
show_ipv6_pim_bsr_groups_cmd,
|
show_ipv6_pim_bsr_groups_cmd,
|
||||||
"show ipv6 pim bsr groups [vrf VRF_NAME] [json$uj]",
|
"show ipv6 pim bsr groups [vrf VRF_NAME] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IPV6_STR
|
IPV6_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
@ -1871,7 +1855,7 @@ DEFPY (show_ipv6_pim_bsr_groups,
|
|||||||
struct pim_instance *pim = vrf->info;
|
struct pim_instance *pim = vrf->info;
|
||||||
struct bsm_scope *scope = &pim->global_scope;
|
struct bsm_scope *scope = &pim->global_scope;
|
||||||
|
|
||||||
return pim_crp_groups_show(vty, scope);
|
return pim_crp_groups_show(vty, scope, !!json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2864,7 +2848,8 @@ void pim_cmd_init(void)
|
|||||||
install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
|
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_rpf_vrf_all_cmd);
|
||||||
install_element(VIEW_NODE, &show_ipv6_pim_secondary_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_bsr_cand_bsr_cmd);
|
||||||
|
install_element(VIEW_NODE, &show_ipv6_pim_bsr_cand_rp_cmd);
|
||||||
install_element(VIEW_NODE, &show_ipv6_pim_bsr_rpdb_cmd);
|
install_element(VIEW_NODE, &show_ipv6_pim_bsr_rpdb_cmd);
|
||||||
install_element(VIEW_NODE, &show_ipv6_pim_bsr_groups_cmd);
|
install_element(VIEW_NODE, &show_ipv6_pim_bsr_groups_cmd);
|
||||||
install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
|
install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
|
||||||
|
@ -378,28 +378,8 @@ struct pim_nexthop_cache;
|
|||||||
void pim_crp_nht_update(struct pim_instance *pim, struct pim_nexthop_cache *pnc);
|
void pim_crp_nht_update(struct pim_instance *pim, struct pim_nexthop_cache *pnc);
|
||||||
|
|
||||||
void pim_crp_db_clear(struct bsm_scope *scope);
|
void pim_crp_db_clear(struct bsm_scope *scope);
|
||||||
int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope);
|
int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope, bool json);
|
||||||
int pim_crp_groups_show(struct vty *vty, struct bsm_scope *scope);
|
int pim_crp_groups_show(struct vty *vty, struct bsm_scope *scope, bool json);
|
||||||
|
|
||||||
int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
|
|
||||||
uint32_t buf_size);
|
|
||||||
|
|
||||||
struct pim_nexthop_cache;
|
|
||||||
void pim_crp_nht_update(struct pim_instance *pim, struct pim_nexthop_cache *pnc);
|
|
||||||
|
|
||||||
void pim_crp_db_clear(struct bsm_scope *scope);
|
|
||||||
int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope);
|
|
||||||
int pim_crp_groups_show(struct vty *vty, struct bsm_scope *scope);
|
|
||||||
|
|
||||||
int pim_crp_process(struct interface *ifp, pim_sgaddr *src_dst, uint8_t *buf,
|
|
||||||
uint32_t buf_size);
|
|
||||||
|
|
||||||
struct pim_nexthop_cache;
|
|
||||||
void pim_crp_nht_update(struct pim_instance *pim, struct pim_nexthop_cache *pnc);
|
|
||||||
|
|
||||||
void pim_crp_db_clear(struct bsm_scope *scope);
|
|
||||||
int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope);
|
|
||||||
int pim_crp_groups_show(struct vty *vty, struct bsm_scope *scope);
|
|
||||||
|
|
||||||
int pim_cand_config_write(struct pim_instance *pim, struct vty *vty);
|
int pim_cand_config_write(struct pim_instance *pim, struct vty *vty);
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ void pim_crp_db_clear(struct bsm_scope *scope)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope)
|
int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope, bool json)
|
||||||
{
|
{
|
||||||
struct bsr_crp_rp *rp;
|
struct bsr_crp_rp *rp;
|
||||||
struct bsr_crp_item *item;
|
struct bsr_crp_item *item;
|
||||||
@ -609,7 +609,7 @@ int pim_crp_db_show(struct vty *vty, struct bsm_scope *scope)
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_crp_groups_show(struct vty *vty, struct bsm_scope *scope)
|
int pim_crp_groups_show(struct vty *vty, struct bsm_scope *scope, bool json)
|
||||||
{
|
{
|
||||||
struct bsr_crp_group *group;
|
struct bsr_crp_group *group;
|
||||||
struct bsr_crp_item *item;
|
struct bsr_crp_item *item;
|
||||||
|
140
pimd/pim_cmd.c
140
pimd/pim_cmd.c
@ -66,27 +66,6 @@ static struct cmd_node debug_node = {
|
|||||||
.config_write = pim_debug_config_write,
|
.config_write = pim_debug_config_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
|
|
||||||
const int argc, int *idx, bool uj)
|
|
||||||
{
|
|
||||||
struct vrf *vrf;
|
|
||||||
|
|
||||||
if (argv_find(argv, argc, "NAME", idx))
|
|
||||||
vrf = vrf_lookup_by_name(argv[*idx]->arg);
|
|
||||||
else
|
|
||||||
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
|
||||||
|
|
||||||
if (!vrf) {
|
|
||||||
if (uj)
|
|
||||||
vty_json_empty(vty, NULL);
|
|
||||||
else
|
|
||||||
vty_out(vty, "Specified VRF: %s does not exist\n",
|
|
||||||
argv[*idx]->arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return vrf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pim_show_assert_helper(struct vty *vty,
|
static void pim_show_assert_helper(struct vty *vty,
|
||||||
struct pim_interface *pim_ifp,
|
struct pim_interface *pim_ifp,
|
||||||
struct pim_ifchannel *ch, time_t now)
|
struct pim_ifchannel *ch, time_t now)
|
||||||
@ -2864,7 +2843,7 @@ DEFPY (show_ip_pim_bsm_db,
|
|||||||
return pim_show_bsm_db_helper(vrf, vty, !!json);
|
return pim_show_bsm_db_helper(vrf, vty, !!json);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ip_pim_bsrp,
|
DEFPY_HIDDEN (show_ip_pim_bsrp,
|
||||||
show_ip_pim_bsrp_cmd,
|
show_ip_pim_bsrp_cmd,
|
||||||
"show ip pim bsrp-info [vrf NAME] [json$json]",
|
"show ip pim bsrp-info [vrf NAME] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
@ -2877,80 +2856,76 @@ DEFPY (show_ip_pim_bsrp,
|
|||||||
return pim_show_group_rp_mappings_info_helper(vrf, vty, !!json);
|
return pim_show_group_rp_mappings_info_helper(vrf, vty, !!json);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_pim_cand_rp,
|
DEFPY (show_ip_pim_bsr_rpinfo,
|
||||||
show_ip_pim_cand_rp_cmd,
|
show_ip_pim_bsr_rpinfo_cmd,
|
||||||
"show ip pim candidate-rp [vrf NAME] [json]",
|
"show ip pim bsr rp-info [vrf NAME] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
"PIM Candidate RP state\n"
|
BSR_STR
|
||||||
|
"PIM cached group-rp mappings information received from BSR\n"
|
||||||
|
VRF_CMD_HELP_STR
|
||||||
|
JSON_STR)
|
||||||
|
{
|
||||||
|
return pim_show_group_rp_mappings_info_helper(vrf, vty, !!json);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY (show_ip_pim_bsr_cand_bsr,
|
||||||
|
show_ip_pim_bsr_cand_bsr_cmd,
|
||||||
|
"show ip pim bsr candidate-bsr [vrf NAME$vrfname] [json$json]",
|
||||||
|
SHOW_STR
|
||||||
|
IP_STR
|
||||||
|
PIM_STR
|
||||||
|
BSR_STR
|
||||||
|
"Current PIM router candidate BSR state\n"
|
||||||
VRF_CMD_HELP_STR
|
VRF_CMD_HELP_STR
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
bool uj = use_json(argc, argv);
|
|
||||||
int idx = 2;
|
int idx = 2;
|
||||||
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, uj);
|
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, !!json);
|
||||||
struct pim_instance *pim;
|
|
||||||
struct bsm_scope *scope;
|
|
||||||
json_object *json = NULL;
|
|
||||||
|
|
||||||
if (!vrf || !vrf->info)
|
if (!vrf || !vrf->info)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
pim = (struct pim_instance *)vrf->info;
|
return pim_show_bsr_cand_bsr(vrf, vty, !!json);
|
||||||
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) {
|
|
||||||
char buf[INET_ADDRSTRLEN];
|
|
||||||
|
|
||||||
json = json_object_new_object();
|
|
||||||
inet_ntop(AF_INET, &scope->cand_rp_addrsel.run_addr, buf,
|
|
||||||
sizeof(buf));
|
|
||||||
json_object_string_add(json, "address", buf);
|
|
||||||
json_object_int_add(json, "priority", scope->cand_rp_prio);
|
|
||||||
json_object_int_add(json, "nextAdvertisementMsec",
|
|
||||||
pim_time_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: %pI4\nPriority: %u\n\n",
|
|
||||||
&scope->cand_rp_addrsel.run_addr, scope->cand_rp_prio);
|
|
||||||
vty_out(vty, "Next adv.: %lu msec\n",
|
|
||||||
pim_time_timer_remain_msec(scope->cand_rp_adv_timer));
|
|
||||||
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_pim_bsr_rpdb,
|
|
||||||
show_ip_pim_bsr_rpdb_cmd,
|
DEFPY (show_ip_pim_bsr_cand_rp,
|
||||||
"show ip pim bsr candidate-rps [vrf NAME] [json]",
|
show_ip_pim_bsr_cand_rp_cmd,
|
||||||
|
"show ip pim bsr candidate-rp [vrf NAME$vrfname] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
"boot-strap router information\n"
|
BSR_STR
|
||||||
"Candidate RPs\n"
|
"Current PIM router candidate RP state\n"
|
||||||
|
VRF_CMD_HELP_STR
|
||||||
|
JSON_STR)
|
||||||
|
{
|
||||||
|
int idx = 2;
|
||||||
|
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, !!json);
|
||||||
|
|
||||||
|
|
||||||
|
if (!vrf || !vrf->info)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
|
||||||
|
return pim_show_bsr_cand_rp(vrf, vty, !!json);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY (show_ip_pim_bsr_rpdb,
|
||||||
|
show_ip_pim_bsr_rpdb_cmd,
|
||||||
|
"show ip pim bsr candidate-rp-database [vrf NAME$vrfname] [json$json]",
|
||||||
|
SHOW_STR
|
||||||
|
IP_STR
|
||||||
|
PIM_STR
|
||||||
|
BSR_STR
|
||||||
|
"Candidate RPs database on this router (if it is the BSR)\n"
|
||||||
VRF_CMD_HELP_STR
|
VRF_CMD_HELP_STR
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
int idx = 2;
|
int idx = 2;
|
||||||
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, false);
|
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, false);
|
||||||
//bool uj = use_json(argc, argv);
|
|
||||||
|
|
||||||
if (!vrf || !vrf->info)
|
if (!vrf || !vrf->info)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
@ -2958,12 +2933,12 @@ DEFUN (show_ip_pim_bsr_rpdb,
|
|||||||
struct pim_instance *pim = vrf->info;
|
struct pim_instance *pim = vrf->info;
|
||||||
struct bsm_scope *scope = &pim->global_scope;
|
struct bsm_scope *scope = &pim->global_scope;
|
||||||
|
|
||||||
return pim_crp_db_show(vty, scope);
|
return pim_crp_db_show(vty, scope, !!json);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_pim_bsr_groups,
|
DEFPY (show_ip_pim_bsr_groups,
|
||||||
show_ip_pim_bsr_groups_cmd,
|
show_ip_pim_bsr_groups_cmd,
|
||||||
"show ip pim bsr groups [vrf NAME] [json]",
|
"show ip pim bsr groups [vrf NAME$vrfname] [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
@ -2974,7 +2949,6 @@ DEFUN (show_ip_pim_bsr_groups,
|
|||||||
{
|
{
|
||||||
int idx = 2;
|
int idx = 2;
|
||||||
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, false);
|
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, false);
|
||||||
//bool uj = use_json(argc, argv);
|
|
||||||
|
|
||||||
if (!vrf || !vrf->info)
|
if (!vrf || !vrf->info)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
@ -2982,7 +2956,7 @@ DEFUN (show_ip_pim_bsr_groups,
|
|||||||
struct pim_instance *pim = vrf->info;
|
struct pim_instance *pim = vrf->info;
|
||||||
struct bsm_scope *scope = &pim->global_scope;
|
struct bsm_scope *scope = &pim->global_scope;
|
||||||
|
|
||||||
return pim_crp_groups_show(vty, scope);
|
return pim_crp_groups_show(vty, scope, !!json);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ip_pim_statistics,
|
DEFPY (show_ip_pim_statistics,
|
||||||
@ -4534,7 +4508,7 @@ DEFPY (pim_bsr_candidate_rp_group,
|
|||||||
NO_STR
|
NO_STR
|
||||||
BSR_STR
|
BSR_STR
|
||||||
"Make this router a Candidate RP\n"
|
"Make this router a Candidate RP\n"
|
||||||
"Configure groups to become candidate RP for\n"
|
"Configure groups to become candidate RP for (At least one group must be configured)\n"
|
||||||
"Multicast group prefix\n")
|
"Multicast group prefix\n")
|
||||||
{
|
{
|
||||||
return pim_process_bsr_crp_grp_cmd(vty, group_str, no);
|
return pim_process_bsr_crp_grp_cmd(vty, group_str, no);
|
||||||
@ -8838,7 +8812,9 @@ void pim_cmd_init(void)
|
|||||||
install_element(VIEW_NODE, &show_ip_pim_nexthop_lookup_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_nexthop_lookup_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_pim_bsrp_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_bsrp_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_pim_bsm_db_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_bsm_db_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_pim_cand_rp_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_bsr_rpinfo_cmd);
|
||||||
|
install_element(VIEW_NODE, &show_ip_pim_bsr_cand_bsr_cmd);
|
||||||
|
install_element(VIEW_NODE, &show_ip_pim_bsr_cand_rp_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_pim_bsr_rpdb_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_bsr_rpdb_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_pim_bsr_groups_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_bsr_groups_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_pim_statistics_cmd);
|
install_element(VIEW_NODE, &show_ip_pim_statistics_cmd);
|
||||||
|
@ -4207,6 +4207,27 @@ struct vrf *pim_cmd_lookup(struct vty *vty, const char *name)
|
|||||||
return vrf;
|
return vrf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
|
||||||
|
const int argc, int *idx, bool uj)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
|
||||||
|
if (argv_find(argv, argc, "NAME", idx))
|
||||||
|
vrf = vrf_lookup_by_name(argv[*idx]->arg);
|
||||||
|
else
|
||||||
|
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||||
|
|
||||||
|
if (!vrf) {
|
||||||
|
if (uj)
|
||||||
|
vty_json_empty(vty, NULL);
|
||||||
|
else
|
||||||
|
vty_out(vty, "Specified VRF: %s does not exist\n",
|
||||||
|
argv[*idx]->arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vrf;
|
||||||
|
}
|
||||||
|
|
||||||
void clear_mroute(struct pim_instance *pim)
|
void clear_mroute(struct pim_instance *pim)
|
||||||
{
|
{
|
||||||
struct pim_upstream *up;
|
struct pim_upstream *up;
|
||||||
@ -5262,7 +5283,7 @@ void pim_show_bsr(struct pim_instance *pim, struct vty *vty, bool uj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
vty_out(vty, "PIMv2 Bootstrap information\n");
|
vty_out(vty, "PIMv2 Bootstrap Router information\n");
|
||||||
vty_out(vty, "Current preferred BSR address: %pPA\n",
|
vty_out(vty, "Current preferred BSR address: %pPA\n",
|
||||||
&pim->global_scope.current_bsr);
|
&pim->global_scope.current_bsr);
|
||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
@ -5471,6 +5492,101 @@ int pim_show_group_rp_mappings_info_helper(const char *vrf, struct vty *vty,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pim_show_bsr_cand_rp(const struct vrf *vrf, struct vty *vty, bool uj)
|
||||||
|
{
|
||||||
|
struct pim_instance *pim;
|
||||||
|
struct bsm_scope *scope;
|
||||||
|
json_object *jsondata = 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) {
|
||||||
|
jsondata = json_object_new_object();
|
||||||
|
json_object_string_addf(jsondata, "address", "%pPA",
|
||||||
|
&scope->cand_rp_addrsel.run_addr);
|
||||||
|
json_object_int_add(jsondata, "priority", scope->cand_rp_prio);
|
||||||
|
json_object_int_add(jsondata, "nextAdvertisementMsec",
|
||||||
|
event_timer_remain_msec(
|
||||||
|
scope->cand_rp_adv_timer));
|
||||||
|
|
||||||
|
vty_json(vty, jsondata);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pim_show_bsr_cand_bsr(const struct vrf *vrf, struct vty *vty, bool uj)
|
||||||
|
{
|
||||||
|
struct pim_instance *pim;
|
||||||
|
struct bsm_scope *scope;
|
||||||
|
json_object *jsondata = NULL;
|
||||||
|
|
||||||
|
if (!vrf || !vrf->info)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
pim = (struct pim_instance *)vrf->info;
|
||||||
|
scope = &pim->global_scope;
|
||||||
|
|
||||||
|
if (!scope->bsr_addrsel.cfg_enable) {
|
||||||
|
if (!!uj)
|
||||||
|
vty_out(vty, "{}\n");
|
||||||
|
else
|
||||||
|
vty_out(vty,
|
||||||
|
"This router is not currently operating as Candidate BSR\n");
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uj) {
|
||||||
|
char buf[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
|
jsondata = json_object_new_object();
|
||||||
|
inet_ntop(AF_INET, &scope->bsr_addrsel.run_addr, buf,
|
||||||
|
sizeof(buf));
|
||||||
|
json_object_string_add(jsondata, "address", buf);
|
||||||
|
json_object_int_add(jsondata, "priority", scope->cand_bsr_prio);
|
||||||
|
json_object_boolean_add(jsondata, "elected",
|
||||||
|
pim->global_scope.state == BSR_ELECTED);
|
||||||
|
|
||||||
|
vty_out(vty, "%s\n",
|
||||||
|
json_object_to_json_string_ext(jsondata,
|
||||||
|
JSON_C_TO_STRING_PRETTY));
|
||||||
|
json_object_free(jsondata);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
vty_out(vty,
|
||||||
|
"Candidate-BSR\nAddress: %pPA\nPriority: %u\nElected: %s\n",
|
||||||
|
&scope->bsr_addrsel.run_addr, scope->cand_bsr_prio,
|
||||||
|
(pim->global_scope.state == BSR_ELECTED) ? " Yes" : " No");
|
||||||
|
|
||||||
|
if (!pim_addr_cmp(scope->bsr_addrsel.run_addr, PIMADDR_ANY))
|
||||||
|
vty_out(vty,
|
||||||
|
"\nThis router is not currently operating as Candidate BSR\n"
|
||||||
|
"Configure a BSR address to enable this feature\n\n");
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* Display the bsm database details */
|
/* Display the bsm database details */
|
||||||
static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj)
|
static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||||
{
|
{
|
||||||
|
@ -140,6 +140,8 @@ void show_mroute_summary(struct pim_instance *pim, struct vty *vty,
|
|||||||
json_object *json);
|
json_object *json);
|
||||||
int clear_ip_mroute_count_command(struct vty *vty, const char *name);
|
int clear_ip_mroute_count_command(struct vty *vty, const char *name);
|
||||||
struct vrf *pim_cmd_lookup(struct vty *vty, const char *name);
|
struct vrf *pim_cmd_lookup(struct vty *vty, const char *name);
|
||||||
|
struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
|
||||||
|
const int argc, int *idx, bool uj);
|
||||||
void clear_mroute(struct pim_instance *pim);
|
void clear_mroute(struct pim_instance *pim);
|
||||||
void clear_pim_statistics(struct pim_instance *pim);
|
void clear_pim_statistics(struct pim_instance *pim);
|
||||||
int clear_pim_interface_traffic(const char *vrf, struct vty *vty);
|
int clear_pim_interface_traffic(const char *vrf, struct vty *vty);
|
||||||
@ -191,6 +193,8 @@ int pim_show_interface_traffic_helper(const char *vrf, const char *if_name,
|
|||||||
void clear_pim_interfaces(struct pim_instance *pim);
|
void clear_pim_interfaces(struct pim_instance *pim);
|
||||||
void pim_show_bsr(struct pim_instance *pim, struct vty *vty, bool uj);
|
void pim_show_bsr(struct pim_instance *pim, struct vty *vty, bool uj);
|
||||||
int pim_show_bsr_helper(const char *vrf, struct vty *vty, bool uj);
|
int pim_show_bsr_helper(const char *vrf, struct vty *vty, bool uj);
|
||||||
|
int pim_show_bsr_cand_bsr(const struct vrf *vrf, struct vty *vty, bool uj);
|
||||||
|
int pim_show_bsr_cand_rp(const struct vrf *vrf, struct vty *vty, bool uj);
|
||||||
int pim_router_config_write(struct vty *vty);
|
int pim_router_config_write(struct vty *vty);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -277,8 +277,9 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len,
|
|||||||
if (!is_mcast) {
|
if (!is_mcast) {
|
||||||
if (header->type == PIM_MSG_TYPE_CANDIDATE) {
|
if (header->type == PIM_MSG_TYPE_CANDIDATE) {
|
||||||
if (PIM_DEBUG_PIM_PACKETS)
|
if (PIM_DEBUG_PIM_PACKETS)
|
||||||
zlog_debug( "%s %s: Candidate RP PIM message from %pPA on %s",
|
zlog_debug("%s %s: Candidate RP PIM message from %pPA on %s",
|
||||||
__FILE__, __func__, &sg.src, ifp->name);
|
__FILE__, __func__, &sg.src,
|
||||||
|
ifp->name);
|
||||||
|
|
||||||
return pim_crp_process(ifp, &sg, pim_msg, pim_msg_len);
|
return pim_crp_process(ifp, &sg, pim_msg, pim_msg_len);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user