1b628819d39b9c9cf7c03cf9fb2c4a8cf75e74dd
[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. This is a
110                leafref to path:
111                    ../../constituent-vnfd
112                    + [id = current()/../id-ref]
113                    + /vnfd-id-ref
114                NOTE: An issue with confd is preventing the
115                use of xpath. Seems to be an issue with leafref
116                to leafref, whose target is in a different module.
117                Once that is resovled this will switched to use
118                leafref";
119           type string;
120         }
121
122         leaf vnfd-connection-point-ref {
123           description "A reference to a connection point name";
124           type leafref {
125             path "/vnfd:vnfd-catalog/vnfd:vnfd" +
126                  "[vnfd:id = current()/../vnfd-id-ref]/" +
127                  "vnfd:connection-point/vnfd:name";
128           }
129         }
130       }
131     }
132   }
133
134   grouping nsd-vnf-dependency {
135     list vnf-dependency {
136       description
137           "List of VNF dependencies.";
138       key vnf-source-ref;
139       leaf vnf-source-ref {
140         type leafref {
141           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
142         }
143       }
144       leaf vnf-depends-on-ref {
145         description
146             "Reference to VNF that sorce VNF depends.";
147         type leafref {
148           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
149         }
150       }
151     }
152   }
153
154   grouping nsd-placement-groups {
155     list placement-groups {
156       description "List of placement groups at NS level";
157
158       key "name";
159       uses manotypes:placement-group-info;
160
161       list member-vnfd {
162         description
163             "List of VNFDs that are part of this placement group";
164
165         key "member-vnf-index-ref";
166
167         leaf member-vnf-index-ref {
168           description "member VNF index of this member VNF";
169           type leafref {
170             path "../../../constituent-vnfd/member-vnf-index";
171           }
172         }
173
174         leaf vnfd-id-ref {
175           description
176               "Identifier for the VNFD.";
177           type leafref {
178             path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
179           }
180         }
181       }
182     }
183   }
184
185   grouping nsd-monitoring-param {
186
187     list monitoring-param {
188       key id;
189
190       uses nsd-base:monitoring-param-common;
191
192       list vnfd-monitoring-param {
193         description "A list of VNFD monitoring params";
194         key "vnfd-id-ref vnfd-monitoring-param-ref";
195
196         leaf vnfd-id-ref {
197           description
198             "A reference to a vnfd. This is a
199               leafref to path:
200                   ../../../../nsd:constituent-vnfd
201                   + [nsd:id = current()/../nsd:id-ref]
202                   + /nsd:vnfd-id-ref
203               NOTE: An issue with confd is preventing the
204               use of xpath. Seems to be an issue with leafref
205               to leafref, whose target is in a different module.
206               Once that is resolved this will switched to use
207               leafref";
208
209           type yang:uuid;
210         }
211
212         leaf vnfd-monitoring-param-ref {
213           description "A reference to the VNFD monitoring param";
214           type leafref {
215             path "/vnfd:vnfd-catalog/vnfd:vnfd"
216               + "[vnfd:id = current()/../vnfd-id-ref]"
217               + "/vnfd:monitoring-param/vnfd:id";
218           }
219         }
220
221         leaf-list member-vnf-index-ref {
222           description
223             "Optional reference to member-vnf within constituent-vnfds";
224           type uint64;
225         }
226       }
227     }
228   }
229
230   container nsd-catalog {
231
232     list nsd {
233       key id;
234
235       uses nsd-base:nsd-descriptor-common;
236
237       uses nsd-vld;
238
239       uses nsd-constituent-vnfd;
240
241       uses nsd-placement-groups;
242
243       uses nsd-vnf-dependency;
244
245       uses nsd-monitoring-param;
246     }
247   }
248 }