summaryrefslogtreecommitdiff
path: root/lib/vrf.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-27 19:38:06 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-28 23:28:40 +0200
commit741d1d009042222c59b71db27ead08387cbe8cb0 (patch)
tree24f8eca32cb1a8fe3df73548c225ea72a30e79a3 /lib/vrf.c
parentd6bd4fca97966f0ec52aaa8fef2f01475e8214b0 (diff)
zebra: convert vrf configuration output to NB
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/vrf.c')
-rw-r--r--lib/vrf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index 48071f2bd6..65721445ab 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -956,6 +956,25 @@ static int lib_vrf_destroy(struct nb_cb_destroy_args *args)
return NB_OK;
}
+static void lib_vrf_cli_write(struct vty *vty, const struct lyd_node *dnode,
+ bool show_defaults)
+{
+ const char *name = yang_dnode_get_string(dnode, "name");
+
+ if (strcmp(name, VRF_DEFAULT_NAME)) {
+ vty_out(vty, "!\n");
+ vty_out(vty, "vrf %s\n", name);
+ }
+}
+
+static void lib_vrf_cli_write_end(struct vty *vty, const struct lyd_node *dnode)
+{
+ const char *name = yang_dnode_get_string(dnode, "name");
+
+ if (strcmp(name, VRF_DEFAULT_NAME))
+ vty_out(vty, "exit-vrf\n");
+}
+
static const void *lib_vrf_get_next(struct nb_cb_get_next_args *args)
{
struct vrf *vrfp = (struct vrf *)args->list_entry;
@@ -1035,6 +1054,8 @@ const struct frr_yang_module_info frr_vrf_info = {
.cbs = {
.create = lib_vrf_create,
.destroy = lib_vrf_destroy,
+ .cli_show = lib_vrf_cli_write,
+ .cli_show_end = lib_vrf_cli_write_end,
.get_next = lib_vrf_get_next,
.get_keys = lib_vrf_get_keys,
.lookup_entry = lib_vrf_lookup_entry,