Fix wrong SR-NAI type for Path Computation
[bgpcep.git] / algo / algo-api / src / main / yang / path-computation.yang
1 module path-computation {
2     yang-version 1;
3     namespace "urn:opendaylight:params:xml:ns:yang:path:computation";
4     prefix "algo";
5
6     import network-concepts { prefix netc; revision-date 2013-11-25; }
7     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
8     import graph { prefix gr; revision-date 2019-11-25; }
9
10     organization "Orange";
11     contact "Olivier Dugeon <olivier.dugeon@orange.com>";
12
13     description
14         "This module contains the model of Computed Path
15          used in various Path Computation algorithms.
16
17         Copyright (c)2020 Orange. All rights reserved.
18
19         This program and the accompanying materials are made available
20         under the terms of the Eclipse Public License v1.0 which
21         accompanies this distribution, and is available at
22         http://www.eclipse.org/legal/epl-v10.html";
23
24     revision "2020-01-20" {
25         description
26              "Initial revision.";
27         reference "";
28     }
29
30     typedef computation-status {
31         description
32             "Status of the Path Computation Algorithm regaring current
33              computed path";
34         type enumeration {
35             enum idle {
36                 description "Path Computeation Algorithm has not yet started";
37                 value 0;
38             }
39             enum in-progress {
40                 description
41                     "Path Computation has started but no path has been found";
42                 value 1;
43             }
44             enum active {
45                 description
46                     "A valid path has been found,
47                      but it is perhaps not the best one";
48                 value 2;
49             }
50             enum completed {
51                 description
52                     "Path Computation Algorithm has completed
53                      and a valid computed path found";
54                 value 3;
55             }
56             enum failed {
57                 value 4;
58             }
59         }
60     }
61
62     typedef algorithm-type {
63         description "Various type of Path Computation Algorithms";
64         type enumeration {
65             enum spf {
66                 value 0;
67             }
68             enum cspf {
69                 value 1;
70             }
71             enum samcra {
72                 value 2;
73             }
74         }
75         default "spf";
76     }
77
78     grouping path-constraints {
79         description "Set of Constraints for Path Computation";
80         leaf metric {
81             description "Maximum end to end IGP metric";
82             type uint32;
83         }
84         leaf te-metric {
85             description "Maximum end to end Traffic Engineering metric";
86             type uint32;
87         }
88         leaf delay {
89             description "Maximum end to end delay";
90             type gr:delay;
91         }
92         leaf jitter {
93             description "Maximum delay variation for selected edges";
94             type gr:delay;
95         }
96         leaf loss {
97             description "Maximum loss for selected edges";
98             type gr:loss;
99         }
100         leaf admin-group {
101             description "Admin group to select edges";
102             type uint32;
103         }
104         leaf address-family {
105             description "Address family of the computed path";
106             type enumeration {
107                 enum ipv4 {
108                     value 0;
109                 }
110                 enum ipv6 {
111                     value 1;
112                 }
113                 enum sr-ipv4 {
114                     value 2;
115                 }
116                 enum sr-ipv6 {
117                     value 3;
118                 }
119             }
120             default "ipv4";
121         }
122         leaf class-type {
123             description "Class Type for bandwidth constraints";
124             type uint8 {
125                 range "0..7";
126             }
127         }
128         leaf bandwidth {
129             description "Requested bandwidth for the computed path";
130             type gr:decimal-bandwidth;
131         }
132     }
133
134     grouping sr-description {
135         description "Segment Routing path description";
136         leaf sid {
137             description "Segment Routing Identifier as an Index or MPLS label";
138             when "path-constraints/address-family = 2 or path-constraints/address-family = 3";
139             type uint32;
140         }
141         leaf local-ipv4 {
142             description "Local IPv4 address";
143             when "path-constraints/address-family = 2";
144             type inet:ipv4-address;
145         }
146         leaf remote-ipv4 {
147             description "Remote IPv4 address";
148             when "path-constraints/address-family = 2";
149             type inet:ipv4-address;
150         }
151         leaf local-ipv6 {
152             description "Local IPv4 address";
153             when "path-constraints/address-family = 3";
154             type inet:ipv6-address;
155         }
156         leaf remote-ipv6 {
157             description "Remote IPv4 address";
158             when "path-constraints/address-family = 3";
159             type inet:ipv6-address;
160         }
161     }
162
163     grouping path-descriptions {
164         description
165             "Computed Path description as a list of IPv4, IPv6 or Segment Routing subobject";
166         list path-description {
167             leaf ipv4 {
168                 when "path-constraints/address-family = 0";
169                 type inet:ipv4-address;
170             }
171             leaf ipv6 {
172                 when "path-constraints/address-family = 1";
173                 type inet:ipv6-address;
174             }
175             uses sr-description;
176         }
177     }
178
179     container constrained-path {
180         description "Computed Path as result of Path Computation Algorithms";
181         uses path-constraints;
182         leaf source {
183             type uint64;
184         }
185         leaf destination {
186             type uint64;
187         }
188         uses path-descriptions;
189         leaf status {
190             type computation-status;
191         }
192     }
193
194     rpc get-constrained-path {
195         input {
196             leaf graph-name {
197                 type string;
198                 mandatory true;
199             }
200             leaf source {
201                 type uint64;
202             }
203             leaf destination {
204                 type uint64;
205             }
206             container constraints {
207                 uses path-constraints;
208             }
209             leaf algorithm {
210                 type algorithm-type;
211             }
212         }
213         output {
214             uses path-descriptions;
215             leaf status {
216                 type computation-status;
217             }
218             leaf computed-metric {
219                 type uint32;
220             }
221             leaf computed-te-metric {
222                 type uint32;
223             }
224             leaf computed-delay {
225                 type gr:delay;
226             }
227         }
228     }
229 }
230