2 * EIGRP daemon CLI implementation.
4 * Copyright (C) 2019 Network Device Education Foundation, Inc. ("NetDEF")
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include "lib/command.h"
27 #include "lib/northbound_cli.h"
29 #include "eigrp_structs.h"
31 #include "eigrp_zebra.h"
33 #ifndef VTYSH_EXTRACT_PL
34 #include "eigrpd/eigrp_cli_clippy.c"
35 #endif /* VTYSH_EXTRACT_PL */
38 * XPath: /frr-eigrpd:eigrpd/instance
43 "router eigrp (1-65535)$as [vrf NAME]",
49 char xpath
[XPATH_MAXLEN
];
52 snprintf(xpath
, sizeof(xpath
),
53 "/frr-eigrpd:eigrpd/instance[asn='%s'][vrf='%s']",
54 as_str
, vrf
? vrf
: VRF_DEFAULT_NAME
);
56 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
57 rv
= nb_cli_apply_changes(vty
, NULL
);
58 if (rv
== CMD_SUCCESS
)
59 VTY_PUSH_XPATH(EIGRP_NODE
, xpath
);
67 "no router eigrp (1-65535)$as [vrf NAME]",
74 char xpath
[XPATH_MAXLEN
];
76 snprintf(xpath
, sizeof(xpath
),
77 "/frr-eigrpd:eigrpd/instance[asn='%s'][vrf='%s']",
78 as_str
, vrf
? vrf
: VRF_DEFAULT_NAME
);
80 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
81 return nb_cli_apply_changes(vty
, NULL
);
84 void eigrp_cli_show_header(struct vty
*vty
, struct lyd_node
*dnode
,
87 const char *asn
= yang_dnode_get_string(dnode
, "./asn");
88 const char *vrf
= yang_dnode_get_string(dnode
, "./vrf");
90 vty_out(vty
, "router eigrp %s", asn
);
91 if (strcmp(vrf
, VRF_DEFAULT_NAME
))
92 vty_out(vty
, " vrf %s", vrf
);
96 void eigrp_cli_show_end_header(struct vty
*vty
, struct lyd_node
*dnode
)
102 * XPath: /frr-eigrpd:eigrpd/instance/router-id
107 "eigrp router-id A.B.C.D$addr",
109 "Router ID for this EIGRP process\n"
110 "EIGRP Router-ID in IP address format\n")
112 nb_cli_enqueue_change(vty
, "./router-id", NB_OP_MODIFY
, addr_str
);
113 return nb_cli_apply_changes(vty
, NULL
);
118 no_eigrp_router_id_cmd
,
119 "no eigrp router-id [A.B.C.D]",
122 "Router ID for this EIGRP process\n"
123 "EIGRP Router-ID in IP address format\n")
125 nb_cli_enqueue_change(vty
, "./router-id", NB_OP_DESTROY
, NULL
);
126 return nb_cli_apply_changes(vty
, NULL
);
129 void eigrp_cli_show_router_id(struct vty
*vty
, struct lyd_node
*dnode
,
132 const char *router_id
= yang_dnode_get_string(dnode
, NULL
);
134 vty_out(vty
, " eigrp router-id %s\n", router_id
);
138 * XPath: /frr-eigrpd:eigrpd/instance/passive-interface
141 eigrp_passive_interface
,
142 eigrp_passive_interface_cmd
,
143 "[no] passive-interface IFNAME",
145 "Suppress routing updates on an interface\n"
146 "Interface to suppress on\n")
149 nb_cli_enqueue_change(vty
, "./passive-interface",
150 NB_OP_DESTROY
, ifname
);
152 nb_cli_enqueue_change(vty
, "./passive-interface",
153 NB_OP_CREATE
, ifname
);
155 return nb_cli_apply_changes(vty
, NULL
);
158 void eigrp_cli_show_passive_interface(struct vty
*vty
, struct lyd_node
*dnode
,
161 const char *ifname
= yang_dnode_get_string(dnode
, NULL
);
163 vty_out(vty
, " passive-interface %s\n", ifname
);
167 * XPath: /frr-eigrpd:eigrpd/instance/active-time
171 eigrp_timers_active_cmd
,
172 "timers active-time <(1-65535)$timer|disabled$disabled>",
173 "Adjust routing timers\n"
174 "Time limit for active state\n"
175 "Active state time limit in seconds\n"
176 "Disable time limit for active state\n")
179 nb_cli_enqueue_change(vty
, "./active-time", NB_OP_MODIFY
, "0");
181 nb_cli_enqueue_change(vty
, "./active-time",
182 NB_OP_MODIFY
, timer_str
);
184 return nb_cli_apply_changes(vty
, NULL
);
188 no_eigrp_timers_active
,
189 no_eigrp_timers_active_cmd
,
190 "no timers active-time [<(1-65535)|disabled>]",
192 "Adjust routing timers\n"
193 "Time limit for active state\n"
194 "Active state time limit in seconds\n"
195 "Disable time limit for active state\n")
197 nb_cli_enqueue_change(vty
, "./active-time", NB_OP_DESTROY
, NULL
);
198 return nb_cli_apply_changes(vty
, NULL
);
201 void eigrp_cli_show_active_time(struct vty
*vty
, struct lyd_node
*dnode
,
204 const char *timer
= yang_dnode_get_string(dnode
, NULL
);
206 vty_out(vty
, " timers active-time %s\n", timer
);
210 * XPath: /frr-eigrpd:eigrpd/instance/variance
215 "variance (1-128)$variance",
216 "Control load balancing variance\n"
217 "Metric variance multiplier\n")
219 nb_cli_enqueue_change(vty
, "./variance", NB_OP_MODIFY
, variance_str
);
220 return nb_cli_apply_changes(vty
, NULL
);
225 no_eigrp_variance_cmd
,
226 "no variance [(1-128)]",
228 "Control load balancing variance\n"
229 "Metric variance multiplier\n")
231 nb_cli_enqueue_change(vty
, "./variance", NB_OP_DESTROY
, NULL
);
232 return nb_cli_apply_changes(vty
, NULL
);
235 void eigrp_cli_show_variance(struct vty
*vty
, struct lyd_node
*dnode
,
238 const char *variance
= yang_dnode_get_string(dnode
, NULL
);
240 vty_out(vty
, " variance %s\n", variance
);
244 * XPath: /frr-eigrpd:eigrpd/instance/maximum-paths
248 eigrp_maximum_paths_cmd
,
249 "maximum-paths (1-32)$maximum_paths",
250 "Forward packets over multiple paths\n"
253 nb_cli_enqueue_change(vty
, "./maximum-paths", NB_OP_MODIFY
,
255 return nb_cli_apply_changes(vty
, NULL
);
259 no_eigrp_maximum_paths
,
260 no_eigrp_maximum_paths_cmd
,
261 "no maximum-paths [(1-32)]",
263 "Forward packets over multiple paths\n"
266 nb_cli_enqueue_change(vty
, "./maximum-paths", NB_OP_DESTROY
, NULL
);
267 return nb_cli_apply_changes(vty
, NULL
);
270 void eigrp_cli_show_maximum_paths(struct vty
*vty
, struct lyd_node
*dnode
,
273 const char *maximum_paths
= yang_dnode_get_string(dnode
, NULL
);
275 vty_out(vty
, " maximum-paths %s\n", maximum_paths
);
279 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K1
280 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K2
281 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K3
282 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K4
283 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K5
284 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K6
287 eigrp_metric_weights
,
288 eigrp_metric_weights_cmd
,
289 "metric weights (0-255)$k1 (0-255)$k2 (0-255)$k3 (0-255)$k4 (0-255)$k5 [(0-255)$k6]",
290 "Modify metrics and parameters for advertisement\n"
291 "Modify metric coefficients\n"
299 nb_cli_enqueue_change(vty
, "./metric-weights/K1", NB_OP_MODIFY
, k1_str
);
300 nb_cli_enqueue_change(vty
, "./metric-weights/K2", NB_OP_MODIFY
, k2_str
);
301 nb_cli_enqueue_change(vty
, "./metric-weights/K3", NB_OP_MODIFY
, k3_str
);
302 nb_cli_enqueue_change(vty
, "./metric-weights/K4", NB_OP_MODIFY
, k4_str
);
303 nb_cli_enqueue_change(vty
, "./metric-weights/K5", NB_OP_MODIFY
, k5_str
);
305 nb_cli_enqueue_change(vty
, "./metric-weights/K6",
306 NB_OP_MODIFY
, k6_str
);
308 return nb_cli_apply_changes(vty
, NULL
);
312 no_eigrp_metric_weights
,
313 no_eigrp_metric_weights_cmd
,
314 "no metric weights [(0-255) (0-255) (0-255) (0-255) (0-255) (0-255)]",
316 "Modify metrics and parameters for advertisement\n"
317 "Modify metric coefficients\n"
325 nb_cli_enqueue_change(vty
, "./metric-weights/K1", NB_OP_DESTROY
, NULL
);
326 nb_cli_enqueue_change(vty
, "./metric-weights/K2", NB_OP_DESTROY
, NULL
);
327 nb_cli_enqueue_change(vty
, "./metric-weights/K3", NB_OP_DESTROY
, NULL
);
328 nb_cli_enqueue_change(vty
, "./metric-weights/K4", NB_OP_DESTROY
, NULL
);
329 nb_cli_enqueue_change(vty
, "./metric-weights/K5", NB_OP_DESTROY
, NULL
);
330 nb_cli_enqueue_change(vty
, "./metric-weights/K6", NB_OP_DESTROY
, NULL
);
331 return nb_cli_apply_changes(vty
, NULL
);
334 void eigrp_cli_show_metrics(struct vty
*vty
, struct lyd_node
*dnode
,
337 const char *k1
, *k2
, *k3
, *k4
, *k5
, *k6
;
339 k1
= yang_dnode_exists(dnode
, "./K1") ?
340 yang_dnode_get_string(dnode
, "./K1") : "0";
341 k2
= yang_dnode_exists(dnode
, "./K2") ?
342 yang_dnode_get_string(dnode
, "./K2") : "0";
343 k3
= yang_dnode_exists(dnode
, "./K3") ?
344 yang_dnode_get_string(dnode
, "./K3") : "0";
345 k4
= yang_dnode_exists(dnode
, "./K4") ?
346 yang_dnode_get_string(dnode
, "./K4") : "0";
347 k5
= yang_dnode_exists(dnode
, "./K5") ?
348 yang_dnode_get_string(dnode
, "./K5") : "0";
349 k6
= yang_dnode_exists(dnode
, "./K6") ?
350 yang_dnode_get_string(dnode
, "./K6") : "0";
352 vty_out(vty
, " metric weights %s %s %s %s %s",
355 vty_out(vty
, " %s", k6
);
360 * XPath: /frr-eigrpd:eigrpd/instance/network
365 "[no] network A.B.C.D/M$prefix",
367 "Enable routing on an IP network\n"
368 "EIGRP network prefix\n")
371 nb_cli_enqueue_change(vty
, "./network", NB_OP_DESTROY
,
374 nb_cli_enqueue_change(vty
, "./network", NB_OP_CREATE
,
377 return nb_cli_apply_changes(vty
, NULL
);
380 void eigrp_cli_show_network(struct vty
*vty
, struct lyd_node
*dnode
,
383 const char *prefix
= yang_dnode_get_string(dnode
, NULL
);
385 vty_out(vty
, " network %s\n", prefix
);
389 * XPath: /frr-eigrpd:eigrpd/instance/neighbor
394 "[no] neighbor A.B.C.D$addr",
396 "Specify a neighbor router\n"
397 "Neighbor address\n")
400 nb_cli_enqueue_change(vty
, "./neighbor", NB_OP_DESTROY
,
403 nb_cli_enqueue_change(vty
, "./neighbor", NB_OP_CREATE
,
406 return nb_cli_apply_changes(vty
, NULL
);
409 void eigrp_cli_show_neighbor(struct vty
*vty
, struct lyd_node
*dnode
,
412 const char *prefix
= yang_dnode_get_string(dnode
, NULL
);
414 vty_out(vty
, " neighbor %s\n", prefix
);
418 * XPath: /frr-eigrpd:eigrpd/instance/redistribute
419 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/route-map
420 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/bandwidth
421 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/delay
422 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/reliability
423 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/load
424 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/mtu
427 eigrp_redistribute_source_metric
,
428 eigrp_redistribute_source_metric_cmd
,
429 "[no] redistribute " FRR_REDIST_STR_EIGRPD
430 "$proto [metric (1-4294967295)$bw (0-4294967295)$delay (0-255)$rlbt (1-255)$load (1-65535)$mtu]",
433 FRR_REDIST_HELP_STR_EIGRPD
434 "Metric for redistributed routes\n"
435 "Bandwidth metric in Kbits per second\n"
436 "EIGRP delay metric, in 10 microsecond units\n"
437 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
438 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
439 "EIGRP MTU of the path\n")
441 char xpath
[XPATH_MAXLEN
], xpath_metric
[XPATH_MAXLEN
+ 64];
443 snprintf(xpath
, sizeof(xpath
), "./redistribute[protocol='%s']", proto
);
446 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
447 return nb_cli_apply_changes(vty
, NULL
);
450 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
451 if (bw
== 0 || delay
== 0 || rlbt
== 0 || load
== 0 || mtu
== 0)
452 return nb_cli_apply_changes(vty
, NULL
);
454 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/bandwidth",
456 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, bw_str
);
457 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/delay", xpath
);
458 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, delay_str
);
459 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/reliability",
461 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, rlbt_str
);
462 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/load", xpath
);
463 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, load_str
);
464 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/mtu", xpath
);
465 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, mtu_str
);
466 return nb_cli_apply_changes(vty
, NULL
);
469 void eigrp_cli_show_redistribute(struct vty
*vty
, struct lyd_node
*dnode
,
472 const char *proto
= yang_dnode_get_string(dnode
, "./protocol");
473 const char *bw
, *delay
, *load
, *mtu
, *rlbt
;
475 bw
= yang_dnode_exists(dnode
, "./metrics/bandwidth") ?
476 yang_dnode_get_string(dnode
, "./metrics/bandwidth") : NULL
;
477 delay
= yang_dnode_exists(dnode
, "./metrics/delay") ?
478 yang_dnode_get_string(dnode
, "./metrics/delay") : NULL
;
479 rlbt
= yang_dnode_exists(dnode
, "./metrics/reliability") ?
480 yang_dnode_get_string(dnode
, "./metrics/reliability") : NULL
;
481 load
= yang_dnode_exists(dnode
, "./metrics/load") ?
482 yang_dnode_get_string(dnode
, "./metrics/load") : NULL
;
483 mtu
= yang_dnode_exists(dnode
, "./metrics/mtu") ?
484 yang_dnode_get_string(dnode
, "./metrics/mtu") : NULL
;
486 vty_out(vty
, " redistribute %s", proto
);
487 if (bw
|| rlbt
|| delay
|| load
|| mtu
)
488 vty_out(vty
, " metric %s %s %s %s %s", bw
, delay
, rlbt
, load
,
494 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/delay
499 "delay (1-16777215)$delay",
500 "Specify interface throughput delay\n"
501 "Throughput delay (tens of microseconds)\n")
503 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/delay",
504 NB_OP_MODIFY
, delay_str
);
505 return nb_cli_apply_changes(vty
, NULL
);
510 no_eigrp_if_delay_cmd
,
511 "no delay [(1-16777215)]",
513 "Specify interface throughput delay\n"
514 "Throughput delay (tens of microseconds)\n")
516 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/delay",
517 NB_OP_DESTROY
, NULL
);
518 return nb_cli_apply_changes(vty
, NULL
);
521 void eigrp_cli_show_delay(struct vty
*vty
, struct lyd_node
*dnode
,
524 const char *delay
= yang_dnode_get_string(dnode
, NULL
);
526 vty_out(vty
, " delay %s\n", delay
);
530 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/bandwidth
534 eigrp_if_bandwidth_cmd
,
535 "eigrp bandwidth (1-10000000)$bw",
537 "Set bandwidth informational parameter\n"
538 "Bandwidth in kilobits\n")
540 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/bandwidth",
541 NB_OP_MODIFY
, bw_str
);
542 return nb_cli_apply_changes(vty
, NULL
);
546 no_eigrp_if_bandwidth
,
547 no_eigrp_if_bandwidth_cmd
,
548 "no eigrp bandwidth [(1-10000000)]",
551 "Set bandwidth informational parameter\n"
552 "Bandwidth in kilobits\n")
554 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/bandwidth",
555 NB_OP_DESTROY
, NULL
);
556 return nb_cli_apply_changes(vty
, NULL
);
559 void eigrp_cli_show_bandwidth(struct vty
*vty
, struct lyd_node
*dnode
,
562 const char *bandwidth
= yang_dnode_get_string(dnode
, NULL
);
564 vty_out(vty
, " eigrp bandwidth %s\n", bandwidth
);
568 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/hello-interval
571 eigrp_if_ip_hellointerval
,
572 eigrp_if_ip_hellointerval_cmd
,
573 "ip hello-interval eigrp (1-65535)$hello",
574 "Interface Internet Protocol config commands\n"
575 "Configures EIGRP hello interval\n"
577 "Seconds between hello transmissions\n")
579 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hello-interval",
580 NB_OP_MODIFY
, hello_str
);
581 return nb_cli_apply_changes(vty
, NULL
);
585 no_eigrp_if_ip_hellointerval
,
586 no_eigrp_if_ip_hellointerval_cmd
,
587 "no ip hello-interval eigrp [(1-65535)]",
589 "Interface Internet Protocol config commands\n"
590 "Configures EIGRP hello interval\n"
592 "Seconds between hello transmissions\n")
594 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hello-interval",
595 NB_OP_DESTROY
, NULL
);
596 return nb_cli_apply_changes(vty
, NULL
);
600 void eigrp_cli_show_hello_interval(struct vty
*vty
, struct lyd_node
*dnode
,
603 const char *hello
= yang_dnode_get_string(dnode
, NULL
);
605 vty_out(vty
, " ip hello-interval eigrp %s\n", hello
);
609 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/hold-time
612 eigrp_if_ip_holdinterval
,
613 eigrp_if_ip_holdinterval_cmd
,
614 "ip hold-time eigrp (1-65535)$hold",
615 "Interface Internet Protocol config commands\n"
616 "Configures EIGRP IPv4 hold time\n"
618 "Seconds before neighbor is considered down\n")
620 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hold-time",
621 NB_OP_MODIFY
, hold_str
);
622 return nb_cli_apply_changes(vty
, NULL
);
626 no_eigrp_if_ip_holdinterval
,
627 no_eigrp_if_ip_holdinterval_cmd
,
628 "no ip hold-time eigrp [(1-65535)]",
630 "Interface Internet Protocol config commands\n"
631 "Configures EIGRP IPv4 hold time\n"
633 "Seconds before neighbor is considered down\n")
635 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hold-time",
636 NB_OP_DESTROY
, NULL
);
637 return nb_cli_apply_changes(vty
, NULL
);
640 void eigrp_cli_show_hold_time(struct vty
*vty
, struct lyd_node
*dnode
,
643 const char *holdtime
= yang_dnode_get_string(dnode
, NULL
);
645 vty_out(vty
, " ip hold-time eigrp %s\n", holdtime
);
649 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/split-horizon
651 /* NOT implemented. */
654 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
655 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/summarize-addresses
658 eigrp_ip_summary_address
,
659 eigrp_ip_summary_address_cmd
,
660 "ip summary-address eigrp (1-65535)$as A.B.C.D/M$prefix",
661 "Interface Internet Protocol config commands\n"
662 "Perform address summarization\n"
665 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
667 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
669 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
671 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
673 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/summarize-address", xpath
);
674 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_CREATE
, prefix_str
);
676 return nb_cli_apply_changes(vty
, NULL
);
680 no_eigrp_ip_summary_address
,
681 no_eigrp_ip_summary_address_cmd
,
682 "no ip summary-address eigrp (1-65535)$as A.B.C.D/M$prefix",
684 "Interface Internet Protocol config commands\n"
685 "Perform address summarization\n"
688 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
690 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
692 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
694 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
696 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/summarize-address", xpath
);
697 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_DESTROY
, prefix_str
);
699 return nb_cli_apply_changes(vty
, NULL
);
702 void eigrp_cli_show_summarize_address(struct vty
*vty
, struct lyd_node
*dnode
,
705 const struct eigrp_interface
*eif
= nb_running_get_entry(dnode
, NULL
,
707 const char *summarize_address
= yang_dnode_get_string(dnode
, NULL
);
709 vty_out(vty
, " ip summary-address eigrp %d %s\n",
710 eif
->eigrp
->AS
, summarize_address
);
714 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
715 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/authentication
718 eigrp_authentication_mode
,
719 eigrp_authentication_mode_cmd
,
720 "ip authentication mode eigrp (1-65535)$as <md5|hmac-sha-256>$crypt",
721 "Interface Internet Protocol config commands\n"
722 "Authentication subcommands\n"
726 "Keyed message digest\n"
727 "HMAC SHA256 algorithm \n")
729 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
731 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
733 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
735 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/authentication", xpath
);
736 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, crypt
);
738 return nb_cli_apply_changes(vty
, NULL
);
742 no_eigrp_authentication_mode
,
743 no_eigrp_authentication_mode_cmd
,
744 "no ip authentication mode eigrp (1-65535)$as [<md5|hmac-sha-256>]",
746 "Interface Internet Protocol config commands\n"
747 "Authentication subcommands\n"
751 "Keyed message digest\n"
752 "HMAC SHA256 algorithm \n")
754 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
756 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
758 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
760 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/authentication", xpath
);
761 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, "none");
763 return nb_cli_apply_changes(vty
, NULL
);
766 void eigrp_cli_show_authentication(struct vty
*vty
, struct lyd_node
*dnode
,
769 const struct eigrp_interface
*eif
= nb_running_get_entry(dnode
, NULL
,
771 const char *crypt
= yang_dnode_get_string(dnode
, NULL
);
773 vty_out(vty
, " ip authentication mode eigrp %d %s\n",
774 eif
->eigrp
->AS
, crypt
);
778 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
779 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/keychain
782 eigrp_authentication_keychain
,
783 eigrp_authentication_keychain_cmd
,
784 "ip authentication key-chain eigrp (1-65535)$as WORD$name",
785 "Interface Internet Protocol config commands\n"
786 "Authentication subcommands\n"
790 "Name of key-chain\n")
792 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
794 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
796 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
798 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/keychain", xpath
);
799 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, name
);
801 return nb_cli_apply_changes(vty
, NULL
);
805 no_eigrp_authentication_keychain
,
806 no_eigrp_authentication_keychain_cmd
,
807 "no ip authentication key-chain eigrp (1-65535)$as [WORD]",
809 "Interface Internet Protocol config commands\n"
810 "Authentication subcommands\n"
814 "Name of key-chain\n")
816 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
818 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
820 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/keychain", xpath
);
821 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_DESTROY
, NULL
);
823 return nb_cli_apply_changes(vty
, NULL
);
826 void eigrp_cli_show_keychain(struct vty
*vty
, struct lyd_node
*dnode
,
829 const struct eigrp_interface
*eif
= nb_running_get_entry(dnode
, NULL
,
831 const char *keychain
= yang_dnode_get_string(dnode
, NULL
);
833 vty_out(vty
, " ip authentication key-chain eigrp %d %s\n",
834 eif
->eigrp
->AS
, keychain
);
839 * CLI installation procedures.
841 static int eigrp_config_write(struct vty
*vty
);
842 static struct cmd_node eigrp_node
= {
845 .parent_node
= CONFIG_NODE
,
846 .prompt
= "%s(config-router)# ",
847 .config_write
= eigrp_config_write
,
850 static int eigrp_config_write(struct vty
*vty
)
852 struct lyd_node
*dnode
;
855 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-eigrpd:eigrpd");
857 nb_cli_show_dnode_cmds(vty
, dnode
, false);
864 static int eigrp_write_interface(struct vty
*vty
);
865 static struct cmd_node eigrp_interface_node
= {
867 .node
= INTERFACE_NODE
,
868 .parent_node
= CONFIG_NODE
,
869 .prompt
= "%s(config-if)# ",
870 .config_write
= eigrp_write_interface
,
874 static int eigrp_write_interface(struct vty
*vty
)
876 struct lyd_node
*dnode
;
877 struct interface
*ifp
;
881 RB_FOREACH(vrf
, vrf_name_head
, &vrfs_by_name
) {
882 FOR_ALL_INTERFACES(vrf
, ifp
) {
883 dnode
= yang_dnode_get(
884 running_config
->dnode
,
885 "/frr-interface:lib/interface[name='%s'][vrf='%s']",
886 ifp
->name
, vrf
->name
);
891 nb_cli_show_dnode_cmds(vty
, dnode
, false);
901 install_element(CONFIG_NODE
, &router_eigrp_cmd
);
902 install_element(CONFIG_NODE
, &no_router_eigrp_cmd
);
904 install_node(&eigrp_node
);
905 install_default(EIGRP_NODE
);
907 install_element(EIGRP_NODE
, &eigrp_router_id_cmd
);
908 install_element(EIGRP_NODE
, &no_eigrp_router_id_cmd
);
909 install_element(EIGRP_NODE
, &eigrp_passive_interface_cmd
);
910 install_element(EIGRP_NODE
, &eigrp_timers_active_cmd
);
911 install_element(EIGRP_NODE
, &no_eigrp_timers_active_cmd
);
912 install_element(EIGRP_NODE
, &eigrp_variance_cmd
);
913 install_element(EIGRP_NODE
, &no_eigrp_variance_cmd
);
914 install_element(EIGRP_NODE
, &eigrp_maximum_paths_cmd
);
915 install_element(EIGRP_NODE
, &no_eigrp_maximum_paths_cmd
);
916 install_element(EIGRP_NODE
, &eigrp_metric_weights_cmd
);
917 install_element(EIGRP_NODE
, &no_eigrp_metric_weights_cmd
);
918 install_element(EIGRP_NODE
, &eigrp_network_cmd
);
919 install_element(EIGRP_NODE
, &eigrp_neighbor_cmd
);
920 install_element(EIGRP_NODE
, &eigrp_redistribute_source_metric_cmd
);
922 install_node(&eigrp_interface_node
);
925 install_element(INTERFACE_NODE
, &eigrp_if_delay_cmd
);
926 install_element(INTERFACE_NODE
, &no_eigrp_if_delay_cmd
);
927 install_element(INTERFACE_NODE
, &eigrp_if_bandwidth_cmd
);
928 install_element(INTERFACE_NODE
, &no_eigrp_if_bandwidth_cmd
);
929 install_element(INTERFACE_NODE
, &eigrp_if_ip_hellointerval_cmd
);
930 install_element(INTERFACE_NODE
, &no_eigrp_if_ip_hellointerval_cmd
);
931 install_element(INTERFACE_NODE
, &eigrp_if_ip_holdinterval_cmd
);
932 install_element(INTERFACE_NODE
, &no_eigrp_if_ip_holdinterval_cmd
);
933 install_element(INTERFACE_NODE
, &eigrp_ip_summary_address_cmd
);
934 install_element(INTERFACE_NODE
, &no_eigrp_ip_summary_address_cmd
);
935 install_element(INTERFACE_NODE
, &eigrp_authentication_mode_cmd
);
936 install_element(INTERFACE_NODE
, &no_eigrp_authentication_mode_cmd
);
937 install_element(INTERFACE_NODE
, &eigrp_authentication_keychain_cmd
);
938 install_element(INTERFACE_NODE
, &no_eigrp_authentication_keychain_cmd
);