New feature: Model changes for project support
[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 {
35     prefix "vnfd";
36   }
37
38   import nsd {
39     prefix "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-08 {
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 "../../../nsd:nsd-catalog/nsd:nsd/nsd:constituent-vnfd/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: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: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 vdu-id-ref {
316             type leafref {
317               path "../../vnfd/vdu/id";
318             }
319           }
320
321           leaf vim-id {
322             description "Allocated VM resource id";
323             type string;
324           }
325
326           leaf flavor-id {
327             description "VIM assigned flavor id";
328             type string;
329           }
330
331           leaf image-id {
332             description "VIM assigned image id";
333             type string;
334           }
335
336           leaf management-ip {
337             description "Management IP address";
338             type inet:ip-address;
339           }
340
341           leaf vm-management-ip {
342             description "VM Private Management IP address";
343             type inet:ip-address;
344           }
345
346           leaf console-url {
347             description "Console URL for this VDU, if available";
348             type inet:uri;
349           }
350
351           uses manotypes:vm-flavor;
352           uses manotypes:guest-epa;
353           uses manotypes:vswitch-epa;
354           uses manotypes:hypervisor-epa;
355           uses manotypes:host-epa;
356
357           uses manotypes:supplemental-boot-data;
358
359           list volumes {
360             key "name";
361
362             leaf name {
363               description "Name of the disk-volumes, e.g. vda, vdb etc";
364               type string;
365             }
366
367             leaf volume-id {
368               description "VIM assigned volume id";
369               type string;
370             }
371
372             uses manotypes:volume-info;
373           }
374
375           list alarms {
376             description
377               "A list of the alarms that have been created for this VDU";
378
379             key "alarm-id";
380             uses manotypes:alarm;
381           }
382
383           list internal-connection-point {
384             key "id";
385             description
386               "List for internal connection points. Each VNFC
387                has zero or more internal connection points.
388                Internal connection points are used for connecting
389                the VNF components internal to the VNF. If a VNF
390                has only one VNFC, it may not have any internal
391                connection points.";
392
393             uses vnfd:common-connection-point;
394
395             leaf ip-address {
396               description
397                 "IP address assigned to the internal connection point";
398               type inet:ip-address;
399             }
400             leaf mac-address {
401               description
402                 "MAC address assigned to the internal connection point";
403               // type inet:mac-address;
404               type string;
405             }
406           }
407
408           list internal-interface {
409             description
410               "List of internal interfaces for the VNF";
411             key name;
412
413             leaf name {
414               description
415                 "Name of internal interface. Note that this
416                  name has only local significance to the VDU.";
417               type string;
418             }
419
420             leaf vdur-internal-connection-point-ref {
421               type leafref {
422                 path "../../internal-connection-point/id";
423               }
424             }
425             uses virtual-interface;
426           }
427
428           list external-interface {
429             description
430               "List of external interfaces for the VNF.
431                The external interfaces enable sending
432                traffic to and from VNF.";
433             key name;
434
435             leaf name {
436               description
437                 "Name of the external interface. Note that
438                  this name has only local significance.";
439               type string;
440             }
441
442             leaf vnfd-connection-point-ref {
443               description
444                 "Name of the external connection point.";
445               type leafref {
446                 path "../../../connection-point/name";
447               }
448             }
449             uses virtual-interface;
450           }
451           leaf operational-status {
452             description
453               "The operational status of the VDU
454               init                : The VDU has just started.
455               vm-init-phase       : The VDUs in the VNF is being created in VIM.
456               vm-alloc-pending    : The  VM alloc is pending in VIM
457               running             : The VDU is active in VM
458               terminate           : The VDU is being terminated
459               vm-terminate-phase  : The VDU in the VNF is being terminated in VIM.
460               terminated          : The VDU is in the terminated state.
461               failed              : The VDU  instantiation failed.
462             ";
463
464             type enumeration {
465               rwpb:enum-type "VduOperationalStatus";
466               enum init;
467               enum vm-init-phase;
468               enum vm-alloc-pending;
469               enum running;
470               enum terminate;
471               enum vl-terminate-phase;
472               enum terminated;
473               enum failed;
474             }
475           }
476           uses placement-group-info;
477         }
478
479         uses manotypes:monitoring-param;
480
481         leaf operational-status {
482           description
483             "The operational status of the VNFR instance
484             init                : The VNF has just started.
485             vl-init-phase       : The internal VLs in the VNF are being instantiated.
486             vm-init-phase       : The VMs for VDUs in the VNF are being instantiated.
487             running             : The VNF is in running state.
488             terminate           : The VNF is being terminated.
489             vm-terminate-phase  : The VMs in the VNF are being terminated.
490             vl-terminate-phase  : The internal VLs in the VNF are being terminated.
491             terminated          : The VNF is in the terminated state.
492             failed              : The VNF instantiation failed
493           ";
494
495           type enumeration {
496             rwpb:enum-type "VnfrOperationalStatus";
497             enum init;
498             enum vl-init-phase;
499             enum vm-init-phase;
500             enum running;
501             enum terminate;
502             enum vm-terminate-phase;
503             enum vl-terminate-phase;
504             enum terminated;
505             enum failed;
506           }
507         }
508         leaf config-status {
509           description
510             "The configuration status of the NS instance
511             configuring: At least one of the VNFs in this instance is in configuring state
512             configured:  All the VNFs in this NS instance are configured or config-not-needed state
513           ";
514
515           type enumeration {
516             enum configuring {
517               value 1;
518             }
519             enum configured {
520               value 2;
521             }
522             enum failed {
523               value 3;
524             }
525             enum config-not-needed {
526               value 4;
527             }
528           }
529         }
530         uses placement-group-info;
531       }
532     }
533   }
534
535   rpc create-alarm {
536     description "Create an alert for a running VDU";
537     input {
538       uses manotypes:rpc-project-name;
539
540       leaf cloud-account {
541         mandatory true;
542         type leafref {
543           path "/rw-project:project[rw-project:name=current()/../project-name]" +
544             "/rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
545         }
546       }
547
548       leaf vdur-id {
549         mandatory true;
550         type string;
551       }
552
553       container alarm {
554         uses manotypes:alarm;
555       }
556     }
557
558     output {
559       leaf alarm-id {
560         type string;
561       }
562     }
563   }
564
565   rpc destroy-alarm {
566     description "Destroy an alert that is associated with a running VDU";
567     input {
568       uses manotypes:rpc-project-name;
569
570       leaf cloud-account {
571         mandatory true;
572         type leafref {
573           path "/rw-project:project[rw-project:name=current()/../project-name]" +
574             "/rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
575         }
576       }
577
578       leaf alarm-id {
579         mandatory true;
580         type string;
581       }
582     }
583   }
584 }
585