From: Sam Tannous Date: Thu, 9 Jun 2016 16:26:06 +0000 (-0400) Subject: vtysh json output not JSON for show ip bgp neigh json X-Git-Tag: frr-2.0-rc1~550^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=dd9275d64122751d129df36d5e684c1d4457a7ae;p=matthieu%2Ffrr.git vtysh json output not JSON for show ip bgp neigh json Ticket: CM-11350 Reviewed By: dsharp Testing Done: built amd64 images and tested output of both json and non-json Upstream patch was applied in wrong section of code so JSON output contained plain text. The upstream patch was commit baa376fc1 (cherry picked from ef757700d0f) This patch moves the text output to the correct if clause and also adds a new JSON line for the same data. Signed-off-by: Sam Tannous Reviewed-by: Donald Sharp --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 259033cb1f..5ff8c25f19 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -12054,14 +12054,11 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js } } - /* TCP metrics. */ - if (p->status == Established && p->rtt) - vty_out (vty, "Estimated round trip time: %d ms%s", - p->rtt, VTY_NEWLINE); - /* Timer information. */ if (use_json) { + if (p->status == Established && p->rtt) + json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt); if (p->t_start) json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); if (p->t_connect) @@ -12083,6 +12080,10 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js } else { + /* TCP metrics. */ + if (p->status == Established && p->rtt) + vty_out (vty, "Estimated round trip time: %d ms%s", + p->rtt, VTY_NEWLINE); if (p->t_start) vty_out (vty, "Next start timer due in %ld seconds%s", thread_timer_remain_second (p->t_start), VTY_NEWLINE);