summaryrefslogtreecommitdiffstats
path: root/lib/command.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-07-06 17:47:44 +0200
committerRenato Westphal <renato@opensourcerouting.org>2020-08-03 20:17:03 +0200
commitca77b518bdc3c03398214e06129690e603090a6f (patch)
tree36e091285109a4f219cd1d785354e64920bc64dd /lib/command.h
parentMerge pull request #6845 from opensourcerouting/foreach-safi-formatting (diff)
downloadfrr-ca77b518bdc3c03398214e06129690e603090a6f.tar.xz
frr-ca77b518bdc3c03398214e06129690e603090a6f.zip
*: introduce DEFPY_YANG & friends
DEFPY_YANG will allow the CLI to identify which commands are YANG-modeled or not before executing them. This is going to be useful for the upcoming configuration back-off timer work that needs to commit pending configuration changes before executing a command that isn't YANG-modeled. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/command.h')
-rw-r--r--lib/command.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/command.h b/lib/command.h
index 1acca9066..a7a2eaf86 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -257,6 +257,12 @@ struct cmd_node {
#define DEFPY_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
DEFPY_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
+#define DEFPY_YANG(funcname, cmdname, cmdstr, helpstr) \
+ DEFPY_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_YANG)
+
+#define DEFPY_YANG_NOSH(funcname, cmdname, cmdstr, helpstr) \
+ DEFPY_YANG(funcname, cmdname, cmdstr, helpstr)
+
#define DEFUN(funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_FUNC_DECL(funcname) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
@@ -270,10 +276,16 @@ struct cmd_node {
#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
+#define DEFUN_YANG(funcname, cmdname, cmdstr, helpstr) \
+ DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_YANG)
+
/* DEFUN_NOSH for commands that vtysh should ignore */
#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \
DEFUN(funcname, cmdname, cmdstr, helpstr)
+#define DEFUN_YANG_NOSH(funcname, cmdname, cmdstr, helpstr) \
+ DEFUN_YANG(funcname, cmdname, cmdstr, helpstr)
+
/* DEFSH for vtysh. */
#define DEFSH(daemon, cmdname, cmdstr, helpstr) \
DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, 0, daemon)
@@ -282,6 +294,9 @@ struct cmd_node {
DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN, \
daemon)
+#define DEFSH_YANG(daemon, cmdname, cmdstr, helpstr) \
+ DEFUN_CMD_ELEMENT(NULL, cmdname, cmdstr, helpstr, CMD_ATTR_YANG, daemon)
+
/* DEFUN + DEFSH */
#define DEFUNSH(daemon, funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_FUNC_DECL(funcname) \
@@ -302,6 +317,9 @@ struct cmd_node {
DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, \
CMD_ATTR_DEPRECATED)
+#define DEFUNSH_YANG(daemon, funcname, cmdname, cmdstr, helpstr) \
+ DEFUNSH_ATTR(daemon, funcname, cmdname, cmdstr, helpstr, CMD_ATTR_YANG)
+
/* ALIAS macro which define existing command's alias. */
#define ALIAS(funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0)
@@ -317,6 +335,9 @@ struct cmd_node {
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, \
CMD_ATTR_DEPRECATED, 0)
+#define ALIAS_YANG(funcname, cmdname, cmdstr, helpstr) \
+ DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_YANG, 0)
+
#define ALIAS_SH(daemon, funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, daemon)