Fix ping pong desc generation error
[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     uses manotypes:ns-service-primitive;
595
596     list initial-config-primitive {
597       rwpb:msg-new NsdInitialConfigPrimitive;
598       description
599         "Initial set of configuration primitives for NSD.";
600       key "seq";
601
602       uses manotypes:initial-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 for VLD for 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 string;
768         }
769       }
770
771     }
772   }
773
774   grouping monitoring-param-common {
775     description
776       "List of monitoring parameters from VNF's that should be
777         propogated up into NSR";
778
779     leaf id {
780       type string;
781     }
782
783     leaf name {
784       type string;
785     }
786
787     uses manotypes:monitoring-param-value;
788     uses manotypes:monitoring-param-ui-data;
789     uses manotypes:monitoring-param-aggregation;
790   }
791 }