char buf[BUFSIZ];
json = json_object_new_object();
+ json_prefix = json_object_new_array();
RNODE_FOREACH_RE (rn, re) {
- json_prefix = json_object_new_array();
vty_show_ip_route(vty, rn, re, json_prefix);
- prefix2str(&rn->p, buf, sizeof buf);
- json_object_object_add(json, buf, json_prefix);
- json_prefix = NULL;
}
+ prefix2str(&rn->p, buf, sizeof(buf));
+ json_object_object_add(json, buf, json_prefix);
vty_out(vty, "%s\n", json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
return CMD_SUCCESS;
}
+DEFPY (show_ip_import_check,
+ show_ip_import_check_cmd,
+ "show <ip$ipv4|ipv6$ipv6> import-check [vrf NAME$vrf_name|vrf all$vrf_all]",
+ SHOW_STR
+ IP_STR
+ IP6_STR
+ "IP import check tracking table\n"
+ VRF_CMD_HELP_STR
+ VRF_ALL_CMD_HELP_STR)
+{
+ afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
+ vrf_id_t vrf_id = VRF_DEFAULT;
+
+ if (vrf_all) {
+ struct vrf *vrf;
+ struct zebra_vrf *zvrf;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
+ if ((zvrf = vrf->info) != NULL) {
+ vty_out(vty, "\nVRF %s:\n",
+ zvrf_name(zvrf));
+ zebra_print_rnh_table(zvrf_id(zvrf),
+ afi, vty,
+ RNH_NEXTHOP_TYPE);
+ }
+ return CMD_SUCCESS;
+ }
+ if (vrf_name)
+ VRF_GET_ID(vrf_id, vrf_name, false);
+
+ zebra_print_rnh_table(vrf_id, afi, vty, RNH_IMPORT_CHECK_TYPE);
+ return CMD_SUCCESS;
+}
DEFUN (show_ip_nht_vrf_all,
show_ip_nht_vrf_all_cmd,
install_element(VIEW_NODE, &show_route_detail_cmd);
install_element(VIEW_NODE, &show_route_summary_cmd);
install_element(VIEW_NODE, &show_ip_nht_cmd);
+ install_element(VIEW_NODE, &show_ip_import_check_cmd);
install_element(VIEW_NODE, &show_ip_nht_vrf_all_cmd);
install_element(VIEW_NODE, &show_ipv6_nht_cmd);
install_element(VIEW_NODE, &show_ipv6_nht_vrf_all_cmd);