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