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