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