mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 21:10:28 +00:00
zebra: merge four "show ip nht" commands into a single DEFPY
This is mostly to be consistent with the "show ip import-check" command, which is very similar. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
76fc688e09
commit
7004c67b35
@ -930,21 +930,35 @@ DEFPY (show_route_table_vrf,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (show_ip_nht,
|
||||
DEFPY (show_ip_nht,
|
||||
show_ip_nht_cmd,
|
||||
"show ip nht [vrf NAME]",
|
||||
"show <ip$ipv4|ipv6$ipv6> nht [vrf NAME$vrf_name|vrf all$vrf_all]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
IP6_STR
|
||||
"IP nexthop tracking table\n"
|
||||
VRF_CMD_HELP_STR)
|
||||
VRF_CMD_HELP_STR
|
||||
VRF_ALL_CMD_HELP_STR)
|
||||
{
|
||||
int idx_vrf = 4;
|
||||
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
|
||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||
|
||||
if (argc == 5)
|
||||
VRF_GET_ID(vrf_id, argv[idx_vrf]->arg, false);
|
||||
if (vrf_all) {
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
|
||||
zebra_print_rnh_table(vrf_id, AFI_IP, vty, RNH_NEXTHOP_TYPE);
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
|
||||
if ((zvrf = vrf->info) != NULL) {
|
||||
vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
|
||||
zebra_print_rnh_table(zvrf_id(zvrf), afi, vty,
|
||||
RNH_NEXTHOP_TYPE);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
if (vrf_name)
|
||||
VRF_GET_ID(vrf_id, vrf_name, false);
|
||||
|
||||
zebra_print_rnh_table(vrf_id, afi, vty, RNH_NEXTHOP_TYPE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -981,67 +995,6 @@ DEFPY (show_ip_import_check,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (show_ip_nht_vrf_all,
|
||||
show_ip_nht_vrf_all_cmd,
|
||||
"show ip nht vrf all",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
"IP nexthop tracking table\n"
|
||||
VRF_ALL_CMD_HELP_STR)
|
||||
{
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
|
||||
if ((zvrf = vrf->info) != NULL) {
|
||||
vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
|
||||
zebra_print_rnh_table(zvrf_id(zvrf), AFI_IP, vty,
|
||||
RNH_NEXTHOP_TYPE);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (show_ipv6_nht,
|
||||
show_ipv6_nht_cmd,
|
||||
"show ipv6 nht [vrf NAME]",
|
||||
SHOW_STR
|
||||
IPV6_STR
|
||||
"IPv6 nexthop tracking table\n"
|
||||
VRF_CMD_HELP_STR)
|
||||
{
|
||||
int idx_vrf = 4;
|
||||
vrf_id_t vrf_id = VRF_DEFAULT;
|
||||
|
||||
if (argc == 5)
|
||||
VRF_GET_ID(vrf_id, argv[idx_vrf]->arg, false);
|
||||
|
||||
zebra_print_rnh_table(vrf_id, AFI_IP6, vty, RNH_NEXTHOP_TYPE);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
DEFUN (show_ipv6_nht_vrf_all,
|
||||
show_ipv6_nht_vrf_all_cmd,
|
||||
"show ipv6 nht vrf all",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
"IPv6 nexthop tracking table\n"
|
||||
VRF_ALL_CMD_HELP_STR)
|
||||
{
|
||||
struct vrf *vrf;
|
||||
struct zebra_vrf *zvrf;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
|
||||
if ((zvrf = vrf->info) != NULL) {
|
||||
vty_out(vty, "\nVRF %s:\n", zvrf_name(zvrf));
|
||||
zebra_print_rnh_table(zvrf_id(zvrf), AFI_IP6, vty,
|
||||
RNH_NEXTHOP_TYPE);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (ip_nht_default_route,
|
||||
ip_nht_default_route_cmd,
|
||||
"ip nht resolve-via-default",
|
||||
@ -2954,9 +2907,6 @@ void zebra_vty_init(void)
|
||||
install_element(VIEW_NODE, &show_route_summary_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_nht_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_import_check_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_nht_vrf_all_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_nht_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_nht_vrf_all_cmd);
|
||||
|
||||
install_element(VIEW_NODE, &show_ip_rpf_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_rpf_addr_cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user