mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
pim6d: Implementing "show ipv6 pim upstream-join-desired" CLI
Adding new show CLI to display group join desired status. Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
parent
95023bd72a
commit
e577f6e7d5
@ -932,6 +932,37 @@ DEFPY (show_ipv6_pim_upstream_vrf_all,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFPY (show_ipv6_pim_upstream_join_desired,
|
||||||
|
show_ipv6_pim_upstream_join_desired_cmd,
|
||||||
|
"show ipv6 pim [vrf NAME] upstream-join-desired [json$json]",
|
||||||
|
SHOW_STR
|
||||||
|
IPV6_STR
|
||||||
|
PIM_STR
|
||||||
|
VRF_CMD_HELP_STR
|
||||||
|
"PIM upstream join-desired\n"
|
||||||
|
JSON_STR)
|
||||||
|
{
|
||||||
|
struct pim_instance *pim;
|
||||||
|
struct vrf *v;
|
||||||
|
bool uj = !!json;
|
||||||
|
|
||||||
|
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
|
if (!v)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
pim = pim_get_pim_instance(v->vrf_id);
|
||||||
|
|
||||||
|
if (!pim) {
|
||||||
|
vty_out(vty, "%% Unable to find pim instance\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
pim_show_join_desired(pim, vty, uj);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void pim_cmd_init(void)
|
void pim_cmd_init(void)
|
||||||
{
|
{
|
||||||
if_cmd_init(pim_interface_config_write);
|
if_cmd_init(pim_interface_config_write);
|
||||||
@ -992,4 +1023,5 @@ void pim_cmd_init(void)
|
|||||||
install_element(VIEW_NODE, &show_ipv6_pim_statistics_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_cmd);
|
||||||
install_element(VIEW_NODE, &show_ipv6_pim_upstream_vrf_all_cmd);
|
install_element(VIEW_NODE, &show_ipv6_pim_upstream_vrf_all_cmd);
|
||||||
|
install_element(VIEW_NODE, &show_ipv6_pim_upstream_join_desired_cmd);
|
||||||
}
|
}
|
||||||
|
@ -4509,9 +4509,9 @@ DEFUN (show_ip_pim_channel,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_pim_upstream_join_desired,
|
DEFPY (show_ip_pim_upstream_join_desired,
|
||||||
show_ip_pim_upstream_join_desired_cmd,
|
show_ip_pim_upstream_join_desired_cmd,
|
||||||
"show ip pim [vrf NAME] upstream-join-desired [json]",
|
"show ip pim [vrf NAME] upstream-join-desired [json$json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
@ -4519,14 +4519,23 @@ DEFUN (show_ip_pim_upstream_join_desired,
|
|||||||
"PIM upstream join-desired\n"
|
"PIM upstream join-desired\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
int idx = 2;
|
struct pim_instance *pim;
|
||||||
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
|
struct vrf *v;
|
||||||
bool uj = use_json(argc, argv);
|
bool uj = !!json;
|
||||||
|
|
||||||
if (!vrf)
|
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
|
if (!v)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
pim_show_join_desired(vrf->info, vty, uj);
|
pim = pim_get_pim_instance(v->vrf_id);
|
||||||
|
|
||||||
|
if (!pim) {
|
||||||
|
vty_out(vty, "%% Unable to find pim instance\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
pim_show_join_desired(pim, vty, uj);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1404,14 +1404,15 @@ static void pim_show_join_desired_helper(struct pim_instance *pim,
|
|||||||
json_object *json, bool uj)
|
json_object *json, bool uj)
|
||||||
{
|
{
|
||||||
json_object *json_group = NULL;
|
json_object *json_group = NULL;
|
||||||
char src_str[INET_ADDRSTRLEN];
|
|
||||||
char grp_str[INET_ADDRSTRLEN];
|
|
||||||
json_object *json_row = NULL;
|
json_object *json_row = NULL;
|
||||||
|
|
||||||
pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
|
|
||||||
pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
|
|
||||||
|
|
||||||
if (uj) {
|
if (uj) {
|
||||||
|
char grp_str[PIM_ADDRSTRLEN];
|
||||||
|
char src_str[PIM_ADDRSTRLEN];
|
||||||
|
|
||||||
|
snprintfrr(grp_str, sizeof(grp_str), "%pPAs", &up->sg.grp);
|
||||||
|
snprintfrr(src_str, sizeof(src_str), "%pPAs", &up->sg.src);
|
||||||
|
|
||||||
json_object_object_get_ex(json, grp_str, &json_group);
|
json_object_object_get_ex(json, grp_str, &json_group);
|
||||||
|
|
||||||
if (!json_group) {
|
if (!json_group) {
|
||||||
@ -1431,7 +1432,8 @@ static void pim_show_join_desired_helper(struct pim_instance *pim,
|
|||||||
json_object_object_add(json_group, src_str, json_row);
|
json_object_object_add(json_group, src_str, json_row);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
vty_out(vty, "%-15s %-15s %-6s\n", src_str, grp_str,
|
vty_out(vty, "%-15pPAs %-15pPAs %-6s\n", &up->sg.src,
|
||||||
|
&up->sg.grp,
|
||||||
pim_upstream_evaluate_join_desired(pim, up) ? "yes"
|
pim_upstream_evaluate_join_desired(pim, up) ? "yes"
|
||||||
: "no");
|
: "no");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user