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