2 * Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
3 * Copyright (C) 2018 NetDEF, Inc.
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)
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
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
28 #include "northbound_cli.h"
31 #include "ripd/ripd.h"
32 #include "ripd/rip_nb.h"
33 #ifndef VTYSH_EXTRACT_PL
34 #include "ripd/rip_cli_clippy.c"
38 * XPath: /frr-ripd:ripd/instance
40 DEFPY_NOSH (router_rip
,
42 "router rip [vrf NAME]",
43 "Enable a routing process\n"
44 "Routing Information Protocol (RIP)\n"
47 char xpath
[XPATH_MAXLEN
];
50 /* Build RIP instance XPath. */
52 vrf
= VRF_DEFAULT_NAME
;
53 snprintf(xpath
, sizeof(xpath
), "/frr-ripd:ripd/instance[vrf='%s']",
56 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
58 ret
= nb_cli_apply_changes(vty
, NULL
);
59 if (ret
== CMD_SUCCESS
)
60 VTY_PUSH_XPATH(RIP_NODE
, xpath
);
67 "no router rip [vrf NAME]",
69 "Enable a routing process\n"
70 "Routing Information Protocol (RIP)\n"
73 char xpath
[XPATH_MAXLEN
];
75 /* Build RIP instance XPath. */
77 vrf
= VRF_DEFAULT_NAME
;
78 snprintf(xpath
, sizeof(xpath
), "/frr-ripd:ripd/instance[vrf='%s']",
81 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
83 return nb_cli_apply_changes(vty
, NULL
);
86 void cli_show_router_rip(struct vty
*vty
, struct lyd_node
*dnode
,
91 vrf_name
= yang_dnode_get_string(dnode
, "./vrf");
94 vty_out(vty
, "router rip");
95 if (!strmatch(vrf_name
, VRF_DEFAULT_NAME
))
96 vty_out(vty
, " vrf %s", vrf_name
);
101 * XPath: /frr-ripd:ripd/instance/allow-ecmp
103 DEFPY (rip_allow_ecmp
,
107 "Allow Equal Cost MultiPath\n")
109 nb_cli_enqueue_change(vty
, "./allow-ecmp", NB_OP_MODIFY
,
110 no
? "false" : "true");
112 return nb_cli_apply_changes(vty
, NULL
);
115 void cli_show_rip_allow_ecmp(struct vty
*vty
, struct lyd_node
*dnode
,
118 if (!yang_dnode_get_bool(dnode
, NULL
))
121 vty_out(vty
, " allow-ecmp\n");
125 * XPath: /frr-ripd:ripd/instance/default-information-originate
127 DEFPY (rip_default_information_originate
,
128 rip_default_information_originate_cmd
,
129 "[no] default-information originate",
131 "Control distribution of default route\n"
132 "Distribute a default route\n")
134 nb_cli_enqueue_change(vty
, "./default-information-originate",
135 NB_OP_MODIFY
, no
? "false" : "true");
137 return nb_cli_apply_changes(vty
, NULL
);
140 void cli_show_rip_default_information_originate(struct vty
*vty
,
141 struct lyd_node
*dnode
,
144 if (!yang_dnode_get_bool(dnode
, NULL
))
147 vty_out(vty
, " default-information originate\n");
151 * XPath: /frr-ripd:ripd/instance/default-metric
153 DEFPY (rip_default_metric
,
154 rip_default_metric_cmd
,
155 "default-metric (1-16)",
156 "Set a metric of redistribute routes\n"
159 nb_cli_enqueue_change(vty
, "./default-metric", NB_OP_MODIFY
,
162 return nb_cli_apply_changes(vty
, NULL
);
165 DEFPY (no_rip_default_metric
,
166 no_rip_default_metric_cmd
,
167 "no default-metric [(1-16)]",
169 "Set a metric of redistribute routes\n"
172 nb_cli_enqueue_change(vty
, "./default-metric", NB_OP_MODIFY
, NULL
);
174 return nb_cli_apply_changes(vty
, NULL
);
177 void cli_show_rip_default_metric(struct vty
*vty
, struct lyd_node
*dnode
,
180 vty_out(vty
, " default-metric %s\n",
181 yang_dnode_get_string(dnode
, NULL
));
185 * XPath: /frr-ripd:ripd/instance/distance/default
190 "Administrative distance\n"
193 nb_cli_enqueue_change(vty
, "./distance/default", NB_OP_MODIFY
,
196 return nb_cli_apply_changes(vty
, NULL
);
199 DEFPY (no_rip_distance
,
201 "no distance [(1-255)]",
203 "Administrative distance\n"
206 nb_cli_enqueue_change(vty
, "./distance/default", NB_OP_MODIFY
, NULL
);
208 return nb_cli_apply_changes(vty
, NULL
);
211 void cli_show_rip_distance(struct vty
*vty
, struct lyd_node
*dnode
,
214 if (yang_dnode_is_default(dnode
, NULL
))
215 vty_out(vty
, " no distance\n");
217 vty_out(vty
, " distance %s\n",
218 yang_dnode_get_string(dnode
, NULL
));
222 * XPath: /frr-ripd:ripd/instance/distance/source
224 DEFPY (rip_distance_source
,
225 rip_distance_source_cmd
,
226 "[no] distance (1-255) A.B.C.D/M$prefix [WORD$acl]",
228 "Administrative distance\n"
231 "Access list name\n")
234 nb_cli_enqueue_change(vty
, ".", NB_OP_CREATE
, NULL
);
235 nb_cli_enqueue_change(vty
, "./distance", NB_OP_MODIFY
,
237 nb_cli_enqueue_change(vty
, "./access-list",
238 acl
? NB_OP_MODIFY
: NB_OP_DESTROY
, acl
);
240 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
242 return nb_cli_apply_changes(vty
, "./distance/source[prefix='%s']",
246 void cli_show_rip_distance_source(struct vty
*vty
, struct lyd_node
*dnode
,
249 vty_out(vty
, " distance %s %s",
250 yang_dnode_get_string(dnode
, "./distance"),
251 yang_dnode_get_string(dnode
, "./prefix"));
252 if (yang_dnode_exists(dnode
, "./access-list"))
254 yang_dnode_get_string(dnode
, "./access-list"));
259 * XPath: /frr-ripd:ripd/instance/explicit-neighbor
263 "[no] neighbor A.B.C.D",
265 "Specify a neighbor router\n"
266 "Neighbor address\n")
268 nb_cli_enqueue_change(vty
, "./explicit-neighbor",
269 no
? NB_OP_DESTROY
: NB_OP_CREATE
, neighbor_str
);
271 return nb_cli_apply_changes(vty
, NULL
);
274 void cli_show_rip_neighbor(struct vty
*vty
, struct lyd_node
*dnode
,
277 vty_out(vty
, " neighbor %s\n", yang_dnode_get_string(dnode
, NULL
));
281 * XPath: /frr-ripd:ripd/instance/network
283 DEFPY (rip_network_prefix
,
284 rip_network_prefix_cmd
,
285 "[no] network A.B.C.D/M",
287 "Enable routing on an IP network\n"
288 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
290 nb_cli_enqueue_change(vty
, "./network",
291 no
? NB_OP_DESTROY
: NB_OP_CREATE
, network_str
);
293 return nb_cli_apply_changes(vty
, NULL
);
296 void cli_show_rip_network_prefix(struct vty
*vty
, struct lyd_node
*dnode
,
299 vty_out(vty
, " network %s\n", yang_dnode_get_string(dnode
, NULL
));
303 * XPath: /frr-ripd:ripd/instance/interface
305 DEFPY (rip_network_if
,
309 "Enable routing on an IP network\n"
312 nb_cli_enqueue_change(vty
, "./interface",
313 no
? NB_OP_DESTROY
: NB_OP_CREATE
, network
);
315 return nb_cli_apply_changes(vty
, NULL
);
318 void cli_show_rip_network_interface(struct vty
*vty
, struct lyd_node
*dnode
,
321 vty_out(vty
, " network %s\n", yang_dnode_get_string(dnode
, NULL
));
325 * XPath: /frr-ripd:ripd/instance/offset-list
327 DEFPY (rip_offset_list
,
329 "[no] offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]",
331 "Modify RIP metric\n"
333 "For incoming updates\n"
334 "For outgoing updates\n"
336 "Interface to match\n")
339 nb_cli_enqueue_change(vty
, ".", NB_OP_CREATE
, NULL
);
340 nb_cli_enqueue_change(vty
, "./access-list", NB_OP_MODIFY
, acl
);
341 nb_cli_enqueue_change(vty
, "./metric", NB_OP_MODIFY
,
344 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
346 return nb_cli_apply_changes(
347 vty
, "./offset-list[interface='%s'][direction='%s']",
348 ifname
? ifname
: "*", direction
);
351 void cli_show_rip_offset_list(struct vty
*vty
, struct lyd_node
*dnode
,
354 const char *interface
;
356 interface
= yang_dnode_get_string(dnode
, "./interface");
358 vty_out(vty
, " offset-list %s %s %s",
359 yang_dnode_get_string(dnode
, "./access-list"),
360 yang_dnode_get_string(dnode
, "./direction"),
361 yang_dnode_get_string(dnode
, "./metric"));
362 if (!strmatch(interface
, "*"))
363 vty_out(vty
, " %s", interface
);
368 * XPath: /frr-ripd:ripd/instance/passive-default
370 DEFPY (rip_passive_default
,
371 rip_passive_default_cmd
,
372 "[no] passive-interface default",
374 "Suppress routing updates on an interface\n"
375 "default for all interfaces\n")
377 nb_cli_enqueue_change(vty
, "./passive-default", NB_OP_MODIFY
,
378 no
? "false" : "true");
380 return nb_cli_apply_changes(vty
, NULL
);
383 void cli_show_rip_passive_default(struct vty
*vty
, struct lyd_node
*dnode
,
386 if (!yang_dnode_get_bool(dnode
, NULL
))
389 vty_out(vty
, " passive-interface default\n");
393 * XPath: /frr-ripd:ripd/instance/passive-interface
394 * /frr-ripd:ripd/instance/non-passive-interface
396 DEFPY (rip_passive_interface
,
397 rip_passive_interface_cmd
,
398 "[no] passive-interface IFNAME",
400 "Suppress routing updates on an interface\n"
403 bool passive_default
=
404 yang_dnode_get_bool(vty
->candidate_config
->dnode
, "%s%s",
405 VTY_CURR_XPATH
, "/passive-default");
407 if (passive_default
) {
408 nb_cli_enqueue_change(vty
, "./non-passive-interface",
409 no
? NB_OP_CREATE
: NB_OP_DESTROY
,
412 nb_cli_enqueue_change(vty
, "./passive-interface",
413 no
? NB_OP_DESTROY
: NB_OP_CREATE
,
417 return nb_cli_apply_changes(vty
, NULL
);
420 void cli_show_rip_passive_interface(struct vty
*vty
, struct lyd_node
*dnode
,
423 vty_out(vty
, " passive-interface %s\n",
424 yang_dnode_get_string(dnode
, NULL
));
427 void cli_show_rip_non_passive_interface(struct vty
*vty
, struct lyd_node
*dnode
,
430 vty_out(vty
, " no passive-interface %s\n",
431 yang_dnode_get_string(dnode
, NULL
));
435 * XPath: /frr-ripd:ripd/instance/redistribute
437 DEFPY (rip_redistribute
,
438 rip_redistribute_cmd
,
439 "[no] redistribute " FRR_REDIST_STR_RIPD
"$protocol [{metric (0-16)|route-map WORD}]",
442 FRR_REDIST_HELP_STR_RIPD
445 "Route map reference\n"
446 "Pointer to route-map entries\n")
449 nb_cli_enqueue_change(vty
, ".", NB_OP_CREATE
, NULL
);
450 nb_cli_enqueue_change(vty
, "./route-map",
451 route_map
? NB_OP_MODIFY
: NB_OP_DESTROY
,
453 nb_cli_enqueue_change(vty
, "./metric",
454 metric_str
? NB_OP_MODIFY
: NB_OP_DESTROY
,
457 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
459 return nb_cli_apply_changes(vty
, "./redistribute[protocol='%s']",
463 void cli_show_rip_redistribute(struct vty
*vty
, struct lyd_node
*dnode
,
466 vty_out(vty
, " redistribute %s",
467 yang_dnode_get_string(dnode
, "./protocol"));
468 if (yang_dnode_exists(dnode
, "./metric"))
469 vty_out(vty
, " metric %s",
470 yang_dnode_get_string(dnode
, "./metric"));
471 if (yang_dnode_exists(dnode
, "./route-map"))
472 vty_out(vty
, " route-map %s",
473 yang_dnode_get_string(dnode
, "./route-map"));
478 * XPath: /frr-ripd:ripd/instance/static-route
482 "[no] route A.B.C.D/M",
484 "RIP static route configuration\n"
485 "IP prefix <network>/<length>\n")
487 nb_cli_enqueue_change(vty
, "./static-route",
488 no
? NB_OP_DESTROY
: NB_OP_CREATE
, route_str
);
490 return nb_cli_apply_changes(vty
, NULL
);
493 void cli_show_rip_route(struct vty
*vty
, struct lyd_node
*dnode
,
496 vty_out(vty
, " route %s\n", yang_dnode_get_string(dnode
, NULL
));
500 * XPath: /frr-ripd:ripd/instance/timers
504 "timers basic (5-2147483647)$update (5-2147483647)$timeout (5-2147483647)$garbage",
505 "Adjust routing timers\n"
506 "Basic routing protocol update timers\n"
507 "Routing table update timer value in second. Default is 30.\n"
508 "Routing information timeout timer. Default is 180.\n"
509 "Garbage collection timer. Default is 120.\n")
511 nb_cli_enqueue_change(vty
, "./update-interval", NB_OP_MODIFY
,
513 nb_cli_enqueue_change(vty
, "./holddown-interval", NB_OP_MODIFY
,
515 nb_cli_enqueue_change(vty
, "./flush-interval", NB_OP_MODIFY
,
518 return nb_cli_apply_changes(vty
, "./timers");
521 DEFPY (no_rip_timers
,
523 "no timers basic [(5-2147483647) (5-2147483647) (5-2147483647)]",
525 "Adjust routing timers\n"
526 "Basic routing protocol update timers\n"
527 "Routing table update timer value in second. Default is 30.\n"
528 "Routing information timeout timer. Default is 180.\n"
529 "Garbage collection timer. Default is 120.\n")
531 nb_cli_enqueue_change(vty
, "./update-interval", NB_OP_MODIFY
, NULL
);
532 nb_cli_enqueue_change(vty
, "./holddown-interval", NB_OP_MODIFY
, NULL
);
533 nb_cli_enqueue_change(vty
, "./flush-interval", NB_OP_MODIFY
, NULL
);
535 return nb_cli_apply_changes(vty
, "./timers");
538 void cli_show_rip_timers(struct vty
*vty
, struct lyd_node
*dnode
,
541 vty_out(vty
, " timers basic %s %s %s\n",
542 yang_dnode_get_string(dnode
, "./update-interval"),
543 yang_dnode_get_string(dnode
, "./holddown-interval"),
544 yang_dnode_get_string(dnode
, "./flush-interval"));
548 * XPath: /frr-ripd:ripd/instance/version
553 "Set routing protocol version\n"
556 nb_cli_enqueue_change(vty
, "./version/receive", NB_OP_MODIFY
,
558 nb_cli_enqueue_change(vty
, "./version/send", NB_OP_MODIFY
, version_str
);
560 return nb_cli_apply_changes(vty
, NULL
);
563 DEFPY (no_rip_version
,
565 "no version [(1-2)]",
567 "Set routing protocol version\n"
570 nb_cli_enqueue_change(vty
, "./version/receive", NB_OP_MODIFY
, NULL
);
571 nb_cli_enqueue_change(vty
, "./version/send", NB_OP_MODIFY
, NULL
);
573 return nb_cli_apply_changes(vty
, NULL
);
576 void cli_show_rip_version(struct vty
*vty
, struct lyd_node
*dnode
,
580 * We have only one "version" command and three possible combinations of
581 * send/receive values.
583 switch (yang_dnode_get_enum(dnode
, "./receive")) {
584 case RI_RIP_VERSION_1
:
585 vty_out(vty
, " version 1\n");
587 case RI_RIP_VERSION_2
:
588 vty_out(vty
, " version 2\n");
590 case RI_RIP_VERSION_1_AND_2
:
591 vty_out(vty
, " no version\n");
597 * XPath: /frr-interface:lib/interface/frr-ripd:rip/split-horizon
599 DEFPY (ip_rip_split_horizon
,
600 ip_rip_split_horizon_cmd
,
601 "[no] ip rip split-horizon [poisoned-reverse$poisoned_reverse]",
604 "Routing Information Protocol\n"
605 "Perform split horizon\n"
606 "With poisoned-reverse\n")
612 else if (poisoned_reverse
)
613 value
= "poison-reverse";
617 nb_cli_enqueue_change(vty
, "./split-horizon", NB_OP_MODIFY
, value
);
619 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
622 void cli_show_ip_rip_split_horizon(struct vty
*vty
, struct lyd_node
*dnode
,
627 value
= yang_dnode_get_enum(dnode
, NULL
);
629 case RIP_NO_SPLIT_HORIZON
:
630 vty_out(vty
, " no ip rip split-horizon\n");
632 case RIP_SPLIT_HORIZON
:
633 vty_out(vty
, " ip rip split-horizon\n");
635 case RIP_SPLIT_HORIZON_POISONED_REVERSE
:
636 vty_out(vty
, " ip rip split-horizon poisoned-reverse\n");
642 * XPath: /frr-interface:lib/interface/frr-ripd:rip/v2-broadcast
644 DEFPY (ip_rip_v2_broadcast
,
645 ip_rip_v2_broadcast_cmd
,
646 "[no] ip rip v2-broadcast",
649 "Routing Information Protocol\n"
650 "Send ip broadcast v2 update\n")
652 nb_cli_enqueue_change(vty
, "./v2-broadcast", NB_OP_MODIFY
,
653 no
? "false" : "true");
655 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
658 void cli_show_ip_rip_v2_broadcast(struct vty
*vty
, struct lyd_node
*dnode
,
661 if (!yang_dnode_get_bool(dnode
, NULL
))
664 vty_out(vty
, " ip rip v2-broadcast\n");
668 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-receive
670 DEFPY (ip_rip_receive_version
,
671 ip_rip_receive_version_cmd
,
672 "ip rip receive version <{1$v1|2$v2}|none>",
674 "Routing Information Protocol\n"
675 "Advertisement reception\n"
692 nb_cli_enqueue_change(vty
, "./version-receive", NB_OP_MODIFY
, value
);
694 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
697 DEFPY (no_ip_rip_receive_version
,
698 no_ip_rip_receive_version_cmd
,
699 "no ip rip receive version [<{1|2}|none>]",
702 "Routing Information Protocol\n"
703 "Advertisement reception\n"
709 nb_cli_enqueue_change(vty
, "./version-receive", NB_OP_MODIFY
, NULL
);
711 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
714 void cli_show_ip_rip_receive_version(struct vty
*vty
, struct lyd_node
*dnode
,
717 switch (yang_dnode_get_enum(dnode
, NULL
)) {
719 vty_out(vty
, " no ip rip receive version\n");
721 case RI_RIP_VERSION_1
:
722 vty_out(vty
, " ip rip receive version 1\n");
724 case RI_RIP_VERSION_2
:
725 vty_out(vty
, " ip rip receive version 2\n");
727 case RI_RIP_VERSION_1_AND_2
:
728 vty_out(vty
, " ip rip receive version 1 2\n");
730 case RI_RIP_VERSION_NONE
:
731 vty_out(vty
, " ip rip receive version none\n");
737 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-send
739 DEFPY (ip_rip_send_version
,
740 ip_rip_send_version_cmd
,
741 "ip rip send version <{1$v1|2$v2}|none>",
743 "Routing Information Protocol\n"
744 "Advertisement transmission\n"
761 nb_cli_enqueue_change(vty
, "./version-send", NB_OP_MODIFY
, value
);
763 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
766 DEFPY (no_ip_rip_send_version
,
767 no_ip_rip_send_version_cmd
,
768 "no ip rip send version [<{1|2}|none>]",
771 "Routing Information Protocol\n"
772 "Advertisement transmission\n"
778 nb_cli_enqueue_change(vty
, "./version-send", NB_OP_MODIFY
, NULL
);
780 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
783 void cli_show_ip_rip_send_version(struct vty
*vty
, struct lyd_node
*dnode
,
786 switch (yang_dnode_get_enum(dnode
, NULL
)) {
788 vty_out(vty
, " no ip rip send version\n");
790 case RI_RIP_VERSION_1
:
791 vty_out(vty
, " ip rip send version 1\n");
793 case RI_RIP_VERSION_2
:
794 vty_out(vty
, " ip rip send version 2\n");
796 case RI_RIP_VERSION_1_AND_2
:
797 vty_out(vty
, " ip rip send version 1 2\n");
799 case RI_RIP_VERSION_NONE
:
800 vty_out(vty
, " ip rip send version none\n");
806 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-scheme
808 DEFPY (ip_rip_authentication_mode
,
809 ip_rip_authentication_mode_cmd
,
810 "ip rip authentication mode <md5$mode [auth-length <rfc|old-ripd>$auth_length]|text$mode>",
812 "Routing Information Protocol\n"
813 "Authentication control\n"
814 "Authentication mode\n"
815 "Keyed message digest\n"
816 "MD5 authentication data length\n"
818 "Old ripd compatible\n"
819 "Clear text authentication\n")
821 const char *value
= NULL
;
824 if (strmatch(auth_length
, "rfc"))
830 nb_cli_enqueue_change(vty
, "./authentication-scheme/mode", NB_OP_MODIFY
,
831 strmatch(mode
, "md5") ? "md5" : "plain-text");
832 if (strmatch(mode
, "md5"))
833 nb_cli_enqueue_change(vty
,
834 "./authentication-scheme/md5-auth-length",
835 NB_OP_MODIFY
, value
);
837 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
840 DEFPY (no_ip_rip_authentication_mode
,
841 no_ip_rip_authentication_mode_cmd
,
842 "no ip rip authentication mode [<md5 [auth-length <rfc|old-ripd>]|text>]",
845 "Routing Information Protocol\n"
846 "Authentication control\n"
847 "Authentication mode\n"
848 "Keyed message digest\n"
849 "MD5 authentication data length\n"
851 "Old ripd compatible\n"
852 "Clear text authentication\n")
854 nb_cli_enqueue_change(vty
, "./authentication-scheme/mode", NB_OP_MODIFY
,
856 nb_cli_enqueue_change(vty
, "./authentication-scheme/md5-auth-length",
857 NB_OP_DESTROY
, NULL
);
859 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
862 void cli_show_ip_rip_authentication_scheme(struct vty
*vty
,
863 struct lyd_node
*dnode
,
866 switch (yang_dnode_get_enum(dnode
, "./mode")) {
868 vty_out(vty
, " no ip rip authentication mode\n");
870 case RIP_AUTH_SIMPLE_PASSWORD
:
871 vty_out(vty
, " ip rip authentication mode text\n");
874 vty_out(vty
, " ip rip authentication mode md5");
876 || !yang_dnode_is_default(dnode
, "./md5-auth-length")) {
877 if (yang_dnode_get_enum(dnode
, "./md5-auth-length")
878 == RIP_AUTH_MD5_SIZE
)
879 vty_out(vty
, " auth-length rfc");
881 vty_out(vty
, " auth-length old-ripd");
889 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-password
891 DEFPY (ip_rip_authentication_string
,
892 ip_rip_authentication_string_cmd
,
893 "ip rip authentication string LINE$password",
895 "Routing Information Protocol\n"
896 "Authentication control\n"
897 "Authentication string\n"
898 "Authentication string\n")
900 if (strlen(password
) > 16) {
902 "%% RIPv2 authentication string must be shorter than 16\n");
903 return CMD_WARNING_CONFIG_FAILED
;
906 if (yang_dnode_exists(vty
->candidate_config
->dnode
, "%s%s",
908 "/frr-ripd:rip/authentication-key-chain")) {
909 vty_out(vty
, "%% key-chain configuration exists\n");
910 return CMD_WARNING_CONFIG_FAILED
;
913 nb_cli_enqueue_change(vty
, "./authentication-password", NB_OP_MODIFY
,
916 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
919 DEFPY (no_ip_rip_authentication_string
,
920 no_ip_rip_authentication_string_cmd
,
921 "no ip rip authentication string [LINE]",
924 "Routing Information Protocol\n"
925 "Authentication control\n"
926 "Authentication string\n"
927 "Authentication string\n")
929 nb_cli_enqueue_change(vty
, "./authentication-password", NB_OP_DESTROY
,
932 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
935 void cli_show_ip_rip_authentication_string(struct vty
*vty
,
936 struct lyd_node
*dnode
,
939 vty_out(vty
, " ip rip authentication string %s\n",
940 yang_dnode_get_string(dnode
, NULL
));
944 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-key-chain
946 DEFPY (ip_rip_authentication_key_chain
,
947 ip_rip_authentication_key_chain_cmd
,
948 "ip rip authentication key-chain LINE$keychain",
950 "Routing Information Protocol\n"
951 "Authentication control\n"
952 "Authentication key-chain\n"
953 "name of key-chain\n")
955 if (yang_dnode_exists(vty
->candidate_config
->dnode
, "%s%s",
957 "/frr-ripd:rip/authentication-password")) {
958 vty_out(vty
, "%% authentication string configuration exists\n");
959 return CMD_WARNING_CONFIG_FAILED
;
962 nb_cli_enqueue_change(vty
, "./authentication-key-chain", NB_OP_MODIFY
,
965 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
968 DEFPY (no_ip_rip_authentication_key_chain
,
969 no_ip_rip_authentication_key_chain_cmd
,
970 "no ip rip authentication key-chain [LINE]",
973 "Routing Information Protocol\n"
974 "Authentication control\n"
975 "Authentication key-chain\n"
976 "name of key-chain\n")
978 nb_cli_enqueue_change(vty
, "./authentication-key-chain", NB_OP_DESTROY
,
981 return nb_cli_apply_changes(vty
, "./frr-ripd:rip");
984 void cli_show_ip_rip_authentication_key_chain(struct vty
*vty
,
985 struct lyd_node
*dnode
,
988 vty_out(vty
, " ip rip authentication key-chain %s\n",
989 yang_dnode_get_string(dnode
, NULL
));
993 * XPath: /frr-ripd:clear-rip-route
997 "clear ip rip [vrf WORD]",
1000 "Clear IP RIP database\n"
1008 struct yang_data
*yang_vrf
;
1010 yang_vrf
= yang_data_new("/frr-ripd:clear-rip-route/input/vrf",
1012 listnode_add(input
, yang_vrf
);
1015 ret
= nb_cli_rpc("/frr-ripd:clear-rip-route", input
, NULL
);
1017 list_delete(&input
);
1022 void rip_cli_init(void)
1024 install_element(CONFIG_NODE
, &router_rip_cmd
);
1025 install_element(CONFIG_NODE
, &no_router_rip_cmd
);
1027 install_element(RIP_NODE
, &rip_allow_ecmp_cmd
);
1028 install_element(RIP_NODE
, &rip_default_information_originate_cmd
);
1029 install_element(RIP_NODE
, &rip_default_metric_cmd
);
1030 install_element(RIP_NODE
, &no_rip_default_metric_cmd
);
1031 install_element(RIP_NODE
, &rip_distance_cmd
);
1032 install_element(RIP_NODE
, &no_rip_distance_cmd
);
1033 install_element(RIP_NODE
, &rip_distance_source_cmd
);
1034 install_element(RIP_NODE
, &rip_neighbor_cmd
);
1035 install_element(RIP_NODE
, &rip_network_prefix_cmd
);
1036 install_element(RIP_NODE
, &rip_network_if_cmd
);
1037 install_element(RIP_NODE
, &rip_offset_list_cmd
);
1038 install_element(RIP_NODE
, &rip_passive_default_cmd
);
1039 install_element(RIP_NODE
, &rip_passive_interface_cmd
);
1040 install_element(RIP_NODE
, &rip_redistribute_cmd
);
1041 install_element(RIP_NODE
, &rip_route_cmd
);
1042 install_element(RIP_NODE
, &rip_timers_cmd
);
1043 install_element(RIP_NODE
, &no_rip_timers_cmd
);
1044 install_element(RIP_NODE
, &rip_version_cmd
);
1045 install_element(RIP_NODE
, &no_rip_version_cmd
);
1047 install_element(INTERFACE_NODE
, &ip_rip_split_horizon_cmd
);
1048 install_element(INTERFACE_NODE
, &ip_rip_v2_broadcast_cmd
);
1049 install_element(INTERFACE_NODE
, &ip_rip_receive_version_cmd
);
1050 install_element(INTERFACE_NODE
, &no_ip_rip_receive_version_cmd
);
1051 install_element(INTERFACE_NODE
, &ip_rip_send_version_cmd
);
1052 install_element(INTERFACE_NODE
, &no_ip_rip_send_version_cmd
);
1053 install_element(INTERFACE_NODE
, &ip_rip_authentication_mode_cmd
);
1054 install_element(INTERFACE_NODE
, &no_ip_rip_authentication_mode_cmd
);
1055 install_element(INTERFACE_NODE
, &ip_rip_authentication_string_cmd
);
1056 install_element(INTERFACE_NODE
, &no_ip_rip_authentication_string_cmd
);
1057 install_element(INTERFACE_NODE
, &ip_rip_authentication_key_chain_cmd
);
1058 install_element(INTERFACE_NODE
,
1059 &no_ip_rip_authentication_key_chain_cmd
);
1061 install_element(ENABLE_NODE
, &clear_ip_rip_cmd
);