bgpd: change conditional operators for bgp/ospf json changes

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
This commit is contained in:
Don Slice 2018-08-31 12:50:02 +00:00
parent 874f58d87b
commit 985d248279

View File

@ -321,10 +321,10 @@ int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty,
else { else {
*bgp = bgp_lookup_by_name(vrf_name); *bgp = bgp_lookup_by_name(vrf_name);
if (!*bgp) { if (!*bgp) {
vty_out(vty,
use_json use_json
? vty_out(vty, "{}\n") ? "{}\n"
: vty_out(vty, : "View/Vrf specified is unknown: %s\n",
"View/Vrf specified is unknown: %s\n",
vrf_name); vrf_name);
*idx = 0; *idx = 0;
return 0; return 0;
@ -333,10 +333,10 @@ int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty,
} else { } else {
*bgp = bgp_get_default(); *bgp = bgp_get_default();
if (!*bgp) { if (!*bgp) {
vty_out(vty,
use_json use_json
? vty_out(vty, "{}\n") ? "{}\n"
: vty_out(vty, : "Unable to find default BGP instance\n");
"Unable to find default BGP instance\n");
*idx = 0; *idx = 0;
return 0; return 0;
} }
@ -8118,8 +8118,7 @@ static void bgp_show_summary_afi_safi(struct vty *vty, struct bgp *bgp, int afi,
if (use_json && is_wildcard) if (use_json && is_wildcard)
vty_out(vty, "}\n"); vty_out(vty, "}\n");
else if (!nbr_output) else if (!nbr_output)
use_json ? vty_out(vty, "{}\n") vty_out(vty, use_json ? "{}\n" : "%% No BGP neighbors found\n");
: vty_out(vty, "%% No BGP neighbors found\n");
} }
static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi, static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi,
@ -8177,10 +8176,10 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
bgp = bgp_lookup_by_name(name); bgp = bgp_lookup_by_name(name);
if (!bgp) { if (!bgp) {
vty_out(vty,
use_json use_json
? vty_out(vty, "{}\n") ? "{}\n"
: vty_out(vty, : "%% BGP instance not found\n");
"%% BGP instance not found\n");
return CMD_WARNING; return CMD_WARNING;
} }
@ -8195,8 +8194,8 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
if (bgp) if (bgp)
bgp_show_summary_afi_safi(vty, bgp, afi, safi, use_json, NULL); bgp_show_summary_afi_safi(vty, bgp, afi, safi, use_json, NULL);
else { else {
use_json ? vty_out(vty, "{}\n") vty_out(vty,
: vty_out(vty, "%% No such BGP instance exist\n"); use_json ? "{}\n" : "%% No such BGP instance exist\n");
return CMD_WARNING; return CMD_WARNING;
} }
@ -10880,10 +10879,8 @@ static int bgp_show_neighbor_vty(struct vty *vty, const char *name,
json); json);
} }
json_object_free(json); json_object_free(json);
} else { } else
use_json ? vty_out(vty, "{}\n") vty_out(vty, use_json ? "{}\n" : "%% BGP instance not found\n");
: vty_out(vty, "%% BGP instance not found\n");
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }