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