summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-02-16 10:57:30 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2021-02-22 16:53:24 +0100
commit09b150ef2a20948947981fedcc86c82fcfa51a75 (patch)
tree8920894979b4987c94fe45fdc58ce5c0d8a6fe16 /lib
parentbgpd: don't rely on northbound control plane protocol vrf pointer (diff)
downloadfrr-09b150ef2a20948947981fedcc86c82fcfa51a75.tar.xz
frr-09b150ef2a20948947981fedcc86c82fcfa51a75.zip
lib: add definitions for vrf xpaths
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/vrf.c7
-rw-r--r--lib/vrf.h3
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/vrf.c b/lib/vrf.c
index 136938783..0a91f4bc8 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -686,8 +686,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);
@@ -821,8 +821,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);
diff --git a/lib/vrf.h b/lib/vrf.h
index 32e6fb428..333d68ce9 100644
--- 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