summaryrefslogtreecommitdiffstats
path: root/ripngd/ripng_cli.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-29 03:49:49 +0100
committerRenato Westphal <renato@opensourcerouting.org>2018-12-03 16:47:58 +0100
commit9a12e9e5edb4f119cd794f347581ae3a950f2c15 (patch)
treec7f26c73fd4c52e444a7c2dc1b032cd7c099544c /ripngd/ripng_cli.c
parentyang, ripngd: add 'frr-ripngd.yang' and associated stub callbacks (diff)
downloadfrr-9a12e9e5edb4f119cd794f347581ae3a950f2c15.tar.xz
frr-9a12e9e5edb4f119cd794f347581ae3a950f2c15.zip
ripngd: retrofit the 'router ripng' command to the new northbound model
* Implement the northbound callbacks associated to the '/frr-ripngd:ripngd/instance' YANG path (the code is mostly a copy and paste from the original "router ripng" DEFUNs); * Move ripng_make_socket() out of ripng_create() since creating a socket is an error-prone operation and thus needs to be performed separately during the NB_EV_PREPARE phase; * On ripng_create(), fetch the defaults from the frr-ripngd YANG model; * Convert the "[no] router ripng" CLI commands to be dumb wrappers around the northbound callbacks; * On ripng_config_write(), write logic to call all 'cli_show' northbound callbacks defined under the '/frr-ripngd:ripngd/instance' YANG path. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripngd/ripng_cli.c')
-rw-r--r--ripngd/ripng_cli.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c
index b033a39ac..7bdc74220 100644
--- a/ripngd/ripng_cli.c
+++ b/ripngd/ripng_cli.c
@@ -34,6 +34,49 @@
#include "ripngd/ripng_cli_clippy.c"
#endif
+/*
+ * XPath: /frr-ripngd:ripngd/instance
+ */
+DEFPY_NOSH (router_ripng,
+ router_ripng_cmd,
+ "router ripng",
+ "Enable a routing process\n"
+ "Make RIPng instance command\n")
+{
+ int ret;
+
+ nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_CREATE,
+ NULL);
+
+ ret = nb_cli_apply_changes(vty, NULL);
+ if (ret == CMD_SUCCESS)
+ VTY_PUSH_XPATH(RIPNG_NODE, "/frr-ripngd:ripngd/instance");
+
+ return ret;
+}
+
+DEFPY (no_router_ripng,
+ no_router_ripng_cmd,
+ "no router ripng",
+ NO_STR
+ "Enable a routing process\n"
+ "Make RIPng instance command\n")
+{
+ nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_DELETE,
+ NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, "!\n");
+ vty_out(vty, "router ripng\n");
+}
+
void ripng_cli_init(void)
{
+ install_element(CONFIG_NODE, &router_ripng_cmd);
+ install_element(CONFIG_NODE, &no_router_ripng_cmd);
}