rd_header = 1;
tbl_ver = table->version;
- for (rm = bgp_table_top(table); rm; rm = bgp_route_next(rm))
+ for (rm = bgp_table_top(table); rm; rm = bgp_route_next(rm)) {
+ if (use_json) {
+ json_array = json_object_new_array();
+ json_prefix_info = json_object_new_object();
+
+ json_object_string_add(json_prefix_info,
+ "prefix", bgp_evpn_route2str(
+ (struct prefix_evpn *)&rm->p, buf,
+ BUFSIZ));
+
+ json_object_int_add(json_prefix_info,
+ "prefixLen", rm->p.prefixlen);
+ }
+
for (pi = bgp_node_get_bgp_path_info(rm); pi;
pi = pi->next) {
total_count++;
if (use_json) {
json_nroute =
json_object_new_object();
- json_prefix_info =
- json_object_new_object();
- json_array =
- json_object_new_array();
if (type == RD_TYPE_AS
|| type == RD_TYPE_AS4)
sprintf(rd_str, "%u:%d",
"rd",
rd_str);
- json_object_string_add(
- json_prefix_info,
- "prefix",
- bgp_evpn_route2str(
- (struct prefix_evpn *)
- &rm->p, buf, BUFSIZ));
-
- json_object_int_add(
- json_prefix_info,
- "prefixLen",
- rm->p.prefixlen);
-
} else {
vty_out(vty,
"Route Distinguisher: ");
}
rd_header = 0;
}
+
if (option == SHOW_DISPLAY_TAGS)
route_vty_out_tag(vty, &rm->p, pi, 0,
SAFI_EVPN,
SAFI_EVPN, json_array);
output_count++;
}
+ if (use_json) {
+ json_object_object_add(json_prefix_info,
+ "paths", json_array);
+ json_object_object_add(json_nroute, buf,
+ json_prefix_info);
+ }
+ }
- if (use_json) {
- json_object_object_add(json_prefix_info, "paths",
- json_array);
- json_object_object_add(json_nroute, buf,
- json_prefix_info);
+ if (use_json)
json_object_object_add(json, rd_str, json_nroute);
- }
}
if (use_json) {