mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-08 13:30:02 +00:00
bgpd: Add decoded notification code strings to JSON output
Ticket: CM-14136 Reviewed By: CCR-5585 Testing Done: bgpmin The JSON output of 'bgp neighbor show' lacked the decoded strings for the last notification error code/subcode. Decoding these strings outside quagga is painful, and then needs to match with any updates to the codes from RFCs/drafts. Further, all apps that look to understanding this need to then add their own decoders for these strings. Just add the decoded strings to the JSON output as well. JSON key name for this is 'lastNotificationReason'. Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
This commit is contained in:
parent
1a11782c40
commit
cca1dda8bf
@ -11917,11 +11917,19 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js
|
||||
tm = gmtime(&uptime);
|
||||
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)
|
||||
if (p->last_reset == PEER_DOWN_NOTIFY_SEND ||
|
||||
p->last_reset == PEER_DOWN_NOTIFY_RECEIVED)
|
||||
{
|
||||
char errorcodesubcode_hexstr[5];
|
||||
char errorcodesubcode_str[256];
|
||||
|
||||
code_str = bgp_notify_code_str(p->notify.code);
|
||||
subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode);
|
||||
|
||||
sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode);
|
||||
json_object_string_add(json_neigh, "lastErrorCodeSubcode", errorcodesubcode_hexstr);
|
||||
snprintf(errorcodesubcode_str, 255, "%s%s", code_str, subcode_str);
|
||||
json_object_string_add(json_neigh, "lastNotificationReason", errorcodesubcode_str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user