|prefix-list WORD\
|filter-list WORD\
|statistics\
- |community <AA:NN|local-AS|no-advertise|no-export|graceful-shutdown\
- no-peer|blackhole|llgr-stale|no-llgr|accept-own|accept-own-nexthop\
- route-filter-v6|route-filter-v4|route-filter-translated-v6|\
- route-filter-translated-v4> [exact-match]\
|community-list <(1-500)|WORD> [exact-match]\
|A.B.C.D/M longer-prefixes\
|X:X::X:X/M longer-prefixes\
"Display routes conforming to the filter-list\n"
"Regular expression access list name\n"
"BGP RIB advertisement statistics\n"
- "Display routes matching the communities\n"
- COMMUNITY_AANN_STR
- "Do not send outside local AS (well-known community)\n"
- "Do not advertise to any peer (well-known community)\n"
- "Do not export to next AS (well-known community)\n"
- "Graceful shutdown (well-known community)\n"
- "Do not export to any peer (well-known community)\n"
- "Inform EBGP peers to blackhole traffic to prefix (well-known community)\n"
- "Staled Long-lived Graceful Restart VPN route (well-known community)\n"
- "Removed because Long-lived Graceful Restart was not enabled for VPN route (well-known community)\n"
- "Should accept local VPN route if exported and imported into different VRF (well-known community)\n"
- "Should accept VPN route with local nexthop (well-known community)\n"
- "RT VPNv6 route filtering (well-known community)\n"
- "RT VPNv4 route filtering (well-known community)\n"
- "RT translated VPNv6 route filtering (well-known community)\n"
- "RT translated VPNv4 route filtering (well-known community)\n"
- "Exact match of the communities\n"
"Display routes matching the community-list\n"
"community-list number\n"
"community-list name\n"
DEFUN (show_ip_bgp_json,
show_ip_bgp_json_cmd,
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]\
- [<\
- cidr-only\
- |dampening <flap-statistics|dampened-paths>\
- |community [<AA:NN|local-AS|no-advertise|no-export|graceful-shutdown>] [exact-match]\
- >] [json]",
+ [cidr-only\
+ |dampening <flap-statistics|dampened-paths>\
+ |community [AA:NN|local-AS|no-advertise|no-export\
+ |graceful-shutdown|no-peer|blackhole|llgr-stale|no-llgr\
+ |accept-own|accept-own-nexthop|route-filter-v6\
+ |route-filter-v4|route-filter-translated-v6\
+ |route-filter-translated-v4] [exact-match]\
+ ] [json]",
SHOW_STR
IP_STR
BGP_STR
"Do not advertise to any peer (well-known community)\n"
"Do not export to next AS (well-known community)\n"
"Graceful shutdown (well-known community)\n"
+ "Do not export to any peer (well-known community)\n"
+ "Inform EBGP peers to blackhole traffic to prefix (well-known community)\n"
+ "Staled Long-lived Graceful Restart VPN route (well-known community)\n"
+ "Removed because Long-lived Graceful Restart was not enabled for VPN route (well-known community)\n"
+ "Should accept local VPN route if exported and imported into different VRF (well-known community)\n"
+ "Should accept VPN route with local nexthop (well-known community)\n"
+ "RT VPNv6 route filtering (well-known community)\n"
+ "RT VPNv4 route filtering (well-known community)\n"
+ "RT translated VPNv6 route filtering (well-known community)\n"
+ "RT translated VPNv4 route filtering (well-known community)\n"
"Exact match of the communities\n"
JSON_STR)
{
enum bgp_show_type sh_type = bgp_show_type_normal;
struct bgp *bgp = NULL;
int idx = 0;
- int idx_community_type = 0;
int exact_match = 0;
bool uj = use_json(argc, argv);
}
if (argv_find(argv, argc, "community", &idx)) {
+ char *maybecomm = idx + 1 < argc ? argv[idx + 1]->text : NULL;
+ char *community = NULL;
- /* show a specific community */
- if (argv_find(argv, argc, "local-AS", &idx_community_type) ||
- argv_find(argv, argc, "no-advertise",
- &idx_community_type) ||
- argv_find(argv, argc, "no-export",
- &idx_community_type) ||
- argv_find(argv, argc, "graceful-shutdown",
- &idx_community_type) ||
- argv_find(argv, argc, "AA:NN", &idx_community_type)) {
- if (argv_find(argv, argc, "exact-match", &idx))
- exact_match = 1;
-
- return (bgp_show_community(vty, bgp,
- argv[idx_community_type]->arg,
- exact_match, afi, safi, uj));
- } else {
+ if (maybecomm && !strmatch(maybecomm, "json")
+ && !strmatch(maybecomm, "exact-match"))
+ community = maybecomm;
+
+ if (argv_find(argv, argc, "exact-match", &idx))
+ exact_match = 1;
- /* show all communities */
+ if (community)
+ return bgp_show_community(vty, bgp, community,
+ exact_match, afi, safi, uj);
+ else
return (bgp_show(vty, bgp, afi, safi,
- bgp_show_type_community_all, NULL,
- uj));
- }
+ bgp_show_type_community_all, NULL,
+ uj));
}
return bgp_show(vty, bgp, afi, safi, sh_type, NULL, uj);