Fix rsvp.yang
[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-no-zone;
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-no-zone;
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-no-zone;
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 binary {
379             length 4|16;
380         }
381     }
382
383     grouping path-key-subobject {
384         reference "https://tools.ietf.org/html/rfc5520#section-3.1";
385         uses c-subobject;
386
387         leaf pce-id {
388             type pce-id;
389             mandatory true;
390         }
391
392         leaf path-key {
393             type path-key;
394             mandatory true;
395         }
396     }
397
398     grouping protection-subobject {
399         container protection-subobject {
400             leaf secondary {
401                 type boolean;
402                 default false;
403             }
404             leaf protecting {
405                 type boolean;
406                 default false;
407             }
408             leaf notification {
409                 type boolean;
410                 default false;
411             }
412             leaf operational {
413                 type boolean;
414                 default false;
415             }
416             leaf lsp-flag {
417                 type lsp-flag;
418                 mandatory true;
419             }
420             leaf link-flags {
421                 type link-flags;
422                 mandatory true;
423             }
424             leaf in-place {
425                 type boolean;
426                 default false;
427             }
428             leaf required {
429                 type boolean;
430                 default false;
431             }
432             leaf seg-flag {
433                 type lsp-flag;
434                 mandatory true;
435             }
436         }
437     }
438
439     grouping record-route-subobjects {
440         leaf protection-available {
441             type boolean;
442             default false;
443         }
444
445         leaf protection-in-use {
446             type boolean;
447             default false;
448         }
449
450         choice subobject-type {
451             case ip-prefix-case {
452                 container ip-prefix {
453                     uses ip-prefix-subobject;
454                 }
455             }
456
457             case label-case {
458                 container label {
459                     uses label-subobject;
460
461                     leaf global {
462                         type boolean;
463                         default false;
464                     }
465                 }
466             }
467
468             case unnumbered-case {
469                 container unnumbered {
470                     uses unnumbered-subobject;
471                 }
472             }
473
474             case path-key-case {
475                 container path-key {
476                     uses path-key-subobject;
477                 }
478             }
479         }
480     }
481
482     grouping basic-explicit-route-subobjects {
483         description "Subobjects shared between XRO and ERO";
484         reference "https://tools.ietf.org/html/rfc4874#section-4.1";
485
486         choice subobject-type {
487             case as-number-case {
488                 container as-number {
489                     uses as-number-subobject;
490                 }
491             }
492             case ip-prefix-case {
493                 container ip-prefix {
494                     uses ip-prefix-subobject;
495                 }
496             }
497             case label-case {
498                 container label {
499                     uses label-subobject;
500                 }
501             }
502             case srlg-case {
503                 container srlg {
504                     uses srlg-subobject;
505                 }
506             }
507             case unnumbered-case {
508                 container unnumbered {
509                     uses unnumbered-subobject;
510                 }
511             }
512         }
513     }
514
515     grouping exclude-route-object {
516         container exclude-route-object {
517             uses rsvp-te-object;
518             list subobject-container {
519                 uses exclude-route-subobjects;
520                 ordered-by user;
521             }
522         }
523     }
524
525     grouping record-route-subobjects-list {
526         list subobject-container {
527             uses record-route-subobjects;
528             ordered-by user;
529         }
530     }
531
532     grouping explicit-route-subobjects-list {
533
534         list subobject-container {
535             leaf loose {
536                 type boolean;
537                 mandatory true;
538             }
539
540             uses explicit-route-subobjects;
541             ordered-by user;
542         }
543     }
544
545     grouping record-route-object {
546         container record-route-object {
547             uses rsvp-te-object;
548             uses record-route-subobjects-list;
549         }
550     }
551
552     grouping explicit-route-object {
553         container explicit-route-object {
554             description "Explicit Route Object";
555             reference "http://tools.ietf.org/html/rfc3209#section-4.3";
556
557             uses rsvp-te-object;
558             uses explicit-route-subobjects-list;
559         }
560     }
561
562     grouping secondary-explicit-route-object {
563         container secondary-explicit-route-object {
564             description "Explicit Route Object";
565             reference "http://tools.ietf.org/html/rfc4873#section-4.1";
566
567             uses rsvp-te-object;
568             list subobject-container {
569                 leaf loose {
570                     type boolean;
571                     mandatory true;
572                 }
573
574                 uses secondary-explicit-route-subobjects;
575                 ordered-by user;
576             }
577         }
578     }
579
580     grouping secondary-explicit-route-subobjects {
581         uses explicit-route-subobjects {
582             augment "subobject-type" {
583                 case basic-protection-case {
584                     container basic-protection {
585                         uses protection-subobject;
586                     }
587                 }
588
589                 case dynamic-control-protection-case {
590                     container dynamic-control-protection {
591                         uses protection-subobject;
592                     }
593                 }
594             }
595         }
596     }
597
598     grouping secondary-record-route-object {
599         container secondary-record-route-object {
600             uses rsvp-te-object;
601             list subobject-container {
602                 uses secondary-record-route-subobjects;
603                 ordered-by user;
604             }
605         }
606     }
607
608     grouping secondary-record-route-subobjects {
609         uses record-route-subobjects {
610             augment "subobject-type" {
611                 case basic-protection-case {
612                     container basic-protection {
613                         uses protection-subobject;
614                     }
615                 }
616
617                 case dynamic-control-protection-case {
618                     container dynamic-control-protection {
619                         uses protection-subobject;
620                     }
621                 }
622             }
623         }
624     }
625
626     grouping exclude-route-subobjects {
627         description "Subobject of an Exclude Route Object";
628         reference "https://tools.ietf.org/html/rfc4874#section-3.1";
629
630         leaf mandatory {
631             type boolean;
632             default false;
633         }
634
635         leaf attribute {
636             type enumeration {
637                 enum interface {
638                     value 0;
639                 }
640                 enum node {
641                     value 1;
642                 }
643                 enum srlg {
644                     value 2;
645                 }
646             }
647             mandatory true;
648         }
649
650         uses basic-explicit-route-subobjects;
651     }
652
653     grouping explicit-route-subobjects {
654         description "Subobject of an Explicit Route Object";
655         reference "https://tools.ietf.org/html/rfc4874#section-4.1";
656         uses basic-explicit-route-subobjects {
657             augment "subobject-type" {
658                 case exrs-case {
659                     container exrs {
660                         list exrs {
661                             uses exclude-route-subobjects;
662                         }
663                     }
664                 }
665                 case path-key-case {
666                     container path-key {
667                         uses path-key-subobject;
668                     }
669                 }
670             }
671         }
672     }
673
674     grouping tspec-object {
675         container tspec-object {
676             description "SENDER TSPEC Object";
677             reference "https://tools.ietf.org/html/rfc2210";
678
679             uses rsvp-te-object;
680             leaf token-bucket-rate {
681                 type ieee754:float32;
682             }
683             leaf token-bucket-size {
684                 type ieee754:float32;
685             }
686             leaf peak-data-rate {
687                 type ieee754:float32;
688             }
689             leaf minimum-policed-unit {
690                 type uint32;
691             }
692             leaf maximum-packet-size {
693                 type uint32;
694             }
695         }
696     }
697
698     typedef service-number {
699         type enumeration {
700             enum guaranteed {
701                 value 2;
702             }
703             enum controlled-load {
704                 value 5;
705             }
706         }
707     }
708
709     grouping flow-spec-object {
710         container flow-spec-object {
711             description "FLOW_SPEC";
712             reference "https://tools.ietf.org/html/rfc2210";
713
714             uses rsvp-te-object;
715             leaf service-header {
716                 type service-number;
717             }
718
719             uses tspec-object;
720
721             leaf rate {
722                 type ieee754:float32;
723             }
724             leaf slack-term {
725                 type uint32;
726             }
727         }
728     }
729
730     typedef association-type {
731         type enumeration {
732             enum reserved {
733                 value 0;
734             }
735             enum recovery {
736                 value 1;
737             }
738         }
739     }
740
741     grouping association-object {
742         container association-object {
743             description "Association Object";
744             reference "http://tools.ietf.org/html/rfc4872#section-16";
745
746             uses rsvp-te-object;
747             leaf association-type {
748                 type association-type;
749             }
750             leaf association-id {
751                 type uint16;
752             }
753             leaf ip-address {
754                 type inet:ip-address-no-zone;
755                 mandatory true;
756             }
757         }
758     }
759
760     grouping admin-status-object {
761         container admin-status-object {
762             description "Admin Status Object";
763             reference "http://tools.ietf.org/html/rfc3473#section-7.1";
764
765             uses rsvp-te-object;
766             leaf reflect {
767                 type boolean;
768                 default false;
769             }
770             leaf testing {
771                 type boolean;
772                 default false;
773             }
774             leaf administratively-down {
775                 type boolean;
776                 default false;
777             }
778             leaf deletion-in-progress {
779                 type boolean;
780                 default false;
781             }
782         }
783     }
784
785     grouping primary-path-route-object {
786         container primary-path-route-object {
787             description "Protection Subobject";
788             reference "http://tools.ietf.org/html/rfc4872#section-15";
789
790             uses rsvp-te-object;
791             uses explicit-route-subobjects-list;
792         }
793     }
794
795     grouping detour-object {
796         description "DETOUR Object";
797         reference "http://tools.ietf.org/html/rfc4090#section-4.2";
798
799         choice detour-object {
800             case ipv4-detour-object {
801                 uses rsvp-te-object;
802                 list plr {
803                     leaf plr-id {
804                         type inet:ipv4-address-no-zone;
805                         mandatory true;
806                     }
807                     leaf avoid-node {
808                         type inet:ipv4-address-no-zone;
809                         mandatory true;
810                     }
811                 }
812             }
813             case ipv6-detour-object {
814                 uses rsvp-te-object;
815                 list plr-id {
816                     leaf plr-id {
817                         type inet:ipv6-address-no-zone;
818                         mandatory true;
819                     }
820                 }
821                 list avoid-node {
822                     leaf avoid-node {
823                         type inet:ipv6-address-no-zone;
824                         mandatory true;
825                     }
826                 }
827             }
828         }
829
830     }
831
832     typedef fast-reroute-flags {
833         type enumeration {
834             enum one-to-one-backup-desired {
835                 value 1;
836             }
837             enum facility-backup-desired {
838                 value 2;
839             }
840         }
841     }
842
843     grouping common-fast-reroute-object {
844         uses rsvp-te-object;
845         uses priority;
846         uses attribute-filters;
847         leaf hop-limit {
848             type uint8;
849             default 0;
850         }
851         leaf flags {
852             type fast-reroute-flags;
853             mandatory true;
854         }
855         leaf bandwidth {
856             type netc:bandwidth;
857         }
858     }
859
860     grouping fast-reroute-object {
861         choice fast-reroute-object {
862             description "FAST REROUTE Object";
863             reference "http://tools.ietf.org/html/rfc4090#section-4.1";
864
865             case basic-fast-reroute-object-case {
866                 container basic-fast-reroute-object {
867                     uses common-fast-reroute-object;
868                 }
869             }
870             case legacy-fast-reroute-object-case {
871                 container legacy-fast-reroute-object {
872                     uses common-fast-reroute-object;
873                 }
874             }
875         }
876     }
877
878     grouping session-attribute-object {
879         choice session-attribute-object {
880             description "SESSION_ATTRIBUTE";
881             reference "http://tools.ietf.org/html/rfc3209#section-4.7";
882
883             case basic-session-attribute-object-case {
884                 container basic-session-attribute-object {
885                     uses rsvp-te-object;
886                     uses tunnel-attributes;
887                 }
888             }
889             case session-attribute-object-with-resources-affinities-case {
890                 container session-attribute-object-with-resources-affinities {
891                     uses rsvp-te-object;
892                     uses tunnel-attributes;
893                 }
894             }
895         }
896     }
897
898     grouping bandwidth-object {
899         choice bandwidth-object {
900             description "BANDWIDTH Object";
901             reference "https://tools.ietf.org/html/rfc5440#section-7.7";
902
903             case basic-bandwidth-object-case {
904                 container basic-bandwidth-object {
905                     uses rsvp-te-object;
906                     // No possibility to carry TLVs
907                     leaf bandwidth {
908                         type netc:bandwidth;
909                     }
910                 }
911             }
912             case reoptimization-bandwidth-object-case {
913                 container reoptimization-bandwidth-object {
914                     uses rsvp-te-object;
915                     // No possibility to carry TLVs
916                     leaf bandwidth {
917                         type netc:bandwidth;
918                     }
919                 }
920             }
921         }
922     }
923
924     grouping metric-object {
925         description "METRIC Object";
926         reference "https://tools.ietf.org/html/rfc5440#section-7.8";
927         container metric-object {
928             uses rsvp-te-object;
929
930             leaf metric-type {
931                 type uint8;
932                 mandatory true;
933             }
934
935             leaf bound {
936                 type boolean;
937                 default false;
938             }
939
940             leaf computed {
941                 type boolean;
942                 default false;
943             }
944
945             leaf value {
946                 type ieee754:float32;
947             }
948         }
949     }
950
951     grouping protection-object {
952         choice protection-object {
953             description "Protection Subobject";
954             reference "http://tools.ietf.org/html/rfc4873#section-6.1"
955             + " http://tools.ietf.org/html/rfc4872#section-14";
956
957             case basic-protection-object-case {
958                 container basic-protection-object {
959                     uses rsvp-te-object;
960                     uses protection-subobject;
961                 }
962             }
963             case dynamic-control-protection-object-case {
964                 container dynamic-control-protection-object {
965                     uses rsvp-te-object;
966                     uses protection-subobject;
967                 }
968             }
969         }
970     }
971
972     grouping lsp-attributes-object {
973         container lsp-attributes-object {
974             description "Lsp Attributes Object";
975             reference "http://tools.ietf.org/html/rfc5420#section-4";
976
977             uses rsvp-te-object;
978             list subobject-container {
979                 uses lsp-att-subobject;
980             }
981         }
982     }
983
984     grouping lsp-required-attributes-object {
985         container lsp-required-attributes-object {
986             description "Lsp Required Attributes Object";
987             reference "http://tools.ietf.org/html/rfc5420#section-5";
988
989             uses rsvp-te-object;
990             uses lsp-attributes-object;
991         }
992     }
993
994     grouping attribute-flags {
995         description "Attributes Flags";
996         reference "http://tools.ietf.org/html/rfc5420#section-3.1";
997         list flag-container {
998             leaf flags {
999                 type binary {
1000                    length 4;
1001                 }
1002             }
1003         }
1004     }
1005
1006     grouping lsp-att-subobject {
1007         choice lsp-subobject {
1008             case flags-tlv {
1009                 uses attribute-flags;
1010             }
1011         }
1012     }
1013 }