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_cli.h"
33 #ifndef VTYSH_EXTRACT_PL
34 #include "ripd/rip_cli_clippy.c"
38 * XPath: /frr-ripd:ripd/instance
40 DEFPY_NOSH (router_rip
,
43 "Enable a routing process\n"
44 "Routing Information Protocol (RIP)\n")
48 struct cli_config_change changes
[] = {
50 .xpath
= "/frr-ripd:ripd/instance",
51 .operation
= NB_OP_CREATE
,
56 ret
= nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
57 if (ret
== CMD_SUCCESS
)
58 VTY_PUSH_XPATH(RIP_NODE
, changes
[0].xpath
);
67 "Enable a routing process\n"
68 "Routing Information Protocol (RIP)\n")
70 struct cli_config_change changes
[] = {
72 .xpath
= "/frr-ripd:ripd/instance",
73 .operation
= NB_OP_DELETE
,
78 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
81 void cli_show_router_rip(struct vty
*vty
, struct lyd_node
*dnode
,
85 vty_out(vty
, "router rip\n");
89 * XPath: /frr-ripd:ripd/instance/allow-ecmp
91 DEFPY (rip_allow_ecmp
,
95 "Allow Equal Cost MultiPath\n")
97 struct cli_config_change changes
[] = {
99 .xpath
= "./allow-ecmp",
100 .operation
= NB_OP_MODIFY
,
101 .value
= no
? "false" : "true",
105 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
108 void cli_show_rip_allow_ecmp(struct vty
*vty
, struct lyd_node
*dnode
,
111 if (!yang_dnode_get_bool(dnode
, NULL
))
114 vty_out(vty
, " allow-ecmp\n");
118 * XPath: /frr-ripd:ripd/instance/default-information-originate
120 DEFPY (rip_default_information_originate
,
121 rip_default_information_originate_cmd
,
122 "[no] default-information originate",
124 "Control distribution of default route\n"
125 "Distribute a default route\n")
127 struct cli_config_change changes
[] = {
129 .xpath
= "./default-information-originate",
130 .operation
= NB_OP_MODIFY
,
131 .value
= no
? "false" : "true",
135 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
138 void cli_show_rip_default_information_originate(struct vty
*vty
,
139 struct lyd_node
*dnode
,
142 if (!yang_dnode_get_bool(dnode
, NULL
))
145 vty_out(vty
, " default-information originate\n");
149 * XPath: /frr-ripd:ripd/instance/default-metric
151 DEFPY (rip_default_metric
,
152 rip_default_metric_cmd
,
153 "default-metric (1-16)",
154 "Set a metric of redistribute routes\n"
157 struct cli_config_change changes
[] = {
159 .xpath
= "./default-metric",
160 .operation
= NB_OP_MODIFY
,
161 .value
= default_metric_str
,
165 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
168 DEFPY (no_rip_default_metric
,
169 no_rip_default_metric_cmd
,
170 "no default-metric [(1-16)]",
172 "Set a metric of redistribute routes\n"
175 struct cli_config_change changes
[] = {
177 .xpath
= "./default-metric",
178 .operation
= NB_OP_MODIFY
,
183 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
186 void cli_show_rip_default_metric(struct vty
*vty
, struct lyd_node
*dnode
,
189 vty_out(vty
, " default-metric %s\n",
190 yang_dnode_get_string(dnode
, NULL
));
194 * XPath: /frr-ripd:ripd/instance/distance/default
199 "Administrative distance\n"
202 struct cli_config_change changes
[] = {
204 .xpath
= "./distance/default",
205 .operation
= NB_OP_MODIFY
,
206 .value
= distance_str
,
210 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
213 DEFPY (no_rip_distance
,
215 "no distance [(1-255)]",
217 "Administrative distance\n"
220 struct cli_config_change changes
[] = {
222 .xpath
= "./distance/default",
223 .operation
= NB_OP_MODIFY
,
228 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
231 void cli_show_rip_distance(struct vty
*vty
, struct lyd_node
*dnode
,
234 vty_out(vty
, " distance %s\n", yang_dnode_get_string(dnode
, NULL
));
238 * XPath: /frr-ripd:ripd/instance/distance/source
240 DEFPY (rip_distance_source
,
241 rip_distance_source_cmd
,
242 "distance (1-255) A.B.C.D/M$prefix [WORD$acl]",
243 "Administrative distance\n"
246 "Access list name\n")
248 char xpath_list
[XPATH_MAXLEN
];
249 struct cli_config_change changes
[] = {
252 .operation
= NB_OP_CREATE
,
255 .xpath
= "./distance",
256 .operation
= NB_OP_MODIFY
,
257 .value
= distance_str
,
260 .xpath
= "./access-list",
261 .operation
= acl
? NB_OP_MODIFY
: NB_OP_DELETE
,
266 snprintf(xpath_list
, sizeof(xpath_list
),
267 "./distance/source[prefix='%s']", prefix_str
);
269 return nb_cli_cfg_change(vty
, xpath_list
, changes
, array_size(changes
));
272 DEFPY (no_rip_distance_source
,
273 no_rip_distance_source_cmd
,
274 "no distance (1-255) A.B.C.D/M$prefix [WORD$acl]",
276 "Administrative distance\n"
279 "Access list name\n")
281 char xpath_list
[XPATH_MAXLEN
];
282 struct cli_config_change changes
[] = {
285 .operation
= NB_OP_DELETE
,
289 snprintf(xpath_list
, sizeof(xpath_list
),
290 "./distance/source[prefix='%s']", prefix_str
);
292 return nb_cli_cfg_change(vty
, xpath_list
, changes
, 1);
295 void cli_show_rip_distance_source(struct vty
*vty
, struct lyd_node
*dnode
,
298 vty_out(vty
, " distance %s %s",
299 yang_dnode_get_string(dnode
, "./distance"),
300 yang_dnode_get_string(dnode
, "./prefix"));
301 if (yang_dnode_exists(dnode
, "./access-list"))
303 yang_dnode_get_string(dnode
, "./access-list"));
308 * XPath: /frr-ripd:ripd/instance/explicit-neighbor
312 "[no] neighbor A.B.C.D",
314 "Specify a neighbor router\n"
315 "Neighbor address\n")
317 struct cli_config_change changes
[] = {
319 .xpath
= "./explicit-neighbor",
320 .operation
= no
? NB_OP_DELETE
: NB_OP_CREATE
,
321 .value
= neighbor_str
,
325 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
328 void cli_show_rip_neighbor(struct vty
*vty
, struct lyd_node
*dnode
,
331 vty_out(vty
, " neighbor %s\n", yang_dnode_get_string(dnode
, NULL
));
335 * XPath: /frr-ripd:ripd/instance/network
337 DEFPY (rip_network_prefix
,
338 rip_network_prefix_cmd
,
339 "[no] network A.B.C.D/M",
341 "Enable routing on an IP network\n"
342 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
344 struct cli_config_change changes
[] = {
346 .xpath
= "./network",
347 .operation
= no
? NB_OP_DELETE
: NB_OP_CREATE
,
348 .value
= network_str
,
352 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
355 void cli_show_rip_network_prefix(struct vty
*vty
, struct lyd_node
*dnode
,
358 vty_out(vty
, " network %s\n", yang_dnode_get_string(dnode
, NULL
));
362 * XPath: /frr-ripd:ripd/instance/interface
364 DEFPY (rip_network_if
,
368 "Enable routing on an IP network\n"
371 struct cli_config_change changes
[] = {
373 .xpath
= "./interface",
374 .operation
= no
? NB_OP_DELETE
: NB_OP_CREATE
,
379 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
382 void cli_show_rip_network_interface(struct vty
*vty
, struct lyd_node
*dnode
,
385 vty_out(vty
, " network %s\n", yang_dnode_get_string(dnode
, NULL
));
389 * XPath: /frr-ripd:ripd/instance/offset-list
391 DEFPY (rip_offset_list
,
393 "offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]",
394 "Modify RIP metric\n"
396 "For incoming updates\n"
397 "For outgoing updates\n"
399 "Interface to match\n")
401 char xpath_list
[XPATH_MAXLEN
];
402 struct cli_config_change changes
[] = {
405 .operation
= NB_OP_CREATE
,
408 .xpath
= "./access-list",
409 .operation
= NB_OP_MODIFY
,
414 .operation
= NB_OP_MODIFY
,
419 snprintf(xpath_list
, sizeof(xpath_list
),
420 "./offset-list[interface='%s'][direction='%s']",
421 ifname
? ifname
: "*", direction
);
423 return nb_cli_cfg_change(vty
, xpath_list
, changes
, array_size(changes
));
426 DEFPY (no_rip_offset_list
,
427 no_rip_offset_list_cmd
,
428 "no offset-list WORD$acl <in|out>$direction (0-16)$metric [IFNAME]",
430 "Modify RIP metric\n"
432 "For incoming updates\n"
433 "For outgoing updates\n"
435 "Interface to match\n")
437 char xpath_list
[XPATH_MAXLEN
];
438 struct cli_config_change changes
[] = {
441 .operation
= NB_OP_DELETE
,
445 snprintf(xpath_list
, sizeof(xpath_list
),
446 "./offset-list[interface='%s'][direction='%s']",
447 ifname
? ifname
: "*", direction
);
449 return nb_cli_cfg_change(vty
, xpath_list
, changes
, array_size(changes
));
452 void cli_show_rip_offset_list(struct vty
*vty
, struct lyd_node
*dnode
,
455 const char *interface
;
457 interface
= yang_dnode_get_string(dnode
, "./interface");
459 vty_out(vty
, " offset-list %s %s %s",
460 yang_dnode_get_string(dnode
, "./access-list"),
461 yang_dnode_get_string(dnode
, "./direction"),
462 yang_dnode_get_string(dnode
, "./metric"));
463 if (!strmatch(interface
, "*"))
464 vty_out(vty
, " %s", interface
);
469 * XPath: /frr-ripd:ripd/instance/passive-default
471 DEFPY (rip_passive_default
,
472 rip_passive_default_cmd
,
473 "[no] passive-interface default",
475 "Suppress routing updates on an interface\n"
476 "default for all interfaces\n")
478 struct cli_config_change changes
[] = {
480 .xpath
= "./passive-default",
481 .operation
= NB_OP_MODIFY
,
482 .value
= no
? "false" : "true",
486 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
489 void cli_show_rip_passive_default(struct vty
*vty
, struct lyd_node
*dnode
,
492 if (!yang_dnode_get_bool(dnode
, NULL
))
495 vty_out(vty
, " passive-interface default\n");
499 * XPath: /frr-ripd:ripd/instance/passive-interface
500 * /frr-ripd:ripd/instance/non-passive-interface
502 DEFPY (rip_passive_interface
,
503 rip_passive_interface_cmd
,
504 "[no] passive-interface IFNAME",
506 "Suppress routing updates on an interface\n"
509 struct cli_config_change changes
[] = {
511 .xpath
= "./passive-interface",
512 .operation
= no
? NB_OP_DELETE
: NB_OP_CREATE
,
516 .xpath
= "./non-passive-interface",
517 .operation
= no
? NB_OP_CREATE
: NB_OP_DELETE
,
522 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
525 void cli_show_rip_passive_interface(struct vty
*vty
, struct lyd_node
*dnode
,
528 vty_out(vty
, " passive-interface %s\n",
529 yang_dnode_get_string(dnode
, NULL
));
532 void cli_show_rip_non_passive_interface(struct vty
*vty
, struct lyd_node
*dnode
,
535 vty_out(vty
, " no passive-interface %s\n",
536 yang_dnode_get_string(dnode
, NULL
));
540 * XPath: /frr-ripd:ripd/instance/redistribute
542 DEFPY (rip_redistribute
,
543 rip_redistribute_cmd
,
544 "redistribute " FRR_REDIST_STR_RIPD
"$protocol [{metric (0-16)|route-map WORD}]",
546 FRR_REDIST_HELP_STR_RIPD
549 "Route map reference\n"
550 "Pointer to route-map entries\n")
552 char xpath_list
[XPATH_MAXLEN
];
553 struct cli_config_change changes
[] = {
556 .operation
= NB_OP_CREATE
,
559 .xpath
= "./route-map",
560 .operation
= route_map
? NB_OP_MODIFY
: NB_OP_DELETE
,
565 .operation
= metric_str
? NB_OP_MODIFY
: NB_OP_DELETE
,
570 snprintf(xpath_list
, sizeof(xpath_list
),
571 "./redistribute[protocol='%s']", protocol
);
573 return nb_cli_cfg_change(vty
, xpath_list
, changes
, array_size(changes
));
576 DEFPY (no_rip_redistribute
,
577 no_rip_redistribute_cmd
,
578 "no redistribute " FRR_REDIST_STR_RIPD
"$protocol [{metric (0-16)|route-map WORD}]",
581 FRR_REDIST_HELP_STR_RIPD
584 "Route map reference\n"
585 "Pointer to route-map entries\n")
587 char xpath_list
[XPATH_MAXLEN
];
588 struct cli_config_change changes
[] = {
591 .operation
= NB_OP_DELETE
,
595 snprintf(xpath_list
, sizeof(xpath_list
),
596 "./redistribute[protocol='%s']", protocol
);
598 return nb_cli_cfg_change(vty
, xpath_list
, changes
, array_size(changes
));
601 void cli_show_rip_redistribute(struct vty
*vty
, struct lyd_node
*dnode
,
604 vty_out(vty
, " redistribute %s",
605 yang_dnode_get_string(dnode
, "./protocol"));
606 if (yang_dnode_exists(dnode
, "./metric"))
607 vty_out(vty
, " metric %s",
608 yang_dnode_get_string(dnode
, "./metric"));
609 if (yang_dnode_exists(dnode
, "./route-map"))
610 vty_out(vty
, " route-map %s",
611 yang_dnode_get_string(dnode
, "./route-map"));
616 * XPath: /frr-ripd:ripd/instance/static-route
620 "[no] route A.B.C.D/M",
622 "RIP static route configuration\n"
623 "IP prefix <network>/<length>\n")
625 struct cli_config_change changes
[] = {
627 .xpath
= "./static-route",
628 .operation
= no
? NB_OP_DELETE
: NB_OP_CREATE
,
633 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
636 void cli_show_rip_route(struct vty
*vty
, struct lyd_node
*dnode
,
639 vty_out(vty
, " route %s\n", yang_dnode_get_string(dnode
, NULL
));
643 * XPath: /frr-ripd:ripd/instance/timers
647 "timers basic (5-2147483647)$update (5-2147483647)$timeout (5-2147483647)$garbage",
648 "Adjust routing timers\n"
649 "Basic routing protocol update timers\n"
650 "Routing table update timer value in second. Default is 30.\n"
651 "Routing information timeout timer. Default is 180.\n"
652 "Garbage collection timer. Default is 120.\n")
654 struct cli_config_change changes
[] = {
656 .xpath
= "./timers/update-interval",
657 .operation
= NB_OP_MODIFY
,
661 .xpath
= "./timers/holddown-interval",
662 .operation
= NB_OP_MODIFY
,
663 .value
= timeout_str
,
666 .xpath
= "./timers/flush-interval",
667 .operation
= NB_OP_MODIFY
,
668 .value
= garbage_str
,
672 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
675 DEFPY (no_rip_timers
,
677 "no timers basic [(5-2147483647) (5-2147483647) (5-2147483647)]",
679 "Adjust routing timers\n"
680 "Basic routing protocol update timers\n"
681 "Routing table update timer value in second. Default is 30.\n"
682 "Routing information timeout timer. Default is 180.\n"
683 "Garbage collection timer. Default is 120.\n")
685 struct cli_config_change changes
[] = {
687 .xpath
= "./timers/update-interval",
688 .operation
= NB_OP_MODIFY
,
692 .xpath
= "./timers/holddown-interval",
693 .operation
= NB_OP_MODIFY
,
697 .xpath
= "./timers/flush-interval",
698 .operation
= NB_OP_MODIFY
,
703 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
706 void cli_show_rip_timers(struct vty
*vty
, struct lyd_node
*dnode
,
709 vty_out(vty
, " timers basic %s %s %s\n",
710 yang_dnode_get_string(dnode
, "./update-interval"),
711 yang_dnode_get_string(dnode
, "./holddown-interval"),
712 yang_dnode_get_string(dnode
, "./flush-interval"));
716 * XPath: /frr-ripd:ripd/instance/version
721 "Set routing protocol version\n"
724 struct cli_config_change changes
[] = {
726 .xpath
= "./version/receive",
727 .operation
= NB_OP_MODIFY
,
728 .value
= version_str
,
731 .xpath
= "./version/send",
732 .operation
= NB_OP_MODIFY
,
733 .value
= version_str
,
737 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
740 DEFPY (no_rip_version
,
742 "no version [(1-2)]",
744 "Set routing protocol version\n"
747 struct cli_config_change changes
[] = {
749 .xpath
= "./version/receive",
750 .operation
= NB_OP_MODIFY
,
753 .xpath
= "./version/send",
754 .operation
= NB_OP_MODIFY
,
758 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
761 void cli_show_rip_version(struct vty
*vty
, struct lyd_node
*dnode
,
765 * We have only one "version" command and three possible combinations of
766 * send/receive values.
768 switch (yang_dnode_get_enum(dnode
, "./receive")) {
769 case RI_RIP_VERSION_1
:
770 vty_out(vty
, " version 1\n");
772 case RI_RIP_VERSION_2
:
773 vty_out(vty
, " version 2\n");
775 case RI_RIP_VERSION_1_AND_2
:
776 vty_out(vty
, " no version\n");
782 * XPath: /frr-interface:lib/interface/frr-ripd:rip/split-horizon
784 DEFPY (ip_rip_split_horizon
,
785 ip_rip_split_horizon_cmd
,
786 "[no] ip rip split-horizon [poisoned-reverse$poisoned_reverse]",
789 "Routing Information Protocol\n"
790 "Perform split horizon\n"
791 "With poisoned-reverse\n")
793 struct cli_config_change changes
[] = {
795 .xpath
= "./frr-ripd:rip/split-horizon",
796 .operation
= NB_OP_MODIFY
,
801 changes
[0].value
= "disabled";
802 else if (poisoned_reverse
)
803 changes
[0].value
= "poison-reverse";
805 changes
[0].value
= "simple";
807 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
810 void cli_show_ip_rip_split_horizon(struct vty
*vty
, struct lyd_node
*dnode
,
815 value
= yang_dnode_get_enum(dnode
, NULL
);
817 case RIP_NO_SPLIT_HORIZON
:
818 vty_out(vty
, " no ip rip split-horizon\n");
820 case RIP_SPLIT_HORIZON
:
821 vty_out(vty
, " ip rip split-horizon\n");
823 case RIP_SPLIT_HORIZON_POISONED_REVERSE
:
824 vty_out(vty
, " ip rip split-horizon poisoned-reverse\n");
830 * XPath: /frr-interface:lib/interface/frr-ripd:rip/v2-broadcast
832 DEFPY (ip_rip_v2_broadcast
,
833 ip_rip_v2_broadcast_cmd
,
834 "[no] ip rip v2-broadcast",
837 "Routing Information Protocol\n"
838 "Send ip broadcast v2 update\n")
840 struct cli_config_change changes
[] = {
842 .xpath
= "./frr-ripd:rip/v2-broadcast",
843 .operation
= NB_OP_MODIFY
,
844 .value
= no
? "false" : "true",
848 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
851 void cli_show_ip_rip_v2_broadcast(struct vty
*vty
, struct lyd_node
*dnode
,
854 if (!yang_dnode_get_bool(dnode
, NULL
))
857 vty_out(vty
, " ip rip v2-broadcast\n");
861 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-receive
863 DEFPY (ip_rip_receive_version
,
864 ip_rip_receive_version_cmd
,
865 "ip rip receive version <{1$v1|2$v2}|none>",
867 "Routing Information Protocol\n"
868 "Advertisement reception\n"
874 struct cli_config_change changes
[] = {
876 .xpath
= "./frr-ripd:rip/version-receive",
877 .operation
= NB_OP_MODIFY
,
882 changes
[0].value
= "both";
884 changes
[0].value
= "1";
886 changes
[0].value
= "2";
888 changes
[0].value
= "none";
890 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
893 DEFPY (no_ip_rip_receive_version
,
894 no_ip_rip_receive_version_cmd
,
895 "no ip rip receive version [<{1|2}|none>]",
898 "Routing Information Protocol\n"
899 "Advertisement reception\n"
905 struct cli_config_change changes
[] = {
907 .xpath
= "./frr-ripd:rip/version-receive",
908 .operation
= NB_OP_MODIFY
,
913 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
916 void cli_show_ip_rip_receive_version(struct vty
*vty
, struct lyd_node
*dnode
,
919 switch (yang_dnode_get_enum(dnode
, NULL
)) {
921 vty_out(vty
, " no ip rip receive version\n");
923 case RI_RIP_VERSION_1
:
924 vty_out(vty
, " ip rip receive version 1\n");
926 case RI_RIP_VERSION_2
:
927 vty_out(vty
, " ip rip receive version 2\n");
929 case RI_RIP_VERSION_1_AND_2
:
930 vty_out(vty
, " ip rip receive version 1 2\n");
932 case RI_RIP_VERSION_NONE
:
933 vty_out(vty
, " ip rip receive version none\n");
939 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-send
941 DEFPY (ip_rip_send_version
,
942 ip_rip_send_version_cmd
,
943 "ip rip send version <{1$v1|2$v2}|none>",
945 "Routing Information Protocol\n"
946 "Advertisement transmission\n"
952 struct cli_config_change changes
[] = {
954 .xpath
= "./frr-ripd:rip/version-send",
955 .operation
= NB_OP_MODIFY
,
960 changes
[0].value
= "both";
962 changes
[0].value
= "1";
964 changes
[0].value
= "2";
966 changes
[0].value
= "none";
968 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
971 DEFPY (no_ip_rip_send_version
,
972 no_ip_rip_send_version_cmd
,
973 "no ip rip send version [<{1|2}|none>]",
976 "Routing Information Protocol\n"
977 "Advertisement transmission\n"
983 struct cli_config_change changes
[] = {
985 .xpath
= "./frr-ripd:rip/version-send",
986 .operation
= NB_OP_MODIFY
,
991 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
994 void cli_show_ip_rip_send_version(struct vty
*vty
, struct lyd_node
*dnode
,
997 switch (yang_dnode_get_enum(dnode
, NULL
)) {
999 vty_out(vty
, " no ip rip send version\n");
1001 case RI_RIP_VERSION_1
:
1002 vty_out(vty
, " ip rip send version 1\n");
1004 case RI_RIP_VERSION_2
:
1005 vty_out(vty
, " ip rip send version 2\n");
1007 case RI_RIP_VERSION_1_AND_2
:
1008 vty_out(vty
, " ip rip send version 1 2\n");
1010 case RI_RIP_VERSION_NONE
:
1011 vty_out(vty
, " ip rip send version none\n");
1017 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-scheme
1019 DEFPY (ip_rip_authentication_mode
,
1020 ip_rip_authentication_mode_cmd
,
1021 "ip rip authentication mode <md5$mode [auth-length <rfc|old-ripd>$auth_length]|text$mode>",
1023 "Routing Information Protocol\n"
1024 "Authentication control\n"
1025 "Authentication mode\n"
1026 "Keyed message digest\n"
1027 "MD5 authentication data length\n"
1029 "Old ripd compatible\n"
1030 "Clear text authentication\n")
1032 struct cli_config_change changes
[] = {
1034 .xpath
= "./frr-ripd:rip/authentication-scheme/mode",
1035 .operation
= NB_OP_MODIFY
,
1036 .value
= strmatch(mode
, "md5") ? "md5" : "plain-text",
1039 .xpath
= "./frr-ripd:rip/authentication-scheme/md5-auth-length",
1040 .operation
= NB_OP_MODIFY
,
1045 if (strmatch(auth_length
, "rfc"))
1046 changes
[1].value
= "16";
1048 changes
[1].value
= "20";
1051 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
1054 DEFPY (no_ip_rip_authentication_mode
,
1055 no_ip_rip_authentication_mode_cmd
,
1056 "no ip rip authentication mode [<md5 [auth-length <rfc|old-ripd>]|text>]",
1059 "Routing Information Protocol\n"
1060 "Authentication control\n"
1061 "Authentication mode\n"
1062 "Keyed message digest\n"
1063 "MD5 authentication data length\n"
1065 "Old ripd compatible\n"
1066 "Clear text authentication\n")
1068 struct cli_config_change changes
[] = {
1070 .xpath
= "./frr-ripd:rip/authentication-scheme/mode",
1071 .operation
= NB_OP_MODIFY
,
1074 .xpath
= "./frr-ripd:rip/authentication-scheme/md5-auth-length",
1075 .operation
= NB_OP_MODIFY
,
1079 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
1082 void cli_show_ip_rip_authentication_scheme(struct vty
*vty
,
1083 struct lyd_node
*dnode
,
1086 switch (yang_dnode_get_enum(dnode
, "./mode")) {
1088 vty_out(vty
, " no ip rip authentication mode\n");
1090 case RIP_AUTH_SIMPLE_PASSWORD
:
1091 vty_out(vty
, " ip rip authentication mode text\n");
1094 vty_out(vty
, " ip rip authentication mode md5");
1096 || !yang_dnode_is_default(dnode
, "./md5-auth-length")) {
1097 if (yang_dnode_get_enum(dnode
, "./md5-auth-length")
1098 == RIP_AUTH_MD5_SIZE
)
1099 vty_out(vty
, " auth-length rfc");
1101 vty_out(vty
, " auth-length old-ripd");
1109 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-password
1111 DEFPY (ip_rip_authentication_string
,
1112 ip_rip_authentication_string_cmd
,
1113 "ip rip authentication string LINE$password",
1115 "Routing Information Protocol\n"
1116 "Authentication control\n"
1117 "Authentication string\n"
1118 "Authentication string\n")
1120 struct cli_config_change changes
[] = {
1122 .xpath
= "./frr-ripd:rip/authentication-password",
1123 .operation
= NB_OP_MODIFY
,
1128 if (strlen(password
) > 16) {
1130 "%% RIPv2 authentication string must be shorter than 16\n");
1131 return CMD_WARNING_CONFIG_FAILED
;
1134 if (yang_dnode_exists(vty
->candidate_config
->dnode
, "%s%s",
1136 "/frr-ripd:rip/authentication-key-chain")) {
1137 vty_out(vty
, "%% key-chain configuration exists\n");
1138 return CMD_WARNING_CONFIG_FAILED
;
1141 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
1144 DEFPY (no_ip_rip_authentication_string
,
1145 no_ip_rip_authentication_string_cmd
,
1146 "no ip rip authentication string [LINE]",
1149 "Routing Information Protocol\n"
1150 "Authentication control\n"
1151 "Authentication string\n"
1152 "Authentication string\n")
1154 struct cli_config_change changes
[] = {
1156 .xpath
= "./frr-ripd:rip/authentication-password",
1157 .operation
= NB_OP_DELETE
,
1161 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
1164 void cli_show_ip_rip_authentication_string(struct vty
*vty
,
1165 struct lyd_node
*dnode
,
1168 vty_out(vty
, " ip rip authentication string %s\n",
1169 yang_dnode_get_string(dnode
, NULL
));
1173 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-key-chain
1175 DEFPY (ip_rip_authentication_key_chain
,
1176 ip_rip_authentication_key_chain_cmd
,
1177 "ip rip authentication key-chain LINE$keychain",
1179 "Routing Information Protocol\n"
1180 "Authentication control\n"
1181 "Authentication key-chain\n"
1182 "name of key-chain\n")
1184 struct cli_config_change changes
[] = {
1186 .xpath
= "./frr-ripd:rip/authentication-key-chain",
1187 .operation
= NB_OP_MODIFY
,
1192 if (yang_dnode_exists(vty
->candidate_config
->dnode
, "%s%s",
1194 "/frr-ripd:rip/authentication-password")) {
1195 vty_out(vty
, "%% authentication string configuration exists\n");
1196 return CMD_WARNING_CONFIG_FAILED
;
1199 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
1202 DEFPY (no_ip_rip_authentication_key_chain
,
1203 no_ip_rip_authentication_key_chain_cmd
,
1204 "no ip rip authentication key-chain [LINE]",
1207 "Routing Information Protocol\n"
1208 "Authentication control\n"
1209 "Authentication key-chain\n"
1210 "name of key-chain\n")
1212 struct cli_config_change changes
[] = {
1214 .xpath
= "./frr-ripd:rip/authentication-key-chain",
1215 .operation
= NB_OP_DELETE
,
1219 return nb_cli_cfg_change(vty
, NULL
, changes
, array_size(changes
));
1222 void cli_show_ip_rip_authentication_key_chain(struct vty
*vty
,
1223 struct lyd_node
*dnode
,
1226 vty_out(vty
, " ip rip authentication key-chain %s\n",
1227 yang_dnode_get_string(dnode
, NULL
));
1231 * XPath: /frr-ripd:clear-rip-route
1233 DEFPY (clear_ip_rip
,
1238 "Clear IP RIP database\n")
1240 return nb_cli_rpc("/frr-ripd:clear-rip-route", NULL
, NULL
);
1243 void rip_cli_init(void)
1245 install_element(CONFIG_NODE
, &router_rip_cmd
);
1246 install_element(CONFIG_NODE
, &no_router_rip_cmd
);
1248 install_element(RIP_NODE
, &rip_allow_ecmp_cmd
);
1249 install_element(RIP_NODE
, &rip_default_information_originate_cmd
);
1250 install_element(RIP_NODE
, &rip_default_metric_cmd
);
1251 install_element(RIP_NODE
, &no_rip_default_metric_cmd
);
1252 install_element(RIP_NODE
, &rip_distance_cmd
);
1253 install_element(RIP_NODE
, &no_rip_distance_cmd
);
1254 install_element(RIP_NODE
, &rip_distance_source_cmd
);
1255 install_element(RIP_NODE
, &no_rip_distance_source_cmd
);
1256 install_element(RIP_NODE
, &rip_neighbor_cmd
);
1257 install_element(RIP_NODE
, &rip_network_prefix_cmd
);
1258 install_element(RIP_NODE
, &rip_network_if_cmd
);
1259 install_element(RIP_NODE
, &rip_offset_list_cmd
);
1260 install_element(RIP_NODE
, &no_rip_offset_list_cmd
);
1261 install_element(RIP_NODE
, &rip_passive_default_cmd
);
1262 install_element(RIP_NODE
, &rip_passive_interface_cmd
);
1263 install_element(RIP_NODE
, &rip_redistribute_cmd
);
1264 install_element(RIP_NODE
, &no_rip_redistribute_cmd
);
1265 install_element(RIP_NODE
, &rip_route_cmd
);
1266 install_element(RIP_NODE
, &rip_timers_cmd
);
1267 install_element(RIP_NODE
, &no_rip_timers_cmd
);
1268 install_element(RIP_NODE
, &rip_version_cmd
);
1269 install_element(RIP_NODE
, &no_rip_version_cmd
);
1271 install_element(INTERFACE_NODE
, &ip_rip_split_horizon_cmd
);
1272 install_element(INTERFACE_NODE
, &ip_rip_v2_broadcast_cmd
);
1273 install_element(INTERFACE_NODE
, &ip_rip_receive_version_cmd
);
1274 install_element(INTERFACE_NODE
, &no_ip_rip_receive_version_cmd
);
1275 install_element(INTERFACE_NODE
, &ip_rip_send_version_cmd
);
1276 install_element(INTERFACE_NODE
, &no_ip_rip_send_version_cmd
);
1277 install_element(INTERFACE_NODE
, &ip_rip_authentication_mode_cmd
);
1278 install_element(INTERFACE_NODE
, &no_ip_rip_authentication_mode_cmd
);
1279 install_element(INTERFACE_NODE
, &ip_rip_authentication_string_cmd
);
1280 install_element(INTERFACE_NODE
, &no_ip_rip_authentication_string_cmd
);
1281 install_element(INTERFACE_NODE
, &ip_rip_authentication_key_chain_cmd
);
1282 install_element(INTERFACE_NODE
,
1283 &no_ip_rip_authentication_key_chain_cmd
);
1285 install_element(ENABLE_NODE
, &clear_ip_rip_cmd
);