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