use_json);
}
+ static int
+ bgp_show_lcommunity (struct vty *vty, struct bgp *bgp, int argc,
+ struct cmd_token **argv, afi_t afi, safi_t safi, u_char uj)
+ {
+ struct lcommunity *lcom;
+ struct buffer *b;
+ int i;
+ char *str;
+ int first = 0;
+
+ b = buffer_new (1024);
+ for (i = 0; i < argc; i++)
+ {
+ if (first)
+ buffer_putc (b, ' ');
+ else
+ {
+ if (strmatch (argv[i]->text, "<AA:BB:CC>"))
+ {
+ first = 1;
+ buffer_putstr (b, argv[i]->arg);
+ }
+ }
+ }
+ buffer_putc (b, '\0');
+
+ str = buffer_getstr (b);
+ buffer_free (b);
+
+ lcom = lcommunity_str2com (str);
+ XFREE (MTYPE_TMP, str);
+ if (! lcom)
+ {
+ vty_out (vty, "%% Large-community malformed: %s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return bgp_show (vty, bgp, afi, safi, bgp_show_type_lcommunity, lcom, uj);
+ }
+
+ static int
+ bgp_show_lcommunity_list (struct vty *vty, struct bgp *bgp, const char *lcom,
+ afi_t afi, safi_t safi, u_char uj)
+ {
+ struct community_list *list;
+
+ list = community_list_lookup (bgp_clist, lcom, LARGE_COMMUNITY_LIST_MASTER);
+ if (list == NULL)
+ {
+ vty_out (vty, "%% %s is not a valid large-community-list name%s", lcom,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ return bgp_show (vty, bgp, afi, safi, bgp_show_type_lcommunity_list, list, uj);
+ }
+
+ DEFUN (show_ip_bgp_large_community_list,
+ show_ip_bgp_large_community_list_cmd,
+ "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] large-community-list <(1-500)|WORD> [json]",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_HELP_STR
+ "Address Family\n"
+ "Address Family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Display routes matching the large-community-list\n"
+ "large-community-list number\n"
+ "large-community-list name\n"
+ JSON_STR)
+ {
+ char *vrf = NULL;
+ afi_t afi = AFI_IP6;
+ safi_t safi = SAFI_UNICAST;
+ int idx = 0;
+
+ if (argv_find (argv, argc, "ip", &idx))
+ afi = AFI_IP;
+ if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
+ vrf = argv[++idx]->arg;
+ if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx))
+ {
+ afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
+ if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
+ safi = bgp_vty_safi_from_arg (argv[idx]->text);
+ }
+
+ int uj = use_json (argc, argv);
+
+ struct bgp *bgp = bgp_lookup_by_name (vrf);
+ if (bgp == NULL)
+ {
+ vty_out (vty, "Can't find BGP instance %s%s", vrf, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ argv_find (argv, argc, "large-community-list", &idx);
+ return bgp_show_lcommunity_list (vty, bgp, argv[idx+1]->arg, afi, safi, uj);
+ }
+ DEFUN (show_ip_bgp_large_community,
+ show_ip_bgp_large_community_cmd,
+ "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] large-community [AA:BB:CC] [json]",
+ SHOW_STR
+ IP_STR
+ BGP_STR
+ BGP_INSTANCE_HELP_STR
+ "Address Family\n"
+ "Address Family\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Address Family modifier\n"
+ "Display routes matching the large-communities\n"
+ "List of large-community numbers\n"
+ JSON_STR)
+ {
+ char *vrf = NULL;
+ afi_t afi = AFI_IP6;
+ safi_t safi = SAFI_UNICAST;
+ int idx = 0;
+
+ if (argv_find (argv, argc, "ip", &idx))
+ afi = AFI_IP;
+ if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx))
+ vrf = argv[++idx]->arg;
+ if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx))
+ {
+ afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
+ if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
+ safi = bgp_vty_safi_from_arg (argv[idx]->text);
+ }
+
+ int uj = use_json (argc, argv);
+
+ struct bgp *bgp = bgp_lookup_by_name (vrf);
+ if (bgp == NULL)
+ {
+ vty_out (vty, "Can't find BGP instance %s%s", vrf, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ argv_find (argv, argc, "large-community", &idx);
+ if (strmatch(argv[idx+1]->text, "AA:BB:CC"))
+ return bgp_show_lcommunity (vty, bgp, argc, argv, afi, safi, uj);
+ else
+ return bgp_show (vty, bgp, afi, safi, bgp_show_type_lcommunity_all, NULL, uj);
+ }
+
+static int bgp_table_stats (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi);
+
/* BGP route print out function. */
-DEFUN (show_ip_bgp_ipv4,
- show_ip_bgp_ipv4_cmd,
+DEFUN (show_ip_bgp,
+ show_ip_bgp_cmd,
"show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]]\
[<\
cidr-only\
install_element (BGP_IPV4M_NODE, &no_aggregate_address_mask_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_ip_bgp_cmd);
install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_regexp_cmd);
+
install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd);
install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd);