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