schema-version added in VNFD, NSD, VLR, VNFR and NSR
[osm/IM.git] / models / yang / nsd-base.yang
1
2 /*
3  * 
4  *   Copyright 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 nsd-base
22 {
23   namespace "http://riftio.com/ns/riftware-1.0/nsd-base";
24   prefix "nsd-base";
25
26   import ietf-inet-types {
27     prefix "inet";
28   }
29
30   import mano-types {
31     prefix "manotypes";
32   }
33
34   revision 2017-02-28 {
35     description
36       "Initial revision. This YANG file defines
37        the Network Service Descriptor (NSD)
38        common groupings";
39     reference
40       "Derived from earlier versions of base YANG files";
41   }
42
43   typedef scaling-trigger {
44     type enumeration {
45       enum pre-scale-in {
46         value 1;
47       }
48       enum post-scale-in {
49         value 2;
50       }
51       enum pre-scale-out {
52         value 3;
53       }
54       enum post-scale-out {
55         value 4;
56       }
57     }
58   }
59
60   typedef scaling-policy-type {
61     type enumeration {
62       enum manual {
63         value 1;
64       }
65       enum automatic {
66         value 2;
67       }
68     }
69   }
70
71   typedef scaling-criteria-operation {
72     type enumeration {
73       enum AND {
74         value 1;
75       }
76       enum OR {
77         value 2;
78       }
79     }
80   }
81
82   grouping primitive-parameter {
83     leaf name {
84       description
85           "Name of the parameter.";
86       type string;
87     }
88
89     leaf data-type {
90       description
91           "Data type associated with the name.";
92       type manotypes:parameter-data-type;
93     }
94
95     leaf mandatory {
96       description "Is this field mandatory";
97       type boolean;
98       default false;
99     }
100
101     leaf default-value {
102       description "The default value for this field";
103       type string;
104     }
105
106     leaf parameter-pool {
107       description "NSD parameter pool name to use for this parameter";
108       type string;
109     }
110   }
111
112   grouping nsd-descriptor-common {
113     leaf id {
114       description "Identifier for the NSD.";
115       type string {
116         length 1..63;
117       }
118     }
119
120     leaf name {
121       description "NSD name.";
122       mandatory true;
123       type string;
124     }
125
126     leaf short-name {
127       description "Short name to appear as label in the UI";
128       type string;
129     }
130
131     leaf vendor {
132       description "Vendor of the NSD.";
133       type string;
134     }
135
136     leaf logo {
137       description
138         "File path for  the vendor specific logo. For example icons/mylogo.png.
139          The logo  should be part of the network service";
140       type string;
141     }
142
143     leaf description {
144       description "Description of the NSD.";
145       type string;
146     }
147
148     leaf version {
149       description "Version of the NSD";
150       type string;
151     }
152
153     list connection-point {
154       description
155           "List for external connection points.
156           Each NS has one or more external connection
157           points. As the name implies that external
158           connection points are used for connecting
159           the NS to other NS or to external networks.
160           Each NS exposes these connection points to
161           the orchestrator. The orchestrator can
162           construct network service chains by
163           connecting the connection points between
164           different NS.";
165
166       key "name";
167       leaf name {
168         description
169             "Name of the NS connection point.";
170         type string;
171       }
172
173       leaf type {
174         description
175             "Type of the connection point.";
176         type manotypes:connection-point-type;
177       }
178     }
179
180     list scaling-group-descriptor {
181       description
182           "scaling group descriptor within this network service.
183            The scaling group defines a group of VNFs,
184            and the ratio of VNFs in the network service
185            that is used as target for scaling action";
186
187       key "name";
188
189       leaf name {
190         description "Name of this scaling group.";
191         type string;
192       }
193
194       list scaling-policy {
195
196         key "name";
197
198         leaf name {
199           description
200               "Name of the scaling policy";
201           type string;
202         }
203
204         leaf scaling-type {
205           description
206               "Type of scaling";
207           type scaling-policy-type;
208         }
209
210         leaf enabled {
211           description
212             "Specifies if the scaling policy can be applied";
213           type boolean;
214           default true;
215         }
216
217         leaf scale-in-operation-type {
218           description
219               "Operation to be applied to check between scaling criterias to
220                check if the scale in threshold condition has been met.
221                Defaults to AND";
222           type scaling-criteria-operation;
223           default AND;
224         }
225
226         leaf scale-out-operation-type {
227           description
228               "Operation to be applied to check between scaling criterias to
229                check if the scale out threshold condition has been met.
230                Defauls to OR";
231           type scaling-criteria-operation;
232           default OR;
233         }
234
235         leaf threshold-time {
236           description
237             "The duration for which the criteria must hold true";
238           type uint32;
239           mandatory true;
240         }
241
242         leaf cooldown-time {
243           description
244             "The duration after a scaling-in/scaling-out action has been
245             triggered, for which there will be no further optional";
246           type uint32;
247           mandatory true;
248         }
249
250         list scaling-criteria {
251           description
252               "list of conditions to be met for generating scaling
253                  requests";
254           key "name";
255
256           leaf name {
257             type string;
258           }
259
260           leaf scale-in-threshold {
261             description
262                 "Value below which scale-in requests are generated";
263             type uint64;
264           }
265
266           leaf scale-out-threshold {
267             description
268                 "Value above which scale-out requests are generated";
269             type uint64;
270           }
271
272           leaf ns-monitoring-param-ref {
273             description
274                "Reference to the NS level monitoring parameter
275                 that is aggregated";
276             type leafref {
277               path "../../../../monitoring-param/id";
278             }
279           }
280         }
281       }
282
283       list vnfd-member {
284         description "List of VNFs in this scaling group";
285         key "member-vnf-index-ref";
286
287         leaf member-vnf-index-ref {
288           description "member VNF index of this member VNF";
289           type leafref {
290             path "../../../constituent-vnfd/member-vnf-index";
291           }
292         }
293
294         leaf count {
295           description
296             "count of this member VNF  within this scaling group.
297              The count allows to define  the number of instances
298              when a scaling action targets this scaling group";
299           type uint32;
300           default 1;
301         }
302       }
303
304       leaf min-instance-count {
305         description
306           "Minimum instances of the scaling group which are allowed.
307           These instances are created by default when the network service
308           is instantiated.";
309         type uint32;
310         default 0;
311       }
312
313       leaf max-instance-count {
314         description
315           "Maximum instances of this scaling group that are allowed
316            in a single network service. The network service scaling
317            will fail, when the number of service group instances
318            exceed the max-instance-count specified.";
319         type uint32;
320         default 10;
321       }
322
323       list scaling-config-action {
324         description "List of scaling config actions";
325         key "trigger";
326
327         leaf trigger {
328           description "scaling trigger";
329           type scaling-trigger;
330         }
331
332         leaf ns-service-primitive-name-ref {
333           description "Reference to the NS service primitive";
334           type leafref {
335             path "../../../service-primitive/name";
336           }
337         }
338       }
339     }
340
341
342     list vnffgd {
343       description
344           "List of VNF Forwarding Graph Descriptors (VNFFGD).";
345
346       key "id";
347
348       leaf id {
349         description
350             "Identifier for the VNFFGD.";
351         type string;
352       }
353
354       leaf name {
355         description
356             "VNFFGD name.";
357         type string;
358       }
359
360       leaf short-name {
361         description
362             "Short name to appear as label in the UI";
363         type string;
364       }
365
366       leaf vendor {
367         description "Provider of the VNFFGD.";
368         type string;
369       }
370
371       leaf description {
372         description "Description of the VNFFGD.";
373         type string;
374       }
375
376       leaf version {
377         description "Version of the VNFFGD";
378         type string;
379       }
380
381       list rsp {
382         description
383           "List of Rendered Service Paths (RSP).";
384
385         key "id";
386
387         leaf id {
388           description
389             "Identifier for the RSP.";
390           type string;
391         }
392
393         leaf name {
394           description
395             "RSP name.";
396           type string;
397         }
398
399         list vnfd-connection-point-ref {
400           description
401             "A list of references to connection points.";
402           key "member-vnf-index-ref";
403
404           leaf member-vnf-index-ref {
405             description "Reference to member-vnf within constituent-vnfds";
406             type leafref {
407               path "../../../../constituent-vnfd/member-vnf-index";
408             }
409           }
410
411           leaf order {
412             type uint8;
413             description
414               "A number that denotes the order of a VNF in a chain";
415           }
416
417           leaf vnfd-id-ref {
418             description
419               "A reference to a vnfd. This is a
420                   leafref to path:
421                       ../../../../nsd:constituent-vnfd
422                       + [nsd:id = current()/../nsd:id-ref]
423                       + /nsd:vnfd-id-ref";
424
425              type leafref {
426                 path "../../../../constituent-vnfd" +
427                      "[member-vnf-index = current()/../member-vnf-index-ref]" +
428                      "/vnfd-id-ref";
429              }
430            }
431
432           leaf vnfd-connection-point-ref {
433             description
434               "A reference to a connection point name
435                   in a vnfd. This is a leafref to path:
436                       /vnfd:vnfd-catalog/vnfd:vnfd
437                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
438                       + /vnfd:connection-point/vnfd:name
439                   NOTE: An issue with confd is preventing the
440                   use of xpath. Seems to be an issue with leafref
441                   to leafref, whose target is in a different module.
442                   Once that is resolved this will switched to use
443                   leafref";
444             // TODO: Keeping as string as this needs to be
445             // diffenent lvel based of if it is nsd-catalog or
446             // in nsr.
447             // type leafref {
448             //   path "../../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
449             //        "[vnfd:id = current()/../vnfd-id-ref]/" +
450             //        "vnfd:connection-point/vnfd:name";
451             // }
452             type string;
453           }
454         }
455       } //rsp
456
457       list classifier {
458         description
459             "List of classifier rules.";
460
461         key "id";
462
463         leaf id {
464           description
465               "Identifier for the classifier rule.";
466           type string;
467         }
468
469         leaf name {
470           description
471               "Name of the classifier.";
472           type string;
473         }
474
475         leaf rsp-id-ref {
476           description
477               "A reference to the RSP.";
478           type leafref {
479             path "../../rsp/id";
480           }
481         }
482
483         leaf member-vnf-index-ref {
484           description "Reference to member-vnf within constituent-vnfds";
485           type leafref {
486             path "../../../constituent-vnfd/member-vnf-index";
487           }
488         }
489
490         leaf vnfd-id-ref {
491           description
492               "A reference to a vnfd. This is a
493                   leafref to path:
494                       ../../../nsd:constituent-vnfd
495                       + [nsd:id = current()/../nsd:id-ref]
496                       + /nsd:vnfd-id-ref";
497
498           type leafref {
499               path "../../../constituent-vnfd" +
500                    "[member-vnf-index = current()/../member-vnf-index-ref]" +
501                    "/vnfd-id-ref";
502           }
503         }
504
505         leaf vnfd-connection-point-ref {
506           description
507               "A reference to a connection point name
508                   in a vnfd. This is a leafref to path:
509                       /vnfd:vnfd-catalog/vnfd:vnfd
510                       + [vnfd:id = current()/../nsd:vnfd-id-ref]
511                       + /vnfd:connection-point/vnfd:name
512                   NOTE: An issue with confd is preventing the
513                   use of xpath. Seems to be an issue with leafref
514                   to leafref, whose target is in a different module.
515                   Once that is resolved this will switched to use
516                   leafref";
517           // TODO: Keeping as string as this needs to be
518           // diffenent lvel based of if it is nsd-catalog or
519           // in nsr.
520           // type leafref {
521           //     path "../../../../../vnfd:vnfd-catalog/vnfd:vnfd" +
522           //          "[vnfd:id = current()/../vnfd-id-ref]/" +
523           //          "vnfd:connection-point/vnfd:name";
524           // }
525           type string;
526         }
527
528         list match-attributes {
529           description
530               "List of match attributes.";
531
532           key "id";
533
534           leaf id {
535             description
536                 "Identifier for the classifier match attribute rule.";
537             type string;
538           }
539
540           leaf ip-proto {
541             description
542                 "IP Protocol.";
543             type uint8;
544           }
545
546           leaf source-ip-address {
547             description
548                 "Source IP address.";
549             type inet:ip-address;
550           }
551
552           leaf destination-ip-address {
553             description
554                 "Destination IP address.";
555             type inet:ip-address;
556           }
557
558           leaf source-port {
559             description
560                 "Source port number.";
561             type inet:port-number;
562           }
563
564           leaf destination-port {
565             description
566                 "Destination port number.";
567             type inet:port-number;
568           }
569           //TODO: Add more match criteria
570         } //match-attributes
571       } // classifier
572     } // vnffgd
573
574     uses manotypes:ip-profile-list;
575
576     list initial-service-primitive {
577       description
578         "Initial set of service primitives for NSD.";
579       key "seq";
580
581       uses manotypes:event-config;
582     }
583
584     list terminate-service-primitive {
585       description
586         "Set of service primitives during
587          termination for NSD.";
588       key "seq";
589
590       uses manotypes:event-config;
591     }
592
593     uses manotypes:input-parameter-xpath;
594
595     list parameter-pool {
596       description
597         "Pool of parameter values which must be
598          pulled from during configuration";
599       key "name";
600
601       leaf name {
602         description
603             "Name of the configuration value pool";
604         type string;
605       }
606
607       container range {
608         description
609             "Create a range of values to populate the pool with";
610
611         leaf start-value {
612           description
613               "Generated pool values start at this value";
614           type uint32;
615           mandatory true;
616         }
617
618         leaf end-value {
619           description
620               "Generated pool values stop at this value";
621           type uint32;
622           mandatory true;
623         }
624       }
625     }
626
627     list key-pair {
628       key "name";
629       description "Used to configure the list of public keys to be injected as part
630           of ns instantiation";
631
632       leaf name {
633         description "Name of this key pair";
634         type string;
635       }
636
637       leaf key {
638         description "Key associated with this key pair";
639         type string;
640       }
641     }
642
643     list user {
644       key "name";
645       description "List of users to be added through cloud-config";
646
647       leaf name {
648         description "Name of the user ";
649         type string;
650       }
651
652       leaf user-info {
653         description "The user name's real name";
654         type string;
655       }
656
657       list key-pair {
658         key "name";
659         description "Used to configure the list of public keys to be injected as part
660             of ns instantiation";
661
662         leaf name {
663           description "Name of this key pair";
664           type string;
665         }
666
667         leaf key {
668           description "Key associated with this key pair";
669           type string;
670         }
671       }
672     }
673   }
674
675   grouping nsd-vld-common {
676     /* Still having issues modelling this,
677        see the comments under vnfd-connection-point-ref
678     */
679     description
680       "List of Virtual Link Descriptors.";
681
682     leaf id {
683       description
684         "Identifier for the VLD.";
685       type string;
686     }
687
688     leaf name {
689       description
690         "Virtual Link Descriptor (VLD) name.";
691       type string;
692     }
693
694     leaf short-name {
695       description
696         "Short name to appear as label in the UI";
697       type string;
698     }
699
700     leaf vendor {
701       description "Provider of the VLD.";
702       type string;
703     }
704
705     leaf description {
706       description "Description of the VLD.";
707       type string;
708     }
709
710     leaf version {
711       description "Version of the VLD";
712       type string;
713     }
714
715     leaf type {
716       type manotypes:virtual-link-type;
717     }
718
719     leaf root-bandwidth {
720       description
721         "For ELAN this is the aggregate bandwidth.";
722       type uint64;
723     }
724
725     leaf leaf-bandwidth {
726       description
727         "For ELAN this is the bandwidth of branches.";
728       type uint64;
729     }
730
731     // replicate for pnfd container here
732     uses manotypes:provider-network;
733
734     leaf mgmt-network {
735       description "Flag indicating whether this network is a VIM management network";
736       type boolean;
737       default false;
738     }
739
740     choice init-params {
741       description "Extra parameters for VLD instantiation";
742
743       case vim-network-ref {
744         leaf vim-network-name {
745           description
746             "Name of network in VIM account. This is used to indicate
747                    pre-provisioned network name in cloud account.";
748           type string;
749         }
750       }
751
752       case vim-network-profile {
753         leaf ip-profile-ref {
754           description "Named reference to IP-profile object";
755           type leafref {
756             path "../../ip-profiles/name";
757           }
758         }
759       }
760
761     }
762   }
763
764   grouping monitoring-param-common {
765     description
766       "List of monitoring parameters from VNF's that should be
767         propogated up into NSR";
768
769     leaf id {
770       type string;
771     }
772
773     leaf name {
774       type string;
775     }
776
777     uses manotypes:monitoring-param-value;
778     uses manotypes:monitoring-param-ui-data;
779     uses manotypes:monitoring-param-aggregation;
780   }
781 }