Skip to content

Commit

Permalink
bgpd: Add show ip bgp <afi> <safi> detail command version
Browse files Browse the repository at this point in the history
Signed-off-by: Donatas Abraitis <[email protected]>
  • Loading branch information
ton31337 authored and cscarpitta committed Mar 1, 2023
1 parent 5213ed1 commit b599dfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -11259,6 +11259,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
bool wide = CHECK_FLAG(show_flags, BGP_SHOW_OPT_WIDE);
bool all = CHECK_FLAG(show_flags, BGP_SHOW_OPT_AFI_ALL);
bool detail_json = CHECK_FLAG(show_flags, BGP_SHOW_OPT_JSON_DETAIL);
bool detail_routes = CHECK_FLAG(show_flags, BGP_SHOW_OPT_ROUTES_DETAIL);

if (output_cum && *output_cum != 0)
header = false;
Expand Down Expand Up @@ -11555,7 +11556,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
vty_out(vty, "Default local pref %u, ",
bgp->default_local_pref);
vty_out(vty, "local AS %u\n", bgp->as);
if (!detail_json) {
if (!detail_routes) {
vty_out(vty, BGP_SHOW_SCODE_HEADER);
vty_out(vty, BGP_SHOW_NCODE_HEADER);
vty_out(vty, BGP_SHOW_OCODE_HEADER);
Expand All @@ -11567,7 +11568,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
else if (type == bgp_show_type_flap_statistics
|| type == bgp_show_type_flap_neighbor)
vty_out(vty, BGP_SHOW_FLAP_HEADER);
else if (!detail_json)
else if (!detail_routes)
vty_out(vty, (wide ? BGP_SHOW_HEADER_WIDE
: BGP_SHOW_HEADER));
header = false;
Expand Down Expand Up @@ -11610,7 +11611,7 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
AFI_IP, safi, use_json,
json_paths);
else {
if (detail_json) {
if (detail_routes) {
const struct prefix_rd *prd;

prd = bgp_rd_from_dest(dest, safi);
Expand Down Expand Up @@ -12676,6 +12677,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|A.B.C.D/M longer-prefixes\
|X:X::X:X/M longer-prefixes\
|optimal-route-reflection [WORD$orr_group_name]\
|detail-routes$detail_routes\
] [json$uj [detail$detail_json] | wide$wide]",
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
BGP_SAFI_WITH_LABEL_HELP_STR
Expand Down Expand Up @@ -12726,6 +12728,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
"Display route and more specific routes\n"
"Display Optimal Route Reflection RR Clients\n"
"ORR Group name\n"
"Display detailed version of all routes\n"
JSON_STR
"Display detailed version of JSON output\n"
"Increase table width for longer prefixes\n")
Expand All @@ -12752,6 +12755,9 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
if (detail_json)
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON_DETAIL);

if (detail_routes)
SET_FLAG(show_flags, BGP_SHOW_OPT_ROUTES_DETAIL);

/* [<ipv4|ipv6> [all]] */
if (all) {
SET_FLAG(show_flags, BGP_SHOW_OPT_AFI_ALL);
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ DECLARE_HOOK(bgp_process,
#define BGP_SHOW_OPT_FAILED (1 << 6)
#define BGP_SHOW_OPT_JSON_DETAIL (1 << 7)
#define BGP_SHOW_OPT_TERSE (1 << 8)
#define BGP_SHOW_OPT_ROUTES_DETAIL (1 << 9)

/* Prototypes. */
extern void bgp_rib_remove(struct bgp_dest *dest, struct bgp_path_info *pi,
Expand Down

0 comments on commit b599dfd

Please sign in to comment.