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