mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 20:55:25 +00:00
bgpd: add show bgp link-state link-state commands
Add the "show bgp link-state link-state" following commands: > r3# show bgp link-state link-state ? > <cr> > all Display the entries for all address families > detail-routes Display detailed version of all routes > json JavaScript Object Notation > neighbors Detailed information on TCP and BGP neighbor connections > regexp Display routes matching the AS path regular expression > summary Summary of BGP neighbor status > version Display prefixes with matching version numbers > wide Increase table width for longer prefixes Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
parent
38a7e20fc9
commit
f11f67033f
@ -12983,6 +12983,62 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* BGP route print out function */
|
||||
DEFPY (show_ip_bgp_link_state, show_ip_bgp_link_state_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] link-state link-state\
|
||||
[all$all]\
|
||||
[version (1-4294967295)\
|
||||
|detail-routes$detail_routes\
|
||||
] [json$uj [detail$detail_json] | wide$wide]",
|
||||
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR
|
||||
BGP_AF_STR
|
||||
BGP_AF_MODIFIER_STR
|
||||
"Display the entries for all address families\n"
|
||||
"Display prefixes with matching version numbers\n"
|
||||
"Version number and above\n"
|
||||
"Display detailed version of all routes\n"
|
||||
JSON_STR
|
||||
"Display detailed version of JSON output\n"
|
||||
"Increase table width for longer prefixes\n")
|
||||
{
|
||||
afi_t afi = AFI_LINKSTATE;
|
||||
safi_t safi = SAFI_LINKSTATE;
|
||||
enum bgp_show_type sh_type = bgp_show_type_normal;
|
||||
void *output_arg = NULL;
|
||||
struct bgp *bgp = NULL;
|
||||
int idx = 0;
|
||||
uint16_t show_flags = 0;
|
||||
enum rpki_states rpki_target_state = RPKI_NOT_BEING_USED;
|
||||
|
||||
if (uj) {
|
||||
argc--;
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON);
|
||||
}
|
||||
|
||||
if (detail_json)
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_JSON_DETAIL);
|
||||
|
||||
if (detail_routes)
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_ROUTES_DETAIL);
|
||||
|
||||
if (wide)
|
||||
SET_FLAG(show_flags, BGP_SHOW_OPT_WIDE);
|
||||
|
||||
bgp_vty_find_and_parse_afi_safi_bgp(vty, argv, argc, &idx, &afi, &safi,
|
||||
&bgp, uj);
|
||||
if (!idx)
|
||||
return CMD_WARNING;
|
||||
|
||||
/* Display prefixes with matching version numbers */
|
||||
if (argv_find(argv, argc, "version", &idx)) {
|
||||
sh_type = bgp_show_type_prefix_version;
|
||||
output_arg = argv[idx + 1]->arg;
|
||||
}
|
||||
|
||||
return bgp_show(vty, bgp, afi, safi, sh_type, output_arg, show_flags,
|
||||
rpki_target_state);
|
||||
}
|
||||
|
||||
DEFUN (show_ip_bgp_route,
|
||||
show_ip_bgp_route_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]]<A.B.C.D|A.B.C.D/M|X:X::X:X|X:X::X:X/M> [<bestpath|multipath>] [rpki <valid|invalid|notfound>] [json]",
|
||||
@ -13063,13 +13119,13 @@ DEFUN (show_ip_bgp_route,
|
||||
|
||||
DEFUN (show_ip_bgp_regexp,
|
||||
show_ip_bgp_regexp_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] regexp REGEX [json]",
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_WITH_LS_CMD_STR" ["BGP_SAFI_WITH_LABEL_LS_CMD_STR"]] regexp REGEX [json]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
BGP_AFI_WITH_LS_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_LS_HELP_STR
|
||||
"Display routes matching the AS path regular expression\n"
|
||||
"A regular-expression (1234567890_^|[,{}() ]$*+.?-\\) to match the BGP AS paths\n"
|
||||
JSON_STR)
|
||||
@ -14610,13 +14666,13 @@ DEFPY (show_ip_bgp_instance_neighbor_bestpath_route,
|
||||
|
||||
DEFPY(show_ip_bgp_instance_neighbor_advertised_route,
|
||||
show_ip_bgp_instance_neighbor_advertised_route_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR " [" BGP_SAFI_WITH_LABEL_CMD_STR "]] [all$all] neighbors <A.B.C.D|X:X::X:X|WORD> <advertised-routes|received-routes|filtered-routes> [route-map RMAP_NAME$route_map] [<A.B.C.D/M|X:X::X:X/M>$prefix | detail$detail] [json$uj | wide$wide]",
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_WITH_LS_CMD_STR " [" BGP_SAFI_WITH_LABEL_LS_CMD_STR "]] [all$all] neighbors <A.B.C.D|X:X::X:X|WORD> <advertised-routes|received-routes|filtered-routes> [route-map RMAP_NAME$route_map] [<A.B.C.D/M|X:X::X:X/M>$prefix | detail$detail] [json$uj | wide$wide]",
|
||||
SHOW_STR
|
||||
IP_STR
|
||||
BGP_STR
|
||||
BGP_INSTANCE_HELP_STR
|
||||
BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
BGP_AFI_WITH_LS_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_LS_HELP_STR
|
||||
"Display the entries for all address families\n"
|
||||
"Detailed information on TCP and BGP neighbor connections\n"
|
||||
"Neighbor to display information about\n"
|
||||
@ -14670,6 +14726,12 @@ DEFPY(show_ip_bgp_instance_neighbor_advertised_route,
|
||||
if (!idx)
|
||||
return CMD_WARNING;
|
||||
|
||||
if (afi == AFI_LINKSTATE && prefix_str) {
|
||||
vty_out(vty,
|
||||
"The prefix option cannot be selected with AFI Link-State\n");
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
/* neighbors <A.B.C.D|X:X::X:X|WORD> */
|
||||
argv_find(argv, argc, "neighbors", &idx);
|
||||
peerstr = argv[++idx]->arg;
|
||||
@ -15892,6 +15954,7 @@ void bgp_route_init(void)
|
||||
install_element(VIEW_NODE, &show_ip_bgp_l2vpn_evpn_statistics_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_dampening_params_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_link_state_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_route_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_regexp_cmd);
|
||||
install_element(VIEW_NODE, &show_ip_bgp_statistics_all_cmd);
|
||||
|
@ -12374,11 +12374,11 @@ int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
|
||||
|
||||
/* `show [ip] bgp summary' commands. */
|
||||
DEFPY(show_ip_bgp_summary, show_ip_bgp_summary_cmd,
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_CMD_STR
|
||||
" [" BGP_SAFI_WITH_LABEL_CMD_STR
|
||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] [" BGP_AFI_WITH_LS_CMD_STR
|
||||
" [" BGP_SAFI_WITH_LABEL_LS_CMD_STR
|
||||
"]] [all$all] summary [established|failed] [<neighbor <A.B.C.D|X:X::X:X|WORD>|remote-as <ASNUM|internal|external>>] [terse] [wide] [json$uj]",
|
||||
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_WITH_LS_HELP_STR
|
||||
BGP_SAFI_WITH_LABEL_LS_HELP_STR
|
||||
"Display the entries for all address families\n"
|
||||
"Summary of BGP neighbor status\n"
|
||||
"Show only sessions in Established state\n"
|
||||
|
@ -17,6 +17,8 @@ struct bgp;
|
||||
#define BGP_AF_MODIFIER_STR "Address Family modifier\n"
|
||||
#define BGP_AFI_CMD_STR "<ipv4|ipv6>"
|
||||
#define BGP_AFI_HELP_STR BGP_AF_STR BGP_AF_STR
|
||||
#define BGP_AFI_WITH_LS_CMD_STR "<ipv4|ipv6|link-state>"
|
||||
#define BGP_AFI_WITH_LS_HELP_STR BGP_AF_STR BGP_AF_STR BGP_AF_STR
|
||||
#define BGP_SAFI_CMD_STR "<unicast|multicast|vpn>"
|
||||
#define BGP_SAFI_HELP_STR \
|
||||
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR
|
||||
@ -28,6 +30,12 @@ struct bgp;
|
||||
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR \
|
||||
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR
|
||||
|
||||
#define BGP_SAFI_WITH_LABEL_LS_CMD_STR \
|
||||
"<unicast|multicast|vpn|labeled-unicast|flowspec|link-state>"
|
||||
#define BGP_SAFI_WITH_LABEL_LS_HELP_STR \
|
||||
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR \
|
||||
BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR BGP_AF_MODIFIER_STR
|
||||
|
||||
#define BGP_SELF_ORIG_CMD_STR "self-originate"
|
||||
#define BGP_SELF_ORIG_HELP_STR "Display only self-originated routes\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user