e2be49d3eed0724f1f7e0d6ffb01a3cba3938914
[osm/SO.git] / models / plugins / yang / project-nsd.yang
1
2 /*
3  * 
4  *   Copyright 2017 RIFT.IO Inc
5  *
6  *   Licensed under the Apache License, Version 2.0 (the "License");
7  *   you may not use this file except in compliance with the License.
8  *   You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *   Unless required by applicable law or agreed to in writing, software
13  *   distributed under the License is distributed on an "AS IS" BASIS,
14  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *   See the License for the specific language governing permissions and
16  *   limitations under the License.
17  *
18  *
19  */
20
21 module project-nsd
22 {
23   namespace "http://riftio.com/ns/riftware-1.0/project-nsd";
24   prefix "project-nsd";
25
26   import ietf-yang-types {
27     prefix "yang";
28   }
29
30   import mano-types {
31     prefix "manotypes";
32   }
33
34   import project-vnfd {
35     prefix "project-vnfd";
36   }
37
38   import nsd-base {
39     prefix "nsd-base";
40   }
41
42   import rw-project {
43     prefix "rw-project";
44   }
45
46
47   revision 2017-02-28 {
48     description
49       "Initial revision. This YANG file defines
50        the Network Service Descriptor (NSD)
51        under projects";
52     reference
53       "Derived from earlier versions of base YANG files";
54   }
55
56
57   grouping nsd-constituent-vnfd {
58     list constituent-vnfd {
59       description
60           "List of VNFDs that are part of this
61           network service.";
62
63       key "member-vnf-index";
64
65       leaf member-vnf-index {
66         description
67           "Identifier/index for the VNFD. This separate id
68            is required to ensure that multiple VNFs can be
69            part of single NS";
70         type uint64;
71       }
72
73       leaf vnfd-id-ref {
74         description
75           "Identifier for the VNFD.";
76         type leafref {
77           path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
78         }
79       }
80
81       leaf start-by-default {
82         description
83           "VNFD is started as part of the NS instantiation";
84         type boolean;
85         default true;
86       }
87     }
88   }
89
90   grouping nsr-nsd-constituent-vnfd {
91     list constituent-vnfd {
92       description
93           "List of VNFDs that are part of this
94           network service.";
95
96       key "member-vnf-index";
97
98       leaf member-vnf-index {
99         description
100           "Identifier/index for the VNFD. This separate id
101            is required to ensure that multiple VNFs can be
102            part of single NS";
103         type uint64;
104       }
105
106       leaf vnfd-id-ref {
107         description
108           "Identifier for the VNFD.";
109         type leafref {
110           path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
111         }
112       }
113
114       leaf start-by-default {
115         description
116           "VNFD is started as part of the NS instantiation";
117         type boolean;
118         default true;
119       }
120     }
121   }
122
123   grouping nsd-vld {
124     list vld {
125
126       key "id";
127
128       uses nsd-base:nsd-vld-common;
129
130       list vnfd-connection-point-ref {
131         description
132             "A list of references to connection points.";
133         key "member-vnf-index-ref vnfd-connection-point-ref";
134
135         leaf member-vnf-index-ref {
136           description "Reference to member-vnf within constituent-vnfds";
137           // TODO (Philip): RIFT-15639
138           // type leafref {
139           //   path "../../../constituent-vnfd/member-vnf-index";
140           // }
141           type uint64;
142         }
143
144         leaf vnfd-id-ref {
145           description
146               "A reference to a vnfd. This is a
147                leafref to path:
148                    ../../constituent-vnfd
149                    + [id = current()/../id-ref]
150                    + /vnfd-id-ref
151                NOTE: An issue with confd is preventing the
152                use of xpath. Seems to be an issue with leafref
153                to leafref, whose target is in a different module.
154                Once that is resovled this will switched to use
155                leafref";
156           type string;
157         }
158
159         leaf vnfd-connection-point-ref {
160           description "A reference to a connection point name";
161           type leafref {
162             path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
163                  "[project-vnfd:id = current()/../vnfd-id-ref]/" +
164                  "project-vnfd:connection-point/project-vnfd:name";
165           }
166         }
167       }
168     }
169   }
170
171   grouping nsr-nsd-vld {
172     list vld {
173
174       key "id";
175
176       uses nsd-base:nsd-vld-common;
177
178       list vnfd-connection-point-ref {
179         description
180             "A list of references to connection points.";
181         key "member-vnf-index-ref vnfd-connection-point-ref";
182
183         leaf member-vnf-index-ref {
184           description "Reference to member-vnf within constituent-vnfds";
185
186           type leafref {
187             path "../../../constituent-vnfd/member-vnf-index";
188           }
189         }
190
191         leaf vnfd-id-ref {
192           description
193               "A reference to a vnfd. This is a
194                leafref to path:
195                    ../../nsd:constituent-vnfd
196                    + [nsd:id = current()/../nsd:id-ref]
197                    + /nsd:vnfd-id-ref
198                NOTE: An issue with confd is preventing the
199                use of xpath. Seems to be an issue with leafref
200                to leafref, whose target is in a different module.
201                Once that is resovled this will switched to use
202                leafref";
203           type string;
204         }
205
206         leaf vnfd-connection-point-ref {
207           description "A reference to a connection point name";
208           type leafref {
209             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
210                  "[project-vnfd:id = current()/../vnfd-id-ref]/" +
211                  "project-vnfd:connection-point/project-vnfd:name";
212           }
213         }
214       }
215     }
216   }
217
218   grouping nsd-vnf-dependency {
219     list vnf-dependency {
220       description
221           "List of VNF dependencies.";
222       key vnf-source-ref;
223       leaf vnf-source-ref {
224         type leafref {
225           path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
226         }
227       }
228       leaf vnf-depends-on-ref {
229         description
230             "Reference to VNF that sorce VNF depends.";
231         type leafref {
232           path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
233         }
234       }
235     }
236   }
237
238   grouping nsr-nsd-vnf-dependency {
239     list vnf-dependency {
240       description
241           "List of VNF dependencies.";
242       key vnf-source-ref;
243       leaf vnf-source-ref {
244         type leafref {
245           path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
246         }
247       }
248       leaf vnf-depends-on-ref {
249         description
250             "Reference to VNF that sorce VNF depends.";
251         type leafref {
252           path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
253         }
254       }
255     }
256   }
257
258   grouping nsd-placement-groups {
259     list placement-groups {
260       description "List of placement groups at NS level";
261
262       key "name";
263       uses manotypes:placement-group-info;
264
265       list member-vnfd {
266         description
267             "List of VNFDs that are part of this placement group";
268
269         key "member-vnf-index-ref";
270
271         leaf member-vnf-index-ref {
272           description "member VNF index of this member VNF";
273           // TODO (Philip): RIFT-15639
274           // type leafref {
275           //   path "../../../constituent-vnfd/member-vnf-index";
276           // }
277           type uint64;
278         }
279
280         leaf vnfd-id-ref {
281           description
282               "Identifier for the VNFD.";
283           type leafref {
284             path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
285           }
286         }
287       }
288     }
289   }
290
291   grouping nsr-nsd-placement-groups {
292     list placement-groups {
293       description "List of placement groups at NS level";
294
295       key "name";
296       uses manotypes:placement-group-info;
297
298       list member-vnfd {
299         description
300             "List of VNFDs that are part of this placement group";
301
302         key "member-vnf-index-ref";
303
304         leaf member-vnf-index-ref {
305           description "member VNF index of this member VNF";
306           // TODO (Philip): RIFT-15639
307           // type leafref {
308           //   path "../../../constituent-vnfd/member-vnf-index";
309           // }
310           type uint64;
311         }
312
313         leaf vnfd-id-ref {
314           description
315               "Identifier for the VNFD.";
316           type leafref {
317             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
318           }
319         }
320       }
321     }
322   }
323
324   grouping nsd-monitoring-param {
325
326     list monitoring-param {
327       key "id";
328
329       uses nsd-base:monitoring-param-common;
330
331       list vnfd-monitoring-param {
332         description "A list of VNFD monitoring params";
333         key "vnfd-id-ref vnfd-monitoring-param-ref";
334
335         leaf vnfd-id-ref {
336           description
337             "A reference to a vnfd. This is a
338               leafref to path:
339                   ../../../../nsd:constituent-vnfd
340                   + [nsd:id = current()/../nsd:id-ref]
341                   + /nsd:vnfd-id-ref
342               NOTE: An issue with confd is preventing the
343               use of xpath. Seems to be an issue with leafref
344               to leafref, whose target is in a different module.
345               Once that is resolved this will switched to use
346               leafref";
347
348           type yang:uuid;
349         }
350
351         leaf vnfd-monitoring-param-ref {
352           description "A reference to the VNFD monitoring param";
353           type leafref {
354             path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
355               + "[project-vnfd:id = current()/../vnfd-id-ref]"
356               + "/project-vnfd:monitoring-param/project-vnfd:id";
357           }
358         }
359
360         leaf-list member-vnf-index-ref {
361           description
362             "Optional reference to member-vnf within constituent-vnfds";
363           type uint64;
364         }
365       }
366     }
367   }
368
369   grouping nsr-nsd-monitoring-param {
370     list monitoring-param {
371       key "id";
372
373       uses nsd-base:monitoring-param-common;
374
375       list vnfd-monitoring-param {
376         description "A list of VNFD monitoring params";
377         key "vnfd-id-ref vnfd-monitoring-param-ref";
378
379         leaf vnfd-id-ref {
380           description
381             "A reference to a vnfd. This is a
382               leafref to path:
383                   ../../../../nsd:constituent-vnfd
384                   + [nsd:id = current()/../nsd:id-ref]
385                   + /nsd:vnfd-id-ref
386               NOTE: An issue with confd is preventing the
387               use of xpath. Seems to be an issue with leafref
388               to leafref, whose target is in a different module.
389               Once that is resolved this will switched to use
390               leafref";
391
392           type yang:uuid;
393         }
394
395         leaf vnfd-monitoring-param-ref {
396           description "A reference to the VNFD monitoring param";
397           type leafref {
398             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
399               + "[project-vnfd:id = current()/../vnfd-id-ref]"
400               + "/project-vnfd:monitoring-param/project-vnfd:id";
401           }
402         }
403
404         leaf-list member-vnf-index-ref {
405           description
406             "Optional reference to member-vnf within constituent-vnfds";
407           type uint64;
408         }
409       }
410     }
411   }
412
413   grouping nsd-descriptor {
414      uses nsd-base:nsd-descriptor-common;
415
416      uses nsd-vld;
417
418      uses nsd-constituent-vnfd;
419
420      uses nsd-placement-groups;
421
422      uses nsd-vnf-dependency;
423
424      uses nsd-monitoring-param;
425   }
426
427   augment "/rw-project:project" {
428     container nsd-catalog {
429
430       list nsd {
431         key id;
432
433         uses nsd-descriptor;
434       }
435     }
436   }
437 }