33d8241f3465a792d125174622e16ac25bed2864
[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 "/rw-project:project[rw-project:name = current()/../../../../rw-project:name]" +
78             "/project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
79         }
80       }
81
82       leaf start-by-default {
83         description
84           "VNFD is started as part of the NS instantiation";
85         type boolean;
86         default true;
87       }
88     }
89   }
90
91   grouping nsr-nsd-constituent-vnfd {
92     list constituent-vnfd {
93       description
94           "List of VNFDs that are part of this
95           network service.";
96
97       key "member-vnf-index";
98
99       leaf member-vnf-index {
100         description
101           "Identifier/index for the VNFD. This separate id
102            is required to ensure that multiple VNFs can be
103            part of single NS";
104         type uint64;
105       }
106
107       leaf vnfd-id-ref {
108         description
109           "Identifier for the VNFD.";
110         type leafref {
111           path "/rw-project:project[rw-project:name = current()/../../../../../rw-project:name]" +
112             "/project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
113         }
114       }
115
116       leaf start-by-default {
117         description
118           "VNFD is started as part of the NS instantiation";
119         type boolean;
120         default true;
121       }
122     }
123   }
124
125   grouping nsd-vld {
126     list vld {
127
128       key "id";
129
130       uses nsd-base:nsd-vld-common;
131
132       list vnfd-connection-point-ref {
133         description
134             "A list of references to connection points.";
135         key "member-vnf-index-ref vnfd-connection-point-ref";
136
137         leaf member-vnf-index-ref {
138           description "Reference to member-vnf within constituent-vnfds";
139           type leafref {
140             path "../../../constituent-vnfd/member-vnf-index";
141           }
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 resolved this will switched to use
155                leafref";
156           //type string;
157           type leafref {
158             path "../../../constituent-vnfd[member-vnf-index = current()/../member-vnf-index-ref]/vnfd-id-ref";
159           }
160         }
161
162         leaf vnfd-connection-point-ref {
163           description "A reference to a connection point name";
164           type leafref {
165             path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
166                  "[project-vnfd:id = current()/../vnfd-id-ref]/" +
167                  "project-vnfd:connection-point/project-vnfd:name";
168           }
169         }
170       }
171     }
172   }
173
174   grouping nsr-nsd-vld {
175     list vld {
176
177       key "id";
178
179       uses nsd-base:nsd-vld-common;
180
181       list vnfd-connection-point-ref {
182         description
183             "A list of references to connection points.";
184         key "member-vnf-index-ref vnfd-connection-point-ref";
185
186         leaf member-vnf-index-ref {
187           description "Reference to member-vnf within constituent-vnfds";
188
189           type leafref {
190             path "../../../constituent-vnfd/member-vnf-index";
191           }
192         }
193
194         leaf vnfd-id-ref {
195           description
196               "A reference to a vnfd. This is a
197                leafref to path:
198                    ../../nsd:constituent-vnfd
199                    + [nsd:id = current()/../nsd:id-ref]
200                    + /nsd:vnfd-id-ref
201                NOTE: An issue with confd is preventing the
202                use of xpath. Seems to be an issue with leafref
203                to leafref, whose target is in a different module.
204                Once that is resolved this will switched to use
205                leafref";
206           type string;
207         }
208
209         leaf vnfd-connection-point-ref {
210           description "A reference to a connection point name";
211           type leafref {
212             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd" +
213                  "[project-vnfd:id = current()/../vnfd-id-ref]/" +
214                  "project-vnfd:connection-point/project-vnfd:name";
215           }
216         }
217       }
218     }
219   }
220
221   grouping nsd-vnf-dependency {
222     list vnf-dependency {
223       description
224           "List of VNF dependencies.";
225       key vnf-source-ref;
226       leaf vnf-source-ref {
227         type leafref {
228           path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
229         }
230       }
231       leaf vnf-depends-on-ref {
232         description
233             "Reference to VNF that sorce VNF depends.";
234         type leafref {
235           path "../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
236         }
237       }
238     }
239   }
240
241   grouping nsr-nsd-vnf-dependency {
242     list vnf-dependency {
243       description
244           "List of VNF dependencies.";
245       key vnf-source-ref;
246       leaf vnf-source-ref {
247         type leafref {
248           path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
249         }
250       }
251       leaf vnf-depends-on-ref {
252         description
253             "Reference to VNF that sorce VNF depends.";
254         type leafref {
255           path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
256         }
257       }
258     }
259   }
260
261   grouping nsd-placement-groups {
262     list placement-groups {
263       description "List of placement groups at NS level";
264
265       key "name";
266       uses manotypes:placement-group-info;
267
268       list member-vnfd {
269         description
270             "List of VNFDs that are part of this placement group";
271
272         key "member-vnf-index-ref";
273
274         leaf member-vnf-index-ref {
275           description "member VNF index of this member VNF";
276           type leafref {
277             path "../../../constituent-vnfd/member-vnf-index";
278           }
279         }
280
281         leaf vnfd-id-ref {
282           description
283               "Identifier for the VNFD.";
284           type leafref {
285             path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
286           }
287         }
288       }
289     }
290   }
291
292   grouping nsr-nsd-placement-groups {
293     list placement-groups {
294       description "List of placement groups at NS level";
295
296       key "name";
297       uses manotypes:placement-group-info;
298
299       list member-vnfd {
300         description
301             "List of VNFDs that are part of this placement group";
302
303         key "member-vnf-index-ref";
304
305         leaf member-vnf-index-ref {
306           description "member VNF index of this member VNF";
307           type leafref {
308             path "../../../constituent-vnfd/member-vnf-index";
309           }
310         }
311
312         leaf vnfd-id-ref {
313           description
314               "Identifier for the VNFD.";
315           type leafref {
316             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
317           }
318         }
319       }
320     }
321   }
322
323   grouping nsd-monitoring-param {
324
325     list monitoring-param {
326       key "id";
327
328       uses nsd-base:monitoring-param-common;
329
330       list vnfd-monitoring-param {
331         description "A list of VNFD monitoring params";
332         key "member-vnf-index-ref vnfd-monitoring-param-ref";
333
334         leaf vnfd-id-ref {
335           description
336             "A reference to a vnfd. This is a
337               leafref to path:
338                   ../../../../nsd:constituent-vnfd
339                   + [nsd:id = current()/../nsd:id-ref]
340                   + /nsd:vnfd-id-ref
341               NOTE: An issue with confd is preventing the
342               use of xpath. Seems to be an issue with leafref
343               to leafref, whose target is in a different module.
344               Once that is resolved this will switched to use
345               leafref";
346
347           type leafref {
348             path "../../../constituent-vnfd" +
349               "[member-vnf-index = current()/../member-vnf-index-ref]" +
350               "/vnfd-id-ref";
351           }
352         }
353
354         leaf vnfd-monitoring-param-ref {
355           description "A reference to the VNFD monitoring param";
356           type leafref {
357             path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
358               + "[project-vnfd:id = current()/../vnfd-id-ref]"
359               + "/project-vnfd:monitoring-param/project-vnfd:id";
360           }
361         }
362
363         leaf member-vnf-index-ref {
364           description
365             "Optional reference to member-vnf within constituent-vnfds";
366           type leafref {
367             path "../../../constituent-vnfd/member-vnf-index";
368           }
369         }
370       }
371     }
372   }
373
374   grouping nsr-nsd-monitoring-param {
375     list monitoring-param {
376       key "id";
377
378       uses nsd-base:monitoring-param-common;
379
380       list vnfd-monitoring-param {
381         description "A list of VNFD monitoring params";
382         key "member-vnf-index-ref vnfd-monitoring-param-ref";
383
384         leaf vnfd-id-ref {
385           description
386             "A reference to a vnfd. This is a
387               leafref to path:
388                   ../../../../nsd:constituent-vnfd
389                   + [nsd:id = current()/../nsd:id-ref]
390                   + /nsd:vnfd-id-ref
391               NOTE: An issue with confd is preventing the
392               use of xpath. Seems to be an issue with leafref
393               to leafref, whose target is in a different module.
394               Once that is resolved this will switched to use
395               leafref";
396
397           type string;
398         }
399
400         leaf vnfd-monitoring-param-ref {
401           description "A reference to the VNFD monitoring param";
402           type leafref {
403             path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
404               + "[project-vnfd:id = current()/../vnfd-id-ref]"
405               + "/project-vnfd:monitoring-param/project-vnfd:id";
406           }
407         }
408
409         leaf member-vnf-index-ref {
410           description
411             "Optional reference to member-vnf within constituent-vnfds";
412           type leafref {
413             path "../../../constituent-vnfd/member-vnf-index";
414           }
415         }
416       }
417     }
418   }
419
420   grouping nsd-service-primitive {
421    list service-primitive {
422       description
423           "Network service level service primitives.";
424
425       key "name";
426
427       leaf name {
428         description
429             "Name of the service primitive.";
430         type string;
431       }
432
433       list parameter {
434         description
435             "List of parameters for the service primitive.";
436
437         key "name";
438         uses manotypes:primitive-parameter;
439       }
440
441       uses manotypes:ui-primitive-group;
442
443       list vnf-primitive-group {
444         description
445             "List of service primitives grouped by VNF.";
446
447         key "member-vnf-index-ref";
448         leaf member-vnf-index-ref {
449           description
450               "Reference to member-vnf within constituent-vnfds";
451           type leafref {
452              path "../../../constituent-vnfd/member-vnf-index";
453           }
454         }
455
456         leaf vnfd-id-ref {
457           description
458               "A reference to a vnfd. This is a leafref";
459
460           type leafref {
461              path "../../../constituent-vnfd" +
462                 "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
463           }
464         }
465
466         leaf vnfd-name {
467           description
468               "Name of the VNFD";
469           type leafref {
470               path "../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
471                     + "[project-vnfd:id = current()/../vnfd-id-ref]"
472                     + "/project-vnfd:name";
473           }
474         }
475
476         list primitive {
477           key "index";
478
479           leaf index {
480             description "Index of this primitive";
481             type uint32;
482           }
483
484           leaf name {
485             description "Name of the primitive in the VNF primitive ";
486             type string;
487           }
488         }
489       }
490
491       leaf user-defined-script {
492         description
493             "A user defined script.";
494         type string;
495       }
496     }
497   }
498
499   grouping nsr-nsd-service-primitive {
500    list service-primitive {
501       description
502           "Network service level service primitives.";
503
504       key "name";
505
506       leaf name {
507         description
508             "Name of the service primitive.";
509         type string;
510       }
511
512       list parameter {
513         description
514             "List of parameters for the service primitive.";
515
516         key "name";
517         uses manotypes:primitive-parameter;
518       }
519
520       uses manotypes:ui-primitive-group;
521
522       list vnf-primitive-group {
523         description
524             "List of service primitives grouped by VNF.";
525
526         key "member-vnf-index-ref";
527         leaf member-vnf-index-ref {
528           description
529               "Reference to member-vnf within constituent-vnfds";
530           type leafref {
531              path "../../../constituent-vnfd/member-vnf-index";
532           }
533         }
534
535         leaf vnfd-id-ref {
536           description
537               "A reference to a vnfd. This is a leafref";
538
539           type leafref {
540              path "../../../constituent-vnfd" +
541                 "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
542           }
543         }
544
545         leaf vnfd-name {
546           description
547               "Name of the VNFD";
548           type leafref {
549               path "../../../../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd"
550                     + "[project-vnfd:id = current()/../vnfd-id-ref]"
551                     + "/project-vnfd:name";
552           }
553         }
554
555         list primitive {
556           key "index";
557
558           leaf index {
559             description "Index of this primitive";
560             type uint32;
561           }
562
563           leaf name {
564             description "Name of the primitive in the VNF primitive ";
565             type string;
566           }
567         }
568       }
569
570       leaf user-defined-script {
571         description
572             "A user defined script.";
573         type string;
574       }
575     }
576   }
577
578   grouping nsd-descriptor {
579      uses nsd-base:nsd-descriptor-common;
580
581      uses nsd-vld;
582
583      uses nsd-constituent-vnfd;
584
585      uses nsd-placement-groups;
586
587      uses nsd-vnf-dependency;
588
589      uses nsd-monitoring-param;
590
591      uses nsd-service-primitive;
592   }
593
594   augment "/rw-project:project" {
595     container nsd-catalog {
596
597       list nsd {
598         key id;
599
600         uses nsd-descriptor;
601       }
602     }
603   }
604 }