forked from Mirror/frr
bgpd: Move some non BGP-specific route-map functions to lib
They are managed under `frr-route-map`, not under `frr-bgp-route-map`.
Fixes: https://github.com/FRRouting/frr/issues/17055
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit b9a9be492e
)
This commit is contained in:
parent
235ee0c88c
commit
3be4912e00
|
@ -7232,43 +7232,6 @@ DEFUN_YANG (no_set_aggregator_as,
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN_YANG (match_ipv6_next_hop,
|
|
||||||
match_ipv6_next_hop_cmd,
|
|
||||||
"match ipv6 next-hop ACCESSLIST6_NAME",
|
|
||||||
MATCH_STR
|
|
||||||
IPV6_STR
|
|
||||||
"Match IPv6 next-hop address of route\n"
|
|
||||||
"IPv6 access-list name\n")
|
|
||||||
{
|
|
||||||
const char *xpath =
|
|
||||||
"./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
|
|
||||||
char xpath_value[XPATH_MAXLEN];
|
|
||||||
|
|
||||||
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
|
|
||||||
snprintf(xpath_value, sizeof(xpath_value),
|
|
||||||
"%s/rmap-match-condition/list-name", xpath);
|
|
||||||
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
|
|
||||||
argv[argc - 1]->arg);
|
|
||||||
|
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN_YANG (no_match_ipv6_next_hop,
|
|
||||||
no_match_ipv6_next_hop_cmd,
|
|
||||||
"no match ipv6 next-hop [ACCESSLIST6_NAME]",
|
|
||||||
NO_STR
|
|
||||||
MATCH_STR
|
|
||||||
IPV6_STR
|
|
||||||
"Match IPv6 next-hop address of route\n"
|
|
||||||
"IPv6 access-list name\n")
|
|
||||||
{
|
|
||||||
const char *xpath =
|
|
||||||
"./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
|
|
||||||
|
|
||||||
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
|
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN_YANG (match_ipv6_next_hop_address,
|
DEFUN_YANG (match_ipv6_next_hop_address,
|
||||||
match_ipv6_next_hop_address_cmd,
|
match_ipv6_next_hop_address_cmd,
|
||||||
"match ipv6 next-hop address X:X::X:X",
|
"match ipv6 next-hop address X:X::X:X",
|
||||||
|
@ -7326,45 +7289,6 @@ ALIAS_HIDDEN (no_match_ipv6_next_hop_address,
|
||||||
"Match IPv6 next-hop address of route\n"
|
"Match IPv6 next-hop address of route\n"
|
||||||
"IPv6 address of next hop\n")
|
"IPv6 address of next hop\n")
|
||||||
|
|
||||||
DEFUN_YANG (match_ipv6_next_hop_prefix_list,
|
|
||||||
match_ipv6_next_hop_prefix_list_cmd,
|
|
||||||
"match ipv6 next-hop prefix-list PREFIXLIST_NAME",
|
|
||||||
MATCH_STR
|
|
||||||
IPV6_STR
|
|
||||||
"Match IPv6 next-hop address of route\n"
|
|
||||||
"Match entries by prefix-list\n"
|
|
||||||
"IPv6 prefix-list name\n")
|
|
||||||
{
|
|
||||||
const char *xpath =
|
|
||||||
"./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
|
|
||||||
char xpath_value[XPATH_MAXLEN];
|
|
||||||
|
|
||||||
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
|
|
||||||
snprintf(xpath_value, sizeof(xpath_value),
|
|
||||||
"%s/rmap-match-condition/list-name", xpath);
|
|
||||||
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
|
|
||||||
argv[argc - 1]->arg);
|
|
||||||
|
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN_YANG (no_match_ipv6_next_hop_prefix_list,
|
|
||||||
no_match_ipv6_next_hop_prefix_list_cmd,
|
|
||||||
"no match ipv6 next-hop prefix-list [PREFIXLIST_NAME]",
|
|
||||||
NO_STR
|
|
||||||
MATCH_STR
|
|
||||||
IPV6_STR
|
|
||||||
"Match IPv6 next-hop address of route\n"
|
|
||||||
"Match entries by prefix-list\n"
|
|
||||||
"IPv6 prefix-list name\n")
|
|
||||||
{
|
|
||||||
const char *xpath =
|
|
||||||
"./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
|
|
||||||
|
|
||||||
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
|
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFPY_YANG (match_ipv4_next_hop,
|
DEFPY_YANG (match_ipv4_next_hop,
|
||||||
match_ipv4_next_hop_cmd,
|
match_ipv4_next_hop_cmd,
|
||||||
"match ip next-hop address A.B.C.D",
|
"match ip next-hop address A.B.C.D",
|
||||||
|
@ -8037,12 +7961,8 @@ void bgp_route_map_init(void)
|
||||||
route_map_install_set(&route_set_ipv6_nexthop_peer_cmd);
|
route_map_install_set(&route_set_ipv6_nexthop_peer_cmd);
|
||||||
route_map_install_match(&route_match_rpki_extcommunity_cmd);
|
route_map_install_match(&route_match_rpki_extcommunity_cmd);
|
||||||
|
|
||||||
install_element(RMAP_NODE, &match_ipv6_next_hop_cmd);
|
|
||||||
install_element(RMAP_NODE, &match_ipv6_next_hop_address_cmd);
|
install_element(RMAP_NODE, &match_ipv6_next_hop_address_cmd);
|
||||||
install_element(RMAP_NODE, &match_ipv6_next_hop_prefix_list_cmd);
|
|
||||||
install_element(RMAP_NODE, &no_match_ipv6_next_hop_cmd);
|
|
||||||
install_element(RMAP_NODE, &no_match_ipv6_next_hop_address_cmd);
|
install_element(RMAP_NODE, &no_match_ipv6_next_hop_address_cmd);
|
||||||
install_element(RMAP_NODE, &no_match_ipv6_next_hop_prefix_list_cmd);
|
|
||||||
install_element(RMAP_NODE, &match_ipv6_next_hop_old_cmd);
|
install_element(RMAP_NODE, &match_ipv6_next_hop_old_cmd);
|
||||||
install_element(RMAP_NODE, &no_match_ipv6_next_hop_old_cmd);
|
install_element(RMAP_NODE, &no_match_ipv6_next_hop_old_cmd);
|
||||||
install_element(RMAP_NODE, &match_ipv4_next_hop_cmd);
|
install_element(RMAP_NODE, &match_ipv4_next_hop_cmd);
|
||||||
|
|
|
@ -417,6 +417,74 @@ DEFPY_YANG(
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN_YANG (match_ipv6_next_hop,
|
||||||
|
match_ipv6_next_hop_cmd,
|
||||||
|
"match ipv6 next-hop ACCESSLIST6_NAME",
|
||||||
|
MATCH_STR
|
||||||
|
IPV6_STR
|
||||||
|
"Match IPv6 next-hop address of route\n"
|
||||||
|
"IPv6 access-list name\n")
|
||||||
|
{
|
||||||
|
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
|
||||||
|
char xpath_value[XPATH_MAXLEN];
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
|
||||||
|
snprintf(xpath_value, sizeof(xpath_value), "%s/rmap-match-condition/list-name", xpath);
|
||||||
|
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, argv[argc - 1]->arg);
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN_YANG (no_match_ipv6_next_hop,
|
||||||
|
no_match_ipv6_next_hop_cmd,
|
||||||
|
"no match ipv6 next-hop [ACCESSLIST6_NAME]",
|
||||||
|
NO_STR
|
||||||
|
MATCH_STR
|
||||||
|
IPV6_STR
|
||||||
|
"Match IPv6 next-hop address of route\n"
|
||||||
|
"IPv6 access-list name\n")
|
||||||
|
{
|
||||||
|
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN_YANG (match_ipv6_next_hop_prefix_list,
|
||||||
|
match_ipv6_next_hop_prefix_list_cmd,
|
||||||
|
"match ipv6 next-hop prefix-list PREFIXLIST_NAME",
|
||||||
|
MATCH_STR
|
||||||
|
IPV6_STR
|
||||||
|
"Match IPv6 next-hop address of route\n"
|
||||||
|
"Match entries by prefix-list\n"
|
||||||
|
"IPv6 prefix-list name\n")
|
||||||
|
{
|
||||||
|
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
|
||||||
|
char xpath_value[XPATH_MAXLEN];
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
|
||||||
|
snprintf(xpath_value, sizeof(xpath_value), "%s/rmap-match-condition/list-name", xpath);
|
||||||
|
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, argv[argc - 1]->arg);
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN_YANG (no_match_ipv6_next_hop_prefix_list,
|
||||||
|
no_match_ipv6_next_hop_prefix_list_cmd,
|
||||||
|
"no match ipv6 next-hop prefix-list [PREFIXLIST_NAME]",
|
||||||
|
NO_STR
|
||||||
|
MATCH_STR
|
||||||
|
IPV6_STR
|
||||||
|
"Match IPv6 next-hop address of route\n"
|
||||||
|
"Match entries by prefix-list\n"
|
||||||
|
"IPv6 prefix-list name\n")
|
||||||
|
{
|
||||||
|
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
DEFPY_YANG(
|
DEFPY_YANG(
|
||||||
match_ipv6_next_hop_type, match_ipv6_next_hop_type_cmd,
|
match_ipv6_next_hop_type, match_ipv6_next_hop_type_cmd,
|
||||||
"match ipv6 next-hop type <blackhole>$type",
|
"match ipv6 next-hop type <blackhole>$type",
|
||||||
|
@ -1665,6 +1733,11 @@ void route_map_cli_init(void)
|
||||||
install_element(RMAP_NODE, &match_ipv6_next_hop_type_cmd);
|
install_element(RMAP_NODE, &match_ipv6_next_hop_type_cmd);
|
||||||
install_element(RMAP_NODE, &no_match_ipv6_next_hop_type_cmd);
|
install_element(RMAP_NODE, &no_match_ipv6_next_hop_type_cmd);
|
||||||
|
|
||||||
|
install_element(RMAP_NODE, &match_ipv6_next_hop_cmd);
|
||||||
|
install_element(RMAP_NODE, &match_ipv6_next_hop_prefix_list_cmd);
|
||||||
|
install_element(RMAP_NODE, &no_match_ipv6_next_hop_cmd);
|
||||||
|
install_element(RMAP_NODE, &no_match_ipv6_next_hop_prefix_list_cmd);
|
||||||
|
|
||||||
install_element(RMAP_NODE, &match_metric_cmd);
|
install_element(RMAP_NODE, &match_metric_cmd);
|
||||||
install_element(RMAP_NODE, &no_match_metric_cmd);
|
install_element(RMAP_NODE, &no_match_metric_cmd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue