]> git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_vty_cmds.c
Merge pull request #7830 from volta-networks/misc_fixes_2021
[mirror_frr.git] / ldpd / ldp_vty_cmds.c
1 /*
2 * Copyright (C) 2016 by Open Source Routing.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19
20 #include <zebra.h>
21
22 #include "command.h"
23 #include "vty.h"
24 #include "json.h"
25
26 #include "ldpd/ldpd.h"
27 #include "ldpd/ldp_vty.h"
28 #ifndef VTYSH_EXTRACT_PL
29 #include "ldpd/ldp_vty_cmds_clippy.c"
30 #endif
31
32 DEFPY_NOSH(ldp_mpls_ldp,
33 ldp_mpls_ldp_cmd,
34 "mpls ldp",
35 "Global MPLS configuration subcommands\n"
36 "Label Distribution Protocol\n")
37 {
38 return (ldp_vty_mpls_ldp(vty, NULL));
39 }
40
41 DEFPY (no_ldp_mpls_ldp,
42 no_ldp_mpls_ldp_cmd,
43 "no mpls ldp",
44 NO_STR
45 "Global MPLS configuration subcommands\n"
46 "Label Distribution Protocol\n")
47 {
48 return (ldp_vty_mpls_ldp(vty, "no"));
49 }
50
51 DEFPY_NOSH(ldp_l2vpn,
52 ldp_l2vpn_cmd,
53 "l2vpn WORD$l2vpn_name type vpls",
54 "Configure l2vpn commands\n"
55 "L2VPN name\n"
56 "L2VPN type\n"
57 "Virtual Private LAN Service\n")
58 {
59 return (ldp_vty_l2vpn(vty, NULL, l2vpn_name));
60 }
61
62 DEFPY (no_ldp_l2vpn,
63 no_ldp_l2vpn_cmd,
64 "no l2vpn WORD$l2vpn_name type vpls",
65 NO_STR
66 "Configure l2vpn commands\n"
67 "L2VPN name\n"
68 "L2VPN type\n"
69 "Virtual Private LAN Service\n")
70 {
71 return (ldp_vty_l2vpn(vty, "no", l2vpn_name));
72 }
73
74 DEFPY_NOSH(ldp_address_family,
75 ldp_address_family_cmd,
76 "address-family <ipv4|ipv6>$af",
77 "Configure Address Family and its parameters\n"
78 "IPv4\n"
79 "IPv6\n")
80 {
81 return (ldp_vty_address_family(vty, NULL, af));
82 }
83
84 DEFPY (no_ldp_address_family,
85 no_ldp_address_family_cmd,
86 "no address-family <ipv4|ipv6>$af",
87 NO_STR
88 "Configure Address Family and its parameters\n"
89 "IPv4\n"
90 "IPv6\n")
91 {
92 return (ldp_vty_address_family(vty, "no", af));
93 }
94
95 DEFPY_NOSH(ldp_exit_address_family,
96 ldp_exit_address_family_cmd,
97 "exit-address-family",
98 "Exit from Address Family configuration mode\n")
99 {
100 if (vty->node == LDP_IPV4_NODE || vty->node == LDP_IPV6_NODE)
101 vty->node = LDP_NODE;
102 return CMD_SUCCESS;
103 }
104
105 DEFPY (ldp_discovery_link_holdtime,
106 ldp_discovery_link_holdtime_cmd,
107 "[no] discovery hello holdtime (1-65535)$holdtime",
108 NO_STR
109 "Configure discovery parameters\n"
110 "LDP Link Hellos\n"
111 "Hello holdtime\n"
112 "Time (seconds) - 65535 implies infinite\n")
113 {
114 return (ldp_vty_disc_holdtime(vty, no, HELLO_LINK, holdtime));
115 }
116
117 DEFPY (ldp_discovery_targeted_holdtime,
118 ldp_discovery_targeted_holdtime_cmd,
119 "[no] discovery targeted-hello holdtime (1-65535)$holdtime",
120 NO_STR
121 "Configure discovery parameters\n"
122 "LDP Targeted Hellos\n"
123 "Hello holdtime\n"
124 "Time (seconds) - 65535 implies infinite\n")
125 {
126 return (ldp_vty_disc_holdtime(vty, no, HELLO_TARGETED, holdtime));
127 }
128
129 DEFPY (ldp_discovery_link_interval,
130 ldp_discovery_link_interval_cmd,
131 "[no] discovery hello interval (1-65535)$interval",
132 NO_STR
133 "Configure discovery parameters\n"
134 "LDP Link Hellos\n"
135 "Hello interval\n"
136 "Time (seconds)\n")
137 {
138 return (ldp_vty_disc_interval(vty, no, HELLO_LINK, interval));
139 }
140
141 DEFPY (ldp_discovery_targeted_interval,
142 ldp_discovery_targeted_interval_cmd,
143 "[no] discovery targeted-hello interval (1-65535)$interval",
144 NO_STR
145 "Configure discovery parameters\n"
146 "LDP Targeted Hellos\n"
147 "Hello interval\n"
148 "Time (seconds)\n")
149 {
150 return (ldp_vty_disc_interval(vty, no, HELLO_TARGETED, interval));
151 }
152
153 DEFPY (ldp_dual_stack_transport_connection_prefer_ipv4,
154 ldp_dual_stack_transport_connection_prefer_ipv4_cmd,
155 "[no] dual-stack transport-connection prefer ipv4",
156 NO_STR
157 "Configure dual stack parameters\n"
158 "Configure TCP transport parameters\n"
159 "Configure preferred address family for TCP transport connection with neighbor\n"
160 "IPv4\n")
161 {
162 return (ldp_vty_trans_pref_ipv4(vty, no));
163 }
164
165 DEFPY (ldp_dual_stack_cisco_interop,
166 ldp_dual_stack_cisco_interop_cmd,
167 "[no] dual-stack cisco-interop",
168 NO_STR
169 "Configure dual stack parameters\n"
170 "Use Cisco non-compliant format to send and interpret the Dual-Stack capability TLV\n")
171 {
172 return (ldp_vty_ds_cisco_interop(vty, no));
173 }
174
175 DEFPY (ldp_neighbor_password,
176 ldp_neighbor_password_cmd,
177 "[no] neighbor A.B.C.D$neighbor password WORD$password",
178 NO_STR
179 "Configure neighbor parameters\n"
180 "LDP Id of neighbor\n"
181 "Configure password for MD5 authentication\n"
182 "The password\n")
183 {
184 return (ldp_vty_neighbor_password(vty, no, neighbor, password));
185 }
186
187 DEFPY (ldp_neighbor_session_holdtime,
188 ldp_neighbor_session_holdtime_cmd,
189 "[no] neighbor A.B.C.D$neighbor session holdtime (15-65535)$holdtime",
190 NO_STR
191 "Configure neighbor parameters\n"
192 "LDP Id of neighbor\n"
193 "Configure session parameters\n"
194 "Configure session holdtime\n"
195 "Time (seconds)\n")
196 {
197 return (ldp_vty_nbr_session_holdtime(vty, no, neighbor, holdtime));
198 }
199
200 DEFPY (ldp_neighbor_ttl_security,
201 ldp_neighbor_ttl_security_cmd,
202 "[no] neighbor A.B.C.D$neighbor ttl-security <disable|hops (1-254)$hops>",
203 NO_STR
204 "Configure neighbor parameters\n"
205 "LDP Id of neighbor\n"
206 "LDP ttl security check\n"
207 "Disable ttl security\n"
208 "IP hops\n"
209 "maximum number of hops\n")
210 {
211 return (ldp_vty_neighbor_ttl_security(vty, no, neighbor, hops_str));
212 }
213
214 DEFPY (ldp_router_id,
215 ldp_router_id_cmd,
216 "[no] router-id A.B.C.D$address",
217 NO_STR
218 "Configure router Id\n"
219 "LSR Id (in form of an IPv4 address)\n")
220 {
221 return (ldp_vty_router_id(vty, no, address));
222 }
223
224 DEFPY (ldp_ordered_control,
225 ldp_ordered_control_cmd,
226 "[no] ordered-control",
227 NO_STR
228 "Configure LDP ordered label distribution control mode\n")
229 {
230 return (ldp_vty_ordered_control(vty, no));
231 }
232
233 DEFPY (ldp_wait_for_sync,
234 ldp_wait_for_sync_cmd,
235 "[no] wait-for-sync (1-10000)$waitforsync",
236 NO_STR
237 "Time to wait for LDP-IGP Sync to complete label exchange\n"
238 "Time (seconds)\n")
239 {
240 return (ldp_vty_wait_for_sync_interval(vty, no, waitforsync));
241
242 }
243
244 DEFPY (ldp_discovery_targeted_hello_accept,
245 ldp_discovery_targeted_hello_accept_cmd,
246 "[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>$from_acl]",
247 NO_STR
248 "Configure discovery parameters\n"
249 "LDP Targeted Hellos\n"
250 "Accept and respond to targeted hellos\n"
251 "Access list to specify acceptable targeted hello source\n"
252 "IP access-list number\n"
253 "IP access-list number (expanded range)\n"
254 "IP access-list name\n")
255 {
256 return (ldp_vty_targeted_hello_accept(vty, no, from_acl));
257 }
258
259 DEFPY (ldp_discovery_transport_address_ipv4,
260 ldp_discovery_transport_address_ipv4_cmd,
261 "[no] discovery transport-address A.B.C.D$address",
262 NO_STR
263 "Configure discovery parameters\n"
264 "Specify transport address for TCP connection\n"
265 "IP address to be used as transport address\n")
266 {
267 return (ldp_vty_trans_addr(vty, no, address_str));
268 }
269
270 DEFPY (ldp_discovery_transport_address_ipv6,
271 ldp_discovery_transport_address_ipv6_cmd,
272 "[no] discovery transport-address X:X::X:X$address",
273 NO_STR
274 "Configure discovery parameters\n"
275 "Specify transport address for TCP connection\n"
276 "IPv6 address to be used as transport address\n")
277 {
278 return (ldp_vty_trans_addr(vty, no, address_str));
279 }
280
281 DEFPY (ldp_label_local_advertise,
282 ldp_label_local_advertise_cmd,
283 "[no] label local advertise [{to <(1-199)|(1300-2699)|WORD>$to_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}]",
284 NO_STR
285 "Configure label control and policies\n"
286 "Configure local label control and policies\n"
287 "Configure outbound label advertisement control\n"
288 "IP Access-list specifying controls on LDP Peers\n"
289 "IP access-list number\n"
290 "IP access-list number (expanded range)\n"
291 "IP access-list name\n"
292 "IP access-list for destination prefixes\n"
293 "IP access-list number\n"
294 "IP access-list number (expanded range)\n"
295 "IP access-list name\n")
296 {
297 return (ldp_vty_label_advertise(vty, no, to_acl, for_acl));
298 }
299
300 DEFPY (ldp_label_local_advertise_explicit_null,
301 ldp_label_local_advertise_explicit_null_cmd,
302 "[no] label local advertise explicit-null [for <(1-199)|(1300-2699)|WORD>$for_acl]",
303 NO_STR
304 "Configure label control and policies\n"
305 "Configure local label control and policies\n"
306 "Configure outbound label advertisement control\n"
307 "Configure explicit-null advertisement\n"
308 "IP access-list for destination prefixes\n"
309 "IP access-list number\n"
310 "IP access-list number (expanded range)\n"
311 "IP access-list name\n")
312 {
313 return (ldp_vty_label_expnull(vty, no, for_acl));
314 }
315
316 DEFPY (ldp_label_local_allocate,
317 ldp_label_local_allocate_cmd,
318 "[no] label local allocate <host-routes$host_routes|for <(1-199)|(1300-2699)|WORD>$for_acl>",
319 NO_STR
320 "Configure label control and policies\n"
321 "Configure local label control and policies\n"
322 "Configure label allocation control\n"
323 "allocate local label for host routes only\n"
324 "IP access-list\n"
325 "IP access-list number\n"
326 "IP access-list number (expanded range)\n"
327 "IP access-list name\n")
328 {
329 return (ldp_vty_label_allocate(vty, no, host_routes, for_acl));
330 }
331
332 DEFPY (ldp_label_remote_accept,
333 ldp_label_remote_accept_cmd,
334 "[no] label remote accept {from <(1-199)|(1300-2699)|WORD>$from_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}",
335 NO_STR
336 "Configure label control and policies\n"
337 "Configure remote/peer label control and policies\n"
338 "Configure inbound label acceptance control\n"
339 "Neighbor from whom to accept label advertisement\n"
340 "IP access-list number\n"
341 "IP access-list number (expanded range)\n"
342 "IP access-list name\n"
343 "IP access-list for destination prefixes\n"
344 "IP access-list number\n"
345 "IP access-list number (expanded range)\n"
346 "IP access-list name\n")
347 {
348 return (ldp_vty_label_accept(vty, no, from_acl, for_acl));
349 }
350
351 DEFPY (ldp_ttl_security_disable,
352 ldp_ttl_security_disable_cmd,
353 "[no] ttl-security disable",
354 NO_STR
355 "LDP ttl security check\n"
356 "Disable ttl security\n")
357 {
358 return (ldp_vty_ttl_security(vty, no));
359 }
360
361 DEFPY (ldp_session_holdtime,
362 ldp_session_holdtime_cmd,
363 "[no] session holdtime (15-65535)$holdtime",
364 NO_STR
365 "Configure session parameters\n"
366 "Configure session holdtime\n"
367 "Time (seconds)\n")
368 {
369 return (ldp_vty_af_session_holdtime(vty, no, holdtime));
370 }
371
372 DEFPY_NOSH(ldp_interface,
373 ldp_interface_cmd,
374 "interface IFNAME$ifname",
375 "Enable LDP on an interface and enter interface submode\n"
376 "Interface's name\n")
377 {
378 return (ldp_vty_interface(vty, NULL, ifname));
379 }
380
381 DEFPY (no_ldp_interface,
382 no_ldp_interface_cmd,
383 "no interface IFNAME$ifname",
384 NO_STR
385 "Enable LDP on an interface and enter interface submode\n"
386 "Interface's name\n")
387 {
388 return (ldp_vty_interface(vty, "no", ifname));
389 }
390
391 DEFPY (ldp_neighbor_ipv4_targeted,
392 ldp_neighbor_ipv4_targeted_cmd,
393 "[no] neighbor A.B.C.D$address targeted",
394 NO_STR
395 "Configure neighbor parameters\n"
396 "IP address of neighbor\n"
397 "Establish targeted session\n")
398 {
399 return (ldp_vty_neighbor_targeted(vty, no, address_str));
400 }
401
402 DEFPY (ldp_neighbor_ipv6_targeted,
403 ldp_neighbor_ipv6_targeted_cmd,
404 "[no] neighbor X:X::X:X$address targeted",
405 NO_STR
406 "Configure neighbor parameters\n"
407 "IPv6 address of neighbor\n"
408 "Establish targeted session\n")
409 {
410 return (ldp_vty_neighbor_targeted(vty, no, address_str));
411 }
412
413 DEFPY (ldp_bridge,
414 ldp_bridge_cmd,
415 "[no] bridge IFNAME$ifname",
416 NO_STR
417 "Bridge interface\n"
418 "Interface's name\n")
419 {
420 return (ldp_vty_l2vpn_bridge(vty, no, ifname));
421 }
422
423 DEFPY (ldp_mtu,
424 ldp_mtu_cmd,
425 "[no] mtu (1500-9180)$mtu",
426 NO_STR
427 "Set Maximum Transmission Unit\n"
428 "Maximum Transmission Unit value\n")
429 {
430 return (ldp_vty_l2vpn_mtu(vty, no, mtu));
431 }
432
433 DEFPY (ldp_member_interface,
434 ldp_member_interface_cmd,
435 "[no] member interface IFNAME$ifname",
436 NO_STR
437 "L2VPN member configuration\n"
438 "Local interface\n"
439 "Interface's name\n")
440 {
441 return (ldp_vty_l2vpn_interface(vty, no, ifname));
442 }
443
444 DEFPY_NOSH(ldp_member_pseudowire,
445 ldp_member_pseudowire_cmd,
446 "member pseudowire IFNAME$ifname",
447 "L2VPN member configuration\n"
448 "Pseudowire interface\n"
449 "Interface's name\n")
450 {
451 return (ldp_vty_l2vpn_pseudowire(vty, NULL, ifname));
452 }
453
454 DEFPY (no_ldp_member_pseudowire,
455 no_ldp_member_pseudowire_cmd,
456 "no member pseudowire IFNAME$ifname",
457 NO_STR
458 "L2VPN member configuration\n"
459 "Pseudowire interface\n"
460 "Interface's name\n")
461 {
462 return (ldp_vty_l2vpn_pseudowire(vty, "no", ifname));
463 }
464
465 DEFPY (ldp_vc_type,
466 ldp_vc_type_cmd,
467 "[no] vc type <ethernet|ethernet-tagged>$vc_type",
468 NO_STR
469 "Virtual Circuit options\n"
470 "Virtual Circuit type to use\n"
471 "Ethernet (type 5)\n"
472 "Ethernet-tagged (type 4)\n")
473 {
474 return (ldp_vty_l2vpn_pwtype(vty, no, vc_type));
475 }
476
477 DEFPY (ldp_control_word,
478 ldp_control_word_cmd,
479 "[no] control-word <exclude|include>$preference",
480 NO_STR
481 "Control-word options\n"
482 "Exclude control-word in pseudowire packets\n"
483 "Include control-word in pseudowire packets\n")
484 {
485 return (ldp_vty_l2vpn_pw_cword(vty, no, preference));
486 }
487
488 DEFPY (ldp_neighbor_address,
489 ldp_neighbor_address_cmd,
490 "[no] neighbor address <A.B.C.D|X:X::X:X>$pw_address",
491 NO_STR
492 "Remote endpoint configuration\n"
493 "Specify the IPv4 or IPv6 address of the remote endpoint\n"
494 "IPv4 address\n"
495 "IPv6 address\n")
496 {
497 return (ldp_vty_l2vpn_pw_nbr_addr(vty, no, pw_address_str));
498 }
499
500 DEFPY (ldp_neighbor_lsr_id,
501 ldp_neighbor_lsr_id_cmd,
502 "[no] neighbor lsr-id A.B.C.D$address",
503 NO_STR
504 "Remote endpoint configuration\n"
505 "Specify the LSR-ID of the remote endpoint\n"
506 "IPv4 address\n")
507 {
508 return (ldp_vty_l2vpn_pw_nbr_id(vty, no, address));
509 }
510
511 DEFPY (ldp_pw_id,
512 ldp_pw_id_cmd,
513 "[no] pw-id (1-4294967295)$pwid",
514 NO_STR
515 "Set the Virtual Circuit ID\n"
516 "Virtual Circuit ID value\n")
517 {
518 return (ldp_vty_l2vpn_pw_pwid(vty, no, pwid));
519 }
520
521 DEFPY (ldp_pw_status_disable,
522 ldp_pw_status_disable_cmd,
523 "[no] pw-status disable",
524 NO_STR
525 "Configure PW status\n"
526 "Disable PW status\n")
527 {
528 return (ldp_vty_l2vpn_pw_pwstatus(vty, no));
529 }
530
531 DEFPY (ldp_clear_mpls_ldp_neighbor,
532 ldp_clear_mpls_ldp_neighbor_cmd,
533 "clear mpls ldp neighbor [<A.B.C.D|X:X::X:X>]$address",
534 "Reset functions\n"
535 "Reset MPLS statistical information\n"
536 "Clear LDP state\n"
537 "Clear LDP neighbor sessions\n"
538 "IPv4 address\n"
539 "IPv6 address\n")
540 {
541 return (ldp_vty_clear_nbr(vty, address_str));
542 }
543
544 DEFPY (ldp_debug_mpls_ldp_discovery_hello,
545 ldp_debug_mpls_ldp_discovery_hello_cmd,
546 "[no] debug mpls ldp discovery hello <recv|sent>$dir",
547 NO_STR
548 "Debugging functions\n"
549 "MPLS information\n"
550 "Label Distribution Protocol\n"
551 "Discovery messages\n"
552 "Discovery hello message\n"
553 "Received messages\n"
554 "Sent messages\n")
555 {
556 return (ldp_vty_debug(vty, no, "discovery", dir, NULL));
557 }
558
559 DEFPY (ldp_debug_mpls_ldp_type,
560 ldp_debug_mpls_ldp_type_cmd,
561 "[no] debug mpls ldp <errors|event|labels|sync|zebra>$type",
562 NO_STR
563 "Debugging functions\n"
564 "MPLS information\n"
565 "Label Distribution Protocol\n"
566 "Errors\n"
567 "LDP event information\n"
568 "LDP label allocation information\n"
569 "LDP sync information\n"
570 "LDP zebra information\n")
571 {
572 return (ldp_vty_debug(vty, no, type, NULL, NULL));
573 }
574
575 DEFPY (ldp_debug_mpls_ldp_messages_recv,
576 ldp_debug_mpls_ldp_messages_recv_cmd,
577 "[no] debug mpls ldp messages recv [all]$all",
578 NO_STR
579 "Debugging functions\n"
580 "MPLS information\n"
581 "Label Distribution Protocol\n"
582 "Messages\n"
583 "Received messages, excluding periodic Keep Alives\n"
584 "Received messages, including periodic Keep Alives\n")
585 {
586 return (ldp_vty_debug(vty, no, "messages", "recv", all));
587 }
588
589 DEFPY (ldp_debug_mpls_ldp_messages_sent,
590 ldp_debug_mpls_ldp_messages_sent_cmd,
591 "[no] debug mpls ldp messages sent [all]$all",
592 NO_STR
593 "Debugging functions\n"
594 "MPLS information\n"
595 "Label Distribution Protocol\n"
596 "Messages\n"
597 "Sent messages, excluding periodic Keep Alives\n"
598 "Sent messages, including periodic Keep Alives\n")
599 {
600 return (ldp_vty_debug(vty, no, "messages", "sent", all));
601 }
602
603 DEFPY (ldp_show_mpls_ldp_binding,
604 ldp_show_mpls_ldp_binding_cmd,
605 "show mpls ldp [<ipv4|ipv6>]$af binding\
606 [<A.B.C.D/M|X:X::X:X/M>$prefix [longer-prefixes$longer_prefixes]]\
607 [{\
608 neighbor A.B.C.D$nbr\
609 |local-label (0-1048575)$local_label\
610 |remote-label (0-1048575)$remote_label\
611 }]\
612 [detail]$detail [json]$json",
613 "Show running system information\n"
614 "MPLS information\n"
615 "Label Distribution Protocol\n"
616 "IPv4 Address Family\n"
617 "IPv6 Address Family\n"
618 "Label Information Base (LIB) information\n"
619 "Destination prefix (IPv4)\n"
620 "Destination prefix (IPv6)\n"
621 "Include longer matches\n"
622 "Display labels from LDP neighbor\n"
623 "Neighbor LSR-ID\n"
624 "Match locally assigned label values\n"
625 "Locally assigned label value\n"
626 "Match remotely assigned label values\n"
627 "Remotely assigned label value\n"
628 "Show detailed information\n"
629 JSON_STR)
630 {
631 if (!(ldpd_conf->flags & F_LDPD_ENABLED))
632 return CMD_SUCCESS;
633 if (!local_label_str)
634 local_label = NO_LABEL;
635 if (!remote_label_str)
636 remote_label = NO_LABEL;
637 return (ldp_vty_show_binding(vty, af, prefix_str, !!longer_prefixes,
638 nbr_str, local_label, remote_label, detail, json));
639 }
640
641 DEFPY (ldp_show_mpls_ldp_discovery,
642 ldp_show_mpls_ldp_discovery_cmd,
643 "show mpls ldp [<ipv4|ipv6>]$af discovery [detail]$detail [json]$json",
644 "Show running system information\n"
645 "MPLS information\n"
646 "Label Distribution Protocol\n"
647 "IPv4 Address Family\n"
648 "IPv6 Address Family\n"
649 "Discovery Hello Information\n"
650 "Show detailed information\n"
651 JSON_STR)
652 {
653 return (ldp_vty_show_discovery(vty, af, detail, json));
654 }
655
656 DEFPY (ldp_show_mpls_ldp_interface,
657 ldp_show_mpls_ldp_interface_cmd,
658 "show mpls ldp [<ipv4|ipv6>]$af interface [json]$json",
659 "Show running system information\n"
660 "MPLS information\n"
661 "Label Distribution Protocol\n"
662 "IPv4 Address Family\n"
663 "IPv6 Address Family\n"
664 "interface information\n"
665 JSON_STR)
666 {
667 return (ldp_vty_show_interface(vty, af, json));
668 }
669
670 DEFPY (ldp_show_mpls_ldp_capabilities,
671 ldp_show_mpls_ldp_capabilities_cmd,
672 "show mpls ldp capabilities [json]$json",
673 "Show running system information\n"
674 "MPLS information\n"
675 "Label Distribution Protocol\n"
676 "Display LDP Capabilities information\n"
677 JSON_STR)
678 {
679 return (ldp_vty_show_capabilities(vty, json));
680 }
681
682 DEFPY (ldp_show_mpls_ldp_neighbor,
683 ldp_show_mpls_ldp_neighbor_cmd,
684 "show mpls ldp neighbor [A.B.C.D]$lsr_id [detail]$detail [json]$json",
685 "Show running system information\n"
686 "MPLS information\n"
687 "Label Distribution Protocol\n"
688 "Neighbor information\n"
689 "Neighbor LSR-ID\n"
690 "Show detailed information\n"
691 JSON_STR)
692 {
693 return (ldp_vty_show_neighbor(vty, lsr_id_str, 0, detail, json));
694 }
695
696 DEFPY (ldp_show_mpls_ldp_neighbor_capabilities,
697 ldp_show_mpls_ldp_neighbor_capabilities_cmd,
698 "show mpls ldp neighbor [A.B.C.D]$lsr_id capabilities [json]$json",
699 "Show running system information\n"
700 "MPLS information\n"
701 "Label Distribution Protocol\n"
702 "Neighbor information\n"
703 "Neighbor LSR-ID\n"
704 "Display neighbor capability information\n"
705 JSON_STR)
706 {
707 return (ldp_vty_show_neighbor(vty, lsr_id_str, 1, NULL, json));
708 }
709
710 DEFPY (ldp_show_mpls_ldp_igp_sync,
711 ldp_show_mpls_ldp_igp_sync_cmd,
712 "show mpls ldp igp-sync [json]$json",
713 "Show mpls ldp ldp-sync information\n"
714 "MPLS information\n"
715 "Label Distribution Protocol\n"
716 "LDP-IGP Sync information\n"
717 JSON_STR)
718 {
719 return (ldp_vty_show_ldp_sync(vty, json));
720 }
721
722 DEFPY (ldp_show_l2vpn_atom_binding,
723 ldp_show_l2vpn_atom_binding_cmd,
724 "show l2vpn atom binding\
725 [{\
726 A.B.C.D$peer\
727 |local-label (16-1048575)$local_label\
728 |remote-label (16-1048575)$remote_label\
729 }]\
730 [json]$json",
731 "Show running system information\n"
732 "Show information about Layer2 VPN\n"
733 "Show Any Transport over MPLS information\n"
734 "Show AToM label binding information\n"
735 "Destination address of the VC\n"
736 "Match locally assigned label values\n"
737 "Locally assigned label value\n"
738 "Match remotely assigned label values\n"
739 "Remotely assigned label value\n"
740 JSON_STR)
741 {
742 if (!local_label_str)
743 local_label = NO_LABEL;
744 if (!remote_label_str)
745 remote_label = NO_LABEL;
746 return (ldp_vty_show_atom_binding(vty, peer_str, local_label,
747 remote_label, json));
748 }
749
750 DEFPY (ldp_show_l2vpn_atom_vc,
751 ldp_show_l2vpn_atom_vc_cmd,
752 "show l2vpn atom vc\
753 [{\
754 A.B.C.D$peer\
755 |interface IFNAME$ifname\
756 |vc-id (1-4294967295)$vcid\
757 }]\
758 [json]$json",
759 "Show running system information\n"
760 "Show information about Layer2 VPN\n"
761 "Show Any Transport over MPLS information\n"
762 "Show AToM virtual circuit information\n"
763 "Destination address of the VC\n"
764 "Local interface of the pseudowire\n"
765 "Interface's name\n"
766 "VC ID\n"
767 "VC ID\n"
768 JSON_STR)
769 {
770 return (ldp_vty_show_atom_vc(vty, peer_str, ifname, vcid_str, json));
771 }
772
773 DEFPY_NOSH (ldp_show_debugging_mpls_ldp,
774 ldp_show_debugging_mpls_ldp_cmd,
775 "show debugging [mpls ldp]",
776 "Show running system information\n"
777 "Debugging functions\n"
778 "MPLS information\n"
779 "Label Distribution Protocol\n")
780 {
781 return (ldp_vty_show_debugging(vty));
782 }
783
784 static void
785 l2vpn_autocomplete(vector comps, struct cmd_token *token)
786 {
787 struct l2vpn *l2vpn;
788
789 RB_FOREACH(l2vpn, l2vpn_head, &vty_conf->l2vpn_tree)
790 vector_set(comps, XSTRDUP(MTYPE_COMPLETION, l2vpn->name));
791 }
792
793 static const struct cmd_variable_handler l2vpn_var_handlers[] = {
794 {
795 .varname = "l2vpn_name",
796 .completions = l2vpn_autocomplete
797 },
798 {
799 .completions = NULL
800 }
801 };
802
803 void
804 ldp_vty_init (void)
805 {
806 cmd_variable_handler_register(l2vpn_var_handlers);
807
808 install_node(&ldp_node);
809 install_node(&ldp_ipv4_node);
810 install_node(&ldp_ipv6_node);
811 install_node(&ldp_ipv4_iface_node);
812 install_node(&ldp_ipv6_iface_node);
813 install_node(&ldp_l2vpn_node);
814 install_node(&ldp_pseudowire_node);
815 install_node(&ldp_debug_node);
816 install_default(LDP_NODE);
817 install_default(LDP_IPV4_NODE);
818 install_default(LDP_IPV6_NODE);
819 install_default(LDP_IPV4_IFACE_NODE);
820 install_default(LDP_IPV6_IFACE_NODE);
821 install_default(LDP_L2VPN_NODE);
822 install_default(LDP_PSEUDOWIRE_NODE);
823
824 install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd);
825 install_element(CONFIG_NODE, &no_ldp_mpls_ldp_cmd);
826 install_element(CONFIG_NODE, &ldp_l2vpn_cmd);
827 install_element(CONFIG_NODE, &no_ldp_l2vpn_cmd);
828 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
829 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_type_cmd);
830 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
831 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
832
833 install_element(LDP_NODE, &ldp_address_family_cmd);
834 install_element(LDP_NODE, &no_ldp_address_family_cmd);
835 install_element(LDP_NODE, &ldp_discovery_link_holdtime_cmd);
836 install_element(LDP_NODE, &ldp_discovery_targeted_holdtime_cmd);
837 install_element(LDP_NODE, &ldp_discovery_link_interval_cmd);
838 install_element(LDP_NODE, &ldp_discovery_targeted_interval_cmd);
839 install_element(LDP_NODE, &ldp_dual_stack_transport_connection_prefer_ipv4_cmd);
840 install_element(LDP_NODE, &ldp_dual_stack_cisco_interop_cmd);
841 install_element(LDP_NODE, &ldp_neighbor_password_cmd);
842 install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
843 install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
844 install_element(LDP_NODE, &ldp_router_id_cmd);
845 install_element(LDP_NODE, &ldp_ordered_control_cmd);
846 install_element(LDP_NODE, &ldp_wait_for_sync_cmd);
847
848 install_element(LDP_IPV4_NODE, &ldp_discovery_link_holdtime_cmd);
849 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_holdtime_cmd);
850 install_element(LDP_IPV4_NODE, &ldp_discovery_link_interval_cmd);
851 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_interval_cmd);
852 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_hello_accept_cmd);
853 install_element(LDP_IPV4_NODE, &ldp_discovery_transport_address_ipv4_cmd);
854 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_cmd);
855 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_explicit_null_cmd);
856 install_element(LDP_IPV4_NODE, &ldp_label_local_allocate_cmd);
857 install_element(LDP_IPV4_NODE, &ldp_label_remote_accept_cmd);
858 install_element(LDP_IPV4_NODE, &ldp_ttl_security_disable_cmd);
859 install_element(LDP_IPV4_NODE, &ldp_interface_cmd);
860 install_element(LDP_IPV4_NODE, &no_ldp_interface_cmd);
861 install_element(LDP_IPV4_NODE, &ldp_session_holdtime_cmd);
862 install_element(LDP_IPV4_NODE, &ldp_neighbor_ipv4_targeted_cmd);
863 install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd);
864
865 install_element(LDP_IPV6_NODE, &ldp_discovery_link_holdtime_cmd);
866 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_holdtime_cmd);
867 install_element(LDP_IPV6_NODE, &ldp_discovery_link_interval_cmd);
868 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_interval_cmd);
869 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_hello_accept_cmd);
870 install_element(LDP_IPV6_NODE, &ldp_discovery_transport_address_ipv6_cmd);
871 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_cmd);
872 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_explicit_null_cmd);
873 install_element(LDP_IPV6_NODE, &ldp_label_local_allocate_cmd);
874 install_element(LDP_IPV6_NODE, &ldp_label_remote_accept_cmd);
875 install_element(LDP_IPV6_NODE, &ldp_ttl_security_disable_cmd);
876 install_element(LDP_IPV6_NODE, &ldp_interface_cmd);
877 install_element(LDP_IPV6_NODE, &no_ldp_interface_cmd);
878 install_element(LDP_IPV6_NODE, &ldp_session_holdtime_cmd);
879 install_element(LDP_IPV6_NODE, &ldp_neighbor_ipv6_targeted_cmd);
880 install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd);
881
882 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
883 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd);
884
885 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
886 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd);
887
888 install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd);
889 install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd);
890 install_element(LDP_L2VPN_NODE, &ldp_member_interface_cmd);
891 install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_cmd);
892 install_element(LDP_L2VPN_NODE, &no_ldp_member_pseudowire_cmd);
893 install_element(LDP_L2VPN_NODE, &ldp_vc_type_cmd);
894
895 install_element(LDP_PSEUDOWIRE_NODE, &ldp_control_word_cmd);
896 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_address_cmd);
897 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_lsr_id_cmd);
898 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_id_cmd);
899 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_status_disable_cmd);
900
901 install_element(ENABLE_NODE, &ldp_clear_mpls_ldp_neighbor_cmd);
902 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
903 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_type_cmd);
904 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
905 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
906
907 install_element(VIEW_NODE, &ldp_show_mpls_ldp_binding_cmd);
908 install_element(VIEW_NODE, &ldp_show_mpls_ldp_discovery_cmd);
909 install_element(VIEW_NODE, &ldp_show_mpls_ldp_interface_cmd);
910 install_element(VIEW_NODE, &ldp_show_mpls_ldp_capabilities_cmd);
911 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_cmd);
912 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_capabilities_cmd);
913 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_binding_cmd);
914 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_vc_cmd);
915 install_element(VIEW_NODE, &ldp_show_debugging_mpls_ldp_cmd);
916 install_element(VIEW_NODE, &ldp_show_mpls_ldp_igp_sync_cmd);
917 }