Simple strategy to allow address pairs for virtual IP
[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:etsi:osm:yang: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   import ietf-inet-types {
39     prefix "inet";
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 string;
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-connection-point-ref {
108           description "A reference to a connection point name";
109           type leafref {
110             path "/vnfd:vnfd-catalog/vnfd:vnfd" +
111                  "[vnfd:id = current()/../vnfd-id-ref]/" +
112                  "vnfd:connection-point/vnfd:name";
113           }
114         }
115
116         leaf vnfd-id-ref {
117           description
118               "A reference to a VNFD";
119           type leafref {
120             path "../../../constituent-vnfd" +
121                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
122                  "/vnfd-id-ref";
123           }
124         }
125
126         leaf ip-address {
127           description "IP address of the connection point";
128           type inet:ip-address;
129         }
130
131       }
132     }
133   }
134
135   grouping nsd-vnf-dependency {
136     list vnf-dependency {
137       description
138           "List of VNF dependencies.";
139       key vnf-source-ref;
140       leaf vnf-source-ref {
141         type leafref {
142           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
143         }
144       }
145       leaf vnf-depends-on-ref {
146         description
147             "Reference to VNF that sorce VNF depends.";
148         type leafref {
149           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
150         }
151       }
152     }
153   }
154
155   grouping nsd-placement-groups {
156     list placement-groups {
157       description "List of placement groups at NS level";
158
159       key "name";
160       uses manotypes:placement-group-info;
161
162       list member-vnfd {
163         description
164             "List of VNFDs that are part of this placement group";
165
166         key "member-vnf-index-ref";
167
168         leaf member-vnf-index-ref {
169           description "Member VNF index of this member VNF";
170           type leafref {
171             path "../../../constituent-vnfd/member-vnf-index";
172           }
173         }
174
175         leaf vnfd-id-ref {
176           description
177               "Identifier for the VNFD.";
178           type leafref {
179             path "../../../constituent-vnfd" + 
180                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
181                  "/vnfd-id-ref";
182           }
183         }
184       }
185     }
186   }
187
188   grouping nsd-monitoring-param {
189
190     list monitoring-param {
191       key id;
192
193       uses nsd-base:monitoring-param-common;
194
195       list vnfd-monitoring-param {
196         description "A list of VNFD monitoring params";
197         key "member-vnf-index-ref vnfd-monitoring-param-ref";
198
199         leaf vnfd-id-ref {
200           description
201              "A reference to a VNFD. This is a leafref";
202
203           type leafref {
204             path "../../../constituent-vnfd" +
205                  "[member-vnf-index = current()/../member-vnf-index-ref]" +
206                  "/vnfd-id-ref";
207           }
208         }
209
210         leaf vnfd-monitoring-param-ref {
211           description "A reference to the VNFD monitoring param";
212           type leafref {
213             path "/vnfd:vnfd-catalog/vnfd:vnfd"
214               + "[vnfd:id = current()/../vnfd-id-ref]"
215               + "/vnfd:monitoring-param/vnfd:id";
216           }
217         }
218
219         leaf member-vnf-index-ref {
220           description
221             "Mandatory reference to member-vnf within constituent-vnfds";
222           type leafref {
223             path "../../../constituent-vnfd/member-vnf-index";
224           }
225         }
226       }
227     }
228   }
229
230   container nsd-catalog {
231
232     leaf schema-version {
233       description "Schema version for the NSD. If unspecified, it assumes v3.0";
234       type string;
235       default "v3.0";
236     }
237
238     list nsd {
239       key id;
240
241       uses nsd-base:nsd-descriptor-common;
242
243       uses nsd-vld;
244
245       uses nsd-constituent-vnfd;
246
247       uses nsd-placement-groups;
248
249       uses nsd-vnf-dependency;
250
251       uses nsd-monitoring-param;
252     }
253   }
254 }