Graph: add Multi-Topology support
[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 ietf-inet-types { prefix inet; revision-date 2013-07-15; }
7     import graph { prefix gr; revision-date 2022-07-20; }
8
9     organization "Orange";
10     contact "Olivier Dugeon <olivier.dugeon@orange.com>";
11
12     description
13         "This module contains the model of Computed Path
14          used in various Path Computation algorithms.
15
16         Copyright (c)2020 Orange. All rights reserved.
17
18         This program and the accompanying materials are made available
19         under the terms of the Eclipse Public License v1.0 which
20         accompanies this distribution, and is available at
21         http://www.eclipse.org/legal/epl-v10.html";
22
23     revision "2022-03-24" {
24         description
25              "add Exclude Route and Include Route to constraints";
26         reference "";
27     }
28
29     revision "2022-03-10" {
30         description
31              "add new computation status for failures and a type for address-family";
32         reference "";
33     }
34
35     revision "2020-01-20" {
36         description
37              "Initial revision.";
38         reference "";
39     }
40
41     typedef computation-status {
42         description
43             "Status of the Path Computation Algorithm regarding current
44              computed path";
45         type enumeration {
46             enum idle {
47                 description "Path Computeation Algorithm has not yet started";
48                 value 0;
49             }
50             enum in-progress {
51                 description
52                     "Path Computation has started but no path has been found";
53                 value 1;
54             }
55             enum active {
56                 description
57                     "A valid path has been found,
58                      but it is perhaps not the best one";
59                 value 2;
60             }
61             enum completed {
62                 description
63                     "Path Computation Algorithm has completed
64                      and a valid computed path found";
65                 value 3;
66             }
67             enum failed {
68                 description "Path Computation Algorithm failed during path computation";
69                 value 4;
70             }
71             enum no-path {
72                 description
73                     "Path Computation Algorithm has not been found a valid path
74                      that meets the given constraints";
75                 value 5;
76             }
77             enum no-source {
78                 description
79                     "The given source of the path has not been found
80                     in the network topology";
81                 value 6;
82             }
83             enum no-destination {
84                 description
85                     "The given destination of the path has not been found
86                     in the network topology";
87                 value 7;
88             }
89             enum equal-endpoints {
90                 description "The given source and destination are equals";
91                 value 8;
92             }
93         }
94     }
95
96     typedef algorithm-type {
97         description "Various type of Path Computation Algorithms";
98         type enumeration {
99             enum spf {
100                 value 0;
101             }
102             enum cspf {
103                 value 1;
104             }
105             enum samcra {
106                 value 2;
107             }
108         }
109         default "spf";
110     }
111
112     typedef address-family {
113         description "Address family of the computed path";
114         type enumeration {
115             enum ipv4 {
116                 value 0;
117             }
118             enum ipv6 {
119                 value 1;
120             }
121             enum sr-ipv4 {
122                 value 2;
123             }
124             enum sr-ipv6 {
125                 value 3;
126             }
127         }
128         default "ipv4";
129     }
130
131     grouping path-constraints {
132         description "Set of Constraints for Path Computation";
133         leaf metric {
134             description "Maximum end to end IGP metric";
135             type uint32;
136         }
137         leaf te-metric {
138             description "Maximum end to end Traffic Engineering metric";
139             type uint32;
140         }
141         leaf delay {
142             description "Maximum end to end delay";
143             type gr:delay;
144         }
145         leaf jitter {
146             description "Maximum delay variation for selected edges";
147             type gr:delay;
148         }
149         leaf loss {
150             description "Maximum loss for selected edges";
151             type gr:loss;
152         }
153         leaf admin-group {
154             description "Admin group to select edges";
155             type uint32;
156         }
157         leaf address-family {
158             type address-family;
159         }
160         leaf class-type {
161             description "Class Type for bandwidth constraints";
162             type uint8 {
163                 range "0..7";
164             }
165         }
166         leaf bandwidth {
167             description "Requested bandwidth for the computed path";
168             type gr:decimal-bandwidth;
169         }
170         list include-route {
171             description "Speficy routes which must be included in the computed path, i.e. IRO";
172             leaf ipv4 {
173                 when "../../address-family = 0 or ../../address-family = 2";
174                 type inet:ipv4-address;
175             }
176             leaf ipv6 {
177                 when "../../address-family = 1 or ../../address-family = 3";
178                 type inet:ipv6-address;
179             }
180         }
181         list exclude-route {
182             description "Speficy routes which must be excluded in the computed path, i.e. XRO";
183             leaf ipv4 {
184                 when "../../address-family = 0 or ../../address-family = 2";
185                 type inet:ipv4-address;
186             }
187             leaf ipv6 {
188                 when "../../address-family = 1 or ../../address-family = 3";
189                 type inet:ipv6-address;
190             }
191         }
192     }
193
194     grouping path-descriptions {
195         description
196             "Computed Path description as a list of IPv4, IPv6 or Segment Routing subobject";
197         list path-description {
198             leaf ipv4 {
199                 when "path-constraints/address-family = 0 or path-constraints/address-family = 2";
200                 type inet:ipv4-address;
201             }
202             leaf ipv6 {
203                 when "path-constraints/address-family = 1 or path-constraints/address-family = 3";
204                 type inet:ipv6-address;
205             }
206             leaf remote-ipv4 {
207                 description "Remote IPv4 address";
208                 when "path-constraints/address-family = 2";
209                 type inet:ipv4-address;
210             }
211             leaf remote-ipv6 {
212                 description "Remote IPv6 address";
213                 when "path-constraints/address-family = 3";
214                 type inet:ipv6-address;
215             }
216             leaf sid {
217                 description "Segment Routing Identifier as an Index or MPLS label";
218                 when "path-constraints/address-family = 2 or path-constraints/address-family = 3";
219                 type uint32;
220             }
221         }
222     }
223
224     container constrained-path {
225         description "Computed Path as result of Path Computation Algorithms";
226         uses path-constraints;
227         leaf source {
228             type uint64;
229         }
230         leaf destination {
231             type uint64;
232         }
233         uses path-descriptions;
234         leaf status {
235             type computation-status;
236         }
237     }
238
239     rpc get-constrained-path {
240         input {
241             leaf graph-name {
242                 type string;
243                 mandatory true;
244             }
245             leaf source {
246                 type uint64;
247             }
248             leaf destination {
249                 type uint64;
250             }
251             container constraints {
252                 uses path-constraints;
253             }
254             leaf algorithm {
255                 type algorithm-type;
256             }
257         }
258         output {
259             uses path-descriptions;
260             leaf status {
261                 type computation-status;
262             }
263             leaf computed-metric {
264                 type uint32;
265             }
266             leaf computed-te-metric {
267                 type uint32;
268             }
269             leaf computed-delay {
270                 type gr:delay;
271             }
272         }
273     }
274 }
275