mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 15:36:25 +00:00
Merge pull request #13437 from raja-rajasekar/raja-rajasekar/show_cmd_fix
bgpd: Fixing the show bgp <vrf> <afi> <safi> detail command
This commit is contained in:
commit
911bfbf5f1
@ -14941,35 +14941,42 @@ static int bgp_show_neighbor_route(struct vty *vty, struct peer *peer,
|
||||
RPKI_NOT_BEING_USED);
|
||||
}
|
||||
|
||||
DEFUN (show_ip_bgp_flowspec_routes_detailed,
|
||||
show_ip_bgp_flowspec_routes_detailed_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" flowspec] detail [json]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
BGP_AFI_HELP_STR
|
||||
"SAFI Flowspec\n"
|
||||
"Detailed information on flowspec entries\n"
|
||||
JSON_STR)
|
||||
/*
|
||||
* Used for "detailed" output for cmds like show bgp <afi> <safi> (or)
|
||||
* show bgp <vrf> (or) show bgp <vrf> <afi> <safi>
|
||||
*/
|
||||
DEFPY(show_ip_bgp_vrf_afi_safi_routes_detailed,
|
||||
show_ip_bgp_vrf_afi_safi_routes_detailed_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME$vrf_name] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] detail [json$uj]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
"Detailed information\n"
|
||||
JSON_STR)
|
||||
{
|
||||
afi_t afi = AFI_IP6;
|
||||
safi_t safi = SAFI_UNICAST;
|
||||
struct bgp *bgp = NULL;
|
||||
int idx = 0;
|
||||
bool uj = use_json(argc, argv);
|
||||
uint16_t show_flags = BGP_SHOW_OPT_ROUTES_DETAIL;
|
||||
|
||||
if (uj) {
|
||||
argc--;
|
||||
if (uj)
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
|
||||
}
|
||||
|
||||
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
|
||||
&bgp, uj);
|
||||
if (!idx)
|
||||
return CMD_WARNING;
|
||||
/* 'vrf all' case to iterate all vrfs & show output per vrf instance */
|
||||
if (vrf_name && strmatch(vrf_name, "all")) {
|
||||
bgp_show_all_instances_routes_vty(vty, afi, safi, show_flags);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* All other cases except vrf all */
|
||||
return bgp_show(vty, bgp, afi, safi, bgp_show_type_detail, NULL,
|
||||
show_flags, RPKI_NOT_BEING_USED);
|
||||
}
|
||||
@ -16085,8 +16092,9 @@ void bgp_route_init(void)
|
||||
install_element(VIEW_NODE, &show_ip_bgp_large_community_list_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_large_community_cmd);
|
||||
|
||||
/* show bgp ipv4 flowspec detailed */
|
||||
install_element(VIEW_NODE, &show_ip_bgp_flowspec_routes_detailed_cmd);
|
||||
/* show bgp vrf <afi> <safi> detailed */
|
||||
install_element(VIEW_NODE,
|
||||
&show_ip_bgp_vrf_afi_safi_routes_detailed_cmd);
|
||||
|
||||
install_element(VIEW_NODE, &show_bgp_listeners_cmd);
|
||||
install_element(VIEW_NODE, &show_bgp_peerhash_cmd);
|
||||
|
116
doc/user/bgp.rst
116
doc/user/bgp.rst
@ -4109,6 +4109,122 @@ structure is extended with :clicmd:`show bgp [afi] [safi]`.
|
||||
If ``afi`` is specified, with ``all`` option, routes will be displayed for
|
||||
each SAFI in the selected AFI.
|
||||
|
||||
.. clicmd:: show [ip] bgp [<view|vrf> VIEWVRFNAME] [afi] [safi] detail [json]
|
||||
|
||||
Display the detailed version of all routes from the specified bgp vrf table
|
||||
for a given afi + safi.
|
||||
|
||||
If no vrf is specified, then it is assumed as a default vrf and routes
|
||||
are displayed from default vrf table.
|
||||
|
||||
If ``all`` option is specified as vrf name, then all bgp vrf tables routes
|
||||
from a given afi+safi are displayed in the detailed output of routes.
|
||||
|
||||
If ``json`` option is specified, detailed output is displayed in JSON format.
|
||||
|
||||
Following are sample output for few examples of how to use this command.
|
||||
|
||||
.. code-block:: frr
|
||||
|
||||
torm-23# sh bgp ipv4 unicast detail (OR) sh bgp vrf default ipv4 unicast detail
|
||||
|
||||
!--- Output suppressed.
|
||||
|
||||
BGP routing table entry for 172.16.16.1/32
|
||||
Paths: (1 available, best #1, table default)
|
||||
Not advertised to any peer
|
||||
Local, (Received from a RR-client)
|
||||
172.16.16.1 (metric 20) from torm-22(172.16.16.1) (192.168.0.10)
|
||||
Origin IGP, metric 0, localpref 100, valid, internal
|
||||
Last update: Fri May 8 12:54:05 2023
|
||||
BGP routing table entry for 172.16.16.2/32
|
||||
Paths: (1 available, best #1, table default)
|
||||
Not advertised to any peer
|
||||
Local
|
||||
0.0.0.0 from 0.0.0.0 (172.16.16.2)
|
||||
Origin incomplete, metric 0, weight 32768, valid, sourced, bestpath-from-AS Local, best (First path received)
|
||||
Last update: Wed May 8 12:54:41 2023
|
||||
|
||||
Displayed 2 routes and 2 total paths
|
||||
|
||||
.. code-block:: frr
|
||||
|
||||
torm-23# sh bgp vrf all detail
|
||||
|
||||
Instance default:
|
||||
|
||||
!--- Output suppressed.
|
||||
|
||||
BGP routing table entry for 172.16.16.1/32
|
||||
Paths: (1 available, best #1, table default)
|
||||
Not advertised to any peer
|
||||
Local, (Received from a RR-client)
|
||||
172.16.16.1 (metric 20) from torm-22(172.16.16.1) (192.168.0.10)
|
||||
Origin IGP, metric 0, localpref 100, valid, internal
|
||||
Last update: Fri May 8 12:44:05 2023
|
||||
BGP routing table entry for 172.16.16.2/32
|
||||
Paths: (1 available, best #1, table default)
|
||||
Not advertised to any peer
|
||||
Local
|
||||
0.0.0.0 from 0.0.0.0 (172.16.16.2)
|
||||
Origin incomplete, metric 0, weight 32768, valid, sourced, bestpath-from-AS Local, best (First path received)
|
||||
Last update: Wed May 8 12:45:01 2023
|
||||
|
||||
Displayed 2 routes and 2 total paths
|
||||
|
||||
Instance vrf3:
|
||||
|
||||
!--- Output suppressed.
|
||||
|
||||
BGP routing table entry for 192.168.0.2/32
|
||||
Paths: (1 available, best #1, vrf vrf3)
|
||||
Not advertised to any peer
|
||||
Imported from 172.16.16.1:12:[2]:[0]:[48]:[00:02:00:00:00:58]:[32]:[192.168.0.2], VNI 1008/4003
|
||||
Local
|
||||
172.16.16.1 from torm-22(172.16.16.1) (172.16.16.1) announce-nh-self
|
||||
Origin IGP, localpref 100, valid, internal, bestpath-from-AS Local, best (First path received)
|
||||
Extended Community: RT:65000:1008 ET:8 Rmac:00:02:00:00:00:58
|
||||
Last update: Fri May 8 02:41:55 2023
|
||||
BGP routing table entry for 192.168.1.2/32
|
||||
Paths: (1 available, best #1, vrf vrf3)
|
||||
Not advertised to any peer
|
||||
Imported from 172.16.16.1:13:[2]:[0]:[48]:[00:02:00:00:00:58]:[32]:[192.168.1.2], VNI 1009/4003
|
||||
Local
|
||||
172.16.16.1 from torm-22(172.16.16.1) (172.16.16.1) announce-nh-self
|
||||
Origin IGP, localpref 100, valid, internal, bestpath-from-AS Local, best (First path received)
|
||||
Extended Community: RT:65000:1009 ET:8 Rmac:00:02:00:00:00:58
|
||||
Last update: Fri May 8 02:41:55 2023
|
||||
|
||||
Displayed 2 routes and 2 total paths
|
||||
|
||||
|
||||
.. code-block:: frr
|
||||
|
||||
torm-23# sh bgp vrf vrf3 ipv4 unicast detail
|
||||
|
||||
!--- Output suppressed.
|
||||
|
||||
BGP routing table entry for 192.168.0.2/32
|
||||
Paths: (1 available, best #1, vrf vrf3)
|
||||
Not advertised to any peer
|
||||
Imported from 172.16.16.1:12:[2]:[0]:[48]:[00:02:00:00:00:58]:[32]:[192.168.0.2], VNI 1008/4003
|
||||
Local
|
||||
172.16.16.1 from torm-22(172.16.16.1) (172.16.16.1) announce-nh-self
|
||||
Origin IGP, localpref 100, valid, internal, bestpath-from-AS Local, best (First path received)
|
||||
Extended Community: RT:65000:1008 ET:8 Rmac:00:02:00:00:00:58
|
||||
Last update: Fri May 8 02:23:35 2023
|
||||
BGP routing table entry for 192.168.1.2/32
|
||||
Paths: (1 available, best #1, vrf vrf3)
|
||||
Not advertised to any peer
|
||||
Imported from 172.16.16.1:13:[2]:[0]:[48]:[00:02:00:00:00:58]:[32]:[192.168.1.2], VNI 1009/4003
|
||||
Local
|
||||
172.16.16.1 from torm-22(172.16.16.1) (172.16.16.1) announce-nh-self
|
||||
Origin IGP, localpref 100, valid, internal, bestpath-from-AS Local, best (First path received)
|
||||
Extended Community: RT:65000:1009 ET:8 Rmac:00:02:00:00:00:58
|
||||
Last update: Fri May 8 02:23:55 2023
|
||||
|
||||
Displayed 2 routes and 2 total paths
|
||||
|
||||
.. _bgp-display-routes-by-community:
|
||||
|
||||
Displaying Routes by Community Attribute
|
||||
|
Loading…
Reference in New Issue
Block a user