mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 06:03:10 +00:00
pim6d: Moving reusable code to common api for "show ip/ipv6 multicast" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
parent
e7c01c6769
commit
8e15c9aa06
@ -1329,24 +1329,7 @@ DEFPY (show_ipv6_multicast,
|
|||||||
"Multicast global information\n"
|
"Multicast global information\n"
|
||||||
VRF_CMD_HELP_STR)
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
struct vrf *v;
|
return pim_show_multicast_helper(vrf, vty);
|
||||||
struct pim_instance *pim;
|
|
||||||
|
|
||||||
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_cmd_show_ip_multicast_helper(pim, vty);
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ipv6_multicast_vrf_all,
|
DEFPY (show_ipv6_multicast_vrf_all,
|
||||||
@ -1357,14 +1340,7 @@ DEFPY (show_ipv6_multicast_vrf_all,
|
|||||||
"Multicast global information\n"
|
"Multicast global information\n"
|
||||||
VRF_CMD_HELP_STR)
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
struct vrf *vrf;
|
return pim_show_multicast_vrf_all_helper(vty);
|
||||||
|
|
||||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
||||||
vty_out(vty, "VRF: %s\n", vrf->name);
|
|
||||||
pim_cmd_show_ip_multicast_helper(vrf->info, vty);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ipv6_multicast_count,
|
DEFPY (show_ipv6_multicast_count,
|
||||||
|
@ -3317,24 +3317,7 @@ DEFPY (show_ip_multicast,
|
|||||||
"Multicast global information\n"
|
"Multicast global information\n"
|
||||||
VRF_CMD_HELP_STR)
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
struct vrf *v;
|
return pim_show_multicast_helper(vrf, vty);
|
||||||
struct pim_instance *pim;
|
|
||||||
|
|
||||||
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_cmd_show_ip_multicast_helper(pim, vty);
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ip_multicast_vrf_all,
|
DEFPY (show_ip_multicast_vrf_all,
|
||||||
@ -3345,14 +3328,7 @@ DEFPY (show_ip_multicast_vrf_all,
|
|||||||
"Multicast global information\n"
|
"Multicast global information\n"
|
||||||
VRF_CMD_HELP_STR)
|
VRF_CMD_HELP_STR)
|
||||||
{
|
{
|
||||||
struct vrf *vrf;
|
return pim_show_multicast_vrf_all_helper(vty);
|
||||||
|
|
||||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
||||||
vty_out(vty, "VRF: %s\n", vrf->name);
|
|
||||||
pim_cmd_show_ip_multicast_helper(vrf->info, vty);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ip_multicast_count,
|
DEFPY (show_ip_multicast_count,
|
||||||
|
@ -4081,3 +4081,37 @@ int pim_show_state_vrf_all_helper(struct vty *vty, const char *s_or_g_str,
|
|||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pim_show_multicast_helper(const char *vrf, struct vty *vty)
|
||||||
|
{
|
||||||
|
struct vrf *v;
|
||||||
|
struct pim_instance *pim;
|
||||||
|
|
||||||
|
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_cmd_show_ip_multicast_helper(pim, vty);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pim_show_multicast_vrf_all_helper(struct vty *vty)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
|
||||||
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||||
|
vty_out(vty, "VRF: %s\n", vrf->name);
|
||||||
|
pim_cmd_show_ip_multicast_helper(vrf->info, vty);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
@ -150,6 +150,8 @@ int pim_show_state_helper(const char *vrf, struct vty *vty,
|
|||||||
const char *s_or_g_str, const char *g_str, bool json);
|
const char *s_or_g_str, const char *g_str, bool json);
|
||||||
int pim_show_state_vrf_all_helper(struct vty *vty, const char *s_or_g_str,
|
int pim_show_state_vrf_all_helper(struct vty *vty, const char *s_or_g_str,
|
||||||
const char *g_str, bool json);
|
const char *g_str, bool json);
|
||||||
|
int pim_show_multicast_helper(const char *vrf, struct vty *vty);
|
||||||
|
int pim_show_multicast_vrf_all_helper(struct vty *vty);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special Macro to allow us to get the correct pim_instance;
|
* Special Macro to allow us to get the correct pim_instance;
|
||||||
|
Loading…
Reference in New Issue
Block a user