Bug 95 Expose mac-address in VNFRs
[osm/SO.git] / models / plugins / 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 vnfd-ref {
203         description "Reference to VNFD";
204         type leafref {
205           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
206         }
207       }
208
209       // Use parameters provided here to configure this VNF
210       uses manotypes:vnf-configuration;
211
212       // Mainly used by Mon-params & dashboard url
213       container mgmt-interface {
214         leaf ip-address {
215           type inet:ip-address;
216         }
217         leaf port {
218           type inet:port-number;
219         }
220       }
221
222       list internal-vlr {
223         key "vlr-ref";
224
225         leaf vlr-ref {
226           description "Reference to a VLR record in the VLR catalog";
227           type leafref {
228             path "/vlr:vlr-catalog/vlr:vlr/vlr:id";
229           }
230         }
231
232         leaf-list internal-connection-point-ref {
233           type leafref {
234             path "../../vdur/internal-connection-point/id";
235           }
236         }
237       }
238
239       list connection-point {
240         key "name";
241         description
242             "List for external connection points. Each VNF has one
243              or more external connection points. As the name
244              implies that external connection points are used for
245              connecting the VNF to other VNFs or to external networks.
246              Each VNF exposes these connection points to the
247              orchestrator. The orchestrator can construct network
248              services by connecting the connection points between
249              different VNFs. The NFVO will use VLDs and VNFFGs at
250              the network service level to construct network services.";
251
252         uses vnfd:common-connection-point;
253
254         leaf vlr-ref {
255           description
256               "Reference to the VLR associated with this connection point";
257           type  leafref {
258             path "/vlr:vlr-catalog/vlr:vlr/vlr:id";
259           }
260         }
261
262         leaf ip-address {
263           description
264               "IP address assigned to the external connection point";
265           type inet:ip-address;
266         }
267         leaf mac-address {
268           description
269               "MAC address assigned to the external connection point";
270           // type inet:mac-address;
271           type string;
272         }
273         leaf connection-point-id {
274           rwpb:field-inline "true";
275           rwpb:field-string-max 64;
276           type string;
277         }
278       }
279
280       list vdur {
281         description "List of Virtual Deployment Units";
282         key "id";
283         unique "name";
284
285         leaf id {
286           description "Unique id for the VDU";
287           type yang:uuid;
288         }
289
290         leaf name {
291           description "name of the instantiated VDUR";
292           type string;
293         }
294
295         leaf vdu-id-ref {
296           type leafref {
297             path "/vnfd:vnfd-catalog/vnfd:vnfd" 
298                + "[vnfd:id = current()/../../vnfr:vnfd-ref]"
299                + "/vnfd:vdu/vnfd:id";
300           }
301         }
302
303         leaf vim-id {
304           description "Allocated VM resource id";
305           type string;
306         }
307
308         leaf flavor-id {
309           description "VIM assigned flavor id";
310           type string;
311         }
312
313         leaf image-id {
314           description "VIM assigned image id";
315           type string;
316         }
317
318         leaf management-ip {
319           description "Management IP address";
320           type inet:ip-address;
321         }
322
323         leaf vm-management-ip {
324           description "VM Private Management IP address";
325           type inet:ip-address;
326         }
327
328         leaf console-url {
329           description "Console URL for this VDU, if available";
330           type inet:uri;
331         }
332
333         uses manotypes:vm-flavor;
334         uses manotypes:guest-epa;
335         uses manotypes:vswitch-epa;
336         uses manotypes:hypervisor-epa;
337         uses manotypes:host-epa;
338
339         list alarms {
340           description
341               "A list of the alarms that have been created for this VDU";
342
343           key "alarm-id";
344           uses manotypes:alarm;
345         }
346
347         list internal-connection-point {
348           key "id";
349           description
350               "List for internal connection points. Each VNFC
351                has zero or more internal connection points.
352                Internal connection points are used for connecting
353                the VNF components internal to the VNF. If a VNF
354                has only one VNFC, it may not have any internal
355                connection points.";
356
357           uses vnfd:common-connection-point;
358
359           leaf ip-address {
360             description
361                 "IP address assigned to the internal connection point";
362             type inet:ip-address;
363           }
364           leaf mac-address {
365             description
366                 "MAC address assigned to the internal connection point";
367             // type inet:mac-address;
368             type string;
369           }
370         }
371
372         list internal-interface {
373           description
374               "List of internal interfaces for the VNF";
375           key name;
376
377           leaf name {
378             description
379                 "Name of internal interface. Note that this
380                  name has only local significance to the VDU.";
381             type string;
382           }
383
384           leaf vdur-internal-connection-point-ref {
385             type leafref {
386               path "../../internal-connection-point/id";
387             }
388           }
389           uses virtual-interface;
390         }
391
392         list external-interface {
393           description
394               "List of external interfaces for the VNF.
395                The external interfaces enable sending
396                traffic to and from VNF.";
397           key name;
398
399           leaf name {
400             description
401                 "Name of the external interface. Note that
402                  this name has only local significance.";
403             type string;
404           }
405
406           leaf vnfd-connection-point-ref {
407             description
408               "Name of the external connection point.";
409             type leafref {
410               path "../../../connection-point/name";
411             }
412           }
413           uses virtual-interface;
414         }
415         leaf operational-status {
416           description
417             "The operational status of the VDU 
418               init                : The VDU has just started.
419               vm-init-phase       : The VDUs in the VNF is being created in VIM.
420               vm-alloc-pending    : The  VM alloc is pending in VIM
421               running             : The VDU is active in VM
422               terminate           : The VDU is being terminated
423               vm-terminate-phase  : The VDU in the VNF is being terminated in VIM.
424               terminated          : The VDU is in the terminated state.
425               failed              : The VDU  instantiation failed.
426             ";
427
428           type enumeration {
429             rwpb:enum-type "VduOperationalStatus";
430             enum init;
431             enum vm-init-phase;
432             enum vm-alloc-pending;
433             enum running;
434             enum terminate;
435             enum vl-terminate-phase;
436             enum terminated;
437             enum failed;
438           }
439         }
440         uses placement-group-info;
441       }
442
443       uses manotypes:monitoring-param;
444
445       leaf operational-status {
446         description
447           "The operational status of the VNFR instance
448             init                : The VNF has just started.
449             vl-init-phase       : The internal VLs in the VNF are being instantiated.
450             vm-init-phase       : The VMs for VDUs in the VNF are being instantiated.
451             running             : The VNF is in running state.
452             terminate           : The VNF is being terminated.
453             vm-terminate-phase  : The VMs in the VNF are being terminated.
454             vl-terminate-phase  : The internal VLs in the VNF are being terminated.
455             terminated          : The VNF is in the terminated state.
456             failed              : The VNF instantiation failed
457           ";
458
459         type enumeration {
460           rwpb:enum-type "VnfrOperationalStatus";
461           enum init;
462           enum vl-init-phase;
463           enum vm-init-phase;
464           enum running;
465           enum terminate;
466           enum vm-terminate-phase;
467           enum vl-terminate-phase;
468           enum terminated;
469           enum failed;
470         }
471       }
472       leaf config-status {
473         description
474           "The configuration status of the NS instance
475             configuring: At least one of the VNFs in this instance is in configuring state
476             configured:  All the VNFs in this NS instance are configured or config-not-needed state
477           ";
478
479         type enumeration {
480           enum configuring {
481             value 1;
482           }
483           enum configured {
484             value 2;
485           }
486           enum failed {
487             value 3;
488           }
489           enum config-not-needed {
490             value 4;
491           }
492         }
493       }
494       uses placement-group-info;
495     }
496   }
497
498   rpc create-alarm {
499     description "Create an alert for a running VDU";
500     input {
501       leaf cloud-account {
502         mandatory true;
503         type string;
504       }
505
506       leaf vdur-id {
507         mandatory true;
508         type string;
509       }
510
511       container alarm {
512         uses manotypes:alarm;
513       }
514     }
515
516     output {
517       leaf alarm-id {
518         type string;
519       }
520     }
521   }
522
523   rpc destroy-alarm {
524     description "Destroy an alert that is associated with a running VDU";
525     input {
526       leaf cloud-account {
527         mandatory true;
528         type string;
529       }
530
531       leaf alarm-id {
532         mandatory true;
533         type string;
534       }
535     }
536   }
537 }
538