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