]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: add definitions for vrf xpaths
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 16 Feb 2021 09:57:30 +0000 (12:57 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 26 Feb 2021 11:42:30 +0000 (14:42 +0300)
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/vrf.c
lib/vrf.h

index 87744ea9543ebc4abeed43314a81916ee8a9b76c..3947e256d308d400952b482dbe1c3560e936cfc4 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -639,8 +639,8 @@ int vrf_handler_create(struct vty *vty, const char *vrfname,
        }
 
        if (vty) {
-               snprintf(xpath_list, sizeof(xpath_list),
-                        "/frr-vrf:lib/vrf[name='%s']", vrfname);
+               snprintf(xpath_list, sizeof(xpath_list), FRR_VRF_KEY_XPATH,
+                        vrfname);
 
                nb_cli_enqueue_change(vty, xpath_list, NB_OP_CREATE, NULL);
                ret = nb_cli_apply_changes(vty, xpath_list);
@@ -774,8 +774,7 @@ DEFUN_YANG (no_vrf,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
-       snprintf(xpath_list, sizeof(xpath_list), "/frr-vrf:lib/vrf[name='%s']",
-                vrfname);
+       snprintf(xpath_list, sizeof(xpath_list), FRR_VRF_KEY_XPATH, vrfname);
 
        nb_cli_enqueue_change(vty, xpath_list, NB_OP_DESTROY, NULL);
        return nb_cli_apply_changes(vty, xpath_list);
index 2d2fbe4fef4f908cd41e03805017b4f767a282fe..21d7f20fbddb4508093893513a3a1f66b0662986 100644 (file)
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -52,6 +52,9 @@ enum { IFLA_VRF_UNSPEC, IFLA_VRF_TABLE, __IFLA_VRF_MAX };
 #define VRF_ALL_CMD_HELP_STR    "Specify the VRF\nAll VRFs\n"
 #define VRF_FULL_CMD_HELP_STR   "Specify the VRF\nThe VRF name\nAll VRFs\n"
 
+#define FRR_VRF_XPATH "/frr-vrf:lib/vrf"
+#define FRR_VRF_KEY_XPATH "/frr-vrf:lib/vrf[name='%s']"
+
 /*
  * Pass some OS specific data up through
  * to the daemons