Adding required ietf YANG models to support OTN tunnel as part of SOTN NNI-based...
[sdnc/oam.git] / platform-logic / restconfapi-yang / src / main / yang / sotn / ietf-te@2018-03-03.yang
1 module ietf-te {
2   yang-version 1.1;
3
4   namespace "urn:ietf:params:xml:ns:yang:ietf-te";
5
6   /* Replace with IANA when assigned */
7   prefix "te";
8
9   /* Import TE generic types */
10   import ietf-te-types {
11     prefix te-types;
12   }
13
14   import ietf-inet-types {
15     prefix inet;
16   }
17
18   organization
19     "IETF Traffic Engineering Architecture and Signaling (TEAS)
20      Working Group";
21
22   contact
23     "WG Web:   <http://tools.ietf.org/wg/teas/>
24      WG List:  <mailto:teas@ietf.org>
25
26      WG Chair: Lou Berger
27                <mailto:lberger@labn.net>
28
29      WG Chair: Vishnu Pavan Beeram
30                <mailto:vbeeram@juniper.net>
31
32      Editor:   Tarek Saad
33                <mailto:tsaad@cisco.com>
34
35      Editor:   Rakesh Gandhi
36                <mailto:rgandhi@cisco.com>
37
38      Editor:   Vishnu Pavan Beeram
39                <mailto:vbeeram@juniper.net>
40
41      Editor:   Himanshu Shah
42                <mailto:hshah@ciena.com>
43
44      Editor:   Xufeng Liu
45                <mailto:Xufeng_Liu@jabil.com>
46
47      Editor:   Igor Bryskin
48                <mailto:Igor.Bryskin@huawei.com>";
49
50   description
51     "YANG data module for TE configuration,
52     state, RPC and notifications.";
53
54   revision "2018-03-03" {
55     description "Latest update to TE generic YANG module.";
56     reference "TBA";
57   }
58
59   typedef tunnel-ref {
60     type leafref {
61       path "/te:te/te:tunnels/te:tunnel/te:name";
62     }
63     description
64       "This type is used by data models that need to reference
65        configured TE tunnel.";
66   }
67
68 /**** TODO: FIXME Hesam
69   typedef path-ref {
70     type union {
71       type leafref {
72         path "/te:te/te:tunnels/te:tunnel/" +
73               "te:p2p-primary-paths/te:p2p-primary-path/te:name";
74       }
75       type leafref {
76         path "/te:te/te:tunnels/te:tunnel/" +
77              "te:p2p-secondary-paths/te:p2p-secondary-path/te:name";
78       }
79     }
80     description
81       "This type is used by data models that need to reference
82        configured primary or secondary path of a TE tunnel.";
83   }
84 ***** TODO****/
85
86   typedef tunnel-p2mp-ref {
87     type leafref {
88       path "/te:te/te:tunnels/te:tunnel-p2mp/te:name";
89     }
90     description
91       "This type is used by data models that need to reference
92        configured P2MP TE tunnel.";
93     reference "RFC4875";
94   }
95
96   /**
97    * TE tunnel generic groupings
98    */
99   grouping path-affinities-contents_config {
100     description
101       "Path affinities constraints grouping";
102     reference "RFC3630 and RFC5305";
103     leaf usage {
104       type identityref {
105         base te-types:resource-affinities-type;
106       }
107       description "Affinities usage";
108     }
109     choice style {
110       description
111         "Path affinities representation style";
112       case value {
113         leaf value {
114           type te-types:admin-groups;
115           description
116             "Bitmap indicating what bits are of significance";
117         }
118       }
119       case named {
120         list affinity-names {
121           key "name";
122           leaf name {
123             type string;
124             description "Affinity name";
125           }
126           description "List of named affinities";
127         }
128       }
129     }
130   }
131
132   grouping path-affinities {
133     description "Path affinities grouping";
134     container path-affinities {
135       description "Path affinities container";
136       list constraints {
137         key "usage";
138         description "List of named affinity constraints";
139         uses path-affinities-contents_config;
140       }
141     }
142   }
143
144   grouping path-srlgs-values_config {
145     description "Path SRLG values properties grouping";
146     reference "RFC4203 and RFC5307";
147     leaf usage {
148       type identityref {
149         base te-types:route-exclude-srlg;
150       }
151       description "SRLG usage";
152     }
153     leaf-list values {
154       type te-types:srlg;
155       description "SRLG value";
156       reference "RFC4203 and RFC5307";
157     }
158   }
159
160   grouping path-srlgs {
161     description "Path SRLG properties grouping";
162     container path-srlgs {
163       description "Path SRLG properties container";
164       choice style {
165         description "Type of SRLG representation";
166         case values {
167           uses path-srlgs-values_config;
168         }
169         case named {
170           container constraints {
171             description "SRLG named constraints";
172             list constraint {
173               key "usage";
174               leaf usage {
175                 type identityref {
176                   base te-types:route-exclude-srlg;
177                 }
178                 description "SRLG usage";
179               }
180               container constraint {
181                 description "Container for named SRLG list";
182                 list srlg-names {
183                   key "name";
184                   leaf name {
185                     type string;
186                     description "The SRLG name";
187                   }
188                   description "List named SRLGs";
189                 }
190               }
191               description "List of named SRLG constraints";
192             }
193           }
194         }
195       }
196     }
197   }
198
199   grouping bidirectional-association_config {
200     description
201       "TE tunnel associated bidirectional leaves
202       grouping";
203     reference "RFC7551";
204     leaf id {
205       type uint16;
206       description
207         "The TE tunnel association identifier.";
208     }
209     leaf source {
210       type inet:ip-address;
211       description "The TE tunnel association source.";
212     }
213     leaf global-source {
214       type inet:ip-address;
215       description "The TE tunnel association global source.";
216     }
217     leaf type {
218       type identityref {
219         base te-types:bidir-association-type;
220       }
221       default te-types:bidir-assoc-non-corouted;
222       description "The TE tunnel association type.";
223     }
224     leaf provisioning {
225       type identityref {
226         base te-types:bidir-provisioning-mode;
227       }
228       description
229         "Describes the provisioning model of the
230         associated bidirectional LSP";
231       reference
232         "draft-ietf-teas-mpls-tp-rsvpte-ext-
233         associated-lsp, section-3.2";
234     }
235   }
236
237   grouping bidir-assoc-properties {
238     description
239       "TE tunnel associated bidirectional properties
240       grouping";
241     reference "RFC7551";
242     container bidirectional {
243       description
244         "TE tunnel associated bidirectional attributes.";
245       container association {
246         description
247           "Tunnel bidirectional association properties";
248         uses bidirectional-association_config;
249       }
250     }
251   }
252
253   grouping p2p-reverse-primary-path-properties {
254     description "tunnel path properties.";
255     reference "RFC7551";
256     container p2p-reverse-primary-path {
257       description "Tunnel reverse primary path properties";
258       uses p2p-path-reverse-properties_config;
259       container state {
260         config false;
261         description
262           "Configuration applied parameters and state";
263         uses p2p-path-properties_state;
264       }
265       container p2p-reverse-secondary-path {
266         description "Tunnel reverse secondary path properties";
267         uses p2p-reverse-path-candidate-secondary-path-config;
268       }
269     }
270   }
271
272   grouping p2p-secondary-path-properties {
273     description "tunnel path properties.";
274     uses p2p-path-properties_config;
275     uses protection-restoration-params_config;
276     container state {
277       config false;
278       description
279         "Configuration applied parameters and state";
280       uses p2p-path-properties_state;
281     }
282   }
283
284   grouping p2p-primary-path-properties {
285     description
286       "TE tunnel primary path properties grouping";
287     uses hierarchical-link;
288     uses p2p-path-properties_config;
289     container state {
290       config false;
291       description
292         "Configuration applied parameters and state";
293       uses p2p-path-properties_state;
294     }
295   }
296
297   grouping path-properties_state {
298     description "Computed path properties grouping";
299     leaf metric-type {
300       type identityref {
301         base te-types:path-metric-type;
302       }
303       description "TE path metric type";
304     }
305     leaf accumulative-value {
306       type uint64;
307       description "TE path metric accumulative value";
308     }
309   }
310
311   grouping path-properties {
312     description "TE computed path properties grouping";
313     container path-properties {
314       description "The TE path computed properties";
315       list path-metric {
316         key metric-type;
317         description "TE path metric type";
318         leaf metric-type {
319           type leafref {
320             path "../state/metric-type";
321           }
322           description "TE path metric type";
323         }
324         container state {
325           config false;
326           description
327             "Configuration applied parameters and state";
328           uses path-properties_state;
329         }
330       }
331       uses path-affinities;
332       uses path-srlgs;
333       container path-route-objects {
334         description
335           "Container for the list of computed route objects
336            as returned by the computation engine";
337         list path-computed-route-object {
338           key index;
339           description
340             "List of computed route objects returned by the
341              computation engine";
342           leaf index {
343             type leafref {
344               path "../state/index";
345             }
346             description "Index of computed route object";
347           }
348           container state {
349             config false;
350             description
351               "Configuration applied parameters and state";
352             uses te-types:explicit-route-hop;
353           }
354         }
355       }
356       uses shared-resources-tunnels;
357     }
358   }
359
360   grouping p2p-path-properties_state {
361     description "TE per path state parameters";
362     uses path-properties {
363       description "The TE path computed properties";
364     }
365     container lsps {
366       description "TE LSPs container";
367       list lsp {
368         key
369           "source destination tunnel-id lsp-id "+
370           "extended-tunnel-id";
371         description "List of LSPs associated with the tunnel.";
372         uses lsp-properties_state;
373         uses shared-resources-tunnels_state;
374         uses lsp-record-route-information_state;
375         uses path-properties {
376           description "The TE path actual properties";
377         }
378       }
379     }
380   }
381
382   grouping p2p-path-properties-common_config {
383     description
384       "TE tunnel common path properties configuration grouping";
385     leaf name {
386       type string;
387       description "TE path name";
388     }
389     leaf path-setup-protocol {
390       type identityref {
391         base te-types:path-signaling-type;
392       }
393       description
394         "Signaling protocol used to set up this tunnel";
395     }
396     leaf path-computation-method {
397       type identityref {
398         base te-types:path-computation-method;
399       }
400       default te-types:path-locally-computed;
401       description
402         "The method used for computing the path, either
403         locally computed, queried from a server or not
404         computed at all (explicitly configured).";
405     }
406     leaf path-computation-server {
407       when "../path-computation-method = "+
408       "'te-types:path-externally-queried'" {
409         description
410           "The path-computation server when the path is
411            externally queried";
412       }
413       type inet:ip-address;
414       description
415         "Address of the external path computation
416          server";
417     }
418     leaf compute-only {
419       type empty;
420       description
421         "When set, the path is computed and updated whenever
422          the topology is updated. No resources are committed
423          or reserved in the network.";
424     }
425     leaf use-path-computation {
426       when "../path-computation-method =" +
427       " 'te-types:path-locally-computed'";
428       type boolean;
429       description "A CSPF dynamically computed path";
430     }
431     leaf lockdown {
432       type empty;
433       description
434         "Indicates no reoptimization to be attempted for
435          this path.";
436     }
437     leaf path-scope {
438       type identityref {
439         base te-types:path-scope-type;
440       }
441       default te-types:path-scope-end-to-end;
442       description "Path scope if segment or an end-to-end path";
443     }
444   }
445
446   grouping p2p-path-reverse-properties_config {
447     description
448       "TE tunnel reverse path properties configuration
449        grouping";
450     uses p2p-path-properties-common_config;
451     uses path-constraints_config;
452     uses te-types:generic-path-optimization;
453     leaf named-path-constraint {
454       if-feature te-types:named-path-constraints;
455       type leafref {
456         path "../../../../../../globals/"
457         + "named-path-constraints/named-path-constraint/"
458         + "name";
459       }
460       description
461         "Reference to a globally defined named path
462         constraint set";
463     }
464   }
465
466   grouping p2p-path-properties_config {
467     description
468       "TE tunnel path properties configuration grouping";
469     uses p2p-path-properties-common_config;
470     uses path-constraints_config;
471     uses te-types:generic-path-optimization;
472     leaf preference {
473       type uint8 {
474         range "1..255";
475       }
476       description
477         "Specifies a preference for this path. The lower the
478         number higher the preference";
479     }
480     leaf named-path-constraint {
481       if-feature te-types:named-path-constraints;
482       type leafref {
483         path "../../../../../globals/"
484         + "named-path-constraints/named-path-constraint/"
485         + "name";
486       }
487       description
488         "Reference to a globally defined named path
489         constraint set";
490     }
491   }
492
493   /* TE tunnel configuration data */
494   grouping tunnel-p2mp-params_config {
495     description
496       "Configuration parameters relating to TE tunnel";
497     leaf name {
498       type string;
499       description "TE tunnel name.";
500     }
501     leaf identifier {
502       type uint16;
503       description
504         "TE tunnel Identifier.";
505     }
506     leaf description {
507       type string;
508       description
509         "Textual description for this TE tunnel";
510     }
511   }
512
513   grouping hierarchical-link_config {
514     description
515       "Hierarchical link configuration grouping";
516     reference "RFC4206";
517     leaf local-te-node-id {
518       type te-types:te-node-id;
519       description
520         "Local TE node identifier";
521     }
522     leaf local-te-link-tp-id {
523       type te-types:te-tp-id;
524       description
525         "Local TE link termination point identifier";
526     }
527     leaf remote-te-node-id {
528       type te-types:te-node-id;
529       description
530         "Remote TE node identifier";
531     }
532     uses te-types:te-topology-identifier;
533   }
534
535   grouping hierarchical-link {
536     description
537       "Hierarchical link grouping";
538     reference "RFC4206";
539     container hierarchical-link {
540       description
541         "Identifies a hierarchical link (in client layer)
542          that this tunnel is associated with.";
543       uses hierarchical-link_config;
544     }
545   }
546
547   grouping protection-restoration-params_state {
548     description
549       "Protection parameters grouping";
550     leaf lockout-of-normal {
551       type boolean;
552       description
553         "
554           When set to 'True', it represents a lockout of normal
555           traffic external command. When set to 'False', it
556           represents a clear lockout of normal traffic external
557           command. The lockout of normal traffic command applies
558           to this Tunnel.
559         ";
560       reference
561         "ITU-T G.808, RFC 4427";
562     }
563     leaf freeze {
564       type boolean;
565       description
566         "
567           When set to 'True', it represents a freeze external
568           command. When set to 'False', it represents a clear
569           freeze external command. The freeze command command
570           applies to all the Tunnels which are sharing the
571           protection resources with this Tunnel.
572         ";
573       reference
574         "ITU-T G.808, RFC 4427";
575     }
576     leaf lsp-protection-role {
577       type enumeration {
578         enum working {
579           description
580             "A working LSP must be a primary LSP whilst a protecting
581              LSP can be either a primary or a secondary LSP. Also,
582              known as protected LSPs when working LSPs are associated
583              with protecting LSPs.";
584         }
585         enum protecting {
586           description
587             "A secondary LSP is an LSP that has been provisioned
588              in the control plane only; e.g. resource allocation
589              has not been committed at the data plane";
590         }
591       }
592       description "LSP role type";
593       reference "rfc4872, section 4.2.1";
594     }
595
596     leaf lsp-protection-state {
597       type identityref {
598         base te-types:lsp-protection-state;
599       }
600       description
601         "The state of the APS state machine controlling which
602          tunnels is using the resources of the protecting LSP.";
603     }
604     leaf protection-group-ingress-node-id {
605       type te-types:te-node-id;
606       description
607         "Indicates the te-node-id of the protection group
608         ingress node when the APS state represents an extenal
609         command (LoP, SF, MS) applied to it or a WTR timer
610         running on it. If the external command is not applied to
611         the ingress node or the WTR timer is not running on it,
612         this attribute is not specified. If value 0.0.0.0 is used
613         when the te-node-id of the protection group ingress node is
614         unknown (e.g., because the ingress node is outside the scope
615         of control of the server)";
616     }
617     leaf protection-group-egress-node-id {
618       type te-types:te-node-id;
619       description
620         "Indicates the te-node-id of the protection group egress node
621         when the APS state represents an extenal command (LoP, SF,
622         MS) applied to it or a WTR timer running on it. If the
623         external command is not applied to the ingress node or
624         the WTR timer is not running on it, this attribute is not
625         specified. If value 0.0.0.0 is used when the te-node-id of
626         the protection group ingress node is unknown (e.g., because
627         the ingress node is outside the scope of control of the
628         server)";
629     }
630   }
631
632   grouping protection-restoration-params_config {
633     description "Protection and restoration parameters";
634     container protection {
635       description "Protection parameters";
636       leaf enable {
637         type boolean;
638         default 'false';
639         description
640           "A flag to specify if LSP protection is enabled";
641         reference "rfc4427";
642       }
643       leaf protection-type {
644         type identityref {
645           base te-types:lsp-protection-type;
646         }
647         description "LSP protection type.";
648       }
649       leaf protection-reversion-disable {
650         type boolean;
651         description "Disable protection reversion to working path";
652       }
653       leaf hold-off-time {
654         type uint32;
655         units "milli-seconds";
656         default 0;
657         description
658           "The time between the declaration of an SF or SD condition
659            and the initialization of the protection switching
660            algorithm.";
661       }
662       leaf wait-to-revert {
663         type uint16;
664         units seconds;
665         description
666          "Time to wait before attempting LSP reversion";
667       }
668       leaf aps-signal-id {
669         type uint8 {
670           range "1..255";
671         }
672         description
673           "The APS signal number used to reference the traffic of this
674            tunnel. The default value for normal traffic is 1.
675            The default value for extra-traffic is 255. If not specified,
676            non-default values can be assigned by the server,
677            if and only if, the server controls both endpoints.";
678         reference
679           "ITU-T G.808.1";
680       }
681     }
682     container restoration {
683       description "Restoration parameters";
684       leaf enable {
685         type boolean;
686         default 'false';
687         description
688           "A flag to specify if LSP restoration is enabled";
689         reference "rfc4427";
690       }
691       leaf restoration-type {
692         type identityref {
693           base te-types:lsp-restoration-type;
694         }
695         description "LSP restoration type.";
696       }
697       leaf restoration-scheme {
698         type identityref {
699           base te-types:restoration-scheme-type;
700         }
701         description "LSP restoration scheme.";
702       }
703       leaf restoration-reversion-disable {
704         type boolean;
705         description "Disable restoration reversion to working path";
706       }
707       leaf hold-off-time {
708         type uint32;
709         units "milli-seconds";
710         description
711           "The time between the declaration of an SF or SD condition
712            and the initialization of the protection switching
713            algorithm.";
714       }
715       leaf wait-to-restore {
716         type uint16;
717         units seconds;
718         description
719          "Time to wait before attempting LSP restoration";
720       }
721       leaf wait-to-revert {
722         type uint16;
723         units seconds;
724         description
725          "Time to wait before attempting LSP reversion";
726       }
727     }
728   }
729
730   grouping p2p-dependency-tunnels_config {
731     description
732       "Groupong for tunnel dependency list of tunnels";
733     container dependency-tunnels {
734       description "Dependency tunnels list";
735       list dependency-tunnel {
736         key "name";
737         description "Dependency tunnel entry";
738         leaf name {
739           type leafref {
740             path "../../../../../tunnels/tunnel/name";
741             require-instance false;
742           }
743           description "Dependency tunnel name";
744         }
745         leaf encoding {
746           type identityref {
747             base te-types:lsp-encoding-types;
748           }
749           description "LSP encoding type";
750           reference "RFC3945";
751         }
752         leaf switching-type {
753           type identityref {
754             base te-types:switching-capabilities;
755           }
756           description "LSP switching type";
757           reference "RFC3945";
758         }
759       }
760     }
761   }
762
763   grouping tunnel-p2p-params_config {
764     description
765       "Configuration parameters relating to TE tunnel";
766     leaf name {
767       type string;
768       description "TE tunnel name.";
769     }
770     leaf identifier {
771       type uint16;
772       description
773         "TE tunnel Identifier.";
774     }
775     leaf description {
776       type string;
777       description
778         "Textual description for this TE tunnel";
779     }
780     leaf encoding {
781       type identityref {
782         base te-types:lsp-encoding-types;
783       }
784       description "LSP encoding type";
785       reference "RFC3945";
786     }
787     leaf switching-type {
788       type identityref {
789         base te-types:switching-capabilities;
790       }
791       description "LSP switching type";
792       reference "RFC3945";
793     }
794     leaf provisioning-state {
795       type identityref {
796         base te-types:tunnel-state-type;
797       }
798       default te-types:tunnel-state-up;
799       description "TE tunnel administrative state.";
800     }
801     leaf preference {
802       type uint8 {
803         range "1..255";
804       }
805       description
806         "Specifies a preference for this tunnel.
807         A lower number signifies a better preference";
808     }
809     leaf reoptimize-timer {
810       type uint16;
811       units seconds;
812       description
813        "frequency of reoptimization of
814         a traffic engineered LSP";
815     }
816     leaf source {
817       type inet:ip-address;
818       description
819         "TE tunnel source address.";
820     }
821     leaf destination {
822       type inet:ip-address;
823       description
824         "P2P tunnel destination address";
825     }
826     leaf src-tp-id {
827       type binary;
828       description
829         "TE tunnel source termination point identifier.";
830     }
831     leaf dst-tp-id {
832       type binary;
833       description
834         "TE tunnel destination termination point identifier.";
835     }
836     uses protection-restoration-params_config;
837     uses te-types:tunnel-constraints_config;
838     uses p2p-dependency-tunnels_config;
839   }
840
841   grouping tunnel-p2p-params_state {
842     description
843       "State parameters relating to TE tunnel";
844     leaf operational-state {
845       type identityref {
846         base te-types:tunnel-state-type;
847       }
848       default te-types:tunnel-state-up;
849       description "TE tunnel administrative state.";
850     }
851   }
852
853   grouping access-segment-info {
854     description
855       "info related to a segment";
856     container forward {
857       description
858         "for the forward direction of this tunnel";
859       uses te-types:label-set-info;
860     }
861     container reverse {
862       description
863         "for the reverse direction of this tunnel";
864         uses te-types:label-set-info;
865     }
866   }
867
868   grouping path-access-segment-info {
869     description
870       "If an end-to-end tunnel crosses multiple domains using
871        the same technology, some additional constraints have to be
872        taken in consideration in each domain";
873     container path-in-segment {
874       presence
875         "The end-to-end tunnel starts in a previous domain;
876          this tunnel is a segment in the current domain.";
877       description
878         "This tunnel is a segment that needs to be coordinated
879          with previous segment stitched on head-end side.";
880       uses access-segment-info;
881     }
882     container path-out-segment {
883       presence
884         "The end-to-end tunnel is not terminated in this domain;
885          this tunnel is a segment in the current domain.";
886       description
887         "This tunnel is a segment that needs to be coordinated
888          with previous segment stitched on head-end side.";
889       uses access-segment-info;
890     }
891   }
892
893   /* TE tunnel configuration/state grouping */
894   grouping tunnel-p2mp-properties {
895     description
896       "Top level grouping for P2MP tunnel properties.";
897     uses tunnel-p2mp-params_config;
898     container state {
899       config false;
900       description
901         "Configuration applied parameters and state";
902       leaf operational-state {
903         type identityref {
904           base te-types:tunnel-state-type;
905         }
906         default te-types:tunnel-state-up;
907         description "TE tunnel administrative state.";
908       }
909     }
910   }
911
912   grouping p2p-path-candidate-secondary-path-config {
913     description
914       "Configuration parameters relating to a secondary path which
915       is a candidate for a particular primary path";
916
917     leaf secondary-path {
918       type leafref {
919         path "../../../../../p2p-secondary-paths/" +
920              "p2p-secondary-path/name";
921       }
922       description
923         "A reference to the secondary path that should be utilised
924         when the containing primary path option is in use";
925     }
926
927     leaf path-setup-protocol {
928       type identityref {
929         base te-types:path-signaling-type;
930       }
931       description
932         "Signaling protocol used to set up this tunnel";
933     }
934   }
935
936   grouping p2p-reverse-path-candidate-secondary-path-config {
937     description
938       "Configuration parameters relating to a secondary path which
939       is a candidate for a particular primary path";
940
941     leaf secondary-path {
942       type leafref {
943         path "../../../../../p2p-secondary-paths/" +
944              "p2p-secondary-path/name";
945       }
946       description
947         "A reference to the secondary path that should be utilised
948         when the containing primary path option is in use";
949     }
950
951     leaf path-setup-protocol {
952       type identityref {
953         base te-types:path-signaling-type;
954       }
955       description
956         "Signaling protocol used to set up this tunnel";
957     }
958   }
959
960   grouping p2p-path-candidate-secondary-path-state {
961     description
962       "Operational state parameters relating to a secondary path
963       which is a candidate for a particular primary path";
964
965     leaf active {
966       type boolean;
967       description
968         "Indicates the current active path option that has
969         been selected of the candidate secondary paths";
970     }
971   }
972
973   grouping tunnel-p2p-properties {
974     description
975       "Top level grouping for tunnel properties.";
976     uses tunnel-p2p-params_config;
977     container state {
978       config false;
979       description
980         "Configuration applied parameters and state";
981       uses tunnel-p2p-params_state;
982     }
983     uses bidir-assoc-properties;
984     container p2p-primary-paths {
985       description "Set of P2P primary aths container";
986       list p2p-primary-path {
987         key "name";
988         description
989           "List of primary paths for this tunnel.";
990         uses p2p-primary-path-properties;
991         uses p2p-reverse-primary-path-properties;
992         container candidate-p2p-secondary-paths {
993           description
994             "The set of candidate secondary paths which may be used
995             for this primary path. When secondary paths are specified
996             in the list the path of the secondary LSP in use must be
997             restricted to those path options referenced. The
998             priority of the secondary paths is specified within the
999             list. Higher priority values are less preferred - that is
1000             to say that a path with priority 0 is the most preferred
1001             path. In the case that the list is empty, any secondary
1002             path option may be utilised when the current primary path
1003             is in use.";
1004           list candidate-p2p-secondary-path {
1005             key "secondary-path";
1006             description
1007               "List of secondary paths for this tunnel.";
1008             uses p2p-path-candidate-secondary-path-config;
1009
1010             container state {
1011               config false;
1012               description
1013                 "Configuration applied parameters and state";
1014               uses p2p-path-candidate-secondary-path-state;
1015             }
1016           }
1017         }
1018       }
1019     }
1020     container p2p-secondary-paths {
1021       description "Set of P2P secondary paths container";
1022       list p2p-secondary-path {
1023         key "name";
1024         description
1025           "List of secondary paths for this tunnel.";
1026         uses p2p-secondary-path-properties;
1027       }
1028     }
1029   }
1030
1031   grouping shared-resources-tunnels_state {
1032     description
1033       "The specific tunnel that is using the shared secondary path
1034        resources";
1035     leaf lsp-shared-resources-tunnel {
1036       type te:tunnel-ref;
1037       description
1038         "Reference to the tunnel that sharing secondary path
1039         resources with this tunnel";
1040     }
1041   }
1042   grouping shared-resources-tunnels {
1043     description
1044       "Set of tunnels that share secondary path resources with
1045       this tunnnel";
1046     container shared-resources-tunnels {
1047       description
1048         "Set of tunnels that share secondary path resources with
1049         this tunnnel";
1050       leaf-list lsp-shared-resources-tunnel {
1051         type te:tunnel-ref;
1052         description
1053           "Reference to the tunnel that sharing secondary path
1054           resources with this tunnel";
1055       }
1056     }
1057   }
1058
1059   grouping tunnel-actions {
1060     description "Tunnel actions";
1061     /***TODO: FIXME: Hesam: actions are not supported by yangtools yet
1062     action tunnel-action {
1063       description "Tunnel action";
1064       input {
1065         leaf action-type {
1066           type identityref {
1067             base te-types:tunnel-action-type;
1068           }
1069           description "Tunnel action type";
1070         }
1071       }
1072       output {
1073         leaf action-result {
1074           type identityref {
1075             base te-types:te-action-result;
1076           }
1077           description "The result of the RPC operation";
1078         }
1079       }
1080     }
1081    ****TODO: FIXME****/
1082   }
1083   grouping tunnel-protection-actions {
1084     description
1085       "Protection external command actions";
1086     /***TODO: FIXME: Hesam: actions are not supported by yangtools yet
1087     action protection-external-commands {
1088       input {
1089         leaf protection-external-command {
1090           type identityref {
1091             base te-types:protection-external-commands;
1092           }
1093           description
1094             "Protection external command";
1095         }
1096         leaf protection-group-ingress-node-id {
1097           type te-types:te-node-id;
1098           description
1099             "Indicates the te-node-id of the protection group
1100              ingress node when the extenal command has to be
1101              applied to it. If the external command is not applied
1102              to the ingress node, this attribute is not specified.";
1103         }
1104         leaf protection-group-egress-node-id {
1105           type te-types:te-node-id;
1106           description
1107             "Indicates the te-node-id of the protection group egress
1108              node when the extenal command has to be applied to it.
1109              If the external command is not applied to the egress node,
1110              This attribute is not specified.";
1111         }
1112         leaf path-ref {
1113           type path-ref;
1114           description
1115             "Indicates to which path the external command applies to.";
1116         }
1117         leaf traffic-type {
1118           type enumeration {
1119             enum normal-traffic {
1120               description
1121                 "The manual-switch or forced-switch command applies to
1122                  the normal traffic (this Tunnel).";
1123             }
1124             enum null-traffic {
1125               description
1126                 "The manual-switch or forced-switch command applies to
1127                  the null traffic.";
1128             }
1129             enum extra-traffic {
1130               description
1131                 "The manual-switch or forced-switch command applies to
1132                  the extra traffic (the extra-traffic Tunnel sharing
1133                  protection bandwidth with this Tunnel).";
1134             }
1135           }
1136           description
1137             "Indicates whether the manual-switch or forced-switch
1138              commands applies to the normal traffic, the null traffic
1139              or the extra-traffic.";
1140           reference
1141             "ITU-T G.808, RFC 4427";
1142         }
1143         leaf extra-traffic-tunnel-ref {
1144           type te:tunnel-ref;
1145           description
1146             "In case there are multiple extra-traffic tunnels sharing
1147              protection bandwidth with this Tunnel (m:n protection),
1148              represents which extra-traffic Tunnel the manual-switch or
1149              forced-switch to extra-traffic command applies to.";
1150         }
1151       }
1152     }
1153     ****TODO: FIXME****/
1154   }
1155
1156   /*** End of TE tunnel groupings ***/
1157
1158   /**
1159    * LSP related generic groupings
1160    */
1161   grouping lsp-record-route-information_state {
1162     description "recorded route information grouping";
1163     container lsp-record-route-subobjects {
1164       description "RSVP recorded route object information";
1165       list record-route-subobject {
1166         when "../../origin-type = 'ingress'" {
1167           description "Applicable on non-ingress LSPs only";
1168         }
1169         key "index";
1170         description "Record route sub-object list";
1171         uses te-types:record-route-subobject_state;
1172       }
1173     }
1174   }
1175
1176   grouping lsps-state-grouping {
1177     description
1178       "LSPs state operational data grouping";
1179     container lsps-state {
1180       config false;
1181       description "TE LSPs state container";
1182       list lsp {
1183         key
1184           "source destination tunnel-id lsp-id "+
1185           "extended-tunnel-id";
1186         description "List of LSPs associated with the tunnel.";
1187         uses lsp-properties_state;
1188         uses lsp-record-route-information_state;
1189       }
1190     }
1191   }
1192
1193   /*** End of TE LSP groupings ***/
1194
1195   /**
1196    * TE global generic groupings
1197    */
1198
1199   /* Global named admin-groups configuration data */
1200   grouping named-admin-groups_config {
1201     description
1202       "Global named administrative groups configuration
1203       grouping";
1204     leaf name {
1205       type string;
1206       description
1207         "A string name that uniquely identifies a TE
1208         interface named admin-group";
1209     }
1210     leaf bit-position {
1211       type uint32;
1212       description
1213         "Bit position representing the administrative group";
1214     }
1215   }
1216   grouping named-admin-groups {
1217     description
1218       "Global named administrative groups configuration
1219       grouping";
1220     container named-admin-groups {
1221       description "TE named admin groups container";
1222       list named-admin-group {
1223         if-feature te-types:extended-admin-groups;
1224         if-feature te-types:named-extended-admin-groups;
1225         key "name";
1226         description
1227           "List of named TE admin-groups";
1228         uses named-admin-groups_config;
1229       }
1230     }
1231   }
1232
1233   /* Global named admin-srlgs configuration data */
1234   grouping named-srlgs_config {
1235     description
1236       "Global named SRLGs configuration grouping";
1237     leaf name {
1238       type string;
1239       description
1240         "A string name that uniquely identifies a TE
1241         interface named srlg";
1242     }
1243     leaf group {
1244       type te-types:srlg;
1245       description "An SRLG value";
1246     }
1247     leaf cost {
1248       type uint32;
1249       description
1250         "SRLG associated cost. Used during path to append
1251          the path cost when traversing a link with this SRLG";
1252     }
1253   }
1254
1255   grouping named-srlgs {
1256     description
1257       "Global named SRLGs configuration grouping";
1258     container named-srlgs {
1259       description "TE named SRLGs container";
1260       list named-srlg {
1261         if-feature te-types:named-srlg-groups;
1262         key "name";
1263         description
1264           "A list of named SRLG groups";
1265         uses named-srlgs_config;
1266       }
1267     }
1268   }
1269
1270   /* Global named paths constraints configuration data */
1271   grouping path-constraints_state {
1272     description
1273       "TE path constraints state";
1274     leaf bandwidth-generic_state {
1275       type te-types:te-bandwidth;
1276       description
1277         "A technology agnostic requested bandwidth to use
1278          for path computation";
1279     }
1280     leaf disjointness_state {
1281       type te-types:te-path-disjointness;
1282       description
1283         "The type of resource disjointness.";
1284     }
1285   }
1286
1287   grouping path-constraints_config {
1288     description
1289       "Global named path constraints configuration
1290       grouping";
1291     uses te-types:common-constraints_config;
1292     uses te-types:generic-path-disjointness;
1293     uses te-types:generic-path-metric-bounds;
1294     uses path-affinities;
1295     uses path-srlgs;
1296     uses te-types:path-route-objects;
1297     uses shared-resources-tunnels {
1298       description
1299         "Set of tunnels that are allowed to share secondary path
1300          resources of this tunnel";
1301     }
1302     uses path-access-segment-info {
1303       description
1304         "Tunnel constraints induced by other segments.";
1305     }
1306   }
1307
1308   grouping path-constraints {
1309     description "Per path constraints";
1310     uses path-constraints_config;
1311     container state {
1312       config false;
1313       description
1314         "Configuration applied parameters and state";
1315       uses path-constraints_state;
1316     }
1317   }
1318
1319   grouping named-path-constraints {
1320     description
1321       "Global named path constraints configuration
1322       grouping";
1323     container named-path-constraints {
1324       description "TE named path constraints container";
1325       list named-path-constraint {
1326         if-feature te-types:named-path-constraints;
1327         key "name";
1328         leaf name {
1329           type string;
1330           description
1331             "A string name that uniquely identifies a
1332             path constraint set";
1333         }
1334         uses path-constraints;
1335         description
1336           "A list of named path constraints";
1337       }
1338     }
1339   }
1340
1341   /* TE globals container data */
1342   grouping globals-grouping {
1343     description
1344       "Globals TE system-wide configuration data grouping";
1345     container globals {
1346       description
1347         "Globals TE system-wide configuration data container";
1348       uses named-admin-groups;
1349       uses named-srlgs;
1350       uses named-path-constraints;
1351     }
1352   }
1353
1354   /* TE tunnels container data */
1355   grouping tunnels-grouping {
1356     description
1357       "Tunnels TE configuration data grouping";
1358     container tunnels {
1359       description
1360         "Tunnels TE configuration data container";
1361
1362       list tunnel {
1363         key "name";
1364         description "P2P TE tunnels list.";
1365         uses tunnel-p2p-properties;
1366         uses tunnel-actions;
1367         uses tunnel-protection-actions;
1368       }
1369       list tunnel-p2mp {
1370         key "name";
1371         unique "identifier";
1372         description "P2MP TE tunnels list.";
1373         uses tunnel-p2mp-properties;
1374       }
1375     }
1376   }
1377
1378   /* TE LSPs ephemeral state container data */
1379   grouping lsp-properties_state {
1380     description
1381       "LSPs state operational data grouping";
1382     leaf source {
1383       type inet:ip-address;
1384       description
1385         "Tunnel sender address extracted from
1386         SENDER_TEMPLATE  object";
1387       reference "RFC3209";
1388     }
1389     leaf destination {
1390       type inet:ip-address;
1391       description
1392         "Tunnel endpoint address extracted from
1393         SESSION object";
1394       reference "RFC3209";
1395     }
1396     leaf tunnel-id {
1397       type uint16;
1398       description
1399         "Tunnel identifier used in the SESSION
1400         that remains constant over the life
1401         of the tunnel.";
1402       reference "RFC3209";
1403     }
1404     leaf lsp-id {
1405       type uint16;
1406       description
1407         "Identifier used in the SENDER_TEMPLATE
1408         and the FILTER_SPEC that can be changed
1409         to allow a sender to share resources with
1410         itself.";
1411       reference "RFC3209";
1412     }
1413     leaf extended-tunnel-id {
1414       type inet:ip-address;
1415        description
1416         "Extended Tunnel ID of the LSP.";
1417       reference "RFC3209";
1418     }
1419     leaf operational-state {
1420       type identityref {
1421         base te-types:lsp-state-type;
1422       }
1423       description "LSP operational state.";
1424     }
1425     leaf path-setup-protocol {
1426       type identityref {
1427         base te-types:path-signaling-type;
1428       }
1429       description
1430         "Signaling protocol used to set up this tunnel";
1431     }
1432     leaf origin-type {
1433       type enumeration {
1434         enum ingress {
1435           description
1436             "Origin ingress";
1437         }
1438         enum egress {
1439           description
1440             "Origin egress";
1441         }
1442         enum transit {
1443           description
1444             "transit";
1445         }
1446       }
1447       description
1448         "Origin type of LSP relative to the location
1449         of the local switch in the path.";
1450     }
1451
1452     leaf lsp-resource-status {
1453       type enumeration {
1454         enum primary {
1455           description
1456             "A primary LSP is a fully established LSP for
1457              which the resource allocation has been committed
1458              at the data plane";
1459         }
1460         enum secondary {
1461           description
1462             "A secondary LSP is an LSP that has been provisioned
1463              in the control plane only; e.g. resource allocation
1464              has not been committed at the data plane";
1465         }
1466       }
1467       description "LSP resource allocation type";
1468       reference "rfc4872, section 4.2.1";
1469     }
1470
1471     uses protection-restoration-params_state;
1472   }
1473   /*** End of TE global groupings ***/
1474
1475   /**
1476    * TE configurations container
1477    */
1478   container te {
1479     presence "Enable TE feature.";
1480     description
1481        "TE global container.";
1482
1483     /* TE Global Configuration Data */
1484     uses globals-grouping;
1485
1486     /* TE Tunnel Configuration Data */
1487     uses tunnels-grouping;
1488
1489     /* TE LSPs State Data */
1490     uses lsps-state-grouping;
1491
1492   }
1493
1494   /* TE Global RPCs/execution Data */
1495   rpc globals-rpc {
1496     description
1497       "Execution data for TE global.";
1498   }
1499
1500   /* TE interfaces RPCs/execution Data */
1501   rpc interfaces-rpc {
1502     description
1503       "Execution data for TE interfaces.";
1504   }
1505
1506   /* TE Tunnel RPCs/execution Data */
1507   rpc tunnels-rpc {
1508     description "TE tunnels RPC nodes";
1509     input {
1510       container tunnel-info {
1511         description "Tunnel Identification";
1512         choice type {
1513           description "Tunnel information type";
1514           case tunnel-p2p {
1515             leaf p2p-id {
1516               type te:tunnel-ref;
1517               description "P2P TE tunnel";
1518             }
1519           }
1520           case tunnel-p2mp {
1521             leaf p2mp-id {
1522               type te:tunnel-p2mp-ref;
1523               description "P2MP TE tunnel";
1524             }
1525           }
1526         }
1527       }
1528     }
1529     output {
1530       container result {
1531         description
1532           "The container result of the RPC operation";
1533         leaf result {
1534           type enumeration {
1535             enum success {
1536               description "Origin ingress";
1537             }
1538             enum in-progress {
1539               description "Origin egress";
1540             }
1541             enum fail {
1542               description "transit";
1543             }
1544           }
1545           description "The result of the RPC operation";
1546         }
1547       }
1548     }
1549   }
1550
1551   /* TE Global Notification Data */
1552   notification globals-notif {
1553     description
1554       "Notification messages for Global TE.";
1555   }
1556
1557   /* TE Tunnel Notification Data */
1558   notification tunnels-notif {
1559     description
1560       "Notification messages for TE tunnels.";
1561   }
1562 }