]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: allow retrieval of ip forwarding state
authorDonna Sharp <dksharp5@gmail.com>
Mon, 24 Feb 2025 21:04:56 +0000 (16:04 -0500)
committerDonna Sharp <dksharp5@gmail.com>
Sat, 1 Mar 2025 19:39:07 +0000 (14:39 -0500)
There was no ability to retrieve the ip-forwarding state
of zebra.  Add this to yang under the state container.

Signed-off-by: Donna Sharp <dksharp5@gmail.com>
yang/frr-zebra.yang
zebra/zebra_nb.c
zebra/zebra_nb.h
zebra/zebra_nb_state.c

index 5f1b711b97307ed79e786f29a6922d3628dc7916..3e005c2d3562fe89a9137c773eb015c66c42f7b4 100644 (file)
@@ -2968,6 +2968,11 @@ module frr-zebra {
       config false;
       description
         "Operational data.";
+      leaf ip-forwarding {
+        type boolean;
+        description
+          "IP forwarding status.";
+      }
     }
     // End of operational / state container
   }
index 81fe2ab6a076a56f4834d03aa450d626d3628021..83d89fa7b79e250d654a8ddb11f2b0b68a4645b7 100644 (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 = {
index 426ad4b7de1dd6a1c11dbd243b28ced72fd3f57f..f742d2474732ce986f7ff32217493a89d5d0d497 100644 (file)
@@ -32,6 +32,7 @@ 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);
index a7091821b549c5a6a730084a54f49754e0193456..9b9991c182eafb277743b35c76fa75f69e43aa54 100644 (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
@@ -1166,3 +1167,12 @@ 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());
+}