summaryrefslogtreecommitdiff
path: root/ripd/rip_cli.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-05-09 01:35:00 -0300
committerRenato Westphal <renato@opensourcerouting.org>2018-10-27 16:16:12 -0200
commit3d7a1be850dbf7350fa217e7eb33967bf15351e9 (patch)
tree857da554ed85c1145a27ecaf5cade1c6ec3abdd4 /ripd/rip_cli.c
parentf0ab22fb70ef94ce4f3109d36744d730003e9876 (diff)
ripd: retrofit the 'network' command to the new northbound model
The frr-ripd YANG module models the ripd "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 'ripd/rip_cli.c')
-rw-r--r--ripd/rip_cli.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index 1d94d02bd7..a22f3054a6 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -331,6 +331,60 @@ void cli_show_rip_neighbor(struct vty *vty, struct lyd_node *dnode,
vty_out(vty, " neighbor %s\n", yang_dnode_get_string(dnode, NULL));
}
+/*
+ * XPath: /frr-ripd:ripd/instance/network
+ */
+DEFPY (rip_network_prefix,
+ rip_network_prefix_cmd,
+ "[no] network A.B.C.D/M",
+ NO_STR
+ "Enable routing on an IP network\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
+{
+ struct cli_config_change changes[] = {
+ {
+ .xpath = "./network",
+ .operation = no ? NB_OP_DELETE : NB_OP_CREATE,
+ .value = network_str,
+ },
+ };
+
+ return nb_cli_cfg_change(vty, NULL, changes, array_size(changes));
+}
+
+void cli_show_rip_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-ripd:ripd/instance/interface
+ */
+DEFPY (rip_network_if,
+ rip_network_if_cmd,
+ "[no] network WORD",
+ NO_STR
+ "Enable routing on an IP network\n"
+ "Interface name\n")
+{
+ struct cli_config_change changes[] = {
+ {
+ .xpath = "./interface",
+ .operation = no ? NB_OP_DELETE : NB_OP_CREATE,
+ .value = network,
+ },
+ };
+
+ return nb_cli_cfg_change(vty, NULL, changes, array_size(changes));
+}
+
+void cli_show_rip_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 rip_cli_init(void)
{
install_element(CONFIG_NODE, &router_rip_cmd);
@@ -345,4 +399,6 @@ void rip_cli_init(void)
install_element(RIP_NODE, &rip_distance_source_cmd);
install_element(RIP_NODE, &no_rip_distance_source_cmd);
install_element(RIP_NODE, &rip_neighbor_cmd);
+ install_element(RIP_NODE, &rip_network_prefix_cmd);
+ install_element(RIP_NODE, &rip_network_if_cmd);
}