diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2021-07-28 03:29:43 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2021-11-23 19:14:08 +0100 |
commit | a71293475bd48bc970bfe6e9c0c80b6620f11903 (patch) | |
tree | d3cffec79849954401700133f1d96ed3990ecb2f /bgpd/bgp_route.c | |
parent | bgpd: add "json" option to "show ip bgp ... prefix-list" (diff) | |
download | frr-a71293475bd48bc970bfe6e9c0c80b6620f11903.tar.xz frr-a71293475bd48bc970bfe6e9c0c80b6620f11903.zip |
bgpd: add "json" option to "show ip bgp ... filter-list"
Move the "filter-list" option from show_ip_bgp_cmd to
show_ip_bgp_json_cmd so that is has access to JSON output.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r-- | bgpd/bgp_route.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 02a227395..63f1899c4 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10635,9 +10635,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, #define BGP_SHOW_DAMP_HEADER " Network From Reuse Path\n" #define BGP_SHOW_FLAP_HEADER " Network From Flaps Duration Reuse Path\n" -static int bgp_show_filter_list(struct vty *vty, struct bgp *bgp, - const char *filter, afi_t afi, safi_t safi, - enum bgp_show_type type); static int bgp_show_route_map(struct vty *vty, struct bgp *bgp, const char *rmap_str, afi_t afi, safi_t safi, enum bgp_show_type type); @@ -12013,7 +12010,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, "]]\ <[all$all] dampening <parameters>\ |route-map WORD\ - |filter-list AS_PATH_FILTER_NAME\ |A.B.C.D/M longer-prefixes\ |X:X::X:X/M longer-prefixes\ >", @@ -12024,8 +12020,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, "Display detail of configured dampening parameters\n" "Display routes matching the route-map\n" "A route-map to match on\n" - "Display routes conforming to the filter-list\n" - "Regular expression access list name\n" "IPv4 prefix\n" "Display route and more specific routes\n" "IPv6 prefix\n" @@ -12058,10 +12052,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, show_flags); } - if (argv_find(argv, argc, "filter-list", &idx)) - return bgp_show_filter_list(vty, bgp, argv[idx + 1]->arg, afi, - safi, bgp_show_type_filter_list); - if (argv_find(argv, argc, "route-map", &idx)) return bgp_show_route_map(vty, bgp, argv[idx + 1]->arg, afi, safi, bgp_show_type_route_map); @@ -12090,6 +12080,7 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd, |route-filter-v4|route-filter-translated-v6\ |route-filter-translated-v4] [exact-match]\ |community-list <(1-500)|COMMUNITY_LIST_NAME> [exact-match]\ + |filter-list AS_PATH_FILTER_NAME\ |prefix-list WORD\ |rpki <invalid|valid|notfound>\ |version (1-4294967295)\ @@ -12122,6 +12113,8 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd, "Community-list name\n" "Display routes matching the community-list\n" "Exact match of the communities\n" + "Display routes conforming to the filter-list\n" + "Regular expression access list name\n" "Display routes conforming to the prefix-list\n" "Prefix-list name\n" "RPKI route types\n" @@ -12228,6 +12221,22 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd, output_arg = list; } + if (argv_find(argv, argc, "filter-list", &idx)) { + const char *filter = argv[++idx]->arg; + struct as_list *as_list; + + as_list = as_list_lookup(filter); + if (as_list == NULL) { + vty_out(vty, + "%% %s is not a valid AS-path access-list name\n", + filter); + return CMD_WARNING; + } + + sh_type = bgp_show_type_filter_list; + output_arg = as_list; + } + if (argv_find(argv, argc, "prefix-list", &idx)) { const char *prefix_list_str = argv[++idx]->arg; struct prefix_list *plist; @@ -12529,24 +12538,6 @@ static int bgp_show_regexp(struct vty *vty, struct bgp *bgp, const char *regstr, return rc; } -static int bgp_show_filter_list(struct vty *vty, struct bgp *bgp, - const char *filter, afi_t afi, safi_t safi, - enum bgp_show_type type) -{ - struct as_list *as_list; - uint16_t show_flags = 0; - - as_list = as_list_lookup(filter); - if (as_list == NULL) { - vty_out(vty, "%% %s is not a valid AS-path access-list name\n", - filter); - return CMD_WARNING; - } - - return bgp_show(vty, bgp, afi, safi, type, as_list, show_flags, - RPKI_NOT_BEING_USED); -} - static int bgp_show_route_map(struct vty *vty, struct bgp *bgp, const char *rmap_str, afi_t afi, safi_t safi, enum bgp_show_type type) |