mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 18:44:54 +00:00
zebra: convert resolve-via-default commands to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
1f2b7c1058
commit
2117faf1cf
@ -2808,6 +2808,22 @@ module frr-zebra {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leaf resolve-via-default {
|
||||||
|
type boolean;
|
||||||
|
description
|
||||||
|
"Resolve IPv4 nexthops via the default route. This is true by default
|
||||||
|
for traditional profile and false by default for datacenter profile.
|
||||||
|
Removing the leaf sets it back to the default value for the profile.";
|
||||||
|
}
|
||||||
|
|
||||||
|
leaf ipv6-resolve-via-default {
|
||||||
|
type boolean;
|
||||||
|
description
|
||||||
|
"Resolve IPv4 nexthops via the default route. This is true by default
|
||||||
|
for traditional profile and false by default for datacenter profile.
|
||||||
|
Removing the leaf sets it back to the default value for the profile.";
|
||||||
|
}
|
||||||
|
|
||||||
uses ribs;
|
uses ribs;
|
||||||
|
|
||||||
uses vrf-vni-mapping;
|
uses vrf-vni-mapping;
|
||||||
|
@ -879,6 +879,20 @@ const struct frr_yang_module_info frr_zebra_info = {
|
|||||||
.modify = lib_vrf_zebra_filter_nht_route_map_modify,
|
.modify = lib_vrf_zebra_filter_nht_route_map_modify,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/resolve-via-default",
|
||||||
|
.cbs = {
|
||||||
|
.modify = lib_vrf_zebra_resolve_via_default_modify,
|
||||||
|
.destroy = lib_vrf_zebra_resolve_via_default_destroy,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/ipv6-resolve-via-default",
|
||||||
|
.cbs = {
|
||||||
|
.modify = lib_vrf_zebra_ipv6_resolve_via_default_modify,
|
||||||
|
.destroy = lib_vrf_zebra_ipv6_resolve_via_default_destroy,
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib",
|
.xpath = "/frr-vrf:lib/vrf/frr-zebra:zebra/ribs/rib",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -428,6 +428,11 @@ int lib_vrf_zebra_filter_protocol_route_map_modify(
|
|||||||
int lib_vrf_zebra_filter_nht_create(struct nb_cb_create_args *args);
|
int lib_vrf_zebra_filter_nht_create(struct nb_cb_create_args *args);
|
||||||
int lib_vrf_zebra_filter_nht_destroy(struct nb_cb_destroy_args *args);
|
int lib_vrf_zebra_filter_nht_destroy(struct nb_cb_destroy_args *args);
|
||||||
int lib_vrf_zebra_filter_nht_route_map_modify(struct nb_cb_modify_args *args);
|
int lib_vrf_zebra_filter_nht_route_map_modify(struct nb_cb_modify_args *args);
|
||||||
|
int lib_vrf_zebra_resolve_via_default_modify(struct nb_cb_modify_args *args);
|
||||||
|
int lib_vrf_zebra_resolve_via_default_destroy(struct nb_cb_destroy_args *args);
|
||||||
|
int lib_vrf_zebra_ipv6_resolve_via_default_modify(struct nb_cb_modify_args *args);
|
||||||
|
int lib_vrf_zebra_ipv6_resolve_via_default_destroy(
|
||||||
|
struct nb_cb_destroy_args *args);
|
||||||
const void *lib_vrf_zebra_ribs_rib_get_next(struct nb_cb_get_next_args *args);
|
const void *lib_vrf_zebra_ribs_rib_get_next(struct nb_cb_get_next_args *args);
|
||||||
int lib_vrf_zebra_ribs_rib_get_keys(struct nb_cb_get_keys_args *args);
|
int lib_vrf_zebra_ribs_rib_get_keys(struct nb_cb_get_keys_args *args);
|
||||||
const void *
|
const void *
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "zebra/zebra_ptm.h"
|
#include "zebra/zebra_ptm.h"
|
||||||
#include "zebra/router-id.h"
|
#include "zebra/router-id.h"
|
||||||
#include "zebra/zebra_routemap.h"
|
#include "zebra/zebra_routemap.h"
|
||||||
|
#include "zebra/zebra_rnh.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-zebra:zebra/mcast-rpf-lookup
|
* XPath: /frr-zebra:zebra/mcast-rpf-lookup
|
||||||
@ -3527,6 +3528,108 @@ int lib_vrf_zebra_filter_nht_route_map_modify(struct nb_cb_modify_args *args)
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/resolve-via-default
|
||||||
|
*/
|
||||||
|
int lib_vrf_zebra_resolve_via_default_modify(struct nb_cb_modify_args *args)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
bool resolve_via_default;
|
||||||
|
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
vrf = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
zvrf = vrf->info;
|
||||||
|
|
||||||
|
resolve_via_default = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
if (zvrf->zebra_rnh_ip_default_route == resolve_via_default)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
zvrf->zebra_rnh_ip_default_route = resolve_via_default;
|
||||||
|
|
||||||
|
zebra_evaluate_rnh(zvrf, AFI_IP, 0, NULL, SAFI_UNICAST);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lib_vrf_zebra_resolve_via_default_destroy(struct nb_cb_destroy_args *args)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
bool resolve_via_default;
|
||||||
|
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
vrf = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
zvrf = vrf->info;
|
||||||
|
|
||||||
|
resolve_via_default = DFLT_ZEBRA_IP_NHT_RESOLVE_VIA_DEFAULT;
|
||||||
|
|
||||||
|
if (zvrf->zebra_rnh_ip_default_route == resolve_via_default)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
zvrf->zebra_rnh_ip_default_route = resolve_via_default;
|
||||||
|
|
||||||
|
zebra_evaluate_rnh(zvrf, AFI_IP, 0, NULL, SAFI_UNICAST);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/ipv6-resolve-via-default
|
||||||
|
*/
|
||||||
|
int lib_vrf_zebra_ipv6_resolve_via_default_modify(struct nb_cb_modify_args *args)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
bool resolve_via_default;
|
||||||
|
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
vrf = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
zvrf = vrf->info;
|
||||||
|
|
||||||
|
resolve_via_default = yang_dnode_get_bool(args->dnode, NULL);
|
||||||
|
|
||||||
|
if (zvrf->zebra_rnh_ipv6_default_route == resolve_via_default)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
zvrf->zebra_rnh_ipv6_default_route = resolve_via_default;
|
||||||
|
|
||||||
|
zebra_evaluate_rnh(zvrf, AFI_IP6, 0, NULL, SAFI_UNICAST);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lib_vrf_zebra_ipv6_resolve_via_default_destroy(struct nb_cb_destroy_args *args)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
struct zebra_vrf *zvrf;
|
||||||
|
bool resolve_via_default;
|
||||||
|
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
vrf = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
zvrf = vrf->info;
|
||||||
|
|
||||||
|
resolve_via_default = DFLT_ZEBRA_IP_NHT_RESOLVE_VIA_DEFAULT;
|
||||||
|
|
||||||
|
if (zvrf->zebra_rnh_ipv6_default_route == resolve_via_default)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
zvrf->zebra_rnh_ipv6_default_route = resolve_via_default;
|
||||||
|
|
||||||
|
zebra_evaluate_rnh(zvrf, AFI_IP6, 0, NULL, SAFI_UNICAST);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id
|
* XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id
|
||||||
*/
|
*/
|
||||||
|
@ -1171,18 +1171,14 @@ DEFUN (ip_nht_default_route,
|
|||||||
"Filter Next Hop tracking route resolution\n"
|
"Filter Next Hop tracking route resolution\n"
|
||||||
"Resolve via default route\n")
|
"Resolve via default route\n")
|
||||||
{
|
{
|
||||||
ZEBRA_DECLVAR_CONTEXT_VRF(vrf, zvrf);
|
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/resolve-via-default",
|
||||||
|
NB_OP_MODIFY, "true");
|
||||||
|
|
||||||
if (!zvrf)
|
if (vty->node == CONFIG_NODE)
|
||||||
return CMD_WARNING;
|
return nb_cli_apply_changes(vty, "/frr-vrf:lib/vrf[name='%s']",
|
||||||
|
VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
if (zvrf->zebra_rnh_ip_default_route)
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
return CMD_SUCCESS;
|
|
||||||
|
|
||||||
zvrf->zebra_rnh_ip_default_route = true;
|
|
||||||
|
|
||||||
zebra_evaluate_rnh(zvrf, AFI_IP, 0, NULL, SAFI_UNICAST);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
|
static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
|
||||||
@ -1691,17 +1687,14 @@ DEFUN (no_ip_nht_default_route,
|
|||||||
"Filter Next Hop tracking route resolution\n"
|
"Filter Next Hop tracking route resolution\n"
|
||||||
"Resolve via default route\n")
|
"Resolve via default route\n")
|
||||||
{
|
{
|
||||||
ZEBRA_DECLVAR_CONTEXT_VRF(vrf, zvrf);
|
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/resolve-via-default",
|
||||||
|
NB_OP_MODIFY, "false");
|
||||||
|
|
||||||
if (!zvrf)
|
if (vty->node == CONFIG_NODE)
|
||||||
return CMD_WARNING;
|
return nb_cli_apply_changes(vty, "/frr-vrf:lib/vrf[name='%s']",
|
||||||
|
VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
if (!zvrf->zebra_rnh_ip_default_route)
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
return CMD_SUCCESS;
|
|
||||||
|
|
||||||
zvrf->zebra_rnh_ip_default_route = false;
|
|
||||||
zebra_evaluate_rnh(zvrf, AFI_IP, 0, NULL, SAFI_UNICAST);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (ipv6_nht_default_route,
|
DEFUN (ipv6_nht_default_route,
|
||||||
@ -1711,17 +1704,14 @@ DEFUN (ipv6_nht_default_route,
|
|||||||
"Filter Next Hop tracking route resolution\n"
|
"Filter Next Hop tracking route resolution\n"
|
||||||
"Resolve via default route\n")
|
"Resolve via default route\n")
|
||||||
{
|
{
|
||||||
ZEBRA_DECLVAR_CONTEXT_VRF(vrf, zvrf);
|
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/ipv6-resolve-via-default",
|
||||||
|
NB_OP_MODIFY, "true");
|
||||||
|
|
||||||
if (!zvrf)
|
if (vty->node == CONFIG_NODE)
|
||||||
return CMD_WARNING;
|
return nb_cli_apply_changes(vty, "/frr-vrf:lib/vrf[name='%s']",
|
||||||
|
VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
if (zvrf->zebra_rnh_ipv6_default_route)
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
return CMD_SUCCESS;
|
|
||||||
|
|
||||||
zvrf->zebra_rnh_ipv6_default_route = true;
|
|
||||||
zebra_evaluate_rnh(zvrf, AFI_IP6, 0, NULL, SAFI_UNICAST);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (no_ipv6_nht_default_route,
|
DEFUN (no_ipv6_nht_default_route,
|
||||||
@ -1732,17 +1722,14 @@ DEFUN (no_ipv6_nht_default_route,
|
|||||||
"Filter Next Hop tracking route resolution\n"
|
"Filter Next Hop tracking route resolution\n"
|
||||||
"Resolve via default route\n")
|
"Resolve via default route\n")
|
||||||
{
|
{
|
||||||
ZEBRA_DECLVAR_CONTEXT_VRF(vrf, zvrf);
|
nb_cli_enqueue_change(vty, "./frr-zebra:zebra/ipv6-resolve-via-default",
|
||||||
|
NB_OP_MODIFY, "false");
|
||||||
|
|
||||||
if (!zvrf)
|
if (vty->node == CONFIG_NODE)
|
||||||
return CMD_WARNING;
|
return nb_cli_apply_changes(vty, "/frr-vrf:lib/vrf[name='%s']",
|
||||||
|
VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
if (!zvrf->zebra_rnh_ipv6_default_route)
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
return CMD_SUCCESS;
|
|
||||||
|
|
||||||
zvrf->zebra_rnh_ipv6_default_route = false;
|
|
||||||
zebra_evaluate_rnh(zvrf, AFI_IP6, 0, NULL, SAFI_UNICAST);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY_HIDDEN(rnh_hide_backups, rnh_hide_backups_cmd,
|
DEFPY_HIDDEN(rnh_hide_backups, rnh_hide_backups_cmd,
|
||||||
|
Loading…
Reference in New Issue
Block a user