Remove superfluous units specification
[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 path-descriptions {
135         description
136             "Computed Path description as a list of IPv4, IPv6 or MPLS Label";
137         list path-description {
138             leaf ipv4 {
139                 when "path-constraints/address-family = 0";
140                 type inet:ipv4-address;
141             }
142             leaf ipv6 {
143                 when "path-constraints/address-family = 1";
144                 type inet:ipv6-address;
145             }
146             leaf label {
147                 when "path-constraints/address-family = 2 or path-constraints/address-family = 3";
148                 type netc:mpls-label;
149             }
150         }
151     }
152
153     container constrained-path {
154         description "Computed Path as result of Path Computation Algorithms";
155         uses path-constraints;
156         leaf source {
157             type uint64;
158         }
159         leaf destination {
160             type uint64;
161         }
162         uses path-descriptions;
163         leaf status {
164             type computation-status;
165         }
166     }
167
168     rpc get-constrained-path {
169         input {
170             leaf graph-name {
171                 type string;
172                 mandatory true;
173             }
174             leaf source {
175                 type uint64;
176             }
177             leaf destination {
178                 type uint64;
179             }
180             container constraints {
181                 uses path-constraints;
182             }
183             leaf algorithm {
184                 type algorithm-type;
185             }
186         }
187         output {
188             uses path-descriptions;
189             leaf status {
190                 type computation-status;
191             }
192             leaf computed-metric {
193                 type uint32;
194             }
195             leaf computed-te-metric {
196                 type uint32;
197             }
198             leaf computed-delay {
199                 type gr:delay;
200             }
201         }
202     }
203 }
204