mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 04:50:29 +00:00
bgpd : Support for exact-match in match clause for lcommunity
FRR has a provision to give exact-match in match clause for standard community, but this option is missing for lcommunity. Part 3 : show related changes for match clause Signed-off-by: vishaldhingra <vdhingra@vmware.com>
This commit is contained in:
parent
03ff9a1410
commit
36a206db61
@ -9168,6 +9168,15 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
|
|||||||
lcom))
|
lcom))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == bgp_show_type_lcommunity_exact) {
|
||||||
|
struct lcommunity *lcom = output_arg;
|
||||||
|
|
||||||
|
if (!pi->attr->lcommunity
|
||||||
|
|| !lcommunity_cmp(pi->attr->lcommunity,
|
||||||
|
lcom))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (type == bgp_show_type_lcommunity_list) {
|
if (type == bgp_show_type_lcommunity_list) {
|
||||||
struct community_list *list = output_arg;
|
struct community_list *list = output_arg;
|
||||||
|
|
||||||
@ -9175,6 +9184,14 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
|
|||||||
list))
|
list))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (type
|
||||||
|
== bgp_show_type_lcommunity_list_exact) {
|
||||||
|
struct community_list *list = output_arg;
|
||||||
|
|
||||||
|
if (!lcommunity_list_exact_match(
|
||||||
|
pi->attr->lcommunity, list))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (type == bgp_show_type_lcommunity_all) {
|
if (type == bgp_show_type_lcommunity_all) {
|
||||||
if (!pi->attr->lcommunity)
|
if (!pi->attr->lcommunity)
|
||||||
continue;
|
continue;
|
||||||
@ -9798,8 +9815,8 @@ static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
|
static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
|
||||||
struct cmd_token **argv, afi_t afi, safi_t safi,
|
struct cmd_token **argv, bool exact, afi_t afi,
|
||||||
bool uj)
|
safi_t safi, bool uj)
|
||||||
{
|
{
|
||||||
struct lcommunity *lcom;
|
struct lcommunity *lcom;
|
||||||
struct buffer *b;
|
struct buffer *b;
|
||||||
@ -9830,13 +9847,15 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
|
|||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bgp_show(vty, bgp, afi, safi, bgp_show_type_lcommunity, lcom,
|
return bgp_show(vty, bgp, afi, safi,
|
||||||
uj);
|
(exact ? bgp_show_type_lcommunity_exact
|
||||||
|
: bgp_show_type_lcommunity),
|
||||||
|
lcom, uj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp,
|
static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp,
|
||||||
const char *lcom, afi_t afi, safi_t safi,
|
const char *lcom, bool exact, afi_t afi,
|
||||||
bool uj)
|
safi_t safi, bool uj)
|
||||||
{
|
{
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
|
||||||
@ -9848,13 +9867,15 @@ static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp,
|
|||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bgp_show(vty, bgp, afi, safi, bgp_show_type_lcommunity_list,
|
return bgp_show(vty, bgp, afi, safi,
|
||||||
|
(exact ? bgp_show_type_lcommunity_list_exact
|
||||||
|
: bgp_show_type_lcommunity_list),
|
||||||
list, uj);
|
list, uj);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_large_community_list,
|
DEFUN (show_ip_bgp_large_community_list,
|
||||||
show_ip_bgp_large_community_list_cmd,
|
show_ip_bgp_large_community_list_cmd,
|
||||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community-list <(1-500)|WORD> [json]",
|
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community-list <(1-500)|WORD> [exact-match] [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
@ -9864,12 +9885,14 @@ DEFUN (show_ip_bgp_large_community_list,
|
|||||||
"Display routes matching the large-community-list\n"
|
"Display routes matching the large-community-list\n"
|
||||||
"large-community-list number\n"
|
"large-community-list number\n"
|
||||||
"large-community-list name\n"
|
"large-community-list name\n"
|
||||||
|
"Exact match of the large-communities\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
char *vrf = NULL;
|
char *vrf = NULL;
|
||||||
afi_t afi = AFI_IP6;
|
afi_t afi = AFI_IP6;
|
||||||
safi_t safi = SAFI_UNICAST;
|
safi_t safi = SAFI_UNICAST;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
bool exact_match = 0;
|
||||||
|
|
||||||
if (argv_find(argv, argc, "ip", &idx))
|
if (argv_find(argv, argc, "ip", &idx))
|
||||||
afi = AFI_IP;
|
afi = AFI_IP;
|
||||||
@ -9893,12 +9916,18 @@ DEFUN (show_ip_bgp_large_community_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
argv_find(argv, argc, "large-community-list", &idx);
|
argv_find(argv, argc, "large-community-list", &idx);
|
||||||
return bgp_show_lcommunity_list(vty, bgp, argv[idx + 1]->arg, afi, safi,
|
|
||||||
uj);
|
const char *clist_number_or_name = argv[++idx]->arg;
|
||||||
|
|
||||||
|
if (++idx < argc && strmatch(argv[idx]->text, "exact-match"))
|
||||||
|
exact_match = 1;
|
||||||
|
|
||||||
|
return bgp_show_lcommunity_list(vty, bgp, clist_number_or_name,
|
||||||
|
exact_match, afi, safi, uj);
|
||||||
}
|
}
|
||||||
DEFUN (show_ip_bgp_large_community,
|
DEFUN (show_ip_bgp_large_community,
|
||||||
show_ip_bgp_large_community_cmd,
|
show_ip_bgp_large_community_cmd,
|
||||||
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community [AA:BB:CC] [json]",
|
"show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community [<AA:BB:CC> [exact-match]] [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
@ -9907,12 +9936,14 @@ DEFUN (show_ip_bgp_large_community,
|
|||||||
BGP_SAFI_WITH_LABEL_HELP_STR
|
BGP_SAFI_WITH_LABEL_HELP_STR
|
||||||
"Display routes matching the large-communities\n"
|
"Display routes matching the large-communities\n"
|
||||||
"List of large-community numbers\n"
|
"List of large-community numbers\n"
|
||||||
|
"Exact match of the large-communities\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
char *vrf = NULL;
|
char *vrf = NULL;
|
||||||
afi_t afi = AFI_IP6;
|
afi_t afi = AFI_IP6;
|
||||||
safi_t safi = SAFI_UNICAST;
|
safi_t safi = SAFI_UNICAST;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
bool exact_match = 0;
|
||||||
|
|
||||||
if (argv_find(argv, argc, "ip", &idx))
|
if (argv_find(argv, argc, "ip", &idx))
|
||||||
afi = AFI_IP;
|
afi = AFI_IP;
|
||||||
@ -9935,9 +9966,12 @@ DEFUN (show_ip_bgp_large_community,
|
|||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv_find(argv, argc, "AA:BB:CC", &idx))
|
if (argv_find(argv, argc, "AA:BB:CC", &idx)) {
|
||||||
return bgp_show_lcommunity(vty, bgp, argc, argv, afi, safi, uj);
|
if (argv_find(argv, argc, "exact-match", &idx))
|
||||||
else
|
exact_match = 1;
|
||||||
|
return bgp_show_lcommunity(vty, bgp, argc, argv,
|
||||||
|
exact_match, afi, safi, uj);
|
||||||
|
} else
|
||||||
return bgp_show(vty, bgp, afi, safi,
|
return bgp_show(vty, bgp, afi, safi,
|
||||||
bgp_show_type_lcommunity_all, NULL, uj);
|
bgp_show_type_lcommunity_all, NULL, uj);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,9 @@ enum bgp_show_type {
|
|||||||
bgp_show_type_community_list_exact,
|
bgp_show_type_community_list_exact,
|
||||||
bgp_show_type_lcommunity_all,
|
bgp_show_type_lcommunity_all,
|
||||||
bgp_show_type_lcommunity,
|
bgp_show_type_lcommunity,
|
||||||
|
bgp_show_type_lcommunity_exact,
|
||||||
bgp_show_type_lcommunity_list,
|
bgp_show_type_lcommunity_list,
|
||||||
|
bgp_show_type_lcommunity_list_exact,
|
||||||
bgp_show_type_flap_statistics,
|
bgp_show_type_flap_statistics,
|
||||||
bgp_show_type_flap_neighbor,
|
bgp_show_type_flap_neighbor,
|
||||||
bgp_show_type_dampend_paths,
|
bgp_show_type_dampend_paths,
|
||||||
|
@ -2298,8 +2298,49 @@ attribute.
|
|||||||
match the specified community list. When `exact-match` is specified, it
|
match the specified community list. When `exact-match` is specified, it
|
||||||
displays only routes that have an exact match.
|
displays only routes that have an exact match.
|
||||||
|
|
||||||
|
.. _bgp-display-routes-by-lcommunity:
|
||||||
|
|
||||||
|
Displaying Routes by Large Community Attribute
|
||||||
|
----------------------------------------------
|
||||||
|
|
||||||
|
The following commands allow displaying routes based on their
|
||||||
|
large community attribute.
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
|
||||||
|
|
||||||
|
These commands display BGP routes which have the large community attribute.
|
||||||
|
attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that
|
||||||
|
large community are displayed. When `exact-match` is specified, it display
|
||||||
|
only routes that have an exact match. When `json` is specified, it display
|
||||||
|
routes in json format.
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
|
||||||
|
|
||||||
|
.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
|
||||||
|
.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
|
||||||
|
|
||||||
|
These commands display BGP routes for the address family specified that
|
||||||
|
match the specified large community list. When `exact-match` is specified,
|
||||||
|
it displays only routes that have an exact match. When `json` is specified,
|
||||||
|
it display routes in json format.
|
||||||
|
|
||||||
.. _bgp-display-routes-by-as-path:
|
.. _bgp-display-routes-by-as-path:
|
||||||
|
|
||||||
|
|
||||||
Displaying Routes by AS Path
|
Displaying Routes by AS Path
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user