Fix ping pong desc generation error
[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 member-vnf-index-ref {
361           description
362             "Optional reference to member-vnf within constituent-vnfds";
363           type leafref {
364             path "../../../constituent-vnfd/member-vnf-index";
365           }
366         }
367       }
368     }
369   }
370
371   grouping nsr-nsd-monitoring-param {
372     list monitoring-param {
373       key "id";
374
375       uses nsd-base:monitoring-param-common;
376
377       list vnfd-monitoring-param {
378         description "A list of VNFD monitoring params";
379         key "vnfd-id-ref vnfd-monitoring-param-ref";
380
381         leaf vnfd-id-ref {
382           description
383             "A reference to a vnfd. This is a
384               leafref to path:
385                   ../../../../nsd:constituent-vnfd
386                   + [nsd:id = current()/../nsd:id-ref]
387                   + /nsd:vnfd-id-ref
388               NOTE: An issue with confd is preventing the
389               use of xpath. Seems to be an issue with leafref
390               to leafref, whose target is in a different module.
391               Once that is resolved this will switched to use
392               leafref";
393
394           type yang:uuid;
395         }
396
397         leaf vnfd-monitoring-param-ref {
398           description "A reference to the VNFD monitoring param";
399           type leafref {
400             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
401               + "[project-vnfd:id = current()/../vnfd-id-ref]"
402               + "/project-vnfd:monitoring-param/project-vnfd:id";
403           }
404         }
405
406         leaf member-vnf-index-ref {
407           description
408             "Optional reference to member-vnf within constituent-vnfds";
409           type leafref {
410             path "../../../constituent-vnfd/member-vnf-index";
411           }
412         }
413       }
414     }
415   }
416
417   grouping nsd-descriptor {
418      uses nsd-base:nsd-descriptor-common;
419
420      uses nsd-vld;
421
422      uses nsd-constituent-vnfd;
423
424      uses nsd-placement-groups;
425
426      uses nsd-vnf-dependency;
427
428      uses nsd-monitoring-param;
429   }
430
431   augment "/rw-project:project" {
432     container nsd-catalog {
433
434       list nsd {
435         key id;
436
437         uses nsd-descriptor;
438       }
439     }
440   }
441 }