mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 19:13:19 +00:00
bgpd: Adding BGP neighbor JSON output for neighbors never established a BGP adjacency
Some keys are only present in the JSON data of BGP neighbors are only present if the peer is, or has previously been established. While they are not present if the peer has never come up. To keep the data structure aligned, the below keys are added also to the neighbors that BGP adjacency has never been established. Values of the keys are all set to Unknown hostname:Unknown, nexthop:Unknown, nexthopGlobal:Unknown, nexthopLocal:Unknown, bgpConnection:Unknown, Signed-off-by: Karl Quan <kquan@nvidia.com>
This commit is contained in:
parent
78464691ee
commit
432e7e463e
@ -13010,9 +13010,8 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
|
||||
|
||||
if (p->hostname) {
|
||||
if (use_json) {
|
||||
if (p->hostname)
|
||||
json_object_string_add(json_neigh, "hostname",
|
||||
p->hostname);
|
||||
json_object_string_add(json_neigh, "hostname",
|
||||
p->hostname);
|
||||
|
||||
if (p->domainname)
|
||||
json_object_string_add(json_neigh, "domainname",
|
||||
@ -13024,6 +13023,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
|
||||
else
|
||||
vty_out(vty, "Hostname: %s\n", p->hostname);
|
||||
}
|
||||
} else {
|
||||
if (use_json)
|
||||
json_object_string_add(json_neigh, "hostname",
|
||||
"Unknown");
|
||||
}
|
||||
|
||||
/* Peer-group */
|
||||
@ -14585,6 +14588,17 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
|
||||
p->shared_network ? "shared network"
|
||||
: "non shared network");
|
||||
}
|
||||
} else {
|
||||
if (use_json) {
|
||||
json_object_string_add(json_neigh, "nexthop",
|
||||
"Unknown");
|
||||
json_object_string_add(json_neigh, "nexthopGlobal",
|
||||
"Unknown");
|
||||
json_object_string_add(json_neigh, "nexthopLocal",
|
||||
"Unknown");
|
||||
json_object_string_add(json_neigh, "bgpConnection",
|
||||
"Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
/* Timer information. */
|
||||
|
Loading…
Reference in New Issue
Block a user