summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-11-25 23:02:37 +0100
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-11-27 10:20:59 +0100
commitc48349e346571d307b48ca594f6edd096be7ccfd (patch)
tree3d465f92432dedb0f4496d4682228d36f29b2db9
parentbgpd: Convert vty_out to vty_json for JSON (diff)
downloadfrr-c48349e346571d307b48ca594f6edd096be7ccfd.tar.xz
frr-c48349e346571d307b48ca594f6edd096be7ccfd.zip
*: Remove redundand braces for single statement blocks
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
-rw-r--r--bgpd/bgp_evpn_mh.c18
-rw-r--r--bgpd/bgp_evpn_vty.c42
-rw-r--r--bgpd/bgp_filter.c6
-rw-r--r--bgpd/bgp_labelpool.c12
-rw-r--r--bgpd/bgp_vty.c11
-rw-r--r--ospf6d/ospf6_area.c3
-rw-r--r--ospf6d/ospf6_gr_helper.c3
-rw-r--r--ospf6d/ospf6_interface.c3
-rw-r--r--ospf6d/ospf6_neighbor.c3
-rw-r--r--ospf6d/ospf6_route.c9
-rw-r--r--ospf6d/ospf6_top.c3
-rw-r--r--ospf6d/ospf6d.c4
-rw-r--r--ospfd/ospf_ldp_sync.c11
-rw-r--r--ospfd/ospf_sr.c6
-rw-r--r--ospfd/ospf_te.c3
-rw-r--r--ospfd/ospf_vty.c112
-rw-r--r--pathd/path_ted.c3
-rw-r--r--pbrd/pbr_vty.c6
-rw-r--r--sharpd/sharp_vty.c3
-rw-r--r--zebra/interface.c12
-rw-r--r--zebra/zebra_evpn_mh.c27
-rw-r--r--zebra/zebra_vty.c3
-rw-r--r--zebra/zebra_vxlan.c63
23 files changed, 135 insertions, 231 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index 06a4cab38..2254bc6ba 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -2451,9 +2451,8 @@ void bgp_evpn_es_show(struct vty *vty, bool uj, bool detail)
}
/* print the array of json-ESs */
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
/* Display specific ES */
@@ -2473,9 +2472,8 @@ void bgp_evpn_es_show_esi(struct vty *vty, esi_t *esi, bool uj)
vty_out(vty, "ESI not found\n");
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
}
/*****************************************************************************/
@@ -3026,9 +3024,8 @@ void bgp_evpn_es_vrf_show(struct vty *vty, bool uj, struct bgp_evpn_es *es)
}
/* print the array of json-ESs */
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
/* Display specific ES VRF */
@@ -3877,9 +3874,8 @@ void bgp_evpn_es_evi_show(struct vty *vty, bool uj, bool detail)
(void (*)(struct hash_bucket *,
void *))bgp_evpn_es_evi_show_one_vni_hash_cb,
&wctx);
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
/* Display specific ES EVI */
@@ -3913,9 +3909,8 @@ void bgp_evpn_es_evi_show_vni(struct vty *vty, vni_t vni,
vty_out(vty, "VNI not found\n");
}
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
/*****************************************************************************
@@ -4643,9 +4638,8 @@ void bgp_evpn_nh_show(struct vty *vty, bool uj)
}
/* print the array of json-ESs */
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
/*****************************************************************************/
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 33fce0806..282809119 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -4387,9 +4387,8 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
evpn_show_vni(vty, bgp_evpn, vni, json);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -4667,9 +4666,8 @@ DEFUN(show_bgp_l2vpn_evpn_route,
evpn_show_all_routes(vty, bgp, type, json, detail);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -4729,9 +4727,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_rd,
else
evpn_show_route_rd(vty, bgp, &prd, type, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -4813,9 +4810,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_rd_macip,
else
evpn_show_route_rd_macip(vty, bgp, &prd, &mac, &ip, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -4855,9 +4851,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_esi,
evpn_show_routes_esi(vty, bgp, &esi, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -4923,9 +4918,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni, show_bgp_l2vpn_evpn_route_vni_cmd,
evpn_show_routes_vni(vty, bgp, vni, type, vtep_ip, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -4991,9 +4985,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_macip,
evpn_show_route_vni_macip(vty, bgp, vni, &mac, &ip, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5047,9 +5040,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_multicast,
evpn_show_route_vni_multicast(vty, bgp, vni, orig_ip, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5108,9 +5100,8 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni_all,
evpn_show_routes_vni_all(vty, bgp, vtep_ip, json, da);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5142,9 +5133,8 @@ DEFPY_HIDDEN(
if (uj)
json = json_object_new_object();
bgp_evpn_show_routes_mac_ip_evi_es(vty, esi_p, json, !!detail);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5176,9 +5166,8 @@ DEFPY_HIDDEN(
if (uj)
json = json_object_new_object();
bgp_evpn_show_routes_mac_ip_global_es(vty, esi_p, json, !!detail);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5210,9 +5199,8 @@ DEFUN(show_bgp_l2vpn_evpn_vrf_import_rt,
evpn_show_vrf_import_rts(vty, bgp_evpn, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5244,9 +5232,8 @@ DEFUN(show_bgp_l2vpn_evpn_import_rt,
evpn_show_import_rts(vty, bgp, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -5828,9 +5815,8 @@ DEFUN (show_bgp_vrf_l3vni_info,
prefix_rd2str(&bgp->vrf_prd, buf1, RD_ADDRSTRLEN));
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index 2774b41a3..fc9fc1e52 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -672,9 +672,8 @@ DEFUN (show_as_path_access_list,
if (aslist)
as_list_show(vty, aslist, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -704,9 +703,8 @@ DEFUN (show_as_path_access_list_all,
as_list_show_all(vty, json);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/bgpd/bgp_labelpool.c b/bgpd/bgp_labelpool.c
index b4eb5d54a..1bc7b6230 100644
--- a/bgpd/bgp_labelpool.c
+++ b/bgpd/bgp_labelpool.c
@@ -735,9 +735,8 @@ DEFUN(show_bgp_labelpool_ledger, show_bgp_labelpool_ledger_cmd,
break;
}
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -827,9 +826,8 @@ DEFUN(show_bgp_labelpool_inuse, show_bgp_labelpool_inuse_cmd,
break;
}
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -902,9 +900,8 @@ DEFUN(show_bgp_labelpool_requests, show_bgp_labelpool_requests_cmd,
break;
}
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -950,9 +947,8 @@ DEFUN(show_bgp_labelpool_chunks, show_bgp_labelpool_chunks_cmd,
vty_out(vty, "%-10u %-10u\n", chunk->first,
chunk->last);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 9b098d468..915634e4d 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -14946,9 +14946,8 @@ DEFUN (show_ip_bgp_route_leak,
vrf = NULL;
}
/* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
- if (argv_find_and_parse_afi(argv, argc, &idx, &afi)) {
+ if (argv_find_and_parse_afi(argv, argc, &idx, &afi))
argv_find_and_parse_safi(argv, argc, &idx, &safi);
- }
if (!((afi == AFI_IP || afi == AFI_IP6) && safi == SAFI_UNICAST)) {
vty_out(vty,
@@ -15380,11 +15379,10 @@ static int bgp_show_peer_group_vty(struct vty *vty, const char *name,
bgp = name ? bgp_lookup_by_name(name) : bgp_get_default();
if (!bgp) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else {
+ else
vty_out(vty, "%% BGP instance not found\n");
- }
return CMD_WARNING;
}
@@ -15404,9 +15402,8 @@ static int bgp_show_peer_group_vty(struct vty *vty, const char *name,
if (group_name && !found && !uj)
vty_out(vty, "%% No such peer-group\n");
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 4f3c3e320..7e8e34a22 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -1045,9 +1045,8 @@ static int ipv6_ospf6_spf_tree_common(struct vty *vty, struct ospf6 *ospf6,
}
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c
index 9f6661913..84ee35a3e 100644
--- a/ospf6d/ospf6_gr_helper.c
+++ b/ospf6d/ospf6_gr_helper.c
@@ -1188,9 +1188,8 @@ DEFPY(show_ipv6_ospf6_gr_helper,
show_ospf6_gr_helper_details(vty, ospf6, json, uj, detail);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index be5a7bb83..a0c921f41 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1507,9 +1507,8 @@ static int ospf6_interface_show_traffic_common(struct vty *vty, int argc,
ospf6_interface_show_traffic(vty, ifp, display_once, json, uj, vrf_id);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index ad33c57db..1a8fedea0 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -1145,9 +1145,8 @@ static int ospf6_neighbor_show_common(struct vty *vty, int argc,
(*showfunc)(vty, on, json, uj);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 880987b3f..f5d60d80f 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -1610,9 +1610,8 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
/* Give summary of this route table */
if (summary) {
ospf6_route_show_table_summary(vty, table, json, use_json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -1626,9 +1625,8 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
ospf6_route_show_table_prefix(vty, &prefix, table, json,
use_json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -1641,9 +1639,8 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
else
ospf6_route_show_table(vty, detail, table, json, use_json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 66313c1fb..6bff52fc5 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -2096,9 +2096,8 @@ DEFPY (show_ipv6_ospf6_external_aggregator,
static void ospf6_stub_router_config_write(struct vty *vty, struct ospf6 *ospf6)
{
- if (CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER)) {
+ if (CHECK_FLAG(ospf6->flag, OSPF6_STUB_ROUTER))
vty_out(vty, " stub-router administrative\n");
- }
return;
}
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index 840c4c084..d9f730586 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -383,9 +383,9 @@ static void ospf6_lsdb_type_show_wrapper(struct vty *vty,
assert(0);
break;
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "\n");
}
diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c
index 90c482468..247ceb0a0 100644
--- a/ospfd/ospf_ldp_sync.c
+++ b/ospfd/ospf_ldp_sync.c
@@ -1031,26 +1031,25 @@ DEFPY (show_ip_ospf_mpls_ldp_interface,
/* Display default ospf (instance 0) info */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
}
if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "LDP-sync is disabled\n");
return CMD_SUCCESS;
}
ret = show_ip_ospf_mpls_ldp_interface_common(vty, ospf, intf_name,
json, uj);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index 445288718..181cc37f4 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -3024,9 +3024,8 @@ DEFUN (show_ip_opsf_srdb,
if (argv_find(argv, argc, "self-originate", &idx)) {
srn = OspfSR.self;
show_sr_node(vty, json_node_array, srn);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -3040,9 +3039,8 @@ DEFUN (show_ip_opsf_srdb,
srn = (struct sr_node *)hash_lookup(OspfSR.neighbors,
(void *)&rid);
show_sr_node(vty, json_node_array, srn);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index f0d90e0e0..999bc49d9 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -4432,9 +4432,8 @@ DEFUN (show_ip_ospf_mpls_te_db,
ls_show_ted(OspfMplsTE.ted, vty, json, verbose);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index a0d23074a..17d1dc9c6 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -3386,17 +3386,17 @@ DEFUN (show_ip_ospf,
ret = show_ip_ospf_common(vty, ospf, json,
use_vrf);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else if (!ospf_output)
+ else if (!ospf_output)
vty_out(vty, "%% OSPF instance not found\n");
return ret;
}
ospf = ospf_lookup_by_inst_name(inst, vrf_name);
if ((ospf == NULL) || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -3405,9 +3405,9 @@ DEFUN (show_ip_ospf,
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
/* Display default ospf (instance 0) info */
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -3457,9 +3457,8 @@ DEFUN (show_ip_ospf_instance,
ret = show_ip_ospf_common(vty, ospf, json, 0);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4119,18 +4118,18 @@ DEFUN (show_ip_ospf_interface,
uj);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else if (!ospf)
+ else if (!ospf)
vty_out(vty, "%% OSPF instance not found\n");
return ret;
}
ospf = ospf_lookup_by_inst_name(inst, vrf_name);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -4142,9 +4141,9 @@ DEFUN (show_ip_ospf_interface,
/* Display default ospf (instance 0) info */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -4153,9 +4152,8 @@ DEFUN (show_ip_ospf_interface,
use_vrf, json, uj);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4196,9 +4194,8 @@ DEFUN (show_ip_ospf_instance_interface,
ret = show_ip_ospf_interface_common(vty, ospf, intf_name, 0, json, uj);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4249,9 +4246,8 @@ DEFUN (show_ip_ospf_interface_traffic,
display_once = 1;
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4276,9 +4272,8 @@ DEFUN (show_ip_ospf_interface_traffic,
vty, ospf, intf_name, json, display_once, use_vrf, uj);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4531,9 +4526,9 @@ DEFUN (show_ip_ospf_neighbor,
vty, ospf, json, uj, use_vrf);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else if (!ospf)
+ else if (!ospf)
vty_out(vty, "OSPF instance not found\n");
return ret;
@@ -4541,9 +4536,9 @@ DEFUN (show_ip_ospf_neighbor,
ospf = ospf_lookup_by_inst_name(inst, vrf_name);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -4552,9 +4547,9 @@ DEFUN (show_ip_ospf_neighbor,
/* Display default ospf (instance 0) info */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -4609,9 +4604,8 @@ DEFUN (show_ip_ospf_instance_neighbor,
ret = show_ip_ospf_neighbor_common(vty, ospf, json, uj, 0);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4745,9 +4739,8 @@ DEFUN (show_ip_ospf_neighbor_all,
vty, ospf, json, uj, use_vrf);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4814,9 +4807,8 @@ DEFUN (show_ip_ospf_instance_neighbor_all,
ret = show_ip_ospf_neighbor_all_common(vty, ospf, json, uj, 0);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -4861,9 +4853,9 @@ static int show_ip_ospf_neighbor_int_common(struct vty *vty, struct ospf *ospf,
show_ip_ospf_neighbor_sub(vty, oi, json, use_json);
}
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "\n");
return CMD_SUCCESS;
@@ -5363,9 +5355,9 @@ static int show_ip_ospf_neighbor_id_common(struct vty *vty, struct ospf *ospf,
}
}
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "\n");
return CMD_SUCCESS;
@@ -5516,9 +5508,8 @@ DEFUN (show_ip_ospf_neighbor_detail,
ret = show_ip_ospf_neighbor_detail_common(
vty, ospf, json, uj, use_vrf);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -5585,9 +5576,8 @@ DEFUN (show_ip_ospf_instance_neighbor_detail,
ret = show_ip_ospf_neighbor_detail_common(vty, ospf, json, uj, 0);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -5700,9 +5690,8 @@ DEFUN (show_ip_ospf_neighbor_detail_all,
vty, ospf, json, uj, use_vrf);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -5770,9 +5759,8 @@ DEFUN (show_ip_ospf_instance_neighbor_detail_all,
ret = show_ip_ospf_neighbor_detail_all_common(vty, ospf, json, uj, 0);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -5828,9 +5816,9 @@ static int show_ip_ospf_neighbor_int_detail_common(struct vty *vty,
}
}
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "\n");
return CMD_SUCCESS;
@@ -7139,9 +7127,8 @@ DEFUN (show_ip_ospf_instance_database_max,
show_ip_ospf_database_common(vty, ospf, 1, argc, argv, 0, json, uj);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -7353,9 +7340,8 @@ DEFUN (show_ip_ospf_instance_database_type_adv_router,
show_ip_ospf_database_type_adv_router_common(vty, ospf, 1, argc, argv,
0, json, uj);
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -10573,9 +10559,9 @@ DEFUN (show_ip_ospf_route,
}
ospf = ospf_lookup_by_inst_name(inst, vrf_name);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -10584,9 +10570,9 @@ DEFUN (show_ip_ospf_route,
/* Display default ospf (instance 0) info */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -10977,9 +10963,8 @@ DEFUN (show_ip_ospf_external_aggregator,
vty, ospf, use_vrf, json, uj, detail);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return ret;
}
@@ -10987,9 +10972,9 @@ DEFUN (show_ip_ospf_external_aggregator,
ospf = ospf_lookup_by_inst_name(inst, vrf_name);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -11000,9 +10985,9 @@ DEFUN (show_ip_ospf_external_aggregator,
/* Default Vrf */
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
if (ospf == NULL || !ospf->oi_running) {
- if (uj) {
+ if (uj)
vty_json(vty, json);
- } else
+ else
vty_out(vty, "%% OSPF instance not found\n");
return CMD_SUCCESS;
@@ -11011,9 +10996,8 @@ DEFUN (show_ip_ospf_external_aggregator,
ospf_show_summary_address(vty, ospf, use_vrf, json, uj, detail);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/pathd/path_ted.c b/pathd/path_ted.c
index 52011402d..6bfca5045 100644
--- a/pathd/path_ted.c
+++ b/pathd/path_ted.c
@@ -471,9 +471,8 @@ DEFPY (show_pahtd_ted_db,
}
/* Show the complete TED */
ls_show_ted(ted_state_g.ted, vty, json, !st_json);
- if (st_json) {
+ if (st_json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index 42a35aeff..0065f3698 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -1037,9 +1037,8 @@ DEFPY (show_pbr_map,
vty_show_pbr_map(vty, pbrm, detail);
}
- if (j) {
+ if (j)
vty_json(vty, j);
- }
return CMD_SUCCESS;
}
@@ -1135,9 +1134,8 @@ DEFPY (show_pbr_interface,
}
}
- if (j) {
+ if (j)
vty_json(vty, j);
- }
return CMD_SUCCESS;
}
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index 3485d172b..0a323f744 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -1065,9 +1065,8 @@ DEFUN (show_sharp_ted,
ls_show_ted(sg.ted, vty, json, verbose);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/zebra/interface.c b/zebra/interface.c
index a4024274c..331034b90 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -2348,9 +2348,8 @@ DEFPY(show_interface, show_interface_cmd,
}
}
- if (json) {
+ if (json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -2392,9 +2391,8 @@ DEFPY (show_interface_vrf_all,
}
}
- if (json) {
+ if (json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -2442,9 +2440,8 @@ DEFPY (show_interface_name_vrf,
else
if_dump_vty(vty, ifp);
- if (json) {
+ if (json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
@@ -2504,9 +2501,8 @@ DEFPY (show_interface_name_vrf_all,
else
if_dump_vty(vty, ifp);
- if (json) {
+ if (json)
vty_json(vty, json);
- }
return CMD_SUCCESS;
}
diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c
index 62befb0fa..af4629e41 100644
--- a/zebra/zebra_evpn_mh.c
+++ b/zebra/zebra_evpn_mh.c
@@ -418,9 +418,8 @@ void zebra_evpn_es_evi_show(struct vty *vty, bool uj, int detail)
hash_iterate(zvrf->evpn_table, zebra_evpn_es_evi_show_one_evpn_hash_cb,
&wctx);
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
void zebra_evpn_es_evi_show_vni(struct vty *vty, bool uj, vni_t vni, int detail)
@@ -443,9 +442,8 @@ void zebra_evpn_es_evi_show_vni(struct vty *vty, bool uj, vni_t vni, int detail)
vty_out(vty, "VNI %d doesn't exist\n", vni);
}
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
/* Initialize the ES tables maintained per-L2_VNI */
@@ -992,9 +990,8 @@ void zebra_evpn_acc_vl_show(struct vty *vty, bool uj)
hash_iterate(zmh_info->evpn_vlan_table, zebra_evpn_acc_vl_show_hash,
&wctx);
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
void zebra_evpn_acc_vl_show_detail(struct vty *vty, bool uj)
@@ -1012,9 +1009,8 @@ void zebra_evpn_acc_vl_show_detail(struct vty *vty, bool uj)
hash_iterate(zmh_info->evpn_vlan_table, zebra_evpn_acc_vl_show_hash,
&wctx);
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
void zebra_evpn_acc_vl_show_vid(struct vty *vty, bool uj, vlanid_t vid)
@@ -1033,9 +1029,8 @@ void zebra_evpn_acc_vl_show_vid(struct vty *vty, bool uj, vlanid_t vid)
vty_out(vty, "VLAN %u not present\n", vid);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
}
/* Initialize VLAN member bitmap on an interface. Although VLAN membership
@@ -1348,9 +1343,8 @@ void zebra_evpn_l2_nh_show(struct vty *vty, bool uj)
hash_iterate(zmh_info->nh_ip_table, zebra_evpn_l2_nh_show_cb, &wctx);
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
static struct zebra_evpn_l2_nh *zebra_evpn_l2_nh_find(struct in_addr vtep_ip)
@@ -3199,9 +3193,8 @@ void zebra_evpn_es_show(struct vty *vty, bool uj)
RB_FOREACH(es, zebra_es_rb_head, &zmh_info->es_rb_tree)
zebra_evpn_es_show_entry(vty, es, json_array);
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
void zebra_evpn_es_show_detail(struct vty *vty, bool uj)
@@ -3222,9 +3215,8 @@ void zebra_evpn_es_show_detail(struct vty *vty, bool uj)
json_object_array_add(json_array, json);
}
- if (uj) {
+ if (uj)
vty_json(vty, json_array);
- }
}
void zebra_evpn_es_show_esi(struct vty *vty, bool uj, esi_t *esi)
@@ -3247,9 +3239,8 @@ void zebra_evpn_es_show_esi(struct vty *vty, bool uj, esi_t *esi)
}
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
}
int zebra_evpn_mh_if_write(struct vty *vty, struct interface *ifp)
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 87daeac69..9c5738116 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1237,9 +1237,8 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
}
}
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
static void do_show_ip_route_all(struct vty *vty, struct zebra_vrf *zvrf,
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 7a85077ca..5ef7c9ace 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -2315,9 +2315,8 @@ void zebra_vxlan_print_specific_rmac_l3vni(struct vty *vty, vni_t l3vni,
zl3vni_print_rmac(zrmac, vty, json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni, bool use_json)
@@ -2357,9 +2356,8 @@ void zebra_vxlan_print_rmacs_l3vni(struct vty *vty, vni_t l3vni, bool use_json)
hash_iterate(zl3vni->rmac_table, zl3vni_print_rmac_hash, &wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, bool use_json)
@@ -2383,9 +2381,8 @@ void zebra_vxlan_print_rmacs_all_l3vni(struct vty *vty, bool use_json)
void *))zl3vni_print_rmac_hash_all_vni,
args);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni,
@@ -2426,9 +2423,8 @@ void zebra_vxlan_print_specific_nh_l3vni(struct vty *vty, vni_t l3vni,
zl3vni_print_nh(n, vty, json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t l3vni, bool use_json)
@@ -2468,9 +2464,8 @@ void zebra_vxlan_print_nh_l3vni(struct vty *vty, vni_t l3vni, bool use_json)
hash_iterate(zl3vni->nh_table, zl3vni_print_nh_hash, &wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, bool use_json)
@@ -2494,9 +2489,8 @@ void zebra_vxlan_print_nh_all_l3vni(struct vty *vty, bool use_json)
void *))zl3vni_print_nh_hash_all_vni,
args);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2530,9 +2524,8 @@ void zebra_vxlan_print_l3vni(struct vty *vty, vni_t vni, bool use_json)
args[1] = json;
zl3vni_print(zl3vni, (void *)args);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_print_vrf_vni(struct vty *vty, struct zebra_vrf *zvrf,
@@ -2619,9 +2612,8 @@ void zebra_vxlan_print_neigh_vni(struct vty *vty, struct zebra_vrf *zvrf,
json_object_int_add(json, "numArpNd", num_neigh);
hash_iterate(zevpn->neigh_table, zebra_evpn_print_neigh_hash, &wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2647,9 +2639,8 @@ void zebra_vxlan_print_neigh_all_vni(struct vty *vty, struct zebra_vrf *zvrf,
(void (*)(struct hash_bucket *,
void *))zevpn_print_neigh_hash_all_evpn,
args);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2676,9 +2667,8 @@ void zebra_vxlan_print_neigh_all_vni_detail(struct vty *vty,
(void (*)(struct hash_bucket *,
void *))zevpn_print_neigh_hash_all_evpn_detail,
args);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2715,9 +2705,8 @@ void zebra_vxlan_print_specific_neigh_vni(struct vty *vty,
zebra_evpn_print_neigh(n, vty, json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2761,9 +2750,8 @@ void zebra_vxlan_print_neigh_vni_vtep(struct vty *vty, struct zebra_vrf *zvrf,
&wctx);
hash_iterate(zevpn->neigh_table, zebra_evpn_print_neigh_hash, &wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2825,9 +2813,8 @@ void zebra_vxlan_print_neigh_vni_dad(struct vty *vty,
hash_iterate(zevpn->neigh_table, zebra_evpn_print_dad_neigh_hash,
&wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2908,9 +2895,8 @@ void zebra_vxlan_print_macs_all_vni(struct vty *vty, struct zebra_vrf *zvrf,
wctx.print_dup = print_dup;
hash_iterate(zvrf->evpn_table, zevpn_print_mac_hash_all_evpn, &wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2938,9 +2924,8 @@ void zebra_vxlan_print_macs_all_vni_detail(struct vty *vty,
hash_iterate(zvrf->evpn_table, zevpn_print_mac_hash_all_evpn_detail,
&wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -2966,9 +2951,8 @@ void zebra_vxlan_print_macs_all_vni_vtep(struct vty *vty,
wctx.json = json;
hash_iterate(zvrf->evpn_table, zevpn_print_mac_hash_all_evpn, &wctx);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/*
@@ -3008,9 +2992,8 @@ void zebra_vxlan_print_specific_mac_vni(struct vty *vty, struct zebra_vrf *zvrf,
json = json_object_new_object();
zebra_evpn_print_mac(mac, vty, json);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
/* Print Duplicate MACs per VNI */
@@ -3453,9 +3436,8 @@ void zebra_vxlan_print_vni(struct vty *vty, struct zebra_vrf *zvrf, vni_t vni,
*/
if (json_array)
json_object_array_add(json_array, json);
- else {
+ else
vty_json(vty, json);
- }
}
}
@@ -3522,9 +3504,8 @@ void zebra_vxlan_print_evpn(struct vty *vty, bool uj)
zebra_evpn_mh_print(vty);
}
- if (uj) {
+ if (uj)
vty_json(vty, json);
- }
}
/*
@@ -3560,9 +3541,8 @@ void zebra_vxlan_print_vnis(struct vty *vty, struct zebra_vrf *zvrf,
(void (*)(struct hash_bucket *, void *))zl3vni_print_hash,
args);
- if (use_json) {
+ if (use_json)
vty_json(vty, json);
- }
}
void zebra_vxlan_dup_addr_detection(ZAPI_HANDLER_ARGS)
@@ -3647,9 +3627,8 @@ void zebra_vxlan_print_vnis_detail(struct vty *vty, struct zebra_vrf *zvrf,
void *))zl3vni_print_hash_detail,
&zes);
- if (use_json) {
+ if (use_json)
vty_json(vty, json_array);
- }
}
/*