mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-02-01 18:56:52 +00:00
ospf6d: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
92ef007878
commit
5a6c232bf8
@ -1046,10 +1046,7 @@ static int ipv6_ospf6_spf_tree_common(struct vty *vty, struct ospf6 *ospf6,
|
||||
}
|
||||
|
||||
if (uj) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
||||
@ -2545,10 +2545,7 @@ DEFUN(show_ipv6_ospf6_redistribute, show_ipv6_ospf6_redistribute_cmd,
|
||||
if (uj) {
|
||||
json_object_object_add(json, "routes",
|
||||
json_array_routes);
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
|
||||
if (!all_vrf)
|
||||
|
||||
@ -1189,10 +1189,7 @@ DEFPY(show_ipv6_ospf6_gr_helper,
|
||||
show_ospf6_gr_helper_details(vty, ospf6, json, uj, detail);
|
||||
|
||||
if (uj) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
||||
@ -1277,10 +1277,7 @@ static int show_ospf6_interface_common(struct vty *vty, vrf_id_t vrf_id,
|
||||
if (ifp == NULL) {
|
||||
json_object_string_add(json, "noSuchInterface",
|
||||
argv[idx_ifname]->arg);
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
json_object_free(json_int);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
@ -1294,10 +1291,7 @@ static int show_ospf6_interface_common(struct vty *vty, vrf_id_t vrf_id,
|
||||
json_int);
|
||||
}
|
||||
}
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
} else {
|
||||
if (argc == intf_idx) {
|
||||
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
|
||||
@ -1484,10 +1478,7 @@ static int ospf6_interface_show_traffic_common(struct vty *vty, int argc,
|
||||
"No Such Interface");
|
||||
json_object_string_add(json, "interface",
|
||||
intf_name);
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
return CMD_WARNING;
|
||||
}
|
||||
if (ifp->info == NULL) {
|
||||
@ -1496,10 +1487,7 @@ static int ospf6_interface_show_traffic_common(struct vty *vty, int argc,
|
||||
"OSPF not enabled on this interface");
|
||||
json_object_string_add(json, "interface",
|
||||
intf_name);
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
@ -1520,10 +1508,7 @@ 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) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
||||
@ -1073,10 +1073,7 @@ static void ospf6_neighbor_show_detail_common(struct vty *vty,
|
||||
json_object_object_add(json, "neighbors", json_array);
|
||||
else
|
||||
json_object_free(json_array);
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1149,10 +1146,7 @@ static int ospf6_neighbor_show_common(struct vty *vty, int argc,
|
||||
}
|
||||
|
||||
if (uj) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
||||
@ -1611,10 +1611,7 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
|
||||
if (summary) {
|
||||
ospf6_route_show_table_summary(vty, table, json, use_json);
|
||||
if (use_json) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -1630,10 +1627,7 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
|
||||
use_json);
|
||||
|
||||
if (use_json) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -1648,10 +1642,7 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
|
||||
ospf6_route_show_table(vty, detail, table, json, use_json);
|
||||
|
||||
if (use_json) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1496,10 +1496,7 @@ DEFUN(show_ipv6_ospf6_vrfs, show_ipv6_ospf6_vrfs_cmd,
|
||||
json_object_object_add(json, "vrfs", json_vrfs);
|
||||
json_object_int_add(json, "totalVrfs", count);
|
||||
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
} else {
|
||||
if (count)
|
||||
vty_out(vty, "\nTotal number of OSPF VRFs: %d\n",
|
||||
@ -2091,9 +2088,7 @@ DEFPY (show_ipv6_ospf6_external_aggregator,
|
||||
}
|
||||
|
||||
if (uj) {
|
||||
vty_out(vty, "%s\n", json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
}
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
||||
@ -292,10 +292,7 @@ static void ospf6_lsdb_show_wrapper(struct vty *vty,
|
||||
json_object_array_add(json_array, json_obj);
|
||||
json_object_object_add(json, "asScopedLinkStateDb", json_array);
|
||||
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
} else
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
@ -387,10 +384,7 @@ static void ospf6_lsdb_type_show_wrapper(struct vty *vty,
|
||||
break;
|
||||
}
|
||||
if (uj) {
|
||||
vty_out(vty, "%s\n",
|
||||
json_object_to_json_string_ext(
|
||||
json, JSON_C_TO_STRING_PRETTY));
|
||||
json_object_free(json);
|
||||
vty_json(vty, json);
|
||||
} else
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user