Adding terminate-config-primitie for PNF config deletion
[osm/IM.git] / models / 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   revision 2017-02-28 {
59     description
60       "Update model to support projects.";
61   }
62
63   revision 2015-09-10 {
64     description
65       "Initial revision. This YANG file defines
66        the Virtual Network Function Record (VNFR)";
67     reference
68       "Derived from earlier versions of base YANG files";
69   }
70
71   typedef vdu-operational-status {
72     type enumeration {
73       enum init;
74       enum vm-init-phase;
75       enum vm-alloc-pending;
76       enum running;
77       enum upgrading;
78       enum terminate;
79       enum vl-terminate-phase;
80       enum terminated;
81       enum failed;
82     }
83   }
84
85   typedef vnf-operational-status {
86     type enumeration {
87       enum pre-init;
88       enum init;
89       enum vl-init-phase;
90       enum vm-init-phase;
91       enum running;
92       enum upgrading;   // Experimental
93       enum terminate;
94       enum vm-terminate-phase;
95       enum vl-terminate-phase;
96       enum terminated;
97       enum failed;
98     }
99   }
100
101   grouping placement-group-info {
102     list placement-groups-info {
103       description
104           "
105           Placement groups to which this VDU belongs and its
106           cloud construct
107           ";
108       key "name";
109       uses manotypes:placement-group-info;
110       uses manotypes:placement-group-input;
111     }
112   }
113
114   grouping virtual-interface {
115     container virtual-interface {
116       description
117           "Container for the virtual interface properties";
118
119       leaf type {
120         description
121             "Specifies the type of virtual interface
122              between VM and host.
123              PARAVIRT        : Use the default paravirtualized interface for the VIM (virtio, vmxnet3, etc.).
124              VIRTIO          : Deprecated! Use the traditional VIRTIO interface.
125              PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
126              SR-IOV          : Use SR-IOV interface.";
127         type enumeration {
128           enum PARAVIRT;
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       leaf schema-version {
203         description "Schema version for the VNFR. If unspecified, it assumes v3.0";
204         type string;
205         default "v3.0";
206       }
207
208       config false;
209       list vnfr {
210         description
211           "Virtual Network Function Record (VNFR).";
212         key "id";
213         unique "name";
214
215         leaf id {
216           description "Identifier for the VNFR.";
217           type yang:uuid;
218         }
219
220         leaf nsr-id-ref {
221           description
222             "NS instance identifier.
223              This is a leafref /nsr:ns-instance-config/nsr:nsr/nsr:id";
224           type yang:uuid;
225         }
226
227         leaf member-vnf-index-ref {
228           description "Reference to member VNF index in Network service.";
229           type leafref {
230             path "../../../project-nsd:nsd-catalog/project-nsd:nsd/project-nsd:constituent-vnfd/project-nsd:member-vnf-index";
231           }
232         }
233
234         leaf dashboard-url {
235           description "Dashboard URL";
236           type inet:uri;
237         }
238
239         leaf name {
240           description "VNFR name.";
241           type string;
242         }
243
244         leaf short-name {
245           description "VNFR short name.";
246           type string;
247         }
248
249         leaf vendor {
250           description "Vendor of the VNFR.";
251           type string;
252         }
253
254         leaf description {
255           description "Description of the VNFR.";
256           type string;
257         }
258
259         leaf version {
260           description "Version of the VNFR";
261           type string;
262         }
263
264         leaf create-time {
265           description
266             "Creation timestamp of this Virtual Network
267           Function.  The timestamp is expressed as
268           seconds since unix epoch - 1970-01-01T00:00:00Z";
269
270           type uint32;
271         }
272
273         leaf uptime {
274           description
275             "Active period of this Virtual Network Function.
276           Uptime is expressed in seconds";
277
278           type uint32;
279         }
280
281         container vnfd {
282           description "VNF descriptor used to instantiate this VNF";
283           uses vnfd-base:vnfd-descriptor;
284         }
285
286         leaf vnfd-ref {
287           description "Reference to VNFD";
288           type leafref {
289             path "../../../project-vnfd:vnfd-catalog/project-vnfd:vnfd/project-vnfd:id";
290           }
291         }
292
293         // Use parameters provided here to configure this VNF
294         container vnf-configuration {
295           uses manotypes:vca-configuration;
296         }
297
298         // Mainly used by Mon-params & dashboard url
299         container mgmt-interface {
300           leaf ip-address {
301             type inet:ip-address;
302           }
303
304           leaf port {
305             type inet:port-number;
306           }
307
308           container ssh-key {
309             description "SSH key pair used for this VNF";
310             leaf public-key {
311               description "Public key configured on this VNF";
312               type string;
313             }
314
315             leaf private-key-file {
316               description "Path to the private key file";
317               type string;
318             }
319           }
320         }
321
322         list internal-vlr {
323           key "vlr-ref";
324
325           leaf vlr-ref {
326             description "Reference to a VLR record in the VLR catalog";
327             type leafref {
328               path "../../../../vlr:vlr-catalog/vlr:vlr/vlr:id";
329             }
330           }
331
332           leaf-list internal-connection-point-ref {
333             type leafref {
334               path "../../vdur/internal-connection-point/id";
335             }
336           }
337         }
338
339         list connection-point {
340           key "name";
341           description
342             "List for external connection points. Each VNF has one
343              or more external connection points. As the name
344              implies that external connection points are used for
345              connecting the VNF to other VNFs or to external networks.
346              Each VNF exposes these connection points to the
347              orchestrator. The orchestrator can construct network
348              services by connecting the connection points between
349              different VNFs. The NFVO will use VLDs and VNFFGs at
350              the network service level to construct network services.";
351
352           uses vnfd-base:common-connection-point;
353
354           leaf vlr-ref {
355             description
356               "Reference to the VLR associated with this connection point";
357             type  leafref {
358               path "../../../../vlr:vlr-catalog/vlr:vlr/vlr:id";
359             }
360           }
361
362           leaf ip-address {
363             description
364               "IP address assigned to the external connection point";
365             type inet:ip-address;
366           }
367
368           leaf mac-address {
369             description
370               "MAC address assigned to the external connection point";
371             // type inet:mac-address;
372             type string;
373           }
374
375           leaf connection-point-id {
376             type string;
377           }
378
379           uses associated-virtual-cps;
380         }
381
382         list vdur {
383           description "List of Virtual Deployment Units";
384           key "id";
385           unique "name";
386
387           leaf id {
388             description "Unique id for the VDU";
389             type yang:uuid;
390           }
391
392           leaf name {
393             description "name of the instantiated VDUR";
394             type string;
395           }
396
397           leaf unique-short-name {
398             description "Short Unique name of the VDU
399                   This will be of the format NSR name-ShortnedString-VDUname
400                   NSR name and VDU name shall be constrained to 10 characters";
401             type string;
402           }
403
404           leaf vdu-id-ref {
405             type leafref {
406               path "../../vnfd/vdu/id";
407             }
408           }
409
410           leaf vim-id {
411             description "Allocated VM resource id";
412             type string;
413           }
414
415           leaf flavor-id {
416             description "VIM assigned flavor id";
417             type string;
418           }
419
420           leaf image-id {
421             description "VIM assigned image id";
422             type string;
423           }
424
425           leaf management-ip {
426             description "Management IP address";
427             type inet:ip-address;
428           }
429
430           leaf vm-management-ip {
431             description "VM Private Management IP address";
432             type inet:ip-address;
433           }
434
435           leaf console-url {
436             description "Console URL for this VDU, if available";
437             type inet:uri;
438           }
439
440           uses manotypes:vm-flavor;
441           uses manotypes:guest-epa;
442           uses manotypes:vswitch-epa;
443           uses manotypes:hypervisor-epa;
444           uses manotypes:host-epa;
445
446           uses manotypes:supplemental-boot-data;
447
448           container vdu-configuration {
449             uses manotypes:vca-configuration;
450           }
451
452           list monitoring-param {
453             description
454               "List of VDU-related monitoring parameters at NFVI level";
455             key id;
456             leaf id {
457               description "The unique id of the monitoring param at VDU level";
458               type string;
459             }
460
461             leaf nfvi-metric {
462               description "The associated NFVI metric to be monitored";
463               type manotypes:nfvi-metric-type;
464             }
465
466             leaf interface-name-ref {
467               description
468                 "Reference to a VDU interface name. Applicable only when the nfvi-metric
469                 refers to an interface and not to the VM";
470               type leafref {
471                 path "../../interface/name";
472               }
473             }
474           }
475
476           list volumes {
477             key "name";
478
479             leaf name {
480               description "Name of the disk-volumes, e.g. vda, vdb etc";
481               type string;
482             }
483
484             leaf volume-id {
485               description "VIM assigned volume id";
486               type string;
487             }
488
489             uses manotypes:volume-info;
490           }
491
492           list internal-connection-point {
493             key "id";
494             description
495               "List for internal connection points. Each VNFC
496                has zero or more internal connection points.
497                Internal connection points are used for connecting
498                the VNF components internal to the VNF. If a VNF
499                has only one VNFC, it may not have any internal
500                connection points.";
501
502             uses vnfd-base:common-connection-point;
503
504             leaf ip-address {
505               description
506                 "IP address assigned to the internal connection point";
507               type inet:ip-address;
508             }
509
510             leaf mac-address {
511               description
512                 "MAC address assigned to the internal connection point";
513               // type inet:mac-address;
514               type string;
515             }
516
517             leaf connection-point-id {
518               type string;
519             }
520
521             uses associated-virtual-cps;
522           }
523
524           list interface {
525             description
526                 "List of interfaces (internal and external) for the VNF";
527             key name;
528
529             leaf name {
530               description
531                   "Name of the interface. Note that this
532                   name has only local significance to the VDU.";
533               type string;
534             }
535
536             leaf position {
537               description
538                   "Explicit Position of the interface within the list";
539               type uint32;
540             }
541
542             leaf type {
543               description
544                   "Type of the Interface";
545
546               type vnfd-base:interface-type;
547
548               default "EXTERNAL";
549             }
550             choice connection-point-type {
551               case internal {
552                 leaf internal-connection-point-ref {
553                   description
554                       "Leaf Ref to the particular internal connection point";
555                   type leafref {
556                     path "../../internal-connection-point/id";
557                   }
558                 }
559               }
560               case external {
561                 leaf external-connection-point-ref {
562                   description
563                       "Leaf Ref to the particular external connection point";
564                   type leafref {
565                     path "../../../connection-point/name";
566                   }
567                 }
568               }
569             }
570             uses virtual-interface;
571           }
572
573           leaf operational-status {
574             description
575               "The operational status of the VDU
576                 init                : The VDU has just started.
577                 vm-init-phase       : The VDUs in the VNF is being created in VIM.
578                 vm-alloc-pending    : The  VM alloc is pending in VIM
579                 running             : The VDU is active in VM
580                 upgrading           : The VDU is being upgraded (EXPERIMENTAL)
581                 terminate           : The VDU is being terminated
582                 vm-terminate-phase  : The VDU in the VNF is being terminated in VIM.
583                 terminated          : The VDU is in the terminated state.
584                 failed              : The VDU  instantiation failed.
585               ";
586             type vdu-operational-status;
587           }
588
589           uses placement-group-info;
590         }
591
592         list monitoring-param {
593           description
594             "List of monitoring parameters at the network service level";
595           key id;
596           leaf id {
597             type string;
598           }
599
600           leaf name {
601             type string;
602           }
603
604           uses manotypes:monitoring-param-aggregation;
605
606           choice monitoring-type {
607             description
608               "Defines the type of monitoring param to be used:
609                 * vdu-monitorin-param:     VDU-related metric (from NFVI)
610                 * vnf-metric:              VNF-related metric (from VCA)
611                 * vdu-metric:              VDU-related metric (from VCA)
612               ";
613
614             case vdu-monitoring-param {
615               description "VDU-related metric from the infrastructure";
616               container vdu-monitoring-param {
617                 leaf vdu-ref {
618                   type leafref {
619                     path "../../../vdur/id";
620                   }
621                 }
622                 leaf vdu-monitoring-param-ref {
623                   type leafref {
624                     path "../../../vdur[id = current()/../vdu-ref]/monitoring-param/id";
625                   }
626                 }
627               }
628             }
629
630             case vnf-metric {
631               description "VNF-related metric (from VCA)";
632               container vnf-metric {
633                 leaf vnf-metric-name-ref {
634                   type leafref {
635                     path "../../../vnf-configuration/metrics/name";
636                   }
637                 }
638               }
639             }
640
641             case vdu-metric {
642               description "VDU-related metric (from VCA)";
643               container vdu-metric {
644                 leaf vdu-ref {
645                   type leafref {
646                     path "../../../vdur/id";
647                   }
648                 }
649                 leaf vdu-metric-name-ref {
650                   type leafref {
651                     path "../../../vdur[id = current()/../vdu-ref]/vdu-configuration/metrics/name";
652                   }
653                 }
654               }
655             }
656
657           }
658
659         }
660
661         leaf operational-status {
662           description
663             "The operational status of the VNFR instance
664               pre-init            : The VNF before Input Param Substitution.
665               init                : The VNF has just started.
666               vl-init-phase       : The internal VLs in the VNF are being instantiated.
667               vm-init-phase       : The VMs for VDUs in the VNF are being instantiated.
668               running             : The VNF is in running state.
669               terminate           : The VNF is being terminated.
670               vm-terminate-phase  : The VMs in the VNF are being terminated.
671               vl-terminate-phase  : The internal VLs in the VNF are being terminated.
672               terminated          : The VNF is in the terminated state.
673               failed              : The VNF instantiation failed
674             ";
675           type vnf-operational-status;
676         }
677
678         leaf config-status {
679           description
680             "The configuration status of the NS instance
681             configuring: At least one of the VNFs in this instance is in configuring state
682             configured:  All the VNFs in this NS instance are configured or config-not-needed state
683           ";
684
685           type enumeration {
686             enum configuring {
687               value 1;
688             }
689             enum configured {
690               value 2;
691             }
692             enum failed {
693               value 3;
694             }
695             enum config-not-needed {
696               value 4;
697             }
698           }
699         }
700         uses placement-group-info;
701
702         container cloud-config {
703           uses manotypes:cloud-config;
704         }
705       }
706     }
707   }
708 }