diff options
Diffstat (limited to 'ripd/rip_cli.c')
| -rw-r--r-- | ripd/rip_cli.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index ac9fc4b1a8..6f45bb5d9e 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -85,14 +85,33 @@ void cli_show_router_rip(struct vty *vty, const struct lyd_node *dnode, /* * XPath: /frr-ripd:ripd/instance/allow-ecmp */ -DEFPY_YANG (rip_allow_ecmp, +DEFUN_YANG (rip_allow_ecmp, rip_allow_ecmp_cmd, - "[no] allow-ecmp", + "allow-ecmp [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", + "Allow Equal Cost MultiPath\n" + "Number of paths\n") +{ + int idx_number = 1; + char mpaths[3] = {}; + uint32_t paths = MULTIPATH_NUM; + + if (argv[idx_number]) + paths = strtol(argv[idx_number]->arg, NULL, 10); + snprintf(mpaths, sizeof(mpaths), "%u", paths); + + nb_cli_enqueue_change(vty, "./allow-ecmp", NB_OP_MODIFY, mpaths); + + return nb_cli_apply_changes(vty, NULL); +} + +DEFUN_YANG (no_rip_allow_ecmp, + no_rip_allow_ecmp_cmd, + "no allow-ecmp [" CMD_RANGE_STR(1, MULTIPATH_NUM) "]", NO_STR - "Allow Equal Cost MultiPath\n") + "Allow Equal Cost MultiPath\n" + "Number of paths\n") { - nb_cli_enqueue_change(vty, "./allow-ecmp", NB_OP_MODIFY, - no ? "false" : "true"); + nb_cli_enqueue_change(vty, "./allow-ecmp", NB_OP_MODIFY, 0); return nb_cli_apply_changes(vty, NULL); } @@ -100,10 +119,14 @@ DEFPY_YANG (rip_allow_ecmp, void cli_show_rip_allow_ecmp(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { - if (!yang_dnode_get_bool(dnode, NULL)) - vty_out(vty, " no"); + uint8_t paths; + + paths = yang_dnode_get_uint8(dnode, NULL); - vty_out(vty, " allow-ecmp\n"); + if (!paths) + vty_out(vty, " no allow-ecmp\n"); + else + vty_out(vty, " allow-ecmp %d\n", paths); } /* @@ -1156,6 +1179,7 @@ void rip_cli_init(void) install_element(RIP_NODE, &rip_no_distribute_list_cmd); install_element(RIP_NODE, &rip_allow_ecmp_cmd); + install_element(RIP_NODE, &no_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); |
