Merge "Feature 5649: allow alternative images for specific VIMs in VNFD"
[osm/IM.git] / models / 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 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 rw-project {
39     prefix "rw-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 uint64;
67       }
68
69       leaf vnfd-id-ref {
70         description
71           "Identifier for the VNFD.";
72         type leafref {
73           path "/rw-project:project[rw-project:name = current()/../../../../rw-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 uint64;
101       }
102
103       leaf vnfd-id-ref {
104         description
105           "Identifier for the VNFD.";
106         type leafref {
107           path "/rw-project:project[rw-project:name = current()/../../../../../rw-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-service-primitive {
417    list service-primitive {
418       description
419           "Network service level service primitives.";
420
421       key "name";
422
423       leaf name {
424         description
425             "Name of the service primitive.";
426         type string;
427       }
428
429       list parameter {
430         description
431             "List of parameters for the service primitive.";
432
433         key "name";
434         uses manotypes:primitive-parameter;
435       }
436
437       uses manotypes:ui-primitive-group;
438
439       list vnf-primitive-group {
440         description
441             "List of service primitives grouped by VNF.";
442
443         key "member-vnf-index-ref";
444         leaf member-vnf-index-ref {
445           description
446               "Reference to member-vnf within constituent-vnfds";
447           type leafref {
448              path "../../../constituent-vnfd/member-vnf-index";
449           }
450         }
451
452         leaf vnfd-id-ref {
453           description
454               "A reference to a vnfd. This is a leafref";
455
456           type leafref {
457              path "../../../constituent-vnfd" +
458                 "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
459           }
460         }
461
462         leaf vnfd-name {
463           description
464               "Name of the VNFD";
465           type leafref {
466               path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
467                     + "[project-vnfd:id = current()/../vnfd-id-ref]"
468                     + "/project-vnfd:name";
469           }
470         }
471
472         list primitive {
473           key "index";
474
475           leaf index {
476             description "Index of this primitive";
477             type uint32;
478           }
479
480           leaf name {
481             description "Name of the primitive in the VNF primitive ";
482             type string;
483           }
484         }
485       }
486
487       leaf user-defined-script {
488         description
489             "A user defined script.";
490         type string;
491       }
492     }
493   }
494
495   grouping nsr-nsd-service-primitive {
496    list service-primitive {
497       description
498           "Network service level service primitives.";
499
500       key "name";
501
502       leaf name {
503         description
504             "Name of the service primitive.";
505         type string;
506       }
507
508       list parameter {
509         description
510             "List of parameters for the service primitive.";
511
512         key "name";
513         uses manotypes:primitive-parameter;
514       }
515
516       uses manotypes:ui-primitive-group;
517
518       list vnf-primitive-group {
519         description
520             "List of service primitives grouped by VNF.";
521
522         key "member-vnf-index-ref";
523         leaf member-vnf-index-ref {
524           description
525               "Reference to member-vnf within constituent-vnfds";
526           type leafref {
527              path "../../../constituent-vnfd/member-vnf-index";
528           }
529         }
530
531         leaf vnfd-id-ref {
532           description
533               "A reference to a vnfd. This is a leafref";
534
535           type leafref {
536              path "../../../constituent-vnfd" +
537                 "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
538           }
539         }
540
541         leaf vnfd-name {
542           description
543               "Name of the VNFD";
544           type leafref {
545               path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
546                     + "[project-vnfd:id = current()/../vnfd-id-ref]"
547                     + "/project-vnfd:name";
548           }
549         }
550
551         list primitive {
552           key "index";
553
554           leaf index {
555             description "Index of this primitive";
556             type uint32;
557           }
558
559           leaf name {
560             description "Name of the primitive in the VNF primitive ";
561             type string;
562           }
563         }
564       }
565
566       leaf user-defined-script {
567         description
568             "A user defined script.";
569         type string;
570       }
571     }
572   }
573
574   grouping nsd-descriptor {
575      uses nsd-base:nsd-descriptor-common;
576
577      uses nsd-vld;
578
579      uses nsd-constituent-vnfd;
580
581      uses nsd-placement-groups;
582
583      uses nsd-vnf-dependency;
584
585      uses nsd-monitoring-param;
586
587      uses nsd-service-primitive;
588   }
589
590   augment "/rw-project:project" {
591     container nsd-catalog {
592
593       list nsd {
594         key id;
595
596         uses nsd-descriptor;
597       }
598     }
599   }
600 }