]> git.proxmox.com Git - mirror_frr.git/blob - ldpd/ldp_vty_cmds.c
Merge pull request #856 from opensourcerouting/cli-fuzzer-fixes
[mirror_frr.git] / ldpd / ldp_vty_cmds.c
1 /*
2 * Copyright (C) 2016 by Open Source Routing.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19
20 #include <zebra.h>
21
22 #include "command.h"
23 #include "vty.h"
24 #include "ldpd/ldp_vty.h"
25
26 DEFUN_NOSH(ldp_mpls_ldp,
27 ldp_mpls_ldp_cmd,
28 "[no] mpls ldp",
29 "Negate a command or set its defaults\n"
30 "Global MPLS configuration subcommands\n"
31 "Label Distribution Protocol\n")
32 {
33 int idx = 0;
34 int negate = 0;
35
36 if (argv_find(argv, argc, "no", &idx))
37 negate = 1;
38
39 return (ldp_vty_mpls_ldp(vty, negate));
40 }
41
42 DEFUN_NOSH(ldp_l2vpn,
43 ldp_l2vpn_cmd,
44 "[no] l2vpn WORD type vpls",
45 "Negate a command or set its defaults\n"
46 "Configure l2vpn commands\n"
47 "L2VPN name\n"
48 "L2VPN type\n"
49 "Virtual Private LAN Service\n")
50 {
51 int idx = 0;
52 int negate = 0;
53 const char *name;
54
55 if (argv_find(argv, argc, "no", &idx))
56 negate = 1;
57 argv_find(argv, argc, "WORD", &idx);
58 name = argv[idx]->arg;
59
60 return (ldp_vty_l2vpn(vty, negate, name));
61 }
62
63 DEFUN_NOSH(ldp_address_family,
64 ldp_address_family_cmd,
65 "[no] address-family <ipv4|ipv6>",
66 "Negate a command or set its defaults\n"
67 "Configure Address Family and its parameters\n"
68 "IPv4\n"
69 "IPv6\n")
70 {
71 int idx = 0;
72 int negate = 0;
73 const char *af;
74
75 if (argv_find(argv, argc, "no", &idx))
76 negate = 1;
77 argv_find(argv, argc, "address-family", &idx);
78 af = argv[idx + 1]->text;
79
80 return (ldp_vty_address_family(vty, negate, af));
81 }
82
83 DEFUN_NOSH(ldp_exit_address_family,
84 ldp_exit_address_family_cmd,
85 "exit-address-family",
86 "Exit from Address Family configuration mode\n")
87 {
88 if (vty->node == LDP_IPV4_NODE || vty->node == LDP_IPV6_NODE)
89 vty->node = LDP_NODE;
90 return CMD_SUCCESS;
91 }
92
93 DEFUN (ldp_discovery_holdtime,
94 ldp_discovery_holdtime_cmd,
95 "[no] discovery <hello|targeted-hello> holdtime (1-65535)",
96 "Negate a command or set its defaults\n"
97 "Configure discovery parameters\n"
98 "LDP Link Hellos\n"
99 "LDP Targeted Hellos\n"
100 "Hello holdtime\n"
101 "Time (seconds) - 65535 implies infinite\n")
102 {
103 int idx = 0;
104 int negate = 0;
105 const char *hello_type;
106 const char *holdtime;
107
108 if (argv_find(argv, argc, "no", &idx))
109 negate = 1;
110 argv_find(argv, argc, "discovery", &idx);
111 hello_type = argv[idx + 1]->text;
112 argv_find(argv, argc, "(1-65535)", &idx);
113 holdtime = argv[idx]->arg;
114
115 return (ldp_vty_disc_holdtime(vty, negate, hello_type, holdtime));
116 }
117
118 DEFUN (ldp_discovery_interval,
119 ldp_discovery_interval_cmd,
120 "[no] discovery <hello|targeted-hello> interval (1-65535)",
121 "Negate a command or set its defaults\n"
122 "Configure discovery parameters\n"
123 "LDP Link Hellos\n"
124 "LDP Targeted Hellos\n"
125 "Hello interval\n"
126 "Time (seconds)\n")
127 {
128 int idx = 0;
129 int negate = 0;
130 const char *hello_type;
131 const char *interval;
132
133 if (argv_find(argv, argc, "no", &idx))
134 negate = 1;
135 argv_find(argv, argc, "discovery", &idx);
136 hello_type = argv[idx + 1]->text;
137 argv_find(argv, argc, "(1-65535)", &idx);
138 interval = argv[idx]->arg;
139
140 return (ldp_vty_disc_interval(vty, negate, hello_type, interval));
141 }
142
143 DEFUN (ldp_dual_stack_transport_connection_prefer_ipv4,
144 ldp_dual_stack_transport_connection_prefer_ipv4_cmd,
145 "[no] dual-stack transport-connection prefer ipv4",
146 "Negate a command or set its defaults\n"
147 "Configure dual stack parameters\n"
148 "Configure TCP transport parameters\n"
149 "Configure prefered address family for TCP transport connection with neighbor\n"
150 "IPv4\n")
151 {
152 int idx = 0;
153 int negate = 0;
154
155 if (argv_find(argv, argc, "no", &idx))
156 negate = 1;
157
158 return (ldp_vty_trans_pref_ipv4(vty, negate));
159 }
160
161 DEFUN (ldp_dual_stack_cisco_interop,
162 ldp_dual_stack_cisco_interop_cmd,
163 "[no] dual-stack cisco-interop",
164 "Negate a command or set its defaults\n"
165 "Configure dual stack parameters\n"
166 "Use Cisco non-compliant format to send and interpret the Dual-Stack capability TLV\n")
167 {
168 int idx = 0;
169 int negate = 0;
170
171 if (argv_find(argv, argc, "no", &idx))
172 negate = 1;
173
174 return (ldp_vty_ds_cisco_interop(vty, negate));
175 }
176
177 DEFUN (ldp_neighbor_password,
178 ldp_neighbor_password_cmd,
179 "[no] neighbor A.B.C.D password WORD",
180 "Negate a command or set its defaults\n"
181 "Configure neighbor parameters\n"
182 "LDP Id of neighbor\n"
183 "Configure password for MD5 authentication\n"
184 "The password\n")
185 {
186 int idx = 0;
187 int negate = 0;
188 const char *neighbor;
189 const char *password;
190
191 if (argv_find(argv, argc, "no", &idx))
192 negate = 1;
193 argv_find(argv, argc, "A.B.C.D", &idx);
194 neighbor = argv[idx]->arg;
195 argv_find(argv, argc, "WORD", &idx);
196 password = argv[idx]->arg;
197
198 return (ldp_vty_neighbor_password(vty, negate, neighbor, password));
199 }
200
201 DEFUN (ldp_neighbor_session_holdtime,
202 ldp_neighbor_session_holdtime_cmd,
203 "[no] neighbor A.B.C.D session holdtime (15-65535)",
204 "Negate a command or set its defaults\n"
205 "Configure neighbor parameters\n"
206 "LDP Id of neighbor\n"
207 "Configure session parameters\n"
208 "Configure session holdtime\n"
209 "Time (seconds)\n")
210 {
211 int idx = 0;
212 int negate = 0;
213 const char *neighbor;
214 const char *holdtime;
215
216 if (argv_find(argv, argc, "no", &idx))
217 negate = 1;
218 argv_find(argv, argc, "A.B.C.D", &idx);
219 neighbor = argv[idx]->arg;
220 argv_find(argv, argc, "(15-65535)", &idx);
221 holdtime = argv[idx]->arg;
222
223 return (ldp_vty_nbr_session_holdtime(vty, negate, neighbor, holdtime));
224 }
225
226 DEFUN (ldp_neighbor_ttl_security,
227 ldp_neighbor_ttl_security_cmd,
228 "[no] neighbor A.B.C.D ttl-security <disable|hops (1-254)>",
229 "Negate a command or set its defaults\n"
230 "Configure neighbor parameters\n"
231 "LDP Id of neighbor\n"
232 "LDP ttl security check\n"
233 "Disable ttl security\n"
234 "IP hops\n"
235 "maximum number of hops\n")
236 {
237 int idx = 0;
238 int negate = 0;
239 const char *neighbor;
240 const char *hops = NULL;
241
242 if (argv_find(argv, argc, "no", &idx))
243 negate = 1;
244 argv_find(argv, argc, "A.B.C.D", &idx);
245 neighbor = argv[idx]->arg;
246 if (argv_find(argv, argc, "(1-254)", &idx))
247 hops = argv[idx]->arg;
248
249 return (ldp_vty_neighbor_ttl_security(vty, negate, neighbor, hops));
250 }
251
252 DEFUN (ldp_router_id,
253 ldp_router_id_cmd,
254 "[no] router-id A.B.C.D",
255 "Negate a command or set its defaults\n"
256 "Configure router Id\n"
257 "LSR Id (in form of an IPv4 address)\n")
258 {
259 int idx = 0;
260 int negate = 0;
261 const char *address;
262
263 if (argv_find(argv, argc, "no", &idx))
264 negate = 1;
265 argv_find(argv, argc, "A.B.C.D", &idx);
266 address = argv[idx]->arg;
267
268 return (ldp_vty_router_id(vty, negate, address));
269 }
270
271 DEFUN (ldp_discovery_targeted_hello_accept,
272 ldp_discovery_targeted_hello_accept_cmd,
273 "[no] discovery targeted-hello accept [from <(1-199)|(1300-2699)|WORD>]",
274 "Negate a command or set its defaults\n"
275 "Configure discovery parameters\n"
276 "LDP Targeted Hellos\n"
277 "Accept and respond to targeted hellos\n"
278 "Access list to specify acceptable targeted hello source\n"
279 "IP access-list number\n"
280 "IP access-list number (expanded range)\n"
281 "IP access-list name\n")
282 {
283 int idx = 0;
284 int negate = 0;
285 const char *from_acl = NULL;
286
287 if (argv_find(argv, argc, "no", &idx))
288 negate = 1;
289 if (argv_find(argv, argc, "from", &idx))
290 from_acl = argv[idx + 1]->arg;
291
292 return (ldp_vty_targeted_hello_accept(vty, negate, from_acl));
293 }
294
295 DEFUN (ldp_discovery_transport_address_ipv4,
296 ldp_discovery_transport_address_ipv4_cmd,
297 "[no] discovery transport-address A.B.C.D",
298 "Negate a command or set its defaults\n"
299 "Configure discovery parameters\n"
300 "Specify transport address for TCP connection\n"
301 "IP address to be used as transport address\n")
302 {
303 int idx = 0;
304 int negate = 0;
305 const char *address;
306
307 if (argv_find(argv, argc, "no", &idx))
308 negate = 1;
309 argv_find(argv, argc, "A.B.C.D", &idx);
310 address = argv[idx]->arg;
311
312 return (ldp_vty_trans_addr(vty, negate, address));
313 }
314
315 DEFUN (ldp_discovery_transport_address_ipv6,
316 ldp_discovery_transport_address_ipv6_cmd,
317 "[no] discovery transport-address X:X::X:X",
318 "Negate a command or set its defaults\n"
319 "Configure discovery parameters\n"
320 "Specify transport address for TCP connection\n"
321 "IPv6 address to be used as transport address\n")
322 {
323 int idx = 0;
324 int negate = 0;
325 const char *address;
326
327 if (argv_find(argv, argc, "no", &idx))
328 negate = 1;
329 argv_find(argv, argc, "X:X::X:X", &idx);
330 address = argv[idx]->arg;
331
332 return (ldp_vty_trans_addr(vty, negate, address));
333 }
334
335 DEFUN (ldp_label_local_advertise,
336 ldp_label_local_advertise_cmd,
337 "[no] label local advertise [{to <(1-199)|(1300-2699)|WORD>|for <(1-199)|(1300-2699)|WORD>}]",
338 "Negate a command or set its defaults\n"
339 "Configure label control and policies\n"
340 "Configure local label control and policies\n"
341 "Configure outbound label advertisement control\n"
342 "IP Access-list specifying controls on LDP Peers\n"
343 "IP access-list number\n"
344 "IP access-list number (expanded range)\n"
345 "IP access-list name\n"
346 "IP access-list for destination prefixes\n"
347 "IP access-list number\n"
348 "IP access-list number (expanded range)\n"
349 "IP access-list name\n")
350 {
351 int idx = 0;
352 int negate = 0;
353 const char *to_acl = NULL;
354 const char *for_acl = NULL;
355
356 if (argv_find(argv, argc, "no", &idx))
357 negate = 1;
358
359 /* arguments within curly braces may be provided in any order */
360 if (argv_find(argv, argc, "to", &idx))
361 to_acl = argv[idx + 1]->arg;
362 idx = 0;
363 if (argv_find(argv, argc, "for", &idx))
364 for_acl = argv[idx + 1]->arg;
365
366 return (ldp_vty_label_advertise(vty, negate, to_acl, for_acl));
367 }
368
369 DEFUN (ldp_label_local_advertise_explicit_null,
370 ldp_label_local_advertise_explicit_null_cmd,
371 "[no] label local advertise explicit-null [for <(1-199)|(1300-2699)|WORD>]",
372 "Negate a command or set its defaults\n"
373 "Configure label control and policies\n"
374 "Configure local label control and policies\n"
375 "Configure outbound label advertisement control\n"
376 "Configure explicit-null advertisement\n"
377 "IP access-list for destination prefixes\n"
378 "IP access-list number\n"
379 "IP access-list number (expanded range)\n"
380 "IP access-list name\n")
381 {
382 int idx = 0;
383 int negate = 0;
384 const char *for_acl = NULL;
385
386 if (argv_find(argv, argc, "no", &idx))
387 negate = 1;
388 if (argv_find(argv, argc, "for", &idx))
389 for_acl = argv[idx + 1]->arg;
390
391 return (ldp_vty_label_expnull(vty, negate, for_acl));
392 }
393
394 DEFUN (ldp_label_local_allocate,
395 ldp_label_local_allocate_cmd,
396 "[no] label local allocate <host-routes|for <(1-199)|(1300-2699)|WORD>>",
397 "Negate a command or set its defaults\n"
398 "Configure label control and policies\n"
399 "Configure local label control and policies\n"
400 "Configure label allocation control\n"
401 "allocate local label for host routes only\n"
402 "IP access-list\n"
403 "IP access-list number\n"
404 "IP access-list number (expanded range)\n"
405 "IP access-list name\n")
406 {
407 int idx = 0;
408 int negate = 0;
409 int host_routes = 0;
410 const char *for_acl = NULL;
411
412 if (argv_find(argv, argc, "no", &idx))
413 negate = 1;
414
415 /* arguments within curly braces may be provided in any order */
416 if (argv_find(argv, argc, "host-routes", &idx))
417 host_routes = 1;
418 idx = 0;
419 if (argv_find(argv, argc, "for", &idx))
420 for_acl = argv[idx + 1]->arg;
421
422 return (ldp_vty_label_allocate(vty, negate, host_routes, for_acl));
423 }
424
425 DEFUN (ldp_label_remote_accept,
426 ldp_label_remote_accept_cmd,
427 "[no] label remote accept {from <(1-199)|(1300-2699)|WORD>|for <(1-199)|(1300-2699)|WORD>}",
428 "Negate a command or set its defaults\n"
429 "Configure label control and policies\n"
430 "Configure remote/peer label control and policies\n"
431 "Configure inbound label acceptance control\n"
432 "Neighbor from whom to accept label advertisement\n"
433 "IP access-list number\n"
434 "IP access-list number (expanded range)\n"
435 "IP access-list name\n"
436 "IP access-list for destination prefixes\n"
437 "IP access-list number\n"
438 "IP access-list number (expanded range)\n"
439 "IP access-list name\n")
440 {
441 int idx = 0;
442 int negate = 0;
443 const char *from_acl = NULL;
444 const char *for_acl = NULL;
445
446 if (argv_find(argv, argc, "no", &idx))
447 negate = 1;
448
449 /* arguments within curly braces may be provided in any order */
450 if (argv_find(argv, argc, "from", &idx))
451 from_acl = argv[idx + 1]->arg;
452 idx = 0;
453 if (argv_find(argv, argc, "for", &idx))
454 for_acl = argv[idx + 1]->arg;
455
456 return (ldp_vty_label_accept(vty, negate, from_acl, for_acl));
457 }
458
459 DEFUN (ldp_ttl_security_disable,
460 ldp_ttl_security_disable_cmd,
461 "[no] ttl-security disable",
462 "Negate a command or set its defaults\n"
463 "LDP ttl security check\n"
464 "Disable ttl security\n")
465 {
466 int idx = 0;
467 int negate = 0;
468
469 if (argv_find(argv, argc, "no", &idx))
470 negate = 1;
471
472 return (ldp_vty_ttl_security(vty, negate));
473 }
474
475 DEFUN (ldp_session_holdtime,
476 ldp_session_holdtime_cmd,
477 "[no] session holdtime (15-65535)",
478 "Negate a command or set its defaults\n"
479 "Configure session parameters\n"
480 "Configure session holdtime\n"
481 "Time (seconds)\n")
482 {
483 int idx = 0;
484 int negate = 0;
485 const char *holdtime;
486
487 if (argv_find(argv, argc, "no", &idx))
488 negate = 1;
489 argv_find(argv, argc, "(15-65535)", &idx);
490 holdtime = argv[idx]->arg;
491
492 return (ldp_vty_af_session_holdtime(vty, negate, holdtime));
493 }
494
495 DEFUN_NOSH(ldp_interface,
496 ldp_interface_cmd,
497 "[no] interface IFNAME",
498 "Negate a command or set its defaults\n"
499 "Enable LDP on an interface and enter interface submode\n"
500 "Interface's name\n")
501 {
502 int idx = 0;
503 int negate = 0;
504 const char *ifname;
505
506 if (argv_find(argv, argc, "no", &idx))
507 negate = 1;
508 argv_find(argv, argc, "IFNAME", &idx);
509 ifname = argv[idx]->arg;
510
511 return (ldp_vty_interface(vty, negate, ifname));
512 }
513
514 DEFUN (ldp_neighbor_ipv4_targeted,
515 ldp_neighbor_ipv4_targeted_cmd,
516 "[no] neighbor A.B.C.D targeted",
517 "Negate a command or set its defaults\n"
518 "Configure neighbor parameters\n"
519 "IP address of neighbor\n"
520 "Establish targeted session\n")
521 {
522 int idx = 0;
523 int negate = 0;
524 const char *address;
525
526 if (argv_find(argv, argc, "no", &idx))
527 negate = 1;
528 argv_find(argv, argc, "A.B.C.D", &idx);
529 address = argv[idx]->arg;
530
531 return (ldp_vty_neighbor_targeted(vty, negate, address));
532 }
533
534 DEFUN (ldp_neighbor_ipv6_targeted,
535 ldp_neighbor_ipv6_targeted_cmd,
536 "[no] neighbor X:X::X:X targeted",
537 "Negate a command or set its defaults\n"
538 "Configure neighbor parameters\n"
539 "IPv6 address of neighbor\n"
540 "Establish targeted session\n")
541 {
542 int idx = 0;
543 int negate = 0;
544 const char *address;
545
546 if (argv_find(argv, argc, "no", &idx))
547 negate = 1;
548 argv_find(argv, argc, "X:X::X:X", &idx);
549 address = argv[idx]->arg;
550
551 return (ldp_vty_neighbor_targeted(vty, negate, address));
552 }
553
554 DEFUN (ldp_bridge,
555 ldp_bridge_cmd,
556 "[no] bridge IFNAME",
557 "Negate a command or set its defaults\n"
558 "Bridge interface\n"
559 "Interface's name\n")
560 {
561 int idx = 0;
562 int negate = 0;
563 const char *ifname;
564
565 if (argv_find(argv, argc, "no", &idx))
566 negate = 1;
567 argv_find(argv, argc, "IFNAME", &idx);
568 ifname = argv[idx]->arg;
569
570 return (ldp_vty_l2vpn_bridge(vty, negate, ifname));
571 }
572
573 DEFUN (ldp_mtu,
574 ldp_mtu_cmd,
575 "[no] mtu (1500-9180)",
576 "Negate a command or set its defaults\n"
577 "Set Maximum Transmission Unit\n"
578 "Maximum Transmission Unit value\n")
579 {
580 int idx = 0;
581 int negate = 0;
582 const char *mtu;
583
584 if (argv_find(argv, argc, "no", &idx))
585 negate = 1;
586 argv_find(argv, argc, "(1500-9180)", &idx);
587 mtu = argv[idx]->arg;
588
589 return (ldp_vty_l2vpn_mtu(vty, negate, mtu));
590 }
591
592 DEFUN (ldp_member_interface,
593 ldp_member_interface_cmd,
594 "[no] member interface IFNAME",
595 "Negate a command or set its defaults\n"
596 "L2VPN member configuration\n"
597 "Local interface\n"
598 "Interface's name\n")
599 {
600 int idx = 0;
601 int negate = 0;
602 const char *ifname;
603
604 if (argv_find(argv, argc, "no", &idx))
605 negate = 1;
606 argv_find(argv, argc, "IFNAME", &idx);
607 ifname = argv[idx]->arg;
608
609 return (ldp_vty_l2vpn_interface(vty, negate, ifname));
610 }
611
612 DEFUN_NOSH(ldp_member_pseudowire,
613 ldp_member_pseudowire_cmd,
614 "[no] member pseudowire IFNAME",
615 "Negate a command or set its defaults\n"
616 "L2VPN member configuration\n"
617 "Pseudowire interface\n"
618 "Interface's name\n")
619 {
620 int idx = 0;
621 int negate = 0;
622 const char *ifname;
623
624 if (argv_find(argv, argc, "no", &idx))
625 negate = 1;
626 argv_find(argv, argc, "IFNAME", &idx);
627 ifname = argv[idx]->arg;
628
629 return (ldp_vty_l2vpn_pseudowire(vty, negate, ifname));
630 }
631
632 DEFUN (ldp_vc_type,
633 ldp_vc_type_cmd,
634 "[no] vc type <ethernet|ethernet-tagged>",
635 "Negate a command or set its defaults\n"
636 "Virtual Circuit options\n"
637 "Virtual Circuit type to use\n"
638 "Ethernet (type 5)\n"
639 "Ethernet-tagged (type 4)\n")
640 {
641 int idx = 0;
642 int negate = 0;
643 const char *vc_type;
644
645 if (argv_find(argv, argc, "no", &idx))
646 negate = 1;
647 argv_find(argv, argc, "type", &idx);
648 vc_type = argv[idx + 1]->text;
649
650 return (ldp_vty_l2vpn_pwtype(vty, negate, vc_type));
651 }
652
653 DEFUN (ldp_control_word,
654 ldp_control_word_cmd,
655 "[no] control-word <exclude|include>",
656 "Negate a command or set its defaults\n"
657 "Control-word options\n"
658 "Exclude control-word in pseudowire packets\n"
659 "Include control-word in pseudowire packets\n")
660 {
661 int idx = 0;
662 int negate = 0;
663 const char *preference;
664
665 if (argv_find(argv, argc, "no", &idx))
666 negate = 1;
667 argv_find(argv, argc, "control-word", &idx);
668 preference = argv[idx + 1]->text;
669
670 return (ldp_vty_l2vpn_pw_cword(vty, negate, preference));
671 }
672
673 DEFUN (ldp_neighbor_address,
674 ldp_neighbor_address_cmd,
675 "[no] neighbor address <A.B.C.D|X:X::X:X>",
676 "Negate a command or set its defaults\n"
677 "Remote endpoint configuration\n"
678 "Specify the IPv4 or IPv6 address of the remote endpoint\n"
679 "IPv4 address\n"
680 "IPv6 address\n")
681 {
682 int idx = 0;
683 int negate = 0;
684 const char *address;
685
686 if (argv_find(argv, argc, "no", &idx))
687 negate = 1;
688 argv_find(argv, argc, "address", &idx);
689 address = argv[idx + 1]->arg;
690
691 return (ldp_vty_l2vpn_pw_nbr_addr(vty, negate, address));
692 }
693
694 DEFUN (ldp_neighbor_lsr_id,
695 ldp_neighbor_lsr_id_cmd,
696 "[no] neighbor lsr-id A.B.C.D",
697 "Negate a command or set its defaults\n"
698 "Remote endpoint configuration\n"
699 "Specify the LSR-ID of the remote endpoint\n"
700 "IPv4 address\n")
701 {
702 int idx = 0;
703 int negate = 0;
704 const char *address;
705
706 if (argv_find(argv, argc, "no", &idx))
707 negate = 1;
708 argv_find(argv, argc, "A.B.C.D", &idx);
709 address = argv[idx]->arg;
710
711 return (ldp_vty_l2vpn_pw_nbr_id(vty, negate, address));
712 }
713
714 DEFUN (ldp_pw_id,
715 ldp_pw_id_cmd,
716 "[no] pw-id (1-4294967295)",
717 "Negate a command or set its defaults\n"
718 "Set the Virtual Circuit ID\n"
719 "Virtual Circuit ID value\n")
720 {
721 int idx = 0;
722 int negate = 0;
723 const char *pwid;
724
725 if (argv_find(argv, argc, "no", &idx))
726 negate = 1;
727 argv_find(argv, argc, "(1-4294967295)", &idx);
728 pwid = argv[idx]->arg;
729
730 return (ldp_vty_l2vpn_pw_pwid(vty, negate, pwid));
731 }
732
733 DEFUN (ldp_pw_status_disable,
734 ldp_pw_status_disable_cmd,
735 "[no] pw-status disable",
736 "Negate a command or set its defaults\n"
737 "Configure PW status\n"
738 "Disable PW status\n")
739 {
740 int idx = 0;
741 int negate = 0;
742
743 if (argv_find(argv, argc, "no", &idx))
744 negate = 1;
745
746 return (ldp_vty_l2vpn_pw_pwstatus(vty, negate));
747 }
748
749 DEFUN (ldp_clear_mpls_ldp_neighbor,
750 ldp_clear_mpls_ldp_neighbor_cmd,
751 "clear mpls ldp neighbor [<A.B.C.D|X:X::X:X>]",
752 "Reset functions\n"
753 "Reset MPLS statistical information\n"
754 "Clear LDP state\n"
755 "Clear LDP neighbor sessions\n"
756 "IPv4 address\n"
757 "IPv6 address\n")
758 {
759 int idx = 0;
760 const char *address = NULL;
761
762 if (argv_find(argv, argc, "neighbor", &idx))
763 address = argv[idx + 1]->arg;
764
765 return (ldp_vty_clear_nbr(vty, address));
766 }
767
768 DEFUN (ldp_debug_mpls_ldp_discovery_hello,
769 ldp_debug_mpls_ldp_discovery_hello_cmd,
770 "[no] debug mpls ldp discovery hello <recv|sent>",
771 "Negate a command or set its defaults\n"
772 "Debugging functions\n"
773 "MPLS information\n"
774 "Label Distribution Protocol\n"
775 "Discovery messages\n"
776 "Discovery hello message\n"
777 "Received messages\n"
778 "Sent messages\n")
779 {
780 int idx = 0;
781 int negate = 0;
782 const char *dir;
783
784 if (argv_find(argv, argc, "no", &idx))
785 negate = 1;
786 argv_find(argv, argc, "hello", &idx);
787 dir = argv[idx + 1]->text;
788
789 return (ldp_vty_debug(vty, negate, "discovery", dir, 0));
790 }
791
792 DEFUN (ldp_debug_mpls_ldp_type,
793 ldp_debug_mpls_ldp_type_cmd,
794 "[no] debug mpls ldp <errors|event|zebra>",
795 "Negate a command or set its defaults\n"
796 "Debugging functions\n"
797 "MPLS information\n"
798 "Label Distribution Protocol\n"
799 "Errors\n"
800 "LDP event information\n"
801 "LDP zebra information\n")
802 {
803 int idx = 0;
804 int negate = 0;
805 const char *type;
806
807 if (argv_find(argv, argc, "no", &idx))
808 negate = 1;
809 argv_find(argv, argc, "ldp", &idx);
810 type = argv[idx + 1]->text;
811
812 return (ldp_vty_debug(vty, negate, type, NULL, 0));
813 }
814
815 DEFUN (ldp_debug_mpls_ldp_messages_recv,
816 ldp_debug_mpls_ldp_messages_recv_cmd,
817 "[no] debug mpls ldp messages recv [all]",
818 "Negate a command or set its defaults\n"
819 "Debugging functions\n"
820 "MPLS information\n"
821 "Label Distribution Protocol\n"
822 "Messages\n"
823 "Received messages, excluding periodic Keep Alives\n"
824 "Received messages, including periodic Keep Alives\n")
825 {
826 int idx = 0;
827 int negate = 0;
828 int all = 0;
829
830 if (argv_find(argv, argc, "no", &idx))
831 negate = 1;
832 if (argv_find(argv, argc, "all", &idx))
833 all = 1;
834
835 return (ldp_vty_debug(vty, negate, "messages", "recv", all));
836 }
837
838 DEFUN (ldp_debug_mpls_ldp_messages_sent,
839 ldp_debug_mpls_ldp_messages_sent_cmd,
840 "[no] debug mpls ldp messages sent [all]",
841 "Negate a command or set its defaults\n"
842 "Debugging functions\n"
843 "MPLS information\n"
844 "Label Distribution Protocol\n"
845 "Messages\n"
846 "Sent messages, excluding periodic Keep Alives\n"
847 "Sent messages, including periodic Keep Alives\n")
848 {
849 int idx = 0;
850 int negate = 0;
851 int all = 0;
852
853 if (argv_find(argv, argc, "no", &idx))
854 negate = 1;
855 if (argv_find(argv, argc, "all", &idx))
856 all = 1;
857
858 return (ldp_vty_debug(vty, negate, "messages", "sent", all));
859 }
860
861 DEFUN (ldp_show_mpls_ldp_binding,
862 ldp_show_mpls_ldp_binding_cmd,
863 "show mpls ldp [<ipv4|ipv6>] binding [detail] [json]",
864 "Show running system information\n"
865 "MPLS information\n"
866 "Label Distribution Protocol\n"
867 "IPv4 Address Family\n"
868 "IPv6 Address Family\n"
869 "Label Information Base (LIB) information\n"
870 "Show detailed information\n"
871 "JavaScript Object Notation\n")
872 {
873 int idx = 0;
874 const char *af = NULL;
875 int detail = 0;
876 int json = 0;
877
878 if (argv_find(argv, argc, "ipv4", &idx) ||
879 argv_find(argv, argc, "ipv6", &idx))
880 af = argv[idx]->text;
881 if (argv_find(argv, argc, "detail", &idx))
882 detail = 1;
883 if (argv_find(argv, argc, "json", &idx))
884 json = 1;
885
886 return (ldp_vty_show_binding(vty, af, detail, json));
887 }
888
889 DEFUN (ldp_show_mpls_ldp_discovery,
890 ldp_show_mpls_ldp_discovery_cmd,
891 "show mpls ldp [<ipv4|ipv6>] discovery [detail] [json]",
892 "Show running system information\n"
893 "MPLS information\n"
894 "Label Distribution Protocol\n"
895 "IPv4 Address Family\n"
896 "IPv6 Address Family\n"
897 "Discovery Hello Information\n"
898 "Show detailed information\n"
899 "JavaScript Object Notation\n")
900 {
901 int idx = 0;
902 const char *af = NULL;
903 int detail = 0;
904 int json = 0;
905
906 if (argv_find(argv, argc, "ipv4", &idx) ||
907 argv_find(argv, argc, "ipv6", &idx))
908 af = argv[idx]->text;
909 if (argv_find(argv, argc, "detail", &idx))
910 detail = 1;
911 if (argv_find(argv, argc, "json", &idx))
912 json = 1;
913
914 return (ldp_vty_show_discovery(vty, af, detail, json));
915 }
916
917 DEFUN (ldp_show_mpls_ldp_interface,
918 ldp_show_mpls_ldp_interface_cmd,
919 "show mpls ldp [<ipv4|ipv6>] interface [json]",
920 "Show running system information\n"
921 "MPLS information\n"
922 "Label Distribution Protocol\n"
923 "IPv4 Address Family\n"
924 "IPv6 Address Family\n"
925 "interface information\n"
926 "JavaScript Object Notation\n")
927 {
928 int idx = 0;
929 const char *af = NULL;
930 int json = 0;
931
932 if (argv_find(argv, argc, "ipv4", &idx) ||
933 argv_find(argv, argc, "ipv6", &idx))
934 af = argv[idx]->text;
935 if (argv_find(argv, argc, "json", &idx))
936 json = 1;
937
938 return (ldp_vty_show_interface(vty, af, json));
939 }
940
941 DEFUN (ldp_show_mpls_ldp_capabilities,
942 ldp_show_mpls_ldp_capabilities_cmd,
943 "show mpls ldp capabilities [json]",
944 "Show running system information\n"
945 "MPLS information\n"
946 "Label Distribution Protocol\n"
947 "Display LDP Capabilities information\n"
948 "JavaScript Object Notation\n")
949 {
950 int idx = 0;
951 int json = 0;
952
953 if (argv_find(argv, argc, "json", &idx))
954 json = 1;
955
956 return (ldp_vty_show_capabilities(vty, json));
957 }
958
959 DEFUN (ldp_show_mpls_ldp_neighbor,
960 ldp_show_mpls_ldp_neighbor_cmd,
961 "show mpls ldp neighbor [detail] [json]",
962 "Show running system information\n"
963 "MPLS information\n"
964 "Label Distribution Protocol\n"
965 "Neighbor information\n"
966 "Show detailed information\n"
967 "JavaScript Object Notation\n")
968 {
969 int idx = 0;
970 int detail = 0;
971 int json = 0;
972
973 if (argv_find(argv, argc, "detail", &idx))
974 detail = 1;
975 if (argv_find(argv, argc, "json", &idx))
976 json = 1;
977
978 return (ldp_vty_show_neighbor(vty, 0, detail, json));
979 }
980
981 DEFUN (ldp_show_mpls_ldp_neighbor_capabilities,
982 ldp_show_mpls_ldp_neighbor_capabilities_cmd,
983 "show mpls ldp neighbor capabilities [json]",
984 "Show running system information\n"
985 "MPLS information\n"
986 "Label Distribution Protocol\n"
987 "Neighbor information\n"
988 "Display neighbor capability information\n"
989 "JavaScript Object Notation\n")
990 {
991 int idx = 0;
992 int json = 0;
993
994 if (argv_find(argv, argc, "json", &idx))
995 json = 1;
996
997 return (ldp_vty_show_neighbor(vty, 1, 0, json));
998 }
999
1000 DEFUN (ldp_show_l2vpn_atom_binding,
1001 ldp_show_l2vpn_atom_binding_cmd,
1002 "show l2vpn atom binding [json]",
1003 "Show running system information\n"
1004 "Show information about Layer2 VPN\n"
1005 "Show Any Transport over MPLS information\n"
1006 "Show AToM label binding information\n"
1007 "JavaScript Object Notation\n")
1008 {
1009 int idx = 0;
1010 int json = 0;
1011
1012 if (argv_find(argv, argc, "json", &idx))
1013 json = 1;
1014
1015 return (ldp_vty_show_atom_binding(vty, json));
1016 }
1017
1018 DEFUN (ldp_show_l2vpn_atom_vc,
1019 ldp_show_l2vpn_atom_vc_cmd,
1020 "show l2vpn atom vc [json]",
1021 "Show running system information\n"
1022 "Show information about Layer2 VPN\n"
1023 "Show Any Transport over MPLS information\n"
1024 "Show AToM virtual circuit information\n"
1025 "JavaScript Object Notation\n")
1026 {
1027 int idx = 0;
1028 int json = 0;
1029
1030 if (argv_find(argv, argc, "json", &idx))
1031 json = 1;
1032
1033 return (ldp_vty_show_atom_vc(vty, json));
1034 }
1035
1036 DEFUN (ldp_show_debugging_mpls_ldp,
1037 ldp_show_debugging_mpls_ldp_cmd,
1038 "show debugging mpls ldp",
1039 "Show running system information\n"
1040 "Debugging functions\n"
1041 "MPLS information\n"
1042 "Label Distribution Protocol\n")
1043 {
1044 return (ldp_vty_show_debugging(vty));
1045 }
1046
1047 void
1048 ldp_vty_init (void)
1049 {
1050 install_node(&ldp_node, ldp_config_write);
1051 install_node(&ldp_ipv4_node, NULL);
1052 install_node(&ldp_ipv6_node, NULL);
1053 install_node(&ldp_ipv4_iface_node, NULL);
1054 install_node(&ldp_ipv6_iface_node, NULL);
1055 install_node(&ldp_l2vpn_node, ldp_l2vpn_config_write);
1056 install_node(&ldp_pseudowire_node, NULL);
1057 install_node(&ldp_debug_node, ldp_debug_config_write);
1058 install_default(LDP_NODE);
1059 install_default(LDP_IPV4_NODE);
1060 install_default(LDP_IPV6_NODE);
1061 install_default(LDP_IPV4_IFACE_NODE);
1062 install_default(LDP_IPV6_IFACE_NODE);
1063 install_default(LDP_L2VPN_NODE);
1064 install_default(LDP_PSEUDOWIRE_NODE);
1065
1066 install_element(CONFIG_NODE, &ldp_mpls_ldp_cmd);
1067 install_element(CONFIG_NODE, &ldp_l2vpn_cmd);
1068 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
1069 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_type_cmd);
1070 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
1071 install_element(CONFIG_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
1072
1073 install_element(LDP_NODE, &ldp_address_family_cmd);
1074 install_element(LDP_NODE, &ldp_discovery_holdtime_cmd);
1075 install_element(LDP_NODE, &ldp_discovery_interval_cmd);
1076 install_element(LDP_NODE, &ldp_dual_stack_transport_connection_prefer_ipv4_cmd);
1077 install_element(LDP_NODE, &ldp_dual_stack_cisco_interop_cmd);
1078 install_element(LDP_NODE, &ldp_neighbor_password_cmd);
1079 install_element(LDP_NODE, &ldp_neighbor_session_holdtime_cmd);
1080 install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd);
1081 install_element(LDP_NODE, &ldp_router_id_cmd);
1082
1083 install_element(LDP_IPV4_NODE, &ldp_discovery_holdtime_cmd);
1084 install_element(LDP_IPV4_NODE, &ldp_discovery_interval_cmd);
1085 install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_hello_accept_cmd);
1086 install_element(LDP_IPV4_NODE, &ldp_discovery_transport_address_ipv4_cmd);
1087 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_cmd);
1088 install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_explicit_null_cmd);
1089 install_element(LDP_IPV4_NODE, &ldp_label_local_allocate_cmd);
1090 install_element(LDP_IPV4_NODE, &ldp_label_remote_accept_cmd);
1091 install_element(LDP_IPV4_NODE, &ldp_ttl_security_disable_cmd);
1092 install_element(LDP_IPV4_NODE, &ldp_interface_cmd);
1093 install_element(LDP_IPV4_NODE, &ldp_session_holdtime_cmd);
1094 install_element(LDP_IPV4_NODE, &ldp_neighbor_ipv4_targeted_cmd);
1095 install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd);
1096
1097 install_element(LDP_IPV6_NODE, &ldp_discovery_holdtime_cmd);
1098 install_element(LDP_IPV6_NODE, &ldp_discovery_interval_cmd);
1099 install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_hello_accept_cmd);
1100 install_element(LDP_IPV6_NODE, &ldp_discovery_transport_address_ipv6_cmd);
1101 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_cmd);
1102 install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_explicit_null_cmd);
1103 install_element(LDP_IPV6_NODE, &ldp_label_local_allocate_cmd);
1104 install_element(LDP_IPV6_NODE, &ldp_label_remote_accept_cmd);
1105 install_element(LDP_IPV6_NODE, &ldp_ttl_security_disable_cmd);
1106 install_element(LDP_IPV6_NODE, &ldp_interface_cmd);
1107 install_element(LDP_IPV6_NODE, &ldp_session_holdtime_cmd);
1108 install_element(LDP_IPV6_NODE, &ldp_neighbor_ipv6_targeted_cmd);
1109 install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd);
1110
1111 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_holdtime_cmd);
1112 install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_interval_cmd);
1113
1114 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_holdtime_cmd);
1115 install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_interval_cmd);
1116
1117 install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd);
1118 install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd);
1119 install_element(LDP_L2VPN_NODE, &ldp_member_interface_cmd);
1120 install_element(LDP_L2VPN_NODE, &ldp_member_pseudowire_cmd);
1121 install_element(LDP_L2VPN_NODE, &ldp_vc_type_cmd);
1122
1123 install_element(LDP_PSEUDOWIRE_NODE, &ldp_control_word_cmd);
1124 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_address_cmd);
1125 install_element(LDP_PSEUDOWIRE_NODE, &ldp_neighbor_lsr_id_cmd);
1126 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_id_cmd);
1127 install_element(LDP_PSEUDOWIRE_NODE, &ldp_pw_status_disable_cmd);
1128
1129 install_element(ENABLE_NODE, &ldp_clear_mpls_ldp_neighbor_cmd);
1130 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_discovery_hello_cmd);
1131 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_type_cmd);
1132 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_recv_cmd);
1133 install_element(ENABLE_NODE, &ldp_debug_mpls_ldp_messages_sent_cmd);
1134
1135 install_element(VIEW_NODE, &ldp_show_mpls_ldp_binding_cmd);
1136 install_element(VIEW_NODE, &ldp_show_mpls_ldp_discovery_cmd);
1137 install_element(VIEW_NODE, &ldp_show_mpls_ldp_interface_cmd);
1138 install_element(VIEW_NODE, &ldp_show_mpls_ldp_capabilities_cmd);
1139 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_cmd);
1140 install_element(VIEW_NODE, &ldp_show_mpls_ldp_neighbor_capabilities_cmd);
1141 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_binding_cmd);
1142 install_element(VIEW_NODE, &ldp_show_l2vpn_atom_vc_cmd);
1143 install_element(VIEW_NODE, &ldp_show_debugging_mpls_ldp_cmd);
1144 }