]> git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_vty_cmds.c
Merge pull request #3206 from qlyoung/mac-token-change
[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_discovery_targeted_hello_accept,
225 ldp_discovery_targeted_hello_accept_cmd,
226 "[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>$from_acl]",
227 NO_STR
228 "Configure discovery parameters\n"
229 "LDP Targeted Hellos\n"
230 "Accept and respond to targeted hellos\n"
231 "Access list to specify acceptable targeted hello source\n"
232 "IP access-list number\n"
233 "IP access-list number (expanded range)\n"
234 "IP access-list name\n")
235 {
236 return (ldp_vty_targeted_hello_accept(vty, no, from_acl));
237 }
238
239 DEFPY (ldp_discovery_transport_address_ipv4,
240 ldp_discovery_transport_address_ipv4_cmd,
241 "[no] discovery transport-address A.B.C.D$address",
242 NO_STR
243 "Configure discovery parameters\n"
244 "Specify transport address for TCP connection\n"
245 "IP address to be used as transport address\n")
246 {
247 return (ldp_vty_trans_addr(vty, no, address_str));
248 }
249
250 DEFPY (ldp_discovery_transport_address_ipv6,
251 ldp_discovery_transport_address_ipv6_cmd,
252 "[no] discovery transport-address X:X::X:X$address",
253 NO_STR
254 "Configure discovery parameters\n"
255 "Specify transport address for TCP connection\n"
256 "IPv6 address to be used as transport address\n")
257 {
258 return (ldp_vty_trans_addr(vty, no, address_str));
259 }
260
261 DEFPY (ldp_label_local_advertise,
262 ldp_label_local_advertise_cmd,
263 "[no] label local advertise [{to <(1-199)|(1300-2699)|WORD>$to_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}]",
264 NO_STR
265 "Configure label control and policies\n"
266 "Configure local label control and policies\n"
267 "Configure outbound label advertisement control\n"
268 "IP Access-list specifying controls on LDP Peers\n"
269 "IP access-list number\n"
270 "IP access-list number (expanded range)\n"
271 "IP access-list name\n"
272 "IP access-list for destination prefixes\n"
273 "IP access-list number\n"
274 "IP access-list number (expanded range)\n"
275 "IP access-list name\n")
276 {
277 return (ldp_vty_label_advertise(vty, no, to_acl, for_acl));
278 }
279
280 DEFPY (ldp_label_local_advertise_explicit_null,
281 ldp_label_local_advertise_explicit_null_cmd,
282 "[no] label local advertise explicit-null [for <(1-199)|(1300-2699)|WORD>$for_acl]",
283 NO_STR
284 "Configure label control and policies\n"
285 "Configure local label control and policies\n"
286 "Configure outbound label advertisement control\n"
287 "Configure explicit-null advertisement\n"
288 "IP access-list for destination prefixes\n"
289 "IP access-list number\n"
290 "IP access-list number (expanded range)\n"
291 "IP access-list name\n")
292 {
293 return (ldp_vty_label_expnull(vty, no, for_acl));
294 }
295
296 DEFPY (ldp_label_local_allocate,
297 ldp_label_local_allocate_cmd,
298 "[no] label local allocate <host-routes$host_routes|for <(1-199)|(1300-2699)|WORD>$for_acl>",
299 NO_STR
300 "Configure label control and policies\n"
301 "Configure local label control and policies\n"
302 "Configure label allocation control\n"
303 "allocate local label for host routes only\n"
304 "IP access-list\n"
305 "IP access-list number\n"
306 "IP access-list number (expanded range)\n"
307 "IP access-list name\n")
308 {
309 return (ldp_vty_label_allocate(vty, no, host_routes, for_acl));
310 }
311
312 DEFPY (ldp_label_remote_accept,
313 ldp_label_remote_accept_cmd,
314 "[no] label remote accept {from <(1-199)|(1300-2699)|WORD>$from_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}",
315 NO_STR
316 "Configure label control and policies\n"
317 "Configure remote/peer label control and policies\n"
318 "Configure inbound label acceptance control\n"
319 "Neighbor from whom to accept label advertisement\n"
320 "IP access-list number\n"
321 "IP access-list number (expanded range)\n"
322 "IP access-list name\n"
323 "IP access-list for destination prefixes\n"
324 "IP access-list number\n"
325 "IP access-list number (expanded range)\n"
326 "IP access-list name\n")
327 {
328 return (ldp_vty_label_accept(vty, no, from_acl, for_acl));
329 }
330
331 DEFPY (ldp_ttl_security_disable,
332 ldp_ttl_security_disable_cmd,
333 "[no] ttl-security disable",
334 NO_STR
335 "LDP ttl security check\n"
336 "Disable ttl security\n")
337 {
338 return (ldp_vty_ttl_security(vty, no));
339 }
340
341 DEFPY (ldp_session_holdtime,
342 ldp_session_holdtime_cmd,
343 "[no] session holdtime (15-65535)$holdtime",
344 NO_STR
345 "Configure session parameters\n"
346 "Configure session holdtime\n"
347 "Time (seconds)\n")
348 {
349 return (ldp_vty_af_session_holdtime(vty, no, holdtime));
350 }
351
352 DEFPY_NOSH(ldp_interface,
353 ldp_interface_cmd,
354 "interface IFNAME$ifname",
355 "Enable LDP on an interface and enter interface submode\n"
356 "Interface's name\n")
357 {
358 return (ldp_vty_interface(vty, NULL, ifname));
359 }
360
361 DEFPY (no_ldp_interface,
362 no_ldp_interface_cmd,
363 "no interface IFNAME$ifname",
364 NO_STR
365 "Enable LDP on an interface and enter interface submode\n"
366 "Interface's name\n")
367 {
368 return (ldp_vty_interface(vty, "no", ifname));
369 }
370
371 DEFPY (ldp_neighbor_ipv4_targeted,
372 ldp_neighbor_ipv4_targeted_cmd,
373 "[no] neighbor A.B.C.D$address targeted",
374 NO_STR
375 "Configure neighbor parameters\n"
376 "IP address of neighbor\n"
377 "Establish targeted session\n")
378 {
379 return (ldp_vty_neighbor_targeted(vty, no, address_str));
380 }
381
382 DEFPY (ldp_neighbor_ipv6_targeted,
383 ldp_neighbor_ipv6_targeted_cmd,
384 "[no] neighbor X:X::X:X$address targeted",
385 NO_STR
386 "Configure neighbor parameters\n"
387 "IPv6 address of neighbor\n"
388 "Establish targeted session\n")
389 {
390 return (ldp_vty_neighbor_targeted(vty, no, address_str));
391 }
392
393 DEFPY (ldp_bridge,
394 ldp_bridge_cmd,
395 "[no] bridge IFNAME$ifname",
396 NO_STR
397 "Bridge interface\n"
398 "Interface's name\n")
399 {
400 return (ldp_vty_l2vpn_bridge(vty, no, ifname));
401 }
402
403 DEFPY (ldp_mtu,
404 ldp_mtu_cmd,
405 "[no] mtu (1500-9180)$mtu",
406 NO_STR
407 "Set Maximum Transmission Unit\n"
408 "Maximum Transmission Unit value\n")
409 {
410 return (ldp_vty_l2vpn_mtu(vty, no, mtu));
411 }
412
413 DEFPY (ldp_member_interface,
414 ldp_member_interface_cmd,
415 "[no] member interface IFNAME$ifname",
416 NO_STR
417 "L2VPN member configuration\n"
418 "Local interface\n"
419 "Interface's name\n")
420 {
421 return (ldp_vty_l2vpn_interface(vty, no, ifname));
422 }
423
424 DEFPY_NOSH(ldp_member_pseudowire,
425 ldp_member_pseudowire_cmd,
426 "member pseudowire IFNAME$ifname",
427 "L2VPN member configuration\n"
428 "Pseudowire interface\n"
429 "Interface's name\n")
430 {
431 return (ldp_vty_l2vpn_pseudowire(vty, NULL, 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\
585 [<A.B.C.D/M|X:X::X:X/M>$prefix [longer-prefixes$longer_prefixes]]\
586 [{\
587 neighbor A.B.C.D$nbr\
588 |local-label (0-1048575)$local_label\
589 |remote-label (0-1048575)$remote_label\
590 }]\
591 [detail]$detail [json]$json",
592 "Show running system information\n"
593 "MPLS information\n"
594 "Label Distribution Protocol\n"
595 "IPv4 Address Family\n"
596 "IPv6 Address Family\n"
597 "Label Information Base (LIB) information\n"
598 "Destination prefix (IPv4)\n"
599 "Destination prefix (IPv6)\n"
600 "Include longer matches\n"
601 "Display labels from LDP neighbor\n"
602 "Neighbor LSR-ID\n"
603 "Match locally assigned label values\n"
604 "Locally assigned label value\n"
605 "Match remotely assigned label values\n"
606 "Remotely assigned label value\n"
607 "Show detailed information\n"
608 JSON_STR)
609 {
610 if (!local_label_str)
611 local_label = NO_LABEL;
612 if (!remote_label_str)
613 remote_label = NO_LABEL;
614 return (ldp_vty_show_binding(vty, af, prefix_str, !!longer_prefixes,
615 nbr_str, local_label, remote_label, detail, json));
616 }
617
618 DEFPY (ldp_show_mpls_ldp_discovery,
619 ldp_show_mpls_ldp_discovery_cmd,
620 "show mpls ldp [<ipv4|ipv6>]$af discovery [detail]$detail [json]$json",
621 "Show running system information\n"
622 "MPLS information\n"
623 "Label Distribution Protocol\n"
624 "IPv4 Address Family\n"
625 "IPv6 Address Family\n"
626 "Discovery Hello Information\n"
627 "Show detailed information\n"
628 JSON_STR)
629 {
630 return (ldp_vty_show_discovery(vty, af, detail, json));
631 }
632
633 DEFPY (ldp_show_mpls_ldp_interface,
634 ldp_show_mpls_ldp_interface_cmd,
635 "show mpls ldp [<ipv4|ipv6>]$af interface [json]$json",
636 "Show running system information\n"
637 "MPLS information\n"
638 "Label Distribution Protocol\n"
639 "IPv4 Address Family\n"
640 "IPv6 Address Family\n"
641 "interface information\n"
642 JSON_STR)
643 {
644 return (ldp_vty_show_interface(vty, af, json));
645 }
646
647 DEFPY (ldp_show_mpls_ldp_capabilities,
648 ldp_show_mpls_ldp_capabilities_cmd,
649 "show mpls ldp capabilities [json]$json",
650 "Show running system information\n"
651 "MPLS information\n"
652 "Label Distribution Protocol\n"
653 "Display LDP Capabilities information\n"
654 JSON_STR)
655 {
656 return (ldp_vty_show_capabilities(vty, json));
657 }
658
659 DEFPY (ldp_show_mpls_ldp_neighbor,
660 ldp_show_mpls_ldp_neighbor_cmd,
661 "show mpls ldp neighbor [A.B.C.D]$lsr_id [detail]$detail [json]$json",
662 "Show running system information\n"
663 "MPLS information\n"
664 "Label Distribution Protocol\n"
665 "Neighbor information\n"
666 "Neighbor LSR-ID\n"
667 "Show detailed information\n"
668 JSON_STR)
669 {
670 return (ldp_vty_show_neighbor(vty, lsr_id_str, 0, detail, json));
671 }
672
673 DEFPY (ldp_show_mpls_ldp_neighbor_capabilities,
674 ldp_show_mpls_ldp_neighbor_capabilities_cmd,
675 "show mpls ldp neighbor [A.B.C.D]$lsr_id capabilities [json]$json",
676 "Show running system information\n"
677 "MPLS information\n"
678 "Label Distribution Protocol\n"
679 "Neighbor information\n"
680 "Neighbor LSR-ID\n"
681 "Display neighbor capability information\n"
682 JSON_STR)
683 {
684 return (ldp_vty_show_neighbor(vty, lsr_id_str, 1, NULL, json));
685 }
686
687 DEFPY (ldp_show_l2vpn_atom_binding,
688 ldp_show_l2vpn_atom_binding_cmd,
689 "show l2vpn atom binding\
690 [{\
691 A.B.C.D$peer\
692 |local-label (16-1048575)$local_label\
693 |remote-label (16-1048575)$remote_label\
694 }]\
695 [json]$json",
696 "Show running system information\n"
697 "Show information about Layer2 VPN\n"
698 "Show Any Transport over MPLS information\n"
699 "Show AToM label binding information\n"
700 "Destination address of the VC\n"
701 "Match locally assigned label values\n"
702 "Locally assigned label value\n"
703 "Match remotely assigned label values\n"
704 "Remotely assigned label value\n"
705 JSON_STR)
706 {
707 if (!local_label_str)
708 local_label = NO_LABEL;
709 if (!remote_label_str)
710 remote_label = NO_LABEL;
711 return (ldp_vty_show_atom_binding(vty, peer_str, local_label,
712 remote_label, json));
713 }
714
715 DEFPY (ldp_show_l2vpn_atom_vc,
716 ldp_show_l2vpn_atom_vc_cmd,
717 "show l2vpn atom vc\
718 [{\
719 A.B.C.D$peer\
720 |interface IFNAME$ifname\
721 |vc-id (1-4294967295)$vcid\
722 }]\
723 [json]$json",
724 "Show running system information\n"
725 "Show information about Layer2 VPN\n"
726 "Show Any Transport over MPLS information\n"
727 "Show AToM virtual circuit information\n"
728 "Destination address of the VC\n"
729 "Local interface of the pseudowire\n"
730 "Interface's name\n"
731 "VC ID\n"
732 "VC ID\n"
733 JSON_STR)
734 {
735 return (ldp_vty_show_atom_vc(vty, peer_str, ifname, vcid_str, json));
736 }
737
738 DEFPY_NOSH (ldp_show_debugging_mpls_ldp,
739 ldp_show_debugging_mpls_ldp_cmd,
740 "show debugging [mpls ldp]",
741 "Show running system information\n"
742 "Debugging functions\n"
743 "MPLS information\n"
744 "Label Distribution Protocol\n")
745 {
746 return (ldp_vty_show_debugging(vty));
747 }
748
749 static void
750 l2vpn_autocomplete(vector comps, struct cmd_token *token)
751 {
752 struct l2vpn *l2vpn;
753
754 RB_FOREACH(l2vpn, l2vpn_head, &vty_conf->l2vpn_tree)
755 vector_set(comps, XSTRDUP(MTYPE_COMPLETION, l2vpn->name));
756 }
757
758 static const struct cmd_variable_handler l2vpn_var_handlers[] = {
759 {
760 .varname = "l2vpn_name",
761 .completions = l2vpn_autocomplete
762 },
763 {
764 .completions = NULL
765 }
766 };
767
768 void
769 ldp_vty_init (void)
770 {
771 cmd_variable_handler_register(l2vpn_var_handlers);
772
773 install_node(&ldp_node, ldp_config_write);
774 install_node(&ldp_ipv4_node, NULL);
775 install_node(&ldp_ipv6_node, NULL);
776 install_node(&ldp_ipv4_iface_node, NULL);
777 install_node(&ldp_ipv6_iface_node, NULL);
778 install_node(&ldp_l2vpn_node, ldp_l2vpn_config_write);
779 install_node(&ldp_pseudowire_node, NULL);
780 install_node(&ldp_debug_node, ldp_debug_config_write);
781 install_default(LDP_NODE);
782 install_default(LDP_IPV4_NODE);
783 install_default(LDP_IPV6_NODE);
784 install_default(LDP_IPV4_IFACE_NODE);
785 install_default(LDP_IPV6_IFACE_NODE);
786 install_default(LDP_L2VPN_NODE);
787 install_default(LDP_PSEUDOWIRE_NODE);
788
789 install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd);
790 install_element(CONFIG_NODE, &no_ldp_mpls_ldp_cmd);
791 install_element(CONFIG_NODE, &ldp_l2vpn_cmd);
792 install_element(CONFIG_NODE, &no_ldp_l2vpn_cmd);
793 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
794 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_type_cmd);
795 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
796 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
797
798 install_element(LDP_NODE, &ldp_address_family_cmd);
799 install_element(LDP_NODE, &no_ldp_address_family_cmd);
800 install_element(LDP_NODE, &ldp_discovery_link_holdtime_cmd);
801 install_element(LDP_NODE, &ldp_discovery_targeted_holdtime_cmd);
802 install_element(LDP_NODE, &ldp_discovery_link_interval_cmd);
803 install_element(LDP_NODE, &ldp_discovery_targeted_interval_cmd);
804 install_element(LDP_NODE, &ldp_dual_stack_transport_connection_prefer_ipv4_cmd);
805 install_element(LDP_NODE, &ldp_dual_stack_cisco_interop_cmd);
806 install_element(LDP_NODE, &ldp_neighbor_password_cmd);
807 install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
808 install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
809 install_element(LDP_NODE, &ldp_router_id_cmd);
810
811 install_element(LDP_IPV4_NODE, &ldp_discovery_link_holdtime_cmd);
812 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_holdtime_cmd);
813 install_element(LDP_IPV4_NODE, &ldp_discovery_link_interval_cmd);
814 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_interval_cmd);
815 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_hello_accept_cmd);
816 install_element(LDP_IPV4_NODE, &ldp_discovery_transport_address_ipv4_cmd);
817 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_cmd);
818 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_explicit_null_cmd);
819 install_element(LDP_IPV4_NODE, &ldp_label_local_allocate_cmd);
820 install_element(LDP_IPV4_NODE, &ldp_label_remote_accept_cmd);
821 install_element(LDP_IPV4_NODE, &ldp_ttl_security_disable_cmd);
822 install_element(LDP_IPV4_NODE, &ldp_interface_cmd);
823 install_element(LDP_IPV4_NODE, &no_ldp_interface_cmd);
824 install_element(LDP_IPV4_NODE, &ldp_session_holdtime_cmd);
825 install_element(LDP_IPV4_NODE, &ldp_neighbor_ipv4_targeted_cmd);
826 install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd);
827
828 install_element(LDP_IPV6_NODE, &ldp_discovery_link_holdtime_cmd);
829 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_holdtime_cmd);
830 install_element(LDP_IPV6_NODE, &ldp_discovery_link_interval_cmd);
831 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_interval_cmd);
832 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_hello_accept_cmd);
833 install_element(LDP_IPV6_NODE, &ldp_discovery_transport_address_ipv6_cmd);
834 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_cmd);
835 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_explicit_null_cmd);
836 install_element(LDP_IPV6_NODE, &ldp_label_local_allocate_cmd);
837 install_element(LDP_IPV6_NODE, &ldp_label_remote_accept_cmd);
838 install_element(LDP_IPV6_NODE, &ldp_ttl_security_disable_cmd);
839 install_element(LDP_IPV6_NODE, &ldp_interface_cmd);
840 install_element(LDP_IPV6_NODE, &no_ldp_interface_cmd);
841 install_element(LDP_IPV6_NODE, &ldp_session_holdtime_cmd);
842 install_element(LDP_IPV6_NODE, &ldp_neighbor_ipv6_targeted_cmd);
843 install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd);
844
845 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
846 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd);
847
848 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
849 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd);
850
851 install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd);
852 install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd);
853 install_element(LDP_L2VPN_NODE, &ldp_member_interface_cmd);
854 install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_cmd);
855 install_element(LDP_L2VPN_NODE, &no_ldp_member_pseudowire_cmd);
856 install_element(LDP_L2VPN_NODE, &ldp_vc_type_cmd);
857
858 install_element(LDP_PSEUDOWIRE_NODE, &ldp_control_word_cmd);
859 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_address_cmd);
860 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_lsr_id_cmd);
861 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_id_cmd);
862 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_status_disable_cmd);
863
864 install_element(ENABLE_NODE, &ldp_clear_mpls_ldp_neighbor_cmd);
865 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
866 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_type_cmd);
867 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
868 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
869
870 install_element(VIEW_NODE, &ldp_show_mpls_ldp_binding_cmd);
871 install_element(VIEW_NODE, &ldp_show_mpls_ldp_discovery_cmd);
872 install_element(VIEW_NODE, &ldp_show_mpls_ldp_interface_cmd);
873 install_element(VIEW_NODE, &ldp_show_mpls_ldp_capabilities_cmd);
874 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_cmd);
875 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_capabilities_cmd);
876 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_binding_cmd);
877 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_vc_cmd);
878 install_element(VIEW_NODE, &ldp_show_debugging_mpls_ldp_cmd);
879 }