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