Merge pull request #18253 from dksharp5/yang_zebra

Allow retrieval of v4/v6 forwarding state via NB
This commit is contained in:
Russ White 2025-03-04 09:25:24 -05:00 committed by GitHub
commit 0b094a772c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 18 deletions

View file

@ -2859,24 +2859,8 @@ module frr-zebra {
"IP forwarding status.";
}
leaf ipv6-forwarding {
type enumeration {
enum unknown {
value -1;
description
"Unknown state.";
}
enum off {
value 0;
description
"IPv6 forwarding disabled.";
}
enum on {
value 1;
description
"IPv6 forwarding enabled.";
}
}
description
type boolean;
description
"IPv6 forwarding status.";
}
leaf workqueue-hold-timer {
@ -2968,6 +2952,16 @@ module frr-zebra {
config false;
description
"Operational data.";
leaf ip-forwarding {
type boolean;
description
"IP forwarding status.";
}
leaf ipv6-forwarding {
type boolean;
description
"IPv6 forwarding status.";
}
}
// End of operational / state container
}

View file

@ -38,6 +38,12 @@ const struct frr_yang_module_info frr_zebra_info = {
.destroy = zebra_ip_forwarding_destroy,
}
},
{
.xpath = "/frr-zebra:zebra/state/ip-forwarding",
.cbs = {
.get_elem = zebra_ip_forwarding_get_elem,
}
},
{
.xpath = "/frr-zebra:zebra/ipv6-forwarding",
.cbs = {
@ -45,6 +51,12 @@ const struct frr_yang_module_info frr_zebra_info = {
.destroy = zebra_ipv6_forwarding_destroy,
}
},
{
.xpath = "/frr-zebra:zebra/state/ipv6-forwarding",
.cbs = {
.get_elem = zebra_ipv6_forwarding_get_elem,
}
},
{
.xpath = "/frr-zebra:zebra/workqueue-hold-timer",
.cbs = {

View file

@ -32,9 +32,11 @@ int get_debugs_rpc(struct nb_cb_rpc_args *args);
int zebra_mcast_rpf_lookup_modify(struct nb_cb_modify_args *args);
int zebra_ip_forwarding_modify(struct nb_cb_modify_args *args);
int zebra_ip_forwarding_destroy(struct nb_cb_destroy_args *args);
struct yang_data *zebra_ip_forwarding_get_elem(struct nb_cb_get_elem_args *args);
int zebra_ipv6_forwarding_modify(struct nb_cb_modify_args *args);
int zebra_ipv6_forwarding_destroy(struct nb_cb_destroy_args *args);
int zebra_workqueue_hold_timer_modify(struct nb_cb_modify_args *args);
struct yang_data *zebra_ipv6_forwarding_get_elem(struct nb_cb_get_elem_args *args);
int zebra_zapi_packets_modify(struct nb_cb_modify_args *args);
int zebra_import_kernel_table_table_id_modify(struct nb_cb_modify_args *args);
int zebra_import_kernel_table_table_id_destroy(struct nb_cb_destroy_args *args);

View file

@ -14,6 +14,7 @@
#include "printfrr.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_vxlan_if.h"
#include "zebra/ipforward.h"
/*
* XPath: /frr-interface:lib/interface/frr-zebra:zebra/state/up-count
@ -1169,3 +1170,22 @@ struct yang_data *zebra_max_multipath_get_elem(struct nb_cb_get_elem_args *args)
{
return yang_data_new_uint16(args->xpath, zrouter.multipath_num);
}
/*
* XPath:
* /frr-zebra:zebra/ip_forwarding
*/
struct yang_data *zebra_ip_forwarding_get_elem(struct nb_cb_get_elem_args *args)
{
return yang_data_new_bool(args->xpath, ipforward());
}
/*
* XPath:
* /frr-zebra:zebra/ipv6_forwarding
*/
struct yang_data *zebra_ipv6_forwarding_get_elem(struct nb_cb_get_elem_args *args)
{
return yang_data_new_bool(args->xpath, ipforward_ipv6());
}