]> git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_vty_cmds.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ldpd / ldp_vty_cmds.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2016 by Open Source Routing.
4 */
5
6 #include <zebra.h>
7
8 #include "command.h"
9 #include "vty.h"
10 #include "json.h"
11
12 #include "ldpd/ldpd.h"
13 #include "ldpd/ldp_vty.h"
14 #include "ldpd/ldp_vty_cmds_clippy.c"
15
16 DEFPY_NOSH(ldp_mpls_ldp,
17 ldp_mpls_ldp_cmd,
18 "mpls ldp",
19 "Global MPLS configuration subcommands\n"
20 "Label Distribution Protocol\n")
21 {
22 return (ldp_vty_mpls_ldp(vty, NULL));
23 }
24
25 DEFPY (no_ldp_mpls_ldp,
26 no_ldp_mpls_ldp_cmd,
27 "no mpls ldp",
28 NO_STR
29 "Global MPLS configuration subcommands\n"
30 "Label Distribution Protocol\n")
31 {
32 return (ldp_vty_mpls_ldp(vty, "no"));
33 }
34
35 DEFPY_NOSH(ldp_l2vpn,
36 ldp_l2vpn_cmd,
37 "l2vpn WORD$l2vpn_name type vpls",
38 "Configure l2vpn commands\n"
39 "L2VPN name\n"
40 "L2VPN type\n"
41 "Virtual Private LAN Service\n")
42 {
43 return (ldp_vty_l2vpn(vty, NULL, l2vpn_name));
44 }
45
46 DEFPY (no_ldp_l2vpn,
47 no_ldp_l2vpn_cmd,
48 "no l2vpn WORD$l2vpn_name type vpls",
49 NO_STR
50 "Configure l2vpn commands\n"
51 "L2VPN name\n"
52 "L2VPN type\n"
53 "Virtual Private LAN Service\n")
54 {
55 return (ldp_vty_l2vpn(vty, "no", l2vpn_name));
56 }
57
58 DEFPY_NOSH(ldp_address_family,
59 ldp_address_family_cmd,
60 "address-family <ipv4|ipv6>$af",
61 "Configure Address Family and its parameters\n"
62 "IPv4\n"
63 "IPv6\n")
64 {
65 return (ldp_vty_address_family(vty, NULL, af));
66 }
67
68 DEFPY (no_ldp_address_family,
69 no_ldp_address_family_cmd,
70 "no address-family <ipv4|ipv6>$af",
71 NO_STR
72 "Configure Address Family and its parameters\n"
73 "IPv4\n"
74 "IPv6\n")
75 {
76 return (ldp_vty_address_family(vty, "no", af));
77 }
78
79 DEFPY_NOSH(ldp_exit_address_family,
80 ldp_exit_address_family_cmd,
81 "exit-address-family",
82 "Exit from Address Family configuration mode\n")
83 {
84 if (vty->node == LDP_IPV4_NODE || vty->node == LDP_IPV6_NODE)
85 vty->node = LDP_NODE;
86 return CMD_SUCCESS;
87 }
88
89 DEFPY (ldp_discovery_link_holdtime,
90 ldp_discovery_link_holdtime_cmd,
91 "[no] discovery hello holdtime (1-65535)$holdtime",
92 NO_STR
93 "Configure discovery parameters\n"
94 "LDP Link Hellos\n"
95 "Hello holdtime\n"
96 "Time (seconds) - 65535 implies infinite\n")
97 {
98 return (ldp_vty_disc_holdtime(vty, no, HELLO_LINK, holdtime));
99 }
100
101 DEFPY (ldp_discovery_targeted_holdtime,
102 ldp_discovery_targeted_holdtime_cmd,
103 "[no] discovery targeted-hello holdtime (1-65535)$holdtime",
104 NO_STR
105 "Configure discovery parameters\n"
106 "LDP Targeted Hellos\n"
107 "Hello holdtime\n"
108 "Time (seconds) - 65535 implies infinite\n")
109 {
110 return (ldp_vty_disc_holdtime(vty, no, HELLO_TARGETED, holdtime));
111 }
112
113 DEFPY (ldp_discovery_link_interval,
114 ldp_discovery_link_interval_cmd,
115 "[no] discovery hello interval (1-65535)$interval",
116 NO_STR
117 "Configure discovery parameters\n"
118 "LDP Link Hellos\n"
119 "Hello interval\n"
120 "Time (seconds)\n")
121 {
122 return (ldp_vty_disc_interval(vty, no, HELLO_LINK, interval));
123 }
124
125 DEFPY (ldp_discovery_targeted_interval,
126 ldp_discovery_targeted_interval_cmd,
127 "[no] discovery targeted-hello interval (1-65535)$interval",
128 NO_STR
129 "Configure discovery parameters\n"
130 "LDP Targeted Hellos\n"
131 "Hello interval\n"
132 "Time (seconds)\n")
133 {
134 return (ldp_vty_disc_interval(vty, no, HELLO_TARGETED, interval));
135 }
136
137 DEFPY (ldp_dual_stack_transport_connection_prefer_ipv4,
138 ldp_dual_stack_transport_connection_prefer_ipv4_cmd,
139 "[no] dual-stack transport-connection prefer ipv4",
140 NO_STR
141 "Configure dual stack parameters\n"
142 "Configure TCP transport parameters\n"
143 "Configure preferred address family for TCP transport connection with neighbor\n"
144 "IPv4\n")
145 {
146 return (ldp_vty_trans_pref_ipv4(vty, no));
147 }
148
149 DEFPY (ldp_dual_stack_cisco_interop,
150 ldp_dual_stack_cisco_interop_cmd,
151 "[no] dual-stack cisco-interop",
152 NO_STR
153 "Configure dual stack parameters\n"
154 "Use Cisco non-compliant format to send and interpret the Dual-Stack capability TLV\n")
155 {
156 return (ldp_vty_ds_cisco_interop(vty, no));
157 }
158
159 DEFPY (ldp_neighbor_password,
160 ldp_neighbor_password_cmd,
161 "[no] neighbor A.B.C.D$neighbor password WORD$password",
162 NO_STR
163 "Configure neighbor parameters\n"
164 "LDP Id of neighbor\n"
165 "Configure password for MD5 authentication\n"
166 "The password\n")
167 {
168 return (ldp_vty_neighbor_password(vty, no, neighbor, password));
169 }
170
171 DEFPY (ldp_neighbor_session_holdtime,
172 ldp_neighbor_session_holdtime_cmd,
173 "[no] neighbor A.B.C.D$neighbor session holdtime (15-65535)$holdtime",
174 NO_STR
175 "Configure neighbor parameters\n"
176 "LDP Id of neighbor\n"
177 "Configure session parameters\n"
178 "Configure session holdtime\n"
179 "Time (seconds)\n")
180 {
181 return (ldp_vty_nbr_session_holdtime(vty, no, neighbor, holdtime));
182 }
183
184 DEFPY (ldp_neighbor_ttl_security,
185 ldp_neighbor_ttl_security_cmd,
186 "[no] neighbor A.B.C.D$neighbor ttl-security <disable|hops (1-254)$hops>",
187 NO_STR
188 "Configure neighbor parameters\n"
189 "LDP Id of neighbor\n"
190 "LDP ttl security check\n"
191 "Disable ttl security\n"
192 "IP hops\n"
193 "maximum number of hops\n")
194 {
195 return (ldp_vty_neighbor_ttl_security(vty, no, neighbor, hops_str));
196 }
197
198 DEFPY (ldp_router_id,
199 ldp_router_id_cmd,
200 "[no] router-id A.B.C.D$address",
201 NO_STR
202 "Configure router Id\n"
203 "LSR Id (in form of an IPv4 address)\n")
204 {
205 return (ldp_vty_router_id(vty, no, address));
206 }
207
208 DEFPY (ldp_ordered_control,
209 ldp_ordered_control_cmd,
210 "[no] ordered-control",
211 NO_STR
212 "Configure LDP ordered label distribution control mode\n")
213 {
214 return (ldp_vty_ordered_control(vty, no));
215 }
216
217 DEFPY (ldp_wait_for_sync,
218 ldp_wait_for_sync_cmd,
219 "[no] wait-for-sync (1-10000)$waitforsync",
220 NO_STR
221 "Time to wait for LDP-IGP Sync to complete label exchange\n"
222 "Time (seconds)\n")
223 {
224 return (ldp_vty_wait_for_sync_interval(vty, no, waitforsync));
225
226 }
227
228 DEFPY (ldp_allow_broken_lsps,
229 ldp_allow_broken_lsps_cmd,
230 "[no] install allow-broken-lsps",
231 NO_STR
232 "install lsps\n"
233 "if no remote-label install with imp-null\n")
234 {
235 return (ldp_vty_allow_broken_lsp(vty, no));
236 }
237
238 DEFPY (ldp_discovery_targeted_hello_accept,
239 ldp_discovery_targeted_hello_accept_cmd,
240 "[no] discovery targeted-hello accept [from ACCESSLIST_NAME$from_acl]",
241 NO_STR
242 "Configure discovery parameters\n"
243 "LDP Targeted Hellos\n"
244 "Accept and respond to targeted hellos\n"
245 "Access list to specify acceptable targeted hello source\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 ACCESSLIST_NAME$to_acl|for ACCESSLIST_NAME$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 name\n"
282 "IP access-list for destination prefixes\n"
283 "IP access-list name\n")
284 {
285 return (ldp_vty_label_advertise(vty, no, to_acl, for_acl));
286 }
287
288 DEFPY (ldp_label_local_advertise_explicit_null,
289 ldp_label_local_advertise_explicit_null_cmd,
290 "[no] label local advertise explicit-null [for ACCESSLIST_NAME$for_acl]",
291 NO_STR
292 "Configure label control and policies\n"
293 "Configure local label control and policies\n"
294 "Configure outbound label advertisement control\n"
295 "Configure explicit-null advertisement\n"
296 "IP access-list for destination prefixes\n"
297 "IP access-list name\n")
298 {
299 return (ldp_vty_label_expnull(vty, no, for_acl));
300 }
301
302 DEFPY (ldp_label_local_allocate,
303 ldp_label_local_allocate_cmd,
304 "[no] label local allocate <host-routes$host_routes|for ACCESSLIST_NAME$for_acl>",
305 NO_STR
306 "Configure label control and policies\n"
307 "Configure local label control and policies\n"
308 "Configure label allocation control\n"
309 "allocate local label for host routes only\n"
310 "IP access-list\n"
311 "IP access-list name\n")
312 {
313 return (ldp_vty_label_allocate(vty, no, host_routes, for_acl));
314 }
315
316 DEFPY (ldp_label_remote_accept,
317 ldp_label_remote_accept_cmd,
318 "[no] label remote accept {from ACCESSLIST_NAME$from_acl|for ACCESSLIST_NAME$for_acl}",
319 NO_STR
320 "Configure label control and policies\n"
321 "Configure remote/peer label control and policies\n"
322 "Configure inbound label acceptance control\n"
323 "Neighbor from whom to accept label advertisement\n"
324 "IP access-list name\n"
325 "IP access-list for destination prefixes\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|sync|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 sync information\n"
550 "LDP zebra information\n")
551 {
552 return (ldp_vty_debug(vty, no, type, NULL, NULL));
553 }
554
555 DEFPY (ldp_debug_mpls_ldp_messages_recv,
556 ldp_debug_mpls_ldp_messages_recv_cmd,
557 "[no] debug mpls ldp messages recv [all]$all",
558 NO_STR
559 "Debugging functions\n"
560 "MPLS information\n"
561 "Label Distribution Protocol\n"
562 "Messages\n"
563 "Received messages, excluding periodic Keep Alives\n"
564 "Received messages, including periodic Keep Alives\n")
565 {
566 return (ldp_vty_debug(vty, no, "messages", "recv", all));
567 }
568
569 DEFPY (ldp_debug_mpls_ldp_messages_sent,
570 ldp_debug_mpls_ldp_messages_sent_cmd,
571 "[no] debug mpls ldp messages sent [all]$all",
572 NO_STR
573 "Debugging functions\n"
574 "MPLS information\n"
575 "Label Distribution Protocol\n"
576 "Messages\n"
577 "Sent messages, excluding periodic Keep Alives\n"
578 "Sent messages, including periodic Keep Alives\n")
579 {
580 return (ldp_vty_debug(vty, no, "messages", "sent", all));
581 }
582
583 DEFPY (ldp_show_mpls_ldp_binding,
584 ldp_show_mpls_ldp_binding_cmd,
585 "show mpls ldp [<ipv4|ipv6>]$af binding\
586 [<A.B.C.D/M|X:X::X:X/M>$prefix [longer-prefixes$longer_prefixes]]\
587 [{\
588 neighbor A.B.C.D$nbr\
589 |local-label (0-1048575)$local_label\
590 |remote-label (0-1048575)$remote_label\
591 }]\
592 [detail]$detail [json]$json",
593 "Show running system information\n"
594 "MPLS information\n"
595 "Label Distribution Protocol\n"
596 "IPv4 Address Family\n"
597 "IPv6 Address Family\n"
598 "Label Information Base (LIB) information\n"
599 "Destination prefix (IPv4)\n"
600 "Destination prefix (IPv6)\n"
601 "Include longer matches\n"
602 "Display labels from LDP neighbor\n"
603 "Neighbor LSR-ID\n"
604 "Match locally assigned label values\n"
605 "Locally assigned label value\n"
606 "Match remotely assigned label values\n"
607 "Remotely assigned label value\n"
608 "Show detailed information\n"
609 JSON_STR)
610 {
611 if (!(ldpd_conf->flags & F_LDPD_ENABLED))
612 return CMD_SUCCESS;
613 if (!local_label_str)
614 local_label = NO_LABEL;
615 if (!remote_label_str)
616 remote_label = NO_LABEL;
617 return (ldp_vty_show_binding(vty, af, prefix_str, !!longer_prefixes,
618 nbr_str, local_label, remote_label, detail, json));
619 }
620
621 DEFPY (ldp_show_mpls_ldp_discovery,
622 ldp_show_mpls_ldp_discovery_cmd,
623 "show mpls ldp [<ipv4|ipv6>]$af discovery [detail]$detail [json]$json",
624 "Show running system information\n"
625 "MPLS information\n"
626 "Label Distribution Protocol\n"
627 "IPv4 Address Family\n"
628 "IPv6 Address Family\n"
629 "Discovery Hello Information\n"
630 "Show detailed information\n"
631 JSON_STR)
632 {
633 return (ldp_vty_show_discovery(vty, af, detail, json));
634 }
635
636 DEFPY (ldp_show_mpls_ldp_interface,
637 ldp_show_mpls_ldp_interface_cmd,
638 "show mpls ldp [<ipv4|ipv6>]$af interface [json]$json",
639 "Show running system information\n"
640 "MPLS information\n"
641 "Label Distribution Protocol\n"
642 "IPv4 Address Family\n"
643 "IPv6 Address Family\n"
644 "interface information\n"
645 JSON_STR)
646 {
647 return (ldp_vty_show_interface(vty, af, json));
648 }
649
650 DEFPY (ldp_show_mpls_ldp_capabilities,
651 ldp_show_mpls_ldp_capabilities_cmd,
652 "show mpls ldp capabilities [json]$json",
653 "Show running system information\n"
654 "MPLS information\n"
655 "Label Distribution Protocol\n"
656 "Display LDP Capabilities information\n"
657 JSON_STR)
658 {
659 return (ldp_vty_show_capabilities(vty, json));
660 }
661
662 DEFPY (ldp_show_mpls_ldp_neighbor,
663 ldp_show_mpls_ldp_neighbor_cmd,
664 "show mpls ldp neighbor [A.B.C.D]$lsr_id [detail]$detail [json]$json",
665 "Show running system information\n"
666 "MPLS information\n"
667 "Label Distribution Protocol\n"
668 "Neighbor information\n"
669 "Neighbor LSR-ID\n"
670 "Show detailed information\n"
671 JSON_STR)
672 {
673 return (ldp_vty_show_neighbor(vty, lsr_id_str, 0, detail, json));
674 }
675
676 DEFPY (ldp_show_mpls_ldp_neighbor_capabilities,
677 ldp_show_mpls_ldp_neighbor_capabilities_cmd,
678 "show mpls ldp neighbor [A.B.C.D]$lsr_id capabilities [json]$json",
679 "Show running system information\n"
680 "MPLS information\n"
681 "Label Distribution Protocol\n"
682 "Neighbor information\n"
683 "Neighbor LSR-ID\n"
684 "Display neighbor capability information\n"
685 JSON_STR)
686 {
687 return (ldp_vty_show_neighbor(vty, lsr_id_str, 1, NULL, json));
688 }
689
690 DEFPY (ldp_show_mpls_ldp_igp_sync,
691 ldp_show_mpls_ldp_igp_sync_cmd,
692 "show mpls ldp igp-sync [json]$json",
693 "Show mpls ldp ldp-sync information\n"
694 "MPLS information\n"
695 "Label Distribution Protocol\n"
696 "LDP-IGP Sync information\n"
697 JSON_STR)
698 {
699 return (ldp_vty_show_ldp_sync(vty, json));
700 }
701
702 DEFPY (ldp_show_l2vpn_atom_binding,
703 ldp_show_l2vpn_atom_binding_cmd,
704 "show l2vpn atom binding\
705 [{\
706 A.B.C.D$peer\
707 |local-label (16-1048575)$local_label\
708 |remote-label (16-1048575)$remote_label\
709 }]\
710 [json]$json",
711 "Show running system information\n"
712 "Show information about Layer2 VPN\n"
713 "Show Any Transport over MPLS information\n"
714 "Show AToM label binding information\n"
715 "Destination address of the VC\n"
716 "Match locally assigned label values\n"
717 "Locally assigned label value\n"
718 "Match remotely assigned label values\n"
719 "Remotely assigned label value\n"
720 JSON_STR)
721 {
722 if (!local_label_str)
723 local_label = NO_LABEL;
724 if (!remote_label_str)
725 remote_label = NO_LABEL;
726 return (ldp_vty_show_atom_binding(vty, peer_str, local_label,
727 remote_label, json));
728 }
729
730 DEFPY (ldp_show_l2vpn_atom_vc,
731 ldp_show_l2vpn_atom_vc_cmd,
732 "show l2vpn atom vc\
733 [{\
734 A.B.C.D$peer\
735 |interface IFNAME$ifname\
736 |vc-id (1-4294967295)$vcid\
737 }]\
738 [json]$json",
739 "Show running system information\n"
740 "Show information about Layer2 VPN\n"
741 "Show Any Transport over MPLS information\n"
742 "Show AToM virtual circuit information\n"
743 "Destination address of the VC\n"
744 "Local interface of the pseudowire\n"
745 "Interface's name\n"
746 "VC ID\n"
747 "VC ID\n"
748 JSON_STR)
749 {
750 return (ldp_vty_show_atom_vc(vty, peer_str, ifname, vcid_str, json));
751 }
752
753 DEFPY_NOSH (ldp_show_debugging_mpls_ldp,
754 ldp_show_debugging_mpls_ldp_cmd,
755 "show debugging [mpls ldp]",
756 "Show running system information\n"
757 "Debugging functions\n"
758 "MPLS information\n"
759 "Label Distribution Protocol\n")
760 {
761 ldp_vty_show_debugging(vty);
762
763 cmd_show_lib_debugs(vty);
764
765 return CMD_SUCCESS;
766 }
767
768 static void
769 l2vpn_autocomplete(vector comps, struct cmd_token *token)
770 {
771 struct l2vpn *l2vpn;
772
773 RB_FOREACH(l2vpn, l2vpn_head, &vty_conf->l2vpn_tree)
774 vector_set(comps, XSTRDUP(MTYPE_COMPLETION, l2vpn->name));
775 }
776
777 static const struct cmd_variable_handler l2vpn_var_handlers[] = {
778 {
779 .varname = "l2vpn_name",
780 .completions = l2vpn_autocomplete
781 },
782 {
783 .completions = NULL
784 }
785 };
786
787 void
788 ldp_vty_init (void)
789 {
790 cmd_variable_handler_register(l2vpn_var_handlers);
791
792 install_node(&ldp_node);
793 install_node(&ldp_ipv4_node);
794 install_node(&ldp_ipv6_node);
795 install_node(&ldp_ipv4_iface_node);
796 install_node(&ldp_ipv6_iface_node);
797 install_node(&ldp_l2vpn_node);
798 install_node(&ldp_pseudowire_node);
799 install_node(&ldp_debug_node);
800 install_default(LDP_NODE);
801 install_default(LDP_IPV4_NODE);
802 install_default(LDP_IPV6_NODE);
803 install_default(LDP_IPV4_IFACE_NODE);
804 install_default(LDP_IPV6_IFACE_NODE);
805 install_default(LDP_L2VPN_NODE);
806 install_default(LDP_PSEUDOWIRE_NODE);
807
808 install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd);
809 install_element(CONFIG_NODE, &no_ldp_mpls_ldp_cmd);
810 install_element(CONFIG_NODE, &ldp_l2vpn_cmd);
811 install_element(CONFIG_NODE, &no_ldp_l2vpn_cmd);
812 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
813 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_type_cmd);
814 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
815 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
816
817 install_element(LDP_NODE, &ldp_address_family_cmd);
818 install_element(LDP_NODE, &no_ldp_address_family_cmd);
819 install_element(LDP_NODE, &ldp_discovery_link_holdtime_cmd);
820 install_element(LDP_NODE, &ldp_discovery_targeted_holdtime_cmd);
821 install_element(LDP_NODE, &ldp_discovery_link_interval_cmd);
822 install_element(LDP_NODE, &ldp_discovery_targeted_interval_cmd);
823 install_element(LDP_NODE, &ldp_dual_stack_transport_connection_prefer_ipv4_cmd);
824 install_element(LDP_NODE, &ldp_dual_stack_cisco_interop_cmd);
825 install_element(LDP_NODE, &ldp_neighbor_password_cmd);
826 install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
827 install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
828 install_element(LDP_NODE, &ldp_router_id_cmd);
829 install_element(LDP_NODE, &ldp_ordered_control_cmd);
830 install_element(LDP_NODE, &ldp_wait_for_sync_cmd);
831 install_element(LDP_NODE, &ldp_allow_broken_lsps_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, &no_ldp_interface_cmd);
863 install_element(LDP_IPV6_NODE, &ldp_session_holdtime_cmd);
864 install_element(LDP_IPV6_NODE, &ldp_neighbor_ipv6_targeted_cmd);
865 install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd);
866
867 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
868 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd);
869
870 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
871 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd);
872
873 install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd);
874 install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd);
875 install_element(LDP_L2VPN_NODE, &ldp_member_interface_cmd);
876 install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_cmd);
877 install_element(LDP_L2VPN_NODE, &no_ldp_member_pseudowire_cmd);
878 install_element(LDP_L2VPN_NODE, &ldp_vc_type_cmd);
879
880 install_element(LDP_PSEUDOWIRE_NODE, &ldp_control_word_cmd);
881 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_address_cmd);
882 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_lsr_id_cmd);
883 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_id_cmd);
884 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_status_disable_cmd);
885
886 install_element(ENABLE_NODE, &ldp_clear_mpls_ldp_neighbor_cmd);
887 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
888 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_type_cmd);
889 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
890 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
891
892 install_element(VIEW_NODE, &ldp_show_mpls_ldp_binding_cmd);
893 install_element(VIEW_NODE, &ldp_show_mpls_ldp_discovery_cmd);
894 install_element(VIEW_NODE, &ldp_show_mpls_ldp_interface_cmd);
895 install_element(VIEW_NODE, &ldp_show_mpls_ldp_capabilities_cmd);
896 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_cmd);
897 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_capabilities_cmd);
898 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_binding_cmd);
899 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_vc_cmd);
900 install_element(VIEW_NODE, &ldp_show_debugging_mpls_ldp_cmd);
901 install_element(VIEW_NODE, &ldp_show_mpls_ldp_igp_sync_cmd);
902 }