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"
32 #include "eigrp_cli.h"
34 #ifndef VTYSH_EXTRACT_PL
35 #include "eigrpd/eigrp_cli_clippy.c"
36 #endif /* VTYSH_EXTRACT_PL */
39 * XPath: /frr-eigrpd:eigrpd/instance
44 "router eigrp (1-65535)$as [vrf NAME]",
50 char xpath
[XPATH_MAXLEN
];
53 snprintf(xpath
, sizeof(xpath
),
54 "/frr-eigrpd:eigrpd/instance[asn='%s'][vrf='%s']",
55 as_str
, vrf
? vrf
: VRF_DEFAULT_NAME
);
57 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
58 rv
= nb_cli_apply_changes(vty
, NULL
);
59 if (rv
== CMD_SUCCESS
)
60 VTY_PUSH_XPATH(EIGRP_NODE
, xpath
);
68 "no router eigrp (1-65535)$as [vrf NAME]",
75 char xpath
[XPATH_MAXLEN
];
77 snprintf(xpath
, sizeof(xpath
),
78 "/frr-eigrpd:eigrpd/instance[asn='%s'][vrf='%s']",
79 as_str
, vrf
? vrf
: VRF_DEFAULT_NAME
);
81 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
82 return nb_cli_apply_changes_clear_pending(vty
, NULL
);
85 void eigrp_cli_show_header(struct vty
*vty
, struct lyd_node
*dnode
,
88 const char *asn
= yang_dnode_get_string(dnode
, "./asn");
89 const char *vrf
= yang_dnode_get_string(dnode
, "./vrf");
91 vty_out(vty
, "router eigrp %s", asn
);
92 if (strcmp(vrf
, VRF_DEFAULT_NAME
))
93 vty_out(vty
, " vrf %s", vrf
);
97 void eigrp_cli_show_end_header(struct vty
*vty
, struct lyd_node
*dnode
)
99 vty_out(vty
, "exit\n");
104 * XPath: /frr-eigrpd:eigrpd/instance/router-id
109 "eigrp router-id A.B.C.D$addr",
111 "Router ID for this EIGRP process\n"
112 "EIGRP Router-ID in IP address format\n")
114 nb_cli_enqueue_change(vty
, "./router-id", NB_OP_MODIFY
, addr_str
);
115 return nb_cli_apply_changes(vty
, NULL
);
120 no_eigrp_router_id_cmd
,
121 "no eigrp router-id [A.B.C.D]",
124 "Router ID for this EIGRP process\n"
125 "EIGRP Router-ID in IP address format\n")
127 nb_cli_enqueue_change(vty
, "./router-id", NB_OP_DESTROY
, NULL
);
128 return nb_cli_apply_changes(vty
, NULL
);
131 void eigrp_cli_show_router_id(struct vty
*vty
, struct lyd_node
*dnode
,
134 const char *router_id
= yang_dnode_get_string(dnode
, NULL
);
136 vty_out(vty
, " eigrp router-id %s\n", router_id
);
140 * XPath: /frr-eigrpd:eigrpd/instance/passive-interface
143 eigrp_passive_interface
,
144 eigrp_passive_interface_cmd
,
145 "[no] passive-interface IFNAME",
147 "Suppress routing updates on an interface\n"
148 "Interface to suppress on\n")
151 nb_cli_enqueue_change(vty
, "./passive-interface",
152 NB_OP_DESTROY
, ifname
);
154 nb_cli_enqueue_change(vty
, "./passive-interface",
155 NB_OP_CREATE
, ifname
);
157 return nb_cli_apply_changes(vty
, NULL
);
160 void eigrp_cli_show_passive_interface(struct vty
*vty
, struct lyd_node
*dnode
,
163 const char *ifname
= yang_dnode_get_string(dnode
, NULL
);
165 vty_out(vty
, " passive-interface %s\n", ifname
);
169 * XPath: /frr-eigrpd:eigrpd/instance/active-time
173 eigrp_timers_active_cmd
,
174 "timers active-time <(1-65535)$timer|disabled$disabled>",
175 "Adjust routing timers\n"
176 "Time limit for active state\n"
177 "Active state time limit in seconds\n"
178 "Disable time limit for active state\n")
181 nb_cli_enqueue_change(vty
, "./active-time", NB_OP_MODIFY
, "0");
183 nb_cli_enqueue_change(vty
, "./active-time",
184 NB_OP_MODIFY
, timer_str
);
186 return nb_cli_apply_changes(vty
, NULL
);
190 no_eigrp_timers_active
,
191 no_eigrp_timers_active_cmd
,
192 "no timers active-time [<(1-65535)|disabled>]",
194 "Adjust routing timers\n"
195 "Time limit for active state\n"
196 "Active state time limit in seconds\n"
197 "Disable time limit for active state\n")
199 nb_cli_enqueue_change(vty
, "./active-time", NB_OP_DESTROY
, NULL
);
200 return nb_cli_apply_changes(vty
, NULL
);
203 void eigrp_cli_show_active_time(struct vty
*vty
, struct lyd_node
*dnode
,
206 const char *timer
= yang_dnode_get_string(dnode
, NULL
);
208 vty_out(vty
, " timers active-time %s\n", timer
);
212 * XPath: /frr-eigrpd:eigrpd/instance/variance
217 "variance (1-128)$variance",
218 "Control load balancing variance\n"
219 "Metric variance multiplier\n")
221 nb_cli_enqueue_change(vty
, "./variance", NB_OP_MODIFY
, variance_str
);
222 return nb_cli_apply_changes(vty
, NULL
);
227 no_eigrp_variance_cmd
,
228 "no variance [(1-128)]",
230 "Control load balancing variance\n"
231 "Metric variance multiplier\n")
233 nb_cli_enqueue_change(vty
, "./variance", NB_OP_DESTROY
, NULL
);
234 return nb_cli_apply_changes(vty
, NULL
);
237 void eigrp_cli_show_variance(struct vty
*vty
, struct lyd_node
*dnode
,
240 const char *variance
= yang_dnode_get_string(dnode
, NULL
);
242 vty_out(vty
, " variance %s\n", variance
);
246 * XPath: /frr-eigrpd:eigrpd/instance/maximum-paths
250 eigrp_maximum_paths_cmd
,
251 "maximum-paths (1-32)$maximum_paths",
252 "Forward packets over multiple paths\n"
255 nb_cli_enqueue_change(vty
, "./maximum-paths", NB_OP_MODIFY
,
257 return nb_cli_apply_changes(vty
, NULL
);
261 no_eigrp_maximum_paths
,
262 no_eigrp_maximum_paths_cmd
,
263 "no maximum-paths [(1-32)]",
265 "Forward packets over multiple paths\n"
268 nb_cli_enqueue_change(vty
, "./maximum-paths", NB_OP_DESTROY
, NULL
);
269 return nb_cli_apply_changes(vty
, NULL
);
272 void eigrp_cli_show_maximum_paths(struct vty
*vty
, struct lyd_node
*dnode
,
275 const char *maximum_paths
= yang_dnode_get_string(dnode
, NULL
);
277 vty_out(vty
, " maximum-paths %s\n", maximum_paths
);
281 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K1
282 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K2
283 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K3
284 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K4
285 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K5
286 * XPath: /frr-eigrpd:eigrpd/instance/metric-weights/K6
289 eigrp_metric_weights
,
290 eigrp_metric_weights_cmd
,
291 "metric weights (0-255)$k1 (0-255)$k2 (0-255)$k3 (0-255)$k4 (0-255)$k5 [(0-255)$k6]",
292 "Modify metrics and parameters for advertisement\n"
293 "Modify metric coefficients\n"
301 nb_cli_enqueue_change(vty
, "./metric-weights/K1", NB_OP_MODIFY
, k1_str
);
302 nb_cli_enqueue_change(vty
, "./metric-weights/K2", NB_OP_MODIFY
, k2_str
);
303 nb_cli_enqueue_change(vty
, "./metric-weights/K3", NB_OP_MODIFY
, k3_str
);
304 nb_cli_enqueue_change(vty
, "./metric-weights/K4", NB_OP_MODIFY
, k4_str
);
305 nb_cli_enqueue_change(vty
, "./metric-weights/K5", NB_OP_MODIFY
, k5_str
);
307 nb_cli_enqueue_change(vty
, "./metric-weights/K6",
308 NB_OP_MODIFY
, k6_str
);
310 return nb_cli_apply_changes(vty
, NULL
);
314 no_eigrp_metric_weights
,
315 no_eigrp_metric_weights_cmd
,
316 "no metric weights [(0-255) (0-255) (0-255) (0-255) (0-255) (0-255)]",
318 "Modify metrics and parameters for advertisement\n"
319 "Modify metric coefficients\n"
327 nb_cli_enqueue_change(vty
, "./metric-weights/K1", NB_OP_DESTROY
, NULL
);
328 nb_cli_enqueue_change(vty
, "./metric-weights/K2", NB_OP_DESTROY
, NULL
);
329 nb_cli_enqueue_change(vty
, "./metric-weights/K3", NB_OP_DESTROY
, NULL
);
330 nb_cli_enqueue_change(vty
, "./metric-weights/K4", NB_OP_DESTROY
, NULL
);
331 nb_cli_enqueue_change(vty
, "./metric-weights/K5", NB_OP_DESTROY
, NULL
);
332 nb_cli_enqueue_change(vty
, "./metric-weights/K6", NB_OP_DESTROY
, NULL
);
333 return nb_cli_apply_changes(vty
, NULL
);
336 void eigrp_cli_show_metrics(struct vty
*vty
, struct lyd_node
*dnode
,
339 const char *k1
, *k2
, *k3
, *k4
, *k5
, *k6
;
341 k1
= yang_dnode_exists(dnode
, "./K1") ?
342 yang_dnode_get_string(dnode
, "./K1") : "0";
343 k2
= yang_dnode_exists(dnode
, "./K2") ?
344 yang_dnode_get_string(dnode
, "./K2") : "0";
345 k3
= yang_dnode_exists(dnode
, "./K3") ?
346 yang_dnode_get_string(dnode
, "./K3") : "0";
347 k4
= yang_dnode_exists(dnode
, "./K4") ?
348 yang_dnode_get_string(dnode
, "./K4") : "0";
349 k5
= yang_dnode_exists(dnode
, "./K5") ?
350 yang_dnode_get_string(dnode
, "./K5") : "0";
351 k6
= yang_dnode_exists(dnode
, "./K6") ?
352 yang_dnode_get_string(dnode
, "./K6") : "0";
354 vty_out(vty
, " metric weights %s %s %s %s %s",
357 vty_out(vty
, " %s", k6
);
362 * XPath: /frr-eigrpd:eigrpd/instance/network
367 "[no] network A.B.C.D/M$prefix",
369 "Enable routing on an IP network\n"
370 "EIGRP network prefix\n")
373 nb_cli_enqueue_change(vty
, "./network", NB_OP_DESTROY
,
376 nb_cli_enqueue_change(vty
, "./network", NB_OP_CREATE
,
379 return nb_cli_apply_changes(vty
, NULL
);
382 void eigrp_cli_show_network(struct vty
*vty
, struct lyd_node
*dnode
,
385 const char *prefix
= yang_dnode_get_string(dnode
, NULL
);
387 vty_out(vty
, " network %s\n", prefix
);
391 * XPath: /frr-eigrpd:eigrpd/instance/neighbor
396 "[no] neighbor A.B.C.D$addr",
398 "Specify a neighbor router\n"
399 "Neighbor address\n")
402 nb_cli_enqueue_change(vty
, "./neighbor", NB_OP_DESTROY
,
405 nb_cli_enqueue_change(vty
, "./neighbor", NB_OP_CREATE
,
408 return nb_cli_apply_changes(vty
, NULL
);
411 void eigrp_cli_show_neighbor(struct vty
*vty
, struct lyd_node
*dnode
,
414 const char *prefix
= yang_dnode_get_string(dnode
, NULL
);
416 vty_out(vty
, " neighbor %s\n", prefix
);
420 * XPath: /frr-eigrpd:eigrpd/instance/redistribute
421 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/route-map
422 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/bandwidth
423 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/delay
424 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/reliability
425 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/load
426 * XPath: /frr-eigrpd:eigrpd/instance/redistribute/metrics/mtu
429 eigrp_redistribute_source_metric
,
430 eigrp_redistribute_source_metric_cmd
,
431 "[no] redistribute " FRR_REDIST_STR_EIGRPD
432 "$proto [metric (1-4294967295)$bw (0-4294967295)$delay (0-255)$rlbt (1-255)$load (1-65535)$mtu]",
435 FRR_REDIST_HELP_STR_EIGRPD
436 "Metric for redistributed routes\n"
437 "Bandwidth metric in Kbits per second\n"
438 "EIGRP delay metric, in 10 microsecond units\n"
439 "EIGRP reliability metric where 255 is 100% reliable2 ?\n"
440 "EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded\n"
441 "EIGRP MTU of the path\n")
443 char xpath
[XPATH_MAXLEN
], xpath_metric
[XPATH_MAXLEN
+ 64];
445 snprintf(xpath
, sizeof(xpath
), "./redistribute[protocol='%s']", proto
);
448 nb_cli_enqueue_change(vty
, xpath
, NB_OP_DESTROY
, NULL
);
449 return nb_cli_apply_changes(vty
, NULL
);
452 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
453 if (bw
== 0 || delay
== 0 || rlbt
== 0 || load
== 0 || mtu
== 0)
454 return nb_cli_apply_changes(vty
, NULL
);
456 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/bandwidth",
458 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, bw_str
);
459 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/delay", xpath
);
460 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, delay_str
);
461 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/reliability",
463 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, rlbt_str
);
464 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/load", xpath
);
465 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, load_str
);
466 snprintf(xpath_metric
, sizeof(xpath_metric
), "%s/metrics/mtu", xpath
);
467 nb_cli_enqueue_change(vty
, xpath_metric
, NB_OP_MODIFY
, mtu_str
);
468 return nb_cli_apply_changes(vty
, NULL
);
471 void eigrp_cli_show_redistribute(struct vty
*vty
, struct lyd_node
*dnode
,
474 const char *proto
= yang_dnode_get_string(dnode
, "./protocol");
475 const char *bw
, *delay
, *load
, *mtu
, *rlbt
;
477 bw
= yang_dnode_exists(dnode
, "./metrics/bandwidth") ?
478 yang_dnode_get_string(dnode
, "./metrics/bandwidth") : NULL
;
479 delay
= yang_dnode_exists(dnode
, "./metrics/delay") ?
480 yang_dnode_get_string(dnode
, "./metrics/delay") : NULL
;
481 rlbt
= yang_dnode_exists(dnode
, "./metrics/reliability") ?
482 yang_dnode_get_string(dnode
, "./metrics/reliability") : NULL
;
483 load
= yang_dnode_exists(dnode
, "./metrics/load") ?
484 yang_dnode_get_string(dnode
, "./metrics/load") : NULL
;
485 mtu
= yang_dnode_exists(dnode
, "./metrics/mtu") ?
486 yang_dnode_get_string(dnode
, "./metrics/mtu") : NULL
;
488 vty_out(vty
, " redistribute %s", proto
);
489 if (bw
|| rlbt
|| delay
|| load
|| mtu
)
490 vty_out(vty
, " metric %s %s %s %s %s", bw
, delay
, rlbt
, load
,
496 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/delay
501 "delay (1-16777215)$delay",
502 "Specify interface throughput delay\n"
503 "Throughput delay (tens of microseconds)\n")
505 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/delay",
506 NB_OP_MODIFY
, delay_str
);
507 return nb_cli_apply_changes(vty
, NULL
);
512 no_eigrp_if_delay_cmd
,
513 "no delay [(1-16777215)]",
515 "Specify interface throughput delay\n"
516 "Throughput delay (tens of microseconds)\n")
518 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/delay",
519 NB_OP_DESTROY
, NULL
);
520 return nb_cli_apply_changes(vty
, NULL
);
523 void eigrp_cli_show_delay(struct vty
*vty
, struct lyd_node
*dnode
,
526 const char *delay
= yang_dnode_get_string(dnode
, NULL
);
528 vty_out(vty
, " delay %s\n", delay
);
532 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/bandwidth
536 eigrp_if_bandwidth_cmd
,
537 "eigrp bandwidth (1-10000000)$bw",
539 "Set bandwidth informational parameter\n"
540 "Bandwidth in kilobits\n")
542 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/bandwidth",
543 NB_OP_MODIFY
, bw_str
);
544 return nb_cli_apply_changes(vty
, NULL
);
548 no_eigrp_if_bandwidth
,
549 no_eigrp_if_bandwidth_cmd
,
550 "no eigrp bandwidth [(1-10000000)]",
553 "Set bandwidth informational parameter\n"
554 "Bandwidth in kilobits\n")
556 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/bandwidth",
557 NB_OP_DESTROY
, NULL
);
558 return nb_cli_apply_changes(vty
, NULL
);
561 void eigrp_cli_show_bandwidth(struct vty
*vty
, struct lyd_node
*dnode
,
564 const char *bandwidth
= yang_dnode_get_string(dnode
, NULL
);
566 vty_out(vty
, " eigrp bandwidth %s\n", bandwidth
);
570 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/hello-interval
573 eigrp_if_ip_hellointerval
,
574 eigrp_if_ip_hellointerval_cmd
,
575 "ip hello-interval eigrp (1-65535)$hello",
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_MODIFY
, hello_str
);
583 return nb_cli_apply_changes(vty
, NULL
);
587 no_eigrp_if_ip_hellointerval
,
588 no_eigrp_if_ip_hellointerval_cmd
,
589 "no ip hello-interval eigrp [(1-65535)]",
591 "Interface Internet Protocol config commands\n"
592 "Configures EIGRP hello interval\n"
594 "Seconds between hello transmissions\n")
596 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hello-interval",
597 NB_OP_DESTROY
, NULL
);
598 return nb_cli_apply_changes(vty
, NULL
);
602 void eigrp_cli_show_hello_interval(struct vty
*vty
, struct lyd_node
*dnode
,
605 const char *hello
= yang_dnode_get_string(dnode
, NULL
);
607 vty_out(vty
, " ip hello-interval eigrp %s\n", hello
);
611 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/hold-time
614 eigrp_if_ip_holdinterval
,
615 eigrp_if_ip_holdinterval_cmd
,
616 "ip hold-time eigrp (1-65535)$hold",
617 "Interface Internet Protocol config commands\n"
618 "Configures EIGRP IPv4 hold time\n"
620 "Seconds before neighbor is considered down\n")
622 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hold-time",
623 NB_OP_MODIFY
, hold_str
);
624 return nb_cli_apply_changes(vty
, NULL
);
628 no_eigrp_if_ip_holdinterval
,
629 no_eigrp_if_ip_holdinterval_cmd
,
630 "no ip hold-time eigrp [(1-65535)]",
632 "Interface Internet Protocol config commands\n"
633 "Configures EIGRP IPv4 hold time\n"
635 "Seconds before neighbor is considered down\n")
637 nb_cli_enqueue_change(vty
, "./frr-eigrpd:eigrp/hold-time",
638 NB_OP_DESTROY
, NULL
);
639 return nb_cli_apply_changes(vty
, NULL
);
642 void eigrp_cli_show_hold_time(struct vty
*vty
, struct lyd_node
*dnode
,
645 const char *holdtime
= yang_dnode_get_string(dnode
, NULL
);
647 vty_out(vty
, " ip hold-time eigrp %s\n", holdtime
);
651 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/split-horizon
653 /* NOT implemented. */
656 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
657 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/summarize-addresses
660 eigrp_ip_summary_address
,
661 eigrp_ip_summary_address_cmd
,
662 "ip summary-address eigrp (1-65535)$as A.B.C.D/M$prefix",
663 "Interface Internet Protocol config commands\n"
664 "Perform address summarization\n"
667 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
669 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
671 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
673 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
675 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/summarize-addresses", xpath
);
676 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_CREATE
, prefix_str
);
678 return nb_cli_apply_changes(vty
, NULL
);
682 no_eigrp_ip_summary_address
,
683 no_eigrp_ip_summary_address_cmd
,
684 "no ip summary-address eigrp (1-65535)$as A.B.C.D/M$prefix",
686 "Interface Internet Protocol config commands\n"
687 "Perform address summarization\n"
690 "Summary <network>/<length>, e.g. 192.168.0.0/16\n")
692 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
694 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
696 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
698 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/summarize-addresses", xpath
);
699 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_DESTROY
, prefix_str
);
701 return nb_cli_apply_changes(vty
, NULL
);
704 void eigrp_cli_show_summarize_address(struct vty
*vty
, struct lyd_node
*dnode
,
707 const struct lyd_node
*instance
= yang_dnode_get_parent(dnode
, "instance");
708 uint16_t asn
= yang_dnode_get_uint16(instance
, "./asn");
709 const char *summarize_address
= yang_dnode_get_string(dnode
, NULL
);
711 vty_out(vty
, " ip summary-address eigrp %d %s\n", asn
,
716 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
717 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/authentication
720 eigrp_authentication_mode
,
721 eigrp_authentication_mode_cmd
,
722 "ip authentication mode eigrp (1-65535)$as <md5|hmac-sha-256>$crypt",
723 "Interface Internet Protocol config commands\n"
724 "Authentication subcommands\n"
728 "Keyed message digest\n"
729 "HMAC SHA256 algorithm \n")
731 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
733 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
735 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
737 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/authentication", xpath
);
738 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, crypt
);
740 return nb_cli_apply_changes(vty
, NULL
);
744 no_eigrp_authentication_mode
,
745 no_eigrp_authentication_mode_cmd
,
746 "no ip authentication mode eigrp (1-65535)$as [<md5|hmac-sha-256>]",
748 "Interface Internet Protocol config commands\n"
749 "Authentication subcommands\n"
753 "Keyed message digest\n"
754 "HMAC SHA256 algorithm \n")
756 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
758 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
760 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
762 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/authentication", xpath
);
763 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, "none");
765 return nb_cli_apply_changes(vty
, NULL
);
768 void eigrp_cli_show_authentication(struct vty
*vty
, struct lyd_node
*dnode
,
771 const struct lyd_node
*instance
= yang_dnode_get_parent(dnode
, "instance");
772 uint16_t asn
= yang_dnode_get_uint16(instance
, "./asn");
773 const char *crypt
= yang_dnode_get_string(dnode
, NULL
);
775 vty_out(vty
, " ip authentication mode eigrp %d %s\n", asn
, crypt
);
779 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance
780 * XPath: /frr-interface:lib/interface/frr-eigrpd:eigrp/instance/keychain
783 eigrp_authentication_keychain
,
784 eigrp_authentication_keychain_cmd
,
785 "ip authentication key-chain eigrp (1-65535)$as WORD$name",
786 "Interface Internet Protocol config commands\n"
787 "Authentication subcommands\n"
791 "Name of key-chain\n")
793 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
795 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
797 nb_cli_enqueue_change(vty
, xpath
, NB_OP_CREATE
, NULL
);
799 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/keychain", xpath
);
800 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_MODIFY
, name
);
802 return nb_cli_apply_changes(vty
, NULL
);
806 no_eigrp_authentication_keychain
,
807 no_eigrp_authentication_keychain_cmd
,
808 "no ip authentication key-chain eigrp (1-65535)$as [WORD]",
810 "Interface Internet Protocol config commands\n"
811 "Authentication subcommands\n"
815 "Name of key-chain\n")
817 char xpath
[XPATH_MAXLEN
], xpath_auth
[XPATH_MAXLEN
+ 64];
819 snprintf(xpath
, sizeof(xpath
), "./frr-eigrpd:eigrp/instance[asn='%s']",
821 snprintf(xpath_auth
, sizeof(xpath_auth
), "%s/keychain", xpath
);
822 nb_cli_enqueue_change(vty
, xpath_auth
, NB_OP_DESTROY
, NULL
);
824 return nb_cli_apply_changes(vty
, NULL
);
827 void eigrp_cli_show_keychain(struct vty
*vty
, struct lyd_node
*dnode
,
830 const struct lyd_node
*instance
= yang_dnode_get_parent(dnode
, "instance");
831 uint16_t asn
= yang_dnode_get_uint16(instance
, "./asn");
832 const char *keychain
= yang_dnode_get_string(dnode
, NULL
);
834 vty_out(vty
, " ip authentication key-chain eigrp %d %s\n", asn
,
840 * CLI installation procedures.
842 static int eigrp_config_write(struct vty
*vty
);
843 static struct cmd_node eigrp_node
= {
846 .parent_node
= CONFIG_NODE
,
847 .prompt
= "%s(config-router)# ",
848 .config_write
= eigrp_config_write
,
851 static int eigrp_config_write(struct vty
*vty
)
853 struct lyd_node
*dnode
;
856 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-eigrpd:eigrpd");
858 nb_cli_show_dnode_cmds(vty
, dnode
, false);
865 static int eigrp_write_interface(struct vty
*vty
)
867 struct lyd_node
*dnode
;
868 struct interface
*ifp
;
872 RB_FOREACH(vrf
, vrf_name_head
, &vrfs_by_name
) {
873 FOR_ALL_INTERFACES(vrf
, ifp
) {
874 dnode
= yang_dnode_getf(
875 running_config
->dnode
,
876 "/frr-interface:lib/interface[name='%s'][vrf='%s']",
877 ifp
->name
, vrf
->name
);
882 nb_cli_show_dnode_cmds(vty
, dnode
, false);
892 install_element(CONFIG_NODE
, &router_eigrp_cmd
);
893 install_element(CONFIG_NODE
, &no_router_eigrp_cmd
);
895 install_node(&eigrp_node
);
896 install_default(EIGRP_NODE
);
898 install_element(EIGRP_NODE
, &eigrp_router_id_cmd
);
899 install_element(EIGRP_NODE
, &no_eigrp_router_id_cmd
);
900 install_element(EIGRP_NODE
, &eigrp_passive_interface_cmd
);
901 install_element(EIGRP_NODE
, &eigrp_timers_active_cmd
);
902 install_element(EIGRP_NODE
, &no_eigrp_timers_active_cmd
);
903 install_element(EIGRP_NODE
, &eigrp_variance_cmd
);
904 install_element(EIGRP_NODE
, &no_eigrp_variance_cmd
);
905 install_element(EIGRP_NODE
, &eigrp_maximum_paths_cmd
);
906 install_element(EIGRP_NODE
, &no_eigrp_maximum_paths_cmd
);
907 install_element(EIGRP_NODE
, &eigrp_metric_weights_cmd
);
908 install_element(EIGRP_NODE
, &no_eigrp_metric_weights_cmd
);
909 install_element(EIGRP_NODE
, &eigrp_network_cmd
);
910 install_element(EIGRP_NODE
, &eigrp_neighbor_cmd
);
911 install_element(EIGRP_NODE
, &eigrp_redistribute_source_metric_cmd
);
915 if_cmd_init(eigrp_write_interface
);
917 install_element(INTERFACE_NODE
, &eigrp_if_delay_cmd
);
918 install_element(INTERFACE_NODE
, &no_eigrp_if_delay_cmd
);
919 install_element(INTERFACE_NODE
, &eigrp_if_bandwidth_cmd
);
920 install_element(INTERFACE_NODE
, &no_eigrp_if_bandwidth_cmd
);
921 install_element(INTERFACE_NODE
, &eigrp_if_ip_hellointerval_cmd
);
922 install_element(INTERFACE_NODE
, &no_eigrp_if_ip_hellointerval_cmd
);
923 install_element(INTERFACE_NODE
, &eigrp_if_ip_holdinterval_cmd
);
924 install_element(INTERFACE_NODE
, &no_eigrp_if_ip_holdinterval_cmd
);
925 install_element(INTERFACE_NODE
, &eigrp_ip_summary_address_cmd
);
926 install_element(INTERFACE_NODE
, &no_eigrp_ip_summary_address_cmd
);
927 install_element(INTERFACE_NODE
, &eigrp_authentication_mode_cmd
);
928 install_element(INTERFACE_NODE
, &no_eigrp_authentication_mode_cmd
);
929 install_element(INTERFACE_NODE
, &eigrp_authentication_keychain_cmd
);
930 install_element(INTERFACE_NODE
, &no_eigrp_authentication_keychain_cmd
);