Merge pull request #1630 from LabNConsulting/working/master/pr1629-no-json

bgpd: fix reporting of no vpn routes (no json)
This commit is contained in:
Donald Sharp 2018-01-19 07:59:34 -05:00 committed by GitHub
commit 00711784cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8127,6 +8127,9 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
struct bgp_node *rn, *next; struct bgp_node *rn, *next;
unsigned long output_cum = 0; unsigned long output_cum = 0;
unsigned long total_cum = 0; unsigned long total_cum = 0;
bool show_msg;
show_msg = (!use_json && type == bgp_show_type_normal);
for (rn = bgp_table_top(table); rn; rn = next) { for (rn = bgp_table_top(table); rn; rn = next) {
next = bgp_route_next(rn); next = bgp_route_next(rn);
@ -8142,8 +8145,19 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
output_arg, use_json, output_arg, use_json,
rd, next == NULL, rd, next == NULL,
&output_cum, &total_cum); &output_cum, &total_cum);
if (next == NULL)
show_msg = false;
} }
} }
if (show_msg) {
if (output_cum == 0)
vty_out(vty, "No BGP prefixes displayed, %ld exist\n",
total_cum);
else
vty_out(vty,
"\nDisplayed %ld routes and %ld total paths\n",
output_cum, total_cum);
}
if (use_json) if (use_json)
vty_out(vty, " } }"); vty_out(vty, " } }");
return CMD_SUCCESS; return CMD_SUCCESS;