dad9a4293e936d89f0199a62eb8431e60bcfe7b2
[bgpcep.git] / rsvp / api / src / main / yang / rsvp.yang
1 module rsvp {
2         yang-version 1;
3         namespace "urn:opendaylight:params:xml:ns:yang:rsvp";
4         prefix "rsvp";
5
6     import iana { prefix iana; revision-date 2013-08-16; }
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8     import ieee754 { prefix ieee754; revision-date 2013-08-19; }
9     import network-concepts { prefix netc; revision-date 2013-11-25; }
10
11     organization "Cisco Systems, Inc.";
12     contact "Robert Varga <rovarga@cisco.com>";
13
14     description
15             "This module contains the definition of types related to
16             Resource Reservation Protocol (RSVP).
17
18             Copyright (c)2013 Cisco Systems, Inc. All rights reserved.
19
20             This program and the accompanying materials are made available
21             under the terms of the Eclipse Public License v1.0 which
22             accompanies this distribution, and is available at
23             http://www.eclipse.org/legal/epl-v10.html";
24
25     revision "2015-08-20" {
26         description
27             "Updated to extend RSVP Objects.";
28         reference "http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-01#section-2.1";
29     }
30
31     revision "2013-08-20" {
32             description
33                     "Initial revision.";
34             reference "https://tools.ietf.org/html/rfc2205";
35     }
36
37     typedef attribute-filter {
38         type uint32;
39     }
40
41     grouping attribute-filters {
42         leaf include-any {
43             type attribute-filter;
44         }
45
46         leaf exclude-any {
47             type attribute-filter;
48         }
49
50         leaf include-all {
51             type attribute-filter;
52         }
53     }
54
55     grouping rsvp-te-object {
56         description
57             "Common marker for all RSVP-TE Objects.";
58     }
59
60     grouping priority {
61         leaf hold-priority {
62             type uint8;
63             default 0;
64         }
65
66         leaf setup-priority {
67             type uint8;
68             default 0;
69         }
70     }
71
72     grouping tunnel-attributes {
73         uses priority;
74
75         leaf local-protection-desired {
76             type boolean;
77             default false;
78         }
79
80         leaf label-recording-desired {
81             type boolean;
82             default false;
83         }
84
85         leaf se-style-desired {
86             type boolean;
87             default false;
88         }
89
90         leaf session-name {
91            type string;
92         }
93
94         uses attribute-filters;
95     }
96
97     typedef lsp-id {
98         type uint32;
99         reference "https://tools.ietf.org/html/rfc3209#section-4.6.2.1";
100     }
101
102     typedef tunnel-id {
103         type uint16;
104         reference "https://tools.ietf.org/html/rfc3209#section-4.6.1.1";
105     }
106
107     typedef ipv4-extended-tunnel-id {
108         type inet:ipv4-address;
109         reference "https://tools.ietf.org/html/rfc3209#section-4.6.1.1";
110     }
111
112     typedef ipv6-extended-tunnel-id {
113         type inet:ipv6-address;
114         reference "https://tools.ietf.org/html/rfc3209#section-4.6.1.2";
115     }
116
117     typedef srlg-id {
118         type uint32;
119         reference "http://tools.ietf.org/html/rfc4202#section-2.3";
120     }
121
122     typedef lsp-flag {
123         type enumeration {
124             enum unprotected {
125                 value 0;
126             }
127             enum full-rerouting {
128                 value 1;
129             }
130             enum rerouting-without-extra-traffic {
131                 value 2;
132             }
133             enum protection-with-extra-traffic {
134                 value 4;
135             }
136             enum unidirectional-protection {
137                 value 8;
138             }
139             enum bidirectional-protection {
140                 value 10;
141             }
142         }
143     }
144
145     typedef link-flags {
146         type enumeration {
147             enum totally-unprotected {
148                 value 0;
149             }
150             enum extra-traffic {
151                 value 1;
152             }
153             enum unprotected {
154                 value 2;
155             }
156             enum shared {
157                 value 4;
158             }
159             enum dedicated-1to1{
160                 value 8;
161             }
162             enum dedicated-1plus1 {
163                 value 10;
164             }
165             enum enhanced {
166                 value 20;
167             }
168         }
169     }
170
171     grouping error-spec {
172         reference "https://tools.ietf.org/html/rfc2205#page-81";
173
174         leaf node {
175             type inet:ip-address;
176             mandatory true;
177         }
178
179         leaf flags {
180             type bits {
181                 bit in-place {
182                     position 7;
183                 }
184                 bit not-guilty {
185                     position 6;
186                 }
187             }
188         }
189
190         leaf code {
191             type uint8;
192             mandatory true;
193         }
194
195         leaf value {
196             type uint16;
197             mandatory true;
198         }
199     }
200
201     grouping user-error-spec {
202         reference "https://tools.ietf.org/html/rfc5284#section-3";
203
204         leaf enterprise {
205             type iana:enterprise-number;
206             mandatory true;
207         }
208
209         leaf sub-org {
210             type uint8;
211             default 0;
212         }
213
214         leaf value {
215             type uint16;
216             mandatory true;
217         }
218
219         leaf description {
220             type string;
221             default "";
222         }
223
224         container subobjects {
225             // Filled by enterprise-specific augmentations
226         }
227     }
228
229     // Marker
230     grouping c-label;
231
232     grouping type1-label {
233         reference "https://tools.ietf.org/html/rfc3209#section-4.1";
234
235         uses c-label;
236
237         leaf type1-label {
238             type uint32;
239             mandatory true;
240         }
241     }
242
243     grouping generalized-label {
244         reference "https://tools.ietf.org/html/rfc3473#section-2.3";
245
246         uses c-label;
247
248         leaf generalized-label {
249             type binary;
250             mandatory true;
251         }
252     }
253
254     grouping waveband-switching-label {
255         reference "https://tools.ietf.org/html/rfc3473#section-2.4";
256
257         uses c-label;
258
259         leaf end-label {
260             type uint32;
261             mandatory true;
262         }
263         leaf start-label {
264             type uint32;
265             mandatory true;
266         }
267         leaf waveband-id {
268             type uint32;
269             mandatory true;
270         }
271     }
272
273     grouping label-set {
274         reference "https://tools.ietf.org/html/rfc3473#section-2.6";
275
276         leaf action {
277             type enumeration {
278                 enum inclusive-list {
279                     value 0;
280                 }
281                 enum exclusive-list {
282                     value 1;
283                 }
284                 enum inclusive-range {
285                     value 2;
286                 }
287                 enum exclusive-range {
288                     value 3;
289                 }
290             }
291         }
292
293         container label-type {
294             // Technology-specific
295         }
296
297         list subchannels {
298
299         }
300     }
301
302     //marker
303     grouping c-subobject {
304
305     }
306
307     grouping ip-prefix-subobject {
308         uses c-subobject;
309         leaf ip-prefix {
310             reference "http://tools.ietf.org/html/rfc3209#section-4.3.3.1";
311             type inet:ip-prefix;
312             mandatory true;
313         }
314     }
315
316     grouping as-number-subobject {
317         uses c-subobject;
318         leaf as-number {
319             reference "http://tools.ietf.org/html/rfc3209#section-4.3.3.4";
320             type inet:as-number;
321             mandatory true;
322         }
323     }
324
325     grouping label-subobject {
326         uses c-subobject;
327
328         leaf uni-directional {
329             type boolean;
330             mandatory true;
331         }
332
333         choice label-type {
334             case type1-label-case {
335                 container type1-label {
336                     uses type1-label;
337                 }
338             }
339             case generalized-label-case {
340                 container generalized-label {
341                     uses generalized-label;
342                 }
343             }
344             case waveband-switching-label-case {
345                 container waveband-switching-label {
346                     uses waveband-switching-label;
347                 }
348             }
349         }
350     }
351
352     grouping unnumbered-subobject {
353         uses c-subobject;
354         leaf router-id {
355             type uint32;
356             mandatory true;
357         }
358
359         leaf interface-id {
360             type uint32;
361             mandatory true;
362         }
363     }
364
365     grouping srlg-subobject {
366         uses c-subobject;
367         leaf srlg-id {
368             type srlg-id;
369             mandatory true;
370         }
371     }
372
373     typedef path-key {
374         type uint16;
375     }
376
377     typedef pce-id {
378         type union {
379             type binary {
380                 length 4;
381             }
382             type binary {
383                 length 16;
384             }
385         }
386     }
387
388     grouping path-key-subobject {
389         reference "https://tools.ietf.org/html/rfc5520#section-3.1";
390         uses c-subobject;
391
392         leaf pce-id {
393             type pce-id;
394             mandatory true;
395         }
396
397         leaf path-key {
398             type path-key;
399             mandatory true;
400         }
401     }
402
403     grouping protection-subobject {
404         container protection-subobject {
405             leaf secondary {
406                 type boolean;
407                 default false;
408             }
409             leaf protecting {
410                 type boolean;
411                 default false;
412             }
413             leaf notification {
414                 type boolean;
415                 default false;
416             }
417             leaf operational {
418                 type boolean;
419                 default false;
420             }
421             leaf lsp-flag {
422                 type lsp-flag;
423                 mandatory true;
424             }
425             leaf link-flags {
426                 type link-flags;
427                 mandatory true;
428             }
429             leaf in-place {
430                 type boolean;
431                 default false;
432             }
433             leaf required {
434                 type boolean;
435                 default false;
436             }
437             leaf seg-flag {
438                 type lsp-flag;
439                 mandatory true;
440             }
441         }
442     }
443
444     grouping record-route-subobjects {
445         leaf protection-available {
446             type boolean;
447             default false;
448         }
449
450         leaf protection-in-use {
451             type boolean;
452             default false;
453         }
454
455         choice subobject-type {
456             case ip-prefix-case {
457                 container ip-prefix {
458                     uses ip-prefix-subobject;
459                 }
460             }
461
462             case label-case {
463                 container label {
464                     uses label-subobject;
465
466                     leaf global {
467                         type boolean;
468                         default false;
469                     }
470                 }
471             }
472
473             case unnumbered-case {
474                 container unnumbered {
475                     uses unnumbered-subobject;
476                 }
477             }
478
479             case path-key-case {
480                 container path-key {
481                     uses path-key-subobject;
482                 }
483             }
484         }
485     }
486
487     grouping basic-explicit-route-subobjects {
488         description "Subobjects shared between XRO and ERO";
489         reference "https://tools.ietf.org/html/rfc4874#section-4.1";
490
491         choice subobject-type {
492             case as-number-case {
493                 container as-number {
494                     uses as-number-subobject;
495                 }
496             }
497             case ip-prefix-case {
498                 container ip-prefix {
499                     uses ip-prefix-subobject;
500                 }
501             }
502             case label-case {
503                 container label {
504                     uses label-subobject;
505                 }
506             }
507             case srlg-case {
508                 container srlg {
509                     uses srlg-subobject;
510                 }
511             }
512             case unnumbered-case {
513                 container unnumbered {
514                     uses unnumbered-subobject;
515                 }
516             }
517         }
518     }
519
520     grouping exclude-route-object {
521         container exclude-route-object {
522             uses rsvp-te-object;
523             list subobject-container {
524                 uses exclude-route-subobjects;
525                 ordered-by user;
526             }
527         }
528     }
529
530     grouping record-route-subobjects-list {
531         list subobject-container {
532             uses record-route-subobjects;
533             ordered-by user;
534         }
535     }
536
537     grouping explicit-route-subobjects-list {
538
539         list subobject-container {
540             leaf loose {
541                 type boolean;
542                 mandatory true;
543             }
544
545             uses explicit-route-subobjects;
546             ordered-by user;
547         }
548     }
549
550     grouping record-route-object {
551         container record-route-object {
552             uses rsvp-te-object;
553             uses record-route-subobjects-list;
554         }
555     }
556
557     grouping explicit-route-object {
558         container explicit-route-object {
559             description "Explicit Route Object";
560             reference "http://tools.ietf.org/html/rfc3209#section-4.3";
561
562             uses rsvp-te-object;
563             uses explicit-route-subobjects-list;
564         }
565     }
566
567     grouping secondary-explicit-route-object {
568         container secondary-explicit-route-object {
569             description "Explicit Route Object";
570             reference "http://tools.ietf.org/html/rfc4873#section-4.1";
571
572             uses rsvp-te-object;
573             uses explicit-route-subobjects-list {
574                 augment "subobject-container/subobject-type" {
575                     case basic-protection-case {
576                         container basic-protection {
577                             uses protection-subobject;
578                         }
579                     }
580
581                     case dynamic-control-protection-case {
582                         container dynamic-control-protection {
583                             uses protection-subobject;
584                         }
585                     }
586                 }
587             }
588         }
589     }
590
591     grouping secondary-record-route-object {
592         container secondary-record-route-object {
593             uses rsvp-te-object;
594             uses record-route-subobjects-list {
595                 augment "subobject-container/subobject-type" {
596                     case basic-protection-case {
597                         container basic-protection {
598                             uses protection-subobject;
599                         }
600                     }
601
602                     case dynamic-control-protection-case {
603                         container dynamic-control-protection {
604                             uses protection-subobject;
605                         }
606                     }
607                 }
608             }
609         }
610     }
611
612     grouping exclude-route-subobjects {
613         description "Subobject of an Exclude Route Object";
614         reference "https://tools.ietf.org/html/rfc4874#section-3.1";
615
616         leaf mandatory {
617             type boolean;
618             default false;
619         }
620
621         leaf attribute {
622             type enumeration {
623                 enum interface {
624                     value 0;
625                 }
626                 enum node {
627                     value 1;
628                 }
629                 enum srlg {
630                     value 2;
631                 }
632             }
633             mandatory true;
634         }
635
636         uses basic-explicit-route-subobjects;
637     }
638
639     grouping explicit-route-subobjects {
640         description "Subobject of an Explicit Route Object";
641         reference "https://tools.ietf.org/html/rfc4874#section-4.1";
642         uses basic-explicit-route-subobjects {
643             augment "subobject-type" {
644                 case exrs-case {
645                     container exrs {
646                         list exrs {
647                             uses exclude-route-subobjects;
648                         }
649                     }
650                 }
651                 case path-key-case {
652                     container path-key {
653                         uses path-key-subobject;
654                     }
655                 }
656             }
657         }
658     }
659
660     grouping tspec-object {
661         container tspec-object {
662             description "SENDER TSPEC Object";
663             reference "https://tools.ietf.org/html/rfc2210";
664
665             uses rsvp-te-object;
666             leaf token-bucket-rate {
667                 type ieee754:float32;
668             }
669             leaf token-bucket-size {
670                 type ieee754:float32;
671             }
672             leaf peak-data-rate {
673                 type ieee754:float32;
674             }
675             leaf minimum-policed-unit {
676                 type uint32;
677             }
678             leaf maximum-packet-size {
679                 type uint32;
680             }
681         }
682     }
683
684     typedef service-number {
685         type enumeration {
686             enum guaranteed {
687                 value 2;
688             }
689             enum controlled-load {
690                 value 5;
691             }
692         }
693     }
694
695     grouping flow-spec-object {
696         container flow-spec-object {
697             description "FLOW_SPEC";
698             reference "https://tools.ietf.org/html/rfc2210";
699
700             uses rsvp-te-object;
701             leaf service-header {
702                 type service-number;
703             }
704
705             uses tspec-object;
706
707             leaf rate {
708                 type ieee754:float32;
709             }
710             leaf slack-term {
711                 type uint32;
712             }
713         }
714     }
715
716     typedef association-type {
717         type enumeration {
718             enum reserved {
719                 value 0;
720             }
721             enum recovery {
722                 value 1;
723             }
724         }
725     }
726
727     grouping association-object {
728         container association-object {
729             description "Association Object";
730             reference "http://tools.ietf.org/html/rfc4872#section-16";
731
732             uses rsvp-te-object;
733             leaf association-type {
734                 type association-type;
735             }
736             leaf association-id {
737                 type uint16;
738             }
739             leaf ip-address {
740                 type inet:ip-address;
741                 mandatory true;
742             }
743         }
744     }
745
746     grouping admin-status-object {
747         container admin-status-object {
748             description "Admin Status Object";
749             reference "http://tools.ietf.org/html/rfc3473#section-7.1";
750
751             uses rsvp-te-object;
752             leaf reflect {
753                 type boolean;
754                 default false;
755             }
756             leaf testing {
757                 type boolean;
758                 default false;
759             }
760             leaf administratively-down {
761                 type boolean;
762                 default false;
763             }
764             leaf deletion-in-progress {
765                 type boolean;
766                 default false;
767             }
768         }
769     }
770
771     grouping primary-path-route-object {
772         container primary-path-route-object {
773             description "Protection Subobject";
774             reference "http://tools.ietf.org/html/rfc4872#section-15";
775
776             uses rsvp-te-object;
777             uses explicit-route-subobjects-list;
778         }
779     }
780
781     grouping detour-object {
782         description "DETOUR Object";
783         reference "http://tools.ietf.org/html/rfc4090#section-4.2";
784
785         choice detour-object {
786             case ipv4-detour-object {
787                 uses rsvp-te-object;
788                 list plr {
789                     leaf plr-id {
790                         type inet:ipv4-address;
791                         mandatory true;
792                     }
793                     leaf avoid-node {
794                         type inet:ipv4-address;
795                         mandatory true;
796                     }
797                 }
798             }
799             case ipv6-detour-object {
800                 uses rsvp-te-object;
801                 list plr-id {
802                     leaf plr-id {
803                         type inet:ipv6-address;
804                         mandatory true;
805                     }
806                 }
807                 list avoid-node {
808                     leaf avoid-node {
809                         type inet:ipv6-address;
810                         mandatory true;
811                     }
812                 }
813             }
814         }
815
816     }
817
818     typedef fast-reroute-flags {
819         type enumeration {
820             enum one-to-one-backup-desired {
821                 value 1;
822             }
823             enum facility-backup-desired {
824                 value 2;
825             }
826         }
827     }
828
829     grouping common-fast-reroute-object {
830         uses rsvp-te-object;
831         uses priority;
832         uses attribute-filters;
833         leaf hop-limit {
834             type uint8;
835             default 0;
836         }
837         leaf flags {
838             type fast-reroute-flags;
839             mandatory true;
840         }
841         leaf bandwidth {
842             type netc:bandwidth;
843         }
844     }
845
846     grouping fast-reroute-object {
847         choice fast-reroute-object {
848             description "FAST REROUTE Object";
849             reference "http://tools.ietf.org/html/rfc4090#section-4.1";
850
851             case basic-fast-reroute-object {
852                 uses common-fast-reroute-object;
853             }
854             case legacy-fast-reroute-object {
855                 uses common-fast-reroute-object;
856             }
857         }
858     }
859
860     grouping session-attribute-object {
861         choice session-attribute-object {
862             description "SESSION_ATTRIBUTE";
863             reference "http://tools.ietf.org/html/rfc3209#section-4.7";
864
865             case basic-session-attribute-object {
866                 uses rsvp-te-object;
867                 uses tunnel-attributes;
868             }
869             case session-attribute-object-with-resources-affinities {
870                 uses rsvp-te-object;
871                 uses tunnel-attributes;
872             }
873         }
874     }
875
876     grouping bandwidth-object {
877         choice bandwidth-object {
878             description "BANDWIDTH Object";
879             reference "https://tools.ietf.org/html/rfc5440#section-7.7";
880
881             case basic-bandwidth-object {
882                 uses rsvp-te-object;
883                 // No possibility to carry TLVs
884                 leaf bandwidth {
885                     type netc:bandwidth;
886                 }
887             }
888             case reoptimization-bandwidth-object {
889                 uses rsvp-te-object;
890                 // No possibility to carry TLVs
891                 leaf bandwidth {
892                     type netc:bandwidth;
893                 }
894             }
895         }
896     }
897
898     grouping metric-object {
899         description "METRIC Object";
900         reference "https://tools.ietf.org/html/rfc5440#section-7.8";
901         container metric-object {
902             uses rsvp-te-object;
903
904             leaf metric-type {
905                 type uint8;
906                 mandatory true;
907             }
908
909             leaf bound {
910                 type boolean;
911                 default false;
912             }
913
914             leaf computed {
915                 type boolean;
916                 default false;
917             }
918
919             leaf value {
920                 type ieee754:float32;
921             }
922         }
923     }
924
925     grouping protection-object {
926         choice protection-object {
927             description "Protection Subobject";
928             reference "http://tools.ietf.org/html/rfc4873#section-6.1"
929             + " http://tools.ietf.org/html/rfc4872#section-14";
930
931             case basic-protection-object-case {
932                 container basic-protection-object {
933                     uses rsvp-te-object;
934                     uses protection-subobject;
935                 }
936             }
937             case dynamic-control-protection-object-case {
938                 container dynamic-control-protection-object {
939                     uses rsvp-te-object;
940                     uses protection-subobject;
941                 }
942             }
943         }
944     }
945
946     grouping lsp-attributes-object {
947         container lsp-attributes-object {
948             description "Lsp Attributes Object";
949             reference "http://tools.ietf.org/html/rfc5420#section-4";
950
951             uses rsvp-te-object;
952             list subobject-container {
953                 uses lsp-att-subobject;
954             }
955         }
956     }
957
958     grouping lsp-required-attributes-object {
959         container lsp-required-attributes-object {
960             description "Lsp Required Attributes Object";
961             reference "http://tools.ietf.org/html/rfc5420#section-5";
962
963             uses rsvp-te-object;
964             uses lsp-attributes-object;
965         }
966     }
967
968     grouping attribute-flags {
969         description "Attributes Flags";
970         reference "http://tools.ietf.org/html/rfc5420#section-3.1";
971         list flag-container {
972             leaf flags {
973                 type binary {
974                    length 4;
975                 }
976             }
977         }
978     }
979
980     grouping lsp-att-subobject {
981         choice lsp-subobject {
982             case flags-tlv {
983                 uses attribute-flags;
984             }
985         }
986     }
987 }