summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-03-01 21:59:25 +0000
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-03-01 21:59:25 +0000
commitd1570739d97f5dbf74272f67b1104a28fa389747 (patch)
tree819e5e20eac5fd52fe9a1c11069be15fd1bf8a6c
parent37b6ab6f003624cf87fc38b912653461afd7310f (diff)
"show ip bgp neighbor json" displays "Hostname: ", invalidates json
format Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-9611
-rw-r--r--bgpd/bgp_vty.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index cda5fc1c8d..21a651b6ea 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -9510,11 +9510,23 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js
if (p->hostname)
{
- if (p->domainname && (p->domainname[0] != '\0'))
- vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
- VTY_NEWLINE);
+ if (use_json)
+ {
+ if (p->hostname)
+ json_object_string_add(json_neigh, "hostname", p->hostname);
+
+ if (p->domainname)
+ json_object_string_add(json_neigh, "domainname", p->domainname);
+ }
else
- vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
+ {
+ if (p->domainname && (p->domainname[0] != '\0'))
+ vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname,
+ VTY_NEWLINE);
+ else
+ vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE);
+ }
+
}
/* Peer-group */