summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 38de01e228..5ce9d3f293 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -394,6 +394,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
json_object *json_labels = NULL;
time_t uptime;
struct tm *tm;
+ struct vrf *vrf = NULL;
rib_dest_t *dest = rib_dest_from_rnode(rn);
struct nexthop_group *nhg;
@@ -422,9 +423,13 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
json_object_int_add(json_route, "instance",
re->instance);
- if (re->vrf_id)
+ if (re->vrf_id) {
json_object_int_add(json_route, "vrfId", re->vrf_id);
+ vrf = vrf_lookup_by_id(re->vrf_id);
+ json_object_string_add(json_route, "vrfName",
+ vrf->name);
+ }
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))
json_object_boolean_true_add(json_route, "selected");
@@ -565,9 +570,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
if ((nexthop->vrf_id != re->vrf_id)
&& (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)) {
- struct vrf *vrf =
- vrf_lookup_by_id(nexthop->vrf_id);
-
+ vrf = vrf_lookup_by_id(nexthop->vrf_id);
json_object_string_add(json_nexthop, "vrf",
vrf->name);
}
@@ -1384,35 +1387,37 @@ DEFPY (show_route_detail,
DEFPY (show_route_summary,
show_route_summary_cmd,
- "show\
- <\
- ip$ipv4 route [vrf <NAME$vrf_name|all$vrf_all>]\
- summary [prefix$prefix]\
- |ipv6$ipv6 route [vrf <NAME$vrf_name|all$vrf_all>]\
- summary [prefix$prefix]\
- >",
+ "show <ip$ipv4|ipv6$ipv6> route [vrf <NAME$vrf_name|all$vrf_all>] \
+ summary [table (1-4294967295)$table_id] [prefix$prefix]",
SHOW_STR
IP_STR
- "IP routing table\n"
- VRF_FULL_CMD_HELP_STR
- "Summary of all routes\n"
- "Prefix routes\n"
IP6_STR
"IP routing table\n"
VRF_FULL_CMD_HELP_STR
"Summary of all routes\n"
+ "Table to display summary for\n"
+ "The table number\n"
"Prefix routes\n")
{
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
struct route_table *table;
+ if (table_id == 0)
+ table_id = RT_TABLE_MAIN;
+
if (vrf_all) {
struct vrf *vrf;
struct zebra_vrf *zvrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if ((zvrf = vrf->info) == NULL
- || (table = zvrf->table[afi][SAFI_UNICAST]) == NULL)
+ if ((zvrf = vrf->info) == NULL)
+ continue;
+
+ table = zebra_vrf_table_with_table_id(afi,
+ SAFI_UNICAST,
+ zvrf->vrf->vrf_id,
+ table_id);
+ if (!table)
continue;
if (prefix)
@@ -1426,7 +1431,9 @@ DEFPY (show_route_summary,
if (vrf_name)
VRF_GET_ID(vrf_id, vrf_name, false);
- table = zebra_vrf_table(afi, SAFI_UNICAST, vrf_id);
+ table = zebra_vrf_table_with_table_id(afi,
+ SAFI_UNICAST,
+ vrf_id, table_id);
if (!table)
return CMD_SUCCESS;
@@ -2651,6 +2658,10 @@ static int config_write_protocol(struct vty *vty)
== MCAST_MIX_DISTANCE
? "lower-distance"
: "longer-prefix");
+
+ /* Include dataplane info */
+ dplane_config_write_helper(vty);
+
return 1;
}