]> git.proxmox.com Git - mirror_frr.git/blame - ripngd/ripng_cli.c
ripngd: retrofit the 'allow-ecmp' command to the new northbound model
[mirror_frr.git] / ripngd / ripng_cli.c
CommitLineData
e9ce224b
RW
1/*
2 * Copyright (C) 1998 Kunihiro Ishiguro
3 * Copyright (C) 2018 NetDEF, Inc.
4 * Renato Westphal
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <zebra.h>
22
23#include "if.h"
24#include "vrf.h"
25#include "log.h"
26#include "prefix.h"
27#include "command.h"
28#include "northbound_cli.h"
29#include "libfrr.h"
30
31#include "ripngd/ripngd.h"
32#include "ripngd/ripng_cli.h"
33#ifndef VTYSH_EXTRACT_PL
34#include "ripngd/ripng_cli_clippy.c"
35#endif
36
9a12e9e5
RW
37/*
38 * XPath: /frr-ripngd:ripngd/instance
39 */
40DEFPY_NOSH (router_ripng,
41 router_ripng_cmd,
42 "router ripng",
43 "Enable a routing process\n"
44 "Make RIPng instance command\n")
45{
46 int ret;
47
48 nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_CREATE,
49 NULL);
50
51 ret = nb_cli_apply_changes(vty, NULL);
52 if (ret == CMD_SUCCESS)
53 VTY_PUSH_XPATH(RIPNG_NODE, "/frr-ripngd:ripngd/instance");
54
55 return ret;
56}
57
58DEFPY (no_router_ripng,
59 no_router_ripng_cmd,
60 "no router ripng",
61 NO_STR
62 "Enable a routing process\n"
63 "Make RIPng instance command\n")
64{
65 nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_DELETE,
66 NULL);
67
68 return nb_cli_apply_changes(vty, NULL);
69}
70
71void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode,
72 bool show_defaults)
73{
74 vty_out(vty, "!\n");
75 vty_out(vty, "router ripng\n");
76}
77
1e42a07c
RW
78/*
79 * XPath: /frr-ripngd:ripngd/instance/allow-ecmp
80 */
81DEFPY (ripng_allow_ecmp,
82 ripng_allow_ecmp_cmd,
83 "[no] allow-ecmp",
84 NO_STR
85 "Allow Equal Cost MultiPath\n")
86{
87 nb_cli_enqueue_change(vty, "./allow-ecmp", NB_OP_MODIFY,
88 no ? "false" : "true");
89
90 return nb_cli_apply_changes(vty, NULL);
91}
92
93void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
94 bool show_defaults)
95{
96 if (!yang_dnode_get_bool(dnode, NULL))
97 vty_out(vty, " no");
98
99 vty_out(vty, " allow-ecmp\n");
100}
101
e9ce224b
RW
102void ripng_cli_init(void)
103{
9a12e9e5
RW
104 install_element(CONFIG_NODE, &router_ripng_cmd);
105 install_element(CONFIG_NODE, &no_router_ripng_cmd);
1e42a07c
RW
106
107 install_element(RIPNG_NODE, &ripng_allow_ecmp_cmd);
e9ce224b 108}