de56e554b714c1e7bb5a159158277b8ea4636a7e
[osm/SO.git] / rwlaunchpad / plugins / yang / rw-pkg-mgmt.yang
1 /*
2  *
3  *   Copyright 2016 RIFT.IO Inc
4  *
5  *   Licensed under the Apache License, Version 2.0 (the "License");
6  *   you may not use this file except in compliance with the License.
7  *   You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *   Unless required by applicable law or agreed to in writing, software
12  *   distributed under the License is distributed on an "AS IS" BASIS,
13  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *   See the License for the specific language governing permissions and
15  *   limitations under the License.
16  *
17  *
18  */
19
20 /**
21  * @file rw-pkg-mgmt.yang
22  * @author Varun Prasad
23  * @date 2016/09/21
24  * @brief Pacakage Management Yang
25  */
26
27 module rw-pkg-mgmt
28 {
29   namespace "http://riftio.com/ns/riftware-1.0/rw-pkg-mgmt";
30   prefix "rw-pkg-mgmt";
31
32   import ietf-yang-types {
33     prefix "yang";
34   }
35
36   import rw-pb-ext {
37     prefix "rwpb";
38   }
39
40   import rw-cli-ext {
41     prefix "rwcli";
42   }
43
44   import rw-cloud {
45     prefix "rwcloud";
46   }
47
48   import rwcal {
49     prefix "rwcal";
50   }
51
52   import mano-types {
53     prefix "manotypes";
54   }
55
56   import rw-vnfd {
57     prefix "rwvnfd";
58   }
59   import rw-nsd {
60     prefix "rwnsd";
61   }
62
63   revision 2016-06-01 {
64     description
65       "Initial revision.";
66   }
67
68   typedef task-status {
69     type enumeration {
70       enum QUEUED;
71       enum IN_PROGRESS;
72       enum DOWNLOADING;
73       enum CANCELLED;
74       enum COMPLETED;
75       enum FAILED;
76     }
77   }
78
79   typedef export-schema {
80     type enumeration {
81       enum RIFT;
82       enum MANO;
83     }
84   }
85
86   typedef export-grammar {
87     type enumeration {
88       enum OSM;
89       enum TOSCA;
90     }
91   }
92
93   typedef export-format {
94     type enumeration {
95       enum YAML;
96       enum JSON;
97     }
98   }
99
100   grouping external-url-data {
101     leaf external-url {
102       description "Url to download";
103       type string;
104     }
105
106     leaf username {
107       description "username if the url uses authentication";
108       type string;
109     }
110
111     leaf password {
112       description "password if the url uses authentication";
113       type string;
114     }
115   }
116
117   grouping package-identifer {
118     leaf package-type {
119       description "Type of the package";
120       type manotypes:package-type;
121     }
122
123     leaf package-id {
124       description "Id of the package";
125       type string;
126     }
127   }
128
129   grouping package-file-identifer {
130     uses package-identifer;
131
132     leaf package-path {
133       description "Relative path in the package";
134       type string;
135     }
136   }
137
138   grouping download-task-status {
139     leaf status {
140       description "The status of the download task";
141       type task-status;
142       default QUEUED;
143     }
144
145     leaf detail {
146       description "Detailed download status message";
147       type string;
148     }
149
150     leaf progress-percent {
151       description "The download progress percentage (0-100)";
152       type uint8;
153       default 0;
154     }
155
156     leaf bytes_downloaded {
157       description "The number of bytes downloaded";
158       type uint64;
159       default 0;
160     }
161
162     leaf bytes_total {
163       description "The total number of bytes to write";
164       type uint64;
165       default 0;
166     }
167
168     leaf bytes_per_second {
169       description "The total number of bytes written per second";
170       type uint32;
171       default 0;
172     }
173
174     leaf start-time {
175       description "start time (unix epoch)";
176       type uint32;
177     }
178
179     leaf stop-time {
180       description "stop time (unix epoch)";
181       type uint32;
182     }
183   }
184
185   container download-jobs {
186     rwpb:msg-new DownloadJobs;
187     description "Download jobs";
188     config false;
189
190     list job {
191       rwpb:msg-new DownloadJob;
192       key "download-id";
193
194       leaf download-id {
195         description "Unique UUID";
196         type string;
197       }
198
199       leaf url {
200         description "URL of the download";
201         type string;
202       }
203
204       uses package-file-identifer;
205       uses download-task-status;
206     }
207   }
208
209   rpc get-package-endpoint {
210     description "Retrieves the endpoint for the descriptor";
211
212     input {
213       uses package-identifer;
214     }
215
216     output {
217      leaf endpoint {
218         description "Endpoint that contains all the package-related data";
219         type string;
220       }
221     }
222   }
223
224   rpc get-package-schema {
225     description "Retrieves the schema for the package type";
226
227     input {
228       leaf package-type {
229         description "Type of the package";
230         type manotypes:package-type;
231       }
232     }
233
234     output {
235       leaf-list schema {
236         description "List of all top level directories for the package.";
237         type string;
238       }
239     }
240   }
241
242   rpc package-create {
243     description "Creates a new package";
244
245     input {
246       uses package-identifer;
247       uses external-url-data;
248     }
249
250     output {
251      leaf transaction-id {
252         description "Valid ID to track the status of the task";
253         type string;
254       }
255     }
256   }
257
258   rpc package-update {
259     description "Creates a new package";
260
261     input {
262       uses package-identifer;
263       uses external-url-data;
264     }
265
266     output {
267      leaf transaction-id {
268         description "Valid ID to track the status of the task";
269         type string;
270       }
271     }
272   }
273
274   rpc package-export {
275     description "Export a package";
276
277     input {
278       uses package-identifer;
279
280       leaf export-schema {
281         description "Schema to export";
282         type export-schema;
283         default RIFT;
284       }
285
286       leaf export-grammar {
287         description "Schema to export";
288         type export-grammar;
289         default OSM;
290       }
291
292       leaf export-format {
293         description "Format to export";
294         type export-format;
295         default YAML;
296       }
297
298     }
299
300     output {
301      leaf transaction-id {
302         description "Valid ID to track the status of the task";
303         type string;
304       }
305
306      leaf filename {
307         description "Valid ID to track the status of the task";
308         type string;
309       }
310     }
311   }
312
313   rpc package-file-add {
314     description "Retrieves the file from the URL and store it in the package";
315
316     input {
317       uses package-file-identifer;
318       uses external-url-data;
319     }
320
321     output {
322      leaf task-id {
323         description "Valid ID to track the status of the task";
324         type string;
325       }
326     }
327   }
328
329   rpc package-file-delete {
330     description "Retrieves the file from the URL and store it in the package";
331
332     input {
333       uses package-file-identifer;
334     }
335
336     output {
337      leaf status {
338         description "Status of the delte operation";
339         type string;
340       }
341
342       leaf error-trace {
343         description "Trace in case of a failure";
344         type string;
345       }
346
347     }
348   }
349
350 }