summaryrefslogtreecommitdiff
path: root/ripd/rip_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'ripd/rip_cli.c')
-rw-r--r--ripd/rip_cli.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index a22f3054a6..10db5d967e 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -385,6 +385,86 @@ void cli_show_rip_network_interface(struct vty *vty, struct lyd_node *dnode,
vty_out(vty, " network %s\n", yang_dnode_get_string(dnode, NULL));
}
+/*
+ * XPath: /frr-ripd:ripd/instance/offset-list
+ */
+DEFPY (rip_offset_list,
+ rip_offset_list_cmd,
+ "offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]",
+ "Modify RIP metric\n"
+ "Access-list name\n"
+ "For incoming updates\n"
+ "For outgoing updates\n"
+ "Metric value\n"
+ "Interface to match\n")
+{
+ char xpath_list[XPATH_MAXLEN];
+ struct cli_config_change changes[] = {
+ {
+ .xpath = ".",
+ .operation = NB_OP_CREATE,
+ },
+ {
+ .xpath = "./access-list",
+ .operation = NB_OP_MODIFY,
+ .value = acl,
+ },
+ {
+ .xpath = "./metric",
+ .operation = NB_OP_MODIFY,
+ .value = metric_str,
+ },
+ };
+
+ snprintf(xpath_list, sizeof(xpath_list),
+ "./offset-list[interface='%s'][direction='%s']",
+ ifname ? ifname : "*", direction);
+
+ return nb_cli_cfg_change(vty, xpath_list, changes, array_size(changes));
+}
+
+DEFPY (no_rip_offset_list,
+ no_rip_offset_list_cmd,
+ "no offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]",
+ NO_STR
+ "Modify RIP metric\n"
+ "Access-list name\n"
+ "For incoming updates\n"
+ "For outgoing updates\n"
+ "Metric value\n"
+ "Interface to match\n")
+{
+ char xpath_list[XPATH_MAXLEN];
+ struct cli_config_change changes[] = {
+ {
+ .xpath = ".",
+ .operation = NB_OP_DELETE,
+ },
+ };
+
+ snprintf(xpath_list, sizeof(xpath_list),
+ "./offset-list[interface='%s'][direction='%s']",
+ ifname ? ifname : "*", direction);
+
+ return nb_cli_cfg_change(vty, xpath_list, changes, array_size(changes));
+}
+
+void cli_show_rip_offset_list(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ const char *interface;
+
+ interface = yang_dnode_get_string(dnode, "./interface");
+
+ vty_out(vty, " offset-list %s %s %s",
+ yang_dnode_get_string(dnode, "./access-list"),
+ yang_dnode_get_string(dnode, "./direction"),
+ yang_dnode_get_string(dnode, "./metric"));
+ if (!strmatch(interface, "*"))
+ vty_out(vty, " %s", interface);
+ vty_out(vty, "\n");
+}
+
void rip_cli_init(void)
{
install_element(CONFIG_NODE, &router_rip_cmd);
@@ -401,4 +481,6 @@ void rip_cli_init(void)
install_element(RIP_NODE, &rip_neighbor_cmd);
install_element(RIP_NODE, &rip_network_prefix_cmd);
install_element(RIP_NODE, &rip_network_if_cmd);
+ install_element(RIP_NODE, &rip_offset_list_cmd);
+ install_element(RIP_NODE, &no_rip_offset_list_cmd);
}