summaryrefslogtreecommitdiff
path: root/ripngd/ripng_cli.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-29 01:45:02 -0200
committerRenato Westphal <renato@opensourcerouting.org>2018-12-03 13:47:58 -0200
commitcc48702b20fa8a6d69e52c1770a741b755828a02 (patch)
tree11561d29d4ddad562581e93c9b7c7f3061c8b63c /ripngd/ripng_cli.c
parentad8778c05e7f26790488bdaf583a92ea9de54afa (diff)
ripngd: retrofit the 'network' command to the new northbound model
The frr-ripngd YANG module models the ripngd "network" command using two separate leaf-lists for simplicity: one leaf-list for interfaces and another leaf-list for actual networks. In the 'cli_show' callbacks, display the "network" command for entries of both leaf-lists. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripngd/ripng_cli.c')
-rw-r--r--ripngd/ripng_cli.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c
index 5a1c9bdca2..53ff3fd061 100644
--- a/ripngd/ripng_cli.c
+++ b/ripngd/ripng_cli.c
@@ -159,6 +159,50 @@ void cli_show_ripng_default_metric(struct vty *vty, struct lyd_node *dnode,
yang_dnode_get_string(dnode, NULL));
}
+/*
+ * XPath: /frr-ripngd:ripngd/instance/network
+ */
+DEFPY (ripng_network_prefix,
+ ripng_network_prefix_cmd,
+ "[no] network X:X::X:X/M",
+ NO_STR
+ "RIPng enable on specified interface or network.\n"
+ "IPv6 network\n")
+{
+ nb_cli_enqueue_change(vty, "./network",
+ no ? NB_OP_DELETE : NB_OP_CREATE, network_str);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ripng_network_prefix(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, " network %s\n", yang_dnode_get_string(dnode, NULL));
+}
+
+/*
+ * XPath: /frr-ripngd:ripngd/instance/interface
+ */
+DEFPY (ripng_network_if,
+ ripng_network_if_cmd,
+ "[no] network WORD",
+ NO_STR
+ "RIPng enable on specified interface or network.\n"
+ "Interface name\n")
+{
+ nb_cli_enqueue_change(vty, "./interface",
+ no ? NB_OP_DELETE : NB_OP_CREATE, network);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ripng_network_interface(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, " network %s\n", yang_dnode_get_string(dnode, NULL));
+}
+
void ripng_cli_init(void)
{
install_element(CONFIG_NODE, &router_ripng_cmd);
@@ -168,4 +212,6 @@ void ripng_cli_init(void)
install_element(RIPNG_NODE, &ripng_default_information_originate_cmd);
install_element(RIPNG_NODE, &ripng_default_metric_cmd);
install_element(RIPNG_NODE, &no_ripng_default_metric_cmd);
+ install_element(RIPNG_NODE, &ripng_network_prefix_cmd);
+ install_element(RIPNG_NODE, &ripng_network_if_cmd);
}