zebra: fix show ip route vrf to use zvrf_list

Iterate over the zvrf_list to allow 'show ip route vrf...'
to show vrfs that are inactive -vs- not even configured

Ticket: CM-10139
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-05-04 13:44:43 +00:00
parent dfa857a5c0
commit 010c141f8a

View File

@ -2055,9 +2055,24 @@ DEFUN (show_ip_route,
struct rib *rib; struct rib *rib;
int first = 1; int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT; vrf_id_t vrf_id = VRF_DEFAULT;
struct zebra_vrf *zvrf = NULL;
if (argc) if (argc)
VRF_GET_ID (vrf_id, argv[0]); {
if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0])))
{
vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE);
return CMD_SUCCESS;
}
if (zvrf->vrf_id == VRF_UNKNOWN)
{
vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE);
return CMD_SUCCESS;
}
else
vrf_id = zvrf->vrf_id;
}
table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id); table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
if (! table) if (! table)
@ -4677,9 +4692,24 @@ DEFUN (show_ipv6_route,
struct rib *rib; struct rib *rib;
int first = 1; int first = 1;
vrf_id_t vrf_id = VRF_DEFAULT; vrf_id_t vrf_id = VRF_DEFAULT;
struct zebra_vrf *zvrf = NULL;
if (argc > 0) if (argc > 0)
VRF_GET_ID (vrf_id, argv[0]); {
if (!(zvrf = zebra_vrf_list_lookup_by_name (argv[0])))
{
vty_out (vty, "vrf %s not defined%s", argv[0], VTY_NEWLINE);
return CMD_SUCCESS;
}
if (zvrf->vrf_id == VRF_UNKNOWN)
{
vty_out (vty, "vrf %s inactive%s", argv[0], VTY_NEWLINE);
return CMD_SUCCESS;
}
else
vrf_id = zvrf->vrf_id;
}
table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id); table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
if (! table) if (! table)