]> git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_vty_cmds.c
ldpd: adding support for LDP ordered label distribution control
[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_discovery_targeted_hello_accept,
234 ldp_discovery_targeted_hello_accept_cmd,
235 "[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>$from_acl]",
236 NO_STR
237 "Configure discovery parameters\n"
238 "LDP Targeted Hellos\n"
239 "Accept and respond to targeted hellos\n"
240 "Access list to specify acceptable targeted hello source\n"
241 "IP access-list number\n"
242 "IP access-list number (expanded range)\n"
243 "IP access-list name\n")
244 {
245 return (ldp_vty_targeted_hello_accept(vty, no, from_acl));
246 }
247
248 DEFPY (ldp_discovery_transport_address_ipv4,
249 ldp_discovery_transport_address_ipv4_cmd,
250 "[no] discovery transport-address A.B.C.D$address",
251 NO_STR
252 "Configure discovery parameters\n"
253 "Specify transport address for TCP connection\n"
254 "IP address to be used as transport address\n")
255 {
256 return (ldp_vty_trans_addr(vty, no, address_str));
257 }
258
259 DEFPY (ldp_discovery_transport_address_ipv6,
260 ldp_discovery_transport_address_ipv6_cmd,
261 "[no] discovery transport-address X:X::X:X$address",
262 NO_STR
263 "Configure discovery parameters\n"
264 "Specify transport address for TCP connection\n"
265 "IPv6 address to be used as transport address\n")
266 {
267 return (ldp_vty_trans_addr(vty, no, address_str));
268 }
269
270 DEFPY (ldp_label_local_advertise,
271 ldp_label_local_advertise_cmd,
272 "[no] label local advertise [{to <(1-199)|(1300-2699)|WORD>$to_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}]",
273 NO_STR
274 "Configure label control and policies\n"
275 "Configure local label control and policies\n"
276 "Configure outbound label advertisement control\n"
277 "IP Access-list specifying controls on LDP Peers\n"
278 "IP access-list number\n"
279 "IP access-list number (expanded range)\n"
280 "IP access-list name\n"
281 "IP access-list for destination prefixes\n"
282 "IP access-list number\n"
283 "IP access-list number (expanded range)\n"
284 "IP access-list name\n")
285 {
286 return (ldp_vty_label_advertise(vty, no, to_acl, for_acl));
287 }
288
289 DEFPY (ldp_label_local_advertise_explicit_null,
290 ldp_label_local_advertise_explicit_null_cmd,
291 "[no] label local advertise explicit-null [for <(1-199)|(1300-2699)|WORD>$for_acl]",
292 NO_STR
293 "Configure label control and policies\n"
294 "Configure local label control and policies\n"
295 "Configure outbound label advertisement control\n"
296 "Configure explicit-null advertisement\n"
297 "IP access-list for destination prefixes\n"
298 "IP access-list number\n"
299 "IP access-list number (expanded range)\n"
300 "IP access-list name\n")
301 {
302 return (ldp_vty_label_expnull(vty, no, for_acl));
303 }
304
305 DEFPY (ldp_label_local_allocate,
306 ldp_label_local_allocate_cmd,
307 "[no] label local allocate <host-routes$host_routes|for <(1-199)|(1300-2699)|WORD>$for_acl>",
308 NO_STR
309 "Configure label control and policies\n"
310 "Configure local label control and policies\n"
311 "Configure label allocation control\n"
312 "allocate local label for host routes only\n"
313 "IP access-list\n"
314 "IP access-list number\n"
315 "IP access-list number (expanded range)\n"
316 "IP access-list name\n")
317 {
318 return (ldp_vty_label_allocate(vty, no, host_routes, for_acl));
319 }
320
321 DEFPY (ldp_label_remote_accept,
322 ldp_label_remote_accept_cmd,
323 "[no] label remote accept {from <(1-199)|(1300-2699)|WORD>$from_acl|for <(1-199)|(1300-2699)|WORD>$for_acl}",
324 NO_STR
325 "Configure label control and policies\n"
326 "Configure remote/peer label control and policies\n"
327 "Configure inbound label acceptance control\n"
328 "Neighbor from whom to accept label advertisement\n"
329 "IP access-list number\n"
330 "IP access-list number (expanded range)\n"
331 "IP access-list name\n"
332 "IP access-list for destination prefixes\n"
333 "IP access-list number\n"
334 "IP access-list number (expanded range)\n"
335 "IP access-list name\n")
336 {
337 return (ldp_vty_label_accept(vty, no, from_acl, for_acl));
338 }
339
340 DEFPY (ldp_ttl_security_disable,
341 ldp_ttl_security_disable_cmd,
342 "[no] ttl-security disable",
343 NO_STR
344 "LDP ttl security check\n"
345 "Disable ttl security\n")
346 {
347 return (ldp_vty_ttl_security(vty, no));
348 }
349
350 DEFPY (ldp_session_holdtime,
351 ldp_session_holdtime_cmd,
352 "[no] session holdtime (15-65535)$holdtime",
353 NO_STR
354 "Configure session parameters\n"
355 "Configure session holdtime\n"
356 "Time (seconds)\n")
357 {
358 return (ldp_vty_af_session_holdtime(vty, no, holdtime));
359 }
360
361 DEFPY_NOSH(ldp_interface,
362 ldp_interface_cmd,
363 "interface IFNAME$ifname",
364 "Enable LDP on an interface and enter interface submode\n"
365 "Interface's name\n")
366 {
367 return (ldp_vty_interface(vty, NULL, ifname));
368 }
369
370 DEFPY (no_ldp_interface,
371 no_ldp_interface_cmd,
372 "no interface IFNAME$ifname",
373 NO_STR
374 "Enable LDP on an interface and enter interface submode\n"
375 "Interface's name\n")
376 {
377 return (ldp_vty_interface(vty, "no", ifname));
378 }
379
380 DEFPY (ldp_neighbor_ipv4_targeted,
381 ldp_neighbor_ipv4_targeted_cmd,
382 "[no] neighbor A.B.C.D$address targeted",
383 NO_STR
384 "Configure neighbor parameters\n"
385 "IP address of neighbor\n"
386 "Establish targeted session\n")
387 {
388 return (ldp_vty_neighbor_targeted(vty, no, address_str));
389 }
390
391 DEFPY (ldp_neighbor_ipv6_targeted,
392 ldp_neighbor_ipv6_targeted_cmd,
393 "[no] neighbor X:X::X:X$address targeted",
394 NO_STR
395 "Configure neighbor parameters\n"
396 "IPv6 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_bridge,
403 ldp_bridge_cmd,
404 "[no] bridge IFNAME$ifname",
405 NO_STR
406 "Bridge interface\n"
407 "Interface's name\n")
408 {
409 return (ldp_vty_l2vpn_bridge(vty, no, ifname));
410 }
411
412 DEFPY (ldp_mtu,
413 ldp_mtu_cmd,
414 "[no] mtu (1500-9180)$mtu",
415 NO_STR
416 "Set Maximum Transmission Unit\n"
417 "Maximum Transmission Unit value\n")
418 {
419 return (ldp_vty_l2vpn_mtu(vty, no, mtu));
420 }
421
422 DEFPY (ldp_member_interface,
423 ldp_member_interface_cmd,
424 "[no] member interface IFNAME$ifname",
425 NO_STR
426 "L2VPN member configuration\n"
427 "Local interface\n"
428 "Interface's name\n")
429 {
430 return (ldp_vty_l2vpn_interface(vty, no, ifname));
431 }
432
433 DEFPY_NOSH(ldp_member_pseudowire,
434 ldp_member_pseudowire_cmd,
435 "member pseudowire IFNAME$ifname",
436 "L2VPN member configuration\n"
437 "Pseudowire interface\n"
438 "Interface's name\n")
439 {
440 return (ldp_vty_l2vpn_pseudowire(vty, NULL, ifname));
441 }
442
443 DEFPY (no_ldp_member_pseudowire,
444 no_ldp_member_pseudowire_cmd,
445 "no member pseudowire IFNAME$ifname",
446 NO_STR
447 "L2VPN member configuration\n"
448 "Pseudowire interface\n"
449 "Interface's name\n")
450 {
451 return (ldp_vty_l2vpn_pseudowire(vty, "no", ifname));
452 }
453
454 DEFPY (ldp_vc_type,
455 ldp_vc_type_cmd,
456 "[no] vc type <ethernet|ethernet-tagged>$vc_type",
457 NO_STR
458 "Virtual Circuit options\n"
459 "Virtual Circuit type to use\n"
460 "Ethernet (type 5)\n"
461 "Ethernet-tagged (type 4)\n")
462 {
463 return (ldp_vty_l2vpn_pwtype(vty, no, vc_type));
464 }
465
466 DEFPY (ldp_control_word,
467 ldp_control_word_cmd,
468 "[no] control-word <exclude|include>$preference",
469 NO_STR
470 "Control-word options\n"
471 "Exclude control-word in pseudowire packets\n"
472 "Include control-word in pseudowire packets\n")
473 {
474 return (ldp_vty_l2vpn_pw_cword(vty, no, preference));
475 }
476
477 DEFPY (ldp_neighbor_address,
478 ldp_neighbor_address_cmd,
479 "[no] neighbor address <A.B.C.D|X:X::X:X>$pw_address",
480 NO_STR
481 "Remote endpoint configuration\n"
482 "Specify the IPv4 or IPv6 address of the remote endpoint\n"
483 "IPv4 address\n"
484 "IPv6 address\n")
485 {
486 return (ldp_vty_l2vpn_pw_nbr_addr(vty, no, pw_address_str));
487 }
488
489 DEFPY (ldp_neighbor_lsr_id,
490 ldp_neighbor_lsr_id_cmd,
491 "[no] neighbor lsr-id A.B.C.D$address",
492 NO_STR
493 "Remote endpoint configuration\n"
494 "Specify the LSR-ID of the remote endpoint\n"
495 "IPv4 address\n")
496 {
497 return (ldp_vty_l2vpn_pw_nbr_id(vty, no, address));
498 }
499
500 DEFPY (ldp_pw_id,
501 ldp_pw_id_cmd,
502 "[no] pw-id (1-4294967295)$pwid",
503 NO_STR
504 "Set the Virtual Circuit ID\n"
505 "Virtual Circuit ID value\n")
506 {
507 return (ldp_vty_l2vpn_pw_pwid(vty, no, pwid));
508 }
509
510 DEFPY (ldp_pw_status_disable,
511 ldp_pw_status_disable_cmd,
512 "[no] pw-status disable",
513 NO_STR
514 "Configure PW status\n"
515 "Disable PW status\n")
516 {
517 return (ldp_vty_l2vpn_pw_pwstatus(vty, no));
518 }
519
520 DEFPY (ldp_clear_mpls_ldp_neighbor,
521 ldp_clear_mpls_ldp_neighbor_cmd,
522 "clear mpls ldp neighbor [<A.B.C.D|X:X::X:X>]$address",
523 "Reset functions\n"
524 "Reset MPLS statistical information\n"
525 "Clear LDP state\n"
526 "Clear LDP neighbor sessions\n"
527 "IPv4 address\n"
528 "IPv6 address\n")
529 {
530 return (ldp_vty_clear_nbr(vty, address_str));
531 }
532
533 DEFPY (ldp_debug_mpls_ldp_discovery_hello,
534 ldp_debug_mpls_ldp_discovery_hello_cmd,
535 "[no] debug mpls ldp discovery hello <recv|sent>$dir",
536 NO_STR
537 "Debugging functions\n"
538 "MPLS information\n"
539 "Label Distribution Protocol\n"
540 "Discovery messages\n"
541 "Discovery hello message\n"
542 "Received messages\n"
543 "Sent messages\n")
544 {
545 return (ldp_vty_debug(vty, no, "discovery", dir, NULL));
546 }
547
548 DEFPY (ldp_debug_mpls_ldp_type,
549 ldp_debug_mpls_ldp_type_cmd,
550 "[no] debug mpls ldp <errors|event|labels|zebra>$type",
551 NO_STR
552 "Debugging functions\n"
553 "MPLS information\n"
554 "Label Distribution Protocol\n"
555 "Errors\n"
556 "LDP event information\n"
557 "LDP label allocation information\n"
558 "LDP zebra information\n")
559 {
560 return (ldp_vty_debug(vty, no, type, NULL, NULL));
561 }
562
563 DEFPY (ldp_debug_mpls_ldp_messages_recv,
564 ldp_debug_mpls_ldp_messages_recv_cmd,
565 "[no] debug mpls ldp messages recv [all]$all",
566 NO_STR
567 "Debugging functions\n"
568 "MPLS information\n"
569 "Label Distribution Protocol\n"
570 "Messages\n"
571 "Received messages, excluding periodic Keep Alives\n"
572 "Received messages, including periodic Keep Alives\n")
573 {
574 return (ldp_vty_debug(vty, no, "messages", "recv", all));
575 }
576
577 DEFPY (ldp_debug_mpls_ldp_messages_sent,
578 ldp_debug_mpls_ldp_messages_sent_cmd,
579 "[no] debug mpls ldp messages sent [all]$all",
580 NO_STR
581 "Debugging functions\n"
582 "MPLS information\n"
583 "Label Distribution Protocol\n"
584 "Messages\n"
585 "Sent messages, excluding periodic Keep Alives\n"
586 "Sent messages, including periodic Keep Alives\n")
587 {
588 return (ldp_vty_debug(vty, no, "messages", "sent", all));
589 }
590
591 DEFPY (ldp_show_mpls_ldp_binding,
592 ldp_show_mpls_ldp_binding_cmd,
593 "show mpls ldp [<ipv4|ipv6>]$af binding\
594 [<A.B.C.D/M|X:X::X:X/M>$prefix [longer-prefixes$longer_prefixes]]\
595 [{\
596 neighbor A.B.C.D$nbr\
597 |local-label (0-1048575)$local_label\
598 |remote-label (0-1048575)$remote_label\
599 }]\
600 [detail]$detail [json]$json",
601 "Show running system information\n"
602 "MPLS information\n"
603 "Label Distribution Protocol\n"
604 "IPv4 Address Family\n"
605 "IPv6 Address Family\n"
606 "Label Information Base (LIB) information\n"
607 "Destination prefix (IPv4)\n"
608 "Destination prefix (IPv6)\n"
609 "Include longer matches\n"
610 "Display labels from LDP neighbor\n"
611 "Neighbor LSR-ID\n"
612 "Match locally assigned label values\n"
613 "Locally assigned label value\n"
614 "Match remotely assigned label values\n"
615 "Remotely assigned label value\n"
616 "Show detailed information\n"
617 JSON_STR)
618 {
619 if (!local_label_str)
620 local_label = NO_LABEL;
621 if (!remote_label_str)
622 remote_label = NO_LABEL;
623 return (ldp_vty_show_binding(vty, af, prefix_str, !!longer_prefixes,
624 nbr_str, local_label, remote_label, detail, json));
625 }
626
627 DEFPY (ldp_show_mpls_ldp_discovery,
628 ldp_show_mpls_ldp_discovery_cmd,
629 "show mpls ldp [<ipv4|ipv6>]$af discovery [detail]$detail [json]$json",
630 "Show running system information\n"
631 "MPLS information\n"
632 "Label Distribution Protocol\n"
633 "IPv4 Address Family\n"
634 "IPv6 Address Family\n"
635 "Discovery Hello Information\n"
636 "Show detailed information\n"
637 JSON_STR)
638 {
639 return (ldp_vty_show_discovery(vty, af, detail, json));
640 }
641
642 DEFPY (ldp_show_mpls_ldp_interface,
643 ldp_show_mpls_ldp_interface_cmd,
644 "show mpls ldp [<ipv4|ipv6>]$af interface [json]$json",
645 "Show running system information\n"
646 "MPLS information\n"
647 "Label Distribution Protocol\n"
648 "IPv4 Address Family\n"
649 "IPv6 Address Family\n"
650 "interface information\n"
651 JSON_STR)
652 {
653 return (ldp_vty_show_interface(vty, af, json));
654 }
655
656 DEFPY (ldp_show_mpls_ldp_capabilities,
657 ldp_show_mpls_ldp_capabilities_cmd,
658 "show mpls ldp capabilities [json]$json",
659 "Show running system information\n"
660 "MPLS information\n"
661 "Label Distribution Protocol\n"
662 "Display LDP Capabilities information\n"
663 JSON_STR)
664 {
665 return (ldp_vty_show_capabilities(vty, json));
666 }
667
668 DEFPY (ldp_show_mpls_ldp_neighbor,
669 ldp_show_mpls_ldp_neighbor_cmd,
670 "show mpls ldp neighbor [A.B.C.D]$lsr_id [detail]$detail [json]$json",
671 "Show running system information\n"
672 "MPLS information\n"
673 "Label Distribution Protocol\n"
674 "Neighbor information\n"
675 "Neighbor LSR-ID\n"
676 "Show detailed information\n"
677 JSON_STR)
678 {
679 return (ldp_vty_show_neighbor(vty, lsr_id_str, 0, detail, json));
680 }
681
682 DEFPY (ldp_show_mpls_ldp_neighbor_capabilities,
683 ldp_show_mpls_ldp_neighbor_capabilities_cmd,
684 "show mpls ldp neighbor [A.B.C.D]$lsr_id capabilities [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 "Display neighbor capability information\n"
691 JSON_STR)
692 {
693 return (ldp_vty_show_neighbor(vty, lsr_id_str, 1, NULL, json));
694 }
695
696 DEFPY (ldp_show_l2vpn_atom_binding,
697 ldp_show_l2vpn_atom_binding_cmd,
698 "show l2vpn atom binding\
699 [{\
700 A.B.C.D$peer\
701 |local-label (16-1048575)$local_label\
702 |remote-label (16-1048575)$remote_label\
703 }]\
704 [json]$json",
705 "Show running system information\n"
706 "Show information about Layer2 VPN\n"
707 "Show Any Transport over MPLS information\n"
708 "Show AToM label binding information\n"
709 "Destination address of the VC\n"
710 "Match locally assigned label values\n"
711 "Locally assigned label value\n"
712 "Match remotely assigned label values\n"
713 "Remotely assigned label value\n"
714 JSON_STR)
715 {
716 if (!local_label_str)
717 local_label = NO_LABEL;
718 if (!remote_label_str)
719 remote_label = NO_LABEL;
720 return (ldp_vty_show_atom_binding(vty, peer_str, local_label,
721 remote_label, json));
722 }
723
724 DEFPY (ldp_show_l2vpn_atom_vc,
725 ldp_show_l2vpn_atom_vc_cmd,
726 "show l2vpn atom vc\
727 [{\
728 A.B.C.D$peer\
729 |interface IFNAME$ifname\
730 |vc-id (1-4294967295)$vcid\
731 }]\
732 [json]$json",
733 "Show running system information\n"
734 "Show information about Layer2 VPN\n"
735 "Show Any Transport over MPLS information\n"
736 "Show AToM virtual circuit information\n"
737 "Destination address of the VC\n"
738 "Local interface of the pseudowire\n"
739 "Interface's name\n"
740 "VC ID\n"
741 "VC ID\n"
742 JSON_STR)
743 {
744 return (ldp_vty_show_atom_vc(vty, peer_str, ifname, vcid_str, json));
745 }
746
747 DEFPY_NOSH (ldp_show_debugging_mpls_ldp,
748 ldp_show_debugging_mpls_ldp_cmd,
749 "show debugging [mpls ldp]",
750 "Show running system information\n"
751 "Debugging functions\n"
752 "MPLS information\n"
753 "Label Distribution Protocol\n")
754 {
755 return (ldp_vty_show_debugging(vty));
756 }
757
758 static void
759 l2vpn_autocomplete(vector comps, struct cmd_token *token)
760 {
761 struct l2vpn *l2vpn;
762
763 RB_FOREACH(l2vpn, l2vpn_head, &vty_conf->l2vpn_tree)
764 vector_set(comps, XSTRDUP(MTYPE_COMPLETION, l2vpn->name));
765 }
766
767 static const struct cmd_variable_handler l2vpn_var_handlers[] = {
768 {
769 .varname = "l2vpn_name",
770 .completions = l2vpn_autocomplete
771 },
772 {
773 .completions = NULL
774 }
775 };
776
777 void
778 ldp_vty_init (void)
779 {
780 cmd_variable_handler_register(l2vpn_var_handlers);
781
782 install_node(&ldp_node, ldp_config_write);
783 install_node(&ldp_ipv4_node, NULL);
784 install_node(&ldp_ipv6_node, NULL);
785 install_node(&ldp_ipv4_iface_node, NULL);
786 install_node(&ldp_ipv6_iface_node, NULL);
787 install_node(&ldp_l2vpn_node, ldp_l2vpn_config_write);
788 install_node(&ldp_pseudowire_node, NULL);
789 install_node(&ldp_debug_node, ldp_debug_config_write);
790 install_default(LDP_NODE);
791 install_default(LDP_IPV4_NODE);
792 install_default(LDP_IPV6_NODE);
793 install_default(LDP_IPV4_IFACE_NODE);
794 install_default(LDP_IPV6_IFACE_NODE);
795 install_default(LDP_L2VPN_NODE);
796 install_default(LDP_PSEUDOWIRE_NODE);
797
798 install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd);
799 install_element(CONFIG_NODE, &no_ldp_mpls_ldp_cmd);
800 install_element(CONFIG_NODE, &ldp_l2vpn_cmd);
801 install_element(CONFIG_NODE, &no_ldp_l2vpn_cmd);
802 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
803 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_type_cmd);
804 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
805 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
806
807 install_element(LDP_NODE, &ldp_address_family_cmd);
808 install_element(LDP_NODE, &no_ldp_address_family_cmd);
809 install_element(LDP_NODE, &ldp_discovery_link_holdtime_cmd);
810 install_element(LDP_NODE, &ldp_discovery_targeted_holdtime_cmd);
811 install_element(LDP_NODE, &ldp_discovery_link_interval_cmd);
812 install_element(LDP_NODE, &ldp_discovery_targeted_interval_cmd);
813 install_element(LDP_NODE, &ldp_dual_stack_transport_connection_prefer_ipv4_cmd);
814 install_element(LDP_NODE, &ldp_dual_stack_cisco_interop_cmd);
815 install_element(LDP_NODE, &ldp_neighbor_password_cmd);
816 install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
817 install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
818 install_element(LDP_NODE, &ldp_router_id_cmd);
819 install_element(LDP_NODE, &ldp_ordered_control_cmd);
820
821 install_element(LDP_IPV4_NODE, &ldp_discovery_link_holdtime_cmd);
822 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_holdtime_cmd);
823 install_element(LDP_IPV4_NODE, &ldp_discovery_link_interval_cmd);
824 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_interval_cmd);
825 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_hello_accept_cmd);
826 install_element(LDP_IPV4_NODE, &ldp_discovery_transport_address_ipv4_cmd);
827 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_cmd);
828 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_explicit_null_cmd);
829 install_element(LDP_IPV4_NODE, &ldp_label_local_allocate_cmd);
830 install_element(LDP_IPV4_NODE, &ldp_label_remote_accept_cmd);
831 install_element(LDP_IPV4_NODE, &ldp_ttl_security_disable_cmd);
832 install_element(LDP_IPV4_NODE, &ldp_interface_cmd);
833 install_element(LDP_IPV4_NODE, &no_ldp_interface_cmd);
834 install_element(LDP_IPV4_NODE, &ldp_session_holdtime_cmd);
835 install_element(LDP_IPV4_NODE, &ldp_neighbor_ipv4_targeted_cmd);
836 install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd);
837
838 install_element(LDP_IPV6_NODE, &ldp_discovery_link_holdtime_cmd);
839 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_holdtime_cmd);
840 install_element(LDP_IPV6_NODE, &ldp_discovery_link_interval_cmd);
841 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_interval_cmd);
842 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_hello_accept_cmd);
843 install_element(LDP_IPV6_NODE, &ldp_discovery_transport_address_ipv6_cmd);
844 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_cmd);
845 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_explicit_null_cmd);
846 install_element(LDP_IPV6_NODE, &ldp_label_local_allocate_cmd);
847 install_element(LDP_IPV6_NODE, &ldp_label_remote_accept_cmd);
848 install_element(LDP_IPV6_NODE, &ldp_ttl_security_disable_cmd);
849 install_element(LDP_IPV6_NODE, &ldp_interface_cmd);
850 install_element(LDP_IPV6_NODE, &no_ldp_interface_cmd);
851 install_element(LDP_IPV6_NODE, &ldp_session_holdtime_cmd);
852 install_element(LDP_IPV6_NODE, &ldp_neighbor_ipv6_targeted_cmd);
853 install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd);
854
855 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
856 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd);
857
858 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
859 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd);
860
861 install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd);
862 install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd);
863 install_element(LDP_L2VPN_NODE, &ldp_member_interface_cmd);
864 install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_cmd);
865 install_element(LDP_L2VPN_NODE, &no_ldp_member_pseudowire_cmd);
866 install_element(LDP_L2VPN_NODE, &ldp_vc_type_cmd);
867
868 install_element(LDP_PSEUDOWIRE_NODE, &ldp_control_word_cmd);
869 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_address_cmd);
870 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_lsr_id_cmd);
871 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_id_cmd);
872 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_status_disable_cmd);
873
874 install_element(ENABLE_NODE, &ldp_clear_mpls_ldp_neighbor_cmd);
875 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
876 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_type_cmd);
877 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
878 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
879
880 install_element(VIEW_NODE, &ldp_show_mpls_ldp_binding_cmd);
881 install_element(VIEW_NODE, &ldp_show_mpls_ldp_discovery_cmd);
882 install_element(VIEW_NODE, &ldp_show_mpls_ldp_interface_cmd);
883 install_element(VIEW_NODE, &ldp_show_mpls_ldp_capabilities_cmd);
884 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_cmd);
885 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_capabilities_cmd);
886 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_binding_cmd);
887 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_vc_cmd);
888 install_element(VIEW_NODE, &ldp_show_debugging_mpls_ldp_cmd);
889 }