update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[osm/SO.git] / models / plugins / yang / rw-vnfr.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 rw-vnfr
22 {
23   namespace "http://riftio.com/ns/riftware-1.0/rw-vnfr";
24   prefix "rw-vnfr";
25
26   import mano-types {
27     prefix "manotypes";
28   }
29
30   import vnfr {
31     prefix "vnfr";
32   }
33
34   import vnfd-base {
35     prefix "vnfd-base";
36   }
37
38   import project-vnfd {
39     prefix "project-vnfd";
40   }
41
42   import rw-cloud {
43     prefix "rw-cloud";
44   }
45
46   import rwvcs-types {
47     prefix "rwvcstypes";
48   }
49
50   import ietf-yang-types {
51     prefix "yang";
52   }
53
54   import ietf-inet-types {
55     prefix "inet";
56   }
57
58   import rw-project {
59     prefix "rw-project";
60   }
61
62   import mano-rift-groupings {
63     prefix "mano-rift";
64   }
65
66   revision 2017-02-28 {
67     description
68       "Update model to support projects.";
69   }
70
71   revision 2015-09-10 {
72     description
73       "Initial revision. This YANG file augments
74        the base MANO VNFD";
75     reference
76       "Derived from earlier versions of base YANG files";
77   }
78
79   typedef vdur-operational-event-types {
80     type enumeration {
81       enum instantiate-rcvd;
82       enum vm-allocation-requested;
83       enum running;
84       enum terminate-rcvd;
85       enum vm-terminate-requested;
86       enum terminated;
87     }
88   }
89
90   typedef vnfr-operational-event-types {
91     type enumeration {
92       enum instantiate-rcvd;
93       enum vl-inited;
94       enum vnf-inited;
95       enum running;
96       enum terminate-rcvd;
97       enum vnf-terminated;
98       enum vl-terminated;
99       enum terminated;
100     }
101   }
102
103   grouping vnfr-operational-events {
104     list operational-events {
105       key "id";
106       description
107         "Recent operational events for VNFR
108         Though the model does not impose any restrictions on the numbe of events,
109         the max operational events will be limited to the most recent 10";
110
111       leaf id {
112         description "The id of the instance";
113         type uint64;
114       }
115
116       leaf timestamp {
117         description
118           "The timestamp of this event expressed as seconds since
119           unix epoch - 1970-01-01T00:00:00Z";
120         type uint32;
121       }
122       leaf event {
123         description "The event";
124         type vnfr-operational-event-types;
125       }
126       leaf description {
127         description
128           "The description of this event";
129         type string;
130       }
131     }
132   }
133
134   grouping vdur-operational-events {
135     list operational-events {
136       key "id";
137       description
138         "Recent operational events for VDUR
139         Though the model does not impose any restrictions on the numbe of events,
140         the max operational events will be limited to the most recent 10";
141
142       leaf id {
143         description "The id of the instance";
144         type uint64;
145       }
146
147       leaf timestamp {
148         description
149           "The timestamp of this event expressed as seconds since
150           unix epoch - 1970-01-01T00:00:00Z";
151         type uint32;
152       }
153       leaf event {
154         description "The event";
155         type vdur-operational-event-types;
156       }
157       leaf description {
158         description
159           "The description of this event";
160         type string;
161       }
162     }
163   }
164
165   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr {
166     uses manotypes:action-param;
167     uses manotypes:control-param;
168
169     leaf datacenter {
170       description
171           "Datacenter name to use when instantiating
172           the network service.";
173       type string;
174     }
175
176     container nfvi-metrics {
177       container vm {
178         leaf label {
179           description
180             "Label to show in UI";
181           type string;
182           default "VM";
183         }
184
185         leaf active-vm {
186           description
187             "The number of active VMs.";
188           type uint64;
189         }
190
191         leaf inactive-vm {
192           description
193             "The number of inactive VMs.";
194           type uint64;
195         }
196       }
197
198       uses manotypes:nfvi-metrics;
199     }
200     uses vnfr-operational-events;
201
202     leaf operational-status-details {
203       description
204         "The error message in case of a failed VNFR operational status";
205       type string;
206     }
207   }
208
209   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur {
210     leaf vm-pool {
211       description
212         "The pool from which this vm was allocated from";
213       type string;
214     }
215
216     container nfvi-metrics {
217       uses manotypes:nfvi-metrics;
218     }
219
220
221     uses vdur-operational-events;
222
223     leaf operational-status-details {
224       description
225         "The error message in case of a failed VDU operational status";
226       type string;
227     }
228   }
229
230   grouping vnfd-ref-count {
231     list vnfd-ref-count {
232       key "vnfd-id-ref";
233       description "This table maintains the number of VNFRs used by each VNFD";
234
235       leaf vnfd-id-ref {
236         description "Reference to VNFD";
237         type leafref {
238           path "../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
239         }
240       }
241       leaf instance-ref-count {
242         description
243           "Reference count for the number of VNFRs refering this VNFD.
244            Every VNF Record instantiated using this descriptor takes
245            a reference on the VNFD and releases the reference when the
246            virtual network service is terminated. This desciptor cannot
247            be deleted when this counter is non zero";
248         type uint64;
249       }
250     }
251   }
252
253   grouping vnfd-config-parameter {
254     container config-parameter {
255       description
256         "List of VNF config parameter requests and sources";
257       list config-parameter-source {
258         description "The list of parameters exposed by this VNF";
259         key "name";
260
261         leaf name {
262           description "Name of the source";
263           type string {
264             length "1..128";
265           }
266         }
267
268         leaf description {
269           description " Description of the source";
270           type string;
271         }
272
273         choice source {
274           case descriptor {
275             leaf descriptor {
276               description
277                 "Location of this source as an xpath.
278                  For example:
279                    ../../../mgmt-interface/port";
280               type string;
281             }
282           }
283
284           case attribute {
285             leaf attribute {
286               description
287                 "Location of this source as runtime attribute.
288                  The value is <xpath>, <attribute_name>
289                  For example:
290                    ../../../mgmt-interface, ip-address
291                    which retruns the ip-address assigned to the
292                    mgmt-interface after VNF instantiation.";
293               type string;
294             }
295           }
296
297           case primitive-ref {
298             leaf config-primitive-name-ref {
299               description
300                 "A leafref to configuration primitive.
301                  This refers to a config parameter whose
302                  output parameter is referred in out-parameter.";
303               type leafref {
304                 path "../../../vnfr:vnf-configuration/vnfr:config-primitive/vnfr:name";
305               }
306             }
307
308             leaf parameter-ref {
309               description
310                 "Name of the output parameter in the config primitiive";
311               type leafref {
312                 path
313                   "../../../vnfr:vnf-configuration/vnfr:config-primitive[vnfr:name=current()/../config-primitive-name-ref]/vnfr:parameter/vnfr:name";
314               }
315             }
316           }
317
318           case value {
319             leaf value {
320               description
321                 "Pre-defined value to be used for this source";
322               type string;
323             }
324           }
325         }
326
327         list parameter {
328           key "config-primitive-name-ref";
329
330           leaf config-primitive-name-ref {
331             description
332               "Name of the configuration primitive where this
333              request will used";
334             type leafref {
335               path "../../../../vnfr:vnf-configuration/vnfr:config-primitive/vnfr:name";
336             }
337           }
338
339           leaf config-primitive-parameter-ref {
340             description
341               "Parameter name of the config primitive";
342             type leafref {
343               path "../../../../vnfr:vnf-configuration/vnfr:config-primitive[vnfr:name=current()/../config-primitive-name-ref]/vnfr:parameter/vnfr:name";
344             }
345           }
346         }
347       }
348
349       list config-parameter-request {
350         description "The list of requests for this VNF";
351         key "name";
352
353         leaf name {
354           description "Name of this parameter request";
355           type string {
356             length "1..128";
357           }
358         }
359
360         leaf description {
361           description "Description of this request";
362           type string;
363         }
364
365         list parameter {
366           key "config-primitive-name-ref";
367
368           leaf config-primitive-name-ref {
369             description
370               "Name of the configuration primitive where this
371              request will used";
372             type leafref {
373               path "../../../../vnfr:vnf-configuration/vnfr:config-primitive/vnfr:name";
374             }
375           }
376
377           leaf config-primitive-parameter-ref {
378             description
379               "Parameter name of the config primitive";
380             type leafref {
381               path "../../../../vnfr:vnf-configuration/vnfr:config-primitive[vnfr:name=current()/../config-primitive-name-ref]/vnfr:parameter/vnfr:name";
382             }
383           }
384         }
385       }
386     }
387   }
388
389   augment /rw-project:project/vnfr:vnfr-catalog {
390     uses vnfd-ref-count;
391   }
392
393   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:mgmt-interface {
394     leaf ssh-key {
395       description
396         "Whether SSH keys need to be generated and passed
397              to the RO and VCA during instantiation.";
398       type boolean;
399     }
400   }
401
402   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vdu/vnfr:vm-flavor {
403                 uses manotypes:vm-flavor-name;
404   }
405
406   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vdu/vnfr:interface {
407     leaf static-ip-address {
408       description "Static IP address for the connection point";
409       type inet:ip-address;
410     }
411
412     leaf floating-ip-needed{
413       type boolean;
414       default "false";
415       description 
416         "Sole purpose of this field is to facilitate translation of VNFD 
417               to other VNFMs";
418     }
419   }
420
421   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur/vnfr:interface {
422     leaf static-ip-address {
423       description "Static IP address for the connection point";
424       type inet:ip-address;
425     }
426
427     leaf floating-ip-needed{
428       type boolean;
429       default "false";
430       description 
431         "Sole purpose of this field is to facilitate translation of VNFD 
432               to other VNFMs";
433     }
434   }
435
436   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur/vnfr:vm-flavor {
437                 uses manotypes:vm-flavor-name;
438   }
439
440   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd {
441     leaf meta {
442       description
443         "Any meta-data needed by the UI";
444       type string;
445     }
446
447     uses vnfd-config-parameter;
448   }
449
450   augment /rw-project:project {
451     container vnfr-console {
452       config false;
453       list vnfr {
454         key "id";
455         leaf id {
456           description "Identifier for the VNFR.";
457           type yang:uuid;
458         }
459         list vdur {
460           description "List of Virtual Deployment Units";
461           key "id";
462           leaf id {
463             description "Unique id for the VDU";
464             type yang:uuid;
465           }
466           leaf console-url {
467             description "Console URL for this VDU, if available";
468             type inet:uri;
469           }
470         }
471       }
472     }
473   }
474
475   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:http-endpoint {
476     uses mano-rift:http-end-point-additions;
477   }
478
479   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:http-endpoint {
480     uses mano-rift:http-end-point-additions;
481   }
482
483   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vdu/vnfr:supplemental-boot-data {
484     uses mano-rift:custom-meta-data;
485   }
486
487   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur/vnfr:supplemental-boot-data {
488     uses mano-rift:custom-meta-data;
489   }
490
491   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vdu/vnfr:volumes {
492     uses mano-rift:volume-info-additions;
493     uses mano-rift:custom-meta-data;
494   }
495
496   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vdu/vnfr:volumes/vnfr:volume-source {
497     case volume {
498       leaf volume-ref {
499         description "Reference for pre-existing volume in VIM";
500         type string;
501       }
502     }
503   }
504
505   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnf-configuration/vnfr:config-primitive/vnfr:parameter {
506     leaf out {
507       description "If this is an output of the primitive execution";
508       type boolean;
509       default false;
510     }
511   }
512
513   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vnf-configuration/vnfr:config-primitive/vnfr:parameter {
514     leaf out {
515       description "If this is an output of the primitive execution";
516       type boolean;
517       default false;
518     }
519   }
520
521   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnf-configuration/vnfr:initial-config-primitive/vnfr:primitive-type {
522     case primitive-ref {
523       leaf config-primitive-ref {
524         description
525           "Reference to a config primitive name.
526            NOTE: The config primitive referred should have
527                  all the input parameters predefined either
528                  with default values or dependency references.";
529         type leafref {
530           path "../../vnfr:config-primitive/vnfr:name";
531         }
532       }
533     }
534   }
535
536   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:vnf-configuration/vnfr:initial-config-primitive/vnfr:primitive-type {
537     case primitive-ref {
538       leaf config-primitive-ref {
539         description
540           "Reference to a config primitive name.
541            NOTE: The config primitive referred should have
542                  all the input parameters predefined either
543                  with default values or dependency references.";
544         type leafref {
545           path "../../vnfr:config-primitive/vnfr:name";
546         }
547       }
548     }
549   }
550
551   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur/vnfr:volumes {
552     uses mano-rift:volume-info-additions;
553     uses mano-rift:custom-meta-data;
554   }
555
556   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vnfd/vnfr:internal-vld {
557     list virtual-connection-points {
558       description
559           "A list of virtual-connection points associated with Virtual Link.
560          These connection points are not directly associated with any VDUs";
561       key name;
562       uses vnfd-base:common-connection-point;
563
564       leaf-list associated-cps {
565         description
566             "A List of connection points associated with virtual connection point";
567         type leafref {
568           path "../../vnfr:internal-connection-point/vnfr:id-ref";
569         }
570       }
571     }
572   }
573
574 }
575
576 // vim: sw=2