diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2018-05-09 06:34:59 +0200 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2018-10-27 20:16:12 +0200 |
commit | 282ae30c4ae3aac7205b456efefbf4b374841a1b (patch) | |
tree | ad3e915af3bd7c0f1575ec3ed1b9e70a3e63fcb1 /ripd/rip_cli.c | |
parent | ripd: retrofit the 'default-information' command to the new northbound model (diff) | |
download | frr-282ae30c4ae3aac7205b456efefbf4b374841a1b.tar.xz frr-282ae30c4ae3aac7205b456efefbf4b374841a1b.zip |
ripd: retrofit the 'default-metric' command to the new northbound model
Trivial conversion.
rip->default_metric was converted to an uint8_t to match the way it's
defined in the YANG module.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripd/rip_cli.c')
-rw-r--r-- | ripd/rip_cli.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 9193c089a..d374ea64f 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -145,6 +145,51 @@ void cli_show_rip_default_information_originate(struct vty *vty, vty_out(vty, " default-information originate\n"); } +/* + * XPath: /frr-ripd:ripd/instance/default-metric + */ +DEFPY (rip_default_metric, + rip_default_metric_cmd, + "default-metric (1-16)", + "Set a metric of redistribute routes\n" + "Default metric\n") +{ + struct cli_config_change changes[] = { + { + .xpath = "./default-metric", + .operation = NB_OP_MODIFY, + .value = default_metric_str, + }, + }; + + return nb_cli_cfg_change(vty, NULL, changes, array_size(changes)); +} + +DEFPY (no_rip_default_metric, + no_rip_default_metric_cmd, + "no default-metric [(1-16)]", + NO_STR + "Set a metric of redistribute routes\n" + "Default metric\n") +{ + struct cli_config_change changes[] = { + { + .xpath = "./default-metric", + .operation = NB_OP_MODIFY, + .value = NULL, + }, + }; + + return nb_cli_cfg_change(vty, NULL, changes, array_size(changes)); +} + +void cli_show_rip_default_metric(struct vty *vty, struct lyd_node *dnode, + bool show_defaults) +{ + vty_out(vty, " default-metric %s\n", + yang_dnode_get_string(dnode, NULL)); +} + void rip_cli_init(void) { install_element(CONFIG_NODE, &router_rip_cmd); @@ -152,4 +197,6 @@ void rip_cli_init(void) install_element(RIP_NODE, &rip_allow_ecmp_cmd); install_element(RIP_NODE, &rip_default_information_originate_cmd); + install_element(RIP_NODE, &rip_default_metric_cmd); + install_element(RIP_NODE, &no_rip_default_metric_cmd); } |