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