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 | bf1a944ace47d87fdf7ed66539791ea0f8478e8a (patch) | |
tree | 8d03a9fef3587a04e0ca4abcc781a12318a46ae2 /bgpd/bgp_route.c | |
parent | bgpd: add "json" option to "show ip bgp ... filter-list" (diff) | |
download | frr-bf1a944ace47d87fdf7ed66539791ea0f8478e8a.tar.xz frr-bf1a944ace47d87fdf7ed66539791ea0f8478e8a.zip |
bgpd: add "json" option to "show ip bgp ... route-map"
Move the "route-map" 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 | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 63f1899c4..7018df2ee 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_route_map(struct vty *vty, struct bgp *bgp, - const char *rmap_str, afi_t afi, safi_t safi, - enum bgp_show_type type); static int bgp_show_prefix_longer(struct vty *vty, struct bgp *bgp, const char *prefix, afi_t afi, safi_t safi, enum bgp_show_type type); @@ -12009,7 +12006,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, " [" BGP_SAFI_WITH_LABEL_CMD_STR "]]\ <[all$all] dampening <parameters>\ - |route-map WORD\ |A.B.C.D/M longer-prefixes\ |X:X::X:X/M longer-prefixes\ >", @@ -12018,8 +12014,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, "Display the entries for all address families\n" "Display detailed information about dampening\n" "Display detail of configured dampening parameters\n" - "Display routes matching the route-map\n" - "A route-map to match on\n" "IPv4 prefix\n" "Display route and more specific routes\n" "IPv6 prefix\n" @@ -12052,10 +12046,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, show_flags); } - 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); - /* prefix-longer */ if (argv_find(argv, argc, "A.B.C.D/M", &idx) || argv_find(argv, argc, "X:X::X:X/M", &idx)) @@ -12082,6 +12072,7 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd, |community-list <(1-500)|COMMUNITY_LIST_NAME> [exact-match]\ |filter-list AS_PATH_FILTER_NAME\ |prefix-list WORD\ + |route-map WORD\ |rpki <invalid|valid|notfound>\ |version (1-4294967295)\ |alias ALIAS_NAME\ @@ -12117,6 +12108,8 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd, "Regular expression access list name\n" "Display routes conforming to the prefix-list\n" "Prefix-list name\n" + "Display routes matching the route-map\n" + "A route-map to match on\n" "RPKI route types\n" "A valid path as determined by rpki\n" "A invalid path as determined by rpki\n" @@ -12252,6 +12245,21 @@ DEFPY(show_ip_bgp_json, show_ip_bgp_json_cmd, output_arg = plist; } + if (argv_find(argv, argc, "route-map", &idx)) { + const char *rmap_str = argv[++idx]->arg; + struct route_map *rmap; + + rmap = route_map_lookup_by_name(rmap_str); + if (!rmap) { + vty_out(vty, "%% %s is not a valid route-map name\n", + rmap_str); + return CMD_WARNING; + } + + sh_type = bgp_show_type_route_map; + output_arg = rmap; + } + if (argv_find(argv, argc, "rpki", &idx)) { sh_type = bgp_show_type_rpki; if (argv_find(argv, argc, "valid", &idx)) @@ -12538,23 +12546,6 @@ static int bgp_show_regexp(struct vty *vty, struct bgp *bgp, const char *regstr, return rc; } -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) -{ - struct route_map *rmap; - uint16_t show_flags = 0; - - rmap = route_map_lookup_by_name(rmap_str); - if (!rmap) { - vty_out(vty, "%% %s is not a valid route-map name\n", rmap_str); - return CMD_WARNING; - } - - return bgp_show(vty, bgp, afi, safi, type, rmap, show_flags, - RPKI_NOT_BEING_USED); -} - static int bgp_show_community(struct vty *vty, struct bgp *bgp, const char *comstr, int exact, afi_t afi, safi_t safi, uint16_t show_flags) |