Merge changes I3b2a87cd,If344b5e0
[osm/IM.git] / models / yang / nsd.yang
1
2 /*
3  *
4  *   Copyright 2016-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 nsd
22 {
23   namespace "urn:ietf:params:xml:ns:yang:nfvo:nsd";
24   prefix "nsd";
25
26   import vnfd {
27     prefix "vnfd";
28   }
29
30   import nsd-base {
31     prefix "nsd-base";
32   }
33
34   import mano-types {
35     prefix "manotypes";
36   }
37
38   revision 2017-02-28 {
39     description
40       "Update model to support projects.";
41   }
42
43   revision 2014-10-27 {
44     description
45       "Initial revision. This YANG file defines
46        the Network Service Descriptor (NSD)";
47     reference
48       "Derived from earlier versions of base YANG files";
49   }
50
51   grouping nsd-constituent-vnfd {
52     list constituent-vnfd {
53       description
54           "List of VNFDs that are part of this
55           network service.";
56
57       key "member-vnf-index";
58
59       leaf member-vnf-index {
60         description
61           "Identifier/index for the VNFD. This separate id
62            is required to ensure that multiple VNFs can be
63            part of single NS";
64         type uint64;
65       }
66
67       leaf vnfd-id-ref {
68         description
69           "Identifier for the VNFD.";
70         type leafref {
71           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
72         }
73       }
74
75       leaf start-by-default {
76         description
77           "VNFD is started as part of the NS instantiation";
78         type boolean;
79         default true;
80       }
81     }
82   }
83
84   grouping nsd-vld {
85     list vld {
86
87       key "id";
88
89       uses nsd-base:nsd-vld-common;
90
91       list vnfd-connection-point-ref {
92         description
93             "A list of references to connection points.";
94         key "member-vnf-index-ref vnfd-connection-point-ref";
95
96         leaf member-vnf-index-ref {
97           description "Reference to member-vnf within constituent-vnfds";
98           type leafref {
99             path "../../../constituent-vnfd/member-vnf-index";
100           }
101         }
102
103         leaf vnfd-id-ref {
104           description
105               "A reference to a VNFD";
106           type leafref {
107             path "../../../constituent-vnfd" +
108                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
109                  "/vnfd-id-ref";
110           }
111         }
112
113         leaf vnfd-connection-point-ref {
114           description "A reference to a connection point name";
115           type leafref {
116             path "/vnfd:vnfd-catalog/vnfd:vnfd" +
117                  "[vnfd:id = current()/../vnfd-id-ref]/" +
118                  "vnfd:connection-point/vnfd:name";
119           }
120         }
121       }
122     }
123   }
124
125   grouping nsd-vnf-dependency {
126     list vnf-dependency {
127       description
128           "List of VNF dependencies.";
129       key vnf-source-ref;
130       leaf vnf-source-ref {
131         type leafref {
132           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
133         }
134       }
135       leaf vnf-depends-on-ref {
136         description
137             "Reference to VNF that sorce VNF depends.";
138         type leafref {
139           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
140         }
141       }
142     }
143   }
144
145   grouping nsd-placement-groups {
146     list placement-groups {
147       description "List of placement groups at NS level";
148
149       key "name";
150       uses manotypes:placement-group-info;
151
152       list member-vnfd {
153         description
154             "List of VNFDs that are part of this placement group";
155
156         key "member-vnf-index-ref";
157
158         leaf member-vnf-index-ref {
159           description "Member VNF index of this member VNF";
160           type leafref {
161             path "../../../constituent-vnfd/member-vnf-index";
162           }
163         }
164
165         leaf vnfd-id-ref {
166           description
167               "Identifier for the VNFD.";
168           type leafref {
169             path "../../../constituent-vnfd" + 
170                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
171                  "/vnfd-id-ref";
172           }
173         }
174       }
175     }
176   }
177
178   grouping nsd-monitoring-param {
179
180     list monitoring-param {
181       key id;
182
183       uses nsd-base:monitoring-param-common;
184
185       list vnfd-monitoring-param {
186         description "A list of VNFD monitoring params";
187         key "member-vnf-index-ref vnfd-monitoring-param-ref";
188
189         leaf vnfd-id-ref {
190           description
191              "A reference to a VNFD. This is a leafref";
192
193           type leafref {
194             path "../../../constituent-vnfd" +
195                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
196                  "/vnfd-id-ref";
197           }
198         }
199
200         leaf vnfd-monitoring-param-ref {
201           description "A reference to the VNFD monitoring param";
202           type leafref {
203             path "/vnfd:vnfd-catalog/vnfd:vnfd"
204               + "[vnfd:id = current()/../vnfd-id-ref]"
205               + "/vnfd:monitoring-param/vnfd:id";
206           }
207         }
208
209         leaf member-vnf-index-ref {
210           description
211             "Mandatory reference to member-vnf within constituent-vnfds";
212           type leafref {
213             path "../../../constituent-vnfd/member-vnf-index";
214           }
215         }
216       }
217     }
218   }
219
220   grouping nsd-service-primitive {
221    list service-primitive {
222       description
223           "Network service level service primitives.";
224
225       key "name";
226
227       leaf name {
228         description
229             "Name of the service primitive.";
230         type string;
231       }
232
233       list parameter {
234         description
235             "List of parameters for the service primitive.";
236
237         key "name";
238         uses manotypes:primitive-parameter;
239       }
240
241       uses manotypes:ui-primitive-group;
242
243       list vnf-primitive-group {
244         description
245             "List of service primitives grouped by VNF.";
246
247         key "member-vnf-index-ref";
248         leaf member-vnf-index-ref {
249           description
250               "Reference to member-vnf within constituent-vnfds";
251           type leafref {
252              path "../../../constituent-vnfd/member-vnf-index";
253           }
254         }
255
256         leaf vnfd-id-ref {
257           description
258               "A reference to a VNFD. This is a leafref";
259
260           type leafref {
261              path "../../../constituent-vnfd" +
262                 "[member-vnf-index = current()/../member-vnf-index-ref]" + "/vnfd-id-ref";
263           }
264         }
265
266         leaf vnfd-name {
267           description
268               "Name of the VNFD";
269           type leafref {
270               path "/vnfd:vnfd-catalog/vnfd:vnfd"
271                     + "[vnfd:id = current()/../vnfd-id-ref]"
272                     + "/vnfd:name";
273           }
274         }
275
276         list primitive {
277           key "index";
278
279           leaf index {
280             description "Index of this primitive";
281             type uint32;
282           }
283
284           leaf name {
285             description "Name of the primitive in the VNF primitive ";
286             type string;
287           }
288         }
289       }
290
291       leaf user-defined-script {
292         description
293             "A user defined script.";
294         type string;
295       }
296     }
297   }
298
299   container nsd-catalog {
300
301     list nsd {
302       key id;
303
304       uses nsd-base:nsd-descriptor-common;
305
306       uses nsd-vld;
307
308       uses nsd-constituent-vnfd;
309
310       uses nsd-placement-groups;
311
312       uses nsd-vnf-dependency;
313
314       uses nsd-monitoring-param;
315
316       uses nsd-service-primitive;
317     }
318   }
319 }