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