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