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