return (ret);
}
-static int
-show_ip_bgp_nexthop_table (struct vty *vty, const char *name, int detail)
+static void
+bgp_show_nexthops (struct vty *vty, struct bgp *bgp, int detail)
{
struct bgp_node *rn;
struct bgp_nexthop_cache *bnc;
struct nexthop *nexthop;
time_t tbuf;
afi_t afi;
- struct bgp *bgp;
-
- if (name)
- bgp = bgp_lookup_by_name (name);
- else
- bgp = bgp_get_default ();
- if (!bgp)
- {
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
vty_out (vty, "Current BGP nexthop cache:%s", VTY_NEWLINE);
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
}
}
}
+}
+
+static int
+show_ip_bgp_nexthop_table (struct vty *vty, const char *name, int detail)
+{
+ struct bgp *bgp;
+
+ if (name)
+ bgp = bgp_lookup_by_name (name);
+ else
+ bgp = bgp_get_default ();
+ if (!bgp)
+ {
+ vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ bgp_show_nexthops (vty, bgp, detail);
+
return CMD_SUCCESS;
}
+static void
+bgp_show_all_instances_nexthops_vty (struct vty *vty)
+{
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ {
+ vty_out (vty, "%sInstance %s:%s",
+ VTY_NEWLINE,
+ (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
+ VTY_NEWLINE);
+ bgp_show_nexthops (vty, bgp, 0);
+ }
+}
+
DEFUN (show_ip_bgp_nexthop,
show_ip_bgp_nexthop_cmd,
"show ip bgp nexthop",
return show_ip_bgp_nexthop_table (vty, argv[1], 0);
}
+DEFUN (show_ip_bgp_instance_all_nexthop,
+ show_ip_bgp_instance_all_nexthop_cmd,
+ "show ip bgp " BGP_INSTANCE_ALL_CMD " nexthop",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "BGP nexthop table\n")
+{
+ bgp_show_all_instances_nexthops_vty (vty);
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_bgp_instance_nexthop_detail,
show_ip_bgp_instance_nexthop_detail_cmd,
"show ip bgp " BGP_INSTANCE_CMD " nexthop detail",
install_element (VIEW_NODE, &show_ip_bgp_nexthop_detail_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_nexthop_detail_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_nexthop_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_instance_all_nexthop_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_nexthop_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_instance_all_nexthop_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_nexthop_detail_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_nexthop_detail_cmd);
}
return bgp_show_table (vty, table, &bgp->router_id, type, output_arg, use_json);
}
+static void
+bgp_show_all_instances_routes_vty (struct vty *vty, afi_t afi, safi_t safi,
+ u_char use_json)
+{
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+ struct bgp_table *table;
+
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ {
+ vty_out (vty, "%sInstance %s:%s",
+ VTY_NEWLINE,
+ (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
+ VTY_NEWLINE);
+ table = bgp->rib[afi][safi];
+ bgp_show_table (vty, table, &bgp->router_id,
+ bgp_show_type_normal, NULL, use_json);
+ }
+}
+
/* Header of detailed BGP route information */
static void
route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
return bgp_show (vty, bgp, AFI_IP, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json(argc, argv));
}
+DEFUN (show_ip_bgp_instance_all,
+ show_ip_bgp_instance_all_cmd,
+ "show ip bgp " BGP_INSTANCE_ALL_CMD " {json}",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "JavaScript Object Notation\n")
+{
+ u_char uj = use_json(argc, argv);
+
+ bgp_show_all_instances_routes_vty (vty, AFI_IP, SAFI_UNICAST, uj);
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_bgp_instance_route,
show_ip_bgp_instance_route_cmd,
"show ip bgp " BGP_INSTANCE_CMD " A.B.C.D {json}",
return bgp_show (vty, bgp, AFI_IP6, SAFI_UNICAST, bgp_show_type_normal, NULL, use_json(argc, argv));
}
+DEFUN (show_bgp_instance_all,
+ show_bgp_instance_all_cmd,
+ "show bgp " BGP_INSTANCE_ALL_CMD " {json}",
+ SHOW_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "JavaScript Object Notation\n")
+{
+ u_char uj = use_json(argc, argv);
+
+ bgp_show_all_instances_routes_vty (vty, AFI_IP6, SAFI_UNICAST, uj);
+ return CMD_SUCCESS;
+}
+
ALIAS (show_bgp_view,
show_bgp_instance_ipv6_cmd,
"show bgp " BGP_INSTANCE_CMD " ipv6 {json}",
install_element (VIEW_NODE, &show_ip_bgp_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_safi_cmd);
install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_instance_all_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_safi_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_route_cmd);
install_element (VIEW_NODE, &show_bgp_neighbor_damp_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_neighbor_damp_cmd);
install_element (VIEW_NODE, &show_bgp_instance_cmd);
+ install_element (VIEW_NODE, &show_bgp_instance_all_cmd);
install_element (VIEW_NODE, &show_bgp_instance_ipv6_cmd);
install_element (VIEW_NODE, &show_bgp_instance_route_cmd);
install_element (VIEW_NODE, &show_bgp_instance_ipv6_route_cmd);
install_element (ENABLE_NODE, &show_bgp_neighbor_damp_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_neighbor_damp_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_cmd);
+ install_element (ENABLE_NODE, &show_bgp_instance_all_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_ipv6_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_route_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_ipv6_route_cmd);
return CMD_SUCCESS;
}
+static void
+bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi,
+ u_char use_json)
+{
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ {
+ vty_out (vty, "%sInstance %s:%s",
+ VTY_NEWLINE,
+ (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
+ VTY_NEWLINE);
+ bgp_show_summary (vty, bgp, afi, safi, use_json);
+ }
+}
+
/* `show ip bgp summary' commands. */
DEFUN (show_ip_bgp_summary,
show_ip_bgp_summary_cmd,
return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj);
}
+DEFUN (show_ip_bgp_instance_all_summary,
+ show_ip_bgp_instance_all_summary_cmd,
+ "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "Summary of BGP neighbor status\n"
+ "JavaScript Object Notation\n")
+{
+ u_char uj = use_json(argc, argv);
+
+ bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj);
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_bgp_ipv4_summary,
show_ip_bgp_ipv4_summary_cmd,
"show ip bgp ipv4 (unicast|multicast) summary {json}",
return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv));
}
+DEFUN (show_bgp_instance_all_summary,
+ show_bgp_instance_all_summary_cmd,
+ "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}",
+ SHOW_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "Summary of BGP neighbor status\n"
+ "JavaScript Object Notation\n")
+{
+ u_char uj = use_json(argc, argv);
+
+ bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj);
+ return CMD_SUCCESS;
+}
+
ALIAS (show_bgp_summary,
show_bgp_ipv6_summary_cmd,
"show bgp ipv6 summary {json}",
return CMD_SUCCESS;
}
+static void
+bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json)
+{
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+ json_object *json = NULL;
+
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ {
+ vty_out (vty, "%sInstance %s:%s",
+ VTY_NEWLINE,
+ (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
+ VTY_NEWLINE);
+ if (use_json)
+ json = json_object_new_object();
+ bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json);
+ }
+}
+
/* "show ip bgp neighbors" commands. */
DEFUN (show_ip_bgp_neighbors,
show_ip_bgp_neighbors_cmd,
return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj);
}
+DEFUN (show_ip_bgp_instance_all_neighbors,
+ show_ip_bgp_instance_all_neighbors_cmd,
+ "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "Detailed information on TCP and BGP neighbor connections\n"
+ "JavaScript Object Notation\n")
+{
+ u_char uj = use_json(argc, argv);
+
+ bgp_show_all_instances_neighbors_vty (vty, uj);
+ return CMD_SUCCESS;
+}
+
ALIAS (show_ip_bgp_instance_neighbors,
show_bgp_instance_neighbors_cmd,
"show bgp " BGP_INSTANCE_CMD " neighbors {json}",
return CMD_SUCCESS;
}
+static void
+bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi)
+{
+ struct listnode *node, *nnode;
+ struct bgp *bgp;
+
+ for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp))
+ {
+ vty_out (vty, "%sInstance %s:%s",
+ VTY_NEWLINE,
+ (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name,
+ VTY_NEWLINE);
+ update_group_show(bgp, afi, safi, vty, 0);
+ }
+}
+
DEFUN (show_ip_bgp_updgrps,
show_ip_bgp_updgrps_cmd,
"show ip bgp update-groups",
return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0));
}
+DEFUN (show_ip_bgp_instance_all_updgrps,
+ show_ip_bgp_instance_all_updgrps_cmd,
+ "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "Detailed info about dynamic update groups\n")
+{
+ bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST);
+ return CMD_SUCCESS;
+}
+
DEFUN (show_bgp_ipv6_updgrps,
show_bgp_ipv6_updgrps_cmd,
"show bgp update-groups",
return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0));
}
+DEFUN (show_bgp_instance_all_ipv6_updgrps,
+ show_bgp_instance_all_ipv6_updgrps_cmd,
+ "show bgp " BGP_INSTANCE_ALL_CMD " update-groups",
+ SHOW_STR
+ BGP_STR
+ BGP_INSTANCE_ALL_HELP_STR
+ "Detailed info about v6 dynamic update groups\n")
+{
+ bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST);
+ return CMD_SUCCESS;
+}
+
DEFUN (show_bgp_updgrps,
show_bgp_updgrps_cmd,
"show bgp (ipv4|ipv6) (unicast|multicast) update-groups",
install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
install_element (VIEW_NODE, &show_bgp_updgrps_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd);
install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
+ install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd);
install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
#ifdef HAVE_IPV6
install_element (VIEW_NODE, &show_bgp_summary_cmd);
install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
+ install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd);
install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd);
install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd);
install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
+ install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
#ifdef HAVE_IPV6
install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
+ install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd);
install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd);
install_element (ENABLE_NODE, &show_bgp_updgrps_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd);
+ install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd);
install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
#ifdef HAVE_IPV6
install_element (ENABLE_NODE, &show_bgp_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
+ install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
+ install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
+ install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
#ifdef HAVE_IPV6