Merge from OSM SO master
[osm/SO.git] / models / plugins / yang / 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 vnfr
22 {
23   namespace "urn:ietf:params:xml:ns:yang:nfvo:vnfr";
24   prefix "vnfr";
25
26   import mano-types {
27     prefix "manotypes";
28   }
29
30   import rw-pb-ext {
31     prefix "rwpb";
32   }
33
34   import vnfd-base {
35     prefix "vnfd-base";
36   }
37
38   import project-nsd {
39     prefix "project-nsd";
40   }
41
42   import vlr {
43     prefix "vlr";
44   }
45
46   import ietf-yang-types {
47     prefix "yang";
48   }
49
50   import ietf-inet-types {
51     prefix "inet";
52   }
53
54   import rw-project {
55     prefix "rw-project";
56   }
57
58   import rw-cloud {
59     prefix "rw-cloud";
60   }
61
62   revision 2017-02-28 {
63     description
64       "Update model to support projects.";
65   }
66
67   revision 2015-09-10 {
68     description
69       "Initial revision. This YANG file defines
70        the Virtual Network Function Record (VNFR)";
71     reference
72       "Derived from earlier versions of base YANG files";
73   }
74
75   grouping placement-group-info {
76     list placement-groups-info {
77       description
78           "
79           Placement groups to which this VDU belongs and its
80           cloud construct
81           ";
82       key "name";
83       uses manotypes:placement-group-info;
84       uses manotypes:placement-group-input;
85     }  
86   }
87   
88   
89   grouping virtual-interface {
90     container virtual-interface {
91       description
92           "Container for the virtual interface properties";
93
94       leaf type {
95         description
96             "Specifies the type of virtual interface
97              between VM and host.
98              VIRTIO          : Use the traditional VIRTIO interface.
99              PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
100              SR-IOV          : Use SR-IOV interface.";
101         type enumeration {
102           enum VIRTIO;
103           enum PCI-PASSTHROUGH;
104           enum SR-IOV;
105         }
106       }
107
108       leaf bandwidth {
109         description
110             "Aggregate bandwidth of the NIC.";
111         type uint64;
112       }
113
114       leaf ovs-offload {
115         description
116             "Defines if the NIC supports OVS offload.
117              MANDATORY : OVS offload support in the NIC is mandatory.
118              PREFERRED : OVS offload support in the NIC is preferred.";
119         type enumeration {
120           enum MANDATORY;
121           enum PREFERRED;
122         }
123       }
124
125       leaf vendor-id {
126         description
127             "Specifies the vendor specific id for
128              the device. This is used when a NIC from
129              specific HW vendor is required.";
130         type string;
131       }
132
133       leaf datapath-library {
134         description
135             "Specifies the name and version of the datapath
136              library the NIC is expected to support.";
137         type string;
138       }
139
140       leaf provider-network-name {
141         description
142             "Name of the provider network to which this
143              NIC is attached.";
144         type string;
145       }
146     }
147   }
148
149   augment "/rw-project:project" {
150     container vnfr-catalog {
151       config false;
152       list vnfr {
153         description
154           "Virtual Network Function Record (VNFR).";
155         key "id";
156         unique "name";
157
158         leaf id {
159           description "Identifier for the VNFR.";
160           type yang:uuid;
161         }
162
163         leaf nsr-id-ref {
164           description
165             "NS instance identifier.
166              This is a leafref /nsr:ns-instance-config/nsr:nsr/nsr:id";
167           type yang:uuid;
168         }
169
170         leaf member-vnf-index-ref {
171           description "Reference to member VNF index in Network service.";
172           type leafref {
173             path "../../../project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:constituent-vnfd/project-nsd:member-vnf-index";
174           }
175         }
176
177         leaf dashboard-url {
178           description "Dashboard URL";
179           type inet:uri;
180         }
181
182         leaf name {
183           description "VNFR name.";
184           type string;
185         }
186
187         leaf short-name {
188           description "VNFR short name.";
189           type string;
190         }
191
192         leaf vendor {
193           description "Vendor of the VNFR.";
194           type string;
195         }
196
197         leaf description {
198           description "Description of the VNFR.";
199           type string;
200         }
201
202         leaf version {
203           description "Version of the VNFR";
204           type string;
205         }
206
207         leaf create-time {
208           description
209             "Creation timestamp of this Virtual Network
210           Function.  The timestamp is expressed as 
211           seconds since unix epoch - 1970-01-01T00:00:00Z";
212
213           type uint32;
214         }
215
216         leaf uptime {
217           description
218             "Active period of this Virtual Network Function.
219           Uptime is expressed in seconds";
220
221           type uint32;
222         }
223
224         container vnfd {
225           description "VNF descriptor used to instantiate this VNF";
226           uses vnfd-base:vnfd-descriptor;
227         }
228
229         // Use parameters provided here to configure this VNF
230         uses manotypes:vnf-configuration;
231
232         // Mainly used by Mon-params & dashboard url
233         container mgmt-interface {
234           leaf ip-address {
235             type inet:ip-address;
236           }
237           leaf port {
238             type inet:port-number;
239           }
240         }
241
242         list internal-vlr {
243           key "vlr-ref";
244
245           leaf vlr-ref {
246             description "Reference to a VLR record in the VLR catalog";
247             type leafref {
248               path "../../../../vlr:vlr-catalog/vlr:vlr/vlr:id";
249             }
250           }
251
252           leaf-list internal-connection-point-ref {
253             type leafref {
254               path "../../vdur/internal-connection-point/id";
255             }
256           }
257         }
258
259         list connection-point {
260           key "name";
261           description
262             "List for external connection points. Each VNF has one
263              or more external connection points. As the name
264              implies that external connection points are used for
265              connecting the VNF to other VNFs or to external networks.
266              Each VNF exposes these connection points to the
267              orchestrator. The orchestrator can construct network
268              services by connecting the connection points between
269              different VNFs. The NFVO will use VLDs and VNFFGs at
270              the network service level to construct network services.";
271
272           uses vnfd-base:common-connection-point;
273
274           leaf vlr-ref {
275             description
276               "Reference to the VLR associated with this connection point";
277             type  leafref {
278               path "../../../../vlr:vlr-catalog/vlr:vlr/vlr:id";
279             }
280           }
281
282           leaf ip-address {
283             description
284               "IP address assigned to the external connection point";
285             type inet:ip-address;
286           }
287           leaf mac-address {
288             description
289               "MAC address assigned to the external connection point";
290             // type inet:mac-address;
291             type string;
292           }
293           leaf connection-point-id {
294             rwpb:field-inline "true";
295             rwpb:field-string-max 64;
296             type string;
297           }
298         }
299
300         list vdur {
301           description "List of Virtual Deployment Units";
302           key "id";
303           unique "name";
304
305           leaf id {
306             description "Unique id for the VDU";
307             type yang:uuid;
308           }
309
310           leaf name {
311             description "name of the instantiated VDUR";
312             type string;
313           }
314
315           leaf unique-short-name {
316             description "Short Unique name of the VDU
317                   This will be of the format NSR name-ShortnedString-VDUname
318                   NSR name and VDU name shall be constrained to 10 characters";
319             rwpb:field-inline "true";
320             rwpb:field-string-max 64;
321             type string;
322           }
323
324           leaf vdu-id-ref {
325             type leafref {
326               path "../../vnfd/vdu/id";
327             }
328           }
329
330           leaf vim-id {
331             description "Allocated VM resource id";
332             type string;
333           }
334
335           leaf flavor-id {
336             description "VIM assigned flavor id";
337             type string;
338           }
339
340           leaf image-id {
341             description "VIM assigned image id";
342             type string;
343           }
344
345           leaf management-ip {
346             description "Management IP address";
347             type inet:ip-address;
348           }
349
350           leaf vm-management-ip {
351             description "VM Private Management IP address";
352             type inet:ip-address;
353           }
354
355           leaf console-url {
356             description "Console URL for this VDU, if available";
357             type inet:uri;
358           }
359
360           uses manotypes:vm-flavor;
361           uses manotypes:guest-epa;
362           uses manotypes:vswitch-epa;
363           uses manotypes:hypervisor-epa;
364           uses manotypes:host-epa;
365
366           uses manotypes:supplemental-boot-data;
367
368           list volumes {
369             key "name";
370
371             leaf name {
372               description "Name of the disk-volumes, e.g. vda, vdb etc";
373               type string;
374             }
375
376             leaf volume-id {
377               description "VIM assigned volume id";
378               type string;
379             }
380
381             uses manotypes:volume-info;
382           }
383
384           list alarms {
385             description
386               "A list of the alarms that have been created for this VDU";
387
388             key "alarm-id";
389             uses manotypes:alarm;
390           }
391
392           list internal-connection-point {
393             key "id";
394             description
395               "List for internal connection points. Each VNFC
396                has zero or more internal connection points.
397                Internal connection points are used for connecting
398                the VNF components internal to the VNF. If a VNF
399                has only one VNFC, it may not have any internal
400                connection points.";
401
402             uses vnfd-base:common-connection-point;
403
404             leaf ip-address {
405               description
406                 "IP address assigned to the internal connection point";
407               type inet:ip-address;
408             }
409             leaf mac-address {
410               description
411                 "MAC address assigned to the internal connection point";
412               // type inet:mac-address;
413               type string;
414             }
415           }
416
417           list internal-interface {
418             description
419               "List of internal interfaces for the VNF";
420             key name;
421
422             leaf name {
423               description
424                 "Name of internal interface. Note that this
425                  name has only local significance to the VDU.";
426               type string;
427             }
428
429             leaf vdur-internal-connection-point-ref {
430               type leafref {
431                 path "../../internal-connection-point/id";
432               }
433             }
434             uses virtual-interface;
435           }
436
437           list external-interface {
438             description
439               "List of external interfaces for the VNF.
440                The external interfaces enable sending
441                traffic to and from VNF.";
442             key name;
443
444             leaf name {
445               description
446                 "Name of the external interface. Note that
447                  this name has only local significance.";
448               type string;
449             }
450
451             leaf vnfd-connection-point-ref {
452               description
453                 "Name of the external connection point.";
454               type leafref {
455                 path "../../../connection-point/name";
456               }
457             }
458             uses virtual-interface;
459           }
460           leaf operational-status {
461             description
462               "The operational status of the VDU
463               init                : The VDU has just started.
464               vm-init-phase       : The VDUs in the VNF is being created in VIM.
465               vm-alloc-pending    : The  VM alloc is pending in VIM
466               running             : The VDU is active in VM
467               terminate           : The VDU is being terminated
468               vm-terminate-phase  : The VDU in the VNF is being terminated in VIM.
469               terminated          : The VDU is in the terminated state.
470               failed              : The VDU  instantiation failed.
471             ";
472
473             type enumeration {
474               rwpb:enum-type "VduOperationalStatus";
475               enum init;
476               enum vm-init-phase;
477               enum vm-alloc-pending;
478               enum running;
479               enum terminate;
480               enum vl-terminate-phase;
481               enum terminated;
482               enum failed;
483             }
484           }
485           uses placement-group-info;
486         }
487
488         uses manotypes:monitoring-param;
489
490         leaf operational-status {
491           description
492             "The operational status of the VNFR instance
493             init                : The VNF has just started.
494             vl-init-phase       : The internal VLs in the VNF are being instantiated.
495             vm-init-phase       : The VMs for VDUs in the VNF are being instantiated.
496             running             : The VNF is in running state.
497             terminate           : The VNF is being terminated.
498             vm-terminate-phase  : The VMs in the VNF are being terminated.
499             vl-terminate-phase  : The internal VLs in the VNF are being terminated.
500             terminated          : The VNF is in the terminated state.
501             failed              : The VNF instantiation failed
502           ";
503
504           type enumeration {
505             rwpb:enum-type "VnfrOperationalStatus";
506             enum init;
507             enum vl-init-phase;
508             enum vm-init-phase;
509             enum running;
510             enum terminate;
511             enum vm-terminate-phase;
512             enum vl-terminate-phase;
513             enum terminated;
514             enum failed;
515           }
516         }
517         leaf config-status {
518           description
519             "The configuration status of the NS instance
520             configuring: At least one of the VNFs in this instance is in configuring state
521             configured:  All the VNFs in this NS instance are configured or config-not-needed state
522           ";
523
524           type enumeration {
525             enum configuring {
526               value 1;
527             }
528             enum configured {
529               value 2;
530             }
531             enum failed {
532               value 3;
533             }
534             enum config-not-needed {
535               value 4;
536             }
537           }
538         }
539         uses placement-group-info;
540       }
541     }
542   }
543
544   rpc create-alarm {
545     description "Create an alert for a running VDU";
546     input {
547       uses manotypes:rpc-project-name;
548
549       leaf cloud-account {
550         mandatory true;
551         type leafref {
552           path "/rw-project:project[rw-project:name=current()/../project-name]" +
553             "/rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
554         }
555       }
556
557       leaf vdur-id {
558         mandatory true;
559         type string;
560       }
561
562       container alarm {
563         uses manotypes:alarm;
564       }
565     }
566
567     output {
568       leaf alarm-id {
569         type string;
570       }
571     }
572   }
573
574   rpc destroy-alarm {
575     description "Destroy an alert that is associated with a running VDU";
576     input {
577       uses manotypes:rpc-project-name;
578
579       leaf cloud-account {
580         mandatory true;
581         type leafref {
582           path "/rw-project:project[rw-project:name=current()/../project-name]" +
583             "/rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
584         }
585       }
586
587       leaf alarm-id {
588         mandatory true;
589         type string;
590       }
591     }
592   }
593 }
594