mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 12:18:12 +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);
|
RPKI_NOT_BEING_USED);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_flowspec_routes_detailed,
|
/*
|
||||||
show_ip_bgp_flowspec_routes_detailed_cmd,
|
* Used for "detailed" output for cmds like show bgp <afi> <safi> (or)
|
||||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" flowspec] detail [json]",
|
* show bgp <vrf> (or) show bgp <vrf> <afi> <safi>
|
||||||
SHOW_STR
|
*/
|
||||||
IP_STR
|
DEFPY(show_ip_bgp_vrf_afi_safi_routes_detailed,
|
||||||
BGP_STR
|
show_ip_bgp_vrf_afi_safi_routes_detailed_cmd,
|
||||||
BGP_INSTANCE_HELP_STR
|
"show [ip] bgp [<view|vrf> VIEWVRFNAME$vrf_name] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] detail [json$uj]",
|
||||||
BGP_AFI_HELP_STR
|
SHOW_STR
|
||||||
"SAFI Flowspec\n"
|
IP_STR
|
||||||
"Detailed information on flowspec entries\n"
|
BGP_STR
|
||||||
JSON_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;
|
afi_t afi = AFI_IP6;
|
||||||
safi_t safi = SAFI_UNICAST;
|
safi_t safi = SAFI_UNICAST;
|
||||||
struct bgp *bgp = NULL;
|
struct bgp *bgp = NULL;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
bool uj = use_json(argc, argv);
|
|
||||||
uint16_t show_flags = BGP_SHOW_OPT_ROUTES_DETAIL;
|
uint16_t show_flags = BGP_SHOW_OPT_ROUTES_DETAIL;
|
||||||
|
|
||||||
if (uj) {
|
if (uj)
|
||||||
argc--;
|
|
||||||
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
|
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
|
||||||
}
|
|
||||||
|
|
||||||
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
|
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
|
||||||
&bgp, uj);
|
&bgp, uj);
|
||||||
if (!idx)
|
if (!idx)
|
||||||
return CMD_WARNING;
|
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,
|
return bgp_show(vty, bgp, afi, safi, bgp_show_type_detail, NULL,
|
||||||
show_flags, RPKI_NOT_BEING_USED);
|
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_list_cmd);
|
||||||
install_element(VIEW_NODE, &show_ip_bgp_large_community_cmd);
|
install_element(VIEW_NODE, &show_ip_bgp_large_community_cmd);
|
||||||
|
|
||||||
/* show bgp ipv4 flowspec detailed */
|
/* show bgp vrf <afi> <safi> detailed */
|
||||||
install_element(VIEW_NODE, &show_ip_bgp_flowspec_routes_detailed_cmd);
|
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_listeners_cmd);
|
||||||
install_element(VIEW_NODE, &show_bgp_peerhash_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
|
If ``afi`` is specified, with ``all`` option, routes will be displayed for
|
||||||
each SAFI in the selected AFI.
|
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:
|
.. _bgp-display-routes-by-community:
|
||||||
|
|
||||||
Displaying Routes by Community Attribute
|
Displaying Routes by Community Attribute
|
||||||
|
Loading…
Reference in New Issue
Block a user