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