afi_t afi, safi_t safi, enum bgp_show_type type);
static int bgp_show_community(struct vty *vty, struct bgp *bgp,
const char *comstr, int exact, afi_t afi,
- safi_t safi);
+ safi_t safi, uint8_t use_json);
static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
|prefix-list WORD\
|filter-list WORD\
|statistics\
- |community <AA:NN|local-AS|no-advertise|no-export|graceful-shutdown> [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"
- "Exact match of the communities\n"
"Display routes matching the community-list\n"
"community-list number\n"
"community-list name\n"
int exact_match = 0;
struct bgp *bgp = NULL;
int idx = 0;
- int idx_community_type = 0;
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
&bgp);
return bgp_show_route_map(vty, bgp, argv[idx + 1]->arg, afi,
safi, bgp_show_type_route_map);
- if (argv_find(argv, argc, "community", &idx)) {
- /* 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);
- }
- }
-
if (argv_find(argv, argc, "community-list", &idx)) {
const char *clist_number_or_name = argv[++idx]->arg;
if (++idx < argc && strmatch(argv[idx]->text, "exact-match"))
[<\
cidr-only\
|dampening <flap-statistics|dampened-paths>\
- |community \
+ |community [<AA:NN|local-AS|no-advertise|no-export|graceful-shutdown>] [exact-match]\
>] [json]",
SHOW_STR
IP_STR
"Display flap statistics of routes\n"
"Display paths suppressed due to dampening\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"
+ "Exact match of the communities\n"
JSON_STR)
{
afi_t afi = AFI_IP6;
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;
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
&bgp);
}
if (argv_find(argv, argc, "community", &idx)) {
- /* show all communities */
- return bgp_show(vty, bgp, afi, safi,
- bgp_show_type_community_all, NULL, uj);
+
+ /* 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 {
+
+ /* show all communities */
+ return (bgp_show(vty, bgp, afi, safi,
+ bgp_show_type_community_all, NULL,
+ uj));
+ }
}
+
return bgp_show(vty, bgp, afi, safi, sh_type, NULL, uj);
}
static int bgp_show_community(struct vty *vty, struct bgp *bgp,
const char *comstr, int exact, afi_t afi,
- safi_t safi)
+ safi_t safi, uint8_t use_json)
{
struct community *com;
int ret = 0;
ret = bgp_show(vty, bgp, afi, safi,
(exact ? bgp_show_type_community_exact
: bgp_show_type_community),
- com, 0);
+ com, use_json);
community_free(com);
return ret;