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