1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
|
/* Zebra MPLS VTY functions
* Copyright (C) 2002 Kunihiro Ishiguro
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Zebra; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <zebra.h>
#if defined(HAVE_MPLS)
#include "memory.h"
#include "if.h"
#include "prefix.h"
#include "command.h"
#include "table.h"
#include "rib.h"
#include "nexthop.h"
#include "vrf.h"
#include "mpls.h"
#include "lib/json.h"
#include "zebra/zserv.h"
#include "zebra/zebra_vrf.h"
#include "zebra/zebra_mpls.h"
#include "zebra/zebra_rnh.h"
#include "zebra/redistribute.h"
#include "zebra/zebra_routemap.h"
#include "zebra/zebra_static.h"
static int
zebra_mpls_transit_lsp (struct vty *vty, int add_cmd, const char *inlabel_str,
const char *gate_str, const char *outlabel_str,
const char *flag_str)
{
struct zebra_vrf *zvrf;
int ret;
enum nexthop_types_t gtype;
union g_addr gate;
mpls_label_t label;
mpls_label_t in_label, out_label;
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
{
vty_out (vty, "%% Default VRF does not exist%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (!inlabel_str)
{
vty_out (vty, "%% No Label Information%s", VTY_NEWLINE);
return CMD_WARNING;
}
out_label = MPLS_IMP_NULL_LABEL; /* as initialization */
label = atoi(inlabel_str);
if (!IS_MPLS_UNRESERVED_LABEL(label))
{
vty_out (vty, "%% Invalid label%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (add_cmd)
{
if (!gate_str)
{
vty_out (vty, "%% No Nexthop Information%s", VTY_NEWLINE);
return CMD_WARNING;
}
if (!outlabel_str)
{
vty_out (vty, "%% No Outgoing label Information%s", VTY_NEWLINE);
return CMD_WARNING;
}
}
in_label = label;
gtype = NEXTHOP_TYPE_BLACKHOLE; /* as initialization */
if (gate_str)
{
/* Gateway is a IPv4 or IPv6 nexthop. */
ret = inet_pton (AF_INET6, gate_str, &gate.ipv6);
if (ret)
gtype = NEXTHOP_TYPE_IPV6;
else
{
ret = inet_pton (AF_INET, gate_str, &gate.ipv4);
if (ret)
gtype = NEXTHOP_TYPE_IPV4;
else
{
vty_out (vty, "%% Invalid nexthop%s", VTY_NEWLINE);
return CMD_WARNING;
}
}
}
if (outlabel_str)
{
if (outlabel_str[0] == 'i')
out_label = MPLS_IMP_NULL_LABEL;
else
out_label = atoi(outlabel_str);
}
if (add_cmd)
{
#if defined(HAVE_CUMULUS)
/* Check that label value is consistent. */
if (!zebra_mpls_lsp_label_consistent (zvrf, in_label, out_label, gtype,
&gate, NULL, 0))
{
vty_out (vty, "%% Label value not consistent%s",
VTY_NEWLINE);
return CMD_WARNING;
}
#endif /* HAVE_CUMULUS */
ret = zebra_mpls_static_lsp_add (zvrf, in_label, out_label, gtype,
&gate, NULL, 0);
}
else
ret = zebra_mpls_static_lsp_del (zvrf, in_label, gtype, &gate, NULL, 0);
if (ret)
{
vty_out (vty, "%% LSP cannot be %s%s",
add_cmd ? "added" : "deleted", VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
DEFUN (mpls_transit_lsp,
mpls_transit_lsp_cmd,
"mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n"
"IPv4 gateway address\n"
"IPv6 gateway address\n"
"Outgoing MPLS label\n"
"Use Implicit-Null label\n")
{
return zebra_mpls_transit_lsp (vty, 1, argv[0], argv[1], argv[2], NULL);
}
DEFUN (no_mpls_transit_lsp,
no_mpls_transit_lsp_cmd,
"no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X)",
NO_STR
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n"
"IPv4 gateway address\n"
"IPv6 gateway address\n")
{
return zebra_mpls_transit_lsp (vty, 0, argv[0], argv[1], NULL, NULL);
}
ALIAS (no_mpls_transit_lsp,
no_mpls_transit_lsp_out_label_cmd,
"no mpls lsp <16-1048575> (A.B.C.D|X:X::X:X) (<16-1048575>|implicit-null)",
NO_STR
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n"
"IPv4 gateway address\n"
"IPv6 gateway address\n"
"Outgoing MPLS label\n"
"Use Implicit-Null label\n")
DEFUN (no_mpls_transit_lsp_all,
no_mpls_transit_lsp_all_cmd,
"no mpls lsp <16-1048575>",
NO_STR
MPLS_STR
"Establish label switched path\n"
"Incoming MPLS label\n")
{
return zebra_mpls_transit_lsp (vty, 0, argv[0], NULL, NULL, NULL);
}
/* Static route configuration. */
DEFUN (ip_route_label,
ip_route_label_cmd,
"ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
NULL, NULL, argv[2]);
}
DEFUN (ip_route_tag_label,
ip_route_tag_label_cmd,
"ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
NULL, NULL, argv[3]);
}
/* Mask as A.B.C.D format. */
DEFUN (ip_route_mask_label,
ip_route_mask_label_cmd,
"ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
NULL, NULL, argv[3]);
}
DEFUN (ip_route_mask_tag_label,
ip_route_mask_tag_label_cmd,
"ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
NULL, NULL, argv[4]);
}
/* Distance option value. */
DEFUN (ip_route_distance_label,
ip_route_distance_label_cmd,
"ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, NULL,
argv[2], NULL, argv[3]);
}
DEFUN (ip_route_tag_distance_label,
ip_route_tag_distance_label_cmd,
"ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1], NULL, argv[2],
argv[3], NULL, argv[4]);
}
DEFUN (ip_route_mask_distance_label,
ip_route_mask_distance_label_cmd,
"ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, NULL,
argv[3], NULL, argv[4]);
}
DEFUN (ip_route_mask_tag_distance_label,
ip_route_mask_tag_distance_label_cmd,
"ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2], NULL, argv[3],
argv[4], NULL, argv[5]);
}
DEFUN (no_ip_route_label,
no_ip_route_label_cmd,
"no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
NULL, NULL, argv[2]);
}
DEFUN (no_ip_route_tag_label,
no_ip_route_tag_label_cmd,
"no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Tag of this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
NULL, NULL, argv[3]);
}
DEFUN (no_ip_route_mask_label,
no_ip_route_mask_label_cmd,
"no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
NULL, NULL, argv[3]);
}
DEFUN (no_ip_route_mask_tag_label,
no_ip_route_mask_tag_label_cmd,
"no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Tag of this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
NULL, NULL, argv[4]);
}
DEFUN (no_ip_route_distance_label,
no_ip_route_distance_label_cmd,
"no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, NULL,
argv[2], NULL, argv[3]);
}
DEFUN (no_ip_route_tag_distance_label,
no_ip_route_tag_distance_label_cmd,
"no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix (e.g. 10.0.0.0/8)\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Tag of this route\n"
"Tag value\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1], NULL, argv[2],
argv[3], NULL, argv[4]);
}
DEFUN (no_ip_route_mask_distance_label,
no_ip_route_mask_distance_label_cmd,
"no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, NULL,
argv[3], NULL, argv[5]);
}
DEFUN (no_ip_route_mask_tag_distance_label,
no_ip_route_mask_tag_distance_label_cmd,
"no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-65535> <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IP destination prefix\n"
"IP destination prefix mask\n"
"IP gateway address\n"
"IP gateway interface name\n"
"Null interface\n"
"Tag of this route\n"
"Tag value\n"
"Distance value for this route\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return zebra_static_ipv4 (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], NULL, argv[3],
argv[4], NULL, argv[5]);
}
DEFUN (ipv6_route_label,
ipv6_route_label_cmd,
"ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
}
DEFUN (ipv6_route_tag_label,
ipv6_route_tag_label_cmd,
"ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
}
DEFUN (ipv6_route_ifname_label,
ipv6_route_ifname_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
}
DEFUN (ipv6_route_ifname_tag_label,
ipv6_route_ifname_tag_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
}
DEFUN (ipv6_route_pref_label,
ipv6_route_pref_label_cmd,
"ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
}
DEFUN (ipv6_route_pref_tag_label,
ipv6_route_pref_tag_label_cmd,
"ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
}
DEFUN (ipv6_route_ifname_pref_label,
ipv6_route_ifname_pref_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
}
DEFUN (ipv6_route_ifname_pref_tag_label,
ipv6_route_ifname_pref_tag_label_cmd,
"ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> label WORD",
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
}
DEFUN (no_ipv6_route_label,
no_ipv6_route_label_cmd,
"no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL, NULL, argv[2]);
}
DEFUN (no_ipv6_route_tag_label,
no_ipv6_route_tag_label_cmd,
"no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL, argv[3]);
}
DEFUN (no_ipv6_route_ifname_label,
no_ipv6_route_ifname_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL, NULL, argv[3]);
}
DEFUN (no_ipv6_route_ifname_tag_label,
no_ipv6_route_ifname_tag_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL, argv[4]);
}
DEFUN (no_ipv6_route_pref_label,
no_ipv6_route_pref_label_cmd,
"no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2], NULL, argv[3]);
}
DEFUN (no_ipv6_route_pref_tag_label,
no_ipv6_route_pref_tag_label_cmd,
"no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-65535> <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL, argv[4]);
}
DEFUN (no_ipv6_route_ifname_pref_label,
no_ipv6_route_ifname_pref_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3], NULL, argv[4]);
}
DEFUN (no_ipv6_route_ifname_pref_tag_label,
no_ipv6_route_ifname_pref_tag_label_cmd,
"no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-65535> <1-255> label WORD",
NO_STR
IP_STR
"Establish static routes\n"
"IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
"IPv6 gateway address\n"
"IPv6 gateway interface name\n"
"Set tag for this route\n"
"Tag value\n"
"Distance value for this prefix\n"
"Specify label(s) for this route\n"
"One or more labels separated by '/'\n")
{
return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL, argv[5]);
}
/* MPLS LSP configuration write function. */
static int
zebra_mpls_config (struct vty *vty)
{
int write = 0;
struct zebra_vrf *zvrf;
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
return 0;
write += zebra_mpls_write_lsp_config(vty, zvrf);
return write;
}
DEFUN (show_mpls_table,
show_mpls_table_cmd,
"show mpls table {json}",
SHOW_STR
MPLS_STR
"MPLS table\n"
"JavaScript Object Notation\n")
{
struct zebra_vrf *zvrf;
u_char use_json = (argv[0] != NULL);
zvrf = vrf_info_lookup(VRF_DEFAULT);
zebra_mpls_print_lsp_table(vty, zvrf, use_json);
return CMD_SUCCESS;
}
DEFUN (show_mpls_table_lsp,
show_mpls_table_lsp_cmd,
"show mpls table <16-1048575> {json}",
SHOW_STR
MPLS_STR
"MPLS table\n"
"LSP to display information about\n"
"JavaScript Object Notation\n")
{
u_int32_t label;
struct zebra_vrf *zvrf;
u_char use_json = (argv[1] != NULL);
zvrf = vrf_info_lookup(VRF_DEFAULT);
label = atoi(argv[0]);
zebra_mpls_print_lsp (vty, zvrf, label, use_json);
return CMD_SUCCESS;
}
/* MPLS node for MPLS LSP. */
static struct cmd_node mpls_node = { MPLS_NODE, "", 1 };
/* MPLS VTY. */
void
zebra_mpls_vty_init (void)
{
install_node (&mpls_node, zebra_mpls_config);
install_element (CONFIG_NODE, &ip_route_label_cmd);
install_element (CONFIG_NODE, &ip_route_tag_label_cmd);
install_element (CONFIG_NODE, &ip_route_mask_label_cmd);
install_element (CONFIG_NODE, &ip_route_mask_tag_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_tag_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_tag_label_cmd);
install_element (CONFIG_NODE, &ip_route_distance_label_cmd);
install_element (CONFIG_NODE, &ip_route_tag_distance_label_cmd);
install_element (CONFIG_NODE, &ip_route_mask_distance_label_cmd);
install_element (CONFIG_NODE, &ip_route_mask_tag_distance_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_distance_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_tag_distance_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_distance_label_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_ifname_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_ifname_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_pref_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_ifname_pref_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_pref_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_tag_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_ifname_tag_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_pref_tag_label_cmd);
install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_tag_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_label_cmd);
install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_label_cmd);
install_element (CONFIG_NODE, &mpls_transit_lsp_cmd);
install_element (CONFIG_NODE, &no_mpls_transit_lsp_cmd);
install_element (CONFIG_NODE, &no_mpls_transit_lsp_out_label_cmd);
install_element (CONFIG_NODE, &no_mpls_transit_lsp_all_cmd);
install_element (VIEW_NODE, &show_mpls_table_cmd);
install_element (ENABLE_NODE, &show_mpls_table_cmd);
install_element (VIEW_NODE, &show_mpls_table_lsp_cmd);
install_element (ENABLE_NODE, &show_mpls_table_lsp_cmd);
}
#endif /* HAVE_MPLS */
|