From e08ac8b7afa03ca235434f8407f4c37d49de8a3a Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Wed, 16 Nov 2016 15:33:35 +0000 Subject: [PATCH] bgpd: 'show ip bgp neighbor json' some keys are in the wrong place Signed-off-by: Daniel Walton Reviewed-by: Sam Tannous Ticket: CM-13511 --- bgpd/bgp_vty.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 47fcae5c51..aff1aabe0c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -12388,8 +12388,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (use_json) { json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); - json_object_int_add(json, "connectionsEstablished", p->established); - json_object_int_add(json, "connectionsDropped", p->dropped); + json_object_int_add(json_neigh, "connectionsEstablished", p->established); + json_object_int_add(json_neigh, "connectionsDropped", p->dropped); } else vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, @@ -12398,7 +12398,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (! p->last_reset) { if (use_json) - json_object_string_add(json, "lastReset", "never"); + json_object_string_add(json_neigh, "lastReset", "never"); else vty_out (vty, " Last reset never%s", VTY_NEWLINE); } @@ -12412,13 +12412,13 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js uptime = bgp_clock(); uptime -= p->resettime; tm = gmtime(&uptime); - json_object_int_add(json, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); - json_object_string_add(json, "lastResetDueTo", peer_down_str[(int) p->last_reset]); + json_object_int_add(json_neigh, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); + json_object_string_add(json_neigh, "lastResetDueTo", peer_down_str[(int) p->last_reset]); if (p->last_reset_cause_size) { char errorcodesubcode_hexstr[5]; sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); - json_object_string_add(json, "lastErrorCodeSubcode", errorcodesubcode_hexstr); + json_object_string_add(json_neigh, "lastErrorCodeSubcode", errorcodesubcode_hexstr); } } else @@ -12469,7 +12469,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) { if (use_json) - json_object_boolean_true_add(json, "prefixesConfigExceedMax"); + json_object_boolean_true_add(json_neigh, "prefixesConfigExceedMax"); else vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); @@ -12477,8 +12477,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js { if (use_json) { - json_object_boolean_true_add(json, "reducePrefixNumFrom"); - json_object_int_add(json, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); + json_object_boolean_true_add(json_neigh, "reducePrefixNumFrom"); + json_object_int_add(json_neigh, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); } else vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", @@ -12488,7 +12488,7 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js else { if (use_json) - json_object_boolean_true_add(json, "reducePrefixNumAndClearIpBgp"); + json_object_boolean_true_add(json_neigh, "reducePrefixNumAndClearIpBgp"); else vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", p->host, VTY_NEWLINE); -- 2.39.5