Bump versions by x.y.(z+1)
[alto.git] / alto-extensions / simple-pce / api / src / main / yang / alto-spce.yang
1 module alto-spce {
2     yang-version 1;
3     namespace "urn:opendaylight:alto:spce";
4     prefix "alto-spce";
5
6     import ietf-inet-types {prefix inet;}
7     import ietf-yang-types {prefix yang;}
8
9     organization "SNLab.";
10     contact "Jensen Zhang <jingxuan.zhang@gmail.com>,
11              Shawn Lin <x.shawn.lin@gmail.com>";
12
13     revision "2016-07-18" {
14         description "The second revision of alto-spce model. The model is based
15         on PCEP (https://tools.ietf.org/rfc/rfc5440.txt) but with simplifications.
16         And we extend it with end to end rate limiting, and getting the network state.";
17     }
18
19     typedef flow-type {
20         type enumeration {
21             enum L2;
22             enum L3;
23         }
24     }
25
26     typedef error-code-type {
27         type enumeration {
28             enum OK;
29             enum COMPUTING_ROUTE_ERROR;
30             enum SETTING_UP_ROUTE_ERROR;
31             enum SETTING_UP_METER_ERROR;
32             enum UNDEFINED_ERROR;
33             enum REMOVING_ROUTE_ERROR;
34             enum REMOVING_METTER_ERROR;
35             enum MISSING_ROUTE_ERROR;
36             enum UPDATING_RATE_LIMITING_ERROR;
37             enum INVALID_INPUT;
38         }
39     }
40
41     typedef alto-spce-metric {
42         type enumeration {
43             enum bandwidth;
44             enum hopcount;
45         }
46     }
47
48     grouping endpoints-group {
49         container endpoints {
50             leaf src {
51                 type inet:ipv4-address;
52                 mandatory true;
53                 description "Source IP address";
54             }
55             leaf dst {
56                 type inet:ipv4-address;
57                 mandatory true;
58                 description "Destination IP address";
59             }
60         }
61     }
62
63     rpc setup-route {
64         description "Given the endpoints, this service computes a route
65            satisfying the constraints; among those satisfying the constraints, 
66            it computes the one with the best object metrics. If a route is
67            found, the service will setup the route by installing flow rules
68            in FRM. This service does not handle the complexity of re-route.";
69
70         input {
71             uses endpoints-group;
72
73             leaf limited-rate {
74                 description "The metric is kbps.";
75                 type int32;
76             }
77
78             leaf burst-size {
79                 description "The metric is kb. The smaller value means rate limiting is more fine grain";
80                 type int32;
81             }
82
83             leaf flow-layer {
84                 type flow-type;
85             }
86
87             leaf-list objective-metrics {
88                 type alto-spce-metric;
89             }
90
91             list constraint-metric {
92                 leaf metric {
93                     type alto-spce-metric;
94                 }
95                 leaf min {
96                     type uint64;
97                     description "We use min and max to allow more flexible range spec.";
98                 }
99                 leaf max {
100                     type uint64;
101                 }
102             }
103
104
105         }
106
107         output {
108             leaf route {
109                 type string;
110             }
111
112             leaf error-code {
113                 type error-code-type;
114             }
115         }
116     }
117
118     rpc remove-route {
119         input {
120             leaf route {
121                 type string;
122             }
123         }
124
125         output {
126             leaf error-code {
127                 type error-code-type;
128             }
129         }
130     }
131
132     rpc get-route {
133         input {
134             uses endpoints-group;
135         }
136         output {
137             leaf route {
138                 type string;
139             }
140             leaf error-code {
141                 type error-code-type;
142             }
143         }
144     }
145
146     rpc update-rate-limiting {
147         description "Given the route (source IP and destination IP are all included), and the value of the rate limiting,
148             this service will set the meter with the rate limiting value, and update every related
149             flow entries in switches along this route.";
150
151         input {
152             uses endpoints-group;
153
154             leaf limited-rate {
155                 description "The metric is kbps.";
156                 type int32;
157             }
158
159             leaf burst-size {
160                 description "The metric is kb. The smaller value means rate limiting is more fine grain";
161                 type int32;
162             }
163         }
164
165         output {
166             leaf route {
167                 type string;
168             }
169
170             leaf error-code {
171                 type error-code-type;
172             }
173         }
174     }
175
176     rpc remove-rate-limiting {
177         input {
178             uses endpoints-group;
179
180             leaf route {
181                 type string;
182             }
183         }
184
185         output {
186             leaf route {
187                 type string;
188             }
189             leaf error-code {
190                 type error-code-type;
191             }
192
193         }
194     }
195
196 }