1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * EIGRP daemon CLI implementation.
5 * Copyright (C) 2019 Network Device Education Foundation, Inc. ("NetDEF")
11 #include "lib/command.h"
13 #include "lib/northbound_cli.h"
15 #include "eigrp_structs.h"
17 #include "eigrp_zebra.h"
18 #include "eigrp_cli.h"
20 #include "eigrpd/eigrp_cli_clippy.c"
23 * XPath: /frr-eigrpd:eigrpd/instance
28 "router eigrp (1-65535)$as [vrf NAME]",
34 char xpath
[XPATH_MAXLEN
];
37 snprintf(xpath
, sizeof(xpath
),
38 "/frr-eigrpd:eigrpd/instance[asn='%s'][vrf='%s']",
39 as_str
, vrf
? vrf
: VRF_DEFAULT_NAME
);
41 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
42 rv
= nb_cli_apply_changes(vty
, NULL
);
43 if (rv
== CMD_SUCCESS
)
44 VTY_PUSH_XPATH(EIGRP_NODE
, xpath
);
52 "no router eigrp (1-65535)$as [vrf NAME]",
59 char xpath
[XPATH_MAXLEN
];
61 snprintf(xpath
, sizeof(xpath
),
62 "/frr-eigrpd:eigrpd/instance[asn='%s'][vrf='%s']",
63 as_str
, vrf
? vrf
: VRF_DEFAULT_NAME
);
65 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
66 return nb_cli_apply_changes_clear_pending(vty
, NULL
);
69 void eigrp_cli_show_header(struct vty
*vty
, const struct lyd_node
*dnode
,
72 const char *asn
= yang_dnode_get_string(dnode
, "./asn");
73 const char *vrf
= yang_dnode_get_string(dnode
, "./vrf");
75 vty_out(vty
, "router eigrp %s", asn
);
76 if (strcmp(vrf
, VRF_DEFAULT_NAME
))
77 vty_out(vty
, " vrf %s", vrf
);
81 void eigrp_cli_show_end_header(struct vty
*vty
, const struct lyd_node
*dnode
)
83 vty_out(vty
, "exit\n");
88 * XPath: /frr-eigrpd:eigrpd/instance/router-id
93 "eigrp router-id A.B.C.D$addr",
95 "Router ID for this EIGRP process\n"
96 "EIGRP Router-ID in IP address format\n")
98 nb_cli_enqueue_change(vty
, "./router-id", NB_OP_MODIFY
, addr_str
);
99 return nb_cli_apply_changes(vty
, NULL
);
104 no_eigrp_router_id_cmd
,
105 "no eigrp router-id [A.B.C.D]",
108 "Router ID for this EIGRP process\n"
109 "EIGRP Router-ID in IP address format\n")
111 nb_cli_enqueue_change(vty
, "./router-id", NB_OP_DESTROY
, NULL
);
112 return nb_cli_apply_changes(vty
, NULL
);
115 void eigrp_cli_show_router_id(struct vty
*vty
, const struct lyd_node
*dnode
,
118 const char *router_id
= yang_dnode_get_string(dnode
, NULL
);
120 vty_out(vty
, " eigrp router-id %s\n", router_id
);
124 * XPath: /frr-eigrpd:eigrpd/instance/passive-interface
127 eigrp_passive_interface
,
128 eigrp_passive_interface_cmd
,
129 "[no] passive-interface IFNAME",
131 "Suppress routing updates on an interface\n"
132 "Interface to suppress on\n")
135 nb_cli_enqueue_change(vty
, "./passive-interface",
136 NB_OP_DESTROY
, ifname
);
138 nb_cli_enqueue_change(vty
, "./passive-interface",
139 NB_OP_CREATE
, ifname
);
141 return nb_cli_apply_changes(vty
, NULL
);
144 void eigrp_cli_show_passive_interface(struct vty
*vty
,
145 const struct lyd_node
*dnode
,
148 const char *ifname
= yang_dnode_get_string(dnode
, NULL
);
150 vty_out(vty
, " passive-interface %s\n", ifname
);
154 * XPath: /frr-eigrpd:eigrpd/instance/active-time
158 eigrp_timers_active_cmd
,
159 "timers active-time <(1-65535)$timer|disabled$disabled>",
160 "Adjust routing timers\n"
161 "Time limit for active state\n"
162 "Active state time limit in seconds\n"
163 "Disable time limit for active state\n")
166 nb_cli_enqueue_change(vty
, "./active-time", NB_OP_MODIFY
, "0");
168 nb_cli_enqueue_change(vty
, "./active-time",
169 NB_OP_MODIFY
, timer_str
);
171 return nb_cli_apply_changes(vty
, NULL
);
175 no_eigrp_timers_active
,
176 no_eigrp_timers_active_cmd
,
177 "no timers active-time [<(1-65535)|disabled>]",
179 "Adjust routing timers\n"
180 "Time limit for active state\n"
181 "Active state time limit in seconds\n"
182 "Disable time limit for active state\n")
184 nb_cli_enqueue_change(vty
, "./active-time", NB_OP_DESTROY
, NULL
);
185 return nb_cli_apply_changes(vty
, NULL
);
188 void eigrp_cli_show_active_time(struct vty
*vty
, const struct lyd_node
*dnode
,
191 const char *timer
= yang_dnode_get_string(dnode
, NULL
);
193 vty_out(vty
, " timers active-time %s\n", timer
);
197 * XPath: /frr-eigrpd:eigrpd/instance/variance
202 "variance (1-128)$variance",
203 "Control load balancing variance\n"
204 "Metric variance multiplier\n")
206 nb_cli_enqueue_change(vty
, "./variance", NB_OP_MODIFY
, variance_str
);
207 return nb_cli_apply_changes(vty
, NULL
);
212 no_eigrp_variance_cmd
,
213 "no variance [(1-128)]",
215 "Control load balancing variance\n"
216 "Metric variance multiplier\n")
218 nb_cli_enqueue_change(vty
, "./variance", NB_OP_DESTROY
, NULL
);
219 return nb_cli_apply_changes(vty
, NULL
);
222 void eigrp_cli_show_variance(struct vty
*vty
, const struct lyd_node
*dnode
,
225 const char *variance
= yang_dnode_get_string(dnode
, NULL
);
227 vty_out(vty
, " variance %s\n", variance
);
231 * XPath: /frr-eigrpd:eigrpd/instance/maximum-paths
235 eigrp_maximum_paths_cmd
,
236 "maximum-paths (1-32)$maximum_paths",
237 "Forward packets over multiple paths\n"
240 nb_cli_enqueue_change(vty
, "./maximum-paths", NB_OP_MODIFY
,
242 return nb_cli_apply_changes(vty
, NULL
);
246 no_eigrp_maximum_paths
,
247 no_eigrp_maximum_paths_cmd
,
248 "no maximum-paths [(1-32)]",
250 "Forward packets over multiple paths\n"
253 nb_cli_enqueue_change(vty
, "./maximum-paths", NB_OP_DESTROY
, NULL
);
254 return nb_cli_apply_changes(vty
, NULL
);
257 void eigrp_cli_show_maximum_paths(struct vty
*vty
, const struct lyd_node
*dnode
,
260 const char *maximum_paths
= yang_dnode_get_string(dnode
, NULL
);
262 vty_out(vty
, " maximum-paths %s\n", maximum_paths
);
266 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K1
267 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K2
268 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K3
269 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K4
270 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K5
271 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K6
274 eigrp_metric_weights
,
275 eigrp_metric_weights_cmd
,
276 "metric weights (0-255)$k1 (0-255)$k2 (0-255)$k3 (0-255)$k4 (0-255)$k5 [(0-255)$k6]",
277 "Modify metrics and parameters for advertisement\n"
278 "Modify metric coefficients\n"
286 nb_cli_enqueue_change(vty
, "./metric-weights/K1", NB_OP_MODIFY
, k1_str
);
287 nb_cli_enqueue_change(vty
, "./metric-weights/K2", NB_OP_MODIFY
, k2_str
);
288 nb_cli_enqueue_change(vty
, "./metric-weights/K3", NB_OP_MODIFY
, k3_str
);
289 nb_cli_enqueue_change(vty
, "./metric-weights/K4", NB_OP_MODIFY
, k4_str
);
290 nb_cli_enqueue_change(vty
, "./metric-weights/K5", NB_OP_MODIFY
, k5_str
);
292 nb_cli_enqueue_change(vty
, "./metric-weights/K6",
293 NB_OP_MODIFY
, k6_str
);
295 return nb_cli_apply_changes(vty
, NULL
);
299 no_eigrp_metric_weights
,
300 no_eigrp_metric_weights_cmd
,
301 "no metric weights [(0-255) (0-255) (0-255) (0-255) (0-255) (0-255)]",
303 "Modify metrics and parameters for advertisement\n"
304 "Modify metric coefficients\n"
312 nb_cli_enqueue_change(vty
, "./metric-weights/K1", NB_OP_DESTROY
, NULL
);
313 nb_cli_enqueue_change(vty
, "./metric-weights/K2", NB_OP_DESTROY
, NULL
);
314 nb_cli_enqueue_change(vty
, "./metric-weights/K3", NB_OP_DESTROY
, NULL
);
315 nb_cli_enqueue_change(vty
, "./metric-weights/K4", NB_OP_DESTROY
, NULL
);
316 nb_cli_enqueue_change(vty
, "./metric-weights/K5", NB_OP_DESTROY
, NULL
);
317 nb_cli_enqueue_change(vty
, "./metric-weights/K6", NB_OP_DESTROY
, NULL
);
318 return nb_cli_apply_changes(vty
, NULL
);
321 void eigrp_cli_show_metrics(struct vty
*vty
, const struct lyd_node
*dnode
,
324 const char *k1
, *k2
, *k3
, *k4
, *k5
, *k6
;
326 k1
= yang_dnode_exists(dnode
, "./K1") ?
327 yang_dnode_get_string(dnode
, "./K1") : "0";
328 k2
= yang_dnode_exists(dnode
, "./K2") ?
329 yang_dnode_get_string(dnode
, "./K2") : "0";
330 k3
= yang_dnode_exists(dnode
, "./K3") ?
331 yang_dnode_get_string(dnode
, "./K3") : "0";
332 k4
= yang_dnode_exists(dnode
, "./K4") ?
333 yang_dnode_get_string(dnode
, "./K4") : "0";
334 k5
= yang_dnode_exists(dnode
, "./K5") ?
335 yang_dnode_get_string(dnode
, "./K5") : "0";
336 k6
= yang_dnode_exists(dnode
, "./K6") ?
337 yang_dnode_get_string(dnode
, "./K6") : "0";
339 vty_out(vty
, " metric weights %s %s %s %s %s",
342 vty_out(vty
, " %s", k6
);
347 * XPath: /frr-eigrpd:eigrpd/instance/network
352 "[no] network A.B.C.D/M$prefix",
354 "Enable routing on an IP network\n"
355 "EIGRP network prefix\n")
358 nb_cli_enqueue_change(vty
, "./network", NB_OP_DESTROY
,
361 nb_cli_enqueue_change(vty
, "./network", NB_OP_CREATE
,
364 return nb_cli_apply_changes(vty
, NULL
);
367 void eigrp_cli_show_network(struct vty
*vty
, const struct lyd_node
*dnode
,
370 const char *prefix
= yang_dnode_get_string(dnode
, NULL
);
372 vty_out(vty
, " network %s\n", prefix
);
376 * XPath: /frr-eigrpd:eigrpd/instance/neighbor
381 "[no] neighbor A.B.C.D$addr",
383 "Specify a neighbor router\n"
384 "Neighbor address\n")
387 nb_cli_enqueue_change(vty
, "./neighbor", NB_OP_DESTROY
,
390 nb_cli_enqueue_change(vty
, "./neighbor", NB_OP_CREATE
,
393 return nb_cli_apply_changes(vty
, NULL
);
396 void eigrp_cli_show_neighbor(struct vty
*vty
, const struct lyd_node
*dnode
,
399 const char *prefix
= yang_dnode_get_string(dnode
, NULL
);
401 vty_out(vty
, " neighbor %s\n", prefix
);
405 * XPath: /frr-eigrpd:eigrpd/instance/redistribute
406 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/route-map
407 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/bandwidth
408 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/delay
409 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/reliability
410 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/load
411 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/mtu
414 eigrp_redistribute_source_metric
,
415 eigrp_redistribute_source_metric_cmd
,
416 "[no] redistribute " FRR_REDIST_STR_EIGRPD
417 "$proto [metric (1-4294967295)$bw (0-4294967295)$delay (0-255)$rlbt (1-255)$load (1-65535)$mtu]",
420 FRR_REDIST_HELP_STR_EIGRPD
421 "Metric for redistributed routes\n"
422 "Bandwidth metric in Kbits per second\n"
423 "EIGRP delay metric, in 10 microsecond units\n"
424 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
425 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
426 "EIGRP MTU of the path\n")
428 char xpath
[XPATH_MAXLEN
], xpath_metric
[XPATH_MAXLEN
+ 64];
430 snprintf(xpath
, sizeof(xpath
), "./redistribute[protocol='%s']", proto
);
433 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
434 return nb_cli_apply_changes(vty
, NULL
);
437 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
438 if (bw
== 0 || delay
== 0 || rlbt
== 0 || load
== 0 || mtu
== 0)
439 return nb_cli_apply_changes(vty
, NULL
);
441 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/bandwidth",
443 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, bw_str
);
444 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/delay", xpath
);
445 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, delay_str
);
446 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/reliability",
448 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, rlbt_str
);
449 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/load", xpath
);
450 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, load_str
);
451 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/mtu", xpath
);
452 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, mtu_str
);
453 return nb_cli_apply_changes(vty
, NULL
);
456 void eigrp_cli_show_redistribute(struct vty
*vty
, const struct lyd_node
*dnode
,
459 const char *proto
= yang_dnode_get_string(dnode
, "./protocol");
460 const char *bw
, *delay
, *load
, *mtu
, *rlbt
;
462 bw
= yang_dnode_exists(dnode
, "./metrics/bandwidth") ?
463 yang_dnode_get_string(dnode
, "./metrics/bandwidth") : NULL
;
464 delay
= yang_dnode_exists(dnode
, "./metrics/delay") ?
465 yang_dnode_get_string(dnode
, "./metrics/delay") : NULL
;
466 rlbt
= yang_dnode_exists(dnode
, "./metrics/reliability") ?
467 yang_dnode_get_string(dnode
, "./metrics/reliability") : NULL
;
468 load
= yang_dnode_exists(dnode
, "./metrics/load") ?
469 yang_dnode_get_string(dnode
, "./metrics/load") : NULL
;
470 mtu
= yang_dnode_exists(dnode
, "./metrics/mtu") ?
471 yang_dnode_get_string(dnode
, "./metrics/mtu") : NULL
;
473 vty_out(vty
, " redistribute %s", proto
);
474 if (bw
|| rlbt
|| delay
|| load
|| mtu
)
475 vty_out(vty
, " metric %s %s %s %s %s", bw
, delay
, rlbt
, load
,
481 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/delay
486 "delay (1-16777215)$delay",
487 "Specify interface throughput delay\n"
488 "Throughput delay (tens of microseconds)\n")
490 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/delay",
491 NB_OP_MODIFY
, delay_str
);
492 return nb_cli_apply_changes(vty
, NULL
);
497 no_eigrp_if_delay_cmd
,
498 "no delay [(1-16777215)]",
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_DESTROY
, NULL
);
505 return nb_cli_apply_changes(vty
, NULL
);
508 void eigrp_cli_show_delay(struct vty
*vty
, const struct lyd_node
*dnode
,
511 const char *delay
= yang_dnode_get_string(dnode
, NULL
);
513 vty_out(vty
, " delay %s\n", delay
);
517 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/bandwidth
521 eigrp_if_bandwidth_cmd
,
522 "eigrp bandwidth (1-10000000)$bw",
524 "Set bandwidth informational parameter\n"
525 "Bandwidth in kilobits\n")
527 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/bandwidth",
528 NB_OP_MODIFY
, bw_str
);
529 return nb_cli_apply_changes(vty
, NULL
);
533 no_eigrp_if_bandwidth
,
534 no_eigrp_if_bandwidth_cmd
,
535 "no eigrp bandwidth [(1-10000000)]",
538 "Set bandwidth informational parameter\n"
539 "Bandwidth in kilobits\n")
541 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/bandwidth",
542 NB_OP_DESTROY
, NULL
);
543 return nb_cli_apply_changes(vty
, NULL
);
546 void eigrp_cli_show_bandwidth(struct vty
*vty
, const struct lyd_node
*dnode
,
549 const char *bandwidth
= yang_dnode_get_string(dnode
, NULL
);
551 vty_out(vty
, " eigrp bandwidth %s\n", bandwidth
);
555 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/hello-interval
558 eigrp_if_ip_hellointerval
,
559 eigrp_if_ip_hellointerval_cmd
,
560 "ip hello-interval eigrp (1-65535)$hello",
561 "Interface Internet Protocol config commands\n"
562 "Configures EIGRP hello interval\n"
564 "Seconds between hello transmissions\n")
566 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hello-interval",
567 NB_OP_MODIFY
, hello_str
);
568 return nb_cli_apply_changes(vty
, NULL
);
572 no_eigrp_if_ip_hellointerval
,
573 no_eigrp_if_ip_hellointerval_cmd
,
574 "no ip hello-interval eigrp [(1-65535)]",
576 "Interface Internet Protocol config commands\n"
577 "Configures EIGRP hello interval\n"
579 "Seconds between hello transmissions\n")
581 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hello-interval",
582 NB_OP_DESTROY
, NULL
);
583 return nb_cli_apply_changes(vty
, NULL
);
587 void eigrp_cli_show_hello_interval(struct vty
*vty
,
588 const struct lyd_node
*dnode
,
591 const char *hello
= yang_dnode_get_string(dnode
, NULL
);
593 vty_out(vty
, " ip hello-interval eigrp %s\n", hello
);
597 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/hold-time
600 eigrp_if_ip_holdinterval
,
601 eigrp_if_ip_holdinterval_cmd
,
602 "ip hold-time eigrp (1-65535)$hold",
603 "Interface Internet Protocol config commands\n"
604 "Configures EIGRP IPv4 hold time\n"
606 "Seconds before neighbor is considered down\n")
608 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hold-time",
609 NB_OP_MODIFY
, hold_str
);
610 return nb_cli_apply_changes(vty
, NULL
);
614 no_eigrp_if_ip_holdinterval
,
615 no_eigrp_if_ip_holdinterval_cmd
,
616 "no ip hold-time eigrp [(1-65535)]",
618 "Interface Internet Protocol config commands\n"
619 "Configures EIGRP IPv4 hold time\n"
621 "Seconds before neighbor is considered down\n")
623 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hold-time",
624 NB_OP_DESTROY
, NULL
);
625 return nb_cli_apply_changes(vty
, NULL
);
628 void eigrp_cli_show_hold_time(struct vty
*vty
, const struct lyd_node
*dnode
,
631 const char *holdtime
= yang_dnode_get_string(dnode
, NULL
);
633 vty_out(vty
, " ip hold-time eigrp %s\n", holdtime
);
637 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/split-horizon
639 /* NOT implemented. */
642 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
643 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/summarize-addresses
646 eigrp_ip_summary_address
,
647 eigrp_ip_summary_address_cmd
,
648 "ip summary-address eigrp (1-65535)$as A.B.C.D/M$prefix",
649 "Interface Internet Protocol config commands\n"
650 "Perform address summarization\n"
653 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
655 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
657 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
659 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
661 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/summarize-addresses", xpath
);
662 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_CREATE
, prefix_str
);
664 return nb_cli_apply_changes(vty
, NULL
);
668 no_eigrp_ip_summary_address
,
669 no_eigrp_ip_summary_address_cmd
,
670 "no ip summary-address eigrp (1-65535)$as A.B.C.D/M$prefix",
672 "Interface Internet Protocol config commands\n"
673 "Perform address summarization\n"
676 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
678 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
680 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
682 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
684 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/summarize-addresses", xpath
);
685 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_DESTROY
, prefix_str
);
687 return nb_cli_apply_changes(vty
, NULL
);
690 void eigrp_cli_show_summarize_address(struct vty
*vty
,
691 const struct lyd_node
*dnode
,
694 const struct lyd_node
*instance
=
695 yang_dnode_get_parent(dnode
, "instance");
696 uint16_t asn
= yang_dnode_get_uint16(instance
, "./asn");
697 const char *summarize_address
= yang_dnode_get_string(dnode
, NULL
);
699 vty_out(vty
, " ip summary-address eigrp %d %s\n", asn
,
704 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
705 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/authentication
708 eigrp_authentication_mode
,
709 eigrp_authentication_mode_cmd
,
710 "ip authentication mode eigrp (1-65535)$as <md5|hmac-sha-256>$crypt",
711 "Interface Internet Protocol config commands\n"
712 "Authentication subcommands\n"
716 "Keyed message digest\n"
717 "HMAC SHA256 algorithm \n")
719 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
721 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
723 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
725 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/authentication", xpath
);
726 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, crypt
);
728 return nb_cli_apply_changes(vty
, NULL
);
732 no_eigrp_authentication_mode
,
733 no_eigrp_authentication_mode_cmd
,
734 "no ip authentication mode eigrp (1-65535)$as [<md5|hmac-sha-256>]",
736 "Interface Internet Protocol config commands\n"
737 "Authentication subcommands\n"
741 "Keyed message digest\n"
742 "HMAC SHA256 algorithm \n")
744 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
746 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
748 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
750 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/authentication", xpath
);
751 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, "none");
753 return nb_cli_apply_changes(vty
, NULL
);
756 void eigrp_cli_show_authentication(struct vty
*vty
,
757 const struct lyd_node
*dnode
,
760 const struct lyd_node
*instance
=
761 yang_dnode_get_parent(dnode
, "instance");
762 uint16_t asn
= yang_dnode_get_uint16(instance
, "./asn");
763 const char *crypt
= yang_dnode_get_string(dnode
, NULL
);
765 vty_out(vty
, " ip authentication mode eigrp %d %s\n", asn
, crypt
);
769 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
770 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/keychain
773 eigrp_authentication_keychain
,
774 eigrp_authentication_keychain_cmd
,
775 "ip authentication key-chain eigrp (1-65535)$as WORD$name",
776 "Interface Internet Protocol config commands\n"
777 "Authentication subcommands\n"
781 "Name of key-chain\n")
783 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
785 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
787 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
789 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/keychain", xpath
);
790 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, name
);
792 return nb_cli_apply_changes(vty
, NULL
);
796 no_eigrp_authentication_keychain
,
797 no_eigrp_authentication_keychain_cmd
,
798 "no ip authentication key-chain eigrp (1-65535)$as [WORD]",
800 "Interface Internet Protocol config commands\n"
801 "Authentication subcommands\n"
805 "Name of key-chain\n")
807 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
809 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
811 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/keychain", xpath
);
812 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_DESTROY
, NULL
);
814 return nb_cli_apply_changes(vty
, NULL
);
817 void eigrp_cli_show_keychain(struct vty
*vty
, const struct lyd_node
*dnode
,
820 const struct lyd_node
*instance
=
821 yang_dnode_get_parent(dnode
, "instance");
822 uint16_t asn
= yang_dnode_get_uint16(instance
, "./asn");
823 const char *keychain
= yang_dnode_get_string(dnode
, NULL
);
825 vty_out(vty
, " ip authentication key-chain eigrp %d %s\n", asn
,
831 * CLI installation procedures.
833 static int eigrp_config_write(struct vty
*vty
);
834 static struct cmd_node eigrp_node
= {
837 .parent_node
= CONFIG_NODE
,
838 .prompt
= "%s(config-router)# ",
839 .config_write
= eigrp_config_write
,
842 static int eigrp_config_write(struct vty
*vty
)
844 const struct lyd_node
*dnode
;
847 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-eigrpd:eigrpd");
849 nb_cli_show_dnode_cmds(vty
, dnode
, false);
859 install_element(CONFIG_NODE
, &router_eigrp_cmd
);
860 install_element(CONFIG_NODE
, &no_router_eigrp_cmd
);
862 install_node(&eigrp_node
);
863 install_default(EIGRP_NODE
);
865 install_element(EIGRP_NODE
, &eigrp_router_id_cmd
);
866 install_element(EIGRP_NODE
, &no_eigrp_router_id_cmd
);
867 install_element(EIGRP_NODE
, &eigrp_passive_interface_cmd
);
868 install_element(EIGRP_NODE
, &eigrp_timers_active_cmd
);
869 install_element(EIGRP_NODE
, &no_eigrp_timers_active_cmd
);
870 install_element(EIGRP_NODE
, &eigrp_variance_cmd
);
871 install_element(EIGRP_NODE
, &no_eigrp_variance_cmd
);
872 install_element(EIGRP_NODE
, &eigrp_maximum_paths_cmd
);
873 install_element(EIGRP_NODE
, &no_eigrp_maximum_paths_cmd
);
874 install_element(EIGRP_NODE
, &eigrp_metric_weights_cmd
);
875 install_element(EIGRP_NODE
, &no_eigrp_metric_weights_cmd
);
876 install_element(EIGRP_NODE
, &eigrp_network_cmd
);
877 install_element(EIGRP_NODE
, &eigrp_neighbor_cmd
);
878 install_element(EIGRP_NODE
, &eigrp_redistribute_source_metric_cmd
);
882 if_cmd_init_default();
884 install_element(INTERFACE_NODE
, &eigrp_if_delay_cmd
);
885 install_element(INTERFACE_NODE
, &no_eigrp_if_delay_cmd
);
886 install_element(INTERFACE_NODE
, &eigrp_if_bandwidth_cmd
);
887 install_element(INTERFACE_NODE
, &no_eigrp_if_bandwidth_cmd
);
888 install_element(INTERFACE_NODE
, &eigrp_if_ip_hellointerval_cmd
);
889 install_element(INTERFACE_NODE
, &no_eigrp_if_ip_hellointerval_cmd
);
890 install_element(INTERFACE_NODE
, &eigrp_if_ip_holdinterval_cmd
);
891 install_element(INTERFACE_NODE
, &no_eigrp_if_ip_holdinterval_cmd
);
892 install_element(INTERFACE_NODE
, &eigrp_ip_summary_address_cmd
);
893 install_element(INTERFACE_NODE
, &no_eigrp_ip_summary_address_cmd
);
894 install_element(INTERFACE_NODE
, &eigrp_authentication_mode_cmd
);
895 install_element(INTERFACE_NODE
, &no_eigrp_authentication_mode_cmd
);
896 install_element(INTERFACE_NODE
, &eigrp_authentication_keychain_cmd
);
897 install_element(INTERFACE_NODE
, &no_eigrp_authentication_keychain_cmd
);